Changes

Jump to: navigation, search

OPS235 Lab 7 - CentOS6

1 byte removed, 21:04, 12 January 2014
no edit summary
@ WARNING: POSSIBLE DNS SPOOFING DETECTED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The RSA host key for fedora3 centos3 has changed,
and the key for the according IP address 192.168.235.13
is unchanged. This could either mean that
Add correct host key in /home/user1/.ssh/known_hosts to get rid of this message.
Offending key in /home/user1/.ssh/known_hosts:53
RSA host key for fedora3 centos3 has changed and you have requested strict
checking.
Host key verification failed.
<ol><li value="4">When prompted enter your password for your ops235 account on centos3.</li>
<li>Establish an ssh connection using your learn account from fedora3 centos3 to fedora2centos2.</li></ol>{{Admon/note |Proof of Established SSH Connection | When you have both ssh connections established between fedora2 centos2 and fedora3 centos3 check your network connections using the netstat command. You should now see at least 2 TCP connections with a state of ESTABLISHED. One connection represents the connection from fedora2 centos2 to fedora3 centos3 and the other represents the connection from centos3 to centos2. You should also see that you still have ssh listening to TCP port 22. Notice that the client side of each connection uses a random port number in the upper ranges. This common behaviour for client side applications.}}
<ol><li value="6">Logout of your ssh connection by typing <code>exit</code>.
<li>Check the state of the connection after logging out. Wait a few minutes and then check again. Record your observations.</li>
=== Investigation 4: How do you use scp and sftp. ===
{{Admon/note | Use your fedora2 centos2 VM | Complete this investigation on your fedora2 centos2 VM.}}
{{Admon/note | | There are 2 common command line tools for transferring files between hosts over an encrypted ssh connection, <code>scp</code> and <code>sftp</code>.<br /> <code>sftp</code> is an interactive file transfer program that functions much like an ftp client. }}
# To connect to a remote host type the command:<br /><code>sftp ops235@fedora3centos3</code>
# This will establish an interactive session after authentication.
# Type <code>help</code> to see the list of sftp commands at any time.
# Try using <code>sftp</code> to transfer files back and forth between hosts.
# As you did previously you can also use the <code>scp</code> command to copy files to and from remote hosts and even from one remote host to another.
# Use <code>scp</code> to copy your services file to the fedora3 centos3 host into the /tmp directory. (The path on a remote host follows the ''':''') using the command: <br /><code>scp /etc/services ops235@fedora3centos3:/tmp</code># Experiment with <code>scp</code> to copy a file from fedora3 centos3 directly to fedora1centos1.{{Admon/tip| SELinux | SELinux may prevent ssh from accessing your home directories on Fedora 1 centos1 because you created a new filesystem there. You can reset the security context of the /home directory with this command: <code>restorecon -Rv /home</code>}}
=== Investigation 6: How do you use ssh to tunnel other traffic. ===
{{Admon/note | Use your centos2 and fedora1 centos1 VMs | Complete this investigation on your centos2 and centos1 VMs.}}
{{Admon/note | | You can also use an ssh connection to tunnel other types of traffic. There could be different reasons for doing this. For example tunneling traffic for an unencrypted application/protocol through ssh can increase the security of that application. Alternatively you could use it to circumvent a firewall that is blocking traffic you wish to use but allows ssh traffic to pass through.}}
:::: [[Image:Tunnel.png]]
<ol><li value="13">Establish a tunnel using a local port on centos2 of 20808, that connects to the remote port on centos1 of 80, using the following command on centos2:<br /><code>ssh -L 20808:centos1:80 user@centos1</code></li></ol>
{{Admon/note | Note! | The -L (which means Local port) takes one argument of <pre><local-port>:<connect-to-host>:<connect-to-port></pre> The command basically connects your local port of 20808 to the remote port of 80 on fedora1centos1. This means all requests to 20808 on the localhost (centos2) are actually tunnelled through your ssh connection to port 22 on fedora1 centos1 and then delivered to port 80 on centos1, bypassing the firewall. }}<ol><li value="14">Once the tunnel is established use netstat to verify the port 20808 is listening on fedora2centos2</li>
<li>Now using the browser on centos2 connect to http://localhost:20808</li>
<li>You should see the index.html page on centos1.</li>

Navigation menu