Fix issues #37 need extra checks on audisp path on Ubuntu.

This commit is contained in:
Samson-W 2022-08-25 18:11:23 +00:00
parent dbbec7cc98
commit 3bb4e50a7c
6 changed files with 56 additions and 12 deletions

View File

@ -205,15 +205,21 @@ fi
[ -r $CIS_ROOT_DIR/lib/common.sh ] && . $CIS_ROOT_DIR/lib/common.sh [ -r $CIS_ROOT_DIR/lib/common.sh ] && . $CIS_ROOT_DIR/lib/common.sh
[ -r $CIS_ROOT_DIR/lib/utils.sh ] && . $CIS_ROOT_DIR/lib/utils.sh [ -r $CIS_ROOT_DIR/lib/utils.sh ] && . $CIS_ROOT_DIR/lib/utils.sh
### Debian: OS_RELEASE=1 Redhat/centos: OS_RELEASE=2 Ubuntu: OS_RELEASE=3
# For --init # For --init
if [ $INIT_G_CONFIG -eq 1 ]; then if [ $INIT_G_CONFIG -eq 1 ]; then
if [ -r /etc/redhat-release ]; then if [ -r /etc/redhat-release ]; then
info "This OS is redhat/CentOS." info "This OS is redhat/CentOS."
sed -i 's/^OS_RELEASE=.*/OS_RELEASE=2/g' /etc/default/cis-hardening sed -i 's/^OS_RELEASE=.*/OS_RELEASE=2/g' /etc/default/cis-hardening
. /etc/default/cis-hardening . /etc/default/cis-hardening
elif [ $(grep -i Ubuntu /etc/lsb-release -c) -gt 0 ]; then
info "This OS is Ubuntu."
sed -i 's/^OS_RELEASE=.*/OS_RELEASE=3/g' /etc/default/cis-hardening
. /etc/default/cis-hardening
elif [ -r /etc/debian_version ]; then elif [ -r /etc/debian_version ]; then
info "This OS is Debian." info "This OS is Debian."
: sed -i 's/^OS_RELEASE=.*/OS_RELEASE=1/g' /etc/default/cis-hardening
. /etc/default/cis-hardening
else else
crit "This OS not support!" crit "This OS not support!"
exit 128 exit 128
@ -225,6 +231,8 @@ if [ $OS_RELEASE -eq 1 ]; then
info "Start auditing for Debian." info "Start auditing for Debian."
elif [ $OS_RELEASE -eq 2 ]; then elif [ $OS_RELEASE -eq 2 ]; then
info "Start auditing for redhat/CentOS." info "Start auditing for redhat/CentOS."
elif [ $OS_RELEASE -eq 3 ]; then
info "Start auditing for Ubuntu."
else else
crit "This OS not support!" crit "This OS not support!"
exit 128 exit 128
@ -251,9 +259,9 @@ if [ $FINAL_G_CONFIG -eq 1 ]; then
# Reinit aide database # Reinit aide database
info "Will reinitialize the AIDE database" info "Will reinitialize the AIDE database"
if [ $OS_RELEASE -eq 1 ]; then if [ $OS_RELEASE -eq 1 -o $OS_RELEASE -eq 3 ]; then
aideinit aideinit
elif [ $OS_RELEASE -eq 2 ]; then elif [ $OS_RELEASE -eq 2]; then
aide --init aide --init
mv /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz mv /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz
fi fi

View File

@ -15,7 +15,6 @@ set -u # One variable unset, it's over
HARDENING_LEVEL=4 HARDENING_LEVEL=4
PACKAGE='audispd-plugins' PACKAGE='audispd-plugins'
FILE='/etc/audisp/audisp-remote.conf'
PATTERN='remote_server' PATTERN='remote_server'
# This function will be called if the script status is on enabled / audit mode # This function will be called if the script status is on enabled / audit mode
@ -59,7 +58,12 @@ apply () {
# This function will check config parameters required # This function will check config parameters required
check_config() { check_config() {
: #Ubuntu
if [ $OS_RELEASE -eq 3 ]; then
FILE='/etc/audit/audisp-remote.conf'
else
FILE='/etc/audisp/audisp-remote.conf'
fi
} }
# Source Root Dir Parameter # Source Root Dir Parameter

View File

@ -15,7 +15,6 @@ set -u # One variable unset, it's over
HARDENING_LEVEL=4 HARDENING_LEVEL=4
PACKAGE='audispd-plugins' PACKAGE='audispd-plugins'
FILE='/etc/audisp/audisp-remote.conf'
PATTERN='enable_krb5' PATTERN='enable_krb5'
SETVALUE='yes' SETVALUE='yes'
@ -68,7 +67,12 @@ apply () {
# This function will check config parameters required # This function will check config parameters required
check_config() { check_config() {
: #Ubuntu
if [ $OS_RELEASE -eq 3 ]; then
FILE='/etc/audit/audisp-remote.conf'
else
FILE='/etc/audisp/audisp-remote.conf'
fi
} }
# Source Root Dir Parameter # Source Root Dir Parameter

View File

@ -15,7 +15,6 @@ set -u # One variable unset, it's over
HARDENING_LEVEL=4 HARDENING_LEVEL=4
PACKAGE='audispd-plugins' PACKAGE='audispd-plugins'
FILE='/etc/audisp/audisp-remote.conf'
PATTERN='disk_full_action' PATTERN='disk_full_action'
SETVALUE='syslog' SETVALUE='syslog'
@ -70,7 +69,12 @@ apply () {
# This function will check config parameters required # This function will check config parameters required
check_config() { check_config() {
: #Ubuntu
if [ $OS_RELEASE -eq 3 ]; then
FILE='/etc/audit/audisp-remote.conf'
else
FILE='/etc/audisp/audisp-remote.conf'
fi
} }
# Source Root Dir Parameter # Source Root Dir Parameter

View File

@ -15,7 +15,6 @@ set -u # One variable unset, it's over
HARDENING_LEVEL=4 HARDENING_LEVEL=4
PACKAGE='audispd-plugins' PACKAGE='audispd-plugins'
FILE='/etc/audisp/audisp-remote.conf'
PATTERN='network_failure_action' PATTERN='network_failure_action'
SETVALUE='syslog' SETVALUE='syslog'
@ -70,7 +69,12 @@ apply () {
# This function will check config parameters required # This function will check config parameters required
check_config() { check_config() {
: #Ubuntu
if [ $OS_RELEASE -eq 3 ]; then
FILE='/etc/audit/audisp-remote.conf'
else
FILE='/etc/audisp/audisp-remote.conf'
fi
} }
# Source Root Dir Parameter # Source Root Dir Parameter

View File

@ -89,8 +89,26 @@ check_config() {
-a always,exit -F path=/etc/audisp/plugins.d/au-remote.conf -F perm=wa -k config_file_change -a always,exit -F path=/etc/audisp/plugins.d/au-remote.conf -F perm=wa -k config_file_change
-a always,exit -F path=/etc/logrotate.conf -F perm=wa -k config_file_change -a always,exit -F path=/etc/logrotate.conf -F perm=wa -k config_file_change
-a always,exit -F dir=/etc/logrotate.d/ -F perm=wa -k config_file_change' -a always,exit -F dir=/etc/logrotate.d/ -F perm=wa -k config_file_change'
# Ubuntu
elif [ $OS_RELEASE -eq 3 ]; then
AUDIT_PARAMS='-a always,exit -F path=/etc/audit/audisp-remote.conf -F perm=wa -k config_file_change
-a always,exit -F path=/etc/audit/auditd.conf -F perm=wa -k config_file_change
-a always,exit -F path=/etc/default/grub -F perm=wa -k config_file_change
-a always,exit -F path=/etc/fstab -F perm=wa -k config_file_change
-a always,exit -F path=/etc/hosts.deny -F perm=wa -k config_file_change
-a always,exit -F path=/etc/login.defs -F perm=wa -k config_file_change
-a always,exit -F dir=/etc/audit/rules.d/ -F perm=wa -k config_file_change
-a always,exit -F dir=/etc/pam.d/ -F perm=wa -k config_file_change
-a always,exit -F path=/etc/profile -F perm=wa -k config_file_change
-a always,exit -F dir=/etc/profile.d/ -F perm=wa -k config_file_change
-a always,exit -F dir=/etc/security/ -F perm=wa -k config_file_change
-a always,exit -F dir=/etc/iptables/ -F perm=wa -k config_file_change
-a always,exit -F path=/etc/sysctl.conf -F perm=wa -k config_file_change
-a always,exit -F path=/etc/rsyslog.conf -F perm=wa -k config_file_change
-a always,exit -F path=/etc/audisp/plugins.d/au-remote.conf -F perm=wa -k config_file_change
-a always,exit -F path=/etc/logrotate.conf -F perm=wa -k config_file_change'
# Debian # Debian
else elif [ $OS_RELEASE -eq 1 ]; then
AUDIT_PARAMS='-a always,exit -F path=/etc/audisp/audisp-remote.conf -F perm=wa -k config_file_change AUDIT_PARAMS='-a always,exit -F path=/etc/audisp/audisp-remote.conf -F perm=wa -k config_file_change
-a always,exit -F path=/etc/audit/auditd.conf -F perm=wa -k config_file_change -a always,exit -F path=/etc/audit/auditd.conf -F perm=wa -k config_file_change
-a always,exit -F path=/etc/default/grub -F perm=wa -k config_file_change -a always,exit -F path=/etc/default/grub -F perm=wa -k config_file_change
@ -108,6 +126,8 @@ check_config() {
-a always,exit -F path=/etc/audisp/plugins.d/au-remote.conf -F perm=wa -k config_file_change -a always,exit -F path=/etc/audisp/plugins.d/au-remote.conf -F perm=wa -k config_file_change
-a always,exit -F path=/etc/logrotate.conf -F perm=wa -k config_file_change -a always,exit -F path=/etc/logrotate.conf -F perm=wa -k config_file_change
-a always,exit -F dir=/etc/logrotate.d/ -F perm=wa -k config_file_change' -a always,exit -F dir=/etc/logrotate.d/ -F perm=wa -k config_file_change'
else
warn "No support!!!"
fi fi
} }