The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu
Go agent-ai-cliagent-harnessesagent-securitybrowser-extensionciclaude-codecloudcodexcursordetection-engineeringjevknowledge-basememorymobile-device-managementobservabilitysecuritysecurity-information-and-event-managementsecurity-toolstelemetrytraces
Configure and report every logged-in user on a root system install
Claude23bd95ec07a6
diff --git a/cli/beacon/cmd/endpoint_console_user_test.go b/cli/beacon/cmd/endpoint_console_user_test.goindex 0b3a4b6a..91b1fc5d 100644--- a/cli/beacon/cmd/endpoint_console_user_test.go+++ b/cli/beacon/cmd/endpoint_console_user_test.go@@ -282,3 +282,110 @@ func TestLinuxActiveConsoleUserIgnoresClosingSessions(t *testing.T) {t.Errorf("resolved %+v from a closing session", info)}}++// A system install configures every person logged in, not only the one at the keyboard: one+// collector and one log serve everyone on the machine, and the people a root install skipped+// exported nowhere without anything saying so.+func TestActiveConsoleUsersListsEveryLoggedInAccountOnce(t *testing.T) {+ if runtime.GOOS != "linux" {+ t.Skip("linux-only resolution")+ }+ t.Setenv("SUDO_USER", "")+ stubLookup(t)+ fakeLoginctl(t, []fakeSession{+ {id: "11", user: "remoteuser", seat: "", state: "active"},+ {id: "9", user: "desktop", seat: "seat0", state: "online"},+ {id: "12", user: "desktop", seat: "", state: "active"},+ {id: "4", user: "leaving", seat: "seat0", state: "closing"},+ })++ users, err := defaultActiveConsoleUsers()+ if err != nil {+ t.Fatal(err)+ }+ var names []string+ for _, u := range users {+ names = append(names, u.Username)+ }+ if got, want := strings.Join(names, ","), "desktop,remoteuser"; got != want {+ t.Fatalf("users = %s, want %s: every live login once, the person at the machine first", got, want)+ }+ // The first entry is what activeConsoleUser answers, so callers that read one person's session+ // stores and callers that configure everyone agree on who comes first.+ first, ok, err := linuxActiveConsoleUser()+ if err != nil || !ok || first.Username != users[0].Username {+ t.Fatalf("linuxActiveConsoleUser() = %+v, %v, %v; want %s", first, ok, err, users[0].Username)+ }+}++// sudo names the person who ran the install; they are configured first, and everyone else logged in+// is still configured after them.+func TestActiveConsoleUsersPutsTheSudoUserFirst(t *testing.T) {+ if runtime.GOOS != "linux" {+ t.Skip("linux-only resolution")+ }+ t.Setenv("SUDO_USER", "installer")+ stubLookup(t)+ fakeLoginctl(t, []fakeSession{+ {id: "9", user: "desktop", seat: "seat0", state: "active"},+ {id: "10", user: "installer", seat: "", state: "active"},+ })++ users, err := defaultActiveConsoleUsers()+ if err != nil {+ t.Fatal(err)+ }+ var names []string+ for _, u := range users {+ names = append(names, u.Username)+ }+ if got, want := strings.Join(names, ","), "installer,desktop"; got != want {+ t.Fatalf("users = %s, want %s", got, want)+ }+}++// root and accounts with nowhere to put a settings file are skipped, as activeConsoleUser skips+// them, and a lookup that fails for one person does not hide the others.+func TestActiveConsoleUsersSkipsTheUnresolvable(t *testing.T) {+ if runtime.GOOS != "linux" {+ t.Skip("linux-only resolution")+ }+ t.Setenv("SUDO_USER", "")+ restore := lookupConsoleUser+ lookupConsoleUser = func(name string) (consoleUserInfo, bool, error) {+ switch name {+ case "root", "nohome":+ return consoleUserInfo{}, false, nil+ case "broken":+ return consoleUserInfo{}, false, fmt.Errorf("directory service timed out")+ }+ return consoleUserInfo{Username: name, HomeDir: "/home/" + name}, true, nil+ }+ t.Cleanup(func() { lookupConsoleUser = restore })+ fakeLoginctl(t, []fakeSession{+ {id: "1", user: "root", seat: "seat0", state: "active"},+ {id: "2", user: "broken", seat: "seat0", state: "online"},+ {id: "3", user: "nohome", seat: "", state: "active"},+ {id: "4", user: "alice", seat: "", state: "active"},+ })++ users, err := defaultActiveConsoleUsers()+ if err != nil {+ t.Fatalf("err = %v; one person's failed lookup must not fail the others", err)+ }+ if len(users) != 1 || users[0].Username != "alice" {+ t.Fatalf("users = %+v, want only alice", users)+ }++ // With nobody resolvable, the lookup error is what explains it.+ fakeLoginctl(t, []fakeSession{{id: "2", user: "broken", seat: "seat0", state: "online"}})+ if users, err := defaultActiveConsoleUsers(); err == nil || len(users) != 0 {+ t.Fatalf("users, err = %+v, %v; want the lookup error when nobody resolved", users, err)+ }++ // No logind and no sudo is a skip, not an error.+ t.Setenv("PATH", t.TempDir())+ if users, err := defaultActiveConsoleUsers(); err != nil || len(users) != 0 {+ t.Fatalf("users, err = %+v, %v; want none and no error without logind", users, err)+ }+}diff --git a/cli/beacon/cmd/endpoint_hooks_repair.go b/cli/beacon/cmd/endpoint_hooks_repair.goindex 95ebc423..773366da 100644--- a/cli/beacon/cmd/endpoint_hooks_repair.go+++ b/cli/beacon/cmd/endpoint_hooks_repair.go@@ -3,6 +3,7 @@ package cmdimport ("context""encoding/json"+ "errors""fmt""os""os/exec"@@ -41,6 +42,8 @@ type endpointHookRepairResult struct {var (activeConsoleUser = defaultActiveConsoleUser+ // activeConsoleUsers is everyone a system install configures; see defaultActiveConsoleUsers.+ activeConsoleUsers = defaultActiveConsoleUsers// lookupConsoleUser is a seam so the SUDO_USER-before-logind ordering can be tested without// depending on which accounts happen to exist on the machine running the tests -- as root in// a container, the obvious test skips, which left the ordering unverified.@@ -234,6 +237,20 @@ func linuxActiveConsoleUser() (consoleUserInfo, bool, error) {if u := strings.TrimSpace(os.Getenv("SUDO_USER")); u != "" {return lookupConsoleUser(u)}+ for _, name := range logindSessionUsers() {+ if info, ok, err := lookupConsoleUser(name); ok || err != nil {+ return info, ok, err+ }+ }+ return consoleUserInfo{}, false, nil+}++// logindSessionUsers lists the account names of the live logind sessions, best answer first:+// someone at the machine in the foreground, then anyone at the machine, then a remote login. Ranked+// rather than filtered -- a remote session is still a real human whose agent runs on this host, so+// it is the right answer when it is the only one. Names repeat when one account has several+// sessions; callers resolve and deduplicate. Empty when logind is absent or refuses.+func logindSessionUsers() []string {// The session table is used only to enumerate ids. Every other column is read back through// `show-session`, which reports `Key=Value` lines -- unambiguous, self-labeling, and free of the// table's placeholders.@@ -247,7 +264,7 @@ func linuxActiveConsoleUser() (consoleUserInfo, bool, error) {if err != nil {// No logind, or it refused. Not an error worth failing an install over: this is a// best-effort identification, and the caller already handles "unknown".- return consoleUserInfo{}, false, nil+ return nil}var sessions []logindSessionfor _, line := range strings.Split(string(out), "\n") {@@ -259,16 +276,59 @@ func linuxActiveConsoleUser() (consoleUserInfo, bool, error) {sessions = append(sessions, s)}}- // Best answer first: someone at the machine in the foreground, then anyone at the machine, then- // a remote login. Ranked rather than filtered -- a remote session is still a real human whose- // agent runs on this host, so it is the right answer when it is the only one.sort.SliceStable(sessions, func(i, j int) bool { return sessions[i].rank() > sessions[j].rank() })+ names := make([]string, 0, len(sessions))for _, sess := range sessions {- if info, ok, err := lookupConsoleUser(sess.user); ok || err != nil {- return info, ok, err+ names = append(names, sess.user)+ }+ return names+}++// defaultActiveConsoleUsers resolves every person whose agent runtime a system install should reach.+//+// activeConsoleUser answers "who is at the keyboard", which is right for reading one person's+// session stores. Configuring runtimes is a different question: a machine several people log in+// to -- a shared workstation, or staff signing in to someone else's machine -- has one collector and+// one log for all of them, and a root install (a package postinstall, a configuration manager)+// that configured only the top-ranked session left everyone else exporting nowhere, silently.+//+// On Linux that is the installing sudo user, then every account with a live logind session, each+// once, in activeConsoleUser's order, so the first entry is always what activeConsoleUser returns.+// macOS and Windows have one console user at a time and keep that single answer. An account that+// cannot be resolved (root, no home, a directory service that does not answer) is skipped, as+// activeConsoleUser skips it; an error is returned only when nobody could be resolved.+func defaultActiveConsoleUsers() ([]consoleUserInfo, error) {+ if runtime.GOOS != "linux" {+ info, ok, err := activeConsoleUser()+ if err != nil || !ok {+ return nil, err}+ return []consoleUserInfo{info}, nil}- return consoleUserInfo{}, false, nil+ var candidates []string+ if u := strings.TrimSpace(os.Getenv("SUDO_USER")); u != "" {+ candidates = append(candidates, u)+ }+ candidates = append(candidates, logindSessionUsers()...)+ var users []consoleUserInfo+ var errs []error+ seen := map[string]bool{}+ for _, name := range candidates {+ info, ok, err := lookupConsoleUser(name)+ if err != nil {+ errs = append(errs, err)+ continue+ }+ if !ok || seen[info.Username] {+ continue+ }+ seen[info.Username] = true+ users = append(users, info)+ }+ if len(users) == 0 && len(errs) > 0 {+ return nil, errors.Join(errs...)+ }+ return users, nil}// logindSession is what one session says about itself.diff --git a/cli/beacon/cmd/endpoint_test.go b/cli/beacon/cmd/endpoint_test.goindex 8d578c55..eb251ca7 100644--- a/cli/beacon/cmd/endpoint_test.go+++ b/cli/beacon/cmd/endpoint_test.go@@ -302,9 +302,7 @@ func TestRepairInstalledEndpointUserConfigConfiguresNativeAndHooks(t *testing.T)loadConfigForUserRepair = func(userMode bool, logPath string) endpointconfig.Config {return endpointconfig.Default(userMode, logPath)}- activeConsoleUser = func() (consoleUserInfo, bool, error) {- return consoleUserInfo{Username: "alice", HomeDir: home}, true, nil- }+ stubConsoleUsers(t, consoleUserInfo{Username: "alice", HomeDir: home})var repairArgs []stringrunHookRepairAsUser = func(info consoleUserInfo, args ...string) error {if info.Username != "alice" || info.HomeDir != home {@@ -401,9 +399,7 @@ func TestRepairInstalledEndpointUserConfigAllowsNativeOnlyHarness(t *testing.T)endpointOpts.userMode = trueendpointOpts.systemMode = trueendpointOpts.hookHarnesses = "gemini"- activeConsoleUser = func() (consoleUserInfo, bool, error) {- return consoleUserInfo{Username: "alice", HomeDir: home}, true, nil- }+ stubConsoleUsers(t, consoleUserInfo{Username: "alice", HomeDir: home})runHookRepairAsUser = func(info consoleUserInfo, args ...string) error {t.Fatalf("native-only Gemini repair should not invoke hook repair, args=%v", args)return nil@@ -439,9 +435,7 @@ func TestRepairInstalledEndpointUserConfigHonorsHookOnlyAliases(t *testing.T) {endpointOpts.userMode = trueendpointOpts.systemMode = trueendpointOpts.hookHarnesses = "claude-hooks"- activeConsoleUser = func() (consoleUserInfo, bool, error) {- return consoleUserInfo{Username: "alice", HomeDir: home}, true, nil- }+ stubConsoleUsers(t, consoleUserInfo{Username: "alice", HomeDir: home})var repairArgs []stringrunHookRepairAsUser = func(info consoleUserInfo, args ...string) error {repairArgs = append([]string(nil), args...)@@ -2037,3 +2031,116 @@ func TestEndpointInstallHookFailureIsAWarningAndOtherHooksStillInstall(t *testint.Fatalf("a settings file the merge cannot read must be left untouched, got %s", data)}}++// stubConsoleUsers makes users the people a system install resolves: the first is the console user,+// and all of them are who repair-installed configures.+func stubConsoleUsers(t *testing.T, users ...consoleUserInfo) {+ t.Helper()+ oldUser, oldUsers := activeConsoleUser, activeConsoleUsers+ t.Cleanup(func() { activeConsoleUser, activeConsoleUsers = oldUser, oldUsers })+ activeConsoleUser = func() (consoleUserInfo, bool, error) {+ if len(users) == 0 {+ return consoleUserInfo{}, false, nil+ }+ return users[0], true, nil+ }+ activeConsoleUsers = func() ([]consoleUserInfo, error) {+ return append([]consoleUserInfo(nil), users...), nil+ }+}++// Every logged-in person is configured, each in their own home and as themselves, and one person's+// failure neither stops the others nor goes unreported.+func TestRepairInstalledEndpointUserConfigConfiguresEveryLoggedInUser(t *testing.T) {+ writeNativeConfigInProcess(t)+ oldOpts := endpointOpts+ oldRunHookRepairAsUser := runHookRepairAsUser+ oldLoadConfigForUserRepair := loadConfigForUserRepair+ t.Cleanup(func() {+ endpointOpts = oldOpts+ runHookRepairAsUser = oldRunHookRepairAsUser+ loadConfigForUserRepair = oldLoadConfigForUserRepair+ })+ logPath := filepath.Join(t.TempDir(), "runtime.jsonl")+ endpointOpts.userMode = true+ endpointOpts.systemMode = true+ endpointOpts.logPath = logPath+ endpointOpts.hookHarnesses = ""+ endpointOpts.hookLevel = "user"+ loadConfigForUserRepair = func(userMode bool, logPath string) endpointconfig.Config {+ return endpointconfig.Default(userMode, logPath)+ }+ alice := consoleUserInfo{Username: "alice", HomeDir: t.TempDir()}+ bob := consoleUserInfo{Username: "bob", HomeDir: t.TempDir()}+ carol := consoleUserInfo{Username: "carol", HomeDir: t.TempDir()}+ stubConsoleUsers(t, alice, bob, carol)+ hooked := map[string]string{}+ runHookRepairAsUser = func(info consoleUserInfo, args ...string) error {+ if info.Username == "bob" {+ return fmt.Errorf("refresh hooks for bob: runuser refused")+ }+ hooked[info.Username] = strings.Join(args, " ")+ return nil+ }++ result, err := repairInstalledEndpointUserConfig()+ if err == nil || !strings.Contains(err.Error(), "bob") {+ t.Fatalf("err = %v, want bob's failure reported", err)+ }+ if len(result.Users) != 3 {+ t.Fatalf("users = %+v, want alice, bob and carol", result.Users)+ }+ for _, u := range []consoleUserInfo{alice, carol} {+ if !strings.Contains(hooked[u.Username], "--harness claude,codex,cursor") {+ t.Errorf("%s hooks = %q, want the default hook targets installed", u.Username, hooked[u.Username])+ }+ settings, err := os.ReadFile(filepath.Join(u.HomeDir, ".claude", "settings.json"))+ if err != nil || !strings.Contains(string(settings), "127.0.0.1:4317") {+ t.Errorf("%s's Claude Code settings do not point at the collector: %v %s", u.Username, err, settings)+ }+ }+ if result.Users[1].User != "bob" || result.Users[1].Error == "" {+ t.Errorf("bob's entry = %+v, want his error", result.Users[1])+ }+ if result.Users[2].User != "carol" || result.Users[2].Error != "" {+ t.Errorf("carol's entry = %+v, want configured after bob failed", result.Users[2])+ }+ // The single-user fields still describe the first person, for readers of the older shape.+ if result.User != "alice" || result.HomeDir != alice.HomeDir || strings.Join(result.HookTargets, ",") != "claude,codex,cursor" {+ t.Errorf("top-level result = %+v, want alice's", result)+ }++ var out strings.Builder+ reportUserConfigRepair(&out, result)+ text := out.String()+ for _, want := range []string{+ "Configured alice (" + alice.HomeDir + "): telemetry for claude, codex; hooks for claude, codex, cursor, writing to " + logPath,+ "Could not configure bob (" + bob.HomeDir + "): refresh hooks for bob: runuser refused",+ "Configured carol (" + carol.HomeDir + ")",+ } {+ if !strings.Contains(text, want) {+ t.Errorf("report missing %q:\n%s", want, text)+ }+ }+}++// With nobody to configure the command says so and says what to run, instead of printing nothing+// after a package install that otherwise reported success.+func TestRepairInstalledEndpointUserConfigReportsNobodyToConfigure(t *testing.T) {+ oldOpts := endpointOpts+ t.Cleanup(func() { endpointOpts = oldOpts })+ endpointOpts.userMode = true+ endpointOpts.systemMode = true+ stubConsoleUsers(t)++ result, err := repairInstalledEndpointUserConfig()+ if err != nil || result.SkippedReason != "no_active_console_user" {+ t.Fatalf("result, err = %+v, %v; want a no_active_console_user skip", result, err)+ }+ var out strings.Builder+ reportUserConfigRepair(&out, result)+ if !strings.Contains(out.String(), "No logged-in user to configure") ||+ !strings.Contains(out.String(), "sudo beacon endpoint user-config repair-installed --system") {+ t.Fatalf("report = %q, want the skip explained with the command to run", out.String())+ }+}diff --git a/cli/beacon/cmd/endpoint_user_config.go b/cli/beacon/cmd/endpoint_user_config.goindex f887ac3a..7d11cffd 100644--- a/cli/beacon/cmd/endpoint_user_config.go+++ b/cli/beacon/cmd/endpoint_user_config.go@@ -4,7 +4,9 @@ import ("bytes""context""encoding/json"+ "errors""fmt"+ "io""os""path/filepath""runtime"@@ -41,6 +43,12 @@ type endpointUserConfigRepairResult struct {NativeConfigPaths []string `json:"native_config_paths,omitempty"`HookTargets []string `json:"hook_targets,omitempty"`SkippedReason string `json:"skipped_reason,omitempty"`+ // Users holds one result per person configured, in the order they were resolved. The fields+ // above repeat the first of them, which is who this command configured when it configured only+ // one person, so a reader of the older single-user shape keeps working.+ Users []endpointUserConfigRepairResult `json:"users,omitempty"`+ // Error says why configuring this person failed, in a Users entry.+ Error string `json:"error,omitempty"`}type userConfigTargets struct {@@ -54,19 +62,50 @@ func runEndpointUserConfigRepairInstalled(cmd *cobra.Command, args []string) errresult, err := repairInstalledEndpointUserConfig()if endpointOpts.jsonOutput {_ = json.NewEncoder(cmd.OutOrStdout()).Encode(result)+ } else {+ reportUserConfigRepair(cmd.OutOrStdout(), result)}return err}+// reportUserConfigRepair says, in words, whose agent runtimes a root install pointed at the+// collector. A package postinstall runs as root, and the lines `endpoint install` prints before this+// describe root's own settings, so without this the install read as a success that had configured+// nobody who uses the machine -- or did configure them and never said so.+func reportUserConfigRepair(w io.Writer, result endpointUserConfigRepairResult) {+ if result.SkippedReason == "no_active_console_user" {+ fmt.Fprintln(w, "No logged-in user to configure: nobody is logged in, or only root is, so no one's agent runtime points at the collector yet.")+ fmt.Fprintln(w, "Each person who runs agents on this machine configures themselves once, logged in: sudo beacon endpoint user-config repair-installed --system")+ return+ }+ for _, user := range result.Users {+ if user.Error != "" {+ fmt.Fprintf(w, "Could not configure %s (%s): %s\n", user.User, user.HomeDir, user.Error)+ continue+ }+ parts := []string{}+ if len(user.NativeConfigTargets) > 0 {+ parts = append(parts, "telemetry for "+strings.Join(user.NativeConfigTargets, ", "))+ }+ if len(user.HookTargets) > 0 {+ parts = append(parts, "hooks for "+strings.Join(user.HookTargets, ", "))+ }+ if len(parts) == 0 {+ parts = append(parts, "nothing to configure")+ }+ fmt.Fprintf(w, "Configured %s (%s): %s, writing to %s\n", user.User, user.HomeDir, strings.Join(parts, "; "), user.RuntimeLogPath)+ }+}+func repairInstalledEndpointUserConfig() (endpointUserConfigRepairResult, error) {if endpointUserMode() {return endpointUserConfigRepairResult{SkippedReason: "requires_system_endpoint"}, fmt.Errorf("endpoint user-config repair-installed is intended for system endpoint installs; pass --system")}- info, ok, err := activeConsoleUser()+ users, err := activeConsoleUsers()if err != nil {return endpointUserConfigRepairResult{}, err}- if !ok {+ if len(users) == 0 {return endpointUserConfigRepairResult{SkippedReason: "no_active_console_user"}, nil}@@ -85,25 +124,41 @@ func repairInstalledEndpointUserConfig() (endpointUserConfigRepairResult, error)}}+ // One person's broken home (a config file they made unparseable, a launcher that refuses them)+ // must not leave everyone after them unconfigured, so each is attempted and the failures are+ // reported together.+ var result endpointUserConfigRepairResult+ var errs []error+ for _, info := range users {+ one, err := repairEndpointUserConfigFor(info, cfg, targets)+ if err != nil {+ one.Error = err.Error()+ errs = append(errs, err)+ }+ result.Users = append(result.Users, one)+ }+ first := result.Users[0]+ result.User, result.HomeDir, result.RuntimeLogPath = first.User, first.HomeDir, first.RuntimeLogPath+ result.NativeConfigTargets, result.NativeConfigPaths, result.HookTargets = first.NativeConfigTargets, first.NativeConfigPaths, first.HookTargets+ return result, errors.Join(errs...)+}++// repairEndpointUserConfigFor points one person's runtimes at the collector.+func repairEndpointUserConfigFor(info consoleUserInfo, cfg endpointconfig.Config, targets userConfigTargets) (endpointUserConfigRepairResult, error) {+ result := endpointUserConfigRepairResult{User: info.Username, HomeDir: info.HomeDir, RuntimeLogPath: cfg.LogPath}nativeTargets, nativePaths, err := repairNativeRuntimeConfigForUser(info, cfg, targets.native)+ result.NativeConfigTargets, result.NativeConfigPaths = nativeTargets, nativePathsif err != nil {- return endpointUserConfigRepairResult{}, err+ return result, err}- var hookTargets []stringif len(targets.hooks) > 0 {- hookTargets, err = repairHookTargetsForUser(info, cfg.LogPath, targets.hooks)+ hookTargets, err := repairHookTargetsForUser(info, cfg.LogPath, targets.hooks)+ result.HookTargets = hookTargetsif err != nil {- return endpointUserConfigRepairResult{}, err+ return result, err}}- return endpointUserConfigRepairResult{- User: info.Username,- HomeDir: info.HomeDir,- RuntimeLogPath: cfg.LogPath,- NativeConfigTargets: nativeTargets,- NativeConfigPaths: nativePaths,- HookTargets: hookTargets,- }, nil+ return result, nil}func resolveUserConfigTargets(values []string) (userConfigTargets, error) {diff --git a/docs/changelog/cli.mdx b/docs/changelog/cli.mdxindex 56f02768..6b61a4dc 100644--- a/docs/changelog/cli.mdx+++ b/docs/changelog/cli.mdx@@ -11,6 +11,7 @@ Stay up to date with the latest changes to the Agent Beacon CLI.## Unreleased+- **Root and fleet installs configure everyone logged in, and say who** · A system install by root with no `sudo` user, such as Salt's `pkg.installed` or an Ansible `apt` task, configured the agent runtime of only the first logged-in session it found, and printed nothing about it; the only hook lines in the output were root's own. `beacon endpoint user-config repair-installed --system`, which the Linux package runs after installing, now configures the `sudo` user and every account with a live logind session, each as themselves, carries on when one of them fails, and prints `Configured <user> (<home>): …` for each, or that nobody was logged in and what to run. `--json` adds a `users` array; the existing fields still describe the first person.- **Microsoft Sentinel forwarding with one command, on macOS, Linux and Windows** · `beacon endpoint sentinel forwarder install --system` runs the Vector bundled with Beacon as a system service that sends the runtime log to Microsoft Sentinel through the Logs Ingestion API, with a Microsoft Entra app registration (certificate or client secret). The credential is stored where only root can read it, or SYSTEM and Administrators on Windows, and is never a command-line argument. Vector checks the config before anything changes. Repair and package upgrades keep the forwarder and restart it on the new Vector; uninstall removes the service. Throttling, server errors and `401`/`403` answers are retried without a limit, and a line counts as sent only once Azure has accepted it. `status` and `remove` complete the commands. The pack's Logs Ingestion DCR template no longer needs a Data Collection Endpoint. See [Vector and the Logs Ingestion API](/log-forwarding/microsoft-sentinel#vector-and-the-logs-ingestion-api).- **The Windows MSI carries Vector** · The MSI now installs Vector 0.56.0 as `vector.exe` beside `beacon.exe` in `%ProgramFiles%\Beacon\bin`, as the macOS and Linux packages already carry it, checked against the same pinned checksums. Beacon finds it there. The package only installs it; nothing runs it until a forwarder is set up. Allow it alongside the other three programs if you run AppLocker or WDAC.- **Scheduled session sync** · `beacon endpoint install|repair --session-sync` turns on a job that runs every 15 minutes and reads new records from the agent runtimes' local session stores into the runtime log. It runs the same bounded, confined sweep install already runs once, so session-store data keeps reaching the log, and any forwarder reading it, after install. Off by default; repair and upgrades keep the setting, and `--no-session-sync` removes the job. See [Scheduled session sync](/cli/endpoint-install#scheduled-session-sync).diff --git a/docs/platforms/linux.mdx b/docs/platforms/linux.mdxindex 24a5b95a..3025455f 100644--- a/docs/platforms/linux.mdx+++ b/docs/platforms/linux.mdx@@ -173,9 +173,17 @@ Vector comes with Beacon. The `.deb` and `.rpm` install it at `/opt/beacon/bin/v| System install | Config and collector config under `/etc/beacon/endpoint` || Service | `/etc/systemd/system/beacon-collector.service`, enabled and started || Runtime log | `/var/log/beacon-agent/runtime.jsonl` |-| Agent runtime | Claude Code and Codex CLI settings for the installing user, pointed at `127.0.0.1:4317` |+| Agent runtime | Claude Code and Codex CLI settings and hooks for the installing user and everyone logged in, pointed at `127.0.0.1:4317` |-That last row is worth knowing about. A system-mode endpoint runs as root, so the install has to work out whose agent settings to configure, and the collector is useless if nothing exports to it. Beacon uses `SUDO_USER`, which is set for every normal install path, and falls back to asking logind who has an active session. If it cannot identify anyone, it says so instead of failing, and you can configure yourself later:+That last row is worth knowing about. A system-mode endpoint runs as root, so the install has to work out whose agent settings to configure, and the collector is useless if nothing exports to it. Beacon configures the user named by `SUDO_USER`, which is set when you install with `sudo`, and every account logind reports a live session for, which is what an install by a configuration manager running as root (Salt, Ansible, Puppet) has to go on. Each is configured as that user, in their own home, and the install prints one line per person:++```+beacon: the hook lines above are root's own; configuring the agent runtimes of logged-in users+Configured alice (/home/alice): telemetry for claude, codex; hooks for claude, codex, writing to /var/log/beacon-agent/runtime.jsonl+Configured bob (/home/bob): telemetry for claude, codex; hooks for claude, codex, writing to /var/log/beacon-agent/runtime.jsonl+```++The `Claude Code hooks installed: /root/...` lines printed before it are root's own settings, not anyone else's. A person who was not logged in during the install is not configured. If nobody can be identified, the install says so instead of failing, and each person configures themselves later:```bash title="Configure your own agent runtime against an already-installed endpoint"sudo beacon endpoint user-config repair-installed --systemdiff --git a/packaging/linux/nfpm/postinstall.sh b/packaging/linux/nfpm/postinstall.shindex 7f85d6f9..66d6a20c 100755--- a/packaging/linux/nfpm/postinstall.sh+++ b/packaging/linux/nfpm/postinstall.sh@@ -15,13 +15,16 @@ if ! /opt/beacon/scripts/install-endpoint.sh; thenfi# A system endpoint runs as root, and `endpoint install` above configured root's own Claude Code-# and Codex settings. The person who ran the install is who actually needs pointing at the-# collector, so this second step resolves them (from SUDO_USER, else logind) and configures their-# runtime. Without it the collector runs perfectly and captures nothing anyone cares about.+# and Codex settings. The people who use the machine are who actually need pointing at the+# collector, so this second step resolves them -- the installing sudo user, and everyone with a live+# logind session, which is what a configuration manager running as root (Salt, Ansible) has to go on+# -- configures each one's runtime as that user, and prints who it configured. Without it the+# collector runs perfectly and captures nothing anyone cares about.## Non-fatal, and it prints why when it cannot: on an unattended install there may be no such user,# which is a legitimate outcome rather than a failure.if [ -x /opt/beacon/bin/beacon ]; then+ echo "beacon: the hook lines above are root's own; configuring the agent runtimes of logged-in users"/opt/beacon/bin/beacon endpoint user-config repair-installed \--system --harness "${BEACON_ENDPOINT_HARNESSES:-claude,codex}" || \echo "beacon: could not configure the installing user's agent runtime; run" \diff --git a/packaging/linux/smoke-package.sh b/packaging/linux/smoke-package.shindex 87470e4a..61a4f0e9 100755--- a/packaging/linux/smoke-package.sh+++ b/packaging/linux/smoke-package.sh@@ -48,7 +48,7 @@ cleanupcase "$FORMAT" indeb) IMAGE=beacon-package-smoke-debBASE="${BEACON_SMOKE_BASE:-ubuntu:24.04}"- INSTALL_PKGS="systemd systemd-sysv dbus curl ca-certificates iproute2 binutils"+ INSTALL_PKGS="systemd systemd-sysv dbus libpam-systemd curl ca-certificates iproute2 binutils"PKGMGR_INSTALL="apt-get install -y -qq /var/tmp/beacon.deb" ;;rpm) IMAGE=beacon-package-smoke-rpmBASE="${BEACON_SMOKE_BASE:-rockylinux/rockylinux:9}"@@ -97,16 +97,36 @@ echo "ok: systemd is PID 1"# and dnf reports it as unopenable. Ubuntu does not do this, which is why only the rpm lane hit it.docker cp "$PKG" "$CONTAINER":/var/tmp/beacon."$FORMAT" >/dev/null-# A human has to exist for the install to have anyone to configure. A system endpoint runs as root,+# Humans have to exist for the install to have anyone to configure. A system endpoint runs as root,# so `endpoint install` configures root's agent settings -- and the postinstall's second step is what-# points the actual operator's Claude Code at the collector. SUDO_USER is how that operator is-# identified, and dpkg/rpm pass their environment through to maintainer scripts, so setting it here-# is the same thing `sudo apt install ./beacon.deb` does.-docker exec "$CONTAINER" useradd -m -s /bin/bash "$SMOKE_USER" >/dev/null 2>&1 || true-docker exec "$CONTAINER" test -d "/home/$SMOKE_USER" || {- echo "could not create the test user $SMOKE_USER" >&2; exit 1; }+# points the people using the machine at the collector.+#+# The install below runs the way a configuration manager runs it: as root, with no SUDO_USER, so the+# only way to know who uses the machine is logind. Two people are logged in, because one machine+# often has several (a shared workstation, staff signing in to someone else's), and the install has+# to configure every one of them, not just the first. `su -l` opens a real logind session through+# pam_systemd. The SUDO_USER path is covered by the CLI's unit tests.+SMOKE_USER2="${SMOKE_USER}2"+for u in "$SMOKE_USER" "$SMOKE_USER2"; do+ docker exec "$CONTAINER" useradd -m -s /bin/bash "$u" >/dev/null 2>&1 || true+ docker exec "$CONTAINER" test -d "/home/$u" || {+ echo "could not create the test user $u" >&2; exit 1; }+ docker exec -d "$CONTAINER" su -l "$u" -c 'exec sleep infinity'+done+i=0+while [ "$i" -lt 20 ]; do+ sessions="$(docker exec "$CONTAINER" loginctl list-sessions --no-legend 2>/dev/null || true)"+ case "$sessions" in *"$SMOKE_USER2"*) case "$sessions" in *"$SMOKE_USER "*) break ;; esac ;; esac+ i=$((i+1)); sleep 1+done+case "$sessions" in+ *"$SMOKE_USER2"*) ;;+ *) echo "logind has no sessions for the test users, so there is nobody to configure:" >&2+ echo "$sessions" >&2; exit 1 ;;+esac+echo "ok: $SMOKE_USER and $SMOKE_USER2 are logged in (logind)"-if ! docker exec -e SUDO_USER="$SMOKE_USER" "$CONTAINER" sh -c "$PKGMGR_INSTALL" >/tmp/beacon-pkg-install.log 2>&1; then+if ! docker exec "$CONTAINER" env -u SUDO_USER sh -c "$PKGMGR_INSTALL" >/tmp/beacon-pkg-install.log 2>&1; thenecho "package install failed:" >&2tail -30 /tmp/beacon-pkg-install.log >&2exit 1@@ -167,6 +187,25 @@ adapter_owner="$(docker exec "$CONTAINER" stat -c %U "$ADAPTER" 2>/dev/null || techo "$ADAPTER is owned by $adapter_owner, not $SMOKE_USER" >&2; exit 1; }echo "ok: hooks installed for the user and runnable by them"+# The second person logged in is configured too, as themselves, and the install says so for both+# rather than leaving the root context's own hook lines as the only output.+SETTINGS2="/home/$SMOKE_USER2/.claude/settings.json"+docker exec "$CONTAINER" grep -q '"hooks"' "$SETTINGS2" || {+ echo "$SETTINGS2 has no hooks, so only the first logged-in user was configured" >&2+ grep -i "configur" /tmp/beacon-pkg-install.log >&2 || true+ exit 1+}+owner2="$(docker exec "$CONTAINER" stat -c %U "$SETTINGS2" 2>/dev/null || true)"+[ "$owner2" = "$SMOKE_USER2" ] || { echo "$SETTINGS2 is owned by $owner2" >&2; exit 1; }+for u in "$SMOKE_USER" "$SMOKE_USER2"; do+ grep -q "^Configured $u (/home/$u): " /tmp/beacon-pkg-install.log || {+ echo "the install did not report configuring $u:" >&2+ tail -20 /tmp/beacon-pkg-install.log >&2+ exit 1+ }+done+echo "ok: every logged-in user was configured, and the install said so for each"+# Reachable by name, not just by absolute path.## Every check in this file used /opt/beacon/bin/beacon, so the package could ship with nothing on