Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 3923

Advanced users • Any Stunnel Experts? Auto generate "ip route add" command on connection

$
0
0
So, in a nutshell:
I'm looking for a way to automatically generate an "ip route add" command, and execute it, using the connected ip address in stunnel.

In the stunnel log file I see these entries when I connect remotely to stunnel from my phone:

Code:

Service [home] accepted connection from xxx.xxx.xxx.xxx:yyyy
I want to be able to capture that IP address (xxx.xxx.xxx.xxx) and generate the following command to add that route:

Code:

ip route add xxx.xxx.xxx.xxx via 192.168.1.1 dev eth0 proto static
I'm pretty good with Python and Bash scripts, and I've read over the stunnel docs, but I can't find anyway to have a script execute when stunnel connects and pass that IP address to it.

I know in OpenVPN, there are the 'up' and 'down' commands that allow you to execute scripts when a connection is made and lost, but I don't see anything like that in stunnel.

Any ideas or suggestions or where to look?

Thanks!

Statistics: Posted by Prof. R. Myrkr — Sat Oct 05, 2024 8:52 am



Viewing all articles
Browse latest Browse all 3923

Trending Articles