Skip to content

Commit ba646d0

Browse files
committed
RELEASE 8.6
1 parent 78964b4 commit ba646d0

File tree

5 files changed

+243
-816
lines changed

5 files changed

+243
-816
lines changed

README.md

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,30 @@ OpenSSH and Cockpit are installed and running.
4242

4343
## Compliance
4444

45-
**The deployed system does not pass all ANSSI-BP-028-HIGH OpenSCAP tests**. The remaining tests rely on user configuration that varies on the user infrastructure and needs to pass successfully.
45+
**The deployed system does not pass all ANSSI-BP-028-HIGH OpenSCAP tests out of the box.**
4646

47-
An OpenSCAP report (HTML format) can be found at the root of the repository showing the system's compliance. However, it does show some false positives:
47+
An OpenSCAP report (HTML format) can be found at the root of the repository showing the system's compliance. You can recreate the report by running the following commands on a freshly installed system:
4848

49-
* **Ensure a dedicated group owns sudo (R57)**: FALSE POSITIVE. You can manually verify this rule with `ls -l /usr/bin | grep sudo`. The group *wheel* owns the binary.
49+
`# oscap xccdf eval --results results.xml --profile xccdf_org.ssgproject.content_profile_anssi_bp28_high /usr/share/xml/scap/ssg/content/ssg-almalinux8-ds-1.2.xml`
5050

51-
* **Explicit arguments in sudo specifications (R63)**: FALSE POSITIVE. As described in the report, false positives happen due to bad parsing of the sudoers file.
51+
`# oscap xccdf generate report results.xml > report.html`
5252

53-
* **Don't target root user in the sudoers file (R60)**: It is up to the user to configure this file to suit their needs.
53+
### False positives
5454

55-
* **Configure TLS for rsyslog remote logging (R43)**: It is up to the user to configure the TLS certificates to match their infrastructure.
55+
These checks are reported as failed, but should be reported as passing. This is due to issues with OpenSCAP.
56+
57+
* **Ensure a dedicated group owns sudo (R57)**: You can manually verify this rule with the following command: `ls -l /usr/bin | grep sudo`. The group *wheel* owns the binary.
58+
59+
* **IOMMU configuration directive (R11)**: You can manually verify iommu usage is enforced with the following command: `dmesg iommu=force`
60+
61+
### Depend on user configuration
62+
63+
The system requires configuration and secrets unique to the user's infrastructure for those checks to pass.
64+
65+
* **Explicit arguments in sudo specifications (R63)**: sudo configuration should be brought in by the user.
66+
67+
* **Don't target root user in the sudoers file (R60)**: sudo configuration should be brought in by the user.
68+
69+
* **Configure TLS for rsyslog remote logging (R43)**: It is up to the user to configure the rsyslog server to match their infrastructure.
5670

5771
* **Configure CA certificate for rsyslog remote logging (R43)**: It is up to the user to configure the TLS certificates to match their infrastructure.

build.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,11 @@ sed -i "s/%SCAP_ID_DATASTREAM%/${SCAP_ID_DATASTREAM}/g" ${PATH_KICKSTART_SCAP}
226226
sed -i "s/%SCAP_ID_XCCDF%/${SCAP_ID_XCCDF}/g" ${PATH_KICKSTART_SCAP}
227227
echo -e "${TEXT_SUCC} => Configured the OpenSCAP kickstart"
228228

229+
# Configure the hardening kickstart
230+
sed -i "s/%SCAP_PROFILE%/${SCAP_PROFILE}/g" ${PATH_KICKSTART_HARD}
231+
sed -i "s|%SCAP_CONTENT%|${SCAP_CONTENT}|g" ${PATH_KICKSTART_HARD}
232+
echo -e "${TEXT_SUCC} => Configured the hardening kickstart"
233+
229234
# Configure the partitioning kickstart
230235
sed -i "s/%TARGET_BLOCK_DEVICE%/${TARGET_BLOCK_DEVICE}/g" ${PATH_KICKSTART_PART}
231236
echo -e "${TEXT_SUCC} => Configured the partitioning kickstart"

kickstarts/hardening.ks

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
# Post-installation script
22
%post --erroronfail
33
4+
# Mount the EFI partition
5+
mount /boot/efi
6+
47
# ANSSI-BP-028 compliance not brought in by OpenSCAP
58
systemctl enable dnf-automatic.timer # Addresses ANSSI-BP-028-R08
69
echo 'kernel.modules_disabled = 1' > /etc/sysctl.d/ANSSI-BP-028-R24.conf # Addresses ANSSI-BP-028-R24
7-
chown root:wheel /usr/bin/sudo # Addresses ANSSI-BP-028-R57
10+
11+
# Addresses ANSSI-BP-028-R57
12+
groupadd wheel
13+
chown root:wheel /usr/bin/sudo
814
915
# Addresses ANSSI-BP-028-R67
1016
setsebool -P deny_execmem=on
@@ -17,13 +23,18 @@ setsebool -P ssh_sysadm_login=off
1723
# I can't believe this one-liner is making it in prod
1824
# Addresses ANSSI-BP-028-R17
1925
{python3 -c 'print("password_pbkdf2 root")' & python3 -c 'import string as s; import secrets as x; a=s.ascii_letters+s.digits; p="".join(x.choice(a) for i in range(64)); print(p + "\n" + p)' | grub2-mkpasswd-pbkdf2 | cut -d ' ' -f 7 | sed -r '/^\s*$/d'} | cat | tr '\n' ' ' >> /etc/grub.d/01_users
20-
grub2-mkconfig -o /boot/grub2/grub.cfg # And for BIOS
26+
grub2-mkconfig -o /boot/grub2/grub.cfg
2127
2228
# Addresses ANSSI-BP-028-R11
2329
grub2-editenv - set "$(grub2-editenv - list | grep kernelopts) iommu=force"
2430
2531
# Addresses ANSSI-BP-028-R36
26-
chmod 0600 /etc/ssh/*_key
32+
ssh-keygen -q -N "" -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key
33+
ssh-keygen -q -N "" -t ed25519 -f /etc/ssh/ssh_host_ed25519_key
34+
ssh-keygen -q -N "" -t rsa -b 4096 -f /etc/ssh/ssh_host_rsa_key
35+
chmod 0600 /etc/ssh/ssh_host_ecdsa_key
36+
chmod 0600 /etc/ssh/ssh_host_ed25519_key
37+
chmod 0600 /etc/ssh/ssh_host_rsa_key
2738
2839
# Disables automounting /boot/efi
2940
sed -i '/efi/ s/nodev/nodev,noauto/g' /etc/fstab
@@ -33,4 +44,11 @@ mkdir -p /etc/tmpfiles.d
3344
echo 'd /tmp/tmp-inst 0000 root root - -' > /etc/tmpfiles.d/anssi-bp-028-r39.conf
3445
echo '/tmp /tmp/tmp-inst/ level root,adm' >> /etc/security/namespace.conf
3546
47+
# Addresses ANSSI-BP-028-R18
48+
sed -i '/rounds=65536/ s/$/ remember=2/' /etc/pam.d/system-auth
49+
50+
# Extra remediation
51+
oscap xccdf eval --remediate --results res.xml --profile %SCAP_PROFILE% %SCAP_CONTENT%
52+
rm res.xml
53+
3654
%end

kickstarts/kickstart.ks

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ text
44
cdrom
55

66
# GRUB2 configuration
7-
bootloader --boot-drive=%TARGET_BLOCK_DEVICE% --timeout=0 --append="rhgb quiet crashkernel=256M"
7+
bootloader --boot-drive=%TARGET_BLOCK_DEVICE% --timeout=0 --append="rhgb quiet crashkernel=256M iommu=force"
88

99
# Automatically accept EULA
1010
eula --agreed

report.html

Lines changed: 196 additions & 806 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)