Skip to content

Commit 3d98cbf

Browse files
authored
add testing and support for current versions of Fedora and FreeBSD (#709)
* add testing and support for current versions of Fedora and FreeBSD Signed-off-by: Martin Schurz <[email protected]> * add waivers for FreeBSD Signed-off-by: Martin Schurz <[email protected]> * use original fedora images Signed-off-by: Martin Schurz <[email protected]> * also harden /home mount Signed-off-by: Martin Schurz <[email protected]> * also harden /tmp mount Signed-off-by: Martin Schurz <[email protected]> * test mock efi directory Signed-off-by: Martin Schurz <[email protected]> * remove mock Signed-off-by: Martin Schurz <[email protected]> * umount efi Signed-off-by: Martin Schurz <[email protected]> * add /tmp to special mountpoints Signed-off-by: Martin Schurz <[email protected]> * set options for /tmp mount Signed-off-by: Martin Schurz <[email protected]> * create /tmp mount Signed-off-by: Martin Schurz <[email protected]> * create /tmp mount and mount it ... Signed-off-by: Martin Schurz <[email protected]> * make fewer changes to default test run Signed-off-by: Martin Schurz <[email protected]> * use correct Ansible var Signed-off-by: Martin Schurz <[email protected]> --------- Signed-off-by: Martin Schurz <[email protected]>
1 parent 4a5a6e1 commit 3d98cbf

File tree

12 files changed

+43
-20
lines changed

12 files changed

+43
-20
lines changed

.github/workflows/os_hardening.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ jobs:
3939
- centosstream9
4040
- rocky8
4141
- rocky9
42-
- fedora37
4342
- fedora38
43+
- fedora39
4444
- ubuntu1804
4545
- ubuntu2004
4646
- ubuntu2204

.github/workflows/os_hardening_vm.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,21 @@ jobs:
3434
fail-fast: false
3535
matrix:
3636
molecule_distro:
37-
- centos7
38-
- centos8s
39-
- centos9s
40-
- rocky8
41-
- rocky9
42-
- fedora37
43-
- fedora38
44-
- ubuntu1804
45-
- ubuntu2004
46-
- ubuntu2204
47-
- debian10
48-
- debian11
49-
- debian12
50-
- opensuse15
51-
# - arch # needs fix for audit
37+
- generic/centos7
38+
- generic/centos8s
39+
- generic/centos9s
40+
- generic/rocky8
41+
- generic/rocky9
42+
- fedora/38-cloud-base
43+
- fedora/39-cloud-base
44+
- generic/ubuntu1804
45+
- generic/ubuntu2004
46+
- generic/ubuntu2204
47+
- generic/debian10
48+
- generic/debian11
49+
- generic/debian12
50+
- generic/opensuse15
51+
# - generic/arch # needs fix for audit
5252
steps:
5353
- name: Checkout repo
5454
uses: actions/checkout@v4

.github/workflows/ssh_hardening.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ jobs:
3939
- centosstream9
4040
- rocky8
4141
- rocky9
42-
- fedora37
4342
- fedora38
43+
- fedora39
4444
- ubuntu1804
4545
- ubuntu2004
4646
- ubuntu2204

.github/workflows/ssh_hardening_bsd.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ jobs:
3636
molecule_distro:
3737
- openbsd7
3838
- freebsd12
39+
- freebsd13
40+
- freebsd14
3941
steps:
4042
- name: Checkout repo
4143
uses: actions/checkout@v4

.github/workflows/ssh_hardening_custom_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ jobs:
3939
- centosstream9
4040
- rocky8
4141
- rocky9
42-
- fedora37
4342
- fedora38
43+
- fedora39
4444
- ubuntu1804
4545
- ubuntu2004
4646
- ubuntu2204

molecule/os_hardening_vm/converge.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,18 @@
1313
set_fact:
1414
os_mnt_boot_enabled: false
1515
when: ansible_facts.os_family == 'Archlinux'
16+
- name: overrides for Fedora image
17+
set_fact:
18+
os_mnt_tmp_enabled: true
19+
os_mnt_tmp_src: "tmpfs"
20+
os_mnt_tmp_filesystem: "tmpfs"
21+
when: ansible_facts.distribution == 'Fedora'
1622
- include_role:
1723
name: os_hardening
1824
vars:
1925
os_auth_pam_passwdqc_enable: false
2026
os_auth_lockout_time: 15
2127
os_yum_repo_file_whitelist: ['foo.repo']
2228
os_mnt_boot_enabled: true
29+
os_mnt_home_enabled: true
2330
os_mnt_boot_src: "/dev/vda1"

molecule/os_hardening_vm/molecule.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ platforms:
1212
# since we also need to use different OS users to run the tests because of how molecule operates,
1313
# the VM names must be predictable by OS user (to clean up canceled runs)
1414
- name: "${USER}"
15-
box: "generic/${MOLECULE_DISTRO}"
15+
box: "${MOLECULE_DISTRO}"
1616
memory: 1024
1717
cpus: 2
1818
provisioner:

molecule/os_hardening_vm/prepare.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@
5151
shell: "rm -f /usr/bin/zzz && ln -s /usr/bin /usr/bin/zzz"
5252
changed_when: false
5353

54+
- name: Unmount EFI partition to get rid of vfat filesystem (qemu has no firmware image that inspec can detect)
55+
ansible.posix.mount:
56+
path: /boot/efi
57+
state: unmounted
58+
when: ansible_facts.distribution == 'Fedora'
59+
5460
- name: include YUM prepare tasks
5561
include_tasks: prepare_tasks/yum.yml
5662
when: ansible_facts.os_family == 'RedHat'
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
sshd-45:
2+
run: false
3+
justification: "PrintLastLog is broken on FreeBSD. see: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=209441"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
sshd-45:
2+
run: false
3+
justification: "PrintLastLog is broken on FreeBSD. see: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=209441"

roles/os_hardening/tasks/minimize_access.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393

9494
- name: Append special devices list to valid mountpoint list
9595
ansible.builtin.set_fact:
96-
mountpoints_list: "{{ mountpoints_list + ['/dev', '/dev/shm', '/run'] }}"
96+
mountpoints_list: "{{ mountpoints_list + ['/dev', '/dev/shm', '/run', '/tmp'] }}"
9797

9898
- name: Minimize access for filesystems
9999
ansible.builtin.include_tasks: minimize_access_fs.yml

roles/ssh_hardening/meta/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ galaxy_info:
2727
- name: FreeBSD
2828
versions:
2929
- "12.2"
30+
- "13.2"
31+
- "14.0"
3032
- name: OpenBSD
3133
versions:
3234
- "7.0"

0 commit comments

Comments
 (0)