This tool acts as a TLS terminating proxy for raw public key TLS RFC 7250 which is used in Pubky. It allows you to:
- Load a secret from a file.
- Create a TLS server using Pubky TLS (RFC 7250).
- Forward decrypted traffic to another service, for example NGINX.
pubky-tls-proxy --secret-file <PATH_TO_SECRET_KEY> --backend-addr <BACKEND_ADDRESS> --listen-addr <LISTEN_ADDRESS>
--secret-file
: Path to a file containing the pubky secret in HEX format (must be 32 bytes/64 hex characters)--backend-addr
: Address to proxy requests to after TLS termination [default: 127.0.0.1:6286]--listen-addr
: Address to listen on for incoming TLS connections [default: 0.0.0.0:8443]
To create a proxy that:
- Listens for TLS connections on port 8443
- Uses a pubky secret from
secret
- Forwards decrypted traffic to a local service on port 3000
pubky-tls-proxy --secret-file secret --backend-addr 127.0.0.1:3000 --listen-addr 0.0.0.0:8443
To generate a new secret key:
# Generate a 32-byte random secret and save as hex
openssl rand -hex 32 > secret
This proxy:
- Loads the secret key and creates a Pubky keypair.
- Sets up a TLS listener using the keypair.
- For each connection:
- Terminates the TLS
- Opens a TCP connection to the backend
- Bidirectionally copies data between the client and backend