Damcava35/set version (#257)

* feat: add "--set-version" option

This feature will allow to chose a specific cis version to run, like debian 11 or debian 12

* chore: configure current repository as a version

And use it as default version.

To this end, the scripts in bin/hardening have been made generic by removing the associated recommendation number.
Only impact is if you are used to execute scripts directly from bin/hardening.
In this case, please use the "bin/hardening.sh" wrapper as intended.

I had to rename 2.3.1_disable_nis.sh to uninstall_nis.sh, as it was conflicting with 2.3.1_disable_nis.sh

Also, there was a doublon between 1.1.1.8_disable_cramfs.sh and 99.1.1.1_disable_cramfs.sh ; the former was kept

* chore: remove CIS recommendation numbers from bin/hardening scripts

* fix: some tests are failing

find_ungrouped_files.sh and find_unowned_files.sh tests can not be executed multiple times:
- test repository is not cleaned
- configuration is updated multiple times

Those tests are also failing, because:
- the sed to change the status in the configuration was also changing the test folder path.
- missing /proc in EXCLUDED paths
- the EXCLUDED configuration doesn't have the correct format for egrep

---------

Co-authored-by: Damien Cavagnini <damien.cavagnini@corp.ovh.com>
This commit is contained in:
damcav35
2025-07-01 08:41:55 +02:00
committed by GitHub
parent 99bc575714
commit be33848d81
734 changed files with 557 additions and 339 deletions

8
versions/README.md Normal file
View File

@ -0,0 +1,8 @@
Here, we'll add some folders to represent a specific CIS version to use.
Each folder will contains links to adequat scripts
Ex:
debian12/
1.1.1.1_disable_cramfs.sh ->../../bin/hardening/disable_cramfs.sh
1.1.1.2_disable_freevxfs.sh ->../../bin/hardening/disable_freevxfs.sh
etc.

1
versions/default Symbolic link
View File

@ -0,0 +1 @@
ovh_legacy/

View File

@ -0,0 +1 @@
../../bin/hardening/disable_freevxfs.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_jffs2.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_hfs.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_hfsplus.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_squashfs.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_udf.sh

View File

@ -0,0 +1 @@
../../bin/hardening/restrict_fat.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_cramfs.sh

View File

@ -0,0 +1 @@
../../bin/hardening/var_tmp_noexec.sh

View File

@ -0,0 +1 @@
../../bin/hardening/var_log_noexec.sh

View File

@ -0,0 +1 @@
../../bin/hardening/var_log_nosuid.sh

View File

@ -0,0 +1 @@
../../bin/hardening/var_log_nodev.sh

View File

@ -0,0 +1 @@
../../bin/hardening/var_log_partition.sh

View File

@ -0,0 +1 @@
../../bin/hardening/var_log_audit_noexec.sh

View File

@ -0,0 +1 @@
../../bin/hardening/var_log_audit_nosuid.sh

View File

@ -0,0 +1 @@
../../bin/hardening/var_log_audit_nodev.sh

View File

@ -0,0 +1 @@
../../bin/hardening/var_log_audit_partition.sh

View File

@ -0,0 +1 @@
../../bin/hardening/home_partition.sh

View File

@ -0,0 +1 @@
../../bin/hardening/home_nosuid.sh

View File

@ -0,0 +1 @@
../../bin/hardening/home_nodev.sh

View File

@ -0,0 +1 @@
../../bin/hardening/run_shm_nodev.sh

View File

@ -0,0 +1 @@
../../bin/hardening/run_shm_nosuid.sh

View File

@ -0,0 +1 @@
../../bin/hardening/run_shm_noexec.sh

View File

@ -0,0 +1 @@
../../bin/hardening/removable_device_nodev.sh

View File

@ -0,0 +1 @@
../../bin/hardening/removable_device_nosuid.sh

View File

@ -0,0 +1 @@
../../bin/hardening/removable_device_noexec.sh

View File

@ -0,0 +1 @@
../../bin/hardening/sticky_bit_world_writable_folder.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_automounting.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_usb_storage.sh

View File

@ -0,0 +1 @@
../../bin/hardening/tmp_partition.sh

View File

@ -0,0 +1 @@
../../bin/hardening/tmp_nodev.sh

View File

@ -0,0 +1 @@
../../bin/hardening/tmp_nosuid.sh

View File

@ -0,0 +1 @@
../../bin/hardening/tmp_noexec.sh

View File

@ -0,0 +1 @@
../../bin/hardening/var_nodev.sh

View File

@ -0,0 +1 @@
../../bin/hardening/var_nosuid.sh

View File

@ -0,0 +1 @@
../../bin/hardening/var_partition.sh

View File

@ -0,0 +1 @@
../../bin/hardening/var_tmp_partition.sh

View File

@ -0,0 +1 @@
../../bin/hardening/var_tmp_nodev.sh

View File

@ -0,0 +1 @@
../../bin/hardening/var_tmp_nosuid.sh

View File

@ -0,0 +1 @@
../../bin/hardening/install_sudo.sh

View File

@ -0,0 +1 @@
../../bin/hardening/pty_sudo.sh

View File

@ -0,0 +1 @@
../../bin/hardening/logfile_sudo.sh

View File

@ -0,0 +1 @@
../../bin/hardening/install_tripwire.sh

View File

@ -0,0 +1 @@
../../bin/hardening/tripwire_cron.sh

View File

@ -0,0 +1 @@
../../bin/hardening/bootloader_ownership.sh

View File

@ -0,0 +1 @@
../../bin/hardening/bootloader_password.sh

View File

@ -0,0 +1 @@
../../bin/hardening/root_password.sh

View File

@ -0,0 +1 @@
../../bin/hardening/enable_nx_support.sh

View File

@ -0,0 +1 @@
../../bin/hardening/enable_randomized_vm_placement.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_apport.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_prelink.sh

View File

@ -0,0 +1 @@
../../bin/hardening/restrict_core_dumps.sh

View File

@ -0,0 +1 @@
../../bin/hardening/install_apparmor.sh

View File

@ -0,0 +1 @@
../../bin/hardening/enable_apparmor.sh

View File

@ -0,0 +1 @@
../../bin/hardening/enforce_or_complain_apparmor.sh

View File

@ -0,0 +1 @@
../../bin/hardening/enforcing_apparmor.sh

View File

@ -0,0 +1 @@
../../bin/hardening/remove_os_info_motd.sh

View File

@ -0,0 +1 @@
../../bin/hardening/remove_os_info_issue.sh

View File

@ -0,0 +1 @@
../../bin/hardening/remove_os_info_issue_net.sh

View File

@ -0,0 +1 @@
../../bin/hardening/motd_perms.sh

View File

@ -0,0 +1 @@
../../bin/hardening/etc_issue_perms.sh

View File

@ -0,0 +1 @@
../../bin/hardening/etc_issue_net_perms.sh

View File

@ -0,0 +1 @@
../../bin/hardening/graphical_warning_banners.sh

View File

@ -0,0 +1 @@
../../bin/hardening/install_updates.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_xinetd.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_bsd_inetd.sh

View File

@ -0,0 +1 @@
../../bin/hardening/use_time_sync.sh

View File

@ -0,0 +1 @@
../../bin/hardening/configure_systemd-timesyncd.sh

View File

@ -0,0 +1 @@
../../bin/hardening/configure_chrony.sh

View File

@ -0,0 +1 @@
../../bin/hardening/configure_ntp.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_http_server.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_imap_pop.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_samba.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_http_proxy.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_snmp_server.sh

View File

@ -0,0 +1 @@
../../bin/hardening/mta_localhost.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_rsync.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_nis.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_xwindow_system.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_avahi_server.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_print_server.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_dhcp.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_ldap.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_nfs_rpc.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_dns_server.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_ftp.sh

View File

@ -0,0 +1 @@
../../bin/hardening/uninstall_nis.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_rsh_client.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_talk_client.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_telnet_client.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_ldap_client.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_ipv6.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_wireless.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_send_packet_redirects.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_ip_forwarding.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_source_routed_packets.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_icmp_redirect.sh

View File

@ -0,0 +1 @@
../../bin/hardening/disable_secure_icmp_redirect.sh

Some files were not shown because too many files have changed in this diff Show More