Repository navigation
Conversation
…ert, plain-HTTP warning
Covers a runtime set of server.tls keys, the client certificate switch with TLS off, a CA bundle without a CA certificate, the HTTPS launch with require_client_cert, and the warning for write mode and for auth from the environment.
…eds TLS The HTTPS launch makes a client certificate signed by its CA when require_client_cert is true and prints a curl command that uses it.
| "Failed to create SSL server. Check certificate and key files: " + tls_config_.cert_file + | ||
| " (key configured: " + (tls_config_.key_file.empty() ? "no" : "yes") + ")"); | ||
| } | ||
| if (tls_config_.require_client_cert) { |
There was a problem hiding this comment.
With a client CA, httplib turns on SSL_VERIFY_PEER but nothing sets a session id context, so OpenSSL aborts any resumed handshake with an internal_error alert. curl --cert ... with two URLs gets 200 and then error 35. Call SSL_CTX_set_session_id_context(ctx, ...) with a fixed non-empty id here, check its return, and add TLS 1.2 and 1.3 resume cases to test_tls_floor_mtls.
| # ./certs/server.crt - Server certificate | ||
| # ./certs/server.key - Server private key (chmod 600) | ||
| # ./certs/client.crt - Client certificate (for future mutual TLS) | ||
| # ./certs/client.crt - Client certificate (for mutual TLS) |
There was a problem hiding this comment.
generate_dev_certs.sh writes ca.pem, ca_key.pem, cert.pem and key.pem, so this file list is wrong and client.crt/client.key do not exist. Point the mTLS examples here and in docs/tutorials/https.rst at gateway_https.launch.py cert_dir:=./certs require_client_cert:=true and its ca.pem, client.pem and client-key.pem, or add a clientAuth leaf to the script.
| 'server.tls.enabled': True, | ||
| 'server.tls.cert_file': cert_paths['cert_file'], | ||
| 'server.tls.key_file': cert_paths['key_file'], | ||
| 'server.tls.ca_file': cert_paths['ca_file'], |
There was a problem hiding this comment.
mTLS is detected only from the launch arg, but a config_file with require_client_cert: true turns it on too. Then no client cert is made, this line swaps the config's ca_file for the dev CA, and the printed curl -k fails the handshake. Read the flag from config_file as well, like cors_override does, and set ca_file only when mTLS is on.
| """Create client.pem and client-key.pem signed by the CA in cert_dir, unless they exist.""" | ||
| client_cert = os.path.join(cert_dir, 'client.pem') | ||
| client_key = os.path.join(cert_dir, 'client-key.pem') | ||
| if os.path.exists(client_cert) and os.path.exists(client_key): |
There was a problem hiding this comment.
An existing client.pem is reused even when generate_certificates just made a new CA, so the printed curl gets unknown ca. Regenerate the client pair when the CA was recreated, or when openssl verify -CAfile ca.pem client.pem fails.
Pull Request
Summary
server.tls.min_versionis now the real protocol floor of the HTTPS server. Before, a value other than1.2only logged a warning. The start log states the floor.server.tls.require_client_cert(defaultfalse) turns on mutual TLS. The server then requires a client certificate signed by a CA inserver.tls.ca_file. The gateway does not start when the switch is on andca_fileholds no CA certificate, or when TLS is off. With the switch off,ca_filechanges nothing for clients, as before. A client certificate does not replace a token.server.tls.*keys are read at start. A runtimeros2 param seton them is refused, as forauth.*.gateway_https.launch.py require_client_cert:=truemakes a client certificate signed by its CA and prints a curl command that uses it.auth.require_auth_foriswriteorall,server.hostis not loopback and TLS is off, the gateway logs a warning at start: client secrets and tokens travel in clear text.Breaking changes:
min_version: "1.3", a client limited to TLS 1.2 is refused.server.tls.*parameter is refused. Before, it was accepted and had no effect.Issue
Type
Testing
The launch prints the curl command. In a second shell:
The plain-HTTP warning:
Checklist