In this lab, you will create a proxy tunnel, and a reverse proxy tunnel.
We have 2 VMs to use for this activity. We have the main lab VM which has many services running on it and multiple interfaces and IP addresses. We also have our backup server VM with rsync and VPN client services running. For this part of the lab, we will create a proxy for access to the POP3 server running on a private IP address on our main server, which we will connect to using our backup server which otherwise cannot reach the POP3 service on that server address.
sudo ufw allow 8088/tcp
dennis
account for which the password is also dennis
- screenshot# Find our IP address to use for the external user to connect
ip a s ens33
# Start a forwarding proxy on that port in the background
ssh -L our-lab-vm-ip:8088:172.16.4.2:110 -N dennis@localhost
ping -c 3 172.16.4.2
sudo apt install nmap
nmap our-lab-vm-ip
telnet our-lab-vm-ip 8088
sudo netstat -tpn |egrep '8088|110|State'
So you should be seeing that the backup server which had no access to 172.16.4.2 at all can now access it using an ssh-protected channel.
We have 2 VMs to use for this activity. We have the main lab VM which has many services running on it and multiple interfaces and IP addresses. We also have our backup server VM with rsync and VPN client services running. For this part of the lab, we will create a proxy for access to the POP3 server running on a private IP address on our main server, which we will connect to using our backup server which otherwise cannot reach the POP3 service on that server address.
sudo ufw status numbered
sudo ufw delete ## where ## is the rule number for the 143/tcp rule
ssh -R *:8143:localhost:143 -N student@backup-srvr-ip
Now we should be able to connect to port 8143 on the backup srvr and get responses from the IMAP service on the main VM, even though its firewall is trying to stop us from getting there.
telnet our-lab-vm-ip 143
sudo apt install nmap
nmap our-lab-vm-ip
telnet localhost 8143
sudo netstat -tpn |egrep '143|State'
sudo netstat -tpn |egrep '8143|State'
who
and netstat
- screenshot
who
sudo netstat -tpn |egrep '22|State'
netstat
listing than the number of user ssh sessions that users have started as shown by the who
command. For each of those sshd processes, use ps to see what processes have been spawned by that sshd. - screenshot
ps -ef|egrep '#|##|###|PID' where #, ##, ### are a process numbers for sshd from the netstat output
dennis@backup-srv:~$ ps -ef|egrep '269173|125104|277773|PID'|grep -v grep
UID PID PPID C STIME TTY TIME CMD
root 125104 955 0 Nov25 ? 00:00:00 sshd: dennis [priv]
dennis 125273 125104 0 Nov25 ? 00:00:00 sshd: dennis@pts/0
root 269173 955 0 02:57 ? 00:00:00 sshd: dennis [priv]
dennis 269288 269173 0 02:57 ? 00:00:00 sshd: dennis
root 277773 955 0 03:23 ? 00:00:00 sshd: dennis [priv]
dennis 277908 277773 0 03:23 ? 00:00:00 sshd: dennis@pts/1
The sshd processes whose PIDs are the ones we looked for are the forked monitor processes for sshd. The sshd processes that have a virtual terminal pts/0 and pts/1 are probably legitimate login sessions because they have terminals attached. Process 269288 in the example, which is a child of 269173 (one of the ones that netstat showed us) does not have a terminal, and is the one for the tunnel. So if look back at the netstat listing for that sshd process, the foreign address for that connection is the place our tunneler connected to. But since the proxy is actually making a second forwarded connection at the remote end, we cannnot know what it is connected to, or even where.
So you can see that the backup server which had no access to the protected service on the main lab VM can now access it using an ssh-protected channel.
Submit a single PDF containing the screenshots marked in the instructions. Only one PDF is to be submitted and other formats will not be accepted.