Difference between revisions of "Network/SSH"
Jump to navigation
Jump to search
(Created page with "== Tunneling == === Script de création/suppression auto de tunnels === Ce script est a l'origine destiné a Bacula. Pour rajouter un host, il suffit de modifier la ligne "...") |
|||
Line 25: | Line 25: | ||
done | done | ||
</pre> | </pre> | ||
+ | |||
+ | |||
+ | == Proxy Socks == | ||
+ | |||
+ | Create Socks Proxy: | ||
+ | |||
+ | ssh -D 9999 eadam@x.x.x.x | ||
+ | |||
+ | Config to connect to some host automatically through the socks proxy: | ||
+ | |||
+ | '''$ cat .ssh/config''' | ||
+ | |||
+ | Host 192.168.96.* | ||
+ | ProxyCommand='connect -5 -S localhost:9999 %h %p' | ||
+ | |||
+ | You may need to install '''connect-proxy'''. |
Latest revision as of 21:54, 19 December 2014
Tunneling
Script de création/suppression auto de tunnels
Ce script est a l'origine destiné a Bacula.
Pour rajouter un host, il suffit de modifier la ligne "HOSTS=...". Le port a utiliser s'incremente tout seul, en partant de 9110.
#!/bin/bash HOSTS=host1 host2 # Stop all tunnels TUNNEL_COUNT=$(ps ax|grep ssh|grep bacula-tun|awk '{print $1}'|wc -l) if [ ! $TUNNEL_COUNT == "0" ]; then kill $(ps ax|grep ssh|grep bacula-tun|awk '{print $1}') fi PORT=1000 for H in $HOSTS; do echo $H:$PORT autossh -M0 -f -N -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" -L $PORT:localhost:9102 -R 9103:si0-2.gre.winsoft.fr:9103 bacula-tun@$H & let PORT=$PORT+1 done
Proxy Socks
Create Socks Proxy:
ssh -D 9999 eadam@x.x.x.x
Config to connect to some host automatically through the socks proxy:
$ cat .ssh/config
Host 192.168.96.* ProxyCommand='connect -5 -S localhost:9999 %h %p'
You may need to install connect-proxy.