@rakay-technology/kraft 0.7.9 → 0.7.13

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.
Files changed (46) hide show
  1. package/dist/bare-5S7IYNHZ.js +27 -0
  2. package/dist/{chunk-VFPLICBX.js → chunk-3AZY56JP.js} +107 -32
  3. package/dist/{chunk-IGTODKUA.js → chunk-5RWL7EFH.js} +5 -5
  4. package/dist/{chunk-ZQJU5CTZ.js → chunk-7VMXN646.js} +1 -1
  5. package/dist/{chunk-DJNKEVZ7.js → chunk-AADWLI2S.js} +1 -1
  6. package/dist/{chunk-MOSINQAM.js → chunk-AFUXAAFQ.js} +16 -388
  7. package/dist/{chunk-2UQFOUSZ.js → chunk-B2CUYCGY.js} +49 -16
  8. package/dist/{chunk-7O6MARHJ.js → chunk-B6B42QMZ.js} +9 -9
  9. package/dist/{chunk-HFOE2IXZ.js → chunk-BIOW6K3V.js} +1 -1
  10. package/dist/{chunk-YY5DEAZI.js → chunk-BQMBJ32I.js} +2 -2
  11. package/dist/{chunk-ULEEWX5M.js → chunk-C3LRTROB.js} +39 -8
  12. package/dist/{chunk-DFVWR6JM.js → chunk-C74WJ3U4.js} +2 -2
  13. package/dist/{chunk-K24SBFI2.js → chunk-D2IM25JV.js} +1 -1
  14. package/dist/{chunk-MC4X55BW.js → chunk-DNC4A3MZ.js} +3 -3
  15. package/dist/{chunk-3RCXJZJD.js → chunk-E3J47WO3.js} +1 -1
  16. package/dist/chunk-G4VGNFGV.js +27374 -0
  17. package/dist/{chunk-JK7KKBXI.js → chunk-KHAT3OZP.js} +4 -4
  18. package/dist/{chunk-7UKBMDUF.js → chunk-MK6GYBO4.js} +9 -9
  19. package/dist/{chunk-SPKRI7MF.js → chunk-N7AJ2D4I.js} +96 -12
  20. package/dist/{chunk-ZNVAHQRY.js → chunk-Q7FAE2MB.js} +6 -6
  21. package/dist/{chunk-2Y62WP2D.js → chunk-QCGVPIYN.js} +2 -2
  22. package/dist/{chunk-PCOTSRS4.js → chunk-QLPQ5NFE.js} +3 -3
  23. package/dist/{chunk-DI54Y66N.js → chunk-QPUEAYB3.js} +3 -3
  24. package/dist/{chunk-XBGSR22I.js → chunk-XAEYWDBX.js} +53 -9
  25. package/dist/{chunk-HLF5PMKE.js → chunk-Y2MET6MX.js} +1 -1
  26. package/dist/{chunk-BN23UUSF.js → chunk-YXXWTBXB.js} +1 -1
  27. package/dist/{detect-N4HFQZ6Y.js → detect-NDVA2MAF.js} +4 -4
  28. package/dist/{docker-DU7JA2AK.js → docker-Z2ILAC7A.js} +8 -8
  29. package/dist/{docker-edge-executor-MPIPQHNF.js → docker-edge-executor-JID2Q2HZ.js} +7 -7
  30. package/dist/{edge-import-RZD7MMOE.js → edge-import-WRU5JQ43.js} +22 -22
  31. package/dist/{edge-preflight-6YO27PPQ.js → edge-preflight-6FYNGFIH.js} +13 -13
  32. package/dist/{ensure-container-edge-ZKEKC47H.js → ensure-container-edge-VFCVCXW3.js} +11 -11
  33. package/dist/{executor-ZWF2J7GS.js → executor-LNKX5OMQ.js} +6 -6
  34. package/dist/{host-channel-preflight-Z64G3NIM.js → host-channel-preflight-V7Q6GPXE.js} +22 -22
  35. package/dist/index.js +40 -40
  36. package/dist/{local-executor-W3O5HDLM.js → local-executor-NPLQMF6A.js} +3 -3
  37. package/dist/{nginx-XLDZIG4E.js → nginx-V6DQWKON.js} +11 -9
  38. package/dist/{openresty-lua-ZNE6IBYU.js → openresty-lua-OECMHHON.js} +21 -7
  39. package/dist/{privilege-IMARWVU2.js → privilege-KI56M7OQ.js} +5 -5
  40. package/dist/server/index.js +1897 -58664
  41. package/dist/{setup-Q6GGIJ4Q.js → setup-A2LJ4IWU.js} +12 -12
  42. package/dist/{ssh-client-LOCZTEUC.js → ssh-client-NRBHQJVZ.js} +2 -2
  43. package/dist/{up-TU7622HW.js → up-XHQK2O2M.js} +25 -25
  44. package/package.json +1 -1
  45. package/dist/bare-JM3EX7S4.js +0 -27
  46. package/dist/chunk-ND23EK7Y.js +0 -81645
@@ -7,20 +7,20 @@ import {
7
7
  composeInstallExists,
8
8
  readComposeEnvFile,
9
9
  startUnitHint
10
- } from "./chunk-2UQFOUSZ.js";
10
+ } from "./chunk-B2CUYCGY.js";
11
11
  import {
12
12
  INTERNAL_TOKEN_FILE,
13
13
  OS_DIR
14
14
  } from "./chunk-5GPXMTE4.js";
15
15
  import {
16
16
  edgeCrashReason
17
- } from "./chunk-PCOTSRS4.js";
17
+ } from "./chunk-QLPQ5NFE.js";
18
18
  import {
19
19
  LocalExecutor
20
- } from "./chunk-HFOE2IXZ.js";
20
+ } from "./chunk-BIOW6K3V.js";
21
21
  import {
22
22
  EDGE_CONTAINER_NAME
23
- } from "./chunk-3RCXJZJD.js";
23
+ } from "./chunk-E3J47WO3.js";
24
24
 
25
25
  // src/lib/edge-import.ts
26
26
  import chalk from "chalk";
@@ -16,32 +16,32 @@ import {
16
16
  splitRuntimeEnv,
17
17
  sq,
18
18
  transferLocalDirectory
19
- } from "./chunk-DFVWR6JM.js";
19
+ } from "./chunk-C74WJ3U4.js";
20
20
  import {
21
21
  LocalExecutor
22
- } from "./chunk-HFOE2IXZ.js";
22
+ } from "./chunk-BIOW6K3V.js";
23
23
  import {
24
24
  privilegedExecutor
25
- } from "./chunk-DI54Y66N.js";
25
+ } from "./chunk-QPUEAYB3.js";
26
26
  import {
27
27
  portOccupantDetails,
28
28
  probeListeningPort
29
- } from "./chunk-2Y62WP2D.js";
29
+ } from "./chunk-QCGVPIYN.js";
30
30
  import {
31
31
  managedDeploymentUnitName,
32
32
  probeExec,
33
33
  withReason
34
- } from "./chunk-3RCXJZJD.js";
34
+ } from "./chunk-E3J47WO3.js";
35
35
  import {
36
36
  HOST_STATE_DIR,
37
37
  envOps,
38
38
  hostRefusal,
39
39
  opScript
40
- } from "./chunk-ZQJU5CTZ.js";
40
+ } from "./chunk-7VMXN646.js";
41
41
  import {
42
42
  ensureOwnedDir,
43
43
  resolveEnvironment
44
- } from "./chunk-YY5DEAZI.js";
44
+ } from "./chunk-BQMBJ32I.js";
45
45
  import {
46
46
  formatDuration,
47
47
  isRemoteConnectionError,
@@ -51,7 +51,7 @@ import {
51
51
  import {
52
52
  sq as sq2,
53
53
  wrapLocalBuildCommand
54
- } from "./chunk-BN23UUSF.js";
54
+ } from "./chunk-YXXWTBXB.js";
55
55
  import {
56
56
  DeployError,
57
57
  LANGUAGES,
@@ -65,7 +65,7 @@ import {
65
65
  refused,
66
66
  safeErrorMessage,
67
67
  shellQuote
68
- } from "./chunk-ND23EK7Y.js";
68
+ } from "./chunk-G4VGNFGV.js";
69
69
 
70
70
  // ../../packages/adapters/src/system/remote-journal.ts
71
71
  var OPSH_RUN_VERSION = 1;
@@ -8,17 +8,17 @@ import {
8
8
  import {
9
9
  getTarCreateEnv,
10
10
  prepareSourceTarArgs
11
- } from "./chunk-K24SBFI2.js";
11
+ } from "./chunk-D2IM25JV.js";
12
12
  import {
13
13
  connectSshClient,
14
14
  openDockerDialStdioChannel,
15
15
  openSftp,
16
16
  openSshUnixSocket,
17
17
  reconcileKnownHosts
18
- } from "./chunk-DJNKEVZ7.js";
18
+ } from "./chunk-AADWLI2S.js";
19
19
  import {
20
20
  LocalExecutor
21
- } from "./chunk-HFOE2IXZ.js";
21
+ } from "./chunk-BIOW6K3V.js";
22
22
  import {
23
23
  HostChannelUnavailableError,
24
24
  SshDisconnectedError,
@@ -33,7 +33,7 @@ import {
33
33
  hasLocalCommand,
34
34
  logEntry,
35
35
  sq
36
- } from "./chunk-BN23UUSF.js";
36
+ } from "./chunk-YXXWTBXB.js";
37
37
  import {
38
38
  HOST_CHANNEL_AUTH_REJECTED,
39
39
  HOST_CHANNEL_NOT_PROVISIONED,
@@ -44,7 +44,7 @@ import {
44
44
  hostChannelAccount,
45
45
  hostFirewallRule,
46
46
  safeErrorMessage
47
- } from "./chunk-ND23EK7Y.js";
47
+ } from "./chunk-G4VGNFGV.js";
48
48
 
49
49
  // ../../packages/adapters/src/system/executor.ts
50
50
  import { existsSync, readFileSync } from "fs";
@@ -1483,7 +1483,95 @@ import { randomBytes as randomBytes2 } from "crypto";
1483
1483
 
1484
1484
  // ../../packages/adapters/src/system/system-ssh.ts
1485
1485
  import { randomBytes } from "crypto";
1486
+ var SSH_ARGS_MAX_CHARS = 512;
1487
+ var SSH_JUMP_HOST_MAX_CHARS = 1024;
1488
+ function validateSshJumpHost(raw) {
1489
+ const trimmed = raw?.trim() ?? "";
1490
+ if (!trimmed) return "";
1491
+ if (trimmed.length > SSH_JUMP_HOST_MAX_CHARS) {
1492
+ throw new Error(
1493
+ `sshJumpHost: exceeds ${SSH_JUMP_HOST_MAX_CHARS} chars (got ${trimmed.length})`
1494
+ );
1495
+ }
1496
+ if (trimmed.includes("\0") || trimmed.includes("\n") || trimmed.includes("\r")) {
1497
+ throw new Error("sshJumpHost: contains illegal characters");
1498
+ }
1499
+ if (/\s/.test(trimmed)) {
1500
+ throw new Error("sshJumpHost: must not contain whitespace");
1501
+ }
1502
+ if (trimmed.includes("\\") || /\$\{|\$\(|`/.test(trimmed) || trimmed.startsWith("-")) {
1503
+ throw new Error("sshJumpHost: shell expansions and flags are not allowed");
1504
+ }
1505
+ const hops = trimmed.split(",");
1506
+ if (hops.length === 0) throw new Error("sshJumpHost: is empty");
1507
+ const HOP_RE = /^(?:[A-Za-z0-9._~-]+@)?(?:[A-Za-z0-9](?:[A-Za-z0-9.-]*[A-Za-z0-9])?|\[[0-9A-Fa-f:.]+\]|%[hr])$/;
1508
+ for (const hop of hops) {
1509
+ if (!HOP_RE.test(hop)) {
1510
+ throw new Error(`sshJumpHost: invalid hop "${hop.slice(0, 64)}"`);
1511
+ }
1512
+ }
1513
+ return trimmed;
1514
+ }
1486
1515
  var CONNECT_TIMEOUT_SECONDS = 15;
1516
+ var ALLOWED_SSH_OPTION_KEYS = /* @__PURE__ */ new Set([
1517
+ "BatchMode",
1518
+ "ConnectTimeout",
1519
+ "IPQoS",
1520
+ "ServerAliveCountMax",
1521
+ "ServerAliveInterval",
1522
+ "StrictHostKeyChecking"
1523
+ ]);
1524
+ var SSH_ARG_VALUE_RE = /^[A-Za-z0-9._-]+$/;
1525
+ var DANGEROUS_SSH_OPTION_RE = /^(proxycommand|localcommand|permitlocalcommand|forwardagent|proxyjump|proxyusefdpass|localforward|remoteforward|dynamicforward|controlpath|controlmaster|controlpersist|identityfile|certificatefile|userknownhostsfile|globalknownhostsfile|pkcs11provider|securitykeyprovider)$/i;
1526
+ function validateSshArgs(raw) {
1527
+ if (!raw?.trim()) return [];
1528
+ const trimmed = raw.trim();
1529
+ if (trimmed.length > SSH_ARGS_MAX_CHARS) {
1530
+ throw new Error(
1531
+ `sshArgs: exceeds ${SSH_ARGS_MAX_CHARS} chars (got ${trimmed.length})`
1532
+ );
1533
+ }
1534
+ if (trimmed.includes("\0") || trimmed.includes("\n") || trimmed.includes("\r")) {
1535
+ throw new Error("sshArgs: contains illegal characters");
1536
+ }
1537
+ if (/\$\{|\$\(|`/.test(trimmed) || trimmed.includes("\\")) {
1538
+ throw new Error("sshArgs: shell expansions are not allowed");
1539
+ }
1540
+ const tokens = trimmed.split(/\s+/);
1541
+ const out = [];
1542
+ for (let i = 0; i < tokens.length; i++) {
1543
+ const flag = tokens[i];
1544
+ if (flag !== "-o") {
1545
+ throw new Error(
1546
+ `sshArgs: only "-o Key=Value" options are allowed (got "${flag.slice(0, 32)}")`
1547
+ );
1548
+ }
1549
+ const kv = tokens[++i];
1550
+ if (!kv || !kv.includes("=")) {
1551
+ throw new Error('sshArgs: "-o" must be followed by Key=Value');
1552
+ }
1553
+ const eq = kv.indexOf("=");
1554
+ const key = kv.slice(0, eq);
1555
+ const value = kv.slice(eq + 1);
1556
+ if (!key || !value) {
1557
+ throw new Error('sshArgs: "-o" must be followed by Key=Value');
1558
+ }
1559
+ if (DANGEROUS_SSH_OPTION_RE.test(key)) {
1560
+ throw new Error(`sshArgs: option "${key}" is not allowed`);
1561
+ }
1562
+ if (!ALLOWED_SSH_OPTION_KEYS.has(key)) {
1563
+ throw new Error(`sshArgs: option "${key}" is not allowed`);
1564
+ }
1565
+ if (!SSH_ARG_VALUE_RE.test(value)) {
1566
+ throw new Error(`sshArgs: invalid value for "${key}"`);
1567
+ }
1568
+ if ((key === "ConnectTimeout" || key === "ServerAliveInterval" || key === "ServerAliveCountMax") && !/^\d{1,3}$/.test(value)) {
1569
+ throw new Error(`sshArgs: "${key}" must be a number (got "${value}")`);
1570
+ }
1571
+ out.push("-o", `${key}=${value}`);
1572
+ }
1573
+ return out;
1574
+ }
1487
1575
  function makeControlPath() {
1488
1576
  return `/tmp/kraft-ssh-${process.pid}-${randomBytes(6).toString("hex")}.sock`;
1489
1577
  }
@@ -1514,13 +1602,9 @@ function buildBaseSshArgs(config, controlPath) {
1514
1602
  "ControlPersist=300"
1515
1603
  ];
1516
1604
  if (config.sshJumpHost?.trim()) {
1517
- args.push("-J", config.sshJumpHost.trim());
1518
- }
1519
- if (config.sshArgs?.trim()) {
1520
- for (const token of config.sshArgs.trim().split(/\s+/)) {
1521
- if (token) args.push(token);
1522
- }
1605
+ args.push("-J", validateSshJumpHost(config.sshJumpHost));
1523
1606
  }
1607
+ args.push(...validateSshArgs(config.sshArgs));
1524
1608
  return args;
1525
1609
  }
1526
1610
  function sshTarget(config) {
@@ -2353,7 +2437,7 @@ async function verifyHostChannelAuth(config) {
2353
2437
  let hint = null;
2354
2438
  let forwarding = "unknown";
2355
2439
  try {
2356
- const { connectSshClient: connectSshClient2 } = await import("./ssh-client-LOCZTEUC.js");
2440
+ const { connectSshClient: connectSshClient2 } = await import("./ssh-client-NRBHQJVZ.js");
2357
2441
  const client = await connectSshClient2({
2358
2442
  host: config.host,
2359
2443
  port: config.port,
@@ -28,11 +28,11 @@ import {
28
28
  sq,
29
29
  staticBuilderOutputPath,
30
30
  transferLocalDirectory
31
- } from "./chunk-DFVWR6JM.js";
31
+ } from "./chunk-C74WJ3U4.js";
32
32
  import {
33
33
  getTarCreateEnv,
34
34
  prepareSourceTarArgs
35
- } from "./chunk-K24SBFI2.js";
35
+ } from "./chunk-D2IM25JV.js";
36
36
  import {
37
37
  DOCKER_DIAL_STDIO_COMMAND,
38
38
  attachDialStdioDiagnostics,
@@ -41,14 +41,14 @@ import {
41
41
  execSshCommand,
42
42
  openDockerDialStdioChannel,
43
43
  openSshUnixSocket
44
- } from "./chunk-DJNKEVZ7.js";
44
+ } from "./chunk-AADWLI2S.js";
45
45
  import {
46
46
  KRAFT_LABEL
47
- } from "./chunk-3RCXJZJD.js";
47
+ } from "./chunk-E3J47WO3.js";
48
48
  import {
49
49
  dirOf,
50
50
  ensureOwnedDir
51
- } from "./chunk-YY5DEAZI.js";
51
+ } from "./chunk-BQMBJ32I.js";
52
52
  import {
53
53
  isRuntimeNotFoundError
54
54
  } from "./chunk-3CJLKL6E.js";
@@ -63,7 +63,7 @@ import {
63
63
  registryForImage,
64
64
  safeErrorMessage,
65
65
  withTimeout
66
- } from "./chunk-ND23EK7Y.js";
66
+ } from "./chunk-G4VGNFGV.js";
67
67
  import {
68
68
  __commonJS,
69
69
  __require,
@@ -7,10 +7,10 @@ import {
7
7
  isContainerPortForwarder,
8
8
  managedDeploymentIdFromUnit,
9
9
  tryExec
10
- } from "./chunk-3RCXJZJD.js";
10
+ } from "./chunk-E3J47WO3.js";
11
11
  import {
12
12
  shellQuote
13
- } from "./chunk-ND23EK7Y.js";
13
+ } from "./chunk-G4VGNFGV.js";
14
14
 
15
15
  // ../../packages/adapters/src/system/port-listen.ts
16
16
  var PROC_NET_TCP_FILES = ["/proc/net/tcp", "/proc/net/tcp6"];
@@ -6,7 +6,7 @@ import {
6
6
  describeProcess,
7
7
  probeListeningPort,
8
8
  waitForPortFree
9
- } from "./chunk-2Y62WP2D.js";
9
+ } from "./chunk-QCGVPIYN.js";
10
10
  import {
11
11
  EDGE_CONTAINER_NAME,
12
12
  classifyProxy,
@@ -16,11 +16,11 @@ import {
16
16
  resolveContainerPublishingPort,
17
17
  stopContainerDurably,
18
18
  tryExec
19
- } from "./chunk-3RCXJZJD.js";
19
+ } from "./chunk-E3J47WO3.js";
20
20
  import {
21
21
  AppError,
22
22
  shellQuote
23
- } from "./chunk-ND23EK7Y.js";
23
+ } from "./chunk-G4VGNFGV.js";
24
24
 
25
25
  // ../../packages/adapters/src/system/proxy/detect.ts
26
26
  var EDGE_PORTS = [80, 443];
@@ -4,15 +4,15 @@ import { createRequire as __ospCreateRequire } from "node:module";
4
4
  const require = __ospCreateRequire(import.meta.url);
5
5
  import {
6
6
  hostRefusal
7
- } from "./chunk-ZQJU5CTZ.js";
7
+ } from "./chunk-7VMXN646.js";
8
8
  import {
9
9
  elevatedExecutor,
10
10
  resolveEnvironment
11
- } from "./chunk-YY5DEAZI.js";
11
+ } from "./chunk-BQMBJ32I.js";
12
12
  import {
13
13
  answered,
14
14
  refused
15
- } from "./chunk-ND23EK7Y.js";
15
+ } from "./chunk-G4VGNFGV.js";
16
16
 
17
17
  // ../../packages/adapters/src/system/privilege.ts
18
18
  function rootChecked(executor, why) {
@@ -5,23 +5,23 @@ const require = __ospCreateRequire(import.meta.url);
5
5
  import {
6
6
  describeProcess,
7
7
  probeListeningPortOwners
8
- } from "./chunk-2Y62WP2D.js";
8
+ } from "./chunk-QCGVPIYN.js";
9
9
  import {
10
10
  envOps,
11
11
  opScript
12
- } from "./chunk-ZQJU5CTZ.js";
12
+ } from "./chunk-7VMXN646.js";
13
13
  import {
14
14
  resolveEnvironment
15
- } from "./chunk-YY5DEAZI.js";
15
+ } from "./chunk-BQMBJ32I.js";
16
16
  import {
17
17
  sq
18
- } from "./chunk-BN23UUSF.js";
18
+ } from "./chunk-YXXWTBXB.js";
19
19
  import {
20
20
  SYSTEM,
21
21
  answered,
22
22
  refused,
23
23
  safeErrorMessage
24
- } from "./chunk-ND23EK7Y.js";
24
+ } from "./chunk-G4VGNFGV.js";
25
25
 
26
26
  // ../../packages/adapters/src/infra/openresty-lua.ts
27
27
  import { createHash, randomBytes } from "crypto";
@@ -448,6 +448,25 @@ var OPENRESTY_SITE_LUALIB = OPENRESTY_LUA_DIR.replace(/\/[^/]+$/, "");
448
448
  var EDGE_LUA_PACKAGE_PATH = `${OPENRESTY_SITE_LUALIB}/?.lua;;`;
449
449
  var EDGE_SERVER_NAMES_HASH_BUCKET_SIZE = 128;
450
450
  var EDGE_CLIENT_MAX_BODY_SIZE = "50m";
451
+ var EDGE_LISTEN_80 = "listen 80;\n listen [::]:80;";
452
+ var EDGE_LISTEN_443 = "listen 443 ssl;\n listen [::]:443 ssl;";
453
+ var EDGE_LISTEN_80_DEFAULT = "listen 80 default_server;\n listen [::]:80 default_server;";
454
+ var EDGE_LISTEN_443_DEFAULT = "listen 443 ssl default_server;\n listen [::]:443 ssl default_server;";
455
+ var EDGE_TLS_HTTP_CONF = ` # See EDGE_TLS_HTTP_CONF \u2014 TLS floor every vhost inherits (C2). A vhost's own
456
+ # value still wins (server beats http), so this is a floor, not a ceiling.
457
+ ssl_protocols TLSv1.2 TLSv1.3;
458
+ ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256;
459
+ ssl_prefer_server_ciphers on;
460
+ ssl_session_cache shared:SSL:10m;
461
+ ssl_session_timeout 10m;
462
+ ssl_stapling on;
463
+ resolver 1.1.1.1 8.8.8.8 valid=300s;`;
464
+ var EDGE_LOG_FORMAT_NAME = "kraft_json";
465
+ var EDGE_LOG_FORMAT_CONF = ` # See EDGE_LOG_FORMAT_CONF \u2014 one JSON line per request (C9). \`escape=json\`
466
+ # keeps a quote in a User-Agent from breaking the line; \`request_id\` is the
467
+ # join key with the app's own logs (vhosts forward it as X-Request-ID).
468
+ log_format ${EDGE_LOG_FORMAT_NAME} escape=json '{"time":"$time_iso8601","request_id":"$request_id","remote_addr":"$remote_addr","host":"$host","method":"$request_method","uri":"$request_uri","status":$status,"bytes_sent":$bytes_sent,"referer":"$http_referer","user_agent":"$http_user_agent","request_time":$request_time,"scheme":"$scheme","forwarded_for":"$http_x_forwarded_for"}';
469
+ access_log logs/access.json ${EDGE_LOG_FORMAT_NAME};`;
451
470
  var EDGE_SHARED_DICTS = [
452
471
  /** Analytics counters. */
453
472
  { name: "analytics", size: "256m" },
@@ -647,6 +666,21 @@ async function ensureOpenRestyConfig(executor, paths) {
647
666
  `sed -i '/http *{/a \\ client_max_body_size ${EDGE_CLIENT_MAX_BODY_SIZE};' ${paths.confPath}`
648
667
  );
649
668
  }
669
+ const hasTlsFloor = await executor.exec(`grep -qE '^[[:space:]]*ssl_protocols' ${paths.confPath}`).then(() => true).catch(() => false);
670
+ if (!hasTlsFloor) {
671
+ await executor.exec(
672
+ `sed -i '/http *{/a \\${toSedAppend(EDGE_TLS_HTTP_CONF)}' ${paths.confPath}`
673
+ );
674
+ }
675
+ const hasLogFormat = await executor.exec(`grep -qF 'log_format ${EDGE_LOG_FORMAT_NAME}' ${paths.confPath}`).then(() => true).catch(() => false);
676
+ if (!hasLogFormat) {
677
+ await executor.exec(
678
+ `sed -i '/http *{/a \\${toSedAppend(EDGE_LOG_FORMAT_CONF)}' ${paths.confPath}`
679
+ );
680
+ }
681
+ }
682
+ function toSedAppend(block) {
683
+ return block.replace(/\n/g, "\\n");
650
684
  }
651
685
  function MINIMAL_NGINX_CONF(confDir, sitesDir) {
652
686
  return `# Auto-generated by Kraft - safe to extend
@@ -666,6 +700,9 @@ http {
666
700
  # See EDGE_CLIENT_MAX_BODY_SIZE \u2014 nginx's 1 MB default 413s an upload before the app
667
701
  # ever sees it. A project's own value overrides this (server beats http).
668
702
  client_max_body_size ${EDGE_CLIENT_MAX_BODY_SIZE};
703
+ ${EDGE_TLS_HTTP_CONF}
704
+
705
+ ${EDGE_LOG_FORMAT_CONF}
669
706
  include ${sitesDir}/*.conf;
670
707
  }
671
708
  `;
@@ -740,7 +777,7 @@ function edgeChallengeVhostConf(host) {
740
777
  # routing target. Everything else gets the shared not-found page - this is
741
778
  # scaffolding, not a site.
742
779
  server {
743
- listen 80;
780
+ ${EDGE_LISTEN_80}
744
781
  server_name ${host};
745
782
 
746
783
  ${EDGE_CHALLENGE_LOCATION}
@@ -761,7 +798,7 @@ var EDGE_HTTPS_REJECT_BLOCK = `# HTTPS catch-all. WITHOUT a 443 default_server,
761
798
  # edgeHttpsDefaultBlock. ssl_reject_handshake (OpenResty/nginx >= 1.19.4; our
762
799
  # installer pulls the newest LTS) needs no certificate.
763
800
  server {
764
- listen 443 ssl default_server;
801
+ ${EDGE_LISTEN_443_DEFAULT}
765
802
  ssl_reject_handshake on;
766
803
  }`;
767
804
  function edgeHttpsDefaultBlock(cert) {
@@ -780,7 +817,7 @@ function edgeHttpsDefaultBlock(cert) {
780
817
  # what stops it from becoming the cross-serving it prevents. And never set
781
818
  # ssl_certificate at http scope: this block would inherit a real domain's cert.
782
819
  server {
783
- listen 443 ssl default_server;
820
+ ${EDGE_LISTEN_443_DEFAULT}
784
821
  server_name _;
785
822
 
786
823
  ssl_certificate ${cert.certPath};
@@ -794,7 +831,7 @@ function edgeDefaultCatchAllConf(cert) {
794
831
  # stops an unmatched Host/SNI from being served the first real vhost by default.
795
832
  # Auto-generated - do not edit manually
796
833
  server {
797
- listen 80 default_server;
834
+ ${EDGE_LISTEN_80_DEFAULT}
798
835
  server_name _;
799
836
 
800
837
  ${ACME_CHALLENGE_LOCATION}
@@ -942,6 +979,13 @@ export {
942
979
  EDGE_LUA_PACKAGE_PATH,
943
980
  EDGE_SERVER_NAMES_HASH_BUCKET_SIZE,
944
981
  EDGE_CLIENT_MAX_BODY_SIZE,
982
+ EDGE_LISTEN_80,
983
+ EDGE_LISTEN_443,
984
+ EDGE_LISTEN_80_DEFAULT,
985
+ EDGE_LISTEN_443_DEFAULT,
986
+ EDGE_TLS_HTTP_CONF,
987
+ EDGE_LOG_FORMAT_NAME,
988
+ EDGE_LOG_FORMAT_CONF,
945
989
  EDGE_SHARED_DICTS,
946
990
  parseNginxVersion,
947
991
  OPENRESTY_DEFAULT_PATHS,
@@ -7,7 +7,7 @@ import {
7
7
  COMPONENT_INSTALLERS,
8
8
  checkAll,
9
9
  checkComponents
10
- } from "./chunk-MOSINQAM.js";
10
+ } from "./chunk-AFUXAAFQ.js";
11
11
 
12
12
  // ../../packages/adapters/src/system/requirements.ts
13
13
  var REMOTE_SERVER_REQUIRED_COMPONENTS = ["docker", "git"];
@@ -4,7 +4,7 @@ import { createRequire as __ospCreateRequire } from "node:module";
4
4
  const require = __ospCreateRequire(import.meta.url);
5
5
  import {
6
6
  shellQuote
7
- } from "./chunk-ND23EK7Y.js";
7
+ } from "./chunk-G4VGNFGV.js";
8
8
 
9
9
  // ../../packages/adapters/src/system/local-shell.ts
10
10
  import { execFile } from "child_process";
@@ -17,15 +17,15 @@ import {
17
17
  sanitizeEdgeVhosts,
18
18
  sq,
19
19
  stopTargetsForStatus
20
- } from "./chunk-PCOTSRS4.js";
21
- import "./chunk-2Y62WP2D.js";
20
+ } from "./chunk-QLPQ5NFE.js";
21
+ import "./chunk-QCGVPIYN.js";
22
22
  import {
23
23
  EDGE_CONTAINER_NAME,
24
24
  classifyProxy,
25
25
  isOurEdgeContainer
26
- } from "./chunk-3RCXJZJD.js";
26
+ } from "./chunk-E3J47WO3.js";
27
27
  import "./chunk-3CJLKL6E.js";
28
- import "./chunk-ND23EK7Y.js";
28
+ import "./chunk-G4VGNFGV.js";
29
29
  import "./chunk-PXKCZB2I.js";
30
30
  export {
31
31
  EDGE_CONTAINER_NAME,
@@ -15,15 +15,15 @@ import {
15
15
  splitDockerFrames,
16
16
  toDockerHealthcheck,
17
17
  toStopConfig
18
- } from "./chunk-ZNVAHQRY.js";
19
- import "./chunk-DFVWR6JM.js";
20
- import "./chunk-K24SBFI2.js";
21
- import "./chunk-DJNKEVZ7.js";
22
- import "./chunk-3RCXJZJD.js";
23
- import "./chunk-YY5DEAZI.js";
18
+ } from "./chunk-Q7FAE2MB.js";
19
+ import "./chunk-C74WJ3U4.js";
20
+ import "./chunk-D2IM25JV.js";
21
+ import "./chunk-AADWLI2S.js";
22
+ import "./chunk-E3J47WO3.js";
23
+ import "./chunk-BQMBJ32I.js";
24
24
  import "./chunk-3CJLKL6E.js";
25
- import "./chunk-BN23UUSF.js";
26
- import "./chunk-ND23EK7Y.js";
25
+ import "./chunk-YXXWTBXB.js";
26
+ import "./chunk-G4VGNFGV.js";
27
27
  import "./chunk-PXKCZB2I.js";
28
28
  export {
29
29
  DockerRuntime,
@@ -4,15 +4,15 @@ import { createRequire as __ospCreateRequire } from "node:module";
4
4
  const require = __ospCreateRequire(import.meta.url);
5
5
  import {
6
6
  DockerEdgeExecutor
7
- } from "./chunk-MC4X55BW.js";
7
+ } from "./chunk-DNC4A3MZ.js";
8
8
  import "./chunk-I3DPMTSF.js";
9
- import "./chunk-PCOTSRS4.js";
10
- import "./chunk-HFOE2IXZ.js";
11
- import "./chunk-2Y62WP2D.js";
12
- import "./chunk-3RCXJZJD.js";
9
+ import "./chunk-QLPQ5NFE.js";
10
+ import "./chunk-BIOW6K3V.js";
11
+ import "./chunk-QCGVPIYN.js";
12
+ import "./chunk-E3J47WO3.js";
13
13
  import "./chunk-3CJLKL6E.js";
14
- import "./chunk-BN23UUSF.js";
15
- import "./chunk-ND23EK7Y.js";
14
+ import "./chunk-YXXWTBXB.js";
15
+ import "./chunk-G4VGNFGV.js";
16
16
  import "./chunk-PXKCZB2I.js";
17
17
  export {
18
18
  DockerEdgeExecutor
@@ -6,8 +6,8 @@ import {
6
6
  importMigratedSites,
7
7
  waitForApiHealth,
8
8
  waitForEdgeRunning
9
- } from "./chunk-JK7KKBXI.js";
10
- import "./chunk-2UQFOUSZ.js";
9
+ } from "./chunk-KHAT3OZP.js";
10
+ import "./chunk-B2CUYCGY.js";
11
11
  import "./chunk-5GPXMTE4.js";
12
12
  import "./chunk-XZYFZ6A5.js";
13
13
  import "./chunk-QWHBRY2K.js";
@@ -17,31 +17,31 @@ import "./chunk-42WQABXM.js";
17
17
  import "./chunk-DRK3MEDS.js";
18
18
  import "./chunk-3NQQXMDR.js";
19
19
  import "./chunk-RHLNVZMS.js";
20
- import "./chunk-MC4X55BW.js";
21
- import "./chunk-HLF5PMKE.js";
22
- import "./chunk-MOSINQAM.js";
23
- import "./chunk-VFPLICBX.js";
20
+ import "./chunk-DNC4A3MZ.js";
21
+ import "./chunk-Y2MET6MX.js";
22
+ import "./chunk-AFUXAAFQ.js";
23
+ import "./chunk-3AZY56JP.js";
24
24
  import "./chunk-I3DPMTSF.js";
25
- import "./chunk-PCOTSRS4.js";
25
+ import "./chunk-QLPQ5NFE.js";
26
26
  import "./chunk-ONKEYSMY.js";
27
27
  import "./chunk-ZWLDLTJP.js";
28
- import "./chunk-ZNVAHQRY.js";
29
- import "./chunk-7UKBMDUF.js";
30
- import "./chunk-DFVWR6JM.js";
31
- import "./chunk-SPKRI7MF.js";
28
+ import "./chunk-Q7FAE2MB.js";
29
+ import "./chunk-MK6GYBO4.js";
30
+ import "./chunk-C74WJ3U4.js";
31
+ import "./chunk-N7AJ2D4I.js";
32
32
  import "./chunk-ZVFS4LUA.js";
33
- import "./chunk-K24SBFI2.js";
34
- import "./chunk-DJNKEVZ7.js";
35
- import "./chunk-HFOE2IXZ.js";
36
- import "./chunk-DI54Y66N.js";
37
- import "./chunk-XBGSR22I.js";
38
- import "./chunk-2Y62WP2D.js";
39
- import "./chunk-3RCXJZJD.js";
40
- import "./chunk-ZQJU5CTZ.js";
41
- import "./chunk-YY5DEAZI.js";
33
+ import "./chunk-D2IM25JV.js";
34
+ import "./chunk-AADWLI2S.js";
35
+ import "./chunk-BIOW6K3V.js";
36
+ import "./chunk-QPUEAYB3.js";
37
+ import "./chunk-XAEYWDBX.js";
38
+ import "./chunk-QCGVPIYN.js";
39
+ import "./chunk-E3J47WO3.js";
40
+ import "./chunk-7VMXN646.js";
41
+ import "./chunk-BQMBJ32I.js";
42
42
  import "./chunk-3CJLKL6E.js";
43
- import "./chunk-BN23UUSF.js";
44
- import "./chunk-ND23EK7Y.js";
43
+ import "./chunk-YXXWTBXB.js";
44
+ import "./chunk-G4VGNFGV.js";
45
45
  import "./chunk-PXKCZB2I.js";
46
46
  export {
47
47
  importMigratedSites,
@@ -13,23 +13,23 @@ import {
13
13
  renderEdgeConflict,
14
14
  repairEdgeConflict,
15
15
  rollbackHostEdge
16
- } from "./chunk-IGTODKUA.js";
16
+ } from "./chunk-5RWL7EFH.js";
17
17
  import "./chunk-5GPXMTE4.js";
18
- import "./chunk-MOSINQAM.js";
19
- import "./chunk-VFPLICBX.js";
18
+ import "./chunk-AFUXAAFQ.js";
19
+ import "./chunk-3AZY56JP.js";
20
20
  import "./chunk-I3DPMTSF.js";
21
- import "./chunk-PCOTSRS4.js";
21
+ import "./chunk-QLPQ5NFE.js";
22
22
  import "./chunk-ZVFS4LUA.js";
23
- import "./chunk-HFOE2IXZ.js";
24
- import "./chunk-DI54Y66N.js";
25
- import "./chunk-XBGSR22I.js";
26
- import "./chunk-2Y62WP2D.js";
27
- import "./chunk-3RCXJZJD.js";
28
- import "./chunk-ZQJU5CTZ.js";
29
- import "./chunk-YY5DEAZI.js";
23
+ import "./chunk-BIOW6K3V.js";
24
+ import "./chunk-QPUEAYB3.js";
25
+ import "./chunk-XAEYWDBX.js";
26
+ import "./chunk-QCGVPIYN.js";
27
+ import "./chunk-E3J47WO3.js";
28
+ import "./chunk-7VMXN646.js";
29
+ import "./chunk-BQMBJ32I.js";
30
30
  import "./chunk-3CJLKL6E.js";
31
- import "./chunk-BN23UUSF.js";
32
- import "./chunk-ND23EK7Y.js";
31
+ import "./chunk-YXXWTBXB.js";
32
+ import "./chunk-G4VGNFGV.js";
33
33
  import "./chunk-PXKCZB2I.js";
34
34
  export {
35
35
  completeHostEdge,