Skip to content

Conversation

@robmueller
Copy link

tcpsock:sslhandshake does a client side ssl handshake for upstream sockets. normally you just specify ssl on the listen directive for downstream sockets. however there are certain cases where you want to be able to take a plaintext downstream connection and upgrade it to an ssl encrypted one, such as legacy SMTP STARTTLS

this implements a new sock:serversslhandshake method. it uses ssl certificate setup via the existing ssl_certificate and ssl_certificate_key configuration options. it only adds this method to downstream socket connections.

most of this work was based on the code in ngx_stream_lua_socket_tcp_sslhandshake and associated functions, with some changes to get it working with downstream sockets. i'm definitely not an nginx expert, so I'm not sure if I've messed up something subtle but important here, but I got enough tests written and working that it seemed reasonably solid.

i'd appreciate any review and feedback and would like to get this to a state where it could be merged upstream.

tcpsock:sslhandshake does a client side ssl handshake for upstream
sockets.  normally you just specify `ssl` on the listen directive for
downstream sockets.  however there are certain cases where you want to
be able to take a plaintext downstream connection and upgrade it to an
ssl encrypted one, such as legacy SMTP STARTTLS

this implements a new sock:serversslhandshake method. it uses ssl
certificate setup via the existing ssl_certificate and ssl_certificate_key
configuration options.  it only adds this method to downstream socket
connections.
@robmueller robmueller force-pushed the feature-serversslhandshake branch from fa988ed to 3ee8cef Compare November 5, 2025 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant