code wiki / _hdl_build / nx_aw_mtls_proxy.nx
nx_aw_mtls_proxy.nx
buildroot/runtime/_hdl_build/nx_aw_mtls_proxy.nx
about
nx_aw_mtls_proxy.nx -- SOVEREIGN mTLS-TERMINATING reverse proxy = the no-JavaScript session carrier.
Identical to the PROVEN nx_aw_tlsproxy (terminate TLS 1.3 + the real Let's Encrypt cert -> forward the
decrypted HTTP to a loopback backend -> relay back encrypted, fork-per-connection, instant DNAT-flip
rollback) EXCEPT it requests a CLIENT cert (mTLS via run_ecdsa_mtls) and, for a VERIFIED client cert,
injects the cert Subject CN as X-Nishi-Cert-Identity into the forwarded request -- stripping any client-
supplied copy first (the trust boundary, gated by nx_aw_mtls_inject_gate). A no-cert / bad-cert client is
forwarded WITHOUT an identity (request-not-require: the backend falls back to its X-Nishi-Session header
path = NEVER-LOCKOUT). So a top-level NAVIGATION carries identity at the TLS layer with ZERO JavaScript,
ZERO cookies -- the sovereign answer the operator asked for. Live cutover = point .240:443 DNAT at NX_MP_PORT.
argv[1] (optional) = listen port (default 9443); argv[2] (optional) = backend port (default 8443)
license_tier: ORIGINAL
dependencies 9 imports · 0 importers
imports: nx_syscalls.nxnx_connect.nxnx_csprng.nxnx_http_server.nxnx_tls13_server_session.nxnx_tls13_server_session_run.nxnx_tls13_server_session_run_mtls.nxnx_tls13_server_session_app_data.nxnx_aw_mtls_inject.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 21 | const NX_MAGIC_100000000: i64 = 100000000 |
| 23 | const NX_MP_PORT_DEFAULT: i64 = 9443 |
| 24 | const NX_MP_BACKEND_DEFAULT: i64 = 8443 |
| 25 | const NX_MP_CERT: *u8 = "/volume1/homes/elderwesto/nishihost/certs/le_fullchain.der" as *u8 |
| 26 | const NX_MP_PRIV: *u8 = "/volume1/homes/elderwesto/nishihost/certs/le_ecdsa_key.bin" as *u8 |
| 27 | const NX_MP_MAX_CHILDREN: i64 = 64 |
| 28 | const NX_MP_REC: i64 = 20480 |
| 29 | const NX_MP_RESP: i64 = 262144 |
| 30 | const NX_MP_OUTCAP: i64 = 32768 |
| 31 | const NX_MP_CHUNK: i64 = 15000 |
| 32 | const NX_MP_CCCAP: i64 = 4096 // client cert DER buffer |
| 33 | const NX_MP_INJCAP: i64 = 22528 // injected-request buffer (NX_MP_REC + ample header room) |
functions
| 35 | func mp_atoi(s: *u8) -> i64 { var v: i64=0; var i: i64=0; while s[i]!=(0 as u8){ let c: i64=s[i] as i64; if c>=48 { if c<=57 { v=v*10+(c-48) } } i=i+1 } return v } called by 1: main |
| 38 | func mp_backend(bport: i64, req: *u8, req_n: i64, resp: *u8, cap: i64) -> i64 |
| 59 | func main(argc: i64, argv: *i64) -> i64 |