Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -327,3 +327,63 @@ silence monitoring indefinitely. Manual maintenance/journal gates remain separat

Deployment requires both the status web/incident-worker changes and the broker
refresh check. Merging this source does not deploy either component.

### Devnet operator keys

Connect → **Private devnet keys** is available to operators of that managed
console devnet (including admins), not viewers or anonymous users. Reveal uses
POST `/api/networks/:name/keys` with the existing session, same-origin and CSRF
checks. Grants reload before and after retrieval. Mainnet/Testnet are excluded.
The ordinary connection files and event stream never contain keys.

Deploy `deploy/devnet-keys-compose.yml` with the same source image as web.
Create `/srv/dash-status/key-access` owned by uid1000, mode0700. The `keys`
service is a separate, read-only collector, not a network operation runner:
it exposes only a mode0600 Unix socket, checks current network/operator grants,
requires an idle ready devnet, uses existing pinned SSH identities without
provisioning, and verifies EC2 instance, Core chain and on-chain ProTx identities.
It reads only the registered voting/owner/collateral keys and BLS/P2P identities,
plus the devnet's spork/payout/faucet addresses. It never changes or unlocks a
wallet, generates keys, or writes keys to disk. RPC/SSH/TLS credentials are not
returned. Web mounts only the socket directory, never the agent's credentials.

Responses are `private, no-store`; audit output contains only actor ID, network
and time. UI data clears on hiding, unmount, background tab or five minutes.
Downloads are explicit private JSON files. Failures return a generic error;
never log raw SSH/RPC responses while troubleshooting key access.

### CI host remediation exclusions

An operator can set `remediation.excludedCiHosts` in the persisted `settings.json`
to an array of exact CI reporter IDs (for example, `['strix-pasta']`, using JSON
quotes in the actual file). This excludes host-scoped incidents and failed jobs
from automated response and the remediation view without removing the reporter,
CI history, resource observations, or CI page entry. Existing incidents remain
recorded, not falsely resolved; unsent events are retained in quarantine with an
explicit exclusion reason. The receiver's fresh-issue suppression gate prevents
already-delivered events from starting repairs. Removing the ID re-enables
admission after a fresh observation. This does not cancel an already-running
response; settle that owner separately before changing its work.

Console GitHub login sessions last seven days from sign-in (both the server session and browser cookie). Existing sessions keep their original expiry; sign in again to receive the new lifetime.

After a console deployment, verify retained capabilities as well as legacy APIs:

```sh
node scripts/check-console-features.mjs https://status.testnet.networks.dash.org
node scripts/check-legacy-api.mjs https://status.testnet.networks.dash.org 82
```

The feature gate checks Remediation, website monitoring, CI queue APIs and their frontend navigation. A passing `/api/health` alone must not certify a console rollout. Preserve deployed integrations when updating the separately built network executor.

For an executor/agent promotion, also run `scripts/check-rollout-backend.mjs`
inside **both candidate images** (mount the script read-only if it is not baked
in). It checks the actual agent validator, plan binding, and both CLI planning
commands without network access. Run the `requested concurrency` integration
test in `agent/agent.test.js` against the candidate agent modules as well.
Check retained features against the last verified complete release, not just the
currently deployed image: on 2026-11-17 a regressed agent silently dropped a
saved `concurrency: 3` request while the restored web correctly displayed it.
Retain the merged engine's Platform protocol compatibility fixes. Do not replace
an active operation's pinned executable/plan; promote only after the agent is
idle and recheck its queue and child processes at cutover.
90 changes: 87 additions & 3 deletions agent/agent.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ test('requests are validated against the network and component repositories', ()
});

// Fake dashnet: writes the --out artifact each command would produce.
function fakeDashnet(calls) {
function fakeDashnet(calls, journal = { missing: true }) {
return (binary, args) => {
const child = new EventEmitter();
child.stdout = new EventEmitter(); child.stderr = new EventEmitter();
Expand All @@ -72,6 +72,14 @@ function fakeDashnet(calls) {
const out = args[args.indexOf('--out') + 1];
setImmediate(() => {
const cmd = args[0];
if (cmd === 'managed-operation') {
if (journal.spawnError) { child.emit('error', new Error(journal.spawnError)); child.emit('close', -2); return; }
if (journal.missing) child.stderr.emit('data', 'dashnet: operation not found\n');
else if (journal.error) child.stderr.emit('data', journal.error + '\n');
else if (!journal.noOutput) writeFileSync(out, JSON.stringify(journal.record ? { record: journal.record } : journal));
child.emit('close', journal.missing || journal.error ? 1 : 0);
return;
}
if (cmd === 'managed-import') writeFileSync(out, JSON.stringify({ id: 'a'.repeat(64), nodes: { 'seed-2': { components: { tenderdash: { image: 'dashpay/tenderdash:1.8.1', digests: ['dashpay/tenderdash@sha256:' + 'b'.repeat(64)] } } } } }));
if (cmd === 'managed-enroll') { child.stderr.emit('data', 'runner: ' + 'c'.repeat(32) + '\nenrolled seed-2; services unchanged\n'); writeFileSync(out, '{}'); }
if (cmd === 'managed-plan') writeFileSync(out, JSON.stringify({ id: 'd'.repeat(64), operation: 'upgrade', images: { 'seed-2': { tenderdash: 'index.docker.io/dashpay/tenderdash@sha256:' + 'e'.repeat(64) } } }));
Expand All @@ -81,12 +89,87 @@ function fakeDashnet(calls) {
setTimeout(() => { child.stderr.emit('data', 'managed target seed-2 ready\nmanaged-verifying\nmanaged target seed-2 applied\nmanaged-verifying\n'); child.emit('close', 0); }, 150);
return;
}
child.emit('close', cmd === 'managed-operation' ? 1 : 0);
child.emit('close', 0);
});
return child;
};
}

async function prepareWithJournal(journal, options) {
const root = mkdtempSync(join(tmpdir(), 'ops-journal-'));
const dirs = { data: root, private: join(root, 'private'), requests: join(root, 'req'), ops: join(root, 'ops'), work: join(root, 'work'), state: join(root, 'state') };
const calls = [];
const ops = createOps({ settings: () => settings, dirs, key: { path: '/key' }, pool: { knownHosts: () => 'x\n', pins: new Proxy({}, { get: () => ({ type: 'ssh-ed25519', key: 'k' }) }) }, binary: 'dashnet', log: () => {}, spawnImpl: fakeDashnet(calls, journal) });
mkdirSync(dirs.state, { recursive: true });
writeFileSync(join(dirs.state, 'testnet.json'), JSON.stringify({ hosts: [host('seed-2', 'seed', [['dashd', 'dashpay/dashd'], ['tenderdash', 'dashpay/tenderdash']])] }));
const id = '6c8139ad-e92f-40da-943d-1e001efaccb5', actor = { id: 9920871, login: 'ktechmidas' };
writeFileSync(join(dirs.requests, `${id}.json`), JSON.stringify({ type: 'create', id, network: 'testnet', action: 'upgrade', options, nodes: ['seed-2'], components: ['tenderdash'], images: { tenderdash: 'dashpay/tenderdash:1.8.2' }, actor }));
const read = () => JSON.parse(readFileSync(join(dirs.ops, `${id}.json`), 'utf8'));
const until = async (statuses) => {
for (let i = 0; i < 200; i++) { ops.tick(); if (statuses.includes(read().status)) return read(); await new Promise((r) => setTimeout(r, 5)); }
throw new Error(`operation did not settle: ${read().status}`);
};
await until(['review', 'failed']);
return { dirs, id, actor, calls, read, until };
}

test('requested concurrency reaches managed planner and ignored options cannot auto-run', async () => {
const { read, calls } = await prepareWithJournal({ record: { phase: 'enrolled', enrolled: { 'seed-2': true } } }, { concurrency: 3, pauseMining: false, autoRun: true });
const args = calls.find((a) => a[0] === 'managed-plan');
assert.equal(args[args.indexOf('--concurrency') + 1], '3');
// This old-executor fixture returns no rollout policy: fail before confirmation.
assert.equal(read().status, 'failed');
assert.match(read().error, /rollout|concurrency/);
assert.ok(!calls.some((a) => a[0] === 'managed-upgrade'));
});

test('journal failures stop before enrollment/planning and retain an actionable error', async (t) => {
for (const journal of [
{ error: 'dashnet: unenrolled target in operation' },
{ error: 'dashnet: AccessDeniedException: table not found' },
{ error: 'dashnet: operation not found\nextra failure' },
{ spawnError: 'spawn dashnet ENOENT' },
{ noOutput: true },
{ record: { enrolled: [] } },
]) await t.test(JSON.stringify(journal), async () => {
const { read, calls, dirs, id } = await prepareWithJournal(journal);
const r = read();
assert.equal(r.status, 'failed');
assert.match(r.error, /Cannot read management journal:/);
if (journal.error) assert.ok(r.error.includes(journal.error.split('\n').at(-1)));
assert.equal(r.steps.at(-1).name, 'Read management journal');
assert.equal(r.steps.at(-1).status, 'failed');
assert.ok(!calls.some((a) => ['managed-enroll', 'managed-plan', 'managed-upgrade', 'managed-unlock'].includes(a[0])));
assert.ok(!readdirSync(join(dirs.work, id, '1')).some((f) => f.startsWith('journal-')), 'temporary journal result cleaned up');
});
});

test('successful journal reads reuse the exact instance enrollment', async () => {
const instanceId = host('seed-2', 'seed', []).instanceId;
const { read, calls } = await prepareWithJournal({ record: { phase: 'enrolled', enrolled: { 'seed-2': true }, instances: { 'seed-2': instanceId } } });
assert.equal(read().status, 'review');
assert.ok(calls.some((a) => a[0] === 'managed-plan'));
assert.ok(!calls.some((a) => a[0] === 'managed-enroll'));
});

test('a replacement instance still needs explicit enrollment', async () => {
const { read, calls } = await prepareWithJournal({ record: { phase: 'enrolled', enrolled: { 'seed-2': true }, instances: { 'seed-2': 'i-old' } } });
assert.equal(read().status, 'review');
assert.ok(calls.some((a) => a[0] === 'managed-enroll'));
});

test('a journal failure after confirmation stops before unlock or upgrade', async () => {
const journal = { record: { phase: 'enrolled', enrolled: { 'seed-2': true } } };
const { dirs, id, actor, read, until, calls } = await prepareWithJournal(journal);
const r = read();
assert.equal(r.status, 'review');
journal.error = 'dashnet: journal revision mismatch';
writeFileSync(join(dirs.requests, `${id}.confirm.json`), JSON.stringify({ type: 'confirm', id, network: 'testnet', planId: r.review.planId, actor }));
const failed = await until(['failed']);
assert.match(failed.error, /journal revision mismatch/);
assert.ok(!calls.some((a) => ['managed-unlock', 'managed-upgrade'].includes(a[0])));
});

test('operation lifecycle: request -> enroll -> plan -> review -> confirm -> upgrade', async () => {
const root = mkdtempSync(join(tmpdir(), 'ops-'));
const dirs = { data: root, private: join(root, 'private'), requests: join(root, 'req'), ops: join(root, 'ops'), work: join(root, 'work'), state: join(root, 'state') };
Expand Down Expand Up @@ -245,13 +328,14 @@ test('platform reset: review from non-destructive stages; a failed wipe stops be
const pool = { exec: async (h, cmd) => {
const stage = cmd.split(' ')[4];
calls.push(`${stage}:${h.name}`);
assert.equal(JSON.parse(Buffer.from(cmd.split(' ')[5], 'base64')).genesisProtocolVersion,15);
const result = { baseline: { images: { drive: 'dashpay/drive:1' }, anchor: 10, epochTime: 3600, dashmate: 'dm', configFormatVersion: '4.2.0', tor: { enabled: false }, height: 100, tenderdashImage: 'dashpay/tenderdash:1' },
anchor: { height: 99, hash: 'ab' }, canary: { checks: { epochTime: 3600, epochEnv: '3600', coreSectionUnchanged: true, anchor: 99 }, rendered: ['dynamic-compose.yml'] } }[stage] || {};
const ok = !(stage === 'wipe' && h.name === failWipeOn);
return JSON.stringify({ ok, stage, result, error: ok ? undefined : 'boom' });
} };
const records = [];
const r = { id: 'x1', network: 'devnet-moutai', steps: [], request: { network: 'devnet-moutai', images: { drive: 'dashpay/drive:2', dapi: 'dashpay/rs-dapi:2', tenderdash: 'dashpay/tenderdash:2' }, options: {} } };
const r = { id: 'x1', network: 'devnet-moutai', steps: [], request: { network: 'devnet-moutai', images: { drive: 'dashpay/drive:2', dapi: 'dashpay/rs-dapi:2', tenderdash: 'dashpay/tenderdash:2' }, options: {genesisProtocolVersion:15} } };
const ctx = { step: () => () => {}, save: (x) => records.push(x.status), write: () => {} };
const reset = createReset({ ctx, dirs, pool, getSettings: () => settings });
await reset.prepareReset(r);
Expand Down
2 changes: 1 addition & 1 deletion agent/devnet-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function devnetFacts({ name, reg = {}, plan, record, lock, reset }) {
seeds: [...hosts.filter((h) => h.role === 'wallet'), ...validators].filter((h) => h.publicIp).slice(0, 4).map((h) => `${h.publicIp}:${ports.coreP2P}`),
},
platform: {
chainId: plan.platformChainId, initialProtocolVersion: plan.initialProtocolVersion, epochSeconds: plan.platformEpochSeconds || 3600,
chainId: plan.platformChainId, initialProtocolVersion: reset?.genesisProtocolVersion ?? plan.initialProtocolVersion, epochSeconds: plan.platformEpochSeconds || 3600,
genesisTime: plan.genesisTime, quorums: PROFILE.quorums, tenderdashP2P: ports.tenderdashP2P,
gatewayTls: plan.gatewayTls ? 'letsencrypt' : 'self-signed',
dapi: validators.filter((h) => h.publicIp).map((h) => `https://${h.publicIp}:${ports.gateway}`),
Expand Down
3 changes: 2 additions & 1 deletion agent/devnet-config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ test('the agent writes facts for live console devnets and rewrites them when the
utimesSync(join(work, 'deployment.json'), new Date(), new Date(Date.now() + 5000));
refresh();
assert.equal(JSON.parse(readFileSync(out, 'utf8')).platform.epochSeconds, 600);
writeFileSync(join(work, 'platform-reset.json'), JSON.stringify({ anchor: { height: 9000 } }));
writeFileSync(join(work, 'platform-reset.json'), JSON.stringify({ anchor: { height: 9000 }, genesisProtocolVersion:15 }));
refresh();
assert.equal(JSON.parse(readFileSync(out, 'utf8')).platform.initialProtocolVersion,15);
assert.equal(JSON.parse(readFileSync(out, 'utf8')).core.genesisCoreHeight, 9000, 'Connect follows verified reset anchor, not the original creation');
});
2 changes: 2 additions & 0 deletions agent/devnet-keys-service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { startKeyService } from './devnet-keys.js';
startKeyService({ dataDir: process.env.STATUS_DATA_DIR || '/data', privateDir: process.env.AGENT_PRIVATE_DIR || '/agent', socketPath: process.env.DEVNET_KEYS_SOCKET || '/key-access/keys.sock' });
Loading
Loading