gowalk-cicd 1.0.222 → 1.0.223
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.
|
@@ -24,7 +24,7 @@ REQUIRED = (
|
|
|
24
24
|
'health_rollout_timing.py',
|
|
25
25
|
'memory_agent.py', 'memory_accounting.py',
|
|
26
26
|
'runtime_env.py', 'runtime_env_parse.py', 'edge_inputs.py', 'edge_vhost.py', 'edge_health.py',
|
|
27
|
-
'configure_vhost.py', 'vhost_diagnostics.py', 'remote_deploy.sh', 'deploy_evidence.sh',
|
|
27
|
+
'configure_vhost.py', 'vhost_diagnostics.py', 'publish_ingress.py', 'remote_deploy.sh', 'deploy_evidence.sh',
|
|
28
28
|
'ensure_certificate.sh', 'select_certbot_account.sh',
|
|
29
29
|
'network_projection.py', 'network_inventory.py', 'network_host.py', 'network_metadata.py', 'network_readback.py',
|
|
30
30
|
)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"""Publish a configured shared-host route before certificate validation starts."""
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
import re
|
|
4
|
+
import stat
|
|
5
|
+
import subprocess
|
|
6
|
+
import sys
|
|
7
|
+
|
|
8
|
+
HOOK = Path('/usr/local/sbin/gowalk-backend-publish-ingress')
|
|
9
|
+
ROOT_UID = 0
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def publish(app, domain):
|
|
13
|
+
try:
|
|
14
|
+
info = HOOK.lstat()
|
|
15
|
+
except FileNotFoundError:
|
|
16
|
+
return
|
|
17
|
+
if not re.fullmatch(r'[a-z0-9-]{1,255}', app):
|
|
18
|
+
raise ValueError('project_invalid')
|
|
19
|
+
if len(domain) > 253 or not re.fullmatch(r'[a-z0-9-]+(?:\.[a-z0-9-]+)+', domain):
|
|
20
|
+
raise ValueError('domain_invalid')
|
|
21
|
+
if not stat.S_ISREG(info.st_mode) or info.st_uid != ROOT_UID or info.st_mode & 0o022:
|
|
22
|
+
raise ValueError('hook_untrusted')
|
|
23
|
+
if not info.st_mode & stat.S_IXUSR:
|
|
24
|
+
raise ValueError('hook_not_executable')
|
|
25
|
+
for parent in HOOK.parents:
|
|
26
|
+
info = parent.lstat()
|
|
27
|
+
if not stat.S_ISDIR(info.st_mode) or info.st_uid != ROOT_UID or info.st_mode & 0o022:
|
|
28
|
+
raise ValueError('hook_parent_untrusted')
|
|
29
|
+
subprocess.run([str(HOOK), app, domain], stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL,
|
|
30
|
+
stderr=subprocess.DEVNULL, timeout=30, check=True,
|
|
31
|
+
env={'PATH': '/usr/sbin:/usr/bin:/sbin:/bin', 'LC_ALL': 'C'})
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def main():
|
|
35
|
+
try:
|
|
36
|
+
if len(sys.argv) != 3:
|
|
37
|
+
raise ValueError('arguments_invalid')
|
|
38
|
+
publish(*sys.argv[1:])
|
|
39
|
+
except (ValueError, OSError, subprocess.SubprocessError):
|
|
40
|
+
print('backend_ingress_publication_refused', file=sys.stderr)
|
|
41
|
+
return 1
|
|
42
|
+
return 0
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
if __name__ == '__main__':
|
|
46
|
+
sys.exit(main())
|
|
@@ -141,6 +141,7 @@ write_vhost() {
|
|
|
141
141
|
state="$(nginx_locked python3 "$HELPERS/configure_vhost.py" "$VHOST" "$DOMAIN" "$PORT" "$1")"
|
|
142
142
|
fi
|
|
143
143
|
[ "$state" != changed ] || log "nginx vhost for $DOMAIN ($1) → 127.0.0.1:$PORT"
|
|
144
|
+
python3 "$HELPERS/publish_ingress.py" "$APP" "$DOMAIN"
|
|
144
145
|
}
|
|
145
146
|
BACKEND_DEPLOY_PHASE=configure_vhost
|
|
146
147
|
if certificate_current "$DOMAIN" "$CERT_VHOST"; then
|
package/docs/BACKEND_SSH_GATE.md
CHANGED
|
@@ -218,3 +218,24 @@ The established `/usr/bin/python3 -B` spelling is accepted and preserves `-B`; o
|
|
|
218
218
|
It changes no app source, runtime profile, container, database, service timer or deployment freeze. Preserve the
|
|
219
219
|
previous release directory; this is ordinary released-helper installation, not app-state recovery.
|
|
220
220
|
Verify a fresh scoped readback through each owner and keep that receipt with the exact npm integrity and release.
|
|
221
|
+
|
|
222
|
+
## Shared public IP route publication
|
|
223
|
+
|
|
224
|
+
A VM behind a hostname-routing ingress needs its public route before ACME can
|
|
225
|
+
validate a new domain. After every successful vhost write, outside the nginx lock,
|
|
226
|
+
the released deployment helper invokes `/usr/local/sbin/gowalk-backend-publish-ingress`
|
|
227
|
+
if installed. This optional operator-owned executable receives two arguments:
|
|
228
|
+
the project slug and infrastructure domain. It must synchronously publish and
|
|
229
|
+
verify that domain's ingress route; it must refuse another VM's existing ownership.
|
|
230
|
+
The executable and all parent directories must be root-owned and not writable by
|
|
231
|
+
group or others. Symlinks are refused. Its environment is fixed, stdin is closed,
|
|
232
|
+
and its output is not included in deployment logs. Failure or the30-second timeout
|
|
233
|
+
stops deployment before certificate validation. An absent hook preserves direct-host
|
|
234
|
+
deployment behavior. Do not remove a shared host's hook to bypass an ingress failure.
|
|
235
|
+
|
|
236
|
+
Install the hook and its private transport using the host's infrastructure tooling;
|
|
237
|
+
application repositories cannot configure it. It does not replace the existing
|
|
238
|
+
certificate, protected-origin or public-health checks. Unchanged vhosts also invoke
|
|
239
|
+
it so an interrupted publication can be retried safely. Normal direct-host delivery
|
|
240
|
+
adds only one small Python invocation; a shared host also performs one bounded
|
|
241
|
+
route publication per vhost stage, with no polling delay.
|