<div dir="ltr"><div><div><div><div>Hi<br><br></div>I have to figure out how to get some ssl encapsulation for an application we have that only servs on obscure ports, the app needs to retain the source ip adress of the client requests. So i looked at stunnel, its working great in transparent mode where the stunnel server is the default gateway of the socket server, but I would like to get the stunnel server onto the same machine as the socket server and keep the client src ip. Testing with a apache as a backend as its easy to test.<br>
<br></div>running centos 6.3 (2.6.32-279.19.1.el6.x86_64), updated an hour ago, built stunnel 4.54 from src.rpm.<br><br></div>The players<br></div>stunnel-boxen external=192.168.0.1, internal=192.168.1.1<br><div></div><div>
web/socket-boxen internal=192.168.1.11, dg=192.168.1.1<br></div><div><br>The configs<br></div><div>Config A - works ok<br></div><div><br>debug = 7<br>foreground = yes<br></div><div>#not chrooted runnnig as root no setuid,setguid<br>
</div><div><br>[socket-1234]<br>cert=blarg.crt<br>key=blarg.key<br>accept = <a href="http://192.168.0.1:1234">192.168.0.1:1234</a><br>connect = <a href="http://192.168.1.11:80">192.168.1.11:80</a><br>transparent = source<br>
<br></div><div>Config B - Not so good<br></div><div>connect = <a href="http://192.168.1.1:80">192.168.1.1:80</a> <- inside interface of stunnel box<br><br>iptables -t mangle -N DIVERT<br>iptables -t mangle -A PREROUTING -p tcp -m socket -j DIVERT<br>
iptables -t mangle -A DIVERT -j MARK --set-mark 1<br>iptables -t mangle -A DIVERT -j ACCEPT<br>ip rule add fwmark 1 lookup 100<br>ip route add local <a href="http://0.0.0.0/0">0.0.0.0/0</a> dev lo table 100<br><br></div><div>
/etc/sysctl.conf<br></div><div>no route filtering and forwarding is on<br></div><div><br></div><div>am i trying something impossible? or am i missing something?<br><br></div><div>Any help greatly appreciated, if I get this going I'll happily do a nice neater write up for others.<br>
<br></div><div>Cheers<br><br>Alex<br></div><div><br><br></div><div><br></div><div><br><div><br></div></div></div>