Linux+ Objective 2.1 Labs
Linux+ Objective 2.1 Labs
1 LABS
Scenario: You work as a system administrator for a small IT company that provides web hosting
services to clients. Your company uses a Linux server to host client websites and you've been
tasked with hardening the server to improve security.
Activities:
1. Disable unused services: Review the running services and disable any that are not
necessary. This will help reduce the attack surface of the server.
2. Enable a rewall: Set up a rewall to restrict incoming and outgoing traf c based on your
company's network security policies.
3. Update the system: Install any available security updates to ensure the latest patches are
applied and vulnerabilities are mitigated.
4. Con gure logging: Set up logging to track system activity, including authentication and
authorization attempts, as well as any potential security incidents.
5. Secure user accounts: Create strong passwords for all user accounts, disable any
unnecessary accounts, and con gure password policies to enforce password complexity
and expiration.
Lab:
Install the ufw rewall using the command sudo apt-get install ufw.
1.
Run the command sudo ufw default deny incoming to deny all incoming
2.
traf c by default.
3. Allow incoming traf c on port 80 for HTTP using the command sudo ufw allow
80/tcp.
4. Allow incoming traf c on port 443 for HTTPS using the command sudo ufw
allow 443/tcp.
5. Run the command sudo ufw enable to enable the rewall.
Task 3: Update the System
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
1. Run the command sudo apt-get update to update the package lists.
2. Run the command sudo apt-get upgrade to install available updates.
3. Run the command sudo apt-get autoremove to remove any unused packages.
Task 4: Con gure Logging
1. Create a strong password for all user accounts using the command sudo passwd
<username>. Replace <username> with the username of the user account you
want to update. For example, to update the password for user "john", you would run the
command sudo passwd john. Follow the prompts to set a strong and secure
password.
Scenario: You are working as a system administrator for a company that is implementing stricter
security measures for its Linux servers. You have been tasked with con guring the authentication
system to ensure only authorized users can access the servers. You will also set up multifactor
authentication and implement single sign-on (SSO) for easier user management.
1. Launch a Linux server instance (e.g. Amazon Linux 2) on your preferred cloud provider
(e.g. AWS).
2. Connect to the instance using SSH.
3. Update the system packages by running the command: sudo yum update -y.
4. Install the required packages for authentication by running the command: sudo yum
install -y pam pam-devel pam_pkcs11 opensc.
Task 2: Con gure PAM for Password Authentication
1. Open the PAM con guration le for password authentication by running the command:
sudo vi /etc/pam.d/password-auth.
2. Add the following line to the top of the le: auth required pam_env.so.
3. Add the following line to the end of the le: auth suf cient pam_unix.so nullok
try_ rst_pass.
4. Save and exit the le.
5. Open the PAM con guration le for system authentication by running the command:
sudo vi /etc/pam.d/system-auth.
6. Add the following line to the top of the le: auth required pam_env.so.
7. Add the following line to the end of the le: auth suf cient pam_unix.so nullok
try_ rst_pass.
8. Save and exit the le.
Task 3: Con gure PAM for Multifactor Authentication
1. Install the Google Authenticator package by running the command: sudo yum install -y
google-authenticator.
2. Run the Google Authenticator setup wizard by running the command: google-
authenticator.
3. Answer "y" to all of the wizard's questions to enable multifactor authentication.
4. Con gure PAM to use Google Authenticator for authentication by running the command:
sudo vi /etc/pam.d/sshd.
5. Add the following line to the top of the le: auth required pam_google_authenticator.so.
6. Save and exit the le.
Task 4: Con gure LDAP Authentication
1. Install the OpenLDAP package by running the command: sudo yum install -y openldap
openldap-clients nss-pam-ldapd.
2. Con gure the LDAP client by running the command: sudo authcon g-tui.
3. Select "Use LDAP" and enter the LDAP server details.
4. Select "Use LDAP Authentication" and enter the LDAP authentication details.
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
5. Save the con guration and exit the tool.
6. Test the LDAP authentication by running the command: getent passwd <ldap_username>.
sudo vi /etc/sssd/sssd.conf
Add the following lines to the [sssd] section of the le:
config_file_version = 2
services = nss, pam
domains = LDAP
id_provider = ldap
auth_provider = ldap
ldap_uri = ldap://<ldap_server_address>
ldap_search_base = <ldap_search_base>
ldap_tls_reqcert = allow
Add the LDAP administrator's username and password to the SSSD con guration le by adding
the following lines to the [domain/LDAP] section of the le:
ldap_default_bind_dn = <ldap_admin_username>
ldap_default_authtok_type = password
ldap_default_authtok = <ldap_admin_password>
The output should include the LDAP server address, search base, and other con guration details.
Lab 3: Certi cates Use Cases and Managing Public Key Infrastructure Certi cates
***You will need.a static Public IP to use. Create an amazon Elastic IP and assign it to your
AWS instance. This is an IP that will always be associated with your server even if you turn
the server off and back on. If you do not use an elastic IP, if you ever have to turn off your
server, it will get a different public IP when you turn it on again.
Assign the elastic IP and tell me what the public IP address is so I can associate that IP to a
domain name you can use for this lab.****
Scenario: You work as a system administrator for a company that provides online services. The
company has a web server that requires HTTPS communication to secure its clients' con dential
information. The server requires a valid SSL/TLS certi cate issued by a trusted Certi cate
Authority (CA).
NOTE: There should be two certi cates in this lab. One is a “self-signed” certi cate that anyone
can make but is not as trusted for a website. Then there is a “third party signed” certi cate you
get from an outside company that you can apply to your web server. By the time you nish this
lab you should have experience applying and then testing both.
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
Task 1: Create a Web Server on Amazon Linux
1. Edit the Apache SSL/TLS con guration le using the command: sudo vi /etc/
httpd/conf.d/ssl.conf.
2. Update the SSLCerti cateFile directive to point to the path of the self-signed certi cate
generated in Task 2: SSLCertificateFile /etc/pki/tls/certs/
myserver.crt.
3. Update the SSLCerti cateKeyFile directive to point to the path of the private key
generated in Task 2: SSLCertificateKeyFile /etc/pki/tls/
private/myserver.key.
4. Save and exit the le.
5. Restart the Apache web server using the command: sudo service httpd
restart.
1. Create a new le called index.html in the /var/www/html directory using the command:
sudo vi /var/www/html/index.html.
2. Add the text "Hello, world!" to the le.
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
3. Save and exit the le.
1. Open a web browser and enter your website's URL with "https://" at the beginning.
2. Ensure that the website loads correctly and that the SSL/TLS certi cate is valid and
issued by a trusted CA.
3. Verify that the "Hello, world!" text appears on the page.
Task 6:
4. Verify the authenticity of the certi cate using the openssl verify command. In the
terminal, navigate to the directory where you copied the certi cate (~/Downloads in
this example). Then enter the following command:
5. Verify that the output shows "myserver.crt: OK". This indicates that the certi cate is valid
and has been issued by a trusted CA.
6. Open a web browser and enter the URL of your website with "https://" at the beginning.
7. Ensure that the website loads correctly and that the SSL/TLS certi cate is valid and
issued by a trusted CA.
8. Verify that the "Hello, world!" text appears on the page.
Task 7: Con gure Apache to use the valid certi cate and enable HTTPS
1. Copy the SSL/TLS certi cate les from the trusted CA to the Amazon Linux instance.
You will typically receive these les in an email or through the CA's website.
2. Move the certi cate les to the appropriate directory using the following commands:
3. Con gure Apache to use the valid certi cate by editing the SSL con guration le with
the command:
sudo vi /etc/httpd/conf.d/ssl.conf
4. In the SSL con guration le, locate the SSLCerti cateFile and SSLCerti cateKeyFile
directives, and update their values with the paths to the certi cate and private key les,
respectively.
SSLCertificateFile /etc/pki/tls/certs/<certificate_file>
SSLCertificateKeyFile /etc/pki/tls/private/
<private_key_file>
Task 8: Test the website to ensure that it loads correctly and that the SSL/TLS certi cate is valid
and issued by a trusted CA.
1. Open a web browser and enter your website's URL with "https://" at the beginning.
2. Ensure that the website loads correctly and that the SSL/TLS certi cate is valid and
issued by a trusted CA.
4. Look for the "Verify return code" section in the output. If the code is "0 (ok)", then the
certi cate is valid and issued by a trusted CA.