Lab 3: Secure Shell (SSH) & File Transfer Protocol (FTP)
Introduction
In this lab, you’ll learn to set up, configure, and secure two essential network protocols: SSH (Secure Shell) and FTP (File Transfer Protocol). SSH is widely used for secure remote administration of servers, enabling encrypted connections that protect data during transmission. You’ll explore the configuration and hardening of SSH to prevent unauthorized access, including setting up key-based authentication, restricting login privileges, and enabling multi-factor authentication (MFA) for enhanced security.
The second half of this lab covers FTP, a protocol traditionally used for transferring files between clients and servers. You’ll configure an FTP server, create and manage FTP-specific user accounts, and explore methods for securing FTP access through user restrictions and access controls.
Resources to assist with the lab:
- Homework Questions
- Class Resources
- Classmates/Teammates
- Internet Resources
- Teaching Assistants
Please reach out to the TAs only after making a genuine effort to resolve the issue independently. While they are available to provide guidance and support, their role is to assist you in developing your understanding rather than providing immediate solutions. You are encouraged to approach challenges proactively, fostering problem-solving skills and critical thinking in the process.
Developing problem-solving skills and critical thinking is fundamental to your education and growth. These skills are emphasized as part of the Aims of a BYU Education, which seek to cultivate individuals of faith, intellect, and character. Problem-solving and critical thinking are essential components of sound reasoning, effective communication, and intellectual depth — qualities that prepare you to succeed in both academic and real-world challenges.
BYU’s focus on lifelong learning and service reminds us that the ability to independently approach, analyze, and resolve complex issues is just as important as mastering technical skills. These capabilities not only build competence but also instill the confidence to contribute meaningfully to the world and continue learning throughout life.
Configuration Instructions
Virtual Machines and Operating Systems
You will be working with:
- 1 Rocky 8 Machine
- 1 Kali Linux Machine
Network Configuration
Since your machines do not currently have internet access, you will need to configure the network as follows:
Lab-3-ssh-ftpMachine:- IP:
172.18.<ID>.3/16 - Gateway:
172.18.0.1 - DNS:
172.18.0.1
- IP:
Lab-3-kaliMachine:- IP:
172.18.<ID>.4/16 - Gateway:
172.18.0.1 - DNS:
172.18.0.1
- IP:
Accessing the Virtual Machines
- The VMs can be accessed through your Proxmox instance.
- To track your progress, visit the scoreboard.
- You need to be connected to the VPN to access the scoreboard and your Proxmox instance.
Scoreboard Key
- Green arrows indicate that everything is working as intended.
- Orange Exclamation indicates that something is partially working.
- Red down arrows indicate that something is not working.
Credentials
- All VMs have the same login credentials:
- Username:
blueteam - Password:
abc123
- Username:
Pass Criteria
P1: SSH Installation and Configuration
- Install
SSHon the server by installing theopenssh-serverpackage
P2: SSH Key Generation and Management
- Generate an SSH key on your
lab-3-kalimachine. - Copy the public key over to your server to the
blueteamaccount. - Connect to the server using the key instead of the password.
P3: SSH Hardening
- Limit the number of failed login attempts to
3. - Set the timeout (for an idle session) to be
1 minute. - Set the maximum number of concurrent sessions to be
10
P4: SSH File Transfers
- Copy the file
ssh-file.txtfrom yourlab-3-kalimachineDocumentsdirectory to your server. Place it in/home/blueteam/P4/.
P5: Logging and Monitoring SSH Activity
Use the file /root/secure for the questions in P5
- View the SSH logs and answer the following questions
- How many failed login attempts are there for the user
bob? Enter the linebob-failed:<count>into the file/home/blueteam/P5/P5.txt. - How many successful logins are there for the user
redteam? Enter the lineredteam-successful:<count>into the file/home/blueteam/P5/P5.txt. - How many successful password logins are there for the user
bob? Enter the linebob-password:<count>into the file/home/blueteam/P5/P5.txt. - How many of the successful logins for the
readteamused anssh key? Enter the lineredteam-key:<count>into the file/home/blueteam/P5/P5.txt.
- How many failed login attempts are there for the user
P6: Troubleshooting
To complete P6 P1-5 must have a green arrow before starting
- Fix the errors in the ssh config files to allow the service to restart.
- Restart the service.
P7: FTP Installation, Configuration, and User Management
- Install an FTP server by installing
vsftpd - Restrict
ftpusers to their home directories
P8: FTP Security
- Disable anonymous login to the FTP server.
P9: Troubleshooting
To complete P9 P1-8 must have a green arrow before starting
- Fix the errors in the FTP config files to allow the service to function.
- Restart the service.
Merit Criteria
M1: SSH Installation and Configuration
- Modify the ssh port to also use port
2222. Make sure it is still also running on port22. - Disable
rootaccount login via ssh - Disable
passwordauthentication and only allowkeyauthentication - Disable empty passwords from being used for ssh
M2: SSH Key Generation and Management
Note: Do not change the passwords of any users.
- On the
lab-3-kalimachine generate ssh keys for the usersssh1,ssh2,ftpuser,boband use their key to login to each of their accounts.
M3: Logging and Monitoring SSH Activity
Using logs (use the logs with postfixes of -date rather than the normal ones) answer the following questions:
- What IP address is the
redteamaccount using to access your machine? Enter the lineip:<ip>into the file/home/blueteam/M3/M3.txt. - What file did the redteam account attempt to view? Enter the line
filepath:<filepath>into the file/home/blueteam/M3/M3.txt.
M4: Troubleshooting
To complete M4 P1-P9 and M1-M3 must have a green arrow before starting
The users ssh3 and ssh4 are having issues using their ssh keys. Troubleshoot the problems and allow them to access their accounts again.
M5: FTP Installation, Configuration, and User Management
- Create the directory
/shared-ftp - Allow
read,writeandexecuteaccess to/shared-ftpfor theownerandgroup - Set the owner of
/shared-ftptoftpuserand set thegrouptoftp - Place all users in the
/shared-ftpdirectory when they log in and do not allow them to exit the directory.
M6: FTP Security
- Block the user
ssh3from accessing theftpserver but still allowsshaccess - Set the default file upload permissions to be
644 - Ensure that users in the
ftpgroup andreadandwriteoverftpto the/shared-ftpdirectory and that users not in theftpgroup cannot read or write overftpto the/shared-ftpdirectory
M7: Troubleshooting
To complete M7 P1-9 and M1-6 must have a green arrow before starting.
- The ftp server seems to have gone down. Let’s see if you can fix it.
Distinction Criteria
D1: SSH Installation and Configuration
- Allow the users
ssh3,blueteamandblackteamto ssh into the server - Allow the user
ssh4to ssh into the server but only from172.18.0.3
D2: Logging and Monitoring SSH Activity
- Use a tool to automatically block an IP after
5failed login attempts for10 minutes. - This will be graded manually by a TA
Submission
You don’t need to submit anything for this lab. All of the above criteria will be auto-graded unless stated otherwise. Once you have finished the lab you will have to do a verbal pass off with a TA.
Pass Off Questions
You will be asked two of these questions at random during your verbal pass-off.
- What is the purpose of SSH, and how does it enhance the security of remote connections?
- How does changing the default SSH port improve security, and what risks are associated with leaving it unchanged?
- Why is it beneficial to disable root login for SSH, and how does this impact server security?
- What are the advantages of using key-based authentication over password-based authentication in SSH?
- What are the benefits of restricting SSH access to specific IP addresses or user groups and the pros and cons of both approaches?
- Explain the process of generating SSH key pairs and how they facilitate secure remote connections.
- How would you manage SSH keys for multiple users on the same system, and why might this be necessary?
- What purpose does limiting failed login attempts serve in SSH, and how does it protect the server?
- Why is logging SSH activity essential, and what information can SSH logs provide for security monitoring?
- What are the advantages of monitoring SSH connections in real-time, especially in a high-security environment?
- What are common issues with SSH key-based authentication, and how would you troubleshoot them?
- What is FTP, and how does it differ from SSH in terms of function and security?
- How does restricting FTP users to their home directories improve security and privacy on a multi-user system.?
- What is the benefit of disabling anonymous FTP login, and what risks might anonymous access present?
- Why is SFTP recommended over standard FTP, and how does it improve data security?
- What are the key differences between active and passive FTP modes, and when would each be used?
Grading:
- Pass: All Pass criteria and verbal pass-off has been completed.
- Merit: All Pass and Merit criteria completed.
- Distinction: All Pass, Merit, and Distinction criteria completed.