Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Restarting socks proxy
View unanswered posts
View posts from last 24 hours

Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Massimo B.

Joined: 09 Feb 2005
Posts: 1607
Location: PB, Germany

PostPosted: Tue Mar 21, 2017 7:02 am    Post subject: Restarting socks proxy Reply with quote

A Restarting Socks Proxy

I try to create some restarting socks proxy that restarts when the link is lost like on network switches or suspend to ram. I wonder that there is no packaged solution yet.

The only thing working so far:
while true;do logger "Launching SOCKS...";ssh -N -D 8080 gw;done

Trying to put that into some script that can be run with autostart of the Window Manager fails even if backgrounded and disowned. It is killed after the script is finished due to STDIN binding. Trying -n for redirecting stdin from /dev/null results in an infinite loop restarting ssh as it quits after started. This is normal with -n but this way I can't check if it is alive.
#!/usr/bin/env bash
    while sleep 1; do
       logger "Launching SOCKS..."
       ssh -CNn -D 8080 gw
) &

More advanced checks for keeping ssh alive is done by autossh, but this doesn't work as documented:

# autossh -M 20000 -f -N -g -D 8080 gw
This quits right after launching ssh, so it does not check the connection status anymore. So I tried combinations of
# autossh -M 20000 -N -g -D 8080 gw &
# autossh -M 20000 -CNn -D 8080 gw &

This first of those is staying alive but cannot be put inside a script as well as it quits after script is finished. The second one is dying as well inside a script.

Looking around I only found few solutions for this like But investigating the script, that AUTO_RECONNECT does only restart on triggering status like polling by a cron job.

Best solution would be an init script or some script connected to Networkmanger itself.
Doesn't some of the real socks proxies like net-proxy/dante provide a solution?
ppc:PowerBook5,8 15"(1440)-G4/1.67,2G|amd64:HP EliteBook 8560w,i7-2620M,16G|amd64-prefix:OpenSuse|HP EliteDesk 800G1 i7-4790|HP Compaq Pro 6300 i7-3770
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum