Package: no-you-talk-to-the-hand
Access all your corporate stuff and web stuff at the same time without
fussYou want this if you’re being worn out by:Seeing the ‘talk to the hand’ page from the corporate web
proxy/filterTunnel/proxy setup in too many places and in too many waysTunnels dropping silentlyForgetting to manually bring up tunnels after logging onto vpnRe-entering ssh credentials over and over (key based auth isn’t
allowed everywhere)no-YOU-talk-to-the-hand solves all these issues by providing a
straight-forward combination ofsshuttlefor the heavy
network lifting, supervisord to keep everything up and manageable, and
yaml to keep it simple and organizedWorks with Linux and MacOS butnot MS Windowsdue to sshuttle though
there is a workaround for windows describedhereWhat it doesSets up your tunnels automaticallywhen your VPN connectsTakes down your tunnels automaticallywhen your VPN disconnectsKeeps your tunnels upwhen they should be upOrganizes your tunnelswith a single, simple, YAML configurationEnters passwords for youas needed
(sshpassrequired for
now)Supportsmultiple VPNs (roots). Have different vpns that require
separate tunnels? Define them in one place and only tunnels dependent
on the vpn that is up are establishedSupports any number ofsimultaneous tunnels(thanks tosshuttle)Supportesnested dependencies. For example: (qa_db, prod_db) –
depends –> (corp_private) – depends –> (corp_vpn)Config.yml replaces all your tunnel scripts/aliases, ssh setup inside db tools, application specific web proxy setup, etc:HOST_PERSONAL_PROXY:&HOST_PERSONAL_PROXY192.168.1.XPROXY_USER:&PROXY_USERproxy.usernameCORP_USER:&CORP_USERcompany.usernameCORP_PASS:&CORP_PASSpA$$wuuuurd# Define the corporate subnets. SUBNETS_CORP_ALL encompasses addresses that will already be sent# through your default network interace to the compnay network. This var is defined for exclusion# from other tunnels which will override your system defaults. SUBNETS_CORP_RESTRICTED is used# to forward a subset of corporate traffic through a jump server in order to reach hosts that are# not reachable directly on the VPN.SUBNETS_CORP_ALL:&SUBNETS_CORP_ALL-"10.0.0.0/8"SUBNETS_CORP_RESTRICTED:&SUBNETS_CORP_RESTRICTED-"10.0.1.0/24"-"10.0.2.0/24"# Define several special destinations on the corporate network. HOST_CORP_JUMP defines the host# through which all protected subnets must be accessed. HOST_CORP_PRIVILEGED_APP and HOST_CORP_SEURE_DB# define an application server and database where the database can only be reached from the# application server. Reaching the database will require a nested tunnelHOST_CORP_JUMP:&HOST_CORP_JUMP10.0.0.1HOST_CORP_PRIVILEGED_APP:&HOST_CORP_PRIVILEGED_APP10.0.1.1HOST_CORP_SECURE_DB:&HOST_CORP_SECURE_DB10.0.2.1# Global config optionslog_level:DEBUG# Python log level. Default is DEBUGmonitor_poll_seconds:5# Monitor thread wakeup (may be exceeded by a long tunnel check). Default is 20tunnels:# Watch for connection to corporate VPN. This is the 'root', external tunnel# In this configuraiton, if the corporate jump server is available, then the vpn is upvpn:check:host:*HOST_CORP_JUMPport:22# Bypass corporate network policies for web browsing, skype, streaming music, etc.# You must have a proxy server available that is outside the corporate network. If# you don't have one, this project is still useful for accessing restricted# resources within the corporate network.personal:depends:vpnproxy:host:*HOST_PERSONAL_PROXYuser:*PROXY_USERpass:check:# instead of an ip and port, a check target can be a url for an http checkurl:https://twitter.com/forwards:# includes and excludes. items can be ips, subnets, or lists of ip/subnets.include:# By default, forward everything through the personal proxy-0/0exclude:# exclude home network and anything corporate-192.168.0.0/16-*SUBNETS_CORP_ALL# Forward traffic destined for restricted subnets through a corporate jump server.corp_sec:depends:vpnproxy:host:*HOST_CORP_JUMPuser:*CORP_USERpass:*CORP_PASS# verify by checking ssh access to the privileged app servercheck:# If the application server is reachable, this tunnel is uphost:*HOST_CORP_PRIVILEGED_APPport:22forwards:# Include anything destined for a secured corporate subnetinclude:-*SUBNETS_CORP_RESTRICTED# Tunnel to access a secure db server from a privileged app server. This tunnel depends# on corp_restricted being established. For traffic destined for the DB, this rule will# fire first and the traffic will be forwarded through the APP server, however traffic# destined for the APP server is forwarded through the JUMP server.prod_db:depends:corp_secproxy:host:*HOST_CORP_PRIVILEGED_APPuser:*CORP_USERpass:*CORP_PASScheck:driver:mysql+pymysqldb:testdbuser:testuserpass:testpasshost:10.0.2.1port:'3306'forwards:# includes and excludes. items can be ips, subnets, or lists of ip/subnets.include:-*HOST_CORP_SECURE_DBInstallation$ pip install no_you_talk_to_the_handIf pip install results in a error like ‘TLSV1_ALERT_PROTOCOL_VERSION’
you may first need to upgrade pip:$ curl https://bootstrap.pypa.io/get-pip.py | pythonIf you configure a password for any remote server thensshpassis required.sshuttle requires root/admin privilege to change forward rules. If your
user is prompted for sudo password, then you may encounter and error
likesudo no tty present and no askpass program specified. A quick
solution is to set the no password flag in the sudoers file. The
following works currently on Macs:$ sudo visudo$ %admin ALL=(ALL) NOPASSWD: ALLIf you check a tunnel via a sqlalchemy connection (see prod_db tunnel in
sample config above) then sqlalchemy and the appropriate driver must be
installed separatelyRunningstartStart daemon to begin managing the configured tunnels (in
~/.nyttth/config.yml)$ nyttth startstopStop daemon along with any tunnels that are running$ nyttth stopstatusHelp:$ nyttth status --help

Usage: nyttth status [OPTIONS]

  View status of all configured tunnels

Options:
  -t, --tunnel [qadb|riskdb|itun|dbtun|etun|vpn|rfindb]
                                  specify a specific tunnel
  -s, --skip                      skip tunnel health checks
  --help                          Show this message and exit.Example with VPN down:$ nyttth status

Process   Depends   Proc State                  Conn Check
----------------------------------------------------------
vpn                 N/A                         down
itun      vpn       STOPPED   Not started       skipped
dbtun     itun      STOPPED   Not started       skipped
etun      vpn       STOPPED   Not started       skipped
qadb      vpn       STOPPED   Not started       skippedExample with VPN up:$ nyttth status

Process   Depends   Proc State                            Conn Check
--------------------------------------------------------------------
vpn                 N/A                                   up
itun      vpn       RUNNING   pid 1595, uptime 0:09:28    up
dbtun     itun      RUNNING   pid 1603, uptime 0:09:23    up
etun      vpn       RUNNING   pid 1565, uptime 0:09:33    up
qadb      vpn       RUNNING   pid 2692, uptime 0:00:04    uptailHelp:$ nyttth tail --help

Usage: nyttth tail [OPTIONS]


  Use system tail command to display logs. If a specific tunnel is not specified
  then all logs will be tailed including the supervisord main log and the vpnmon
  tunnel monitor process.


Options:
  -t, --tunnel [qadb|itun|dbtun|etun|vpn]
                                  specify a specific tunnel to tail. If not
                                  specified all tunnels and the tunnel monitor
                                  (monitor) will be tailed
  -f, --wait                      wait for additional data
  -n, --lines INTEGER             number of lines to display
  --help                          Show this message and exit.Tail output for a single (example) tunnel:$ nyttth tail -f -t itun
  server: warning: closed channel 158 got cmd=TCP_STOP_SENDING len=0
  server: warning: closed channel 159 got cmd=TCP_STOP_SENDING len=0
  server: warning: closed channel 160 got cmd=TCP_STOP_SENDING len=0
  server: warning: closed channel 148 got cmd=TCP_STOP_SENDING len=0
  server: warning: closed channel 162 got cmd=TCP_STOP_SENDING len=0
  server: warning: closed channel 164 got cmd=TCP_STOP_SENDING len=0When VPN Connects:$ nyttth tail -f | grep nyttth
2017-05-17 11:52:53,357 DEBUG nyttth: checking tunnels
2017-05-17 11:52:53,497 INFO nyttth: qadb is down. starting
2017-05-17 11:52:53,498 INFO nyttth: dbtun is down. starting
2017-05-17 11:52:53,907 INFO nyttth: etun is down. starting
2017-05-17 11:52:55,493 INFO nyttth: itun is down. starting
2017-05-17 11:53:06,527 DEBUG nyttth: checking tunnels
2017-05-17 11:53:06,814 INFO nyttth: rfindb is down. starting
2017-05-17 11:53:17,826 DEBUG nyttth: checking tunnels
2017-05-17 11:53:28,129 DEBUG nyttth: checking tunnelsWhen VPN Disconnects:$ nyttth tail -f | grep nyttth
2017-05-17 11:51:44,701 DEBUG nyttth: checking tunnels
2017-05-17 11:51:55,000 DEBUG nyttth: checking tunnels
2017-05-17 11:52:05,265 DEBUG nyttth: checking tunnels
2017-05-17 11:52:07,269 DEBUG nyttth: vpn is down
2017-05-17 11:52:07,274 INFO nyttth: qadb depends on vpn which is down. stopping
2017-05-17 11:52:07,281 INFO nyttth: itun depends on vpn which is down. stopping
2017-05-17 11:52:07,286 INFO nyttth: rfindb depends on itun which is down. stopping
2017-05-17 11:52:07,292 INFO nyttth: dbtun depends on vpn which is down. stopping
2017-05-17 11:52:07,299 INFO nyttth: etun depends on vpn which is down. stopping
2017-05-17 11:52:17,306 DEBUG nyttth: checking tunnels
2017-05-17 11:52:19,310 DEBUG nyttth: vpn is down
2017-05-17 11:52:29,324 DEBUG nyttth: checking tunnels
2017-05-17 11:52:31,329 DEBUG nyttth: vpn is down
2017-05-17 11:52:41,340 DEBUG nyttth: checking tunnels
2017-05-17 11:52:43,345 DEBUG nyttth: vpn is downctlRun supervisorctl console$ nyttth ctlNotesThis project uses sshuttle version 0.78.1. Subsequent versions define PF
(Packet Filter) exclusions in a way that breaks when there are
exclusions in multiple instances of sshuttle.Python 3 is not supported because supervisord does notThis docs ignores whatever technical differences there are between
tunnels and forwards and just uses the word ‘tunnels’.Remote ssh servers through which trafffic is forwarded, are referred to
as proxies.The term ‘VPN’ refers to a ‘root’ tunnel in the configuration that
specifies no proxy setup or forwards. It exsits to check an external
condition (reachable network endpoint)and does not really have to be a
true VPN