#CHEAT SHEET

ssh -i cloud.key ubuntu@10.4.128.2 "wget -O ipop-14.07.0_ubuntu12.tar.gz http://goo.gl/IsGzqI && tar xvzf ipop-14.07.0_ubuntu12.tar.gz && cd ipop-14.07.0_ubuntu12"


ssh -i cloud.key ubuntu@10.4.128.2 "echo '{                                    
    "xmpp_username": "jules",
    "xmpp_password": "password",
    "xmpp_host": "131.94.128.12",
    "ip4": "192.168.5.2",
    "ip4_mask": 24,
    "tincan_logging": 1,
    "controller_logging": "DEBUG",
    "stun": ["131.94.128.12:3478"]
}' > ~/ipop-14.07.0_ubuntu12/config.json"
&&
ssh -i cloud.key ubuntu@10.4.128.4 "echo '{                                    
    "xmpp_username": "claire",
    "xmpp_password": "password",
    "xmpp_host": "131.94.128.12",
    "ip4": "192.168.5.4",
    "ip4_mask": 24,
    "tincan_logging": 1,
    "controller_logging": "DEBUG",
    "stun": ["131.94.128.12:3478"]
}' > ~/ipop-14.07.0_ubuntu12/config.json"
&&
ssh -i cloud.key ubuntu@10.4.128.7 "echo '{
    "xmpp_username": "sebastien",
    "xmpp_password": "password",
    "xmpp_host": "131.94.128.12",
    "ip4": "192.168.5.7",
    "ip4_mask": 24,
    "tincan_logging": 1,
    "controller_logging": "DEBUG",
    "stun": ["131.94.128.12:3478"]
}' > ~/ipop-14.07.0_ubuntu12/config.json"
&&
ssh -i cloud.key ubuntu@10.4.128.8 "echo '{
    "xmpp_username": "salome",
    "xmpp_password": "password",
    "xmpp_host": "131.94.128.12",
    "ip4": "192.168.5.8",
    "ip4_mask": 24,
    "tincan_logging": 1,
    "controller_logging": "DEBUG",
    "stun": ["131.94.128.12:3478"]
}' > ~/ipop-14.07.0_ubuntu12/config.json"
&&
ssh -i cloud.key ubuntu@10.4.128.6 "echo '{
    "xmpp_username": "laurent",
    "xmpp_password": "password",
    "xmpp_host": "131.94.128.12",
    "ip4": "192.168.5.6",
    "ip4_mask": 24,
    "tincan_logging": 1,
    "controller_logging": "DEBUG",
    "stun": ["131.94.128.12:3478"]
}' > ~/ipop-14.07.0_ubuntu12/config.json"


ssh -i cloud.key ubuntu@10.4.128.2 "cat ~/ipop-14.07.0_ubuntu12/config.json"



ssh -i cloud.key ubuntu@10.4.128.2 "sudo sh -c '~/ipop-14.07.0_ubuntu12/ipop-tincan-x86_64 1> out.log 2> err.log &'"

ssh -i cloud.key ubuntu@10.4.128.2 "chmod 755 ~/ipop-14.07.0_ubuntu12/gvpn_controller.py"

ssh -i cloud.key ubuntu@10.4.128.2 "~/ipop-14.07.0_ubuntu12/gvpn_controller.py -c config.json &> log.txt &"

ssh -i cloud.key ubuntu@10.4.128.2 "echo -e '\x02\x01{"m":"get_state"}' | netcat -q 1 -u 127.0.0.1 5800"

ssh -i cloud.key ubuntu@10.4.128.2 "/sbin/ifconfig ipop"



cd ipop-14.07.0_ubuntu12/
sudo sh -c './ipop-tincan-x86_64 1> out.log 2> err.log &'
chmod 755 gvpn_controller.py
./gvpn_controller.py -c config.json &> log.txt &
echo -e '\x02\x01{"m":"get_state"}' | netcat -q 1 -u 127.0.0.1 5800
/sbin/ifconfig ipop


sudo sh -c './ipop-tincan-x86_64 1> out.log 2> err.log &'
chmod 755 svpn_controller.py
./gvpn_controller.py -c config.json &> log.txt &
echo -e '\x02\x01{"m":"get_state"}' | netcat -q 1 -u 127.0.0.1 5800
/sbin/ifconfig ipop


pkill ipop-tincan-x86_64
ps aux | grep svpn_controller.py
kill <pid-of-svpn-controller.py>