learn: HTTP/HTTPS observation via transparent proxy - #197
Conversation
|
Thanks for the PR! One quick question: since this is only for |
Agreed on keeping args minimal, but plain HTTP (port 80, no CA, no extra ports) needs neither |
Another argument for making it default: without HTTP learning, |
34b9d27 to
3e70855
Compare
|
Thanks for the update! A few issues below: 1. Learned
|
… env and http_ca_out; update docs
…HTTPS learn tests
3e70855 to
0dae1d3
Compare
|
Addressed all review points:
Smaller things (redundant |
Covers the HTTP observation item from the RFC #72 (
http.allow: observed method+host+path rules, gated by--learn-http).New arguments
--learn-http[http]section. Port 80 always intercepted.--http-inject-ca <path>--http-port <port>--learn-httpmust be passed explicitly:--http-inject-caand--http-portalone do not activate observation.What this does
sandlock learnnow records HTTP traffic (method + host + path) and writes it as[http].allowrules in the profile. The--http-inject-capath is also written to[config].http_inject_casosandlock runpicks it up automatically.How it works
An optional
log_fncallback was added toAclServicein the transparent proxy. In learn mode the closure pushes"METHOD host/path"intoLearnObserver::http_requests. The proxy previously only spawned when ACL rules were present, the condition was extended to also spawn whenlog_fnis set (passthrough, no rules enforced).CLI
Discussion
Follows the design stance in original RFC #72: keep learn loose, minimal new arguments.
Port learning: at
connect()time only IP+port are visible. Port 80 is always included; port 443 requires--http-inject-ca; anything else requires--http-port. The proxy can only intercept ports it is told to listen on upfront. Can--http-portbe removed by intercepting all TCP ports and detecting HTTP dynamically (learning HTTP ports)?CA:
--http-inject-ca <bundle>is the preferred mode.--http-ca/--http-key(BYO CA) is not wired inLearnArgs: the inject approach covers the same use case with less friction. Is this acceptable?Other config-like arguments not wired in learn:
--http-ca-out(write ephemeral CA to a path) and--http-auth(credential injection) aresandlock runflags with no learn equivalent. For Node.js workloads, HTTPS interception also requiresNODE_EXTRA_CA_CERTSpointing to the sandlock CA via--env. Should these arguments be added toLearnArgs?Tests
test_learn_captures_http_request: single GET recorded with correct pathtest_learn_captures_http_multiple_paths: multiple paths deduplicatedtest_learn_captures_https_request:--http-inject-cawritten to[config]test_learn_then_run_http(integration): learned path allowed; unlearned path blocked (403)test_learn_then_run_https(integration): HTTPS round-trip,[config]picked up by run automatically