@le-space/rootfs 0.9.7 → 0.9.9
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/package.json +1 -1
- package/reference/orbitdb-relay/rootfs/orbitdb-relay-autotls-refresh.service +1 -0
- package/reference/uc-go-peer/rootfs/__pycache__/uc-go-peer-autotls-refresh.cpython-312.pyc +0 -0
- package/reference/uc-go-peer/rootfs/__pycache__/uc-go-peer-describe.cpython-312.pyc +0 -0
- package/reference/uc-go-peer/rootfs/uc-go-peer-autotls-refresh.service +1 -0
- package/reference/uc-go-peer/rootfs/uc-go-peer-describe.py +45 -7
package/package.json
CHANGED
|
@@ -17,6 +17,7 @@ Environment=SERVICE_NAME=orbitdb-relay.service
|
|
|
17
17
|
Environment=CADDY_SERVICE=caddy.service
|
|
18
18
|
Environment=CADDYFILE=/etc/caddy/Caddyfile
|
|
19
19
|
ExecStart=/usr/bin/python3 /usr/local/sbin/orbitdb-relay-autotls-refresh.py
|
|
20
|
+
ExecStartPost=/usr/bin/systemctl start --no-block orbitdb-relay-bootstrap-refresh.service
|
|
20
21
|
StandardOutput=journal
|
|
21
22
|
StandardError=journal
|
|
22
23
|
|
|
Binary file
|
|
Binary file
|
|
@@ -16,6 +16,7 @@ Environment=AUTOTLS_CADDY_READY_FILE=/etc/default/uc-go-peer.caddy-ready
|
|
|
16
16
|
Environment=SERVICE_NAME=uc-go-peer.service
|
|
17
17
|
Environment=WS_BACKEND_PORT=9097
|
|
18
18
|
ExecStart=/usr/bin/python3 /usr/local/sbin/uc-go-peer-autotls-refresh.py
|
|
19
|
+
ExecStartPost=/usr/bin/systemctl start --no-block uc-go-peer-bootstrap-refresh.service
|
|
19
20
|
Restart=on-failure
|
|
20
21
|
RestartSec=43200
|
|
21
22
|
StartLimitIntervalSec=0
|
|
@@ -16,6 +16,7 @@ CADDY_HTTPS_PORT = int(os.environ.get("CADDY_HTTPS_PORT", "443"))
|
|
|
16
16
|
WAIT_TIMEOUT_SECONDS = int(os.environ.get("DESCRIBE_WAIT_TIMEOUT_SECONDS", "240"))
|
|
17
17
|
WAIT_INTERVAL_SECONDS = float(os.environ.get("DESCRIBE_WAIT_INTERVAL_SECONDS", "2"))
|
|
18
18
|
AUTOTLS_EXTRA_WAIT_SECONDS = int(os.environ.get("DESCRIBE_AUTOTLS_EXTRA_WAIT_SECONDS", "120"))
|
|
19
|
+
WS_BACKEND_PORT = os.environ.get("WS_BACKEND_PORT", "9097").strip()
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
def tls_endpoint_serves(hostname: str, port: int) -> bool:
|
|
@@ -40,22 +41,56 @@ def tls_endpoint_serves(hostname: str, port: int) -> bool:
|
|
|
40
41
|
return False
|
|
41
42
|
|
|
42
43
|
|
|
44
|
+
def backend_ws_port(env_values: dict[str, str]) -> int | None:
|
|
45
|
+
"""Port the websocket listener is bound to inside the guest."""
|
|
46
|
+
raw = env_values.get("GO_PEER_WSS_PORT", "").strip() or WS_BACKEND_PORT
|
|
47
|
+
try:
|
|
48
|
+
return int(raw)
|
|
49
|
+
except (TypeError, ValueError):
|
|
50
|
+
return None
|
|
51
|
+
|
|
52
|
+
|
|
43
53
|
def caddy_cert_serves(hostname: str) -> bool:
|
|
44
54
|
return tls_endpoint_serves(hostname, CADDY_HTTPS_PORT)
|
|
45
55
|
|
|
46
56
|
|
|
47
|
-
def autotls_cert_serves(autotls_addrs: list[str]) -> bool:
|
|
48
|
-
"""Verify the AutoTLS *.libp2p.direct certificate actually serves.
|
|
49
|
-
|
|
50
|
-
|
|
57
|
+
def autotls_cert_serves(autotls_addrs: list[str], backend_port: int | None = None) -> bool:
|
|
58
|
+
"""Verify the AutoTLS *.libp2p.direct certificate actually serves.
|
|
59
|
+
|
|
60
|
+
The handshake is a loopback dial, so it needs the port the listener is
|
|
61
|
+
bound to *inside the guest* -- and the announced port is not that. On
|
|
62
|
+
Aleph every port is published under a different number: the relay binds
|
|
63
|
+
GO_PEER_WSS_PORT (9097) while the multiaddr advertises
|
|
64
|
+
EXTERNAL_RELAY_WS_PORT, and the translation is done by the host's NAT,
|
|
65
|
+
which loopback never traverses. Taking the port from the multiaddr
|
|
66
|
+
therefore dialled 127.0.0.1:<external>, got ECONNREFUSED every time, and
|
|
67
|
+
silently dropped every AutoTLS address from the registration.
|
|
68
|
+
|
|
69
|
+
Measured on a live relay: 127.0.0.1:64861 refused the connection while
|
|
70
|
+
127.0.0.1:9097 served a valid `*.libp2p.direct` certificate, and only
|
|
71
|
+
9097 was listening.
|
|
72
|
+
|
|
73
|
+
The announced port is still tried first: on a profile that binds the
|
|
74
|
+
published port directly -- orbitdb-relay does -- it is the right one, and
|
|
75
|
+
this must not regress there. `backend_port` is the fallback.
|
|
76
|
+
"""
|
|
51
77
|
for addr in autotls_addrs:
|
|
52
78
|
host_match = re.search(r"/dns[46]/([^/]+)/", addr) or re.search(r"/sni/([^/]+)/", addr)
|
|
53
79
|
port_match = re.search(r"/tcp/(\d+)/", addr)
|
|
54
|
-
if host_match
|
|
55
|
-
|
|
80
|
+
if not host_match:
|
|
81
|
+
continue
|
|
82
|
+
hostname = host_match.group(1)
|
|
83
|
+
candidates: list[int] = []
|
|
84
|
+
if port_match:
|
|
85
|
+
candidates.append(int(port_match.group(1)))
|
|
86
|
+
if backend_port and backend_port not in candidates:
|
|
87
|
+
candidates.append(backend_port)
|
|
88
|
+
for port in candidates:
|
|
89
|
+
if tls_endpoint_serves(hostname, port):
|
|
56
90
|
return True
|
|
57
91
|
return False
|
|
58
92
|
|
|
93
|
+
|
|
59
94
|
PEER_ID_PATTERNS = [
|
|
60
95
|
re.compile(r"PeerID:\s+(\S+)"),
|
|
61
96
|
re.compile(r"Host created with PeerID:\s+(\S+)"),
|
|
@@ -280,7 +315,10 @@ def main() -> None:
|
|
|
280
315
|
)
|
|
281
316
|
autotls_cert_ready = bool(
|
|
282
317
|
grouped["autotls_wss_multiaddrs"]
|
|
283
|
-
and autotls_cert_serves(
|
|
318
|
+
and autotls_cert_serves(
|
|
319
|
+
grouped["autotls_wss_multiaddrs"],
|
|
320
|
+
backend_ws_port(env_values),
|
|
321
|
+
)
|
|
284
322
|
)
|
|
285
323
|
certhash_ready = bool(
|
|
286
324
|
grouped["webtransport_multiaddrs"] or grouped["webrtc_direct_multiaddrs"]
|