Creating an SSH Tunnel with IPCOP is another way to create an encrypted tunnel between your computer and IPCOP. This allows for remote access to computers behind IPCOP without additional software (such as OpenVPN).
ssh -p 222 -N -f -L 12345:10.0.0.20:23 root@ipcop.fqn
where 12345 is the local port to listen on, 10.0.0.20 is the remote computer, 23 is the port on the remote computer, and ipcop.fqn is the address of your IPCOP box.
Full explanation of options specified before:
-p 222
SSH port.
-N
Run SSH background without terminating.
-f
Run SSH in the background.
-L
SSH port forwarding tunnel specified by the next parameters.
12345
The local port.
10.0.0.20
Remote server.
23
Remote port number.
root@ipcop.fqn
Specifies to connect to use your IPCOP firewall.
If you are on Windows, you can create a tunnel by doing the following:
You may want to allow access to IPCOP without having to use username/password. The following tutorial is designed to assist in the creation with Windows users using Putty.
Figure 1: PuttyGen Initial Menu
Figure 2: PuttyGen Generating Keys
Figure 3: PuttyGen Personalize Settings
Figure 4: PuttyGen Personalized Settings
Connect to IPCOP via SSH (on Windows use Putty).
cd /root
mkdir .ssh
chmod 700 .ssh
cd .ssh
touch authorized_keys2
chmod 600 authorized_keys2
vi authorized_keys2
<Esc> :wq!
The following are steps you may want to take. If you change the SSH settings via the web interface, you will have to reset these options. We will be editing the SSH file located at /etc/ssh/sshd_config
Protocol 2,1
Protocol 2
PasswordAuthentication yes
PasswordAuthentication no
AllowTcpForwarding no
AllowTcpForwarding yes
Now you need to reload the configuration file by doing the following:
kill -HUP ’cat /var/run/sshd.pid’
To connect to IPCOP with your public keys, do the following:
Figure 5: Putty Public Key Setup
If you are having problems connecting to IPCOP with an error message of ’Server refused our key’, do the following:
ssh-keygen -i -f /path/to/public_key >> ~/.ssh/authorized_keys2
ssh-keygen -i -f /path/to/public_key > ~/.ssh/authorized_keys2