code wiki / _hdl_build / nx_aw_mtls_proxy.nx

nx_aw_mtls_proxy.nx

buildroot/runtime/_hdl_build/nx_aw_mtls_proxy.nx

8481 B157 linesdepth 15pulls 84 transitivereach 0 importersview sourcekind tooltopic aw
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_connect.nx nx_csprng.nx nx_http_server.nx nx_tls13_server_session.nx nx_tls13_server_session_run.nx nx_tls13_server_session_run_mtls.n nx_tls13_server_session_app_data.n nx_aw_mtls_inject.nx nx_aw_mtls_proxy.nx

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

main mp_atoi sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close sys_write nx_http_server_addr_any nx_http_server_make_sockad nx_http_server_listen sys_ignore_sigpipe sys_mmap ↻ sys_socket sys_mmap ↻ sys_setsockopt sys_bind sys_close ↻ sys_listen sys_set_socket_timeout sys_mmap ↻ sys_setsockopt ↻ sys_munmap sys_wait4 sys_accept_with_addr sys_fork sys_close ↻ sys_setsockopt ↻ nx_csprng_fill sys_mmap ↻ nx_csprng_urandom_path sys_openat_rd ↻ sys_read ↻ sys_close ↻ nx_tls13_server_session_ru nx_tls13_server_session_ne sys_mmap ↻ x25519_keypair_public

structs

none

consts

21const NX_MAGIC_100000000: i64 = 100000000
23const NX_MP_PORT_DEFAULT: i64 = 9443
24const NX_MP_BACKEND_DEFAULT: i64 = 8443
25const NX_MP_CERT: *u8 = "/volume1/homes/elderwesto/nishihost/certs/le_fullchain.der" as *u8
26const NX_MP_PRIV: *u8 = "/volume1/homes/elderwesto/nishihost/certs/le_ecdsa_key.bin" as *u8
27const NX_MP_MAX_CHILDREN: i64 = 64
28const NX_MP_REC: i64 = 20480
29const NX_MP_RESP: i64 = 262144
30const NX_MP_OUTCAP: i64 = 32768
31const NX_MP_CHUNK: i64 = 15000
32const NX_MP_CCCAP: i64 = 4096 // client cert DER buffer
33const NX_MP_INJCAP: i64 = 22528 // injected-request buffer (NX_MP_REC + ample header room)

functions

35func 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
38func mp_backend(bport: i64, req: *u8, req_n: i64, resp: *u8, cap: i64) -> i64
59func main(argc: i64, argv: *i64) -> i64