I have a server that needs to accept TCP connections on port 443, figure out if a connection is an OpenVPN client or an HTTPS client, and either forward it to my web server or my OpenVPN server.
SSLH was designed specifically for this reason, and seems to work great. The only problem is that while setting it up in non-transparent mode works fine for me, using transparent mode is giving me trouble.
Can someone explain the theory behind how transparent mode is supposed to work?
The SSLH guide says that in order to use SSLH transparently, you need to:
- Set sslh.cfg to
transparent: true;- I've done this
- sslh needs extended rights (CAP_NET_ADMIN)
- I installed sslh from my CentOS 7's repos, which came with sslh.service for systemd. That service file contains the line
CapabilityBoundingSet=... CAP_NET_ADMIN ..., so I assume this is already done by SystemD
- I installed sslh from my CentOS 7's repos, which came with sslh.service for systemd. That service file contains the line
- Setup iptables rules that mark packets, and some sort of local route
- This is what I'm unclear about. Do these get setup on the SSLH server? Or do they get setup on the OpenVPN and HTTPS servers?
I get that in the example, iptables is told to mark any packets with a source port of 22 or 4443 with a 0x1 marking, a rule is created to have any packets marked with 0x1 use routing table 100, and routing table 100 is created that sets up some sort of local route that does something.
Why are these iptables rules and the route necessary? What is the route actually doing? I would think that the route should be on the web server and OpenVPN server, and point to the SSLH ip, but that doesn't seem to work for me either.
===
Update: It just occurred to me that it's probably a route that points back to localhost because in the example, the servers are all on the same machine, and they want the reply packets coming from the actual servers to go through SSLH before they leave the machine. Does that sound right? If so, what would I do in my case if my servers are on different machines? Setup traffic marking and a route back to the SSLH server on those machines?
Update 2: I just quickly setup the HTTPS server on the same box as the SSLH, and transparent mode does seem to work exactly the way it does in the example of SSLH's documentation. I need it to work when they are on different servers.
port-shareoption (serverfault.com/a/187930/229499).