[Ninux-Calabria] raggiungere le antenne con sshuttle

Giuseppe De Marco demarcog83 a gmail.com
Mar 29 Ott 2013 23:36:33 UTC


Andando al sodo,

da casa mia mi collego in ssh al pc del mio ufficio e da questo, tramite
una sock in python e una regola nat di iptables in PREROUTING ottengo un
VPN proxy :)

Il server ssh necessita solo di iptables e python per fare tutto,
tramite iptables dirotta tutto il traffico TCP/IP su una sock creata in
python che nel computer che ospita ssh sfrutta la tabella di routing e le
sue interfacce per una navigazione "orizzontale".


root a maker:/home/wert# sshuttle -r wert a 160.97.12.22:222  172.17.87.0/16
wert a 160.97.12.224's password:
Connected.
server: warning: closed channel 1 got cmd=STOP_SENDING len=0
server: warning: closed channel 2 got cmd=STOP_SENDING len=0
server: warning: closed channel 4 got cmd=STOP_SENDING len=0
server: warning: closed channel 6 got cmd=STOP_SENDING len=0
server: warning: closed channel 3 got cmd=STOP_SENDING len=0

in iptables succede questo:


root a maker:/home/wert# iptables -t nat -L -n
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination
sshuttle-12300  all  --  0.0.0.0/0            0.0.0.0/0

Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
sshuttle-12300  all  --  0.0.0.0/0            0.0.0.0/0

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination

Chain sshuttle-12300 (2 references)
target     prot opt source               destination
REDIRECT   tcp  --  0.0.0.0/0            172.17.0.0/16        TTL match TTL
!= 42 redir ports 12300
RETURN     tcp  --  0.0.0.0/0            127.0.0.0/8


e come socketstream mi trovo:

python    18799        root    3u  IPv4 5260614      0t0  TCP
127.0.0.1:12300 (LISTEN)
python    18800        root    3u  IPv4 5260614      0t0  TCP
127.0.0.1:12300 (LISTEN)


provare per credere, io sul mio browser vado su:

https://172.17.87.9/system.cgi

che č collegato sullo stesso switch della mia rete in ufficio :)

pensiamoci.

esponendo su ogni super nodo, ove possibile, la connessione alla porta ssh
dal router adsl domestico, possiamo - previa installazione di
python-minimal su openwrt - amministrare le antenne con flessibilitā.

apt-get install sshuttle

bye,
G
-------------- parte successiva --------------
Un allegato HTML č stato rimosso...
URL: <http://ml.ninux.org/pipermail/calabria/attachments/20131030/1e3a1e81/attachment.htm>


Maggiori informazioni sulla lista Calabria