@tyhld/conductor 0.12.178 → 0.12.179
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.
- package/dist/selfcheck.js +73 -0
- package/package.json +1 -1
package/dist/selfcheck.js
CHANGED
|
@@ -1179,6 +1179,7 @@ function managedWhere(p) {
|
|
|
1179
1179
|
* 1 置き場の有無と持ち主・権限 2 読めるか 3 書式が正しいか 4 安全を下げる明示が無いか
|
|
1180
1180
|
* 5 対象の版で確かめてあるか(+実体の手がかり) 6 必要な守りの登録が在るか
|
|
1181
1181
|
* 7 実際に守りが働いたか(★この項目では確かめられない=必ず「未確認」と出す) 8 抜け道の見張り
|
|
1182
|
+
* 9 設定が囲いの通信を記録の proxy へ向けているなら、proxy が待っているか(★待っていなければ FAIL・便 29d95ae4)
|
|
1182
1183
|
*
|
|
1183
1184
|
* 【★合否の決め方】
|
|
1184
1185
|
* ・3(書式)か 4(安全を下げる明示)が駄目 → FAIL(fault)。★壊れていると、そのPCで
|
|
@@ -1287,8 +1288,80 @@ function checkManaged(d, claude) {
|
|
|
1287
1288
|
note(item, st.windowsDir.exists
|
|
1288
1289
|
? `8 見張り: ★Windows 側の置き場が在ります(${st.windowsDir.name}・持ち主 ${st.windowsDir.owner}・権限 ${st.windowsDir.mode})`
|
|
1289
1290
|
: '8 見張り: Windows 側の置き場はありません');
|
|
1291
|
+
// 9. 設定が囲いの通信を記録の proxy へ向けているなら、proxy が待っているか(便 29d95ae4)
|
|
1292
|
+
checkManagedProxy(d, item, good.map((f) => f.json));
|
|
1290
1293
|
return item;
|
|
1291
1294
|
}
|
|
1295
|
+
/** 記録の proxy を起こし直す1行(★利用者の systemd の常駐を入れ直す・無い PC は setsid の形で起こす)。 */
|
|
1296
|
+
export const SANDBOX_PROXY_FIX_COMMAND = 'bash ~/projects/conductor/scripts/sandbox-proxy/resident.sh install';
|
|
1297
|
+
/** 設定が囲いの通信を向けるポート(sandbox.network の httpProxyPort・socksProxyPort・重なりは1つ)。 */
|
|
1298
|
+
export function managedProxyPorts(bodies) {
|
|
1299
|
+
const ports = new Set();
|
|
1300
|
+
for (const b of bodies) {
|
|
1301
|
+
const sb = b?.sandbox;
|
|
1302
|
+
const net = sb && typeof sb === 'object' ? sb.network : null;
|
|
1303
|
+
if (!net || typeof net !== 'object')
|
|
1304
|
+
continue;
|
|
1305
|
+
for (const k of ['httpProxyPort', 'socksProxyPort']) {
|
|
1306
|
+
const v = net[k];
|
|
1307
|
+
if (typeof v === 'number' && Number.isInteger(v) && v > 0 && v < 65536)
|
|
1308
|
+
ports.add(v);
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
return [...ports].sort((a, b) => a - b);
|
|
1312
|
+
}
|
|
1313
|
+
/**
|
|
1314
|
+
* この機で「待っている」TCP のポート(<proc>/net/tcp・tcp6 の状態 0A=LISTEN)。読めなければ null。
|
|
1315
|
+
* ★中身を読むのは番号と状態の欄だけ(相手の宛先は見ない)。
|
|
1316
|
+
*/
|
|
1317
|
+
export function listeningTcpPorts(procDir) {
|
|
1318
|
+
const out = new Set();
|
|
1319
|
+
let read = 0;
|
|
1320
|
+
for (const name of ['tcp', 'tcp6']) {
|
|
1321
|
+
let body;
|
|
1322
|
+
try {
|
|
1323
|
+
body = readFileSync(path.join(procDir, 'net', name), 'utf8');
|
|
1324
|
+
}
|
|
1325
|
+
catch {
|
|
1326
|
+
continue;
|
|
1327
|
+
}
|
|
1328
|
+
read++;
|
|
1329
|
+
for (const line of body.split('\n').slice(1)) {
|
|
1330
|
+
const f = line.trim().split(/\s+/);
|
|
1331
|
+
if (f.length < 4 || f[3] !== '0A')
|
|
1332
|
+
continue;
|
|
1333
|
+
const port = parseInt(f[1].split(':').pop() ?? '', 16);
|
|
1334
|
+
if (Number.isInteger(port))
|
|
1335
|
+
out.add(port);
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
return read > 0 ? out : null;
|
|
1339
|
+
}
|
|
1340
|
+
/**
|
|
1341
|
+
* 9 残した設定が囲いの通信を記録の proxy(18080/18081)へ向けているのに proxy が待っていなければ、赤(FAIL)。
|
|
1342
|
+
* ★proxy が居ないと、その PC のすべての職人の git push・npm・gh がつながらない(便 29d95ae4)。
|
|
1343
|
+
* ★/proc の一覧が読めない機では「未確認」と出すだけ(合否に数えない)。
|
|
1344
|
+
*/
|
|
1345
|
+
function checkManagedProxy(d, item, bodies) {
|
|
1346
|
+
const ports = managedProxyPorts(bodies);
|
|
1347
|
+
if (ports.length === 0) {
|
|
1348
|
+
note(item, '9 通信の記録の proxy: 設定は囲いの通信を proxy へ向けていません');
|
|
1349
|
+
return;
|
|
1350
|
+
}
|
|
1351
|
+
const procDir = d.procDir ?? '/proc';
|
|
1352
|
+
const listening = listeningTcpPorts(procDir);
|
|
1353
|
+
if (!listening) {
|
|
1354
|
+
note(item, `9 通信の記録の proxy: 未確認(${procDir}/net の一覧を読めません・設定はポート ${ports.join('・')} へ向けています)`);
|
|
1355
|
+
return;
|
|
1356
|
+
}
|
|
1357
|
+
const down = ports.filter((p) => !listening.has(p));
|
|
1358
|
+
if (down.length === 0) {
|
|
1359
|
+
note(item, `9 通信の記録の proxy: 設定が向けるポート ${ports.join('・')} で待っています`);
|
|
1360
|
+
return;
|
|
1361
|
+
}
|
|
1362
|
+
fail(item, 'human', `9 ★設定は囲いの通信を記録の proxy(ポート ${ports.join('・')})へ向けていますが、${down.join('・')} で待っている物がありません` +
|
|
1363
|
+
`=囲いの中の git push・npm・gh がつながりません(直し方: ${SANDBOX_PROXY_FIX_COMMAND})`, { machine: d.machine, what: 'Ubuntu で記録の proxy を利用者の常駐で起こし直す(sudo は要りません)', command: SANDBOX_PROXY_FIX_COMMAND });
|
|
1364
|
+
}
|
|
1292
1365
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
1293
1366
|
// +安全を外す指定の見張り(便 728c3bcc・けいさん承諾 2026-10-09 19:09/19:18 の決定)
|
|
1294
1367
|
// ─────────────────────────────────────────────────────────────────────────────
|