@appforge-ci/admin-cli 0.3.13 → 0.3.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"runner-user.d.ts","sourceRoot":"","sources":["../../src/lib/runner-user.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,eAAO,MAAM,mBAAmB,cAAc,CAAC;AAC/C;qFACqF;AACrF,eAAO,MAAM,sBAAsB,YAAY,CAAC;AAEhD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,KAAK,GAAG,MAAM,CAEhF;AAED;;uFAEuF;AACvF,wBAAgB,UAAU,CAAC,QAAQ,GAAE,MAAqB,GAAG,OAAO,GAAG,KAAK,CAE3E;AAED,MAAM,WAAW,qBAAqB;IACpC,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAClC;0GACsG;IACtG,YAAY,IAAI,MAAM,CAAC;IACvB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACvC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAC7C,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAC9B,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,yBAAyB,EAAE,qBAkCvC,CAAC;AAEF,MAAM,WAAW,wBAAwB;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8FAA8F;IAC9F,SAAS,CAAC,EAAE,MAAM,CAAC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M,GAAG,MAAM,CAOnD;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,GAAE,qBAAiD,GACtD,MAAM,CAuBR;AAED,0GAA0G;AAC1G,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,qBAAiD,GAAG,MAAM,CAO9G;AAED;sEACsE;AACtE,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,qBAAiD,GAAG,MAAM,CAgBnJ;AAED,wBAAgB,iBAAiB,CAAC,IAAI,GAAE,wBAA6B,EAAE,IAAI,GAAE,qBAAiD,GAAG,IAAI,CA0BpI"}
@@ -73,11 +73,13 @@ export const realInstallRunnerUserDeps = {
73
73
  run(cmd, args) {
74
74
  // eslint-disable-next-line no-console
75
75
  console.log(` $ ${cmd} ${args.join(" ")}`);
76
- execFileSync(cmd, args, { stdio: "inherit" });
76
+ // cwd "/": a helper that drops to another account (createhomedir -u) must not inherit the operator's own,
77
+ // unreadable-to-others, working directory (it printed "getcwd: cannot access parent directories").
78
+ execFileSync(cmd, args, { stdio: "inherit", cwd: "/" });
77
79
  },
78
80
  tryRun(cmd, args) {
79
81
  try {
80
- execFileSync(cmd, args, { stdio: "ignore" });
82
+ execFileSync(cmd, args, { stdio: "ignore", cwd: "/" });
81
83
  return true;
82
84
  }
83
85
  catch {
@@ -118,32 +120,40 @@ export function nextFreeUid(listing) {
118
120
  }
119
121
  return max + 1;
120
122
  }
121
- /** Creates the dedicated account, or leaves it alone if it already exists. Returns its home directory. */
122
- export function ensureRunnerUser(user, deps = realInstallRunnerUserDeps) {
123
+ /**
124
+ * Creates a plain, ordinary (not hidden, not admin) account with its own home directory, or leaves it alone if it
125
+ * already exists. Shared by `install-runner-user` and `install-vm-user`. The account is created WITHOUT a password
126
+ * (it cannot authenticate until the operator sets one) and is deliberately not hidden: both callers need a real
127
+ * login session for GUI frameworks. Returns its home directory.
128
+ */
129
+ export function ensureOrdinaryUser(user, realName, banner, deps = realInstallRunnerUserDeps) {
123
130
  const home = `/Users/${user}`;
124
131
  if (deps.userExists(user)) {
125
132
  deps.log(` user '${user}' already exists, leaving it alone`);
126
133
  return home;
127
134
  }
128
- deps.log(`\n==> Creating the dedicated '${user}' account (so this Mac's CI runner no longer shares a uid with the build agent)`);
135
+ deps.log(`\n==> ${banner}`);
129
136
  const uid = nextFreeUid(deps.listUserUids());
130
137
  const gid = uid;
131
138
  deps.run("sudo", ["dscl", ".", "-create", `/Groups/${user}`]);
132
139
  deps.run("sudo", ["dscl", ".", "-create", `/Groups/${user}`, "PrimaryGroupID", String(gid)]);
133
140
  deps.run("sudo", ["dscl", ".", "-create", `/Users/${user}`]);
134
141
  deps.run("sudo", ["dscl", ".", "-create", `/Users/${user}`, "UserShell", "/bin/zsh"]);
135
- deps.run("sudo", ["dscl", ".", "-create", `/Users/${user}`, "RealName", "AppForge CI runner (dedicated)"]);
142
+ deps.run("sudo", ["dscl", ".", "-create", `/Users/${user}`, "RealName", realName]);
136
143
  deps.run("sudo", ["dscl", ".", "-create", `/Users/${user}`, "UniqueID", String(uid)]);
137
144
  deps.run("sudo", ["dscl", ".", "-create", `/Users/${user}`, "PrimaryGroupID", String(gid)]);
138
145
  deps.run("sudo", ["dscl", ".", "-create", `/Users/${user}`, "NFSHomeDirectory", home]);
139
146
  // No -create .../Password at all: an account with no AuthenticationAuthority entry cannot authenticate by
140
147
  // password until one is set. `createhomedir` below needs no password to run (root does it on the
141
- // account's behalf). Deliberately NOT marking IsHidden — see the module docblock on why this is an
142
- // ordinary account, not a service account.
148
+ // account's behalf). Deliberately NOT marking IsHidden, see the docblock above.
143
149
  deps.run("sudo", ["createhomedir", "-c", "-u", user]);
144
150
  deps.log(` created ${home} (uid ${uid})`);
145
151
  return home;
146
152
  }
153
+ /** Creates the dedicated account, or leaves it alone if it already exists. Returns its home directory. */
154
+ export function ensureRunnerUser(user, deps = realInstallRunnerUserDeps) {
155
+ return ensureOrdinaryUser(user, "AppForge CI runner (dedicated)", `Creating the dedicated '${user}' account (so this Mac's CI runner no longer shares a uid with the build agent)`, deps);
156
+ }
147
157
  /** Downloads and extracts the runner release into `<home>/actions-runner`, owned by `user`. A no-op (besides
148
158
  * logging) if that directory already looks like a runner install. */
149
159
  export function ensureRunnerDownloaded(user, home, version, deps = realInstallRunnerUserDeps) {
@@ -1 +1 @@
1
- {"version":3,"file":"runner-user.js","sourceRoot":"","sources":["../../src/lib/runner-user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,2GAA2G;AAC3G,uGAAuG;AACvG,yGAAyG;AACzG,4BAA4B;AAE5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,WAAW,CAAC;AAC/C;qFACqF;AACrF,MAAM,CAAC,MAAM,sBAAsB,GAAG,SAAS,CAAC;AAEhD,MAAM,UAAU,iBAAiB,CAAC,OAAe,EAAE,IAAqB;IACtE,OAAO,wDAAwD,OAAO,uBAAuB,IAAI,IAAI,OAAO,SAAS,CAAC;AACxH,CAAC;AAED;;uFAEuF;AACvF,MAAM,UAAU,UAAU,CAAC,WAAmB,OAAO,CAAC,IAAI;IACxD,OAAO,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;AAChD,CAAC;AAeD,MAAM,CAAC,MAAM,yBAAyB,GAA0B;IAC9D,UAAU,CAAC,IAAI;QACb,IAAI,CAAC;YACH,YAAY,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE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,oBAAoB,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,CAAC;QACrI,IAAI,CAAC,GAAG,CACN,0HAA0H;YACxH,2HAA2H;YAC3H,sDAAsD,IAAI,aAAa;YACvE,aAAa,IAAI,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI;YAC5C,UAAU,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI;YAClC,UAAU,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CACnC,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,77 @@
1
+ import { type InstallVmUserDeps } from "./vm-user.js";
2
+ /**
3
+ * `install-vm-user --apply`: the helper-account layout (appforge-ci#812, option C) as ONE idempotent, non-interactive command,
4
+ * for a fleet (appforge-ci#836). Run as root over SSH or from an MDM script; `--dry-run` prints every step and changes nothing.
5
+ *
6
+ * What it does, each step skipped when it is already true:
7
+ * 1. creates the helper account (an ordinary account, as install-vm-user always did);
8
+ * 2. when it created the account (or `--reset-password` was given): sets a random password, makes the account the
9
+ * auto-login account (`sysadminctl -autologin set`, falling back to writing /etc/kcpassword), and reads the setting back.
10
+ * The password is generated here, used once for this and never printed or stored anywhere else. An existing
11
+ * account's password is NEVER reset without `--reset-password`;
12
+ * 3. makes the shared folder both accounts use (owner = the agent's account, group = the helper, mode 770);
13
+ * 4. adds the knobs to the agent's LaunchDaemon plist (APPFORGE_STATUS_MIRROR_DIR, APPFORGE_VM_INVENTORY_FILE, and
14
+ * APPFORGE_VM_TOOLING_DIR, which makes the agent deliver the signed VM tooling bundle into the shared folder) and
15
+ * restarts the agent. (install-service would drop knobs that its shell does not export, and it has to run as the agent's
16
+ * own account with that account's sudo, which a root-run MDM script does not have; editing the one plist is the
17
+ * idempotent equivalent. install-service refuses to drop these knobs later unless told to.)
18
+ *
19
+ * Refuses (changing nothing) on a laptop, with FileVault on, when not root, when the agent's account is unknown, when the
20
+ * agent is not a boot-time LaunchDaemon, and when a GitHub Actions runner is a LaunchAgent of another account: the auto-login
21
+ * switch would leave it waiting for a manual login after every reboot (#780).
22
+ *
23
+ * 5. installs the helper's reconcile LaunchAgent (~/Library/LaunchAgents/com.appforge.vm-reconcile.plist, owned by the helper, so
24
+ * it loads at the helper's own login): it runs `reconcile-bundle.sh` from the tooling bundle the agent delivers into the shared
25
+ * folder (`<folder>/vm-tooling/current`, appforge-ci#836 B2) every 300 s, with the host name derived from the computer name,
26
+ * the agent's status and the inventory mirror wired to the shared folder, and the agent's own node. No git, no credential. It
27
+ * exits quietly until the first bundle has been delivered.
28
+ * The host files ship with `spec.enabled: false` unless a release enables them, so a Mac that is fully set up still applies
29
+ * nothing until its host file opts in.
30
+ */
31
+ export declare const AGENT_DAEMON_PLIST = "/Library/LaunchDaemons/com.appforge.agent.plist";
32
+ export declare const LOGINWINDOW_PREFS = "/Library/Preferences/com.apple.loginwindow";
33
+ export declare const KCPASSWORD_PATH = "/etc/kcpassword";
34
+ export interface ApplyVmUserDeps extends InstallVmUserDeps {
35
+ euid(): number;
36
+ /** The account that ran sudo, or null (an MDM script runs as plain root). */
37
+ sudoUser(): string | null;
38
+ readText(path: string): string | null;
39
+ listDir(path: string): string[] | null;
40
+ randomPassword(): string;
41
+ /** Like `run`, but never echoes the arguments (they hold a secret); `label` is what gets logged. */
42
+ runSecret(cmd: string, args: string[], label: string): void;
43
+ /** Writes a root-only file. */
44
+ writeSecretFile(path: string, data: Buffer): void;
45
+ /** Writes a text file (mode 0644) and gives it to `owner:group`. */
46
+ writeOwnedText(path: string, text: string, owner: string, group: string): void;
47
+ }
48
+ export declare const realApplyVmUserDeps: ApplyVmUserDeps;
49
+ export declare const HELPER_AGENT_LABEL = "com.appforge.vm-reconcile";
50
+ export interface HelperAgentPlistOptions {
51
+ shareDir: string;
52
+ /** The node the agent runs with (absolute). */
53
+ nodePath: string;
54
+ /** The helper account's home directory. */
55
+ home: string;
56
+ }
57
+ /**
58
+ * The helper's reconcile LaunchAgent. Runs `reconcile-bundle.sh` from the delivered bundle's `current` folder with the host name
59
+ * derived on the Mac (`auto`). The `[ -f ]` guard makes it a quiet no-op until the agent has delivered the first bundle.
60
+ */
61
+ export declare function helperAgentPlist(o: HelperAgentPlistOptions): string;
62
+ /** The /etc/kcpassword encoding of an auto-login password: XOR with the fixed key, zero-padded to a multiple of 12. */
63
+ export declare function kcpasswordBytes(password: string): Buffer;
64
+ /** Accounts whose GitHub Actions runner is a LaunchAgent (found through each runner dir's `.service` file, as the doctor does). */
65
+ export declare function runnerLaunchAgentAccounts(deps: Pick<ApplyVmUserDeps, "listDir" | "readText">): string[];
66
+ export interface ApplyVmUserOptions {
67
+ user: string;
68
+ agentUser?: string;
69
+ dryRun?: boolean;
70
+ /** Set a new random password and make an EXISTING account the auto-login account. */
71
+ resetPassword?: boolean;
72
+ shareDir?: string;
73
+ }
74
+ /** The reasons --apply refuses; empty means go ahead. */
75
+ export declare function applyRefusals(opts: ApplyVmUserOptions, deps: ApplyVmUserDeps): string[];
76
+ export declare function applyVmUser(opts: ApplyVmUserOptions, deps?: ApplyVmUserDeps): void;
77
+ //# sourceMappingURL=vm-user-apply.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vm-user-apply.d.ts","sourceRoot":"","sources":["../../src/lib/vm-user-apply.ts"],"names":[],"mappings":"AAIA,OAAO,EAA2D,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAG/G;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,eAAO,MAAM,kBAAkB,oDAAoD,CAAC;AACpF,eAAO,MAAM,iBAAiB,+CAA+C,CAAC;AAC9E,eAAO,MAAM,eAAe,oBAAoB,CAAC;AAEjD,MAAM,WAAW,eAAgB,SAAQ,iBAAiB;IACxD,IAAI,IAAI,MAAM,CAAC;IACf,6EAA6E;IAC7E,QAAQ,IAAI,MAAM,GAAG,IAAI,CAAC;IAC1B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AAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,yDAAyD;AACzD,wBAAgB,aAAa,CAAC,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,eAAe,GAAG,MAAM,EAAE,CAgBvF;AASD,wBAAgB,WAAW,CAAC,IAAI,EAAE,kBAAkB,EAAE,IAAI,GAAE,eAAqC,GAAG,IAAI,CAkGvG"}
@@ -0,0 +1,272 @@
1
+ import { execFileSync } from "node:child_process";
2
+ import { randomBytes } from "node:crypto";
3
+ import { readFileSync, readdirSync, writeFileSync, chmodSync } from "node:fs";
4
+ import { join } from "node:path";
5
+ import { STATUS_SHARE_DIR, realInstallVmUserDeps, vmUserRefusals } from "./vm-user.js";
6
+ import { ensureOrdinaryUser } from "./runner-user.js";
7
+ /**
8
+ * `install-vm-user --apply`: the helper-account layout (appforge-ci#812, option C) as ONE idempotent, non-interactive command,
9
+ * for a fleet (appforge-ci#836). Run as root over SSH or from an MDM script; `--dry-run` prints every step and changes nothing.
10
+ *
11
+ * What it does, each step skipped when it is already true:
12
+ * 1. creates the helper account (an ordinary account, as install-vm-user always did);
13
+ * 2. when it created the account (or `--reset-password` was given): sets a random password, makes the account the
14
+ * auto-login account (`sysadminctl -autologin set`, falling back to writing /etc/kcpassword), and reads the setting back.
15
+ * The password is generated here, used once for this and never printed or stored anywhere else. An existing
16
+ * account's password is NEVER reset without `--reset-password`;
17
+ * 3. makes the shared folder both accounts use (owner = the agent's account, group = the helper, mode 770);
18
+ * 4. adds the knobs to the agent's LaunchDaemon plist (APPFORGE_STATUS_MIRROR_DIR, APPFORGE_VM_INVENTORY_FILE, and
19
+ * APPFORGE_VM_TOOLING_DIR, which makes the agent deliver the signed VM tooling bundle into the shared folder) and
20
+ * restarts the agent. (install-service would drop knobs that its shell does not export, and it has to run as the agent's
21
+ * own account with that account's sudo, which a root-run MDM script does not have; editing the one plist is the
22
+ * idempotent equivalent. install-service refuses to drop these knobs later unless told to.)
23
+ *
24
+ * Refuses (changing nothing) on a laptop, with FileVault on, when not root, when the agent's account is unknown, when the
25
+ * agent is not a boot-time LaunchDaemon, and when a GitHub Actions runner is a LaunchAgent of another account: the auto-login
26
+ * switch would leave it waiting for a manual login after every reboot (#780).
27
+ *
28
+ * 5. installs the helper's reconcile LaunchAgent (~/Library/LaunchAgents/com.appforge.vm-reconcile.plist, owned by the helper, so
29
+ * it loads at the helper's own login): it runs `reconcile-bundle.sh` from the tooling bundle the agent delivers into the shared
30
+ * folder (`<folder>/vm-tooling/current`, appforge-ci#836 B2) every 300 s, with the host name derived from the computer name,
31
+ * the agent's status and the inventory mirror wired to the shared folder, and the agent's own node. No git, no credential. It
32
+ * exits quietly until the first bundle has been delivered.
33
+ * The host files ship with `spec.enabled: false` unless a release enables them, so a Mac that is fully set up still applies
34
+ * nothing until its host file opts in.
35
+ */
36
+ export const AGENT_DAEMON_PLIST = "/Library/LaunchDaemons/com.appforge.agent.plist";
37
+ export const LOGINWINDOW_PREFS = "/Library/Preferences/com.apple.loginwindow";
38
+ export const KCPASSWORD_PATH = "/etc/kcpassword";
39
+ export const realApplyVmUserDeps = {
40
+ ...realInstallVmUserDeps,
41
+ euid: () => (typeof process.geteuid === "function" ? process.geteuid() : -1),
42
+ sudoUser: () => process.env.SUDO_USER?.trim() || null,
43
+ readText(path) {
44
+ try {
45
+ return readFileSync(path, "utf8");
46
+ }
47
+ catch {
48
+ return null;
49
+ }
50
+ },
51
+ listDir(path) {
52
+ try {
53
+ return readdirSync(path);
54
+ }
55
+ catch {
56
+ return null;
57
+ }
58
+ },
59
+ // 31 characters on purpose: kcpassword pads to a multiple of 12 with zero bytes, and a length that is already a multiple
60
+ // of 12 leaves no terminator for the reader of the file.
61
+ randomPassword: () => randomBytes(24).toString("base64url").slice(0, 31),
62
+ runSecret(cmd, args, label) {
63
+ // eslint-disable-next-line no-console
64
+ console.log(` $ ${label}`);
65
+ execFileSync(cmd, args, { stdio: ["ignore", "inherit", "inherit"], cwd: "/" });
66
+ },
67
+ writeSecretFile(path, data) {
68
+ writeFileSync(path, data, { mode: 0o600 });
69
+ chmodSync(path, 0o600);
70
+ },
71
+ writeOwnedText(path, text, owner, group) {
72
+ writeFileSync(path, text, { mode: 0o644 });
73
+ chmodSync(path, 0o644);
74
+ execFileSync("chown", [`${owner}:${group}`, path], { cwd: "/" });
75
+ },
76
+ };
77
+ export const HELPER_AGENT_LABEL = "com.appforge.vm-reconcile";
78
+ function xml(s) {
79
+ return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
80
+ }
81
+ /**
82
+ * The helper's reconcile LaunchAgent. Runs `reconcile-bundle.sh` from the delivered bundle's `current` folder with the host name
83
+ * derived on the Mac (`auto`). The `[ -f ]` guard makes it a quiet no-op until the agent has delivered the first bundle.
84
+ */
85
+ export function helperAgentPlist(o) {
86
+ const current = `${o.shareDir}/vm-tooling/current`;
87
+ const log = `${o.home}/.appforge-infra/reconcile.log`;
88
+ return `<?xml version="1.0" encoding="UTF-8"?>
89
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
90
+ <plist version="1.0">
91
+ <dict>
92
+ <key>Label</key>
93
+ <string>${HELPER_AGENT_LABEL}</string>
94
+ <key>ProgramArguments</key>
95
+ <array>
96
+ <string>/bin/bash</string>
97
+ <string>-c</string>
98
+ <string>[ -f "$0" ] || exit 0; exec /bin/bash "$0" "$1" auto</string>
99
+ <string>${xml(current)}/reconcile-bundle.sh</string>
100
+ <string>${xml(current)}</string>
101
+ </array>
102
+ <key>ProcessType</key>
103
+ <string>Background</string>
104
+ <key>Nice</key>
105
+ <integer>19</integer>
106
+ <key>EnvironmentVariables</key>
107
+ <dict>
108
+ <key>PATH</key>
109
+ <string>/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
110
+ <key>APPFORGE_NODE</key>
111
+ <string>${xml(o.nodePath)}</string>
112
+ <key>APPFORGE_AGENT_STATUS</key>
113
+ <string>${xml(o.shareDir)}/status.json</string>
114
+ <key>APPFORGE_INVENTORY_MIRROR_DIR</key>
115
+ <string>${xml(o.shareDir)}</string>
116
+ </dict>
117
+ <key>StartInterval</key>
118
+ <integer>300</integer>
119
+ <key>RunAtLoad</key>
120
+ <true/>
121
+ <key>StandardOutPath</key>
122
+ <string>${xml(log)}</string>
123
+ <key>StandardErrorPath</key>
124
+ <string>${xml(log)}</string>
125
+ </dict>
126
+ </plist>
127
+ `;
128
+ }
129
+ const KC_KEY = [0x7d, 0x89, 0x52, 0x23, 0xd2, 0xbc, 0xdd, 0xea, 0xa3, 0xb9, 0x1f];
130
+ /** The /etc/kcpassword encoding of an auto-login password: XOR with the fixed key, zero-padded to a multiple of 12. */
131
+ export function kcpasswordBytes(password) {
132
+ const raw = [...Buffer.from(password, "utf8")];
133
+ const remainder = raw.length % 12;
134
+ if (remainder > 0)
135
+ raw.push(...new Array(12 - remainder).fill(0));
136
+ return Buffer.from(raw.map((byte, i) => byte ^ KC_KEY[i % KC_KEY.length]));
137
+ }
138
+ /** Accounts whose GitHub Actions runner is a LaunchAgent (found through each runner dir's `.service` file, as the doctor does). */
139
+ export function runnerLaunchAgentAccounts(deps) {
140
+ const found = new Set();
141
+ for (const name of deps.listDir("/Users") ?? []) {
142
+ if (name === "Shared" || name.startsWith("."))
143
+ continue;
144
+ const home = join("/Users", name);
145
+ for (const entry of (deps.listDir(home) ?? []).filter((e) => /^actions-runner/i.test(e))) {
146
+ const svc = deps.readText(join(home, entry, ".service"))?.trim();
147
+ const owner = svc ? /^\/Users\/([^/]+)\/Library\/LaunchAgents\//.exec(svc)?.[1] : undefined;
148
+ if (owner)
149
+ found.add(owner);
150
+ }
151
+ }
152
+ return [...found];
153
+ }
154
+ /** The reasons --apply refuses; empty means go ahead. */
155
+ export function applyRefusals(opts, deps) {
156
+ const reasons = vmUserRefusals(deps);
157
+ if (deps.euid() !== 0)
158
+ reasons.push("--apply has to run as root (sudo appforge-admin agents install-vm-user --apply, or an MDM script)");
159
+ const agentUser = opts.agentUser ?? deps.sudoUser();
160
+ if (!agentUser)
161
+ reasons.push("cannot tell which account runs the agent: pass --agent-user <name> (an MDM script runs as root, with no sudo user)");
162
+ else if (!deps.userExists(agentUser))
163
+ reasons.push(`the agent's account '${agentUser}' does not exist`);
164
+ if (deps.readText(AGENT_DAEMON_PLIST) === null) {
165
+ reasons.push(`the agent is not installed as a boot-time LaunchDaemon (${AGENT_DAEMON_PLIST} is missing): install it first (appforge-agent install-service --daemon); the agent cannot hold the console session in this layout`);
166
+ }
167
+ const orphaned = runnerLaunchAgentAccounts(deps).filter((a) => a !== opts.user);
168
+ if (orphaned.length > 0) {
169
+ reasons.push(`a GitHub Actions runner is a LaunchAgent of ${orphaned.join(", ")}: making '${opts.user}' the auto-login account would leave it waiting for a manual login after every reboot (appforge-ci#780). Move the runner to a boot-time LaunchDaemon first`);
170
+ }
171
+ return reasons;
172
+ }
173
+ export function applyVmUser(opts, deps = realApplyVmUserDeps) {
174
+ const { user } = opts;
175
+ const refusals = applyRefusals(opts, deps);
176
+ if (refusals.length > 0)
177
+ throw new Error(`refused: ${refusals.join("; ")}`);
178
+ const agentUser = (opts.agentUser ?? deps.sudoUser());
179
+ const shareDir = opts.shareDir ?? STATUS_SHARE_DIR;
180
+ const existed = deps.userExists(user);
181
+ const loginPref = () => deps.capture("/usr/bin/defaults", ["read", LOGINWINDOW_PREFS, "autoLoginUser"])?.trim() ?? "";
182
+ const setPassword = !existed || opts.resetPassword === true;
183
+ const helperPlistPath = `/Users/${user}/Library/LaunchAgents/${HELPER_AGENT_LABEL}.plist`;
184
+ // The agent's own node, so the helper runs the same one: the first argument of the agent's LaunchDaemon.
185
+ const agentNode = () => deps.capture("/usr/bin/plutil", ["-extract", "ProgramArguments.0", "raw", "-o", "-", AGENT_DAEMON_PLIST])?.trim() || "/opt/homebrew/bin/node";
186
+ const desiredHelperPlist = () => helperAgentPlist({ shareDir, nodePath: agentNode(), home: `/Users/${user}` });
187
+ const existingHelperPlist = () => deps.readText(helperPlistPath);
188
+ const steps = [
189
+ {
190
+ title: `create the '${user}' account`,
191
+ skip: () => (existed ? "already exists" : null),
192
+ run: () => void ensureOrdinaryUser(user, "AppForge VM helper (dedicated)", `Creating the dedicated '${user}' account (it will hold this Mac's graphical session and run the VM tooling)`, deps),
193
+ },
194
+ {
195
+ title: `set a random password for '${user}' and make it the auto-login account`,
196
+ skip: () => {
197
+ if (setPassword)
198
+ return null;
199
+ return loginPref() === user
200
+ ? "already the auto-login account (its password is not touched)"
201
+ : `the account exists and is not the auto-login account; its password is not touched without --reset-password, so auto-login is NOT set`;
202
+ },
203
+ run: () => {
204
+ const password = deps.randomPassword();
205
+ deps.runSecret("dscl", [".", "-passwd", `/Users/${user}`, password], `dscl . -passwd /Users/${user} <random password, not shown>`);
206
+ try {
207
+ deps.runSecret("sysadminctl", ["-autologin", "set", "-userName", user, "-password", password], `sysadminctl -autologin set -userName ${user} -password <random password, not shown>`);
208
+ }
209
+ catch {
210
+ deps.log(" sysadminctl could not set auto-login; writing /etc/kcpassword and the loginwindow preference instead");
211
+ }
212
+ if (loginPref() !== user) {
213
+ deps.writeSecretFile(KCPASSWORD_PATH, kcpasswordBytes(password));
214
+ deps.run("defaults", ["write", LOGINWINDOW_PREFS, "autoLoginUser", "-string", user]);
215
+ }
216
+ if (loginPref() !== user)
217
+ throw new Error(`auto-login for '${user}' did not stick: ${LOGINWINDOW_PREFS} autoLoginUser reads "${loginPref()}"`);
218
+ deps.log(` auto-login is now '${user}' (read back); it takes effect at the next boot`);
219
+ },
220
+ },
221
+ {
222
+ title: `make the shared folder ${shareDir} (owner ${agentUser}, group ${user}, mode 770)`,
223
+ run: () => deps.run("install", ["-d", "-o", agentUser, "-g", user, "-m", "770", shareDir]),
224
+ },
225
+ {
226
+ title: `add the mirror knobs to the agent's LaunchDaemon plist and restart the agent`,
227
+ skip: () => {
228
+ const have = (key) => deps.capture("/usr/bin/plutil", ["-extract", `EnvironmentVariables.${key}`, "raw", "-o", "-", AGENT_DAEMON_PLIST])?.trim();
229
+ return have("APPFORGE_STATUS_MIRROR_DIR") === shareDir && have("APPFORGE_VM_INVENTORY_FILE") === `${shareDir}/inventory.json` && have("APPFORGE_VM_TOOLING_DIR") === shareDir
230
+ ? "already set"
231
+ : null;
232
+ },
233
+ run: () => {
234
+ deps.run("plutil", ["-replace", "EnvironmentVariables.APPFORGE_STATUS_MIRROR_DIR", "-string", shareDir, AGENT_DAEMON_PLIST]);
235
+ deps.run("plutil", ["-replace", "EnvironmentVariables.APPFORGE_VM_INVENTORY_FILE", "-string", `${shareDir}/inventory.json`, AGENT_DAEMON_PLIST]);
236
+ deps.run("plutil", ["-replace", "EnvironmentVariables.APPFORGE_VM_TOOLING_DIR", "-string", shareDir, AGENT_DAEMON_PLIST]);
237
+ deps.run("launchctl", ["kickstart", "-k", "system/com.appforge.agent"]);
238
+ },
239
+ },
240
+ {
241
+ title: `install the helper's reconcile LaunchAgent (runs the delivered VM tooling from ${shareDir}/vm-tooling/current)`,
242
+ skip: () => (existingHelperPlist() === desiredHelperPlist() ? "already installed, unchanged" : null),
243
+ run: () => {
244
+ const home = `/Users/${user}`;
245
+ deps.run("install", ["-d", "-o", user, "-g", user, "-m", "755", `${home}/Library`, `${home}/Library/LaunchAgents`]);
246
+ deps.run("install", ["-d", "-o", user, "-g", user, "-m", "755", `${home}/.appforge-infra`]);
247
+ deps.writeOwnedText(helperPlistPath, desiredHelperPlist(), user, user);
248
+ deps.log(` wrote ${helperPlistPath}; it loads at ${user}'s next login (the reboot)`);
249
+ },
250
+ },
251
+ ];
252
+ deps.log(`${opts.dryRun ? "DRY RUN: nothing will be changed. " : ""}Setting up the helper-account layout for '${user}' (agent account '${agentUser}'):`);
253
+ let n = 0;
254
+ for (const step of steps) {
255
+ n += 1;
256
+ const reason = step.skip?.() ?? null;
257
+ if (reason !== null) {
258
+ deps.log(`\n[${n}/${steps.length}] ${step.title}: skipped, ${reason}`);
259
+ continue;
260
+ }
261
+ deps.log(`\n[${n}/${steps.length}] ${step.title}`);
262
+ if (!opts.dryRun)
263
+ step.run();
264
+ }
265
+ if (!opts.dryRun && loginPref() !== user) {
266
+ deps.log(`\nWARNING: '${user}' is NOT the auto-login account (${LOGINWINDOW_PREFS} autoLoginUser reads "${loginPref() || "nothing"}"): macOS guests will not start after a reboot until it is. Re-run with --reset-password to set one.`);
267
+ }
268
+ deps.log(opts.dryRun
269
+ ? "\nDry run finished: re-run without --dry-run to apply."
270
+ : `\nDone. Reboot to start the helper's session: its reconcile LaunchAgent loads at login and starts applying once the agent has delivered the signed VM tooling for its own version (a tagged release; appforge-ci#836).`);
271
+ }
272
+ //# sourceMappingURL=vm-user-apply.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vm-user-apply.js","sourceRoot":"","sources":["../../src/lib/vm-user-apply.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC9E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,cAAc,EAA0B,MAAM,cAAc,CAAC;AAC/G,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,iDAAiD,CAAC;AACpF,MAAM,CAAC,MAAM,iBAAiB,GAAG,4CAA4C,CAAC;AAC9E,MAAM,CAAC,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAiBjD,MAAM,CAAC,MAAM,mBAAmB,GAAoB;IAClD,GAAG,qBAAqB;IACxB,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,OAAO,OAAO,CAA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
+ {"version":3,"file":"vm-user-apply.test.d.ts","sourceRoot":"","sources":["../../src/lib/vm-user-apply.test.ts"],"names":[],"mappings":"AAAA,OAAO,iCAAiC,CAAC"}