Skip to content

Instantly share code, notes, and snippets.

@shurikk
Created February 10, 2021 18:08
Show Gist options
  • Save shurikk/631fb68d1e108265926ac48fe2f0e725 to your computer and use it in GitHub Desktop.
Save shurikk/631fb68d1e108265926ac48fe2f0e725 to your computer and use it in GitHub Desktop.
nginx as a transparent SSL proxy using stream module (quick test)
iptables -t nat -A OUTPUT -p tcp -m tcp --dport 443 -m owner --uid-owner root -j RETURN
iptables -t nat -A OUTPUT -p tcp -m tcp --dport 443 -m owner --uid-owner nginx -j RETURN
iptables -t nat -A OUTPUT -p tcp -m tcp --dport 443 -j REDIRECT --to-ports 3130
daemon off;
events {}
error_log /dev/stdout info;
http {
access_log /dev/stdout;
}
stream {
server {
listen 3130;
ssl_preread on;
proxy_pass $ssl_preread_server_name:443;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment