fix: suppress chrome first-run prompts
This commit is contained in:
parent
4e5ce36538
commit
5d459e0da1
@ -11,6 +11,7 @@
|
||||
|
||||
- Fixed auto-shell command reconstruction so arguments with spaces stay quoted when shell operators such as `&&` are present.
|
||||
- Fixed Windows WebVNC credential handling so generated portal links preserve special characters and managed TightVNC sessions copy service passwords into the logged-in user's registry profile.
|
||||
- Fixed managed Linux browser setup so Chrome/Chromium launches skip first-run and default-browser prompts.
|
||||
|
||||
## 0.5.0 - 2026-05-04
|
||||
|
||||
|
||||
@ -120,6 +120,8 @@ already made that endpoint reachable on a trusted network.
|
||||
|
||||
`--browser` guarantees a browser binary and env such as `BROWSER` and
|
||||
`CHROME_BIN`; it does not create, unlock, sync, or migrate a logged-in profile.
|
||||
On managed Linux leases, these env vars point to a Crabbox wrapper that disables
|
||||
Chrome/Chromium first-run and default-browser prompts for repeatable VNC use.
|
||||
On managed targets, manual browser login through VNC lasts only for that lease
|
||||
unless the caller intentionally exports an artifact. On static hosts, any
|
||||
existing browser profile belongs to that host.
|
||||
|
||||
@ -562,7 +562,18 @@ func cloudInitOptionalBootstrap(cfg Config) string {
|
||||
fi
|
||||
fi
|
||||
if [ -n "$browser_path" ]; then
|
||||
printf 'CHROME_BIN=%s\nBROWSER=%s\n' "$browser_path" "$browser_path" > /var/lib/crabbox/browser.env
|
||||
browser_wrapper=/usr/local/bin/crabbox-browser
|
||||
install -d -m 0755 /etc/opt/chrome/policies/managed /etc/chromium/policies/managed
|
||||
cat > /etc/opt/chrome/policies/managed/crabbox.json <<'EOF'
|
||||
{"DefaultBrowserSettingEnabled":false,"MetricsReportingEnabled":false,"PromotionalTabsEnabled":false}
|
||||
EOF
|
||||
cp /etc/opt/chrome/policies/managed/crabbox.json /etc/chromium/policies/managed/crabbox.json
|
||||
cat > "$browser_wrapper" <<EOF
|
||||
#!/bin/sh
|
||||
exec "$browser_path" --no-first-run --no-default-browser-check --disable-default-apps "\$@"
|
||||
EOF
|
||||
chmod 0755 "$browser_wrapper"
|
||||
printf 'CHROME_BIN=%s\nBROWSER=%s\n' "$browser_wrapper" "$browser_wrapper" > /var/lib/crabbox/browser.env
|
||||
chown crabbox:crabbox /var/lib/crabbox/browser.env
|
||||
chmod 0644 /var/lib/crabbox/browser.env
|
||||
fi`)
|
||||
|
||||
@ -72,6 +72,9 @@ func TestCloudInitBrowserProfile(t *testing.T) {
|
||||
"google-chrome-stable",
|
||||
"apt-cache show chromium",
|
||||
"apt-cache show chromium-browser",
|
||||
"/etc/opt/chrome/policies/managed/crabbox.json",
|
||||
"/usr/local/bin/crabbox-browser",
|
||||
"--no-first-run --no-default-browser-check --disable-default-apps",
|
||||
"/var/lib/crabbox/browser.env",
|
||||
"test -x \"$BROWSER\"",
|
||||
"\"$BROWSER\" --version >/dev/null",
|
||||
|
||||
@ -442,7 +442,18 @@ function optionalBootstrap(config: LeaseConfig): string {
|
||||
fi
|
||||
fi
|
||||
if [ -n "$browser_path" ]; then
|
||||
printf 'CHROME_BIN=%s\\nBROWSER=%s\\n' "$browser_path" "$browser_path" > /var/lib/crabbox/browser.env
|
||||
browser_wrapper=/usr/local/bin/crabbox-browser
|
||||
install -d -m 0755 /etc/opt/chrome/policies/managed /etc/chromium/policies/managed
|
||||
cat > /etc/opt/chrome/policies/managed/crabbox.json <<'EOF'
|
||||
{"DefaultBrowserSettingEnabled":false,"MetricsReportingEnabled":false,"PromotionalTabsEnabled":false}
|
||||
EOF
|
||||
cp /etc/opt/chrome/policies/managed/crabbox.json /etc/chromium/policies/managed/crabbox.json
|
||||
cat > "$browser_wrapper" <<EOF
|
||||
#!/bin/sh
|
||||
exec "$browser_path" --no-first-run --no-default-browser-check --disable-default-apps "\\$@"
|
||||
EOF
|
||||
chmod 0755 "$browser_wrapper"
|
||||
printf 'CHROME_BIN=%s\\nBROWSER=%s\\n' "$browser_wrapper" "$browser_wrapper" > /var/lib/crabbox/browser.env
|
||||
chown crabbox:crabbox /var/lib/crabbox/browser.env
|
||||
chmod 0644 /var/lib/crabbox/browser.env
|
||||
fi`);
|
||||
|
||||
@ -95,6 +95,9 @@ describe("cloud-init bootstrap", () => {
|
||||
expect(got).toContain("google-chrome-stable");
|
||||
expect(got).toContain("apt-cache show chromium");
|
||||
expect(got).toContain("apt-cache show chromium-browser");
|
||||
expect(got).toContain("/etc/opt/chrome/policies/managed/crabbox.json");
|
||||
expect(got).toContain("/usr/local/bin/crabbox-browser");
|
||||
expect(got).toContain("--no-first-run --no-default-browser-check --disable-default-apps");
|
||||
expect(got).toContain("/var/lib/crabbox/browser.env");
|
||||
expect(got).toContain('test -x "$BROWSER"');
|
||||
expect(got).toContain('"$BROWSER" --version >/dev/null');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user