@astrofoundry/pi-astro 0.40.26 → 0.40.27
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.
|
@@ -21,6 +21,7 @@ describe("approvals", () => {
|
|
|
21
21
|
expect(isRisky("network", ["unifi", "mira", "--local", "write", "PUT", "/v1/sites/x/networks/y", "{}"])).toBe(true);
|
|
22
22
|
expect(isRisky("network", ["unifi", "mira", "nat-write", "POST", "{}"])).toBe(true);
|
|
23
23
|
expect(isRisky("network", ["unifi", "37", "nat"])).toBe(false);
|
|
24
|
+
expect(isRisky("network", ["unifi", "mira", "app-policy-delete", "0123456789abcdef01234567"])).toBe(true);
|
|
24
25
|
expect(isRisky("network", ["unifi", "mira", "device-network", "0123456789abcdef01234567", "{}"])).toBe(true);
|
|
25
26
|
expect(isRisky("network", ["unifi", "mira", "app-get", "/api/s/default/stat/device"])).toBe(false);
|
|
26
27
|
expect(isRisky("arcane", ["projects", "list"])).toBe(false);
|
|
@@ -33,7 +33,7 @@ export const RISKY: Readonly<Record<string, readonly RegExp[]>> = {
|
|
|
33
33
|
],
|
|
34
34
|
identity: [/^zitadel\s+(DELETE|POST|PUT|PATCH)\b/, /^dmz\s+(deploy-config|pomerium-restart|render|lego-renew)\b/],
|
|
35
35
|
// Every UniFi write, on either console.
|
|
36
|
-
network: [/^unifi\s+\S+\s+(write|nat-write|device-network)\b/],
|
|
36
|
+
network: [/^unifi\s+\S+\s+(write|nat-write|device-network|app-policy-delete)\b/],
|
|
37
37
|
dns: [
|
|
38
38
|
/^technitium\s+primary\s+(zone-create|zone-catalog|zone-delete|record-add|record-update|record-delete|cluster-init|cluster-delete|cluster-remove|server-domain)\b/,
|
|
39
39
|
/^technitium\s+node\s+\S+\s+(server-domain|stale-zone-delete)\b/,
|
package/package.json
CHANGED
package/skills/network/SKILL.md
CHANGED
|
@@ -94,6 +94,8 @@ Behavior learned on the live consoles:
|
|
|
94
94
|
|
|
95
95
|
`app-get` reads any path of the Network application's own API under `/api/s/default/` or `/v2/api/site/default/`, through the same connector and key. Use it to find the fields a change needs before adding a narrow write command. Useful reads: `/api/s/default/stat/device` (devices with `mgmt_network_id`, `config_network`, `port_table`, `port_overrides`, `uplink`), `/api/s/default/stat/sta` (clients with `ap_mac`, `sw_mac`, `sw_port`), `/api/s/default/rest/networkconf` (networks with their 24-hex ids, VLAN, subnet, DHCP range).
|
|
96
96
|
|
|
97
|
+
`app-policy-delete <policyId>` deletes a firewall policy that the official API lists with `id: null`, such as rules converted from the old firewall (Mira's `BLOCK INTERNET` rows on 2026-10-31). Find its 24-hex `_id` with `app-get /v2/api/site/default/firewall-policies`; every other policy change goes through `write`.
|
|
98
|
+
|
|
97
99
|
`device-network` changes only a device's management network and address: a PUT of `/api/s/default/rest/device/<deviceId>` whose body may hold just `mgmt_network_id` and `config_network`. Both sites use the same layout: the uplink port stays native Default with all VLANs tagged, and each device sits on Management with a static address and the local DNS nodes.
|
|
98
100
|
|
|
99
101
|
```json
|
package/specialists/README.md
CHANGED
|
@@ -40,7 +40,7 @@ Host: Cortex (macOS on Apple silicon; Homebrew git; the specialists' Node, trend
|
|
|
40
40
|
- `edge`: `GCP_SA_KEY_JSON` (service account key), `SSH_KEY_FRONTDOOR_B64`, `HOMELAB_DEPLOY_KEY_B64`.
|
|
41
41
|
- `security`: `SSH_KEY_OBS_B64`.
|
|
42
42
|
- `backup`: `SSH_KEY_PULSAR_B64`, `SSH_KEY_ARCANE_B64`.
|
|
43
|
-
- `proxmox`: `PVE_TOKEN_ID` (plain, `spc-proxmox@pve!cortex`), `PVE_TOKEN_SECRET`, `SSH_KEY_PULSAR_B64
|
|
43
|
+
- `proxmox`: `PVE_TOKEN_ID` (plain, `spc-proxmox@pve!cortex`), `PVE_TOKEN_SECRET`, `PVE_SPACEX_TOKEN_ID` and `PVE_SPACEX_TOKEN_SECRET` (the same user on SPACE-X), `SSH_KEY_PULSAR_B64` (trusted by Pulsar and SPACE-X). `proxmox.json` also needs `spacexApiUrl`, `spacexCertSha256`, `spacexNode`, `spacexHost`, `spacexUser`, and `known_hosts` the SPACE-X host key.
|
|
44
44
|
- `inference`: `SSH_KEY_NEXUS_B64`.
|
|
45
45
|
- `media`: `TMDB_ACCESS_TOKEN` (TMDB API Read Access Token), `OMDB_API_KEY`, `RADARR_API_KEY`, `SONARR_API_KEY` (Settings, General, Security; each app has one), `SABNZBD_API_KEY` (the API key, not the NZB key, which can only add NZBs and cannot read or pause the queue).
|
|
46
46
|
2. **Identities.** Zitadel (`https://auth.37pla.net/ui/console`): service user `spc-arcane` with Access Token Type JWT and a JSON key; service user `spc-identity` with a Personal Access Token and the Instance Owner role. Technitium (cluster primary): user `spc-dns` in the Administrators group with an API token; the cluster syncs the user to every node. Cloudflare: an account-owned API token with `Zone:Read` and `DNS:Edit` on both zones. GCP project `frontdoor-1337`: service account `spc-edge` with `roles/iap.tunnelResourceAccessor` and `roles/compute.viewer`, JSON key. Proxmox (`ssh pulsar`): user `spc-proxmox@pve`, role `SpecialistGuest` = `VM.Audit VM.PowerMgmt VM.Snapshot VM.Snapshot.Rollback VM.Config.CPU VM.Config.Memory VM.Config.Options VM.Config.Network VM.Config.CDROM VM.GuestAgent.Audit`, ACLs `PVEAuditor` on `/` and `SpecialistGuest` on `/vms` for both the user and the token `spc-proxmox@pve!cortex` (`-privsep 1`).
|
|
@@ -151,6 +151,6 @@ The `astro-discord` extension gives Discord users access to the specialists from
|
|
|
151
151
|
|
|
152
152
|
## Rotation and operations
|
|
153
153
|
|
|
154
|
-
Rotation steps for every field live in the homelab repository, `03-cortex-macmini/ROTATION.md`. After any change in Vaultwarden run `specialist-cli provision`. Host state and the sudo rules are documented in `03-cortex-macmini/README.md`; the forced-command scripts are tracked under `02-pulsar-proxmox/dmz/system/`, `02-pulsar-proxmox/pulsar/system/`, `02-pulsar-proxmox/observability/system/`, `host/` of the `astronaute77/arcane` repository, `04-nexus-macstudio/system/`, and `00-frontdoor-vps/system/`.
|
|
154
|
+
Rotation steps for every field live in the homelab repository, `03-cortex-macmini/ROTATION.md`. After any change in Vaultwarden run `specialist-cli provision`. Host state and the sudo rules are documented in `03-cortex-macmini/README.md`; the forced-command scripts are tracked under `02-pulsar-proxmox/dmz/system/`, `02-pulsar-proxmox/pulsar/system/`, `06-space-x-proxmox/system/`, `02-pulsar-proxmox/observability/system/`, `host/` of the `astronaute77/arcane` repository, `04-nexus-macstudio/system/`, and `00-frontdoor-vps/system/`.
|
|
155
155
|
|
|
156
156
|
All nine planned specialists exist. See `AGENTS.md` for how to add one.
|
|
@@ -80,6 +80,8 @@ ${Object.values(UNIFI_READS)
|
|
|
80
80
|
unifi <37|mira> app-get <path> [--local] any GET of the Network application under /api/s/default/ or /v2/api/site/default/
|
|
81
81
|
unifi <37|mira> device-network <deviceId> <json> [--local]
|
|
82
82
|
set a device's management network and IP (keys mgmt_network_id, config_network)
|
|
83
|
+
unifi <37|mira> app-policy-delete <policyId> [--local]
|
|
84
|
+
delete a firewall policy the official API lists without an id
|
|
83
85
|
unifi <37|mira> nat [--local] the console's NAT rules (Policy Table; not in the official API)
|
|
84
86
|
unifi <37|mira> nat-write POST <json> | PUT <ruleId> <json> | DELETE <ruleId> [--local]
|
|
85
87
|
unifi <37|mira> fingerprint the local console's certificate fingerprint (for the pin)
|
|
@@ -223,6 +225,13 @@ export function deviceNetworkWrite(args: string[]): UnifiWrite {
|
|
|
223
225
|
return { method: "PUT", path: `/api/s/default/rest/device/${id}`, body };
|
|
224
226
|
}
|
|
225
227
|
|
|
228
|
+
/** `app-policy-delete <policyId>`: a firewall policy that the official API returns with `id: null` (rules converted from the old firewall). */
|
|
229
|
+
export function appPolicyDelete(args: string[]): UnifiWrite {
|
|
230
|
+
const [id, ...extra] = args;
|
|
231
|
+
if (id === undefined || !NAT_ID.test(id) || extra.length > 0) throw new UsageError("app-policy-delete <24-hex policyId from app-get /v2/api/site/default/firewall-policies>");
|
|
232
|
+
return { method: "DELETE", path: `/v2/api/site/default/firewall-policies/${id}` };
|
|
233
|
+
}
|
|
234
|
+
|
|
226
235
|
/** `nat-write POST <json>`, `nat-write PUT <ruleId> <json>`, or `nat-write DELETE <ruleId>`. */
|
|
227
236
|
export function natWrite(args: string[]): UnifiWrite {
|
|
228
237
|
const [method, first, second, ...extra] = args;
|
|
@@ -330,6 +339,10 @@ async function unifi(args: string[]): Promise<number> {
|
|
|
330
339
|
return 0;
|
|
331
340
|
}
|
|
332
341
|
if (rest[0] === "app-get") return printAnswer(await siteRequest(site, readSite(site), local, appGetPath(rest.slice(1)), "GET", undefined, "app"), `UniFi ${site} application`);
|
|
342
|
+
if (rest[0] === "app-policy-delete") {
|
|
343
|
+
const call = appPolicyDelete(rest.slice(1));
|
|
344
|
+
return printAnswer(await siteRequest(site, readSite(site), local, call.path, call.method, undefined, "app"), `UniFi ${site} policy`);
|
|
345
|
+
}
|
|
333
346
|
if (rest[0] === "device-network") {
|
|
334
347
|
const call = deviceNetworkWrite(rest.slice(1));
|
|
335
348
|
return printAnswer(await siteRequest(site, readSite(site), local, call.path, call.method, call.body, "app"), `UniFi ${site} device`);
|
|
@@ -11,7 +11,7 @@ import { buildInferenceRemote, command as inferenceCommand } from "./inference/r
|
|
|
11
11
|
import { MAX_ADD_IDS, MAX_EXCLUDE_IDS, buildTrendarrCall, interpretRun, parseImdbIds, trendarrConfig, trendarrError, trendarrWarnings, command as mediaCommand } from "./media/run.ts";
|
|
12
12
|
import { ServiceError, UsageError } from "./lib/errors.ts";
|
|
13
13
|
import { safeRepoPath, safeWritePath } from "./lib/repo.ts";
|
|
14
|
-
import { appGetPath, buildPulsarRemote, cloudPath, deviceNetworkWrite, NAT_PATH, natWrite, parseQuery, parseSiteArgs, unifiPath, unifiWrite, command as networkCommand } from "./network/run.ts";
|
|
14
|
+
import { appGetPath, appPolicyDelete, buildPulsarRemote, cloudPath, deviceNetworkWrite, NAT_PATH, natWrite, parseQuery, parseSiteArgs, unifiPath, unifiWrite, command as networkCommand } from "./network/run.ts";
|
|
15
15
|
import { buildHostRemote, splitHost, needsConfirm, parseSetPairs, parseVmid, validateApiPath as validatePvePath, command as proxmoxCommand } from "./proxmox/run.ts";
|
|
16
16
|
import { banLength, buildObsRemote, compactDecisions, parseGoDuration, summariseAlerts, summariseVulns, summariseWazuh, vulnEvents, wazuhEvents, command as securityCommand } from "./security/run.ts";
|
|
17
17
|
|
|
@@ -118,6 +118,8 @@ describe("network wrapper", () => {
|
|
|
118
118
|
it("limits application reads and device network writes", () => {
|
|
119
119
|
const id = "0123456789abcdef01234567";
|
|
120
120
|
expect(appGetPath(["/api/s/default/stat/device"])).toBe("/api/s/default/stat/device");
|
|
121
|
+
expect(appPolicyDelete(["0123456789abcdef01234567"])).toEqual({ method: "DELETE", path: "/v2/api/site/default/firewall-policies/0123456789abcdef01234567" });
|
|
122
|
+
expect(() => appPolicyDelete(["611cef69-df2e-4498-9845-8685daee84f3"])).toThrow(UsageError);
|
|
121
123
|
expect(appGetPath(["/v2/api/site/default/nat"])).toBe("/v2/api/site/default/nat");
|
|
122
124
|
expect(() => appGetPath(["/api/s/other/stat/device"])).toThrow(UsageError);
|
|
123
125
|
expect(() => appGetPath(["/api/s/default/../../x"])).toThrow(UsageError);
|