All pastes #762443 Raw Edit

ssh tutorial for scorche

public text v1 · immutable
·published 2007-11-05 18:14 UTC
rendered paste body
ssh on port 443 tutorial for scorche

This assumes a PC at work that's running linux of some flavour I'm afraid. Windows
just won't cut it here :(

1. Install ssh server on your home PC.
2. Edit sshd_config (usually in /etc/ssh) and add the following lines : (doesn't really matter where)

    Port 443
    PermitTunnel yes
    TCPKeepAlive yes   (useful but not required)
3. Restart sshd to make sure it reads these new settings

4. Create the following script in ~root on your home PC ,
   replacing "ath0" with whatever the network interface is
   on your PC which connected to the intertubes :

    #!/bin/bash
    /sbin/modprobe tun
    /sbin/ifconfig tun0 192.168.10.1 netmask 255.255.255.0 up
    echo 1 > /proc/sys/net/ipv4/ip_forward
    iptables -t nat -F
    iptables -t nat -A POSTROUTING -o ath0 -j MASQUERADE

5. Create the following script in ~root on your work PC :
    #!/bin/bash
    /sbin/modprobe tun
    /sbin/ifconfig tun0 192.168.10.2 netmask 255.255.255.0 up
    /sbin/route add -net 10.0.0.0 gw 10.8.237.1
    /sbin/route del default
    /sbin/route add default 192.168.10.1
    /usr/bin/host www.google.com    (this just tests to see if it's all working)

    Clearly in the above example you'll have to replace the 10.0.0.0 network with
    whatever private network range your company uses on it's internal LAN, and
    also the 10.8.237.1 address with whatever your default gateway was before
    you connected to your ssh session at home.

6. Install BIND on your work PC. This is necessary if you want to be able to
   resolve both intertube IP addresses, and local work ones. I tried fiddling
   with /etc/resolv.conf till I was blue in the face - but you just can't make
   it work like that. It's best to follow some sort of intertube HOWTO on getting
   this set up properly to do caching / forwarding - it's beyond the scope of this
   document. But once you've done that bit read on for getting it resolving your
   work addresses.

7. /etc/bind/named.conf (or wherever it lives on your distro)
   Add "zone" entries for each sub-domain on your network.
   For instance I have these :

    zone "emea-qadev.com" IN {
        type slave;
        file "pri/emea-qadev.com.zone";
        masters { 10.8.225.96; 10.8.225.97; };
    };

    zone "qadev.uk.eu.abnamro.com" IN {
        type slave;
        file "pri/abnamro.com.zone";
        masters { 10.8.226.254; 10.8.224.254; };
    };

    This will create .zone files in /var/bind/pri on my machine to track addresses
    in those domains.

    You probably also want zones to do reverse lookups in those domains, e.g. :

    zone "225.8.10.in-addr.arpa" IN {
        type slave;
        file "pri/10.8.225.zone";
        masters { 10.8.225.96; 10.8.225.97; };
    };

8. Put something similar to the following in your ~/.ssh/config file on the work PC.
   Replace the 10.1.7.62 address with the address of your work's http proxy server 
  (and change the port too if it's not on 8080)

Host home
 Hostname scorche.dyndns.org
 Port 443
 ProxyCommand corkscrew 10.1.7.62 8080 %h %p
 TCPKeepAlive yes
 User scorche
 ForwardX11 yes
 Compression yes
 CompressionLevel 6