Skip to content

The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu

Install scripts: read BEACON_LOG_ACCESS in any case, as the CLI does

Claude0bb752692216
diff --git a/packaging/linux/install-endpoint.sh b/packaging/linux/install-endpoint.sh
index 88758977..e02598ae 100755
--- a/packaging/linux/install-endpoint.sh
+++ b/packaging/linux/install-endpoint.sh
@@ -47,6 +47,9 @@ BEACON_SPLUNK_CA_FILE="${BEACON_SPLUNK_CA_FILE:-}"
# shared or restricted; empty keeps the mode the endpoint already has, so a package upgrade never
# changes it.
BEACON_LOG_ACCESS="${BEACON_LOG_ACCESS:-}"
+# The CLI takes the mode in any case and ignores surrounding blanks, so the checks below must too:
+# `Restricted` from a settings file installs a restricted log, and has to add its readers.
+BEACON_LOG_ACCESS="$(printf '%s' "$BEACON_LOG_ACCESS" | tr '[:upper:]' '[:lower:]' | tr -d '[:space:]')"
# A first install from the package defaults to restricted: a package is installed by root for the
# whole machine, often by a configuration manager across a fleet, and that is the install that
# should make the collector the only writer of the system log without a second step.
diff --git a/packaging/linux/test-endpoint-scripts.sh b/packaging/linux/test-endpoint-scripts.sh
index a6988965..3b768fe4 100644
--- a/packaging/linux/test-endpoint-scripts.sh
+++ b/packaging/linux/test-endpoint-scripts.sh
@@ -287,6 +287,18 @@ run_install SUDO_USER=alice BEACON_INSTALL_TTY=1 BEACON_LOG_ACCESS=shared
has_flag --log-readers && fail "shared first install by sudo passed --log-readers"
run_install SUDO_USER=alice BEACON_INSTALL_TTY=1 BEACON_LOG_READERS=
has_flag --log-readers && fail "BEACON_LOG_READERS= (nobody) still added the sudo user"
+# The CLI takes the mode in any case, so the script must too: a restricted log from `Restricted`
+# still adds the person who installed it.
+run_install SUDO_USER=alice BEACON_INSTALL_TTY=1 BEACON_LOG_ACCESS=' Restricted '
+expect_readers alice "first install by sudo with BEACON_LOG_ACCESS=Restricted"
+expect_log_access restricted "BEACON_LOG_ACCESS=Restricted"
+printf 'BEACON_LOG_ACCESS=RESTRICTED\n' >"$DEFAULTS"
+run_install BEACON_DEFAULTS_FILE="$DEFAULTS" SUDO_USER=alice BEACON_INSTALL_TTY=1
+expect_readers alice "defaults file BEACON_LOG_ACCESS=RESTRICTED"
+printf 'BEACON_LOG_ACCESS=Shared\n' >"$DEFAULTS"
+run_install BEACON_DEFAULTS_FILE="$DEFAULTS" SUDO_USER=alice BEACON_INSTALL_TTY=1
+has_flag --log-readers && fail "defaults file BEACON_LOG_ACCESS=Shared passed --log-readers"
+rm -f "$DEFAULTS"
run_install SUDO_USER=alice BEACON_LOG_READERS=svc_splunk,bob
expect_readers svc_splunk,bob "BEACON_LOG_READERS over the sudo user"
printf 'BEACON_LOG_READERS= # fleet: nobody implicitly\n' >"$DEFAULTS"
diff --git a/packaging/macos/install-endpoint.sh b/packaging/macos/install-endpoint.sh
index 214f6613..c10ec779 100755
--- a/packaging/macos/install-endpoint.sh
+++ b/packaging/macos/install-endpoint.sh
@@ -52,6 +52,9 @@ BEACON_FALCON_CA_FILE="${BEACON_FALCON_CA_FILE:-}"
# shared or restricted; empty keeps the mode the endpoint already has, so a package upgrade never
# changes it.
BEACON_LOG_ACCESS="${BEACON_LOG_ACCESS:-}"
+# The CLI takes the mode in any case and ignores surrounding blanks, so the checks below must too:
+# `Restricted` from a settings file installs a restricted log, and has to add its readers.
+BEACON_LOG_ACCESS="$(printf '%s' "$BEACON_LOG_ACCESS" | tr '[:upper:]' '[:lower:]' | tr -d '[:space:]')"
# A first install from the package defaults to restricted, as on Linux and Windows: a package is
# installed by an administrator for the whole machine, often by an MDM across a fleet, and that is
# the install that should make the collector the only writer of the system log without a second
diff --git a/packaging/macos/test-install-settings.sh b/packaging/macos/test-install-settings.sh
index 8005a976..ea79d93e 100644
--- a/packaging/macos/test-install-settings.sh
+++ b/packaging/macos/test-install-settings.sh
@@ -131,6 +131,12 @@ run_install BEACON_INSTALLER_GUI=1 BEACON_CONSOLE_USER=loginwindow
has_flag --log-readers && fail "loginwindow added as a reader"
run_install BEACON_INSTALLER_GUI=1 BEACON_CONSOLE_USER=alice BEACON_LOG_ACCESS=shared
has_flag --log-readers && fail "shared install added a reader"
+# The CLI takes the mode in any case, so the script must too.
+run_install BEACON_INSTALLER_GUI=1 BEACON_CONSOLE_USER=alice BEACON_LOG_ACCESS=' Restricted '
+expect --log-readers alice "Installer.app first install with BEACON_LOG_ACCESS=Restricted"
+expect --log-access restricted "BEACON_LOG_ACCESS=Restricted"
+run_install BEACON_INSTALLER_GUI=1 BEACON_CONSOLE_USER=alice BEACON_LOG_ACCESS=SHARED
+has_flag --log-readers && fail "BEACON_LOG_ACCESS=SHARED install added a reader"
run_install BEACON_INSTALLER_GUI=1 BEACON_CONSOLE_USER=alice BEACON_LOG_READERS=
has_flag --log-readers && fail "BEACON_LOG_READERS= still added the installing person"
printf 'BEACON_LOG_READERS=\n' >"$MANAGED.plist"