diff --git a/bin/hardening.sh b/bin/hardening.sh index d6291a0..eb0bd2f 100755 --- a/bin/hardening.sh +++ b/bin/hardening.sh @@ -22,7 +22,6 @@ AUDIT_ALL=0 AUDIT_ALL_ENABLE_PASSED=0 ALLOW_SERVICE_LIST=0 SET_HARDENING_LEVEL=0 -CIS_ROOT_DIR='' usage() { cat << EOF @@ -136,16 +135,14 @@ while [[ $# > 0 ]]; do done # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z $CIS_ROOT_DIR ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 [ -r $CIS_ROOT_DIR/lib/constants.sh ] && . $CIS_ROOT_DIR/lib/constants.sh [ -r $CIS_ROOT_DIR/etc/hardening.cfg ] && . $CIS_ROOT_DIR/etc/hardening.cfg diff --git a/bin/hardening/1.1_install_updates.sh b/bin/hardening/1.1_install_updates.sh index 657dc79..f73494f 100755 --- a/bin/hardening/1.1_install_updates.sh +++ b/bin/hardening/1.1_install_updates.sh @@ -45,16 +45,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/10.1.1_set_password_exp_days.sh b/bin/hardening/10.1.1_set_password_exp_days.sh index ce7dcbc..9a2926f 100755 --- a/bin/hardening/10.1.1_set_password_exp_days.sh +++ b/bin/hardening/10.1.1_set_password_exp_days.sh @@ -73,16 +73,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/10.1.2_set_password_min_days_change.sh b/bin/hardening/10.1.2_set_password_min_days_change.sh index a4eef31..1e8db4c 100755 --- a/bin/hardening/10.1.2_set_password_min_days_change.sh +++ b/bin/hardening/10.1.2_set_password_min_days_change.sh @@ -73,16 +73,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/10.1.3_set_password_exp_warning_days.sh b/bin/hardening/10.1.3_set_password_exp_warning_days.sh index 3ff35c1..72ea126 100755 --- a/bin/hardening/10.1.3_set_password_exp_warning_days.sh +++ b/bin/hardening/10.1.3_set_password_exp_warning_days.sh @@ -73,16 +73,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/10.2_disable_system_accounts.sh b/bin/hardening/10.2_disable_system_accounts.sh index 0dcb6a9..2bdcc24 100755 --- a/bin/hardening/10.2_disable_system_accounts.sh +++ b/bin/hardening/10.2_disable_system_accounts.sh @@ -89,15 +89,13 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi +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) diff --git a/bin/hardening/10.3_default_root_group.sh b/bin/hardening/10.3_default_root_group.sh index 51a389e..0ae19d6 100755 --- a/bin/hardening/10.3_default_root_group.sh +++ b/bin/hardening/10.3_default_root_group.sh @@ -41,16 +41,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/10.4_default_umask.sh b/bin/hardening/10.4_default_umask.sh index 5e9f4e4..0d8a32a 100755 --- a/bin/hardening/10.4_default_umask.sh +++ b/bin/hardening/10.4_default_umask.sh @@ -91,15 +91,13 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi +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) diff --git a/bin/hardening/10.5_lock_inactive_user_account.sh b/bin/hardening/10.5_lock_inactive_user_account.sh index 967a39a..54c6329 100755 --- a/bin/hardening/10.5_lock_inactive_user_account.sh +++ b/bin/hardening/10.5_lock_inactive_user_account.sh @@ -33,16 +33,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/11.1_warning_banners.sh b/bin/hardening/11.1_warning_banners.sh index 6b1fda5..19fb524 100755 --- a/bin/hardening/11.1_warning_banners.sh +++ b/bin/hardening/11.1_warning_banners.sh @@ -67,16 +67,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/11.2_remove_os_info_warning_banners.sh b/bin/hardening/11.2_remove_os_info_warning_banners.sh index 56c4f04..c362a61 100755 --- a/bin/hardening/11.2_remove_os_info_warning_banners.sh +++ b/bin/hardening/11.2_remove_os_info_warning_banners.sh @@ -47,16 +47,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/11.3_graphical_warning_banners.sh b/bin/hardening/11.3_graphical_warning_banners.sh index 1149c4e..599363b 100755 --- a/bin/hardening/11.3_graphical_warning_banners.sh +++ b/bin/hardening/11.3_graphical_warning_banners.sh @@ -29,16 +29,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/12.10_find_suid_files.sh b/bin/hardening/12.10_find_suid_files.sh index 971f0e1..b9b4168 100755 --- a/bin/hardening/12.10_find_suid_files.sh +++ b/bin/hardening/12.10_find_suid_files.sh @@ -53,16 +53,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/12.11_find_sgid_files.sh b/bin/hardening/12.11_find_sgid_files.sh index db1b91e..59b61c1 100755 --- a/bin/hardening/12.11_find_sgid_files.sh +++ b/bin/hardening/12.11_find_sgid_files.sh @@ -54,16 +54,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/12.1_etc_passwd_permissions.sh b/bin/hardening/12.1_etc_passwd_permissions.sh index d833292..e4b7601 100755 --- a/bin/hardening/12.1_etc_passwd_permissions.sh +++ b/bin/hardening/12.1_etc_passwd_permissions.sh @@ -43,16 +43,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/12.2_etc_shadow_permissions.sh b/bin/hardening/12.2_etc_shadow_permissions.sh index f5ea517..7fa454b 100755 --- a/bin/hardening/12.2_etc_shadow_permissions.sh +++ b/bin/hardening/12.2_etc_shadow_permissions.sh @@ -43,16 +43,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/12.3_etc_group_permissions.sh b/bin/hardening/12.3_etc_group_permissions.sh index 89d3230..0853bb9 100755 --- a/bin/hardening/12.3_etc_group_permissions.sh +++ b/bin/hardening/12.3_etc_group_permissions.sh @@ -43,16 +43,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/12.4_etc_passwd_ownership.sh b/bin/hardening/12.4_etc_passwd_ownership.sh index 3219378..953a188 100755 --- a/bin/hardening/12.4_etc_passwd_ownership.sh +++ b/bin/hardening/12.4_etc_passwd_ownership.sh @@ -58,16 +58,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/12.5_etc_shadow_ownership.sh b/bin/hardening/12.5_etc_shadow_ownership.sh index c63ead0..dd48293 100755 --- a/bin/hardening/12.5_etc_shadow_ownership.sh +++ b/bin/hardening/12.5_etc_shadow_ownership.sh @@ -58,16 +58,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/12.6_etc_group_ownership.sh b/bin/hardening/12.6_etc_group_ownership.sh index 7f5c676..dd30070 100755 --- a/bin/hardening/12.6_etc_group_ownership.sh +++ b/bin/hardening/12.6_etc_group_ownership.sh @@ -58,16 +58,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/12.7_find_world_writable_file.sh b/bin/hardening/12.7_find_world_writable_file.sh index d97872a..5790714 100755 --- a/bin/hardening/12.7_find_world_writable_file.sh +++ b/bin/hardening/12.7_find_world_writable_file.sh @@ -44,16 +44,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/12.8_find_unowned_files.sh b/bin/hardening/12.8_find_unowned_files.sh index 53d8644..02e838f 100755 --- a/bin/hardening/12.8_find_unowned_files.sh +++ b/bin/hardening/12.8_find_unowned_files.sh @@ -46,16 +46,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/12.9_find_ungrouped_files.sh b/bin/hardening/12.9_find_ungrouped_files.sh index 68a81c5..fbf65ee 100755 --- a/bin/hardening/12.9_find_ungrouped_files.sh +++ b/bin/hardening/12.9_find_ungrouped_files.sh @@ -46,16 +46,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/13.10_find_user_rhosts_files.sh b/bin/hardening/13.10_find_user_rhosts_files.sh index 7db4077..5cb905a 100755 --- a/bin/hardening/13.10_find_user_rhosts_files.sh +++ b/bin/hardening/13.10_find_user_rhosts_files.sh @@ -44,16 +44,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening FILE, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/13.11_find_passwd_group_inconsistencies.sh b/bin/hardening/13.11_find_passwd_group_inconsistencies.sh index a52def2..4c23b5d 100755 --- a/bin/hardening/13.11_find_passwd_group_inconsistencies.sh +++ b/bin/hardening/13.11_find_passwd_group_inconsistencies.sh @@ -42,16 +42,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening FILE, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/13.12_users_valid_homedir.sh b/bin/hardening/13.12_users_valid_homedir.sh index 2566779..4a1ab61 100755 --- a/bin/hardening/13.12_users_valid_homedir.sh +++ b/bin/hardening/13.12_users_valid_homedir.sh @@ -45,16 +45,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening FILE, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/13.13_check_user_homedir_ownership.sh b/bin/hardening/13.13_check_user_homedir_ownership.sh index 053ead2..a716d87 100755 --- a/bin/hardening/13.13_check_user_homedir_ownership.sh +++ b/bin/hardening/13.13_check_user_homedir_ownership.sh @@ -56,16 +56,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening FILE, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/13.14_check_duplicate_uid.sh b/bin/hardening/13.14_check_duplicate_uid.sh index 63ee17f..58f88c1 100755 --- a/bin/hardening/13.14_check_duplicate_uid.sh +++ b/bin/hardening/13.14_check_duplicate_uid.sh @@ -45,16 +45,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening FILE, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/13.15_check_duplicate_gid.sh b/bin/hardening/13.15_check_duplicate_gid.sh index d0fd19c..335f662 100755 --- a/bin/hardening/13.15_check_duplicate_gid.sh +++ b/bin/hardening/13.15_check_duplicate_gid.sh @@ -45,16 +45,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening FILE, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/13.16_check_duplicate_username.sh b/bin/hardening/13.16_check_duplicate_username.sh index bc3c2ed..fd618e8 100755 --- a/bin/hardening/13.16_check_duplicate_username.sh +++ b/bin/hardening/13.16_check_duplicate_username.sh @@ -45,16 +45,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening FILE, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/13.17_check_duplicate_groupname.sh b/bin/hardening/13.17_check_duplicate_groupname.sh index 5c73c71..f3db785 100755 --- a/bin/hardening/13.17_check_duplicate_groupname.sh +++ b/bin/hardening/13.17_check_duplicate_groupname.sh @@ -45,16 +45,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening FILE, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/13.18_find_user_netrc_files.sh b/bin/hardening/13.18_find_user_netrc_files.sh index a98d084..695713d 100755 --- a/bin/hardening/13.18_find_user_netrc_files.sh +++ b/bin/hardening/13.18_find_user_netrc_files.sh @@ -44,16 +44,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening FILE, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/13.19_find_user_forward_files.sh b/bin/hardening/13.19_find_user_forward_files.sh index c8bdca0..46fb5e1 100755 --- a/bin/hardening/13.19_find_user_forward_files.sh +++ b/bin/hardening/13.19_find_user_forward_files.sh @@ -44,16 +44,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening FILE, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/13.1_remove_empty_password_field.sh b/bin/hardening/13.1_remove_empty_password_field.sh index dac0c87..2c33a0e 100755 --- a/bin/hardening/13.1_remove_empty_password_field.sh +++ b/bin/hardening/13.1_remove_empty_password_field.sh @@ -47,16 +47,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/13.20_shadow_group_empty.sh b/bin/hardening/13.20_shadow_group_empty.sh index 33f8b3f..9ab097b 100755 --- a/bin/hardening/13.20_shadow_group_empty.sh +++ b/bin/hardening/13.20_shadow_group_empty.sh @@ -54,16 +54,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening FILE, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/13.2_remove_legacy_passwd_entries.sh b/bin/hardening/13.2_remove_legacy_passwd_entries.sh index 267cf93..ea24350 100755 --- a/bin/hardening/13.2_remove_legacy_passwd_entries.sh +++ b/bin/hardening/13.2_remove_legacy_passwd_entries.sh @@ -48,16 +48,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/13.3_remove_legacy_shadow_entries.sh b/bin/hardening/13.3_remove_legacy_shadow_entries.sh index 2bcd9bc..1ef2b44 100755 --- a/bin/hardening/13.3_remove_legacy_shadow_entries.sh +++ b/bin/hardening/13.3_remove_legacy_shadow_entries.sh @@ -48,16 +48,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/13.4_remove_legacy_group_entries.sh b/bin/hardening/13.4_remove_legacy_group_entries.sh index c4decf5..7796eec 100755 --- a/bin/hardening/13.4_remove_legacy_group_entries.sh +++ b/bin/hardening/13.4_remove_legacy_group_entries.sh @@ -48,16 +48,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/13.5_find_0_uid_non_root_account.sh b/bin/hardening/13.5_find_0_uid_non_root_account.sh index 21bb593..9a4a93d 100755 --- a/bin/hardening/13.5_find_0_uid_non_root_account.sh +++ b/bin/hardening/13.5_find_0_uid_non_root_account.sh @@ -61,16 +61,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/13.6_sanitize_root_path.sh b/bin/hardening/13.6_sanitize_root_path.sh index d82865c..9ba92a8 100755 --- a/bin/hardening/13.6_sanitize_root_path.sh +++ b/bin/hardening/13.6_sanitize_root_path.sh @@ -71,16 +71,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/13.7_check_user_dir_perm.sh b/bin/hardening/13.7_check_user_dir_perm.sh index c3a6c35..d8b8a01 100755 --- a/bin/hardening/13.7_check_user_dir_perm.sh +++ b/bin/hardening/13.7_check_user_dir_perm.sh @@ -105,16 +105,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/13.8_check_user_dot_file_perm.sh b/bin/hardening/13.8_check_user_dot_file_perm.sh index 4157953..bd0e711 100755 --- a/bin/hardening/13.8_check_user_dot_file_perm.sh +++ b/bin/hardening/13.8_check_user_dot_file_perm.sh @@ -64,16 +64,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening FILE, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/13.9_set_perm_on_user_netrc.sh b/bin/hardening/13.9_set_perm_on_user_netrc.sh index ac50b3b..f3bc1f6 100755 --- a/bin/hardening/13.9_set_perm_on_user_netrc.sh +++ b/bin/hardening/13.9_set_perm_on_user_netrc.sh @@ -63,16 +63,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening FILE, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/2.10_home_nodev.sh b/bin/hardening/2.10_home_nodev.sh index 084f1d6..5ba1ee2 100755 --- a/bin/hardening/2.10_home_nodev.sh +++ b/bin/hardening/2.10_home_nodev.sh @@ -68,16 +68,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/2.11_removable_device_nodev.sh b/bin/hardening/2.11_removable_device_nodev.sh index ee6f41b..83dfcbb 100755 --- a/bin/hardening/2.11_removable_device_nodev.sh +++ b/bin/hardening/2.11_removable_device_nodev.sh @@ -56,16 +56,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/2.12_removable_device_noexec.sh b/bin/hardening/2.12_removable_device_noexec.sh index b1912b3..2fe2b5b 100755 --- a/bin/hardening/2.12_removable_device_noexec.sh +++ b/bin/hardening/2.12_removable_device_noexec.sh @@ -56,16 +56,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/2.13_removable_device_nosuid.sh b/bin/hardening/2.13_removable_device_nosuid.sh index c6a8f73..0cb4947 100755 --- a/bin/hardening/2.13_removable_device_nosuid.sh +++ b/bin/hardening/2.13_removable_device_nosuid.sh @@ -56,16 +56,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/2.14_run_shm_nodev.sh b/bin/hardening/2.14_run_shm_nodev.sh index 41939b5..5f93d2d 100755 --- a/bin/hardening/2.14_run_shm_nodev.sh +++ b/bin/hardening/2.14_run_shm_nodev.sh @@ -68,16 +68,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/2.15_run_shm_nosuid.sh b/bin/hardening/2.15_run_shm_nosuid.sh index 4ffbc07..046eae2 100755 --- a/bin/hardening/2.15_run_shm_nosuid.sh +++ b/bin/hardening/2.15_run_shm_nosuid.sh @@ -68,16 +68,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/2.16_run_shm_noexec.sh b/bin/hardening/2.16_run_shm_noexec.sh index 84e6765..ee2ea30 100755 --- a/bin/hardening/2.16_run_shm_noexec.sh +++ b/bin/hardening/2.16_run_shm_noexec.sh @@ -68,16 +68,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/2.17_sticky_bit_world_writable_folder.sh b/bin/hardening/2.17_sticky_bit_world_writable_folder.sh index 3188a34..9f6b8fb 100755 --- a/bin/hardening/2.17_sticky_bit_world_writable_folder.sh +++ b/bin/hardening/2.17_sticky_bit_world_writable_folder.sh @@ -43,16 +43,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/2.18_disable_cramfs.sh b/bin/hardening/2.18_disable_cramfs.sh index c2c44f5..2fc2ce4 100755 --- a/bin/hardening/2.18_disable_cramfs.sh +++ b/bin/hardening/2.18_disable_cramfs.sh @@ -45,16 +45,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/2.19_disable_freevxfs.sh b/bin/hardening/2.19_disable_freevxfs.sh index b5e7911..9e4961c 100755 --- a/bin/hardening/2.19_disable_freevxfs.sh +++ b/bin/hardening/2.19_disable_freevxfs.sh @@ -45,16 +45,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/2.1_tmp_partition.sh b/bin/hardening/2.1_tmp_partition.sh index 2f7b1e2..b020f5e 100755 --- a/bin/hardening/2.1_tmp_partition.sh +++ b/bin/hardening/2.1_tmp_partition.sh @@ -57,16 +57,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/2.20_disable_jffs2.sh b/bin/hardening/2.20_disable_jffs2.sh index d00f8ac..c0ee9b1 100755 --- a/bin/hardening/2.20_disable_jffs2.sh +++ b/bin/hardening/2.20_disable_jffs2.sh @@ -45,16 +45,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/2.21_disable_hfs.sh b/bin/hardening/2.21_disable_hfs.sh index 67e546c..7de876f 100755 --- a/bin/hardening/2.21_disable_hfs.sh +++ b/bin/hardening/2.21_disable_hfs.sh @@ -45,16 +45,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/2.22_disable_hfsplus.sh b/bin/hardening/2.22_disable_hfsplus.sh index 20b8dd3..5b4cb32 100755 --- a/bin/hardening/2.22_disable_hfsplus.sh +++ b/bin/hardening/2.22_disable_hfsplus.sh @@ -45,16 +45,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/2.23_disable_squashfs.sh b/bin/hardening/2.23_disable_squashfs.sh index 83ba69e..1727f8d 100755 --- a/bin/hardening/2.23_disable_squashfs.sh +++ b/bin/hardening/2.23_disable_squashfs.sh @@ -45,16 +45,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/2.24_disable_udf.sh b/bin/hardening/2.24_disable_udf.sh index d271f2d..bde19b0 100755 --- a/bin/hardening/2.24_disable_udf.sh +++ b/bin/hardening/2.24_disable_udf.sh @@ -45,16 +45,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/2.25_disable_automounting.sh b/bin/hardening/2.25_disable_automounting.sh index e6ed5ca..31c28e3 100755 --- a/bin/hardening/2.25_disable_automounting.sh +++ b/bin/hardening/2.25_disable_automounting.sh @@ -44,16 +44,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/2.2_tmp_nodev.sh b/bin/hardening/2.2_tmp_nodev.sh index b9da185..1e907d4 100755 --- a/bin/hardening/2.2_tmp_nodev.sh +++ b/bin/hardening/2.2_tmp_nodev.sh @@ -68,16 +68,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/2.3_tmp_nosuid.sh b/bin/hardening/2.3_tmp_nosuid.sh index 9852a05..f7acf9a 100755 --- a/bin/hardening/2.3_tmp_nosuid.sh +++ b/bin/hardening/2.3_tmp_nosuid.sh @@ -68,16 +68,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/2.4_tmp_noexec.sh b/bin/hardening/2.4_tmp_noexec.sh index 85d9e71..bb3ec2a 100755 --- a/bin/hardening/2.4_tmp_noexec.sh +++ b/bin/hardening/2.4_tmp_noexec.sh @@ -68,16 +68,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/2.5_var_partition.sh b/bin/hardening/2.5_var_partition.sh index e0cdee4..bae4c98 100755 --- a/bin/hardening/2.5_var_partition.sh +++ b/bin/hardening/2.5_var_partition.sh @@ -57,16 +57,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/2.6.1_var_tmp_partition.sh b/bin/hardening/2.6.1_var_tmp_partition.sh index 92cb896..51828ce 100755 --- a/bin/hardening/2.6.1_var_tmp_partition.sh +++ b/bin/hardening/2.6.1_var_tmp_partition.sh @@ -57,16 +57,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/2.6.2_var_tmp_nodev.sh b/bin/hardening/2.6.2_var_tmp_nodev.sh index ab50f90..78a4180 100755 --- a/bin/hardening/2.6.2_var_tmp_nodev.sh +++ b/bin/hardening/2.6.2_var_tmp_nodev.sh @@ -68,16 +68,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/2.6.3_var_tmp_nosuid.sh b/bin/hardening/2.6.3_var_tmp_nosuid.sh index 10da05e..d4e0dd3 100755 --- a/bin/hardening/2.6.3_var_tmp_nosuid.sh +++ b/bin/hardening/2.6.3_var_tmp_nosuid.sh @@ -68,16 +68,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/2.6.4_var_tmp_noexec.sh b/bin/hardening/2.6.4_var_tmp_noexec.sh index d738423..2a7e421 100755 --- a/bin/hardening/2.6.4_var_tmp_noexec.sh +++ b/bin/hardening/2.6.4_var_tmp_noexec.sh @@ -68,16 +68,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/2.7_var_log_partition.sh b/bin/hardening/2.7_var_log_partition.sh index 42276a4..e48fef4 100755 --- a/bin/hardening/2.7_var_log_partition.sh +++ b/bin/hardening/2.7_var_log_partition.sh @@ -57,16 +57,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/2.8_var_log_audit_partition.sh b/bin/hardening/2.8_var_log_audit_partition.sh index 0bddf6f..e1e0132 100755 --- a/bin/hardening/2.8_var_log_audit_partition.sh +++ b/bin/hardening/2.8_var_log_audit_partition.sh @@ -57,16 +57,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/2.9_home_partition.sh b/bin/hardening/2.9_home_partition.sh index 106f6e8..8257a14 100755 --- a/bin/hardening/2.9_home_partition.sh +++ b/bin/hardening/2.9_home_partition.sh @@ -57,16 +57,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/3.1_bootloader_ownership.sh b/bin/hardening/3.1_bootloader_ownership.sh index 9f778b5..912b482 100755 --- a/bin/hardening/3.1_bootloader_ownership.sh +++ b/bin/hardening/3.1_bootloader_ownership.sh @@ -66,16 +66,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/3.2_bootloader_permissions.sh b/bin/hardening/3.2_bootloader_permissions.sh index adf8f66..c8eea41 100755 --- a/bin/hardening/3.2_bootloader_permissions.sh +++ b/bin/hardening/3.2_bootloader_permissions.sh @@ -53,16 +53,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/3.3_bootloader_password.sh b/bin/hardening/3.3_bootloader_password.sh index fcdea74..eb72bc9 100755 --- a/bin/hardening/3.3_bootloader_password.sh +++ b/bin/hardening/3.3_bootloader_password.sh @@ -64,16 +64,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/3.4_root_password.sh b/bin/hardening/3.4_root_password.sh index 7b68169..0aa1d38 100755 --- a/bin/hardening/3.4_root_password.sh +++ b/bin/hardening/3.4_root_password.sh @@ -43,16 +43,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/4.1_restrict_core_dumps.sh b/bin/hardening/4.1_restrict_core_dumps.sh index 246da9c..2fec2fa 100755 --- a/bin/hardening/4.1_restrict_core_dumps.sh +++ b/bin/hardening/4.1_restrict_core_dumps.sh @@ -63,16 +63,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/4.2_enable_nx_support.sh b/bin/hardening/4.2_enable_nx_support.sh index 7cda69f..81aeaa1 100755 --- a/bin/hardening/4.2_enable_nx_support.sh +++ b/bin/hardening/4.2_enable_nx_support.sh @@ -65,16 +65,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/4.3_enable_randomized_vm_placement.sh b/bin/hardening/4.3_enable_randomized_vm_placement.sh index b183eb1..1a31001 100755 --- a/bin/hardening/4.3_enable_randomized_vm_placement.sh +++ b/bin/hardening/4.3_enable_randomized_vm_placement.sh @@ -47,16 +47,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/4.4_disable_prelink.sh b/bin/hardening/4.4_disable_prelink.sh index 740af73..da3017e 100755 --- a/bin/hardening/4.4_disable_prelink.sh +++ b/bin/hardening/4.4_disable_prelink.sh @@ -46,16 +46,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/4.5_enable_apparmor.sh b/bin/hardening/4.5_enable_apparmor.sh index ca18b1a..56db83e 100755 --- a/bin/hardening/4.5_enable_apparmor.sh +++ b/bin/hardening/4.5_enable_apparmor.sh @@ -43,16 +43,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/5.1.1_disable_nis.sh b/bin/hardening/5.1.1_disable_nis.sh index eca65d7..a700f50 100755 --- a/bin/hardening/5.1.1_disable_nis.sh +++ b/bin/hardening/5.1.1_disable_nis.sh @@ -44,16 +44,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/5.1.2_disable_rsh.sh b/bin/hardening/5.1.2_disable_rsh.sh index 58b08b5..fdcdad5 100755 --- a/bin/hardening/5.1.2_disable_rsh.sh +++ b/bin/hardening/5.1.2_disable_rsh.sh @@ -76,16 +76,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/5.1.3_disable_rsh_client.sh b/bin/hardening/5.1.3_disable_rsh_client.sh index e6da543..56f7aea 100755 --- a/bin/hardening/5.1.3_disable_rsh_client.sh +++ b/bin/hardening/5.1.3_disable_rsh_client.sh @@ -48,16 +48,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/5.1.4_disable_talk.sh b/bin/hardening/5.1.4_disable_talk.sh index e052c74..6486378 100755 --- a/bin/hardening/5.1.4_disable_talk.sh +++ b/bin/hardening/5.1.4_disable_talk.sh @@ -75,16 +75,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/5.1.5_disable_talk_client.sh b/bin/hardening/5.1.5_disable_talk_client.sh index 12317b9..c20a6a9 100755 --- a/bin/hardening/5.1.5_disable_talk_client.sh +++ b/bin/hardening/5.1.5_disable_talk_client.sh @@ -47,16 +47,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/5.1.6_disable_telnet_server.sh b/bin/hardening/5.1.6_disable_telnet_server.sh index 6db2b59..421022b 100755 --- a/bin/hardening/5.1.6_disable_telnet_server.sh +++ b/bin/hardening/5.1.6_disable_telnet_server.sh @@ -76,16 +76,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/5.1.7_disable_tftp_server.sh b/bin/hardening/5.1.7_disable_tftp_server.sh index 9921598..e9f1e86 100755 --- a/bin/hardening/5.1.7_disable_tftp_server.sh +++ b/bin/hardening/5.1.7_disable_tftp_server.sh @@ -75,16 +75,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/5.1.8_disable_inetd.sh b/bin/hardening/5.1.8_disable_inetd.sh index f032e3e..0c36249 100755 --- a/bin/hardening/5.1.8_disable_inetd.sh +++ b/bin/hardening/5.1.8_disable_inetd.sh @@ -47,16 +47,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/5.2_disable_chargen.sh b/bin/hardening/5.2_disable_chargen.sh index e96d435..2b715fa 100755 --- a/bin/hardening/5.2_disable_chargen.sh +++ b/bin/hardening/5.2_disable_chargen.sh @@ -56,16 +56,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/5.3_disable_daytime.sh b/bin/hardening/5.3_disable_daytime.sh index 8788a06..933e8a0 100755 --- a/bin/hardening/5.3_disable_daytime.sh +++ b/bin/hardening/5.3_disable_daytime.sh @@ -56,16 +56,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/5.4_disable_echo.sh b/bin/hardening/5.4_disable_echo.sh index f52b4dc..7cc3fe3 100755 --- a/bin/hardening/5.4_disable_echo.sh +++ b/bin/hardening/5.4_disable_echo.sh @@ -56,16 +56,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/5.5_disable_discard.sh b/bin/hardening/5.5_disable_discard.sh index 254c6a7..6a7f821 100755 --- a/bin/hardening/5.5_disable_discard.sh +++ b/bin/hardening/5.5_disable_discard.sh @@ -56,16 +56,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/5.6_disable_time.sh b/bin/hardening/5.6_disable_time.sh index a7075db..fc95166 100755 --- a/bin/hardening/5.6_disable_time.sh +++ b/bin/hardening/5.6_disable_time.sh @@ -56,16 +56,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/6.10_disable_http_server.sh b/bin/hardening/6.10_disable_http_server.sh index f0ca53c..b9db475 100755 --- a/bin/hardening/6.10_disable_http_server.sh +++ b/bin/hardening/6.10_disable_http_server.sh @@ -49,16 +49,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/6.11_disable_imap_pop.sh b/bin/hardening/6.11_disable_imap_pop.sh index a78b98f..c6a6add 100755 --- a/bin/hardening/6.11_disable_imap_pop.sh +++ b/bin/hardening/6.11_disable_imap_pop.sh @@ -49,16 +49,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/6.12_disable_samba.sh b/bin/hardening/6.12_disable_samba.sh index 1ff4825..3efbf66 100755 --- a/bin/hardening/6.12_disable_samba.sh +++ b/bin/hardening/6.12_disable_samba.sh @@ -48,16 +48,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/6.13_disable_http_proxy.sh b/bin/hardening/6.13_disable_http_proxy.sh index 654a596..1747a23 100755 --- a/bin/hardening/6.13_disable_http_proxy.sh +++ b/bin/hardening/6.13_disable_http_proxy.sh @@ -48,16 +48,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/6.14_disable_snmp_server.sh b/bin/hardening/6.14_disable_snmp_server.sh index 80a1d40..5d89d41 100755 --- a/bin/hardening/6.14_disable_snmp_server.sh +++ b/bin/hardening/6.14_disable_snmp_server.sh @@ -48,16 +48,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/6.15_mta_localhost.sh b/bin/hardening/6.15_mta_localhost.sh index f44800a..f21a86c 100755 --- a/bin/hardening/6.15_mta_localhost.sh +++ b/bin/hardening/6.15_mta_localhost.sh @@ -57,16 +57,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/6.16_disable_rsync.sh b/bin/hardening/6.16_disable_rsync.sh index 72645d7..32b77fa 100755 --- a/bin/hardening/6.16_disable_rsync.sh +++ b/bin/hardening/6.16_disable_rsync.sh @@ -59,16 +59,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/6.1_disable_xwindow_system.sh b/bin/hardening/6.1_disable_xwindow_system.sh index 1d6e339..421cff9 100755 --- a/bin/hardening/6.1_disable_xwindow_system.sh +++ b/bin/hardening/6.1_disable_xwindow_system.sh @@ -49,16 +49,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/6.2_disable_avahi_server.sh b/bin/hardening/6.2_disable_avahi_server.sh index cdde0b2..cc81eea 100755 --- a/bin/hardening/6.2_disable_avahi_server.sh +++ b/bin/hardening/6.2_disable_avahi_server.sh @@ -47,16 +47,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/6.3_disable_print_server.sh b/bin/hardening/6.3_disable_print_server.sh index f08321b..9174deb 100755 --- a/bin/hardening/6.3_disable_print_server.sh +++ b/bin/hardening/6.3_disable_print_server.sh @@ -48,16 +48,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/6.4_disable_dhcp.sh b/bin/hardening/6.4_disable_dhcp.sh index b0e48bf..ade7747 100755 --- a/bin/hardening/6.4_disable_dhcp.sh +++ b/bin/hardening/6.4_disable_dhcp.sh @@ -48,16 +48,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/6.5_configure_ntp.sh b/bin/hardening/6.5_configure_ntp.sh index aeb2504..fe022e8 100755 --- a/bin/hardening/6.5_configure_ntp.sh +++ b/bin/hardening/6.5_configure_ntp.sh @@ -76,16 +76,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/6.6_disable_ldap.sh b/bin/hardening/6.6_disable_ldap.sh index b811c62..444ca5b 100755 --- a/bin/hardening/6.6_disable_ldap.sh +++ b/bin/hardening/6.6_disable_ldap.sh @@ -48,16 +48,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/6.7_disable_nfs_rpc.sh b/bin/hardening/6.7_disable_nfs_rpc.sh index b43f9ff..c7ed1a6 100755 --- a/bin/hardening/6.7_disable_nfs_rpc.sh +++ b/bin/hardening/6.7_disable_nfs_rpc.sh @@ -48,16 +48,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/6.8_disable_dns_server.sh b/bin/hardening/6.8_disable_dns_server.sh index 856f5db..089ef98 100755 --- a/bin/hardening/6.8_disable_dns_server.sh +++ b/bin/hardening/6.8_disable_dns_server.sh @@ -48,16 +48,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/6.9_disable_ftp.sh b/bin/hardening/6.9_disable_ftp.sh index 7a429fc..b003d54 100755 --- a/bin/hardening/6.9_disable_ftp.sh +++ b/bin/hardening/6.9_disable_ftp.sh @@ -49,16 +49,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/7.1.1_disable_ip_forwarding.sh b/bin/hardening/7.1.1_disable_ip_forwarding.sh index 8022ba1..5b14d7b 100755 --- a/bin/hardening/7.1.1_disable_ip_forwarding.sh +++ b/bin/hardening/7.1.1_disable_ip_forwarding.sh @@ -49,16 +49,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/7.1.2_disable_send_packet_redirects.sh b/bin/hardening/7.1.2_disable_send_packet_redirects.sh index 4892bde..b53b418 100755 --- a/bin/hardening/7.1.2_disable_send_packet_redirects.sh +++ b/bin/hardening/7.1.2_disable_send_packet_redirects.sh @@ -59,16 +59,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/7.2.1_disable_source_routed_packets.sh b/bin/hardening/7.2.1_disable_source_routed_packets.sh index 74f0e32..2b6eccd 100755 --- a/bin/hardening/7.2.1_disable_source_routed_packets.sh +++ b/bin/hardening/7.2.1_disable_source_routed_packets.sh @@ -57,16 +57,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/7.2.2_disable_icmp_redirect.sh b/bin/hardening/7.2.2_disable_icmp_redirect.sh index 06b424c..c6b4129 100755 --- a/bin/hardening/7.2.2_disable_icmp_redirect.sh +++ b/bin/hardening/7.2.2_disable_icmp_redirect.sh @@ -57,16 +57,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/7.2.3_disable_secure_icmp_redirect.sh b/bin/hardening/7.2.3_disable_secure_icmp_redirect.sh index c0036fc..c3a83e3 100755 --- a/bin/hardening/7.2.3_disable_secure_icmp_redirect.sh +++ b/bin/hardening/7.2.3_disable_secure_icmp_redirect.sh @@ -57,16 +57,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/7.2.4_log_martian_packets.sh b/bin/hardening/7.2.4_log_martian_packets.sh index 7dc017d..6994964 100755 --- a/bin/hardening/7.2.4_log_martian_packets.sh +++ b/bin/hardening/7.2.4_log_martian_packets.sh @@ -57,16 +57,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/7.2.5_ignore_broadcast_requests.sh b/bin/hardening/7.2.5_ignore_broadcast_requests.sh index 35e92c8..e383bb5 100755 --- a/bin/hardening/7.2.5_ignore_broadcast_requests.sh +++ b/bin/hardening/7.2.5_ignore_broadcast_requests.sh @@ -57,16 +57,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/7.2.6_enable_bad_error_message_protection.sh b/bin/hardening/7.2.6_enable_bad_error_message_protection.sh index c9861cc..f020d88 100755 --- a/bin/hardening/7.2.6_enable_bad_error_message_protection.sh +++ b/bin/hardening/7.2.6_enable_bad_error_message_protection.sh @@ -57,16 +57,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/7.2.7_enable_source_route_validation.sh b/bin/hardening/7.2.7_enable_source_route_validation.sh index 8ecdc1b..fd1b062 100755 --- a/bin/hardening/7.2.7_enable_source_route_validation.sh +++ b/bin/hardening/7.2.7_enable_source_route_validation.sh @@ -57,16 +57,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/7.2.8_enable_tcp_syn_cookies.sh b/bin/hardening/7.2.8_enable_tcp_syn_cookies.sh index 3dd8a28..7d65932 100755 --- a/bin/hardening/7.2.8_enable_tcp_syn_cookies.sh +++ b/bin/hardening/7.2.8_enable_tcp_syn_cookies.sh @@ -57,16 +57,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/7.3.1_disable_ipv6_router_advertisement.sh b/bin/hardening/7.3.1_disable_ipv6_router_advertisement.sh index b7a1d6e..e0cba8f 100755 --- a/bin/hardening/7.3.1_disable_ipv6_router_advertisement.sh +++ b/bin/hardening/7.3.1_disable_ipv6_router_advertisement.sh @@ -67,16 +67,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/7.3.2_disable_ipv6_redirect.sh b/bin/hardening/7.3.2_disable_ipv6_redirect.sh index 31a330e..7eeff05 100755 --- a/bin/hardening/7.3.2_disable_ipv6_redirect.sh +++ b/bin/hardening/7.3.2_disable_ipv6_redirect.sh @@ -67,16 +67,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/7.3.3_disable_ipv6.sh b/bin/hardening/7.3.3_disable_ipv6.sh index d0bf7b5..74c8090 100755 --- a/bin/hardening/7.3.3_disable_ipv6.sh +++ b/bin/hardening/7.3.3_disable_ipv6.sh @@ -67,16 +67,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/7.4.1_install_tcp_wrapper.sh b/bin/hardening/7.4.1_install_tcp_wrapper.sh index 9c9b5b8..1bf05b9 100755 --- a/bin/hardening/7.4.1_install_tcp_wrapper.sh +++ b/bin/hardening/7.4.1_install_tcp_wrapper.sh @@ -42,16 +42,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/7.4.2_hosts_allow.sh b/bin/hardening/7.4.2_hosts_allow.sh index bdda7b3..8933004 100755 --- a/bin/hardening/7.4.2_hosts_allow.sh +++ b/bin/hardening/7.4.2_hosts_allow.sh @@ -43,16 +43,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/7.4.3_hosts_allow_permissions.sh b/bin/hardening/7.4.3_hosts_allow_permissions.sh index edf5fb0..40522be 100755 --- a/bin/hardening/7.4.3_hosts_allow_permissions.sh +++ b/bin/hardening/7.4.3_hosts_allow_permissions.sh @@ -43,16 +43,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/7.4.4_hosts_deny.sh b/bin/hardening/7.4.4_hosts_deny.sh index c4129ca..674d5d8 100755 --- a/bin/hardening/7.4.4_hosts_deny.sh +++ b/bin/hardening/7.4.4_hosts_deny.sh @@ -57,16 +57,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/7.4.5_hosts_deny_permissions.sh b/bin/hardening/7.4.5_hosts_deny_permissions.sh index 0e8ab2c..3e9d09a 100755 --- a/bin/hardening/7.4.5_hosts_deny_permissions.sh +++ b/bin/hardening/7.4.5_hosts_deny_permissions.sh @@ -43,16 +43,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/7.5.1_disable_dccp.sh b/bin/hardening/7.5.1_disable_dccp.sh index 54c1853..1df20c9 100755 --- a/bin/hardening/7.5.1_disable_dccp.sh +++ b/bin/hardening/7.5.1_disable_dccp.sh @@ -29,16 +29,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/7.5.2_disable_sctp.sh b/bin/hardening/7.5.2_disable_sctp.sh index e22d5cd..b0c6785 100755 --- a/bin/hardening/7.5.2_disable_sctp.sh +++ b/bin/hardening/7.5.2_disable_sctp.sh @@ -29,16 +29,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/7.5.3_disable_rds.sh b/bin/hardening/7.5.3_disable_rds.sh index 65f043d..e567c75 100755 --- a/bin/hardening/7.5.3_disable_rds.sh +++ b/bin/hardening/7.5.3_disable_rds.sh @@ -29,16 +29,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/7.5.4_disable_tipc.sh b/bin/hardening/7.5.4_disable_tipc.sh index 479e448..a83a5ff 100755 --- a/bin/hardening/7.5.4_disable_tipc.sh +++ b/bin/hardening/7.5.4_disable_tipc.sh @@ -29,16 +29,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/7.6_disable_wireless.sh b/bin/hardening/7.6_disable_wireless.sh index fda6894..ee77136 100755 --- a/bin/hardening/7.6_disable_wireless.sh +++ b/bin/hardening/7.6_disable_wireless.sh @@ -29,16 +29,25 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi +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 +## Source Root Dir Parameter +#if [ ! -r /etc/default/cis-hardening ]; then +# echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" +# exit 128 +#else +# . /etc/default/cis-hardening +# if [ -z ${CIS_ROOT_DIR:-} ]; then +# echo "No CIS_ROOT_DIR variable, aborting" +# exit 128 +# fi +#fi # Main function, will call the proper functions given the configuration (audit, enabled, disabled) if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then diff --git a/bin/hardening/7.7_enable_firewall.sh b/bin/hardening/7.7_enable_firewall.sh index c6131e6..7de9fb6 100755 --- a/bin/hardening/7.7_enable_firewall.sh +++ b/bin/hardening/7.7_enable_firewall.sh @@ -45,16 +45,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/8.0_enable_auditd_kernel.sh b/bin/hardening/8.0_enable_auditd_kernel.sh index 8739aa2..da07c15 100755 --- a/bin/hardening/8.0_enable_auditd_kernel.sh +++ b/bin/hardening/8.0_enable_auditd_kernel.sh @@ -46,16 +46,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/8.1.1.1_audit_log_storage.sh b/bin/hardening/8.1.1.1_audit_log_storage.sh index 77b7813..e83ad66 100755 --- a/bin/hardening/8.1.1.1_audit_log_storage.sh +++ b/bin/hardening/8.1.1.1_audit_log_storage.sh @@ -57,16 +57,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/8.1.1.2_halt_when_audit_log_full.sh b/bin/hardening/8.1.1.2_halt_when_audit_log_full.sh index 48ca617..59255be 100755 --- a/bin/hardening/8.1.1.2_halt_when_audit_log_full.sh +++ b/bin/hardening/8.1.1.2_halt_when_audit_log_full.sh @@ -75,16 +75,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/8.1.1.3_keep_all_audit_logs.sh b/bin/hardening/8.1.1.3_keep_all_audit_logs.sh index c1fe614..46ac4d7 100755 --- a/bin/hardening/8.1.1.3_keep_all_audit_logs.sh +++ b/bin/hardening/8.1.1.3_keep_all_audit_logs.sh @@ -75,16 +75,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/8.1.10_record_dac_edit.sh b/bin/hardening/8.1.10_record_dac_edit.sh index 6aae374..3559eb7 100755 --- a/bin/hardening/8.1.10_record_dac_edit.sh +++ b/bin/hardening/8.1.10_record_dac_edit.sh @@ -57,16 +57,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/8.1.11_record_failed_access_file.sh b/bin/hardening/8.1.11_record_failed_access_file.sh index 7bda7c9..f411283 100755 --- a/bin/hardening/8.1.11_record_failed_access_file.sh +++ b/bin/hardening/8.1.11_record_failed_access_file.sh @@ -55,16 +55,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/8.1.12_record_privileged_commands.sh b/bin/hardening/8.1.12_record_privileged_commands.sh index 1bbf4e5..856e52c 100755 --- a/bin/hardening/8.1.12_record_privileged_commands.sh +++ b/bin/hardening/8.1.12_record_privileged_commands.sh @@ -55,16 +55,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/8.1.13_record_successful_mount.sh b/bin/hardening/8.1.13_record_successful_mount.sh index 8f5826a..c3e411b 100755 --- a/bin/hardening/8.1.13_record_successful_mount.sh +++ b/bin/hardening/8.1.13_record_successful_mount.sh @@ -53,16 +53,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/8.1.14_record_file_deletions.sh b/bin/hardening/8.1.14_record_file_deletions.sh index 6b5c476..07d6acb 100755 --- a/bin/hardening/8.1.14_record_file_deletions.sh +++ b/bin/hardening/8.1.14_record_file_deletions.sh @@ -53,16 +53,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/8.1.15_record_sudoers_edit.sh b/bin/hardening/8.1.15_record_sudoers_edit.sh index 64c1cb5..6d22771 100755 --- a/bin/hardening/8.1.15_record_sudoers_edit.sh +++ b/bin/hardening/8.1.15_record_sudoers_edit.sh @@ -53,16 +53,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/8.1.16_record_sudo_usage.sh b/bin/hardening/8.1.16_record_sudo_usage.sh index b0e8a74..489602b 100755 --- a/bin/hardening/8.1.16_record_sudo_usage.sh +++ b/bin/hardening/8.1.16_record_sudo_usage.sh @@ -52,16 +52,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/8.1.17_record_kernel_modules.sh b/bin/hardening/8.1.17_record_kernel_modules.sh index f4500c3..d6f48f2 100755 --- a/bin/hardening/8.1.17_record_kernel_modules.sh +++ b/bin/hardening/8.1.17_record_kernel_modules.sh @@ -55,16 +55,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/8.1.18_freeze_auditd_conf.sh b/bin/hardening/8.1.18_freeze_auditd_conf.sh index 4fa408e..2342621 100755 --- a/bin/hardening/8.1.18_freeze_auditd_conf.sh +++ b/bin/hardening/8.1.18_freeze_auditd_conf.sh @@ -52,16 +52,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/8.1.2_enable_auditd.sh b/bin/hardening/8.1.2_enable_auditd.sh index 50926b7..908d64c 100755 --- a/bin/hardening/8.1.2_enable_auditd.sh +++ b/bin/hardening/8.1.2_enable_auditd.sh @@ -57,16 +57,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/8.1.3_audit_bootloader.sh b/bin/hardening/8.1.3_audit_bootloader.sh index d1ef1e9..96bb93f 100755 --- a/bin/hardening/8.1.3_audit_bootloader.sh +++ b/bin/hardening/8.1.3_audit_bootloader.sh @@ -75,16 +75,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/8.1.4_record_date_time_edit.sh b/bin/hardening/8.1.4_record_date_time_edit.sh index 113777f..41de3f5 100755 --- a/bin/hardening/8.1.4_record_date_time_edit.sh +++ b/bin/hardening/8.1.4_record_date_time_edit.sh @@ -56,16 +56,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/8.1.5_record_user_group_edit.sh b/bin/hardening/8.1.5_record_user_group_edit.sh index 46d6adf..1fa0777 100755 --- a/bin/hardening/8.1.5_record_user_group_edit.sh +++ b/bin/hardening/8.1.5_record_user_group_edit.sh @@ -56,16 +56,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/8.1.6_record_network_edit.sh b/bin/hardening/8.1.6_record_network_edit.sh index 0d3583e..e1e2dc9 100755 --- a/bin/hardening/8.1.6_record_network_edit.sh +++ b/bin/hardening/8.1.6_record_network_edit.sh @@ -57,16 +57,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/8.1.7_record_mac_edit.sh b/bin/hardening/8.1.7_record_mac_edit.sh index 4fa59a4..756f45d 100755 --- a/bin/hardening/8.1.7_record_mac_edit.sh +++ b/bin/hardening/8.1.7_record_mac_edit.sh @@ -52,16 +52,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/8.1.8_record_login_logout.sh b/bin/hardening/8.1.8_record_login_logout.sh index 70572f4..7ee224a 100755 --- a/bin/hardening/8.1.8_record_login_logout.sh +++ b/bin/hardening/8.1.8_record_login_logout.sh @@ -54,16 +54,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/8.1.9_record_session_init.sh b/bin/hardening/8.1.9_record_session_init.sh index e3774d1..807721d 100755 --- a/bin/hardening/8.1.9_record_session_init.sh +++ b/bin/hardening/8.1.9_record_session_init.sh @@ -54,16 +54,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/8.2.1_install_syslog-ng.sh b/bin/hardening/8.2.1_install_syslog-ng.sh index 03b41a9..83b549e 100755 --- a/bin/hardening/8.2.1_install_syslog-ng.sh +++ b/bin/hardening/8.2.1_install_syslog-ng.sh @@ -43,16 +43,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/8.2.2_enable_syslog-ng.sh b/bin/hardening/8.2.2_enable_syslog-ng.sh index 930eefa..5b08173 100755 --- a/bin/hardening/8.2.2_enable_syslog-ng.sh +++ b/bin/hardening/8.2.2_enable_syslog-ng.sh @@ -45,16 +45,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/8.2.3_configure_syslog-ng.sh b/bin/hardening/8.2.3_configure_syslog-ng.sh index d7ebffa..a8a31d2 100755 --- a/bin/hardening/8.2.3_configure_syslog-ng.sh +++ b/bin/hardening/8.2.3_configure_syslog-ng.sh @@ -33,16 +33,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/8.2.4_set_logfile_perm.sh b/bin/hardening/8.2.4_set_logfile_perm.sh index 8796eba..c599688 100755 --- a/bin/hardening/8.2.4_set_logfile_perm.sh +++ b/bin/hardening/8.2.4_set_logfile_perm.sh @@ -89,16 +89,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/8.2.5_syslog-ng_remote_host.sh b/bin/hardening/8.2.5_syslog-ng_remote_host.sh index 4305cf6..20112aa 100755 --- a/bin/hardening/8.2.5_syslog-ng_remote_host.sh +++ b/bin/hardening/8.2.5_syslog-ng_remote_host.sh @@ -51,16 +51,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/8.2.6_remote_syslog-ng_acl.sh b/bin/hardening/8.2.6_remote_syslog-ng_acl.sh index eb322b4..7d27831 100755 --- a/bin/hardening/8.2.6_remote_syslog-ng_acl.sh +++ b/bin/hardening/8.2.6_remote_syslog-ng_acl.sh @@ -29,16 +29,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/8.3.1_install_tripwire.sh b/bin/hardening/8.3.1_install_tripwire.sh index 60d24c1..cc24616 100755 --- a/bin/hardening/8.3.1_install_tripwire.sh +++ b/bin/hardening/8.3.1_install_tripwire.sh @@ -44,16 +44,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/8.3.2_tripwire_cron.sh b/bin/hardening/8.3.2_tripwire_cron.sh index 45097c1..6c09836 100755 --- a/bin/hardening/8.3.2_tripwire_cron.sh +++ b/bin/hardening/8.3.2_tripwire_cron.sh @@ -43,15 +43,13 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi +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) diff --git a/bin/hardening/8.4_configure_logrotate.sh b/bin/hardening/8.4_configure_logrotate.sh index 48a31e6..585d0f6 100755 --- a/bin/hardening/8.4_configure_logrotate.sh +++ b/bin/hardening/8.4_configure_logrotate.sh @@ -33,16 +33,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/9.1.1_enable_cron.sh b/bin/hardening/9.1.1_enable_cron.sh index e14aeac..405428f 100755 --- a/bin/hardening/9.1.1_enable_cron.sh +++ b/bin/hardening/9.1.1_enable_cron.sh @@ -57,16 +57,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/9.1.2_crontab_perm_ownership.sh b/bin/hardening/9.1.2_crontab_perm_ownership.sh index c23e2c5..b88a902 100755 --- a/bin/hardening/9.1.2_crontab_perm_ownership.sh +++ b/bin/hardening/9.1.2_crontab_perm_ownership.sh @@ -72,16 +72,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/9.1.3_cron_hourly_perm_ownership.sh b/bin/hardening/9.1.3_cron_hourly_perm_ownership.sh index 956816e..416139d 100755 --- a/bin/hardening/9.1.3_cron_hourly_perm_ownership.sh +++ b/bin/hardening/9.1.3_cron_hourly_perm_ownership.sh @@ -72,16 +72,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/9.1.4_cron_daily_perm_ownership.sh b/bin/hardening/9.1.4_cron_daily_perm_ownership.sh index bb1281f..fe5a179 100755 --- a/bin/hardening/9.1.4_cron_daily_perm_ownership.sh +++ b/bin/hardening/9.1.4_cron_daily_perm_ownership.sh @@ -72,16 +72,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/9.1.5_cron_weekly_perm_ownership.sh b/bin/hardening/9.1.5_cron_weekly_perm_ownership.sh index c04e033..d38b827 100755 --- a/bin/hardening/9.1.5_cron_weekly_perm_ownership.sh +++ b/bin/hardening/9.1.5_cron_weekly_perm_ownership.sh @@ -72,16 +72,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/9.1.6_cron_monthly_perm_ownership.sh b/bin/hardening/9.1.6_cron_monthly_perm_ownership.sh index 27c8828..752c256 100755 --- a/bin/hardening/9.1.6_cron_monthly_perm_ownership.sh +++ b/bin/hardening/9.1.6_cron_monthly_perm_ownership.sh @@ -72,16 +72,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/9.1.7_cron_d_perm_ownership.sh b/bin/hardening/9.1.7_cron_d_perm_ownership.sh index e00609b..9e6092c 100755 --- a/bin/hardening/9.1.7_cron_d_perm_ownership.sh +++ b/bin/hardening/9.1.7_cron_d_perm_ownership.sh @@ -72,16 +72,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/9.1.8_cron_users.sh b/bin/hardening/9.1.8_cron_users.sh index fd9dec2..add1a1a 100755 --- a/bin/hardening/9.1.8_cron_users.sh +++ b/bin/hardening/9.1.8_cron_users.sh @@ -99,16 +99,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/9.2.1_enable_cracklib.sh b/bin/hardening/9.2.1_enable_cracklib.sh index c527321..e62b467 100755 --- a/bin/hardening/9.2.1_enable_cracklib.sh +++ b/bin/hardening/9.2.1_enable_cracklib.sh @@ -57,16 +57,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/9.2.2_enable_lockout_failed_password.sh b/bin/hardening/9.2.2_enable_lockout_failed_password.sh index f9050e8..cfe611f 100755 --- a/bin/hardening/9.2.2_enable_lockout_failed_password.sh +++ b/bin/hardening/9.2.2_enable_lockout_failed_password.sh @@ -57,16 +57,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/9.2.3_limit_password_reuse.sh b/bin/hardening/9.2.3_limit_password_reuse.sh index f1fb1f0..532f08f 100755 --- a/bin/hardening/9.2.3_limit_password_reuse.sh +++ b/bin/hardening/9.2.3_limit_password_reuse.sh @@ -57,16 +57,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/9.3.10_disable_sshd_setenv.sh b/bin/hardening/9.3.10_disable_sshd_setenv.sh index 920752d..990e6d8 100755 --- a/bin/hardening/9.3.10_disable_sshd_setenv.sh +++ b/bin/hardening/9.3.10_disable_sshd_setenv.sh @@ -74,16 +74,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/9.3.11_sshd_ciphers.sh b/bin/hardening/9.3.11_sshd_ciphers.sh index c521cc0..ea67d72 100755 --- a/bin/hardening/9.3.11_sshd_ciphers.sh +++ b/bin/hardening/9.3.11_sshd_ciphers.sh @@ -74,16 +74,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/9.3.12_sshd_idle_timeout.sh b/bin/hardening/9.3.12_sshd_idle_timeout.sh index 0faa949..bf2a2b7 100755 --- a/bin/hardening/9.3.12_sshd_idle_timeout.sh +++ b/bin/hardening/9.3.12_sshd_idle_timeout.sh @@ -88,16 +88,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/9.3.13_sshd_limit_access.sh b/bin/hardening/9.3.13_sshd_limit_access.sh index 6610449..f87d23f 100755 --- a/bin/hardening/9.3.13_sshd_limit_access.sh +++ b/bin/hardening/9.3.13_sshd_limit_access.sh @@ -104,16 +104,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/9.3.14_ssh_banner.sh b/bin/hardening/9.3.14_ssh_banner.sh index cda4516..86c3410 100755 --- a/bin/hardening/9.3.14_ssh_banner.sh +++ b/bin/hardening/9.3.14_ssh_banner.sh @@ -84,16 +84,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/9.3.1_sshd_protocol.sh b/bin/hardening/9.3.1_sshd_protocol.sh index 7b63d02..26ee7d7 100755 --- a/bin/hardening/9.3.1_sshd_protocol.sh +++ b/bin/hardening/9.3.1_sshd_protocol.sh @@ -74,16 +74,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/9.3.2_sshd_loglevel.sh b/bin/hardening/9.3.2_sshd_loglevel.sh index ad70578..7f614e3 100755 --- a/bin/hardening/9.3.2_sshd_loglevel.sh +++ b/bin/hardening/9.3.2_sshd_loglevel.sh @@ -74,16 +74,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/9.3.3_sshd_conf_perm_ownership.sh b/bin/hardening/9.3.3_sshd_conf_perm_ownership.sh index 13b3933..0de46eb 100755 --- a/bin/hardening/9.3.3_sshd_conf_perm_ownership.sh +++ b/bin/hardening/9.3.3_sshd_conf_perm_ownership.sh @@ -72,16 +72,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/9.3.4_disable_x11_forwarding.sh b/bin/hardening/9.3.4_disable_x11_forwarding.sh index b82c8b4..e865062 100755 --- a/bin/hardening/9.3.4_disable_x11_forwarding.sh +++ b/bin/hardening/9.3.4_disable_x11_forwarding.sh @@ -74,16 +74,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/9.3.5_sshd_maxauthtries.sh b/bin/hardening/9.3.5_sshd_maxauthtries.sh index 3cd5a52..fd0aa36 100755 --- a/bin/hardening/9.3.5_sshd_maxauthtries.sh +++ b/bin/hardening/9.3.5_sshd_maxauthtries.sh @@ -74,16 +74,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/9.3.6_enable_sshd_ignorerhosts.sh b/bin/hardening/9.3.6_enable_sshd_ignorerhosts.sh index 7ae0e55..ff50d7a 100755 --- a/bin/hardening/9.3.6_enable_sshd_ignorerhosts.sh +++ b/bin/hardening/9.3.6_enable_sshd_ignorerhosts.sh @@ -74,16 +74,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/9.3.7_disable_sshd_hostbasedauthentication.sh b/bin/hardening/9.3.7_disable_sshd_hostbasedauthentication.sh index b9b8021..f902c2a 100755 --- a/bin/hardening/9.3.7_disable_sshd_hostbasedauthentication.sh +++ b/bin/hardening/9.3.7_disable_sshd_hostbasedauthentication.sh @@ -74,16 +74,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/9.3.8_disable_root_login.sh b/bin/hardening/9.3.8_disable_root_login.sh index 1ddcfb1..a22f717 100755 --- a/bin/hardening/9.3.8_disable_root_login.sh +++ b/bin/hardening/9.3.8_disable_root_login.sh @@ -74,16 +74,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/9.3.9_disable_sshd_permitemptypasswords.sh b/bin/hardening/9.3.9_disable_sshd_permitemptypasswords.sh index 772bc41..be0ae71 100755 --- a/bin/hardening/9.3.9_disable_sshd_permitemptypasswords.sh +++ b/bin/hardening/9.3.9_disable_sshd_permitemptypasswords.sh @@ -74,16 +74,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/9.4_secure_tty.sh b/bin/hardening/9.4_secure_tty.sh index 71db30e..aa7cd56 100755 --- a/bin/hardening/9.4_secure_tty.sh +++ b/bin/hardening/9.4_secure_tty.sh @@ -33,16 +33,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/9.5_restrict_su.sh b/bin/hardening/9.5_restrict_su.sh index 6eba2c1..d86ba33 100755 --- a/bin/hardening/9.5_restrict_su.sh +++ b/bin/hardening/9.5_restrict_su.sh @@ -57,16 +57,14 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi -fi +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 diff --git a/bin/hardening/99.1_timeout_tty.sh b/bin/hardening/99.1_timeout_tty.sh index 6d8c745..f1c25e8 100755 --- a/bin/hardening/99.1_timeout_tty.sh +++ b/bin/hardening/99.1_timeout_tty.sh @@ -94,15 +94,13 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi +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) diff --git a/bin/hardening/99.2_disable_usb_devices.sh b/bin/hardening/99.2_disable_usb_devices.sh index 5b2244e..d8399f2 100755 --- a/bin/hardening/99.2_disable_usb_devices.sh +++ b/bin/hardening/99.2_disable_usb_devices.sh @@ -101,15 +101,13 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z ${CIS_ROOT_DIR:-} ]; then - echo "No CIS_ROOT_DIR variable, aborting" - exit 128 - fi +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) diff --git a/src/skel b/src/skel index b3b4941..b93d4be 100644 --- a/src/skel +++ b/src/skel @@ -27,15 +27,15 @@ check_config() { } # Source Root Dir Parameter -if [ ! -r /etc/default/cis-hardening ]; then - echo "There is no /etc/default/cis-hardening file, cannot source CIS_ROOT_DIR variable, aborting" - exit 128 -else +if [ -r /etc/default/cis-hardening ]; then . /etc/default/cis-hardening - if [ -z $CIS_ROOT_DIR ]; then - echo "No CIS_ROOT_DIR variable, aborting" - fi -fi +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 +[ -r "$CIS_ROOT_DIR"/lib/main.sh ] && . $CIS_ROOT_DIR/lib/main.sh +