mirror of
https://github.com/3proxy/3proxy.git
synced 2026-11-22 23:59:41 +08:00
Add TLS tests: a wrapped proxy, a TLS chain, and MITM
Three arrangements, with key material generated for the run rather than kept in the tree: a proxy wrapped in TLS, a proxy that reaches a TLS parent and verifies it against the CA, and MITM. The MITM case checks what interception is for: the decrypted request line, URI and all, reaches the log, where the same request through a plain CONNECT tunnel leaves only the host and port. The origin runs in its own process there so the proxy log holds only what the proxy saw, and log assertions wait, since a record is written when the connection finishes rather than when the reply arrives. Verification of the spoofed certificate is deliberately not strict: 3proxy issues those without an Authority Key Identifier, which Python rejects under its 3.13 defaults.
This commit is contained in:
1 parent
137ff3beea
commit
7011e78ece
3 files changed
+346
-6
No files matched your search
+10
-1
@@ -7,7 +7,9 @@
|
||||
python3 tests/run.py --keep # keep the configurations and logs
|
||||
|
||||
Python 3.6 or later and a built 3proxy are the only requirements: the suite
|
||||
is standard library throughout, so it runs wherever 3proxy builds. With no
|
||||
is standard library throughout, so it runs wherever 3proxy builds. The TLS
|
||||
case additionally wants `openssl` on PATH to generate its key material, and
|
||||
skips itself when that is missing or the build has no TLS support. With no
|
||||
`--bin` it looks in `bin/`, then `build/bin/`, then the per-configuration
|
||||
directories a multi-configuration CMake generator uses.
|
||||
|
||||
@@ -49,6 +51,13 @@ Assertions are `eq`, `ne`, `contains`, `not_contains`, `in_range`,
|
||||
`not_in_range`, plus `ok`, `fail` and `skip`. `harness.field()` and
|
||||
`int_field()` pull a single line out of an `echo` reply.
|
||||
|
||||
`t.certs()` generates a CA, a second unrelated CA, and a certificate for
|
||||
127.0.0.1, once per run and inside the run's temporary directory, so no key
|
||||
material lives in the tree. `t.https()`, `t.tls_proxy_http()` and
|
||||
`t.socks_http()` reach a server through TLS, a TLS-wrapped proxy, or SOCKS.
|
||||
Log records are written when a connection finishes rather than when the
|
||||
reply arrives, so assert on them through `t.wait_output(server, text)`.
|
||||
|
||||
Note that access rules accumulate until `flush`, so a service section that
|
||||
means to stand on its own should start with one - otherwise an earlier
|
||||
`allow *` matches first and the rule under test is never reached.
|
||||
Reference in new issue
Block a user