Compare commits

...

112 Commits

Author SHA1 Message Date
9c3aa51982 Update changelog 2020-11-30 15:16:36 +01:00
b994ca11a7 FIX(main): fix small bug in main
The bug (introduced in 2.1-2) leaded to an error in the test that evaluates forcedstatus
2020-11-30 15:10:39 +01:00
f4e0aafacc IMP(5.2.3): fix possible permissions for 5.2.3 2020-11-30 14:27:20 +01:00
d40a85085d FIX: fix issue, we had to run audit twice
First one as root to create conf files with good owner and permissions, and then with secaudit.
Now first run with --create-config-files-only and the normally with --audit.
2020-11-20 10:05:14 +01:00
467e5f178c fixup! IMP(4.5): rename to 1.6.1.2 improve test 2020-11-17 13:02:02 +01:00
d244a2e810 fixup! IMP(4.5): rename to 1.6.1.2 improve test 2020-11-17 12:56:10 +01:00
84bff4ac88 fixup! Move to most recent docker image for buster 2020-11-16 17:07:08 +01:00
d640a467e2 fixup! IMP(4.1.x): add tests for each checks 2020-11-16 16:54:51 +01:00
9bfb7efca1 Update changelog 2020-11-16 16:39:47 +01:00
7b8cca20d6 FIX(4.1.1.2): fix auditd apply 2020-11-09 11:48:48 +01:00
a6de243808 Rename 6.1.2,6.1.3,6.1.4 to be CIS9 compliant 2020-11-09 09:00:34 +01:00
7e8c976722 Add disclaimer when checks don't require comprehensive checks
modified:   tests/hardening/1.1.1.1_disable_freevxfs.sh
	modified:   tests/hardening/1.1.1.2_disable_jffs2.sh
	modified:   tests/hardening/1.1.1.3_disable_hfs.sh
	modified:   tests/hardening/1.1.1.4_disable_hfsplus.sh
	modified:   tests/hardening/1.1.1.5_disable_udf.sh
	modified:   tests/hardening/1.1.1.6_disable_cramfs.sh
	modified:   tests/hardening/1.1.1.7_disable_squashfs.sh
	modified:   tests/hardening/1.1.10_var_tmp_noexec.sh
	modified:   tests/hardening/1.1.11_var_log_partition.sh
	modified:   tests/hardening/1.1.12_var_log_audit_partition.sh
	modified:   tests/hardening/1.1.13_home_partition.sh
	modified:   tests/hardening/1.1.14_home_nodev.sh
	modified:   tests/hardening/1.1.18_removable_device_nodev.sh
	modified:   tests/hardening/1.1.19_removable_device_nosuid.sh
	modified:   tests/hardening/1.1.20_removable_device_noexec.sh
	modified:   tests/hardening/1.1.2_tmp_partition.sh
	modified:   tests/hardening/1.1.3_tmp_nodev.sh
	modified:   tests/hardening/1.1.4_tmp_nosuid.sh
	modified:   tests/hardening/1.1.5_tmp_noexec.sh
	modified:   tests/hardening/1.1.6_var_partition.sh
	modified:   tests/hardening/1.1.7_var_tmp_partition.sh
	modified:   tests/hardening/1.1.8_var_tmp_nodev.sh
	modified:   tests/hardening/1.1.9_var_tmp_nosuid.sh
	modified:   tests/hardening/1.8_install_updates.sh
	modified:   tests/hardening/2.2.10_disable_http_server.sh
	modified:   tests/hardening/2.2.11_disable_imap_pop.sh
	modified:   tests/hardening/2.2.12_disable_samba.sh
	modified:   tests/hardening/2.2.13_disable_http_proxy.sh
	modified:   tests/hardening/2.2.14_disable_snmp_server.sh
	modified:   tests/hardening/2.2.2_disable_xwindow_system.sh
	modified:   tests/hardening/2.2.3_disable_avahi_server.sh
	modified:   tests/hardening/2.2.4_disable_print_server.sh
	modified:   tests/hardening/2.2.5_disable_dhcp.sh
	modified:   tests/hardening/2.2.6_disable_ldap.sh
	modified:   tests/hardening/2.2.7_disable_nfs_rpc.sh
	modified:   tests/hardening/2.2.8_disable_dns_server.sh
	modified:   tests/hardening/2.2.9_disable_ftp.sh
	modified:   tests/hardening/2.3.1_disable_nis.sh
	modified:   tests/hardening/2.3.2_disable_rsh_client.sh
	modified:   tests/hardening/2.3.3_disable_talk_client.sh
	modified:   tests/hardening/2.3.4_telnet_client_not_installed.sh
	modified:   tests/hardening/2.3.5_ldap_client_not_installed.sh
2020-11-06 16:20:10 +01:00
ffd5b28840 FIX: fix apt autoremove to be non interactive
modified:   bin/hardening/2.2.10_disable_http_server.sh
	modified:   bin/hardening/2.2.11_disable_imap_pop.sh
	modified:   bin/hardening/2.2.12_disable_samba.sh
	modified:   bin/hardening/2.2.14_disable_snmp_server.sh
	modified:   bin/hardening/2.2.2_disable_xwindow_system.sh
	modified:   bin/hardening/2.2.3_disable_avahi_server.sh
	modified:   bin/hardening/2.2.4_disable_print_server.sh
	modified:   bin/hardening/2.2.5_disable_dhcp.sh
	modified:   bin/hardening/2.2.6_disable_ldap.sh
	modified:   bin/hardening/2.2.7_disable_nfs_rpc.sh
	modified:   bin/hardening/2.2.8_disable_dns_server.sh
	modified:   bin/hardening/2.2.9_disable_ftp.sh
	modified:   bin/hardening/2.3.1_disable_nis.sh
	modified:   bin/hardening/2.3.2_disable_rsh_client.sh
	modified:   bin/hardening/2.3.3_disable_talk_client.sh
	modified:   bin/hardening/2.3.4_telnet_client_not_installed.sh
	modified:   bin/hardening/2.3.5_ldap_client_not_installed.sh
2020-11-06 14:51:26 +01:00
ce1e87b1a3 IMP(4.5): rename to 1.6.1.2 improve test 2020-11-06 11:09:22 +01:00
b5865947ba Move to most recent docker image for buster 2020-11-06 10:11:46 +01:00
ee4b2417c2 IMP(4.1.x): add tests for each checks 2020-11-02 15:47:27 +01:00
5568065c35 IMP(4.1.3): skip on docker (bootloader) 2020-11-02 15:46:45 +01:00
91a2824246 IMP(5.6): add test 2020-10-30 09:48:36 +01:00
47f8b7b677 IMP(5.4.4): add test 2020-10-30 09:48:27 +01:00
728011f846 IMP(5.4.3): add purposely failing test 2020-10-30 09:40:28 +01:00
17e43753b9 IMP(5.4.1.1-3): add tests and rename some variables 2020-10-30 09:39:42 +01:00
9aac4c3504 IMP(5.3.4): improve check 2020-10-29 16:47:34 +01:00
8af91dd6a8 IMP(5.3.1,5.3.2): add tests and upgrade PAM conf 2020-10-29 16:45:15 +01:00
feefee28e4 IMP(5.3.1): add test and config function for check 2020-10-29 15:35:56 +01:00
774af39a34 IMP(5.2.x): add tests and default_config
I added tests from 5.2.4 to 5.2.19 and default_config files in the
checks. This checks concern sshd conf (ciphers, mac, rootlogin, ...)

	modifié :         bin/hardening/5.2.4_sshd_protocol.sh
	modifié :         bin/hardening/5.2.6_disable_x11_forwarding.sh
	modifié :         bin/hardening/5.2.7_sshd_maxauthtries.sh
	modifié :         bin/hardening/5.2.8_enable_sshd_ignorerhosts.sh
	modifié :         bin/hardening/5.2.9_disable_sshd_hostbasedauthentication.sh
	modifié :         bin/hardening/5.2.10_disable_root_login.sh
	modifié :         bin/hardening/5.2.11_disable_sshd_permitemptypasswords.sh
	modifié :         bin/hardening/5.2.12_disable_sshd_setenv.sh
	modifié :         bin/hardening/5.2.13_sshd_ciphers.sh
	modifié :         bin/hardening/5.2.16_sshd_idle_timeout.sh
	modifié :         bin/hardening/5.2.17_sshd_login_grace_time.sh
	modifié :         tests/hardening/5.2.4_sshd_protocol.sh
	modifié :         tests/hardening/5.2.5_sshd_loglevel.sh
	modifié :         tests/hardening/5.2.6_disable_x11_forwarding.sh
	modifié :         tests/hardening/5.2.7_sshd_maxauthtries.sh
	modifié :         tests/hardening/5.2.8_enable_sshd_ignorerhosts.sh
	modifié :         tests/hardening/5.2.9_disable_sshd_hostbasedauthentication.sh
	modifié :         tests/hardening/5.2.10_disable_root_login.sh
	modifié :         tests/hardening/5.2.11_disable_sshd_permitemptypasswords.sh
	modifié :         tests/hardening/5.2.12_disable_sshd_setenv.sh
	modifié :         tests/hardening/5.2.13_sshd_ciphers.sh
	modifié :         tests/hardening/5.2.16_sshd_idle_timeout.sh
	modifié :         tests/hardening/5.2.17_sshd_login_grace_time.sh
	modifié :         tests/hardening/5.2.18_sshd_limit_access.sh
	modifié :         tests/hardening/5.2.19_ssh_banner.sh
2020-10-29 11:18:31 +01:00
e288835381 Update changelog 2020-11-16 14:21:47 +01:00
fbd26ceefa Fix race condition on /etc/passwd, /etc/shadow and /etc/group 2020-11-16 14:09:12 +01:00
501ce8c651 IMP(5.2.3): 640 permission is now ok for the check 2020-11-16 14:08:42 +01:00
829ee8631f Revert to previous check (8.2.4 in old num) 2020-11-16 14:06:39 +01:00
6620a82f34 Update changelog 2020-11-12 10:17:32 +01:00
3c7a03445c FIX(3.1.1): fix unbound variable issue 2020-11-12 10:15:41 +01:00
03c8e25ff3 FIX(99.5.4): fix test (permission denied on authorized_keys) 2020-11-05 15:05:12 +01:00
7b73eac6d6 FIX: fix test for CDS 2020-11-05 14:24:57 +01:00
67649ec407 IMP: dismiss for count some tests on blank host 2020-11-05 12:06:14 +01:00
a7afb1099a IMP(6.2.8): fix bug where /sbin/nologin was considered as a valid shell 2020-11-05 11:25:52 +01:00
fe568561bf IMP: Better cleanup after tests 2020-11-05 10:13:14 +01:00
4dc8701132 Update changelog 2020-10-30 16:43:48 +01:00
6aae84f4b2 FIX(2.3.18): Re-add telnet server check
Renaming for 2.3.4 anbd 2.3.5 to have naming consistency.

	nouveau fichier : bin/hardening/2.2.18_disable_telnet_server.sh
	renommé :         bin/hardening/2.3.4_telnet_client_not_installed.sh -> bin/hardening/2.3.4_disable_telnet_client.sh
	renommé :         bin/hardening/2.3.5_ldap_client_not_installed.sh -> bin/hardening/2.3.5_disable_ldap_client.sh
	renommé :         tests/hardening/2.3.4_telnet_client_not_installed.sh -> tests/hardening/2.2.18_disable_telnet_server.sh
	renommé :         tests/hardening/2.3.5_ldap_client_not_installed.sh -> tests/hardening/2.3.4_disable_telnet_client.sh
	nouveau fichier : tests/hardening/2.3.5_disable_ldap_client.sh
2020-11-03 09:38:13 +01:00
668dc80bb8 FIX(3.1.1,3.2.1,3.2.2): don't check for IPv6 options if IPv6 is disabled 2020-11-02 17:16:11 +01:00
c2090b74b3 FIX(2.2.12): smbd enabling check was wrong 2020-11-02 16:53:04 +01:00
26c119c4a1 ADD(3.2.7): add check mysteriously deleted during renaming 2020-10-30 16:09:25 +01:00
aff5d708e8 ADD(3.2.6): add check mysteriously deleted during renaming 2020-10-30 16:09:21 +01:00
b266982a3c ADD(6.2.7): add check mysteriously deleted during renaming 2020-10-30 16:01:18 +01:00
a0b025deac Fix final printf command
The final printf bugs on non US system.
A fix is to truncate the percentage to 2 decimals with bc and not with
printf.
	modifié :         bin/hardening.sh
2020-10-30 14:56:27 +01:00
ccef85ebe3 IMP(4.2.4): use functions in utils 2020-10-30 14:49:16 +01:00
258da6b4a1 CLEAN(4.2.2): delete 4.2.2, duplicate with 4.2.3 2020-10-30 14:40:48 +01:00
9eb6bac993 FIX(6.2.9): fix EXCEPTIONS unbound variable error 2020-10-28 15:04:41 +01:00
df802b4882 Fix spelling mistakes and numbering in comments 2020-10-28 10:09:10 +01:00
f71d34a31b Update changelog 2019-10-30 15:42:59 +01:00
ab712b4a6c IMP(5.2.1,5.2.2,5.2.3): add purposely failing tests 2020-10-28 09:09:30 +01:00
2559dd82cb IMP(5.1.8): add purposely failing tests 2020-10-27 16:44:14 +01:00
b33ab3d9bf IMP(5.1.2-5.1.7): add purposely failing tests 2020-10-27 16:16:23 +01:00
67badc0ed1 FIX(2.2.15): add netstat docker images 2020-10-27 16:01:20 +01:00
7a09e0fb9a IMP(99.2): skip on docker 2020-10-27 16:00:02 +01:00
5d16ee5c98 IMP(1.1.21): skip on docker 2020-10-27 15:34:32 +01:00
4680465095 IMP(1.4.1,1.4.2,1.4.3): skip on docker 2020-10-27 15:12:09 +01:00
027552f364 IMP(8.0): skip on docker 2020-10-27 15:07:32 +01:00
a0df6837ea IMP(1.5.1): skip this test on docker 2020-10-27 14:29:13 +01:00
20f432765d FIX(5.2.2,5.2.3) find was not working properly
I removed the functions in utils and replace them with loops, so that
there is no more problems with the options arrays.
2020-10-27 12:47:11 +01:00
97bb1927c3 IMP(1.1.1.X): skip this tests on docker 2020-10-27 11:25:18 +01:00
fec0ac159c IMP(6.2.18,6.2.19,6.2.20): add purposely failing tests 2020-10-27 11:24:40 +01:00
f89a864b33 IMP(6.2.15): add purposely failing tests 2020-10-27 11:06:27 +01:00
5ea053a502 IMP(6.2.12,6.2.13): add purposely failing tests 2020-10-27 11:04:55 +01:00
58277716c7 IMP(6.2.11,6.2.14): add purposely failing tests 2020-10-27 11:04:33 +01:00
912718a014 IMP(6.2.10): add purposely failing tests 2020-10-27 10:01:29 +01:00
01d02b5d5c IMP(6.2.8): add purposely failing tests 2020-10-27 09:34:06 +01:00
bb266ebe4a IMP(6.2.6): add purposely failing tests 2020-10-27 09:17:57 +01:00
1e64a14299 IMP(6.2.2,6.2.3,6.2.4): add purposely failing tests 2020-10-26 14:46:42 +01:00
7ab41f7b88 IMP(6.2.1): add purposely failing tests 2020-10-26 12:52:29 +01:00
a0796af547 IMP(6.1.2,6.1.3,6.1.4): add purposely failing tests 2020-10-26 11:48:02 +01:00
990f191111 CLEAN: rename 2.18, 2.23 2020-10-26 11:05:37 +01:00
f82712203d CLEAN: rename 7.7 2020-10-26 11:00:55 +01:00
e2616b024d CLEAN: Remove 13.13 (duplicate with 6.2.9) 2020-10-26 10:55:12 +01:00
36d55a6f79 CLEAN: Remove old checks (3.2, 8.2.4) 2020-10-26 10:48:08 +01:00
e1846ebd4c CLEAN: Rename 1.7.1.4, 8.2.1 2020-10-26 10:40:48 +01:00
bb9f60a939 IMP(12.7): test is automatically skipped on docker 2020-10-26 08:51:50 +01:00
c0e9b96ffc FIX: change name to fit check content (cracklib -> pwquality)
renamed:    bin/hardening/5.3.1_enable_cracklib.sh -> bin/hardening/5.3.1_enable_pwquality.sh
	renamed:    tests/hardening/5.3.1_enable_cracklib.sh -> tests/hardening/5.3.1_enable_pwquality.sh
2019-10-30 15:40:15 +01:00
de3da21a38 CLEAN: remove 8.2.4 2019-10-30 15:37:36 +01:00
c81cf79fea CLEAN(12.x) remove unused checks that were merged with ownsership/perms
deleted:    12.4_etc_passwd_ownership.sh
	deleted:    12.5_etc_shadow_ownership.sh
	deleted:    12.6_etc_group_ownership.sh
2019-10-30 15:29:11 +01:00
d4bbc786a6 IMP(3.2.1-2): set sysctl params in config file 2019-10-30 15:20:30 +01:00
625a6206c7 Fix typos
modified:   1.7.1.4_motd_perms.sh
	modified:   1.7.1.5_etc_issue_perms.sh
	modified:   1.7.1.6_etc_issue_net_perms.sh
	modified:   1.8_install_updates.sh
2019-10-30 15:18:52 +01:00
5074c5a8bd FIX(2.2.12) handle smbd as a service 2019-10-25 16:03:11 +02:00
0fa10240cd Update changelog 2020-10-28 09:26:51 +01:00
d91fdbf84b Add missing tests CUPS, telnet and LDAP
new file:   bin/hardening/2.2.4_disable_print_server.sh
	new file:   bin/hardening/2.3.4_telnet_client_not_installed.sh
	new file:   bin/hardening/2.3.5_ldap_client_not_installed.sh
	new file:   tests/hardening/2.2.4_disable_print_server.sh
	new file:   tests/hardening/2.3.4_telnet_client_not_installed.sh
	new file:   tests/hardening/2.3.5_ldap_client_not_installed.sh
2019-10-21 14:45:25 +02:00
2b60594a06 Renum 2.6.x to 1.1.x for /var/tmp
renamed:    bin/hardening/2.6.4_var_tmp_noexec.sh -> bin/hardening/1.1.10_var_tmp_noexec.sh
	renamed:    bin/hardening/2.6.1_var_tmp_partition.sh -> bin/hardening/1.1.7_var_tmp_partition.sh
	renamed:    bin/hardening/2.6.2_var_tmp_nodev.sh -> bin/hardening/1.1.8_var_tmp_nodev.sh
	renamed:    bin/hardening/2.6.3_var_tmp_nosuid.sh -> bin/hardening/1.1.9_var_tmp_nosuid.sh
	renamed:    tests/hardening/2.6.4_var_tmp_noexec.sh -> tests/hardening/1.1.10_var_tmp_noexec.sh
	renamed:    tests/hardening/2.6.3_var_tmp_nosuid.sh -> tests/hardening/1.1.7_var_tmp_partition.sh
	renamed:    tests/hardening/2.6.2_var_tmp_nodev.sh -> tests/hardening/1.1.8_var_tmp_nodev.sh
	renamed:    tests/hardening/2.6.1_var_tmp_partition.sh -> tests/hardening/1.1.9_var_tmp_nosuid.sh
2019-10-21 12:21:22 +02:00
d6dae89966 Renum logrotate config 8.4 to 4.3
renamed:    8.4_configure_logrotate.sh -> 4.3_configure_logrotate.sh
	renamed:    ../../tests/hardening/8.4_configure_logrotate.sh -> ../../tests/hardening/4.3_configure_logrotate.sh
2019-10-18 17:32:41 +02:00
80b97940fa Renumbering custom 99.* scripts as newcomers to CIS benchmark
renamed:    bin/hardening/99.4_net_fw_default_policy_drop.sh -> bin/hardening/3.5.1.1_net_fw_default_policy_drop.sh
	renamed:    bin/hardening/99.3.3_acc_pam_sha512.sh -> bin/hardening/5.3.4_acc_pam_sha512.sh
	renamed:    tests/hardening/99.4_net_fw_default_policy_drop.sh -> tests/hardening/3.5.1.1_net_fw_default_policy_drop.sh
	renamed:    tests/hardening/99.3.3_acc_pam_sha512.sh -> tests/hardening/5.3.4_acc_pam_sha512.sh
2019-10-18 17:26:31 +02:00
609444a47f Renum User and Groups settings 13.x to 6.2.x
renamed:    bin/hardening/13.8_check_user_dot_file_perm.sh -> bin/hardening/6.2.10_check_user_dot_file_perm.sh
	renamed:    bin/hardening/13.19_find_user_forward_files.sh -> bin/hardening/6.2.11_find_user_forward_files.sh
	renamed:    bin/hardening/13.18_find_user_netrc_files.sh -> bin/hardening/6.2.12_find_user_netrc_files.sh
	renamed:    bin/hardening/13.9_set_perm_on_user_netrc.sh -> bin/hardening/6.2.13_set_perm_on_user_netrc.sh
	renamed:    bin/hardening/13.10_find_user_rhosts_files.sh -> bin/hardening/6.2.14_find_user_rhosts_files.sh
	renamed:    bin/hardening/13.11_find_passwd_group_inconsistencies.sh -> bin/hardening/6.2.15_find_passwd_group_inconsistencies.sh
	renamed:    bin/hardening/13.14_check_duplicate_uid.sh -> bin/hardening/6.2.16_check_duplicate_uid.sh
	renamed:    bin/hardening/13.15_check_duplicate_gid.sh -> bin/hardening/6.2.17_check_duplicate_gid.sh
	renamed:    bin/hardening/13.16_check_duplicate_username.sh -> bin/hardening/6.2.18_check_duplicate_username.sh
	renamed:    bin/hardening/13.17_check_duplicate_groupname.sh -> bin/hardening/6.2.19_check_duplicate_groupname.sh
	renamed:    bin/hardening/13.1_remove_empty_password_field.sh -> bin/hardening/6.2.1_remove_empty_password_field.sh
	renamed:    bin/hardening/13.20_shadow_group_empty.sh -> bin/hardening/6.2.20_shadow_group_empty.sh
	renamed:    bin/hardening/13.2_remove_legacy_passwd_entries.sh -> bin/hardening/6.2.2_remove_legacy_passwd_entries.sh
	renamed:    bin/hardening/13.3_remove_legacy_shadow_entries.sh -> bin/hardening/6.2.3_remove_legacy_shadow_entries.sh
	renamed:    bin/hardening/13.4_remove_legacy_group_entries.sh -> bin/hardening/6.2.4_remove_legacy_group_entries.sh
	renamed:    bin/hardening/13.5_find_0_uid_non_root_account.sh -> bin/hardening/6.2.5_find_0_uid_non_root_account.sh
	renamed:    bin/hardening/13.6_sanitize_root_path.sh -> bin/hardening/6.2.6_sanitize_root_path.sh
	renamed:    bin/hardening/13.7_check_user_dir_perm.sh -> bin/hardening/6.2.8_check_user_dir_perm.sh
	renamed:    bin/hardening/13.12_users_valid_homedir.sh -> bin/hardening/6.2.9_users_valid_homedir.sh
	renamed:    tests/hardening/13.9_set_perm_on_user_netrc.sh -> tests/hardening/6.2.10_check_user_dot_file_perm.sh
	renamed:    tests/hardening/13.8_check_user_dot_file_perm.sh -> tests/hardening/6.2.11_find_user_forward_files.sh
	renamed:    tests/hardening/13.7_check_user_dir_perm.sh -> tests/hardening/6.2.12_find_user_netrc_files.sh
	renamed:    tests/hardening/13.6_sanitize_root_path.sh -> tests/hardening/6.2.13_set_perm_on_user_netrc.sh
	renamed:    tests/hardening/13.4_remove_legacy_group_entries.sh -> tests/hardening/6.2.15_find_passwd_group_inconsistencies.sh
	renamed:    tests/hardening/13.14_check_duplicate_uid.sh -> tests/hardening/6.2.16_check_duplicate_uid.sh
	renamed:    tests/hardening/13.15_check_duplicate_gid.sh -> tests/hardening/6.2.17_check_duplicate_gid.sh
	renamed:    tests/hardening/13.3_remove_legacy_shadow_entries.sh -> tests/hardening/6.2.18_check_duplicate_username.sh
	renamed:    tests/hardening/13.2_remove_legacy_passwd_entries.sh -> tests/hardening/6.2.19_check_duplicate_groupname.sh
	renamed:    tests/hardening/13.20_shadow_group_empty.sh -> tests/hardening/6.2.1_remove_empty_password_field.sh
	renamed:    tests/hardening/13.1_remove_empty_password_field.sh -> tests/hardening/6.2.20_shadow_group_empty.sh
	renamed:    tests/hardening/13.19_find_user_forward_files.sh -> tests/hardening/6.2.2_remove_legacy_passwd_entries.sh
	renamed:    tests/hardening/13.18_find_user_netrc_files.sh -> tests/hardening/6.2.3_remove_legacy_shadow_entries.sh
	renamed:    tests/hardening/13.17_check_duplicate_groupname.sh -> tests/hardening/6.2.4_remove_legacy_group_entries.sh
	renamed:    tests/hardening/13.5_find_0_uid_non_root_account.sh -> tests/hardening/6.2.5_find_0_uid_non_root_account.sh
	renamed:    tests/hardening/13.16_check_duplicate_username.sh -> tests/hardening/6.2.6_sanitize_root_path.sh
	renamed:    tests/hardening/13.12_users_valid_homedir.sh -> tests/hardening/6.2.8_check_user_dir_perm.sh
	renamed:    tests/hardening/13.11_find_passwd_group_inconsistencies.sh -> tests/hardening/6.2.9_users_valid_homedir.sh
2019-09-12 17:43:12 +02:00
440aeaf45f Renum 12.x checks to 6.1.x Verify_System_File_Permissions
modified:   bin/hardening/12.4_etc_passwd_ownership.sh
	modified:   bin/hardening/12.5_etc_shadow_ownership.sh
	modified:   bin/hardening/12.6_etc_group_ownership.sh
	renamed:    bin/hardening/12.7_find_world_writable_file.sh -> bin/hardening/6.1.10_find_world_writable_file.sh
	renamed:    bin/hardening/12.8_find_unowned_files.sh -> bin/hardening/6.1.11_find_unowned_files.sh
	renamed:    bin/hardening/12.9_find_ungrouped_files.sh -> bin/hardening/6.1.12_find_ungrouped_files.sh
	renamed:    bin/hardening/12.10_find_suid_files.sh -> bin/hardening/6.1.13_find_suid_files.sh
	renamed:    bin/hardening/12.11_find_sgid_files.sh -> bin/hardening/6.1.14_find_sgid_files.sh
	renamed:    bin/hardening/12.1_etc_passwd_permissions.sh -> bin/hardening/6.1.2_etc_passwd_permissions.sh
	renamed:    bin/hardening/12.2_etc_shadow_permissions.sh -> bin/hardening/6.1.3_etc_shadow_permissions.sh
	renamed:    bin/hardening/12.3_etc_group_permissions.sh -> bin/hardening/6.1.4_etc_group_permissions.sh
	deleted:    tests/hardening/12.1_etc_passwd_permissions.sh
	deleted:    tests/hardening/12.2_etc_shadow_permissions.sh
	deleted:    tests/hardening/12.3_etc_group_permissions.sh
	renamed:    tests/hardening/12.7_find_world_writable_file.sh -> tests/hardening/6.1.10_find_world_writable_file.sh
	renamed:    tests/hardening/12.8_find_unowned_files.sh -> tests/hardening/6.1.11_find_unowned_files.sh
	renamed:    tests/hardening/12.9_find_ungrouped_files.sh -> tests/hardening/6.1.12_find_ungrouped_files.sh
	renamed:    tests/hardening/12.10_find_suid_files.sh -> tests/hardening/6.1.13_find_suid_files.sh
	renamed:    tests/hardening/12.11_find_sgid_files.sh -> tests/hardening/6.1.14_find_sgid_files.sh
	renamed:    tests/hardening/12.6_etc_group_ownership.sh -> tests/hardening/6.1.2_etc_passwd_permissions.sh
	renamed:    tests/hardening/12.5_etc_shadow_ownership.sh -> tests/hardening/6.1.3_etc_shadow_permissions.sh
	renamed:    tests/hardening/12.4_etc_passwd_ownership.sh -> tests/hardening/6.1.4_etc_group_permissions.sh
2019-09-12 16:44:45 +02:00
a085785321 Renum warning banners checks 11.x to 1.7.x
new file:   bin/hardening/1.7.1.1_remove_os_info_motd.sh
	renamed:    bin/hardening/11.2_remove_os_info_warning_banners.sh -> bin/hardening/1.7.1.2_remove_os_info_issue.sh
	new file:   bin/hardening/1.7.1.3_remove_os_info_issue_net.sh
	new file:   bin/hardening/1.7.1.4_motd_perms.sh
	new file:   bin/hardening/1.7.1.5_etc_issue_perms.sh
	new file:   bin/hardening/1.7.1.6_etc_issue_net_perms.sh
	renamed:    bin/hardening/11.3_graphical_warning_banners.sh -> bin/hardening/1.7.2_graphical_warning_banners.sh
	deleted:    bin/hardening/11.1_warning_banners.sh
	renamed:    tests/hardening/11.3_graphical_warning_banners.sh -> tests/hardening/1.7.1.1_remove_os_info_motd.sh
	renamed:    tests/hardening/11.2_remove_os_info_warning_banners.sh -> tests/hardening/1.7.1.2_remove_os_info_issue.sh
	renamed:    tests/hardening/11.1_warning_banners.sh -> tests/hardening/1.7.1.3_remove_os_info_issue_net.sh
	new file:   tests/hardening/1.7.1.4_warning_banners.sh
	new file:   tests/hardening/1.7.2_graphical_warning_banners.sh
2019-09-12 15:42:22 +02:00
fbb73d1953 Renum 10.x to 5.4.x
renamed:    bin/hardening/10.5_lock_inactive_user_account.sh -> bin/hardening/5.4.1.4_lock_inactive_user_account.sh
	renamed:    bin/hardening/10.2_disable_system_accounts.sh -> bin/hardening/5.4.2_disable_system_accounts.sh
	renamed:    bin/hardening/10.3_default_root_group.sh -> bin/hardening/5.4.3_default_root_group.sh
	renamed:    bin/hardening/10.4_default_umask.sh -> bin/hardening/5.4.4_default_umask.sh
	renamed:    tests/hardening/10.5_lock_inactive_user_account.sh -> tests/hardening/5.4.1.4_lock_inactive_user_account.sh
	renamed:    tests/hardening/10.2_disable_system_accounts.sh -> tests/hardening/5.4.2_disable_system_accounts.sh
	renamed:    tests/hardening/10.4_default_umask.sh -> tests/hardening/5.4.3_default_root_group.sh
	renamed:    tests/hardening/10.3_default_root_group.sh -> tests/hardening/5.4.4_default_umask.sh
2019-09-12 10:55:43 +02:00
47a9ffdc9c Renum login.defs 10.1.x to 5.4.1.x
renamed:    bin/hardening/10.1.1_set_password_exp_days.sh -> bin/hardening/5.4.1.1_set_password_exp_days.sh
	renamed:    bin/hardening/10.1.2_set_password_min_days_change.sh -> bin/hardening/5.4.1.2_set_password_min_days_change.sh
	renamed:    bin/hardening/10.1.3_set_password_exp_warning_days.sh -> bin/hardening/5.4.1.3_set_password_exp_warning_days.sh
	renamed:    tests/hardening/10.1.3_set_password_exp_warning_days.sh -> tests/hardening/5.4.1.1_set_password_exp_days.sh
	renamed:    tests/hardening/10.1.2_set_password_min_days_change.sh -> tests/hardening/5.4.1.2_set_password_min_days_change.sh
	renamed:    tests/hardening/10.1.1_set_password_exp_days.sh -> tests/hardening/5.4.1.3_set_password_exp_warning_days.sh
2019-09-12 10:43:48 +02:00
8a4a28a35b Renum 9.x tty and su checks
renamed:    bin/hardening/9.4_secure_tty.sh -> bin/hardening/5.5_secure_tty.sh
	renamed:    bin/hardening/9.5_restrict_su.sh -> bin/hardening/5.6_restrict_su.sh
	renamed:    tests/hardening/9.5_restrict_su.sh -> tests/hardening/5.5_secure_tty.sh
	renamed:    tests/hardening/9.4_secure_tty.sh -> tests/hardening/5.6_restrict_su.sh
2019-09-11 17:16:54 +02:00
9e61ca8367 Renum ssh config check 9.3.x to 5.2.x
Also renum 99.x checks that were included in CIS recommendations

	renamed:    bin/hardening/9.3.8_disable_root_login.sh -> bin/hardening/5.2.10_disable_root_login.sh
	renamed:    bin/hardening/9.3.9_disable_sshd_permitemptypasswords.sh -> bin/hardening/5.2.11_disable_sshd_permitemptypasswords.sh
	renamed:    bin/hardening/9.3.10_disable_sshd_setenv.sh -> bin/hardening/5.2.12_disable_sshd_setenv.sh
	renamed:    bin/hardening/9.3.11_sshd_ciphers.sh -> bin/hardening/5.2.13_sshd_ciphers.sh
	renamed:    bin/hardening/99.5.2.2_ssh_cry_mac.sh -> bin/hardening/5.2.14_ssh_cry_mac.sh
	renamed:    bin/hardening/99.5.2.1_ssh_cry_kex.sh -> bin/hardening/5.2.15_ssh_cry_kex.sh
	renamed:    bin/hardening/9.3.12_sshd_idle_timeout.sh -> bin/hardening/5.2.16_sshd_idle_timeout.sh
	renamed:    bin/hardening/9.3.13_sshd_limit_access.sh -> bin/hardening/5.2.18_sshd_limit_access.sh
	renamed:    bin/hardening/9.3.14_ssh_banner.sh -> bin/hardening/5.2.19_ssh_banner.sh
	renamed:    bin/hardening/9.3.3_sshd_conf_perm_ownership.sh -> bin/hardening/5.2.1_sshd_conf_perm_ownership.sh
	renamed:    bin/hardening/9.3.1_sshd_protocol.sh -> bin/hardening/5.2.4_sshd_protocol.sh
	renamed:    bin/hardening/9.3.2_sshd_loglevel.sh -> bin/hardening/5.2.5_sshd_loglevel.sh
	renamed:    bin/hardening/9.3.4_disable_x11_forwarding.sh -> bin/hardening/5.2.6_disable_x11_forwarding.sh
	renamed:    bin/hardening/9.3.5_sshd_maxauthtries.sh -> bin/hardening/5.2.7_sshd_maxauthtries.sh
	renamed:    bin/hardening/9.3.6_enable_sshd_ignorerhosts.sh -> bin/hardening/5.2.8_enable_sshd_ignorerhosts.sh
	renamed:    bin/hardening/9.3.7_disable_sshd_hostbasedauthentication.sh -> bin/hardening/5.2.9_disable_sshd_hostbasedauthentication.sh
	renamed:    tests/hardening/9.3.9_disable_sshd_permitemptypasswords.sh -> tests/hardening/5.2.10_disable_root_login.sh
	renamed:    tests/hardening/9.3.8_disable_root_login.sh -> tests/hardening/5.2.11_disable_sshd_permitemptypasswords.sh
	renamed:    tests/hardening/9.3.7_disable_sshd_hostbasedauthentication.sh -> tests/hardening/5.2.12_disable_sshd_setenv.sh
	renamed:    tests/hardening/9.3.6_enable_sshd_ignorerhosts.sh -> tests/hardening/5.2.13_sshd_ciphers.sh
	renamed:    tests/hardening/99.5.2.2_ssh_cry_mac.sh -> tests/hardening/5.2.14_ssh_cry_mac.sh
	renamed:    tests/hardening/99.5.2.1_ssh_cry_kex.sh -> tests/hardening/5.2.15_ssh_cry_kex.sh
	renamed:    tests/hardening/9.3.5_sshd_maxauthtries.sh -> tests/hardening/5.2.16_sshd_idle_timeout.sh
	renamed:    tests/hardening/9.3.4_disable_x11_forwarding.sh -> tests/hardening/5.2.18_sshd_limit_access.sh
	renamed:    tests/hardening/9.3.3_sshd_conf_perm_ownership.sh -> tests/hardening/5.2.19_ssh_banner.sh
	renamed:    tests/hardening/9.3.1_sshd_protocol.sh -> tests/hardening/5.2.1_sshd_conf_perm_ownership.sh
	renamed:    tests/hardening/9.3.14_ssh_banner.sh -> tests/hardening/5.2.4_sshd_protocol.sh
	renamed:    tests/hardening/9.3.2_sshd_loglevel.sh -> tests/hardening/5.2.5_sshd_loglevel.sh
	renamed:    tests/hardening/9.3.13_sshd_limit_access.sh -> tests/hardening/5.2.6_disable_x11_forwarding.sh
	renamed:    tests/hardening/9.3.12_sshd_idle_timeout.sh -> tests/hardening/5.2.7_sshd_maxauthtries.sh
	renamed:    tests/hardening/9.3.11_sshd_ciphers.sh -> tests/hardening/5.2.8_enable_sshd_ignorerhosts.sh
	renamed:    tests/hardening/9.3.10_disable_sshd_setenv.sh -> tests/hardening/5.2.9_disable_sshd_hostbasedauthentication.sh
2019-09-11 17:12:54 +02:00
c863a01305 Renum 9.2.x to 5.3.x Pam password settings
renamed:    bin/hardening/9.2.1_enable_cracklib.sh -> bin/hardening/5.3.1_enable_cracklib.sh
	renamed:    bin/hardening/9.2.2_enable_lockout_failed_password.sh -> bin/hardening/5.3.2_enable_lockout_failed_password.sh
	renamed:    bin/hardening/9.2.3_limit_password_reuse.sh -> bin/hardening/5.3.3_limit_password_reuse.sh
	renamed:    tests/hardening/9.2.1_enable_cracklib.sh -> tests/hardening/5.3.1_enable_cracklib.sh
	renamed:    tests/hardening/9.2.3_limit_password_reuse.sh -> tests/hardening/5.3.2_enable_lockout_failed_password.sh
	renamed:    tests/hardening/9.2.2_enable_lockout_failed_password.sh -> tests/hardening/5.3.3_limit_password_reuse.sh
2019-09-11 15:40:00 +02:00
124dde8254 Renum 9.1.x to 5.1.x cron checks
renamed:    bin/hardening/9.1.1_enable_cron.sh -> bin/hardening/5.1.1_enable_cron.sh
	renamed:    bin/hardening/9.1.2_crontab_perm_ownership.sh -> bin/hardening/5.1.2_crontab_perm_ownership.sh
	renamed:    bin/hardening/9.1.3_cron_hourly_perm_ownership.sh -> bin/hardening/5.1.3_cron_hourly_perm_ownership.sh
	renamed:    bin/hardening/9.1.4_cron_daily_perm_ownership.sh -> bin/hardening/5.1.4_cron_daily_perm_ownership.sh
	renamed:    bin/hardening/9.1.5_cron_weekly_perm_ownership.sh -> bin/hardening/5.1.5_cron_weekly_perm_ownership.sh
	renamed:    bin/hardening/9.1.6_cron_monthly_perm_ownership.sh -> bin/hardening/5.1.6_cron_monthly_perm_ownership.sh
	renamed:    bin/hardening/9.1.7_cron_d_perm_ownership.sh -> bin/hardening/5.1.7_cron_d_perm_ownership.sh
	renamed:    bin/hardening/9.1.8_cron_users.sh -> bin/hardening/5.1.8_cron_users.sh
	renamed:    tests/hardening/9.1.8_cron_users.sh -> tests/hardening/5.1.1_enable_cron.sh
	renamed:    tests/hardening/9.1.7_cron_d_perm_ownership.sh -> tests/hardening/5.1.2_crontab_perm_ownership.sh
	renamed:    tests/hardening/9.1.6_cron_monthly_perm_ownership.sh -> tests/hardening/5.1.3_cron_hourly_perm_ownership.sh
	renamed:    tests/hardening/9.1.5_cron_weekly_perm_ownership.sh -> tests/hardening/5.1.4_cron_daily_perm_ownership.sh
	renamed:    tests/hardening/9.1.4_cron_daily_perm_ownership.sh -> tests/hardening/5.1.5_cron_weekly_perm_ownership.sh
	renamed:    tests/hardening/9.1.3_cron_hourly_perm_ownership.sh -> tests/hardening/5.1.6_cron_monthly_perm_ownership.sh
	renamed:    tests/hardening/9.1.2_crontab_perm_ownership.sh -> tests/hardening/5.1.7_cron_d_perm_ownership.sh
	renamed:    tests/hardening/9.1.1_enable_cron.sh -> tests/hardening/5.1.8_cron_users.sh
2019-09-11 12:16:50 +02:00
65f92a7556 Renum 8.2.x to 4.2.2.x for syslog-ng
renamed:    bin/hardening/8.2.2_enable_syslog-ng.sh -> bin/hardening/4.2.2.1_enable_syslog-ng.sh
	renamed:    bin/hardening/8.2.3_configure_syslog-ng.sh -> bin/hardening/4.2.2.2_configure_syslog-ng.sh
	new file:   bin/hardening/4.2.2.3_syslog_ng_logfiles_perm.sh
	renamed:    bin/hardening/8.2.5_syslog-ng_remote_host.sh -> bin/hardening/4.2.2.4_syslog-ng_remote_host.sh
	renamed:    bin/hardening/8.2.6_remote_syslog-ng_acl.sh -> bin/hardening/4.2.2.5_remote_syslog-ng_acl.sh
	renamed:    tests/hardening/8.2.6_remote_syslog-ng_acl.sh -> tests/hardening/4.2.2.1_enable_syslog-ng.sh
	renamed:    tests/hardening/8.2.3_configure_syslog-ng.sh -> tests/hardening/4.2.2.2_configure_syslog-ng.sh
	renamed:    tests/hardening/8.2.2_enable_syslog-ng.sh -> tests/hardening/4.2.2.3_syslog_ng_logfiles_perm.sh
	renamed:    tests/hardening/8.2.5_syslog-ng_remote_host.sh -> tests/hardening/4.2.2.4_syslog-ng_remote_host.sh
	new file:   tests/hardening/4.2.2.5_remote_syslog-ng_acl.sh
2019-09-11 11:52:24 +02:00
00dd3ef591 Renum 8.1.x auditing configuration
renamed:    bin/hardening/8.1.1.1_audit_log_storage.sh -> bin/hardening/4.1.1.1_audit_log_storage.sh
	renamed:    bin/hardening/8.1.1.2_halt_when_audit_log_full.sh -> bin/hardening/4.1.1.2_halt_when_audit_log_full.sh
	renamed:    bin/hardening/8.1.1.3_keep_all_audit_logs.sh -> bin/hardening/4.1.1.3_keep_all_audit_logs.sh
	renamed:    bin/hardening/8.1.10_record_dac_edit.sh -> bin/hardening/4.1.10_record_dac_edit.sh
	renamed:    bin/hardening/8.1.11_record_failed_access_file.sh -> bin/hardening/4.1.11_record_failed_access_file.sh
	renamed:    bin/hardening/8.1.12_record_privileged_commands.sh -> bin/hardening/4.1.12_record_privileged_commands.sh
	renamed:    bin/hardening/8.1.13_record_successful_mount.sh -> bin/hardening/4.1.13_record_successful_mount.sh
	renamed:    bin/hardening/8.1.14_record_file_deletions.sh -> bin/hardening/4.1.14_record_file_deletions.sh
	renamed:    bin/hardening/8.1.15_record_sudoers_edit.sh -> bin/hardening/4.1.15_record_sudoers_edit.sh
	renamed:    bin/hardening/8.1.16_record_sudo_usage.sh -> bin/hardening/4.1.16_record_sudo_usage.sh
	renamed:    bin/hardening/8.1.17_record_kernel_modules.sh -> bin/hardening/4.1.17_record_kernel_modules.sh
	renamed:    bin/hardening/8.1.18_freeze_auditd_conf.sh -> bin/hardening/4.1.18_freeze_auditd_conf.sh
	renamed:    bin/hardening/8.1.2_enable_auditd.sh -> bin/hardening/4.1.2_enable_auditd.sh
	renamed:    bin/hardening/8.1.3_audit_bootloader.sh -> bin/hardening/4.1.3_audit_bootloader.sh
	renamed:    bin/hardening/8.1.4_record_date_time_edit.sh -> bin/hardening/4.1.4_record_date_time_edit.sh
	renamed:    bin/hardening/8.1.5_record_user_group_edit.sh -> bin/hardening/4.1.5_record_user_group_edit.sh
	renamed:    bin/hardening/8.1.6_record_network_edit.sh -> bin/hardening/4.1.6_record_network_edit.sh
	renamed:    bin/hardening/8.1.7_record_mac_edit.sh -> bin/hardening/4.1.7_record_mac_edit.sh
	renamed:    bin/hardening/8.1.8_record_login_logout.sh -> bin/hardening/4.1.8_record_login_logout.sh
	renamed:    bin/hardening/8.1.9_record_session_init.sh -> bin/hardening/4.1.9_record_session_init.sh
	renamed:    tests/hardening/8.1.9_record_session_init.sh -> tests/hardening/4.1.1.1_audit_log_storage.sh
	renamed:    tests/hardening/8.1.8_record_login_logout.sh -> tests/hardening/4.1.1.2_halt_when_audit_log_full.sh
	renamed:    tests/hardening/8.1.7_record_mac_edit.sh -> tests/hardening/4.1.1.3_keep_all_audit_logs.sh
	renamed:    tests/hardening/8.1.6_record_network_edit.sh -> tests/hardening/4.1.10_record_dac_edit.sh
	renamed:    tests/hardening/8.1.5_record_user_group_edit.sh -> tests/hardening/4.1.11_record_failed_access_file.sh
	renamed:    tests/hardening/8.1.4_record_date_time_edit.sh -> tests/hardening/4.1.12_record_privileged_commands.sh
	renamed:    tests/hardening/8.1.3_audit_bootloader.sh -> tests/hardening/4.1.13_record_successful_mount.sh
	renamed:    tests/hardening/8.1.2_enable_auditd.sh -> tests/hardening/4.1.14_record_file_deletions.sh
	renamed:    tests/hardening/8.1.18_freeze_auditd_conf.sh -> tests/hardening/4.1.15_record_sudoers_edit.sh
	renamed:    tests/hardening/8.1.17_record_kernel_modules.sh -> tests/hardening/4.1.16_record_sudo_usage.sh
	renamed:    tests/hardening/8.1.16_record_sudo_usage.sh -> tests/hardening/4.1.17_record_kernel_modules.sh
	renamed:    tests/hardening/8.1.15_record_sudoers_edit.sh -> tests/hardening/4.1.18_freeze_auditd_conf.sh
	renamed:    tests/hardening/8.1.14_record_file_deletions.sh -> tests/hardening/4.1.2_enable_auditd.sh
	renamed:    tests/hardening/8.1.13_record_successful_mount.sh -> tests/hardening/4.1.3_audit_bootloader.sh
	renamed:    tests/hardening/8.1.12_record_privileged_commands.sh -> tests/hardening/4.1.4_record_date_time_edit.sh
	renamed:    tests/hardening/8.1.11_record_failed_access_file.sh -> tests/hardening/4.1.5_record_user_group_edit.sh
	renamed:    tests/hardening/8.1.10_record_dac_edit.sh -> tests/hardening/4.1.6_record_network_edit.sh
	renamed:    tests/hardening/8.1.1.3_keep_all_audit_logs.sh -> tests/hardening/4.1.7_record_mac_edit.sh
	renamed:    tests/hardening/8.1.1.2_halt_when_audit_log_full.sh -> tests/hardening/4.1.8_record_login_logout.sh
	renamed:    tests/hardening/8.1.1.1_audit_log_storage.sh -> tests/hardening/4.1.9_record_session_init.sh
2019-09-09 16:45:54 +02:00
032aaa7c79 Renumber 7.5.x and 7.6
renamed:    bin/hardening/7.5.1_disable_dccp.sh -> bin/hardening/3.4.1_disable_dccp.sh
	renamed:    bin/hardening/7.5.2_disable_sctp.sh -> bin/hardening/3.4.2_disable_sctp.sh
	renamed:    bin/hardening/7.5.3_disable_rds.sh -> bin/hardening/3.4.3_disable_rds.sh
	renamed:    bin/hardening/7.5.4_disable_tipc.sh -> bin/hardening/3.4.4_disable_tipc.sh
	renamed:    bin/hardening/7.6_disable_wireless.sh -> bin/hardening/3.6_disable_wireless.sh
	renamed:    tests/hardening/7.6_disable_wireless.sh -> tests/hardening/3.4.1_disable_dccp.sh
	renamed:    tests/hardening/7.5.4_disable_tipc.sh -> tests/hardening/3.4.2_disable_sctp.sh
	renamed:    tests/hardening/7.5.3_disable_rds.sh -> tests/hardening/3.4.3_disable_rds.sh
	renamed:    tests/hardening/7.5.2_disable_sctp.sh -> tests/hardening/3.4.4_disable_tipc.sh
	renamed:    tests/hardening/7.5.1_disable_dccp.sh -> tests/hardening/3.6_disable_wireless.sh
2019-08-30 17:18:26 +02:00
68f9f56192 Renumber 7.4.x tcp wrappers
renamed:    bin/hardening/7.4.1_install_tcp_wrapper.sh -> bin/hardening/3.3.1_install_tcp_wrapper.sh
	renamed:    bin/hardening/7.4.2_hosts_allow.sh -> bin/hardening/3.3.2_hosts_allow.sh
	renamed:    bin/hardening/7.4.4_hosts_deny.sh -> bin/hardening/3.3.3_hosts_deny.sh
	renamed:    bin/hardening/7.4.3_hosts_allow_permissions.sh -> bin/hardening/3.3.4_hosts_allow_permissions.sh
	renamed:    bin/hardening/7.4.5_hosts_deny_permissions.sh -> bin/hardening/3.3.5_hosts_deny_permissions.sh
	renamed:    tests/hardening/7.4.5_hosts_deny_permissions.sh -> tests/hardening/3.3.1_install_tcp_wrapper.sh
	renamed:    tests/hardening/7.4.4_hosts_deny.sh -> tests/hardening/3.3.2_hosts_allow.sh
	renamed:    tests/hardening/7.4.3_hosts_allow_permissions.sh -> tests/hardening/3.3.3_hosts_deny.sh
	renamed:    tests/hardening/7.4.2_hosts_allow.sh -> tests/hardening/3.3.4_hosts_allow_permissions.sh
	renamed:    tests/hardening/7.4.1_install_tcp_wrapper.sh -> tests/hardening/3.3.5_hosts_deny_permissions.sh
2019-08-30 17:11:03 +02:00
c5674c3627 Renumber network params 7.1.x, 7.2.x and 7.3
renamed:    bin/hardening/7.1.1_disable_ip_forwarding.sh -> bin/hardening/3.1.1_disable_ip_forwarding.sh
	renamed:    bin/hardening/7.1.2_disable_send_packet_redirects.sh -> bin/hardening/3.1.2_disable_send_packet_redirects.sh
	renamed:    bin/hardening/7.2.1_disable_source_routed_packets.sh -> bin/hardening/3.2.1_disable_source_routed_packets.sh
	renamed:    bin/hardening/7.2.2_disable_icmp_redirect.sh -> bin/hardening/3.2.2_disable_icmp_redirect.sh
	renamed:    bin/hardening/7.2.3_disable_secure_icmp_redirect.sh -> bin/hardening/3.2.3_disable_secure_icmp_redirect.sh
	renamed:    bin/hardening/7.2.4_log_martian_packets.sh -> bin/hardening/3.2.4_log_martian_packets.sh
	renamed:    bin/hardening/7.2.5_ignore_broadcast_requests.sh -> bin/hardening/3.2.5_ignore_broadcast_requests.sh
	renamed:    bin/hardening/7.2.8_enable_tcp_syn_cookies.sh -> bin/hardening/3.2.8_enable_tcp_syn_cookies.sh
	renamed:    bin/hardening/7.3.1_disable_ipv6_router_advertisement.sh -> bin/hardening/3.2.9_disable_ipv6_router_advertisement.sh
	renamed:    bin/hardening/7.3.3_disable_ipv6.sh -> bin/hardening/3.7_disable_ipv6.sh
	deleted:    bin/hardening/7.2.6_enable_bad_error_message_protection.sh
	deleted:    bin/hardening/7.2.7_enable_source_route_validation.sh
	deleted:    bin/hardening/7.3.2_disable_ipv6_redirect.sh
	renamed:    tests/hardening/7.3.3_disable_ipv6.sh -> tests/hardening/3.1.1_disable_ip_forwarding.sh
	renamed:    tests/hardening/7.3.2_disable_ipv6_redirect.sh -> tests/hardening/3.1.2_disable_send_packet_redirects.sh
	renamed:    tests/hardening/7.3.1_disable_ipv6_router_advertisement.sh -> tests/hardening/3.2.1_disable_source_routed_packets.sh
	renamed:    tests/hardening/7.2.8_enable_tcp_syn_cookies.sh -> tests/hardening/3.2.2_disable_icmp_redirect.sh
	renamed:    tests/hardening/7.2.7_enable_source_route_validation.sh -> tests/hardening/3.2.3_disable_secure_icmp_redirect.sh
	renamed:    tests/hardening/7.2.6_enable_bad_error_message_protection.sh -> tests/hardening/3.2.4_log_martian_packets.sh
	renamed:    tests/hardening/7.2.5_ignore_broadcast_requests.sh -> tests/hardening/3.2.5_ignore_broadcast_requests.sh
	renamed:    tests/hardening/7.2.4_log_martian_packets.sh -> tests/hardening/3.2.8_enable_tcp_syn_cookies.sh
	renamed:    tests/hardening/7.2.3_disable_secure_icmp_redirect.sh -> tests/hardening/3.2.9_disable_ipv6_router_advertisement.sh
	renamed:    tests/hardening/7.2.2_disable_icmp_redirect.sh -> tests/hardening/3.7_disable_ipv6.sh
	deleted:    tests/hardening/7.1.1_disable_ip_forwarding.sh
	deleted:    tests/hardening/7.1.2_disable_send_packet_redirects.sh
	deleted:    tests/hardening/7.2.1_disable_source_routed_packets.sh
2019-08-30 14:14:29 +02:00
e205dc7481 Renumber special purpose services 6.x
new file:   bin/hardening/2.2.1.1_use_time_sync.sh
	renamed:    bin/hardening/6.5_configure_ntp.sh -> bin/hardening/2.2.1.2_configure_ntp.sh
	new file:   bin/hardening/2.2.1.3_configure_chrony.sh
	renamed:    bin/hardening/6.10_disable_http_server.sh -> bin/hardening/2.2.10_disable_http_server.sh
	renamed:    bin/hardening/6.11_disable_imap_pop.sh -> bin/hardening/2.2.11_disable_imap_pop.sh
	renamed:    bin/hardening/6.12_disable_samba.sh -> bin/hardening/2.2.12_disable_samba.sh
	renamed:    bin/hardening/6.13_disable_http_proxy.sh -> bin/hardening/2.2.13_disable_http_proxy.sh
	renamed:    bin/hardening/6.14_disable_snmp_server.sh -> bin/hardening/2.2.14_disable_snmp_server.sh
	renamed:    bin/hardening/6.15_mta_localhost.sh -> bin/hardening/2.2.15_mta_localhost.sh
	renamed:    bin/hardening/6.16_disable_rsync.sh -> bin/hardening/2.2.16_disable_rsync.sh
	renamed:    bin/hardening/6.1_disable_xwindow_system.sh -> bin/hardening/2.2.2_disable_xwindow_system.sh
	renamed:    bin/hardening/6.2_disable_avahi_server.sh -> bin/hardening/2.2.3_disable_avahi_server.sh
	renamed:    bin/hardening/6.4_disable_dhcp.sh -> bin/hardening/2.2.5_disable_dhcp.sh
	renamed:    bin/hardening/6.6_disable_ldap.sh -> bin/hardening/2.2.6_disable_ldap.sh
	renamed:    bin/hardening/6.7_disable_nfs_rpc.sh -> bin/hardening/2.2.7_disable_nfs_rpc.sh
	renamed:    bin/hardening/6.8_disable_dns_server.sh -> bin/hardening/2.2.8_disable_dns_server.sh
	renamed:    bin/hardening/6.9_disable_ftp.sh -> bin/hardening/2.2.9_disable_ftp.sh
	deleted:    bin/hardening/6.3_disable_print_server.sh
	new file:   tests/hardening/2.2.1.1_use_time_sync.sh
	renamed:    tests/hardening/6.9_disable_ftp.sh -> tests/hardening/2.2.1.2_configure_ntp.sh
	renamed:    tests/hardening/6.8_disable_dns_server.sh -> tests/hardening/2.2.1.3_configure_chrony.sh
	renamed:    tests/hardening/6.7_disable_nfs_rpc.sh -> tests/hardening/2.2.10_disable_http_server.sh
	renamed:    tests/hardening/6.6_disable_ldap.sh -> tests/hardening/2.2.11_disable_imap_pop.sh
	renamed:    tests/hardening/6.5_configure_ntp.sh -> tests/hardening/2.2.12_disable_samba.sh
	renamed:    tests/hardening/6.4_disable_dhcp.sh -> tests/hardening/2.2.13_disable_http_proxy.sh
	renamed:    tests/hardening/6.3_disable_print_server.sh -> tests/hardening/2.2.14_disable_snmp_server.sh
	renamed:    tests/hardening/6.2_disable_avahi_server.sh -> tests/hardening/2.2.15_mta_localhost.sh
	renamed:    tests/hardening/6.1_disable_xwindow_system.sh -> tests/hardening/2.2.16_disable_rsync.sh
	renamed:    tests/hardening/6.16_disable_rsync.sh -> tests/hardening/2.2.2_disable_xwindow_system.sh
	renamed:    tests/hardening/6.15_mta_localhost.sh -> tests/hardening/2.2.3_disable_avahi_server.sh
	renamed:    tests/hardening/6.14_disable_snmp_server.sh -> tests/hardening/2.2.5_disable_dhcp.sh
	renamed:    tests/hardening/6.13_disable_http_proxy.sh -> tests/hardening/2.2.6_disable_ldap.sh
	renamed:    tests/hardening/6.12_disable_samba.sh -> tests/hardening/2.2.7_disable_nfs_rpc.sh
	renamed:    tests/hardening/6.11_disable_imap_pop.sh -> tests/hardening/2.2.8_disable_dns_server.sh
	renamed:    tests/hardening/6.10_disable_http_server.sh -> tests/hardening/2.2.9_disable_ftp.sh
2019-08-29 16:02:39 +02:00
fbdf3b72ed Renumbering OS services checks and removing obsolete ones
new file:   bin/hardening/2.1.1_disable_xinetd.sh
	renamed:    bin/hardening/5.1.8_disable_inetd.sh -> bin/hardening/2.1.2_disable_bsd_inetd.sh
	renamed:    bin/hardening/5.1.1_disable_nis.sh -> bin/hardening/2.3.1_disable_nis.sh
	renamed:    bin/hardening/5.1.3_disable_rsh_client.sh -> bin/hardening/2.3.2_disable_rsh_client.sh
	renamed:    bin/hardening/5.1.5_disable_talk_client.sh -> bin/hardening/2.3.3_disable_talk_client.sh
	deleted:    bin/hardening/5.1.2_disable_rsh.sh
	deleted:    bin/hardening/5.1.4_disable_talk.sh
	deleted:    bin/hardening/5.1.6_disable_telnet_server.sh
	deleted:    bin/hardening/5.1.7_disable_tftp_server.sh
	deleted:    bin/hardening/5.2_disable_chargen.sh
	deleted:    bin/hardening/5.3_disable_daytime.sh
	deleted:    bin/hardening/5.4_disable_echo.sh
	deleted:    bin/hardening/5.5_disable_discard.sh
	deleted:    bin/hardening/5.6_disable_time.sh
	renamed:    tests/hardening/5.6_disable_time.sh -> tests/hardening/2.1.1_disable_xinetd.sh
	renamed:    tests/hardening/5.5_disable_discard.sh -> tests/hardening/2.3.1_disable_nis.sh
	renamed:    tests/hardening/5.4_disable_echo.sh -> tests/hardening/2.3.2_disable_rsh_client.sh
	renamed:    tests/hardening/5.3_disable_daytime.sh -> tests/hardening/2.3.3_disable_talk_client.sh
	deleted:    tests/hardening/5.1.1_disable_nis.sh
	deleted:    tests/hardening/5.1.2_disable_rsh.sh
	deleted:    tests/hardening/5.1.3_disable_rsh_client.sh
	deleted:    tests/hardening/5.1.4_disable_talk.sh
	deleted:    tests/hardening/5.1.5_disable_talk_client.sh
	deleted:    tests/hardening/5.1.6_disable_telnet_server.sh
	deleted:    tests/hardening/5.1.7_disable_tftp_server.sh
	deleted:    tests/hardening/5.1.8_disable_inetd.sh
	deleted:    tests/hardening/5.2_disable_chargen.sh
2019-08-29 10:33:23 +02:00
6365f58b4c Renumbering 4.x checks
renamed:    4.1_restrict_core_dumps.sh -> 1.5.1_restrict_core_dumps.sh
	renamed:    4.2_enable_nx_support.sh -> 1.5.2_enable_nx_support.sh
	renamed:    4.3_enable_randomized_vm_placement.sh -> 1.5.3_enable_randomized_vm_placement.sh
	renamed:    4.4_disable_prelink.sh -> 1.5.4_disable_prelink.sh
	renamed:    ../../tests/hardening/4.4_disable_prelink.sh -> ../../tests/hardening/1.5.1_restrict_core_dumps.sh
	renamed:    ../../tests/hardening/4.3_enable_randomized_vm_placement.sh -> ../../tests/hardening/1.5.2_enable_nx_support.sh
	renamed:    ../../tests/hardening/4.2_enable_nx_support.sh -> ../../tests/hardening/1.5.3_enable_randomized_vm_placement.sh
	renamed:    ../../tests/hardening/4.1_restrict_core_dumps.sh -> ../../tests/hardening/1.5.4_disable_prelink.sh
2019-08-28 17:26:27 +02:00
fe25b1ba38 Renumbering of bootloader checks
renamed:    3.1_bootloader_ownership.sh -> 1.4.1_bootloader_ownership.sh
	renamed:    3.3_bootloader_password.sh -> 1.4.2_bootloader_password.sh
	renamed:    3.4_root_password.sh -> 1.4.3_root_password.sh
	deleted:    3.2_bootloader_permissions.sh
	renamed:    ../../tests/hardening/3.4_root_password.sh -> ../../tests/hardening/1.4.1_bootloader_ownership.sh
	renamed:    ../../tests/hardening/3.3_bootloader_password.sh -> ../../tests/hardening/1.4.2_bootloader_password.sh
	renamed:    ../../tests/hardening/3.1_bootloader_ownership.sh -> ../../tests/hardening/1.4.3_root_password.sh
2019-08-28 17:19:59 +02:00
0b85d16c16 First batch of renaming to comply to comply to 8v2 and 9 pdf
renamed:    2.19_disable_freevxfs.sh -> 1.1.1.1_disable_freevxfs.sh
	renamed:    2.20_disable_jffs2.sh -> 1.1.1.2_disable_jffs2.sh
	renamed:    2.21_disable_hfs.sh -> 1.1.1.3_disable_hfs.sh
	renamed:    2.22_disable_hfsplus.sh -> 1.1.1.4_disable_hfsplus.sh
	renamed:    2.24_disable_udf.sh -> 1.1.1.5_disable_udf.sh
	renamed:    2.7_var_log_partition.sh -> 1.1.11_var_log_partition.sh
	renamed:    2.8_var_log_audit_partition.sh -> 1.1.12_var_log_audit_partition.sh
	renamed:    2.9_home_partition.sh -> 1.1.13_home_partition.sh
	renamed:    2.10_home_nodev.sh -> 1.1.14_home_nodev.sh
	renamed:    2.14_run_shm_nodev.sh -> 1.1.15_run_shm_nodev.sh
	renamed:    2.15_run_shm_nosuid.sh -> 1.1.16_run_shm_nosuid.sh
	renamed:    2.16_run_shm_noexec.sh -> 1.1.17_run_shm_noexec.sh
	renamed:    2.11_removable_device_nodev.sh -> 1.1.18_removable_device_nodev.sh
	renamed:    2.13_removable_device_nosuid.sh -> 1.1.19_removable_device_nosuid.sh
	renamed:    2.12_removable_device_noexec.sh -> 1.1.20_removable_device_noexec.sh
	renamed:    2.17_sticky_bit_world_writable_folder.sh -> 1.1.21_sticky_bit_world_writable_folder.sh
	renamed:    2.25_disable_automounting.sh -> 1.1.22_disable_automounting.sh
	renamed:    2.1_tmp_partition.sh -> 1.1.2_tmp_partition.sh
	renamed:    2.2_tmp_nodev.sh -> 1.1.3_tmp_nodev.sh
	renamed:    2.3_tmp_nosuid.sh -> 1.1.4_tmp_nosuid.sh
	renamed:    2.4_tmp_noexec.sh -> 1.1.5_tmp_noexec.sh
	renamed:    2.5_var_partition.sh -> 1.1.6_var_partition.sh
	renamed:    1.1_install_updates.sh -> 1.8_install_updates.sh
2019-08-27 15:30:47 +02:00
88e3a515ef 5.2.17_sshd_login_grace_time 2020-10-05 17:26:13 +02:00
55c1cdbdde 5.2.3_ssh_host_public_keys_perm_ownership 2020-10-05 17:05:47 +02:00
6f5d714b55 5.2.2_ssh_host_private_keys_perm_ownership 2020-10-05 17:05:26 +02:00
a37c5bdc4e Add functions utils
I added two functions in utils that checks perms and ownership for file
resulting for a certain find. It takes parameters to filter the results
if needed.
2020-10-05 17:01:13 +02:00
d6e5803252 4.2.4_logs_permissions 2020-10-05 13:17:44 +02:00
922f28c200 4.2.3_install_syslog-ng 2020-09-30 17:03:10 +02:00
533 changed files with 5128 additions and 3207 deletions

View File

@ -20,6 +20,7 @@ AUDIT=0
APPLY=0 APPLY=0
AUDIT_ALL=0 AUDIT_ALL=0
AUDIT_ALL_ENABLE_PASSED=0 AUDIT_ALL_ENABLE_PASSED=0
CREATE_CONFIG=0
ALLOW_SERVICE_LIST=0 ALLOW_SERVICE_LIST=0
SET_HARDENING_LEVEL=0 SET_HARDENING_LEVEL=0
SUDO_MODE='' SUDO_MODE=''
@ -76,6 +77,10 @@ $LONG_SCRIPT_NAME <RUN_MODE> [OPTIONS], where RUN_MODE is one of:
Modifies the policy to allow a certain kind of services on the machine, such Modifies the policy to allow a certain kind of services on the machine, such
as http, mail, etc. Can be specified multiple times to allow multiple services. as http, mail, etc. Can be specified multiple times to allow multiple services.
Use --allow-service-list to get a list of supported services. Use --allow-service-list to get a list of supported services.
--create-config-files-only
Create the config files in etc/conf.d
Must be run as root, before running the audit with user secaudit
OPTIONS: OPTIONS:
@ -126,6 +131,9 @@ while [[ $# > 0 ]]; do
--allow-service-list) --allow-service-list)
ALLOW_SERVICE_LIST=1 ALLOW_SERVICE_LIST=1
;; ;;
--create-config-files-only)
CREATE_CONFIG=1
;;
--allow-service) --allow-service)
ALLOWED_SERVICES_LIST[${#ALLOWED_SERVICES_LIST[@]}]="$2" ALLOWED_SERVICES_LIST[${#ALLOWED_SERVICES_LIST[@]}]="$2"
shift shift
@ -156,7 +164,7 @@ while [[ $# > 0 ]]; do
done done
# if no RUN_MODE was passed, usage and quit # if no RUN_MODE was passed, usage and quit
if [ "$AUDIT" -eq 0 -a "$AUDIT_ALL" -eq 0 -a "$AUDIT_ALL_ENABLE_PASSED" -eq 0 -a "$APPLY" -eq 0 ]; then if [ "$AUDIT" -eq 0 -a "$AUDIT_ALL" -eq 0 -a "$AUDIT_ALL_ENABLE_PASSED" -eq 0 -a "$APPLY" -eq 0 -a "$CREATE_CONFIG" -eq 0 ]; then
usage usage
fi fi
@ -210,6 +218,11 @@ if [ -n "$SET_HARDENING_LEVEL" -a "$SET_HARDENING_LEVEL" != 0 ] ; then
exit 0 exit 0
fi fi
if [ $CREATE_CONFIG = 1 ] && [ "$EUID" -ne 0 ]; then
echo "For --create-config-files-only, please run as root"
exit 1
fi
# Parse every scripts and execute them in the required mode # Parse every scripts and execute them in the required mode
for SCRIPT in $(ls $CIS_ROOT_DIR/bin/hardening/*.sh -v); do for SCRIPT in $(ls $CIS_ROOT_DIR/bin/hardening/*.sh -v); do
if [ ${#TEST_LIST[@]} -gt 0 ] ; then if [ ${#TEST_LIST[@]} -gt 0 ] ; then
@ -223,8 +236,10 @@ for SCRIPT in $(ls $CIS_ROOT_DIR/bin/hardening/*.sh -v); do
fi fi
info "Treating $SCRIPT" info "Treating $SCRIPT"
if [ $CREATE_CONFIG = 1 ]; then
if [ $AUDIT = 1 ]; then debug "$CIS_ROOT_DIR/bin/hardening/$SCRIPT --create-config-files-only"
$SCRIPT --create-config-files-only $BATCH_MODE
elif [ $AUDIT = 1 ]; then
debug "$CIS_ROOT_DIR/bin/hardening/$SCRIPT --audit $SUDO_MODE $BATCH_MODE" debug "$CIS_ROOT_DIR/bin/hardening/$SCRIPT --audit $SUDO_MODE $BATCH_MODE"
$SCRIPT --audit $SUDO_MODE $BATCH_MODE $SCRIPT --audit $SUDO_MODE $BATCH_MODE
elif [ $AUDIT_ALL = 1 ]; then elif [ $AUDIT_ALL = 1 ]; then
@ -273,7 +288,8 @@ if [ $BATCH_MODE ]; then
BATCH_SUMMARY+="RUN_CHECKS:${TOTAL_TREATED_CHECKS:-0} " BATCH_SUMMARY+="RUN_CHECKS:${TOTAL_TREATED_CHECKS:-0} "
BATCH_SUMMARY+="TOTAL_CHECKS_AVAIL:${TOTAL_CHECKS:-0}" BATCH_SUMMARY+="TOTAL_CHECKS_AVAIL:${TOTAL_CHECKS:-0}"
if [ $TOTAL_TREATED_CHECKS != 0 ]; then if [ $TOTAL_TREATED_CHECKS != 0 ]; then
BATCH_SUMMARY+=" CONFORMITY_PERCENTAGE:$(printf "%.2f" $( echo "($PASSED_CHECKS/$TOTAL_TREATED_CHECKS) * 100" | bc -l))" CONFORMITY_PERCENTAGE=$(bc -l <<< "scale=2; ($PASSED_CHECKS/$TOTAL_TREATED_CHECKS) * 100")
BATCH_SUMMARY+=" CONFORMITY_PERCENTAGE:$(printf "%s" "$CONFORMITY_PERCENTAGE")"
else else
BATCH_SUMMARY+=" CONFORMITY_PERCENTAGE:N.A" # No check runned, avoid division by 0 BATCH_SUMMARY+=" CONFORMITY_PERCENTAGE:N.A" # No check runned, avoid division by 0
fi fi
@ -284,9 +300,12 @@ else
printf "%30s %s\n" "Total Runned Checks :" "$TOTAL_TREATED_CHECKS" printf "%30s %s\n" "Total Runned Checks :" "$TOTAL_TREATED_CHECKS"
printf "%30s [ %7s ]\n" "Total Passed Checks :" "$PASSED_CHECKS/$TOTAL_TREATED_CHECKS" printf "%30s [ %7s ]\n" "Total Passed Checks :" "$PASSED_CHECKS/$TOTAL_TREATED_CHECKS"
printf "%30s [ %7s ]\n" "Total Failed Checks :" "$FAILED_CHECKS/$TOTAL_TREATED_CHECKS" printf "%30s [ %7s ]\n" "Total Failed Checks :" "$FAILED_CHECKS/$TOTAL_TREATED_CHECKS"
printf "%30s %.2f %%\n" "Enabled Checks Percentage :" "$( echo "($TOTAL_TREATED_CHECKS/$TOTAL_CHECKS) * 100" | bc -l)"
ENABLED_CHECKS_PERCENTAGE=$(bc -l <<< "scale=2; ($TOTAL_TREATED_CHECKS/$TOTAL_CHECKS) * 100")
CONFORMITY_PERCENTAGE=$(bc -l <<< "scale=2; ($PASSED_CHECKS/$TOTAL_TREATED_CHECKS) * 100")
printf "%30s %s %%\n" "Enabled Checks Percentage :" "$ENABLED_CHECKS_PERCENTAGE"
if [ $TOTAL_TREATED_CHECKS != 0 ]; then if [ $TOTAL_TREATED_CHECKS != 0 ]; then
printf "%30s %.2f %%\n" "Conformity Percentage :" "$( echo "($PASSED_CHECKS/$TOTAL_TREATED_CHECKS) * 100" | bc -l)" printf "%30s %s %%\n" "Conformity Percentage :" "$CONFORMITY_PERCENTAGE"
else else
printf "%30s %s %%\n" "Conformity Percentage :" "N.A" # No check runned, avoid division by 0 printf "%30s %s %%\n" "Conformity Percentage :" "N.A" # No check runned, avoid division by 0
fi fi

View File

@ -5,7 +5,7 @@
# #
# #
# 2.19 Disable Mounting of freevxfs Filesystems (Not Scored) # 1.1.1.1 Disable Mounting of freevxfs Filesystems (Not Scored)
# #
set -e # One error, it's over set -e # One error, it's over
@ -26,7 +26,6 @@ audit () {
else else
ok "$KERNEL_OPTION is disabled" ok "$KERNEL_OPTION is disabled"
fi fi
:
} }
# This function will be called if the script status is on enabled mode # This function will be called if the script status is on enabled mode
@ -37,7 +36,6 @@ apply () {
else else
ok "$KERNEL_OPTION is disabled, nothing to do" ok "$KERNEL_OPTION is disabled, nothing to do"
fi fi
:
} }
# This function will check config parameters required # This function will check config parameters required

View File

@ -5,7 +5,7 @@
# #
# #
# 2.20 Disable Mounting of jffs2 Filesystems (Not Scored) # 1.1.1.2 Disable Mounting of jffs2 Filesystems (Not Scored)
# #
set -e # One error, it's over set -e # One error, it's over
@ -26,7 +26,6 @@ audit () {
else else
ok "$KERNEL_OPTION is disabled" ok "$KERNEL_OPTION is disabled"
fi fi
:
} }
# This function will be called if the script status is on enabled mode # This function will be called if the script status is on enabled mode
@ -37,7 +36,6 @@ apply () {
else else
ok "$KERNEL_OPTION is disabled, nothing to do" ok "$KERNEL_OPTION is disabled, nothing to do"
fi fi
:
} }
# This function will check config parameters required # This function will check config parameters required

View File

@ -5,7 +5,7 @@
# #
# #
# 2.21 Disable Mounting of hfs Filesystems (Not Scored) # 1.1.1.3 Disable Mounting of hfs Filesystems (Not Scored)
# #
set -e # One error, it's over set -e # One error, it's over
@ -26,7 +26,6 @@ audit () {
else else
ok "$KERNEL_OPTION is disabled" ok "$KERNEL_OPTION is disabled"
fi fi
:
} }
# This function will be called if the script status is on enabled mode # This function will be called if the script status is on enabled mode
@ -37,7 +36,6 @@ apply () {
else else
ok "$KERNEL_OPTION is disabled, nothing to do" ok "$KERNEL_OPTION is disabled, nothing to do"
fi fi
:
} }
# This function will check config parameters required # This function will check config parameters required

View File

@ -5,7 +5,7 @@
# #
# #
# 2.22 Disable Mounting of hfsplus Filesystems (Not Scored) # 1.1.1.4 Disable Mounting of hfsplus Filesystems (Not Scored)
# #
set -e # One error, it's over set -e # One error, it's over
@ -26,7 +26,6 @@ audit () {
else else
ok "$KERNEL_OPTION is disabled" ok "$KERNEL_OPTION is disabled"
fi fi
:
} }
# This function will be called if the script status is on enabled mode # This function will be called if the script status is on enabled mode
@ -37,7 +36,6 @@ apply () {
else else
ok "$KERNEL_OPTION is disabled, nothing to do" ok "$KERNEL_OPTION is disabled, nothing to do"
fi fi
:
} }
# This function will check config parameters required # This function will check config parameters required

View File

@ -5,7 +5,7 @@
# #
# #
# 2.24 Disable Mounting of udf Filesystems (Not Scored) # 1.1.1.5 Disable Mounting of udf Filesystems (Not Scored)
# #
set -e # One error, it's over set -e # One error, it's over
@ -26,7 +26,6 @@ audit () {
else else
ok "$KERNEL_OPTION is disabled" ok "$KERNEL_OPTION is disabled"
fi fi
:
} }
# This function will be called if the script status is on enabled mode # This function will be called if the script status is on enabled mode
@ -37,7 +36,6 @@ apply () {
else else
ok "$KERNEL_OPTION is disabled, nothing to do" ok "$KERNEL_OPTION is disabled, nothing to do"
fi fi
:
} }
# This function will check config parameters required # This function will check config parameters required

View File

@ -5,7 +5,7 @@
# #
# #
# 2.18 Disable Mounting of cramfs Filesystems (Not Scored) # 1.1.1.6 Disable Mounting of cramfs Filesystems (Not Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -5,7 +5,7 @@
# #
# #
# 2.23 Disable Mounting of squashfs Filesystems (Not Scored) # 1.1.1.7 Disable Mounting of squashfs Filesystems (Not Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -5,7 +5,7 @@
# #
# #
# 2.6.4 Set noexec option for /var/tmp Partition (Scored) # 1.1.10 Ensure noexec option set on /var/tmp partition (Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -5,7 +5,7 @@
# #
# #
# 2.7 Create Separate Partition for /var/log (Scored) # 1.1.11 Create Separate Partition for /var/log (Scored)
# #
set -e # One error, it's over set -e # One error, it's over
@ -35,8 +35,6 @@ audit () {
ok "$PARTITION is mounted" ok "$PARTITION is mounted"
fi fi
fi fi
:
} }
# This function will be called if the script status is on enabled mode # This function will be called if the script status is on enabled mode

View File

@ -5,7 +5,7 @@
# #
# #
# 2.8 Create Separate Partition for /var/log/audit (Scored) # 1.1.12 Create Separate Partition for /var/log/audit (Scored)
# #
set -e # One error, it's over set -e # One error, it's over
@ -35,8 +35,6 @@ audit () {
ok "$PARTITION is mounted" ok "$PARTITION is mounted"
fi fi
fi fi
:
} }
# This function will be called if the script status is on enabled mode # This function will be called if the script status is on enabled mode

View File

@ -5,7 +5,7 @@
# #
# #
# 2.9 Create Separate Partition for /home (Scored) # 1.1.13 Create Separate Partition for /home (Scored)
# #
set -e # One error, it's over set -e # One error, it's over
@ -35,8 +35,6 @@ audit () {
ok "$PARTITION is mounted" ok "$PARTITION is mounted"
fi fi
fi fi
:
} }
# This function will be called if the script status is on enabled mode # This function will be called if the script status is on enabled mode

View File

@ -5,7 +5,7 @@
# #
# #
# 2.10 Add nodev Option to /home (Scored) # 1.1.14 Ensure nodev Option set on /home (Scored)
# #
set -e # One error, it's over set -e # One error, it's over
@ -37,11 +37,11 @@ audit () {
has_mounted_option $PARTITION $OPTION has_mounted_option $PARTITION $OPTION
if [ $FNRET -gt 0 ]; then if [ $FNRET -gt 0 ]; then
warn "$PARTITION is not mounted with $OPTION at runtime" warn "$PARTITION is not mounted with $OPTION at runtime"
FNRET=3 FNRET=3
else else
ok "$PARTITION mounted with $OPTION" ok "$PARTITION mounted with $OPTION"
fi fi
fi fi
fi fi
} }
@ -59,7 +59,7 @@ apply () {
elif [ $FNRET = 3 ]; then elif [ $FNRET = 3 ]; then
info "Remounting $PARTITION from fstab" info "Remounting $PARTITION from fstab"
remount_partition $PARTITION remount_partition $PARTITION
fi fi
} }
# This function will check config parameters required # This function will check config parameters required

View File

@ -6,7 +6,7 @@
# #
# #
# 2.14 Add nodev Option to /run/shm Partition (Scored) # 1.1.15 Ensure nodev option set on /dev/shm partition (Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -6,7 +6,7 @@
# #
# #
# 2.15 Add nosuid Option to /run/shm Partition (Scored) # 1.1.16 Ensure nosuid Option set on /run/shm Partition (Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -6,7 +6,7 @@
# #
# #
# 2.16 Add noexec Option to /run/shm Partition (Scored) # 1.1.17 Ensure noexec Option set on /run/shm Partition (Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -5,7 +5,7 @@
# #
# #
# 2.11 Add nodev Option to Removable Media Partitions (Not Scored) # 1.1.18 Add nodev Option to Removable Media Partitions (Not Scored)
# #
set -e # One error, it's over set -e # One error, it's over
@ -36,7 +36,7 @@ audit () {
FNRET=1 FNRET=1
else else
ok "$PARTITION has $OPTION in fstab" ok "$PARTITION has $OPTION in fstab"
fi fi
fi fi
} }
@ -47,7 +47,7 @@ apply () {
elif [ $FNRET = 1 ]; then elif [ $FNRET = 1 ]; then
info "Adding $OPTION to fstab" info "Adding $OPTION to fstab"
add_option_to_fstab $PARTITION $OPTION add_option_to_fstab $PARTITION $OPTION
fi fi
} }
# This function will check config parameters required # This function will check config parameters required

View File

@ -5,7 +5,7 @@
# #
# #
# 2.13 Add nosuid Option to Removable Media Partitions (Not Scored) # 1.1.19 Ensure nosuid Option set on Removable Media Partitions (Not Scored)
# #
set -e # One error, it's over set -e # One error, it's over
@ -36,7 +36,7 @@ audit () {
FNRET=1 FNRET=1
else else
ok "$PARTITION has $OPTION in fstab" ok "$PARTITION has $OPTION in fstab"
fi fi
fi fi
} }
@ -47,7 +47,7 @@ apply () {
elif [ $FNRET = 1 ]; then elif [ $FNRET = 1 ]; then
info "Adding $OPTION to fstab" info "Adding $OPTION to fstab"
add_option_to_fstab $PARTITION $OPTION add_option_to_fstab $PARTITION $OPTION
fi fi
} }
# This function will check config parameters required # This function will check config parameters required

View File

@ -5,7 +5,7 @@
# #
# #
# 2.12 Add noexec Option to Removable Media Partitions (Not Scored) # 1.1.20 Ensure noexec Option set on Removable Media Partitions (Not Scored)
# #
set -e # One error, it's over set -e # One error, it's over
@ -36,7 +36,7 @@ audit () {
FNRET=1 FNRET=1
else else
ok "$PARTITION has $OPTION in fstab" ok "$PARTITION has $OPTION in fstab"
fi fi
fi fi
} }
@ -47,7 +47,7 @@ apply () {
elif [ $FNRET = 1 ]; then elif [ $FNRET = 1 ]; then
info "Adding $OPTION to fstab" info "Adding $OPTION to fstab"
add_option_to_fstab $PARTITION $OPTION add_option_to_fstab $PARTITION $OPTION
fi fi
} }
# This function will check config parameters required # This function will check config parameters required

View File

@ -5,7 +5,7 @@
# #
# #
# 2.17 Set Sticky Bit on All World-Writable Directories (Scored) # 1.1.21 Ensure Sticky Bit set on All World-Writable Directories (Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -5,7 +5,7 @@
# #
# #
# 2.25 Disable Automounting (Scored) # 1.1.22 Disable Automounting (Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -5,14 +5,14 @@
# #
# #
# 2.1 Create Separate Partition for /tmp (Scored) # 1.1.2 Ensure /tmp is configured (Scored)
# #
set -e # One error, it's over set -e # One error, it's over
set -u # One variable unset, it's over set -u # One variable unset, it's over
HARDENING_LEVEL=3 HARDENING_LEVEL=3
DESCRIPTION="/tmp on a separate partition." DESCRIPTION="Ensure /tmp is configured (Scored)"
# Quick factoring as many script use the same logic # Quick factoring as many script use the same logic
PARTITION="/tmp" PARTITION="/tmp"
@ -35,8 +35,6 @@ audit () {
ok "$PARTITION is mounted" ok "$PARTITION is mounted"
fi fi
fi fi
:
} }
# This function will be called if the script status is on enabled mode # This function will be called if the script status is on enabled mode

View File

@ -5,7 +5,7 @@
# #
# #
# 2.2 Set nodev option for /tmp Partition (Scored) # 1.1.3 Ensure nodev option set for /tmp Partition (Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -5,7 +5,7 @@
# #
# #
# 2.3 Set nosuid option for /tmp Partition (Scored) # 1.1.4 Ensure nosuid option set for /tmp Partition (Scored)
# #
set -e # One error, it's over set -e # One error, it's over
@ -37,11 +37,11 @@ audit () {
has_mounted_option $PARTITION $OPTION has_mounted_option $PARTITION $OPTION
if [ $FNRET -gt 0 ]; then if [ $FNRET -gt 0 ]; then
warn "$PARTITION is not mounted with $OPTION at runtime" warn "$PARTITION is not mounted with $OPTION at runtime"
FNRET=3 FNRET=3
else else
ok "$PARTITION mounted with $OPTION" ok "$PARTITION mounted with $OPTION"
fi fi
fi fi
fi fi
} }
@ -59,7 +59,7 @@ apply () {
elif [ $FNRET = 3 ]; then elif [ $FNRET = 3 ]; then
info "Remounting $PARTITION from fstab" info "Remounting $PARTITION from fstab"
remount_partition $PARTITION remount_partition $PARTITION
fi fi
} }
# This function will check config parameters required # This function will check config parameters required

View File

@ -5,7 +5,7 @@
# #
# #
# 2.4 Set noexec option for /tmp Partition (Scored) # 1.1.5 Ensure noexec option set for /tmp Partition (Scored)
# #
set -e # One error, it's over set -e # One error, it's over
@ -37,11 +37,11 @@ audit () {
has_mounted_option $PARTITION $OPTION has_mounted_option $PARTITION $OPTION
if [ $FNRET -gt 0 ]; then if [ $FNRET -gt 0 ]; then
warn "$PARTITION is not mounted with $OPTION at runtime" warn "$PARTITION is not mounted with $OPTION at runtime"
FNRET=3 FNRET=3
else else
ok "$PARTITION mounted with $OPTION" ok "$PARTITION mounted with $OPTION"
fi fi
fi fi
fi fi
} }
@ -59,7 +59,7 @@ apply () {
elif [ $FNRET = 3 ]; then elif [ $FNRET = 3 ]; then
info "Remounting $PARTITION from fstab" info "Remounting $PARTITION from fstab"
remount_partition $PARTITION remount_partition $PARTITION
fi fi
} }
# This function will check config parameters required # This function will check config parameters required

View File

@ -5,7 +5,7 @@
# #
# #
# 2.5 Create Separate Partition for /var (Scored) # 1.1.6 Create Separate Partition for /var (Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -5,7 +5,7 @@
# #
# #
# 2.6.1 Create Separate Partition for /var/tmp (Scored) # 1.1.7 Ensure separate partition exists for /var/tmp (Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -5,7 +5,7 @@
# #
# #
# 2.6.2 Set nodev option for /var/tmp Partition (Scored) # 1.1.8 Ensure nodev option set on /var/tmp partition (Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -5,7 +5,7 @@
# #
# #
# 2.6.3 Set nosuid option for /var/tmp Partition (Scored) # 1.1.9 Ensure nosuid option set on /var/tmp partition (Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -0,0 +1,101 @@
#!/bin/bash
#
# CIS Debian Hardening
#
#
# 1.4.1 Ensure permissions on bootloader config are configured (Scored)
#
set -e # One error, it's over
set -u # One variable unset, it's over
HARDENING_LEVEL=1
DESCRIPTION="User and group root owner of grub bootloader config."
# Assertion : Grub Based.
FILE='/boot/grub/grub.cfg'
USER='root'
GROUP='root'
PERMISSIONS='400'
# This function will be called if the script status is on enabled / audit mode
audit () {
has_file_correct_ownership $FILE $USER $GROUP
if [ $FNRET = 0 ]; then
ok "$FILE has correct ownership"
else
crit "$FILE ownership was not set to $USER:$GROUP"
fi
has_file_correct_permissions $FILE $PERMISSIONS
if [ $FNRET = 0 ]; then
ok "$FILE has correct permissions"
else
crit "$FILE permissions were not set to $PERMISSIONS"
fi
}
# This function will be called if the script status is on enabled mode
apply () {
has_file_correct_ownership $FILE $USER $GROUP
if [ $FNRET = 0 ]; then
ok "$FILE has correct ownership"
else
info "fixing $FILE ownership to $USER:$GROUP"
chown $USER:$GROUP $FILE
fi
has_file_correct_permissions $FILE $PERMISSIONS
if [ $FNRET = 0 ]; then
ok "$FILE has correct permissions"
else
info "fixing $FILE permissions to $PERMISSIONS"
chmod 0$PERMISSIONS $FILE
fi
}
# This function will check config parameters required
check_config() {
is_pkg_installed "grub-pc"
if [ $FNRET != 0 ]; then
warn "Grub is not installed, not handling configuration"
exit 128
fi
does_user_exist $USER
if [ $FNRET != 0 ]; then
crit "$USER does not exist"
exit 128
fi
does_group_exist $GROUP
if [ $FNRET != 0 ]; then
crit "$GROUP does not exist"
exit 128
fi
does_file_exist $FILE
if [ $FNRET != 0 ]; then
crit "$FILE does not exist"
exit 128
fi
}
# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
. /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
echo "Cannot source CIS_ROOT_DIR variable, aborting."
exit 128
fi
# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
. $CIS_ROOT_DIR/lib/main.sh
else
echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
exit 128
fi

View File

@ -5,7 +5,7 @@
# #
# #
# 3.3 Set Boot Loader Password (Scored) # 1.4.2 Ensure bootloader password is set (Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -5,7 +5,7 @@
# #
# #
# 3.4 Require Authentication for Single-User Mode (Scored) # 1.4.3 Ensure authentication required for single user mode (Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -5,7 +5,7 @@
# #
# #
# 4.1 Restrict Core Dumps (Scored) # 1.5.1 Ensure core dumps are restricted (Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -5,7 +5,7 @@
# #
# #
# 4.2 Enable XD/NX Support on 32-bit x86 Systems (Not Scored) # 1.5.2 Ensure XD/NX support is enabled (Not Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -5,7 +5,7 @@
# #
# #
# 4.3 Enable Randomized Virtual Memory Region Placement (Scored) # 1.5.3 Ensure address space layout randomization (ASLR) is enabled (Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -5,7 +5,7 @@
# #
# #
# 4.4 Disable Prelink (Scored) # 1.5.4 Ensure prelink is disabled (Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -0,0 +1,101 @@
#!/bin/bash
#
# CIS Debian Hardening
#
#
# 1.6.2.1 Activate AppArmor (Scored)
#
set -e # One error, it's over
set -u # One variable unset, it's over
HARDENING_LEVEL=3
DESCRIPTION="Activate AppArmor to enforce permissions control."
PACKAGE='apparmor'
# This function will be called if the script status is on enabled / audit mode
audit () {
is_pkg_installed $PACKAGE
if [ $FNRET != 0 ]; then
crit "$PACKAGE is absent!"
else
ok "$PACKAGE is installed"
fi
ERROR=0
RESULT=$($SUDO_CMD grep "^\s*linux" /boot/grub/grub.cfg)
# define custom IFS and save default one
d_IFS=$IFS
c_IFS=$'\n'
IFS=$c_IFS
for line in $RESULT; do
if [[ ! $line =~ "apparmor=1" ]] || [[ ! $line =~ "security=apparmor" ]]; then
crit "$line is not configured"
ERROR=1
fi
done
IFS=$d_IFS
if [ $ERROR = 0 ]; then
ok "$PACKAGE is configured"
fi
}
# This function will be called if the script status is on enabled mode
apply () {
is_pkg_installed $PACKAGE
if [ $FNRET != 0 ]; then
crit "$PACKAGE is not installed, please install $PACKAGE and configure it"
else
ok "$PACKAGE is installed"
fi
ERROR=0
RESULT=$($SUDO_CMD grep "^\s*linux" /boot/grub/grub.cfg)
# define custom IFS and save default one
d_IFS=$IFS
c_IFS=$'\n'
IFS=$c_IFS
for line in $RESULT; do
if [[ ! $line =~ "apparmor=1" ]] || [[ ! $line =~ "security=apparmor" ]]; then
crit "$line is not configured"
ERROR=1
fi
done
IFS=$d_IFS
if [ $ERROR = 1 ]; then
$SUDO_CMD sed -i "s/GRUB_CMDLINE_LINUX=\"/GRUB_CMDLINE_LINUX=\"apparmor=1 security=apparmor/" /etc/default/grub
$SUDO_CMD update-grub
else
ok "$PACKAGE is configured"
fi
}
# This function will check config parameters required
check_config() {
:
}
# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
. /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
echo "Cannot source CIS_ROOT_DIR variable, aborting."
exit 128
fi
# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
. $CIS_ROOT_DIR/lib/main.sh
else
echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
exit 128
fi

View File

@ -0,0 +1,62 @@
#!/bin/bash
#
# CIS Debian Hardening
#
#
# 1.7.1.1 Ensure message of the day is configured properly (Scored)
#
set -e # One error, it's over
set -u # One variable unset, it's over
HARDENING_LEVEL=3
DESCRIPTION="Remove OS information from motd"
FILE='/etc/motd'
PATTERN='(\\v|\\r|\\m|\\s)'
# This function will be called if the script status is on enabled / audit mode
audit () {
does_pattern_exist_in_file $FILE "$PATTERN"
if [ $FNRET = 0 ]; then
crit "$PATTERN is present in $FILE"
else
ok "$PATTERN is not present in $FILE"
fi
}
# This function will be called if the script status is on enabled mode
apply () {
does_pattern_exist_in_file $FILE "$PATTERN"
if [ $FNRET = 0 ]; then
warn "$PATTERN is present in $FILE"
delete_line_in_file $FILE $PATTERN
else
ok "$PATTERN is not present in $FILE"
fi
}
# This function will check config parameters required
check_config() {
:
}
# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
. /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
echo "Cannot source CIS_ROOT_DIR variable, aborting."
exit 128
fi
# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
. $CIS_ROOT_DIR/lib/main.sh
else
echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
exit 128
fi

View File

@ -0,0 +1,62 @@
#!/bin/bash
#
# CIS Debian Hardening
#
#
# 1.7.1.2 Ensure local login warning banner is configured properly (Scored)
#
set -e # One error, it's over
set -u # One variable unset, it's over
HARDENING_LEVEL=3
DESCRIPTION="Remove OS information from Login Warning Banners."
FILE='/etc/issue'
PATTERN='(\\v|\\r|\\m|\\s)'
# This function will be called if the script status is on enabled / audit mode
audit () {
does_pattern_exist_in_file $FILE "$PATTERN"
if [ $FNRET = 0 ]; then
crit "$PATTERN is present in $FILE"
else
ok "$PATTERN is not present in $FILE"
fi
}
# This function will be called if the script status is on enabled mode
apply () {
does_pattern_exist_in_file $FILE "$PATTERN"
if [ $FNRET = 0 ]; then
warn "$PATTERN is present in $FILE"
delete_line_in_file $FILE $PATTERN
else
ok "$PATTERN is not present in $FILE"
fi
}
# This function will check config parameters required
check_config() {
:
}
# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
. /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
echo "Cannot source CIS_ROOT_DIR variable, aborting."
exit 128
fi
# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
. $CIS_ROOT_DIR/lib/main.sh
else
echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
exit 128
fi

View File

@ -0,0 +1,62 @@
#!/bin/bash
#
# CIS Debian Hardening
#
#
# 1.7.1.3 Ensure remote login warning banner is configured properly (Scored)
#
set -e # One error, it's over
set -u # One variable unset, it's over
HARDENING_LEVEL=3
DESCRIPTION="Remove OS information from remote Login Warning Banners."
FILE='/etc/issue.net'
PATTERN='(\\v|\\r|\\m|\\s)'
# This function will be called if the script status is on enabled / audit mode
audit () {
does_pattern_exist_in_file $FILE "$PATTERN"
if [ $FNRET = 0 ]; then
crit "$PATTERN is present in $FILE"
else
ok "$PATTERN is not present in $FILE"
fi
}
# This function will be called if the script status is on enabled mode
apply () {
does_pattern_exist_in_file $FILE "$PATTERN"
if [ $FNRET = 0 ]; then
warn "$PATTERN is present in $FILE"
delete_line_in_file $FILE $PATTERN
else
ok "$PATTERN is not present in $FILE"
fi
}
# This function will check config parameters required
check_config() {
:
}
# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
. /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
echo "Cannot source CIS_ROOT_DIR variable, aborting."
exit 128
fi
# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
. $CIS_ROOT_DIR/lib/main.sh
else
echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
exit 128
fi

View File

@ -0,0 +1,87 @@
#!/bin/bash
#
# CIS Debian Hardening
#
#
# 1.7.1.4 Ensure permissions on /etc/motd are configured (Scored)
#
set -e # One error, it's over
set -u # One variable unset, it's over
HARDENING_LEVEL=3
DESCRIPTION="Checking root ownership and 644 permissions on banner files: /etc/motd|issue|issue.net ."
PERMISSIONS='644'
USER='root'
GROUP='root'
FILE='/etc/motd'
# This function will be called if the script status is on enabled / audit mode
audit () {
does_file_exist $FILE
if [ $FNRET != 0 ]; then
crit "$FILE does not exist"
continue
fi
has_file_correct_ownership $FILE $USER $GROUP
if [ $FNRET = 0 ]; then
ok "$FILE has correct ownership"
else
crit "$FILE ownership was not set to $USER:$GROUP"
fi
has_file_correct_permissions $FILE $PERMISSIONS
if [ $FNRET = 0 ]; then
ok "$FILE has correct permissions"
else
crit "$FILE permissions were not set to $PERMISSIONS"
fi
}
# This function will be called if the script status is on enabled mode
apply () {
does_file_exist $FILE
if [ $FNRET != 0 ]; then
info "$FILE does not exist"
touch $FILE
fi
has_file_correct_ownership $FILE $USER $GROUP
if [ $FNRET = 0 ]; then
ok "$FILE has correct ownership"
else
warn "fixing $FILE ownership to $USER:$GROUP"
chown $USER:$GROUP $FILE
fi
has_file_correct_permissions $FILE $PERMISSIONS
if [ $FNRET = 0 ]; then
ok "$FILE has correct permissions"
else
info "fixing $FILE permissions to $PERMISSIONS"
chmod 0$PERMISSIONS $FILE
fi
}
# This function will check config parameters required
check_config() {
:
}
# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
. /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
echo "Cannot source CIS_ROOT_DIR variable, aborting."
exit 128
fi
# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
. $CIS_ROOT_DIR/lib/main.sh
else
echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
exit 128
fi

View File

@ -0,0 +1,87 @@
#!/bin/bash
#
# CIS Debian Hardening
#
#
# 1.7.1.5 Ensure permissions on /etc/issue are configured (Scored)
#
set -e # One error, it's over
set -u # One variable unset, it's over
HARDENING_LEVEL=3
DESCRIPTION="Checking root ownership and 644 permissions on banner files: /etc/motd|issue|issue.net ."
PERMISSIONS='644'
USER='root'
GROUP='root'
FILE='/etc/issue'
# This function will be called if the script status is on enabled / audit mode
audit () {
does_file_exist $FILE
if [ $FNRET != 0 ]; then
crit "$FILE does not exist"
continue
fi
has_file_correct_ownership $FILE $USER $GROUP
if [ $FNRET = 0 ]; then
ok "$FILE has correct ownership"
else
crit "$FILE ownership was not set to $USER:$GROUP"
fi
has_file_correct_permissions $FILE $PERMISSIONS
if [ $FNRET = 0 ]; then
ok "$FILE has correct permissions"
else
crit "$FILE permissions were not set to $PERMISSIONS"
fi
}
# This function will be called if the script status is on enabled mode
apply () {
does_file_exist $FILE
if [ $FNRET != 0 ]; then
info "$FILE does not exist"
touch $FILE
fi
has_file_correct_ownership $FILE $USER $GROUP
if [ $FNRET = 0 ]; then
ok "$FILE has correct ownership"
else
warn "fixing $FILE ownership to $USER:$GROUP"
chown $USER:$GROUP $FILE
fi
has_file_correct_permissions $FILE $PERMISSIONS
if [ $FNRET = 0 ]; then
ok "$FILE has correct permissions"
else
info "fixing $FILE permissions to $PERMISSIONS"
chmod 0$PERMISSIONS $FILE
fi
}
# This function will check config parameters required
check_config() {
:
}
# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
. /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
echo "Cannot source CIS_ROOT_DIR variable, aborting."
exit 128
fi
# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
. $CIS_ROOT_DIR/lib/main.sh
else
echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
exit 128
fi

View File

@ -0,0 +1,87 @@
#!/bin/bash
#
# CIS Debian Hardening
#
#
# 1.7.1.6 Ensure permissions on /etc/issue.net are configured (Scored)
#
set -e # One error, it's over
set -u # One variable unset, it's over
HARDENING_LEVEL=3
DESCRIPTION="Checking root ownership and 644 permissions on banner files: /etc/motd|issue|issue.net ."
PERMISSIONS='644'
USER='root'
GROUP='root'
FILE='/etc/issue.net'
# This function will be called if the script status is on enabled / audit mode
audit () {
does_file_exist $FILE
if [ $FNRET != 0 ]; then
crit "$FILE does not exist"
continue
fi
has_file_correct_ownership $FILE $USER $GROUP
if [ $FNRET = 0 ]; then
ok "$FILE has correct ownership"
else
crit "$FILE ownership was not set to $USER:$GROUP"
fi
has_file_correct_permissions $FILE $PERMISSIONS
if [ $FNRET = 0 ]; then
ok "$FILE has correct permissions"
else
crit "$FILE permissions were not set to $PERMISSIONS"
fi
}
# This function will be called if the script status is on enabled mode
apply () {
does_file_exist $FILE
if [ $FNRET != 0 ]; then
info "$FILE does not exist"
touch $FILE
fi
has_file_correct_ownership $FILE $USER $GROUP
if [ $FNRET = 0 ]; then
ok "$FILE has correct ownership"
else
warn "fixing $FILE ownership to $USER:$GROUP"
chown $USER:$GROUP $FILE
fi
has_file_correct_permissions $FILE $PERMISSIONS
if [ $FNRET = 0 ]; then
ok "$FILE has correct permissions"
else
info "fixing $FILE permissions to $PERMISSIONS"
chmod 0$PERMISSIONS $FILE
fi
}
# This function will check config parameters required
check_config() {
:
}
# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
. /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
echo "Cannot source CIS_ROOT_DIR variable, aborting."
exit 128
fi
# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
. $CIS_ROOT_DIR/lib/main.sh
else
echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
exit 128
fi

View File

@ -5,7 +5,7 @@
# #
# #
# 11.3 Set Graphical Warning Banner (Not Scored) # 1.7.2 Ensure GDM login banner is configured (Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -5,14 +5,14 @@
# #
# #
# 1.1 Install Updates, Patches and Additional Security Software (Not Scored) # 1.8 Ensure updates, patches and additional security software are installed (Not Scored)
# #
set -e # One error, it's over set -e # One error, it's over
set -u # One variable unset, it's over set -u # One variable unset, it's over
HARDENING_LEVEL=3 HARDENING_LEVEL=3
DESCRIPTION="Install updates, patches and additional secutiry software." DESCRIPTION="Ensure updates, patches, and additional security software are installed (Not Scored)"
# This function will be called if the script status is on enabled / audit mode # This function will be called if the script status is on enabled / audit mode
audit () { audit () {

View File

@ -1,66 +0,0 @@
#!/bin/bash
#
# CIS Debian Hardening
#
#
# 11.2 Remove OS Information from Login Warning Banners (Scored)
#
set -e # One error, it's over
set -u # One variable unset, it's over
HARDENING_LEVEL=3
DESCRIPTION="Remove OS information from Login Warning Banners."
FILES='/etc/motd /etc/issue /etc/issue.net'
PATTERN='(\\v|\\r|\\m|\\s)'
# This function will be called if the script status is on enabled / audit mode
audit () {
for FILE in $FILES; do
does_pattern_exist_in_file $FILE "$PATTERN"
if [ $FNRET = 0 ]; then
crit "$PATTERN is present in $FILE"
else
ok "$PATTERN is not present in $FILE"
fi
done
}
# This function will be called if the script status is on enabled mode
apply () {
for FILE in $FILES; do
does_pattern_exist_in_file $FILE "$PATTERN"
if [ $FNRET = 0 ]; then
warn "$PATTERN is present in $FILE"
delete_line_in_file $FILE $PATTERN
else
ok "$PATTERN is not present in $FILE"
fi
done
}
# This function will check config parameters required
check_config() {
:
}
# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
. /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
echo "Cannot source CIS_ROOT_DIR variable, aborting."
exit 128
fi
# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
. $CIS_ROOT_DIR/lib/main.sh
else
echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
exit 128
fi

View File

@ -1,62 +0,0 @@
#!/bin/bash
#
# CIS Debian Hardening
#
#
# 12.1 Verify Permissions on /etc/passwd (Scored)
#
set -e # One error, it's over
set -u # One variable unset, it's over
HARDENING_LEVEL=1
DESCRIPTION="Check permissions on /etc/passwd to 644."
FILE='/etc/passwd'
PERMISSIONS='644'
# This function will be called if the script status is on enabled / audit mode
audit () {
has_file_correct_permissions $FILE $PERMISSIONS
if [ $FNRET = 0 ]; then
ok "$FILE has correct permissions"
else
crit "$FILE permissions were not set to $PERMISSIONS"
fi
}
# This function will be called if the script status is on enabled mode
apply () {
has_file_correct_permissions $FILE $PERMISSIONS
if [ $FNRET = 0 ]; then
ok "$FILE has correct permissions"
else
info "fixing $FILE permissions to $PERMISSIONS"
chmod 0$PERMISSIONS $FILE
fi
}
# This function will check config parameters required
check_config() {
:
}
# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
. /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
echo "Cannot source CIS_ROOT_DIR variable, aborting."
exit 128
fi
# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
. $CIS_ROOT_DIR/lib/main.sh
else
echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
exit 128
fi

View File

@ -1,62 +0,0 @@
#!/bin/bash
#
# CIS Debian Hardening
#
#
# 12.2 Verify Permissions on /etc/shadow (Scored)
#
set -e # One error, it's over
set -u # One variable unset, it's over
HARDENING_LEVEL=1
DESCRIPTION="Check permissions on /etc/shadow to 640."
FILE='/etc/shadow'
PERMISSIONS='640'
# This function will be called if the script status is on enabled / audit mode
audit () {
has_file_correct_permissions $FILE $PERMISSIONS
if [ $FNRET = 0 ]; then
ok "$FILE has correct permissions"
else
crit "$FILE permissions were not set to $PERMISSIONS"
fi
}
# This function will be called if the script status is on enabled mode
apply () {
has_file_correct_permissions $FILE $PERMISSIONS
if [ $FNRET = 0 ]; then
ok "$FILE has correct permissions"
else
info "fixing $FILE permissions to $PERMISSIONS"
chmod 0$PERMISSIONS $FILE
fi
}
# This function will check config parameters required
check_config() {
:
}
# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
. /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
echo "Cannot source CIS_ROOT_DIR variable, aborting."
exit 128
fi
# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
. $CIS_ROOT_DIR/lib/main.sh
else
echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
exit 128
fi

View File

@ -1,62 +0,0 @@
#!/bin/bash
#
# CIS Debian Hardening
#
#
# 12.3 Verify Permissions on /etc/group (Scored)
#
set -e # One error, it's over
set -u # One variable unset, it's over
HARDENING_LEVEL=1
DESCRIPTION="Check permissions on /etc/group to 644."
FILE='/etc/group'
PERMISSIONS='644'
# This function will be called if the script status is on enabled / audit mode
audit () {
has_file_correct_permissions $FILE $PERMISSIONS
if [ $FNRET = 0 ]; then
ok "$FILE has correct permissions"
else
crit "$FILE permissions were not set to $PERMISSIONS"
fi
}
# This function will be called if the script status is on enabled mode
apply () {
has_file_correct_permissions $FILE $PERMISSIONS
if [ $FNRET = 0 ]; then
ok "$FILE has correct permissions"
else
info "fixing $FILE permissions to $PERMISSIONS"
chmod 0$PERMISSIONS $FILE
fi
}
# This function will check config parameters required
check_config() {
:
}
# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
. /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
echo "Cannot source CIS_ROOT_DIR variable, aborting."
exit 128
fi
# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
. $CIS_ROOT_DIR/lib/main.sh
else
echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
exit 128
fi

View File

@ -1,77 +0,0 @@
#!/bin/bash
#
# CIS Debian Hardening
#
#
# 12.4 Verify User/Group Ownership on /etc/passwd (Scored)
#
set -e # One error, it's over
set -u # One variable unset, it's over
HARDENING_LEVEL=1
DESCRIPTION="Check user/group to root on /etc/passwd."
FILE='/etc/passwd'
USER='root'
GROUP='root'
# This function will be called if the script status is on enabled / audit mode
audit () {
has_file_correct_ownership $FILE $USER $GROUP
if [ $FNRET = 0 ]; then
ok "$FILE has correct ownership"
else
crit "$FILE ownership was not set to $USER:$GROUP"
fi
}
# This function will be called if the script status is on enabled mode
apply () {
has_file_correct_ownership $FILE $USER $GROUP
if [ $FNRET = 0 ]; then
ok "$FILE has correct ownership"
else
info "fixing $FILE ownership to $USER:$GROUP"
chown $USER:$GROUP $FILE
fi
}
# This function will check config parameters required
check_config() {
does_user_exist $USER
if [ $FNRET != 0 ]; then
crit "$USER does not exist"
exit 128
fi
does_group_exist $GROUP
if [ $FNRET != 0 ]; then
crit "$GROUP does not exist"
exit 128
fi
does_file_exist $FILE
if [ $FNRET != 0 ]; then
crit "$FILE does not exist"
exit 128
fi
}
# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
. /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
echo "Cannot source CIS_ROOT_DIR variable, aborting."
exit 128
fi
# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
. $CIS_ROOT_DIR/lib/main.sh
else
echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
exit 128
fi

View File

@ -1,77 +0,0 @@
#!/bin/bash
#
# CIS Debian Hardening
#
#
# 12.5 Verify User/Group Ownership on /etc/shadow (Scored)
#
set -e # One error, it's over
set -u # One variable unset, it's over
HARDENING_LEVEL=1
DESCRIPTION="Check user/group to root on etc/shadow."
FILE='/etc/shadow'
USER='root'
GROUP='shadow'
# This function will be called if the script status is on enabled / audit mode
audit () {
has_file_correct_ownership $FILE $USER $GROUP
if [ $FNRET = 0 ]; then
ok "$FILE has correct ownership"
else
crit "$FILE ownership was not set to $USER:$GROUP"
fi
}
# This function will be called if the script status is on enabled mode
apply () {
has_file_correct_ownership $FILE $USER $GROUP
if [ $FNRET = 0 ]; then
ok "$FILE has correct ownership"
else
info "fixing $FILE ownership to $USER:$GROUP"
chown $USER:$GROUP $FILE
fi
}
# This function will check config parameters required
check_config() {
does_user_exist $USER
if [ $FNRET != 0 ]; then
crit "$USER does not exist"
exit 128
fi
does_group_exist $GROUP
if [ $FNRET != 0 ]; then
crit "$GROUP does not exist"
exit 128
fi
does_file_exist $FILE
if [ $FNRET != 0 ]; then
crit "$FILE does not exist"
exit 128
fi
}
# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
. /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
echo "Cannot source CIS_ROOT_DIR variable, aborting."
exit 128
fi
# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
. $CIS_ROOT_DIR/lib/main.sh
else
echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
exit 128
fi

View File

@ -1,77 +0,0 @@
#!/bin/bash
#
# CIS Debian Hardening
#
#
# 12.6 Verify User/Group Ownership on /etc/group (Scored)
#
set -e # One error, it's over
set -u # One variable unset, it's over
HARDENING_LEVEL=1
DESCRIPTION="Check user/group to root on /etc/group."
FILE='/etc/group'
USER='root'
GROUP='root'
# This function will be called if the script status is on enabled / audit mode
audit () {
has_file_correct_ownership $FILE $USER $GROUP
if [ $FNRET = 0 ]; then
ok "$FILE has correct ownership"
else
crit "$FILE ownership was not set to $USER:$GROUP"
fi
}
# This function will be called if the script status is on enabled mode
apply () {
has_file_correct_ownership $FILE $USER $GROUP
if [ $FNRET = 0 ]; then
ok "$FILE has correct ownership"
else
info "fixing $FILE ownership to $USER:$GROUP"
chown $USER:$GROUP $FILE
fi
}
# This function will check config parameters required
check_config() {
does_user_exist $USER
if [ $FNRET != 0 ]; then
crit "$USER does not exist"
exit 128
fi
does_group_exist $GROUP
if [ $FNRET != 0 ]; then
crit "$GROUP does not exist"
exit 128
fi
does_file_exist $FILE
if [ $FNRET != 0 ]; then
crit "$FILE does not exist"
exit 128
fi
}
# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
. /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
echo "Cannot source CIS_ROOT_DIR variable, aborting."
exit 128
fi
# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
. $CIS_ROOT_DIR/lib/main.sh
else
echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
exit 128
fi

View File

@ -5,37 +5,37 @@
# #
# #
# 4.5 Activate AppArmor (Scored) # 2.1.1 Ensure xinetd is not enabled (Scored)
# #
set -e # One error, it's over set -e # One error, it's over
set -u # One variable unset, it's over set -u # One variable unset, it's over
HARDENING_LEVEL=3 HARDENING_LEVEL=3
DESCRIPTION="Activate AppArmor to enforce permissions control." DESCRIPTION="Ensure xinetd is not enabled."
PACKAGE='apparmor' PACKAGE='xinetd'
# This function will be called if the script status is on enabled / audit mode # This function will be called if the script status is on enabled / audit mode
audit () { audit () {
is_pkg_installed $PACKAGE is_pkg_installed $PACKAGE
if [ $FNRET != 0 ]; then if [ $FNRET = 0 ]; then
crit "$PACKAGE is absent!" crit "$PACKAGE is installed"
else else
ok "$PACKAGE is installed" ok "$PACKAGE is absent"
fi fi
:
} }
# This function will be called if the script status is on enabled mode # This function will be called if the script status is on enabled mode
apply () { apply () {
is_pkg_installed $PACKAGE is_pkg_installed $PACKAGE
if [ $FNRET != 0 ]; then if [ $FNRET = 0 ]; then
crit "$PACKAGE is not installed, please install $PACKAGE and configure it" warn "$PACKAGE is installed, purging"
apt-get purge $PACKAGE -y
apt-get autoremove
else else
ok "$PACKAGE is installed" ok "$PACKAGE is absent"
fi fi
:
} }
# This function will check config parameters required # This function will check config parameters required

View File

@ -5,20 +5,20 @@
# #
# #
# 5.1.8 Ensure xinetd is not enabled (Scored) # 2.1.2 Ensure bsd-inetd is not enabled (Scored)
# #
set -e # One error, it's over set -e # One error, it's over
set -u # One variable unset, it's over set -u # One variable unset, it's over
HARDENING_LEVEL=3 HARDENING_LEVEL=3
DESCRIPTION="Ensure xinetd is not enabled." DESCRIPTION="Ensure bsd-inetd is not enabled."
PACKAGES='openbsd-inetd xinetd rlinetd' PACKAGES='openbsd-inetd inetutils-inetd'
# This function will be called if the script status is on enabled / audit mode # This function will be called if the script status is on enabled / audit mode
audit () { audit () {
for PACKAGE in $PACKAGES; do for PACKAGE in $PACKAGES; do
is_pkg_installed $PACKAGE is_pkg_installed $PACKAGE
if [ $FNRET = 0 ]; then if [ $FNRET = 0 ]; then
crit "$PACKAGE is installed" crit "$PACKAGE is installed"
@ -30,7 +30,7 @@ audit () {
# This function will be called if the script status is on enabled mode # This function will be called if the script status is on enabled mode
apply () { apply () {
for PACKAGE in $PACKAGES; do for PACKAGE in $PACKAGES; do
is_pkg_installed $PACKAGE is_pkg_installed $PACKAGE
if [ $FNRET = 0 ]; then if [ $FNRET = 0 ]; then
warn "$PACKAGE is installed, purging" warn "$PACKAGE is installed, purging"

View File

@ -0,0 +1,56 @@
#!/bin/bash
#
# CIS Debian Hardening
#
#
# 2.2.1.1 Ensure time synchronization is in use (Not Scored)
#
set -e # One error, it's over
set -u # One variable unset, it's over
HARDENING_LEVEL=3
DESCRIPTION="Ensure time synchronization is in use"
PACKAGES="ntp chrony"
# This function will be called if the script status is on enabled / audit mode
audit () {
FOUND=false
for PACKAGE in $PACKAGES; do
is_pkg_installed $PACKAGE
if [ $FNRET = 0 ]; then
ok "Time synchronization is available through $PACKAGE"
FOUND=true
fi
done
if [ "$FOUND" = false ]; then
crit "None of the following time sync packages are installed: $PACKAGES"
fi
}
# This function will be called if the script status is on enabled mode
apply () {
:
}
# This function will check config parameters required
check_config() {
:
}
# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
. /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
echo "Cannot source CIS_ROOT_DIR variable, aborting."
exit 128
fi
# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
[ -r "$CIS_ROOT_DIR"/lib/main.sh ] && . $CIS_ROOT_DIR/lib/main.sh

View File

@ -5,7 +5,7 @@
# #
# #
# 6.5 Configure Network Time Protocol (NTP) (Scored) # 2.2.1.2 Ensure ntp is configured (Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -0,0 +1,64 @@
#!/bin/bash
#
# CIS Debian Hardening
#
#
# 2.2.1.3 Ensure chrony is configured (Scored)
#
set -e # One error, it's over
set -u # One variable unset, it's over
HARDENING_LEVEL=3
DESCRIPTION="Configure Network Time Protocol (ntp). Check restrict parameters and ntp daemon runs ad unprivileged user."
HARDENING_EXCEPTION=ntp
PACKAGE=chrony
CONF_DEFAULT_PATTERN='^(server|pool)'
CONF_FILE='/etc/chrony/chrony.conf'
# This function will be called if the script status is on enabled / audit mode
audit () {
is_pkg_installed $PACKAGE
if [ $FNRET != 0 ]; then
crit "$PACKAGE is not installed!"
else
ok "$PACKAGE is installed, checking configuration"
does_pattern_exist_in_file $CONF_FILE $CONF_DEFAULT_PATTERN
if [ $FNRET != 0 ]; then
crit "$CONF_DEFAULT_PATTERN not found in $CONF_FILE"
else
ok "$CONF_DEFAULT_PATTERN found in $CONF_FILE"
fi
fi
}
# This function will be called if the script status is on enabled mode
apply () {
:
}
# This function will check config parameters required
check_config() {
:
}
# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
. /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
echo "Cannot source CIS_ROOT_DIR variable, aborting."
exit 128
fi
# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
. $CIS_ROOT_DIR/lib/main.sh
else
echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
exit 128
fi

View File

@ -5,7 +5,7 @@
# #
# #
# 6.10 Ensure HTTP Server is not enabled (Not Scored) # 2.2.10 Ensure HTTP Server is not enabled (Scored)
# #
set -e # One error, it's over set -e # One error, it's over
@ -37,7 +37,7 @@ apply () {
if [ $FNRET = 0 ]; then if [ $FNRET = 0 ]; then
crit "$PACKAGE is installed, purging it" crit "$PACKAGE is installed, purging it"
apt-get purge $PACKAGE -y apt-get purge $PACKAGE -y
apt-get autoremove apt-get autoremove -y
else else
ok "$PACKAGE is absent" ok "$PACKAGE is absent"
fi fi

View File

@ -5,14 +5,14 @@
# #
# #
# 6.11 Ensure IMAP and POP server is not enabled (Not Scored) # 2.2.11 Ensure IMAP and POP server is not installed (Scored)
# #
set -e # One error, it's over set -e # One error, it's over
set -u # One variable unset, it's over set -u # One variable unset, it's over
HARDENING_LEVEL=3 HARDENING_LEVEL=3
DESCRIPTION="Ensure IMAP and POP servers are not enabled." DESCRIPTION="Ensure IMAP and POP servers are not installed"
HARDENING_EXCEPTION=mail HARDENING_EXCEPTION=mail
# Based on aptitude search '~Pimap-server' and aptitude search '~Ppop3-server' # Based on aptitude search '~Pimap-server' and aptitude search '~Ppop3-server'
@ -37,7 +37,7 @@ apply () {
if [ $FNRET = 0 ]; then if [ $FNRET = 0 ]; then
crit "$PACKAGE is installed, purging it" crit "$PACKAGE is installed, purging it"
apt-get purge $PACKAGE -y apt-get purge $PACKAGE -y
apt-get autoremove apt-get autoremove -y
else else
ok "$PACKAGE is absent" ok "$PACKAGE is absent"
fi fi

View File

@ -0,0 +1,81 @@
#!/bin/bash
#
# CIS Debian Hardening
#
#
# 2.2.12 Ensure Samba is not enabled (Scored)
#
set -e # One error, it's over
set -u # One variable unset, it's over
HARDENING_LEVEL=3
DESCRIPTION="Ensure Samba is not enabled."
HARDENING_EXCEPTION=samba
PACKAGES='samba'
SERVICE='smbd'
# This function will be called if the script status is on enabled / audit mode
audit () {
for PACKAGE in $PACKAGES; do
is_pkg_installed $PACKAGE
if [ $FNRET = 0 ]; then
crit "$PACKAGE is installed!"
else
ok "$PACKAGE is absent"
fi
done
is_service_enabled $SERVICE
if [ $FNRET = 0 ]; then
crit "Service $SERVICE is enabled!"
else
ok "Service $SERVICE is disabled"
fi
}
# This function will be called if the script status is on enabled mode
apply () {
for PACKAGE in $PACKAGES; do
is_pkg_installed $PACKAGE
if [ $FNRET = 0 ]; then
crit "$PACKAGE is installed, purging it"
apt-get purge $PACKAGE -y
apt-get autoremove -y
else
ok "$PACKAGE is absent"
fi
done
is_service_enabled $SERVICE
if [ $FNRET = 0 ]; then
crit "Service $SERVICE is enabled!"
systemctl disable $SERVICE
else
ok "Service $SERVICE is disabled"
fi
}
# This function will check config parameters required
check_config() {
:
}
# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
. /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
echo "Cannot source CIS_ROOT_DIR variable, aborting."
exit 128
fi
# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
. $CIS_ROOT_DIR/lib/main.sh
else
echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
exit 128
fi

View File

@ -5,7 +5,7 @@
# #
# #
# 6.13 Ensure HTTP Proxy Server is not enabled (Not Scored) # 2.2.13 Ensure HTTP Proxy Server is not enabled (Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -5,7 +5,7 @@
# #
# #
# 6.14 Ensure SNMP Server is not enabled (Not Scored) # 2.2.14 Ensure SNMP Server is not enabled (Scored)
# #
set -e # One error, it's over set -e # One error, it's over
@ -36,7 +36,7 @@ apply () {
if [ $FNRET = 0 ]; then if [ $FNRET = 0 ]; then
crit "$PACKAGE is installed, purging it" crit "$PACKAGE is installed, purging it"
apt-get purge $PACKAGE -y apt-get purge $PACKAGE -y
apt-get autoremove apt-get autoremove -y
else else
ok "$PACKAGE is absent" ok "$PACKAGE is absent"
fi fi

View File

@ -5,7 +5,7 @@
# #
# #
# 6.15 Configure Mail Transfer Agent for Local-Only Mode (Scored) # 2.2.15 Ensure Mail Transfer Agent is configured for Local-Only Mode (Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -5,7 +5,7 @@
# #
# #
# 6.16 Ensure rsync service is not enabled (Scored) # 2.2.16 Ensure rsync service is not enabled (Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -1,13 +1,15 @@
#!/bin/bash #!/bin/bash
# #
# CIS Debian Hardening # Legacy CIS Debian Hardening
# #
# #
# 5.1.6 Ensure telnet server is not enabled (Scored) # 2.2.18 Ensure telnet server is not enabled (Scored)
# #
# Note: this check is not anymore in CIS hardening but we decided to keep it anyway
set -e # One error, it's over set -e # One error, it's over
set -u # One variable unset, it's over set -u # One variable unset, it's over

View File

@ -5,7 +5,7 @@
# #
# #
# 6.1 Ensure the X Window system is not installed (Scored) # 2.2.2 Ensure the X Window system is not installed (Scored)
# #
set -e # One error, it's over set -e # One error, it's over
@ -37,7 +37,7 @@ apply () {
if [ $FNRET = 0 ]; then if [ $FNRET = 0 ]; then
crit "$PACKAGE is installed, purging it" crit "$PACKAGE is installed, purging it"
apt-get purge $PACKAGE -y apt-get purge $PACKAGE -y
apt-get autoremove apt-get autoremove -y
else else
ok "$PACKAGE is absent" ok "$PACKAGE is absent"
fi fi

View File

@ -5,7 +5,7 @@
# #
# #
# 6.2 Ensure Avahi Server is not enabled (Scored) # 2.2.3 Ensure Avahi Server is not enabled (Scored)
# #
set -e # One error, it's over set -e # One error, it's over
@ -35,7 +35,7 @@ apply () {
if [ $FNRET = 0 ]; then if [ $FNRET = 0 ]; then
crit "$PACKAGE is installed, purging it" crit "$PACKAGE is installed, purging it"
apt-get purge $PACKAGE -y apt-get purge $PACKAGE -y
apt-get autoremove apt-get autoremove -y
else else
ok "$PACKAGE is absent" ok "$PACKAGE is absent"
fi fi

View File

@ -5,7 +5,7 @@
# #
# #
# 6.3 Ensure print server is not enabled (Not Scored) # 2.2.4 Ensure CUPS is not enabled (Scored)
# #
set -e # One error, it's over set -e # One error, it's over
@ -36,7 +36,7 @@ apply () {
if [ $FNRET = 0 ]; then if [ $FNRET = 0 ]; then
crit "$PACKAGE is installed, purging it" crit "$PACKAGE is installed, purging it"
apt-get purge $PACKAGE -y apt-get purge $PACKAGE -y
apt-get autoremove apt-get autoremove -y
else else
ok "$PACKAGE is absent" ok "$PACKAGE is absent"
fi fi

View File

@ -5,7 +5,7 @@
# #
# #
# 6.4 Ensure DHCP Server is not enabled (Scored) # 2.2.5 Ensure DHCP Server is not enabled (Scored)
# #
set -e # One error, it's over set -e # One error, it's over
@ -36,7 +36,7 @@ apply () {
if [ $FNRET = 0 ]; then if [ $FNRET = 0 ]; then
crit "$PACKAGE is installed, purging it" crit "$PACKAGE is installed, purging it"
apt-get purge $PACKAGE -y apt-get purge $PACKAGE -y
apt-get autoremove apt-get autoremove -y
else else
ok "$PACKAGE is absent" ok "$PACKAGE is absent"
fi fi

View File

@ -5,7 +5,7 @@
# #
# #
# 6.6 Ensure LDAP is not enabled (Not Scored) # 2.2.6 Ensure LDAP server is not enabled (Scored)
# #
set -e # One error, it's over set -e # One error, it's over
@ -36,7 +36,7 @@ apply () {
if [ $FNRET = 0 ]; then if [ $FNRET = 0 ]; then
crit "$PACKAGE is installed, purging it" crit "$PACKAGE is installed, purging it"
apt-get purge $PACKAGE -y apt-get purge $PACKAGE -y
apt-get autoremove apt-get autoremove -y
else else
ok "$PACKAGE is absent" ok "$PACKAGE is absent"
fi fi

View File

@ -5,7 +5,7 @@
# #
# #
# 6.7 Ensure NFS and RPC are not enabled (Not Scored) # 2.2.7 Ensure NFS and RPC are not enabled (Scored)
# #
set -e # One error, it's over set -e # One error, it's over
@ -36,7 +36,7 @@ apply () {
if [ $FNRET = 0 ]; then if [ $FNRET = 0 ]; then
crit "$PACKAGE is installed, purging it" crit "$PACKAGE is installed, purging it"
apt-get purge $PACKAGE -y apt-get purge $PACKAGE -y
apt-get autoremove apt-get autoremove -y
else else
ok "$PACKAGE is absent" ok "$PACKAGE is absent"
fi fi

View File

@ -5,7 +5,7 @@
# #
# #
# 6.8 Ensure DNS Server is not enabled (Not Scored) # 2.2.8 Ensure DNS Server is not enabled (Scored)
# #
set -e # One error, it's over set -e # One error, it's over
@ -36,7 +36,7 @@ apply () {
if [ $FNRET = 0 ]; then if [ $FNRET = 0 ]; then
crit "$PACKAGE is installed, purging it" crit "$PACKAGE is installed, purging it"
apt-get purge $PACKAGE -y apt-get purge $PACKAGE -y
apt-get autoremove apt-get autoremove -y
else else
ok "$PACKAGE is absent" ok "$PACKAGE is absent"
fi fi

View File

@ -5,7 +5,7 @@
# #
# #
# 6.9 Ensure FTP Server is not enabled (Not Scored) # 2.2.9 Ensure FTP Server is not enabled (Scored)
# #
set -e # One error, it's over set -e # One error, it's over
@ -37,7 +37,7 @@ apply () {
if [ $FNRET = 0 ]; then if [ $FNRET = 0 ]; then
crit "$PACKAGE is installed, purging it" crit "$PACKAGE is installed, purging it"
apt-get purge $PACKAGE -y apt-get purge $PACKAGE -y
apt-get autoremove apt-get autoremove -y
else else
ok "$PACKAGE is absent" ok "$PACKAGE is absent"
fi fi

View File

@ -5,7 +5,7 @@
# #
# #
# 5.1.1 Ensure NIS is not installed (Scored) # 2.3.1 Ensure NIS client is not installed (Scored)
# #
set -e # One error, it's over set -e # One error, it's over
@ -33,7 +33,7 @@ apply () {
if [ $FNRET = 0 ]; then if [ $FNRET = 0 ]; then
crit "$PACKAGE is installed, purging it" crit "$PACKAGE is installed, purging it"
apt-get purge $PACKAGE -y apt-get purge $PACKAGE -y
apt-get autoremove apt-get autoremove -y
else else
ok "$PACKAGE is absent" ok "$PACKAGE is absent"
fi fi

View File

@ -5,7 +5,7 @@
# #
# #
# 5.1.3 Ensure rsh client is not installed (Scored) # 2.3.2 Ensure rsh client is not installed (Scored)
# #
set -e # One error, it's over set -e # One error, it's over
@ -36,7 +36,7 @@ apply () {
if [ $FNRET = 0 ]; then if [ $FNRET = 0 ]; then
warn "$PACKAGE is installed, purging" warn "$PACKAGE is installed, purging"
apt-get purge $PACKAGE -y apt-get purge $PACKAGE -y
apt-get autoremove apt-get autoremove -y
else else
ok "$PACKAGE is absent" ok "$PACKAGE is absent"
fi fi

View File

@ -5,7 +5,7 @@
# #
# #
# 5.1.5 Ensure talk client is not installed (Scored) # 2.3.3 Ensure talk client is not installed (Scored)
# #
set -e # One error, it's over set -e # One error, it's over
@ -35,7 +35,7 @@ apply () {
if [ $FNRET = 0 ]; then if [ $FNRET = 0 ]; then
warn "$PACKAGE is installed, purging" warn "$PACKAGE is installed, purging"
apt-get purge $PACKAGE -y apt-get purge $PACKAGE -y
apt-get autoremove apt-get autoremove -y
else else
ok "$PACKAGE is absent" ok "$PACKAGE is absent"
fi fi

View File

@ -5,24 +5,23 @@
# #
# #
# 6.12 Ensure Samba is not enabled (Not Scored) # 2.3.4 Ensure telnet client is not installed (Scored)
# #
set -e # One error, it's over set -e # One error, it's over
set -u # One variable unset, it's over set -u # One variable unset, it's over
HARDENING_LEVEL=3 HARDENING_LEVEL=2
DESCRIPTION="Ensure Samba is not enabled." DESCRIPTION="Ensure telnet client is not installed."
HARDENING_EXCEPTION=samba
PACKAGES='samba' PACKAGES='telnet'
# This function will be called if the script status is on enabled / audit mode # This function will be called if the script status is on enabled / audit mode
audit () { audit () {
for PACKAGE in $PACKAGES; do for PACKAGE in $PACKAGES; do
is_pkg_installed $PACKAGE is_pkg_installed $PACKAGE
if [ $FNRET = 0 ]; then if [ $FNRET = 0 ]; then
crit "$PACKAGE is installed!" crit "$PACKAGE is installed"
else else
ok "$PACKAGE is absent" ok "$PACKAGE is absent"
fi fi
@ -34,9 +33,9 @@ apply () {
for PACKAGE in $PACKAGES; do for PACKAGE in $PACKAGES; do
is_pkg_installed $PACKAGE is_pkg_installed $PACKAGE
if [ $FNRET = 0 ]; then if [ $FNRET = 0 ]; then
crit "$PACKAGE is installed, purging it" warn "$PACKAGE is installed, purging"
apt-get purge $PACKAGE -y apt-get purge $PACKAGE -y
apt-get autoremove apt-get autoremove -y
else else
ok "$PACKAGE is absent" ok "$PACKAGE is absent"
fi fi

View File

@ -0,0 +1,66 @@
#!/bin/bash
#
# CIS Debian Hardening
#
#
# 2.3.5 Ensure LDAP client is not installed (Scored)
#
set -e # One error, it's over
set -u # One variable unset, it's over
HARDENING_LEVEL=2
DESCRIPTION="Ensure ldap client is not installed."
PACKAGES='ldap-utils'
# This function will be called if the script status is on enabled / audit mode
audit () {
for PACKAGE in $PACKAGES; do
is_pkg_installed $PACKAGE
if [ $FNRET = 0 ]; then
crit "$PACKAGE is installed"
else
ok "$PACKAGE is absent"
fi
done
}
# This function will be called if the script status is on enabled mode
apply () {
for PACKAGE in $PACKAGES; do
is_pkg_installed $PACKAGE
if [ $FNRET = 0 ]; then
warn "$PACKAGE is installed, purging"
apt-get purge $PACKAGE -y
apt-get autoremove -y
else
ok "$PACKAGE is absent"
fi
done
}
# This function will check config parameters required
check_config() {
:
}
# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
. /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
echo "Cannot source CIS_ROOT_DIR variable, aborting."
exit 128
fi
# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
. $CIS_ROOT_DIR/lib/main.sh
else
echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
exit 128
fi

View File

@ -0,0 +1,75 @@
#!/bin/bash
#
# CIS Debian Hardening
#
#
# 3.1.1 Ensure IP forwarding is disabled (Scored)
#
set -e # One error, it's over
set -u # One variable unset, it's over
HARDENING_LEVEL=3
HARDENING_EXCEPTION=gw
DESCRIPTION="Disable IP forwarding."
SYSCTL_PARAMS='net.ipv4.ip_forward net.ipv6.conf.all.forwarding'
SYSCTL_EXP_RESULT=0
# This function will be called if the script status is on enabled / audit mode
audit () {
for SYSCTL_PARAM in $SYSCTL_PARAMS; do
does_sysctl_param_exists "net.ipv6"
if [ $FNRET = 0 ] || [[ ! $SYSCTL_PARAM =~ .*ipv6.* ]]; then # IPv6 is enabled or SYSCTL_VALUES doesn't contain ipv6
has_sysctl_param_expected_result $SYSCTL_PARAM $SYSCTL_EXP_RESULT
if [ $FNRET != 0 ]; then
crit "$SYSCTL_PARAM was not set to $SYSCTL_EXP_RESULT"
elif [ $FNRET = 255 ]; then
warn "$SYSCTL_PARAM does not exist -- Typo?"
else
ok "$SYSCTL_PARAM correctly set to $SYSCTL_EXP_RESULT"
fi
fi
done
}
# This function will be called if the script status is on enabled mode
apply () {
for SYSCTL_PARAM in $SYSCTL_PARAMS; do
has_sysctl_param_expected_result $SYSCTL_PARAM $SYSCTL_EXP_RESULT
if [ $FNRET != 0 ]; then
warn "$SYSCTL_PARAM was not set to $SYSCTL_EXP_RESULT -- Fixing"
set_sysctl_param $SYSCTL_PARAM $SYSCTL_EXP_RESULT
sysctl -w net.ipv4.route.flush=1 > /dev/null
elif [ $FNRET = 255 ]; then
warn "$SYSCTL_PARAM does not exist -- Typo?"
else
ok "$SYSCTL_PARAM correctly set to $SYSCTL_EXP_RESULT"
fi
done
}
# This function will check config parameters required
check_config() {
:
}
# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
. /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
echo "Cannot source CIS_ROOT_DIR variable, aborting."
exit 128
fi
# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
. $CIS_ROOT_DIR/lib/main.sh
else
echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
exit 128
fi

View File

@ -5,7 +5,7 @@
# #
# #
# 7.1.2 Disable Send Packet Redirects (Scored) # 3.1.2 Ensure packet redirect sending is disabled (Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -1,85 +0,0 @@
#!/bin/bash
#
# CIS Debian Hardening
#
#
# 3.1 Set User/Group Owner on bootloader config (Scored)
#
set -e # One error, it's over
set -u # One variable unset, it's over
HARDENING_LEVEL=1
DESCRIPTION="User and group root owner of grub bootloader config."
# Assertion : Grub Based.
FILE='/boot/grub/grub.cfg'
USER='root'
GROUP='root'
# This function will be called if the script status is on enabled / audit mode
audit () {
has_file_correct_ownership $FILE $USER $GROUP
if [ $FNRET = 0 ]; then
ok "$FILE has correct ownership"
else
crit "$FILE ownership was not set to $USER:$GROUP"
fi
}
# This function will be called if the script status is on enabled mode
apply () {
has_file_correct_ownership $FILE $USER $GROUP
if [ $FNRET = 0 ]; then
ok "$FILE has correct ownership"
else
info "fixing $FILE ownership to $USER:$GROUP"
chown $USER:$GROUP $FILE
fi
}
# This function will check config parameters required
check_config() {
is_pkg_installed "grub-pc"
if [ $FNRET != 0 ]; then
warn "Grub is not installed, not handling configuration"
exit 128
fi
does_user_exist $USER
if [ $FNRET != 0 ]; then
crit "$USER does not exist"
exit 128
fi
does_group_exist $GROUP
if [ $FNRET != 0 ]; then
crit "$GROUP does not exist"
exit 128
fi
does_file_exist $FILE
if [ $FNRET != 0 ]; then
crit "$FILE does not exist"
exit 128
fi
}
# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
. /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
echo "Cannot source CIS_ROOT_DIR variable, aborting."
exit 128
fi
# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
. $CIS_ROOT_DIR/lib/main.sh
else
echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
exit 128
fi

View File

@ -5,7 +5,7 @@
# #
# #
# 7.2.1 Disable Source Routed Packet Acceptance (Scored) # 3.2.1 Ensure source routed packets are not accepted (Scored)
# #
set -e # One error, it's over set -e # One error, it's over
@ -13,22 +13,25 @@ set -u # One variable unset, it's over
HARDENING_LEVEL=2 HARDENING_LEVEL=2
DESCRIPTION="Disable source routed packet acceptance." DESCRIPTION="Disable source routed packet acceptance."
# set in config file
SYSCTL_PARAMS='net.ipv4.conf.all.accept_source_route=0 net.ipv4.conf.default.accept_source_route=0' SYSCTL_PARAMS=''
# This function will be called if the script status is on enabled / audit mode # This function will be called if the script status is on enabled / audit mode
audit () { audit () {
for SYSCTL_VALUES in $SYSCTL_PARAMS; do for SYSCTL_VALUES in $SYSCTL_PARAMS; do
SYSCTL_PARAM=$(echo $SYSCTL_VALUES | cut -d= -f 1) does_sysctl_param_exists "net.ipv6"
SYSCTL_EXP_RESULT=$(echo $SYSCTL_VALUES | cut -d= -f 2) if [ $FNRET = 0 ] || [[ ! $SYSCTL_VALUES =~ .*ipv6.* ]]; then # IPv6 is enabled or SYSCTL_VALUES doesn't contain ipv6
debug "$SYSCTL_PARAM should be set to $SYSCTL_EXP_RESULT" SYSCTL_PARAM=$(echo $SYSCTL_VALUES | cut -d= -f 1)
has_sysctl_param_expected_result $SYSCTL_PARAM $SYSCTL_EXP_RESULT SYSCTL_EXP_RESULT=$(echo $SYSCTL_VALUES | cut -d= -f 2)
if [ $FNRET != 0 ]; then debug "$SYSCTL_PARAM should be set to $SYSCTL_EXP_RESULT"
crit "$SYSCTL_PARAM was not set to $SYSCTL_EXP_RESULT" has_sysctl_param_expected_result $SYSCTL_PARAM $SYSCTL_EXP_RESULT
elif [ $FNRET = 255 ]; then if [ $FNRET != 0 ]; then
warn "$SYSCTL_PARAM does not exist -- Typo?" crit "$SYSCTL_PARAM was not set to $SYSCTL_EXP_RESULT"
else elif [ $FNRET = 255 ]; then
ok "$SYSCTL_PARAM correctly set to $SYSCTL_EXP_RESULT" warn "$SYSCTL_PARAM does not exist -- Typo?"
else
ok "$SYSCTL_PARAM correctly set to $SYSCTL_EXP_RESULT"
fi
fi fi
done done
} }
@ -52,6 +55,14 @@ apply () {
done done
} }
# This function will create the config file for this check with default values
create_config() {
cat <<EOF
status=audit
# Specify system parameters to audit, space separated
SYSCTL_PARAMS="net.ipv4.conf.all.accept_source_route=0 net.ipv4.conf.default.accept_source_route=0 net.ipv6.conf.all.accept_source_route=0 net.ipv6.conf.default.accept_source_route=0"
EOF
}
# This function will check config parameters required # This function will check config parameters required
check_config() { check_config() {
: :

View File

@ -5,7 +5,7 @@
# #
# #
# 7.2.2 Disable ICMP Redirect Acceptance (Scored) # 3.2.2 Ensure ICMP redirects are not accepted (Scored)
# #
set -e # One error, it's over set -e # One error, it's over
@ -13,22 +13,26 @@ set -u # One variable unset, it's over
HARDENING_LEVEL=2 HARDENING_LEVEL=2
DESCRIPTION="Disable ICMP redirect acceptance to prevent routing table corruption." DESCRIPTION="Disable ICMP redirect acceptance to prevent routing table corruption."
# set in config file
SYSCTL_PARAMS='net.ipv4.conf.all.accept_redirects=0 net.ipv4.conf.default.accept_redirects=0' SYSCTL_PARAMS=''
# This function will be called if the script status is on enabled / audit mode # This function will be called if the script status is on enabled / audit mode
audit () { audit () {
for SYSCTL_VALUES in $SYSCTL_PARAMS; do for SYSCTL_VALUES in $SYSCTL_PARAMS; do
SYSCTL_PARAM=$(echo $SYSCTL_VALUES | cut -d= -f 1) does_sysctl_param_exists "net.ipv6"
SYSCTL_EXP_RESULT=$(echo $SYSCTL_VALUES | cut -d= -f 2) if [ $FNRET = 0 ] || [[ ! $SYSCTL_VALUES =~ .*ipv6.* ]]; then # IPv6 is enabled or SYSCTL_VALUES doesn't contain ipv6
debug "$SYSCTL_PARAM should be set to $SYSCTL_EXP_RESULT" SYSCTL_PARAM=$(echo $SYSCTL_VALUES | cut -d= -f 1)
has_sysctl_param_expected_result $SYSCTL_PARAM $SYSCTL_EXP_RESULT SYSCTL_EXP_RESULT=$(echo $SYSCTL_VALUES | cut -d= -f 2)
if [ $FNRET != 0 ]; then debug "$SYSCTL_PARAM should be set to $SYSCTL_EXP_RESULT"
crit "$SYSCTL_PARAM was not set to $SYSCTL_EXP_RESULT"
elif [ $FNRET = 255 ]; then has_sysctl_param_expected_result $SYSCTL_PARAM $SYSCTL_EXP_RESULT
warn "$SYSCTL_PARAM does not exist -- Typo?" if [ $FNRET != 0 ]; then
else crit "$SYSCTL_PARAM was not set to $SYSCTL_EXP_RESULT"
ok "$SYSCTL_PARAM correctly set to $SYSCTL_EXP_RESULT" elif [ $FNRET = 255 ]; then
warn "$SYSCTL_PARAM does not exist -- Typo?"
else
ok "$SYSCTL_PARAM correctly set to $SYSCTL_EXP_RESULT"
fi
fi fi
done done
} }
@ -52,6 +56,14 @@ apply () {
done done
} }
# This function will create the config file for this check with default values
create_config() {
cat <<EOF
status=audit
# Specify system parameters to audit, space separated
SYSCTL_PARAMS="net.ipv4.conf.all.accept_redirects=0 net.ipv4.conf.default.accept_redirects=0 net.ipv6.conf.all.accept_redirects=0 net.ipv6.conf.default.accept_redirects=0"
EOF
}
# This function will check config parameters required # This function will check config parameters required
check_config() { check_config() {
: :

View File

@ -5,7 +5,7 @@
# #
# #
# 7.2.3 Disable Secure ICMP Redirect Acceptance (Scored) # 3.2.3 Ensure secure ICMP redirects are not accepted (Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -5,7 +5,7 @@
# #
# #
# 7.2.4 Log Suspicious Packets (Scored) # 3.2.4 Ensure suspicious packets are logged (Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -5,7 +5,7 @@
# #
# #
# 7.2.5 Enable Ignore Broadcast Requests (Scored) # 3.2.5 Ensure broadcast ICMP requests are ignored (Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -5,7 +5,7 @@
# #
# #
# 7.2.6 Enable Bad Error Message Protection (Scored) # 3.2.6 Ensure bogus ICMP responses are ignored (Scored)
# #
set -e # One error, it's over set -e # One error, it's over
@ -73,4 +73,4 @@ if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
else else
echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening" echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
exit 128 exit 128
fi fi

View File

@ -5,7 +5,7 @@
# #
# #
# 7.2.7 Enable RFC-recommended Source Route Validation (Scored) # 3.2.7 Ensure Reverse Path Filtering is enabled (Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -5,7 +5,7 @@
# #
# #
# 7.2.8 Enable TCP SYN Cookies (Scored) # 3.2.8 Ensure TCP SYN Cookies is enabled (Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -5,7 +5,7 @@
# #
# #
# 7.3.1 Disable IPv6 Router Advertisements (Not Scored) # 3.2.9 Ensure IPv6 router advertisements are not accepted (Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -1,72 +0,0 @@
#!/bin/bash
#
# CIS Debian Hardening
#
#
# 3.2 Set Permissions on bootloader config (Scored)
#
set -e # One error, it's over
set -u # One variable unset, it's over
HARDENING_LEVEL=1
DESCRIPTION="Permissions for root only on grub bootloader config."
# Assertion : Grub Based.
FILE='/boot/grub/grub.cfg'
PERMISSIONS='400'
# This function will be called if the script status is on enabled / audit mode
audit () {
has_file_correct_permissions $FILE $PERMISSIONS
if [ $FNRET = 0 ]; then
ok "$FILE has correct permissions"
else
crit "$FILE permissions were not set to $PERMISSIONS"
fi
}
# This function will be called if the script status is on enabled mode
apply () {
has_file_correct_permissions $FILE $PERMISSIONS
if [ $FNRET = 0 ]; then
ok "$FILE has correct permissions"
else
info "fixing $FILE permissions to $PERMISSIONS"
chmod 0$PERMISSIONS $FILE
fi
}
# This function will check config parameters required
check_config() {
is_pkg_installed "grub-pc"
if [ $FNRET != 0 ]; then
warn "grub-pc is not installed, not handling configuration"
exit 128
fi
if [ $FNRET != 0 ]; then
crit "$FILE does not exist"
exit 128
fi
}
# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
. /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
echo "Cannot source CIS_ROOT_DIR variable, aborting."
exit 128
fi
# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
. $CIS_ROOT_DIR/lib/main.sh
else
echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
exit 128
fi

View File

@ -5,7 +5,7 @@
# #
# #
# 7.4.1 Install TCP Wrappers (Scored) # 3.3.1 Ensure TCP Wrappers is installed (Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -5,7 +5,7 @@
# #
# #
# 7.4.2 Create /etc/hosts.allow (Not Scored) # 3.3.2 Ensure /etc/hosts.allow is configured (Not Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -5,7 +5,7 @@
# #
# #
# 7.4.4 Create /etc/hosts.deny (Not Scored) # 3.3.3 Ensure /etc/hosts.deny is configured (Not Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -5,17 +5,19 @@
# #
# #
# 7.4.3 Verify Permissions on /etc/hosts.allow (Scored) # 3.3.4 Ensure permissions on /etc/hosts.allow are configured (Scored)
# #
set -e # One error, it's over set -e # One error, it's over
set -u # One variable unset, it's over set -u # One variable unset, it's over
HARDENING_LEVEL=3 HARDENING_LEVEL=3
DESCRIPTION="Check 644 permissions on /hosts.allow ." DESCRIPTION="Check 644 permissions and root:root ownership on /hosts.allow ."
FILE='/etc/hosts.allow' FILE='/etc/hosts.allow'
PERMISSIONS='644' PERMISSIONS='644'
USER='root'
GROUP='root'
# This function will be called if the script status is on enabled / audit mode # This function will be called if the script status is on enabled / audit mode
audit () { audit () {
@ -24,7 +26,13 @@ audit () {
ok "$FILE has correct permissions" ok "$FILE has correct permissions"
else else
crit "$FILE permissions were not set to $PERMISSIONS" crit "$FILE permissions were not set to $PERMISSIONS"
fi fi
has_file_correct_ownership $FILE $USER $GROUP
if [ $FNRET = 0 ]; then
ok "$FILE has correct ownership"
else
crit "$FILE ownership was not set to $USER:$GROUP"
fi
} }
# This function will be called if the script status is on enabled mode # This function will be called if the script status is on enabled mode

View File

@ -5,17 +5,19 @@
# #
# #
# 7.4.5 Verify Permissions on /etc/hosts.deny (Scored) # 3.3.5 Verify Permissions on /etc/hosts.deny (Scored)
# #
set -e # One error, it's over set -e # One error, it's over
set -u # One variable unset, it's over set -u # One variable unset, it's over
HARDENING_LEVEL=3 HARDENING_LEVEL=3
DESCRIPTION="Check 644 permissions on /etc/hosts.deny ." DESCRIPTION="Check 644 permissions and root:root ownership on /etc/hosts.deny ."
FILE='/etc/hosts.deny' FILE='/etc/hosts.deny'
PERMISSIONS='644' PERMISSIONS='644'
USER='root'
GROUP='root'
# This function will be called if the script status is on enabled / audit mode # This function will be called if the script status is on enabled / audit mode
audit () { audit () {
@ -24,7 +26,13 @@ audit () {
ok "$FILE has correct permissions" ok "$FILE has correct permissions"
else else
crit "$FILE permissions were not set to $PERMISSIONS" crit "$FILE permissions were not set to $PERMISSIONS"
fi fi
has_file_correct_ownership $FILE $USER $GROUP
if [ $FNRET = 0 ]; then
ok "$FILE has correct ownership"
else
crit "$FILE ownership was not set to $USER:$GROUP"
fi
} }
# This function will be called if the script status is on enabled mode # This function will be called if the script status is on enabled mode

View File

@ -5,7 +5,7 @@
# #
# #
# 7.5.1 Disable DCCP (Not Scored) # 3.4.1 Ensure DCCP is disabled (Not Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -5,7 +5,7 @@
# #
# #
# 7.5.2 Disable SCTP (Not Scored) # 3.4.2 Ensure SCTP is disabled (Not Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -5,7 +5,7 @@
# #
# #
# 7.5.3 Disable RDS (Not Scored) # 3.4.3 Ensure SCTP is disabled (Not Scored)
# #
set -e # One error, it's over set -e # One error, it's over

View File

@ -5,7 +5,7 @@
# #
# #
# 7.5.4 Disable TIPC (Not Scored) # 3.4.4 Ensure TIPC is disabled (Not Scored)
# #
set -e # One error, it's over set -e # One error, it's over

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