|
| 1 | +Unit 2 Lab – Network Standards and |
| 2 | +Compliance |
| 3 | + |
| 4 | +Required Materials |
| 5 | + |
| 6 | +Putty or other connection tool Lab Server |
| 7 | +Root or sudo command access |
| 8 | +STIG Viewer 2.18 (download from https://public.cyber.mil/stigs/downloads/ ) |
| 9 | + |
| 10 | + |
| 11 | +EXERCISES (Warmup to quickly run through your system and familiarize yourself) |
| 12 | + |
| 13 | +1. sysctl -a | grep -i ipv4 | grep -i forward |
| 14 | + 1. Does this system appear to be set to forward? Why or why not? |
| 15 | +2. sysctl -a | grep -i ipv4 | grep -i martian |
| 16 | + 1. What are martians and is this system allowing them? |
| 17 | +3. sysctl -a | grep -i panic |
| 18 | + 1. How does this system handle panics? |
| 19 | +4. sysctl -a | grep -i crypto |
| 20 | + 1. What are the settings you see? Is FIPS enabled? |
| 21 | +5. cat /proc/cmdline |
| 22 | +6. fips-mode-setup --check |
| 23 | +7. sestatus |
| 24 | +8. cat /etc/selinux/config |
| 25 | + 1. What information about the security posture of the system can you see here? |
| 26 | + 1. Can you verify SELINUX status? |
| 27 | + 2. Can you verify FIPS status? |
| 28 | + |
| 29 | +PreLAB |
| 30 | + |
| 31 | +Download the STIG Viewer 2.18 from - https://public.cyber.mil/stigs/downloads/ |
| 32 | +Download the STIG for RHEL 9 and the import it into your STIG viewer |
| 33 | +Create a checklist from the opened STIG for RHEL 9 |
| 34 | + |
| 35 | +LAB |
| 36 | + |
| 37 | +This lab is designed to have the engineer practice securing a Linux server or service against a set of configuration standards. These standards are sometimes called benchmarks, checklists, or guidelines. The engineer will be using STIG Viewer 2.18 to complete this lab. |
| 38 | + |
| 39 | +Network Service configuration: |
| 40 | + |
| 41 | +1. Connect to a hammer server |
| 42 | +2. Filter by ipv4 and see how many STIGS you have. |
| 43 | +3. Examine STIG V-257957 |
| 44 | + 1. What is the problem? |
| 45 | + 2. What is the fix? |
| 46 | + 3. What type of control is being implemented? |
| 47 | +4. Is it set properly on your system? |
| 48 | + 1. sysctl -a | grep -i ipv4 | grep -i syncookies |
| 49 | + 2. Can you remediate this finding? |
| 50 | + |
| 51 | +In this case it’s already correctly set. |
| 52 | + |
| 53 | +But if we needed to, we would set that value in /etc/sysctl.d/00- remediate.conf |
| 54 | +And then reload sysctl with `sysctl --system` |
| 55 | + |
| 56 | +5. Check and remediate V-257958 STIG |
| 57 | + 1. What is the problem? |
| 58 | + 2. What is the fix? |
| 59 | + 3. What type of control is being implemented? |
| 60 | + 4. Is it set properly on your system? |
| 61 | + 5. How would you go about remediating this on your system? |
| 62 | + |
| 63 | +6. Check and remediate V-257960 and V-257961 STIGs |
| 64 | + 1. What is the problem? How are they related? |
| 65 | + 2. What is the fix? |
| 66 | + 3. What type of control is being implemented? |
| 67 | + 4. Is it set properly on your system? |
| 68 | +7. Filter by firewall |
| 69 | + 1. How many STIGS do you see? |
| 70 | + 2. What do these STIGS appear to be trying to do? What types of controls are they? |
| 71 | + |
| 72 | + |
| 73 | +Firewall port exposure |
| 74 | + |
| 75 | +Your team needs to use node_exporter with Prometheus to allow scraping of system information back to your network monitoring solution. You are running a firewall, so you need to expose the port that node_exporter runs on to the network outside of your system. |
| 76 | + |
| 77 | +7. Expose a network port through your firewall |
| 78 | + 1. Verify that your firewall is running systemctl status firewalld |
| 79 | + 2. Verify that your firewall has the service defined firewall-cmd --get-services | grep -i node |
| 80 | +ls /usr/lib/firewalld/services | grep -i node |
| 81 | + 3. Verify that the service is not currently enabled for node_exporter firewall-cmd --list-services |
| 82 | + 4. Examine the structure of the firewall .xml file |
| 83 | +cat /usr/lib/firewalld/services/prometheus-node-exporter.xml |
| 84 | + 5. Enable the service through your firewall |
| 85 | +firewall-cmd --permanent --add-service=prometheus-node-exporter firewall-cmd --reload |
| 86 | + 6. Verify that the service is currently enabled for node_exporter firewall-cmd --list-services |
| 87 | + |
| 88 | +Automate STIG remediation on a system |
| 89 | + |
| 90 | +There are many options and the STIG remediation steps are well known. Here the learner will examine a few ways to generate Ansible and Shell fixes to your system. Then one can apply all of them, or just |
| 91 | +some of them. This is the real value of a security engineer focused Linux engineer, the tradeoff between security and productivity. |
| 92 | + |
| 93 | +8. Download and extract a STIG remediation tool |
| 94 | + |
| 95 | +cd /root mkdir stigs cd stigs |
| 96 | +wget -O U_RHEL_9_V2R3_STIG_Ansible.zip https://dl.dod.cyber.mil/wp-content/uploads/stigs/zip/U_RHEL_9_V2R3_STIG_Ansible.zip |
| 97 | +unzip U_RHEL_9_V2R3_STIG_Ansible.zip |
| 98 | +mkdir ansible |
| 99 | +cp rhel9STIG-ansible.zip ansible/ |
| 100 | +cd ansible |
| 101 | +unzip rhel9STIG-ansible.zip |
| 102 | + |
| 103 | + |
| 104 | +9. Examine the default values for stigs |
| 105 | + |
| 106 | +vim /root/stigs/ansible/roles/rhel9STIG/defaults/main.yml |
| 107 | + |
| 108 | +Search for a few of the STIG numbers you used earlier and see their default values. |
| 109 | + #use /257784 to search |
| 110 | + |
| 111 | +10. Examine the playbook to see how those are applied in a running system. |
| 112 | + |
| 113 | +vim /root/stigs/ansible/roles/rhel9STIG/tasks/main.yml |
| 114 | + |
| 115 | +#use /257784 to search for the STIG from above and see how it is fixed in the playbook. |
| 116 | + |
| 117 | +11. Create an Ansible playbook from openscap. |
| 118 | + |
| 119 | +dnf -y install openscap-scanner openscap-utils openscap-scanner scap-security-guide |
| 120 | + |
| 121 | +#Generate the Ansible |
| 122 | +oscap xccdf generate fix --profile ospp --fix-type ansible /usr/share/xml/scap/ssg/content/ssg-rhel9-ds.xml > draft-disa-remediate.yml |
| 123 | + |
| 124 | +#Examine the file |
| 125 | +vim draft-disa-remediate.yml |
| 126 | + |
| 127 | +#Generate a BASH version |
| 128 | +oscap xccdf generate fix --profile ospp --fix-type bash /usr/share/xml/scap/ssg/content/ssg-rhel9-ds.xml > draft-disa-remediate.sh |
| 129 | + |
| 130 | +#Examine the file |
| 131 | +vim draf-disa-remediate.sh |
0 commit comments