Fix #48: Debian 12 errors : Current OS is not support!

This commit is contained in:
Samson-W 2023-06-13 01:23:56 +08:00
parent 0ab75f8fa8
commit 4699911078
17 changed files with 96 additions and 169 deletions

View File

@ -1,7 +1,7 @@
#!/bin/bash
#
# harbian-audit for Debian GNU/Linux Debian 9 or CentOS 8 Hardening
# harbian-audit for Debian GNU/Linux Debian 9/10/11/12 or CentOS 8 Hardening
# Modify by: Samson-W (samson@hardenedlinux.org)
#
@ -47,13 +47,10 @@ audit_centos ()
# This function will be called if the script status is on enabled / audit mode
audit ()
{
if [ $OS_RELEASE -eq 1 ]; then
audit_debian
elif [ $OS_RELEASE -eq 2 ]; then
if [ $OS_RELEASE -eq 2 ]; then
audit_centos
else
crit "Current OS is not support!"
FNRET=44
audit_debian
fi
}
@ -82,12 +79,10 @@ apply_centos ()
# This function will be called if the script status is on enabled mode
apply ()
{
if [ $OS_RELEASE -eq 1 ]; then
apply_debian
elif [ $OS_RELEASE -eq 2 ]; then
if [ $OS_RELEASE -eq 2 ]; then
apply_centos
else
crit "Current OS is not support!"
apply_debian
fi
}

View File

@ -1,7 +1,7 @@
#!/bin/bash
#
# harbian-audit for Debian GNU/Linux Debian 9 or CentOS 8 Hardening
# harbian-audit for Debian GNU/Linux Debian 9/10/11/12 or CentOS 8 Hardening
#
#
@ -47,13 +47,10 @@ audit_centos ()
# This function will be called if the script status is on enabled / audit mode
audit ()
{
if [ $OS_RELEASE -eq 1 ]; then
audit_debian
elif [ $OS_RELEASE -eq 2 ]; then
if [ $OS_RELEASE -eq 2 ]; then
audit_centos
else
crit "Current OS is not support!"
FNRET=44
audit_debian
fi
}
@ -87,12 +84,10 @@ apply_centos () {
# This function will be called if the script status is on enabled mode
apply () {
if [ $OS_RELEASE -eq 1 ]; then
apply_debian
elif [ $OS_RELEASE -eq 2 ]; then
if [ $OS_RELEASE -eq 2 ]; then
apply_centos
else
crit "Current OS is not support!"
apply_debian
fi
}

View File

@ -1,7 +1,7 @@
#!/bin/bash
#
# harbian-audit for Debian GNU/Linux Debian 9 or CentOS 8 Hardening
# harbian-audit for Debian GNU/Linux Debian 9/10/11/12 or CentOS 8 Hardening
#
#
@ -49,13 +49,10 @@ audit_centos ()
# This function will be called if the script status is on enabled / audit mode
audit()
{
if [ $OS_RELEASE -eq 1 ]; then
audit_debian
elif [ $OS_RELEASE -eq 2 ]; then
if [ $OS_RELEASE -eq 2 ]; then
audit_centos
else
crit "Current OS is not support!"
FNRET=44
audit_debian
fi
}
@ -86,12 +83,10 @@ apply_centos () {
# This function will be called if the script status is on enabled mode
apply () {
if [ $OS_RELEASE -eq 1 ]; then
apply_debian
elif [ $OS_RELEASE -eq 2 ]; then
if [ $OS_RELEASE -eq 2 ]; then
apply_centos
else
crit "Current OS is not support!"
apply_debian
fi
}
# This function will check config parameters required

View File

@ -1,7 +1,7 @@
#!/bin/bash
#
# harbian-audit for Debian GNU/Linux Debian 9 or CentOS 8 Hardening
# harbian-audit for Debian GNU/Linux Debian 9/10/11/12 or CentOS 8 Hardening
#
#
@ -46,13 +46,10 @@ audit_centos ()
# This function will be called if the script status is on enabled / audit mode
audit () {
if [ $OS_RELEASE -eq 1 ]; then
audit_debian
elif [ $OS_RELEASE -eq 2 ]; then
if [ $OS_RELEASE -eq 2 ]; then
audit_centos
else
crit "Current OS is not support!"
FNRET=44
audit_debian
fi
}
@ -82,12 +79,10 @@ apply_centos () {
# This function will be called if the script status is on enabled mode
apply () {
if [ $OS_RELEASE -eq 1 ]; then
apply_debian
elif [ $OS_RELEASE -eq 2 ]; then
if [ $OS_RELEASE -eq 2 ]; then
apply_centos
else
crit "Current OS is not support!"
apply_debian
fi
}
# This function will check config parameters required

View File

@ -1,7 +1,7 @@
#!/bin/bash
#
# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening
# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12 or CentOS Hardening
#Modify by: Samson-W (samson@hardenedlinux.org)
#
@ -50,13 +50,10 @@ audit_centos () {
# This function will be called if the script status is on enabled / audit mode
audit () {
if [ $OS_RELEASE -eq 1 ]; then
audit_debian
elif [ $OS_RELEASE -eq 2 ]; then
if [ $OS_RELEASE -eq 2 ]; then
audit_centos
else
crit "Current OS is not support!"
FNRET=44
audit_debian
fi
}
@ -92,12 +89,10 @@ apply_centos () {
# This function will be called if the script status is on enabled mode
apply () {
if [ $OS_RELEASE -eq 1 ]; then
apply_debian
elif [ $OS_RELEASE -eq 2 ]; then
if [ $OS_RELEASE -eq 2 ]; then
apply_centos
else
crit "Current OS is not support!"
apply_debian
fi
}

View File

@ -1,7 +1,7 @@
#!/bin/bash
#
# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening
# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12 or CentOS Hardening
# Modify by: Samson-W (samson@hardenedlinux.org)
#
@ -73,13 +73,10 @@ audit_centos () {
# This function will be called if the script status is on enabled / audit mode
audit () {
if [ $OS_RELEASE -eq 1 ]; then
audit_debian
elif [ $OS_RELEASE -eq 2 ]; then
if [ $OS_RELEASE -eq 2 ]; then
audit_centos
else
crit "Current OS is not support!"
FNRET=44
audit_debian
fi
}
@ -119,12 +116,10 @@ apply_centos () {
# This function will be called if the script status is on enabled mode
apply () {
if [ $OS_RELEASE -eq 1 ]; then
apply_debian
elif [ $OS_RELEASE -eq 2 ]; then
if [ $OS_RELEASE -eq 2 ]; then
apply_centos
else
crit "Current OS is not support!"
apply_debian
fi
}

View File

@ -1,7 +1,7 @@
#!/bin/bash
#
# harbian-audit for Debian GNU/Linux 9/10 or CentOS 8 Hardening
# harbian-audit for Debian GNU/Linux 9/10/11/12 or CentOS 8 Hardening
#
#
@ -93,13 +93,10 @@ audit_centos () {
# This function will be called if the script status is on enabled / audit mode
audit () {
if [ $OS_RELEASE -eq 1 ]; then
audit_debian
elif [ $OS_RELEASE -eq 2 ]; then
if [ $OS_RELEASE -eq 2 ]; then
audit_centos
else
crit "Current OS is not support!"
FNRET=44
audit_debian
fi
}
@ -157,12 +154,10 @@ apply_centos () {
# This function will be called if the script status is on enabled mode
apply () {
if [ $OS_RELEASE -eq 1 ]; then
apply_debian
elif [ $OS_RELEASE -eq 2 ]; then
if [ $OS_RELEASE -eq 2 ]; then
apply_centos
else
crit "Current OS is not support!"
apply_debian
fi
}

View File

@ -1,7 +1,7 @@
#!/bin/bash
#
# harbian-audit for Debian GNU/Linux 9/10 or CentOS 8 Hardening
# harbian-audit for Debian GNU/Linux 9/10/11/12 or CentOS 8 Hardening
#
#
@ -48,13 +48,10 @@ audit_centos () {
# This function will be called if the script status is on enabled / audit mode
audit () {
if [ $OS_RELEASE -eq 1 ]; then
audit_debian
elif [ $OS_RELEASE -eq 2 ]; then
if [ $OS_RELEASE -eq 2 ]; then
audit_centos
else
crit "Current OS is not support!"
FNRET=44
audit_debian
fi
}
@ -89,12 +86,10 @@ apply_centos () {
# This function will be called if the script status is on enabled mode
apply () {
if [ $OS_RELEASE -eq 1 ]; then
apply_debian
elif [ $OS_RELEASE -eq 2 ]; then
if [ $OS_RELEASE -eq 2 ]; then
apply_centos
else
crit "Current OS is not support!"
apply_debian
fi
}

View File

@ -1,7 +1,7 @@
#!/bin/bash
#
# harbian-audit for Debian GNU/Linux 9/10 or CentOS Hardening
# harbian-audit for Debian GNU/Linux 9/10/11/12 or CentOS Hardening
# Modify by: Samson-W (samson@hardenedlinux.org)
#
@ -57,13 +57,10 @@ audit_centos () {
# This function will be called if the script status is on enabled / audit mode
audit () {
if [ $OS_RELEASE -eq 1 ]; then
audit_debian
elif [ $OS_RELEASE -eq 2 ]; then
if [ $OS_RELEASE -eq 2 ]; then
audit_centos
else
crit "Current OS is not support!"
FNRET=44
audit_debian
fi
}

View File

@ -1,7 +1,7 @@
#!/bin/bash
#
# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening
# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12 or CentOS Hardening
# Modify by: Samson-W (samson@hardenedlinux.org)
#
@ -52,13 +52,10 @@ audit_centos () {
}
# This function will be called if the script status is on enabled / audit mode
audit () {
if [ $OS_RELEASE -eq 1 ]; then
audit_debian
elif [ $OS_RELEASE -eq 2 ]; then
if [ $OS_RELEASE -eq 2 ]; then
audit_centos
else
crit "Current OS is not support!"
FNRET=44
audit_debian
fi
}
@ -101,12 +98,10 @@ apply_centos () {
# This function will be called if the script status is on enabled mode
apply () {
if [ $OS_RELEASE -eq 1 ]; then
apply_debian
elif [ $OS_RELEASE -eq 2 ]; then
if [ $OS_RELEASE -eq 2 ]; then
apply_centos
else
crit "Current OS is not support!"
apply_debian
fi
}

View File

@ -1,7 +1,7 @@
#!/bin/bash
#
# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening
# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12 or CentOS Hardening
# Modify by: Samson-W (samson@hardenedlinux.org)
#
@ -54,13 +54,10 @@ audit_centos () {
# This function will be called if the script status is on enabled / audit mode
audit () {
if [ $OS_RELEASE -eq 1 ]; then
audit_debian
elif [ $OS_RELEASE -eq 2 ]; then
if [ $OS_RELEASE -eq 2 ]; then
audit_centos
else
crit "Current OS is not support!"
FNRET=44
audit_debian
fi
}
@ -105,12 +102,10 @@ apply_centos () {
# This function will be called if the script status is on enabled mode
apply () {
if [ $OS_RELEASE -eq 1 ]; then
apply_debian
elif [ $OS_RELEASE -eq 2 ]; then
if [ $OS_RELEASE -eq 2 ]; then
apply_centos
else
crit "Current OS is not support!"
apply_debian
fi
}
# This function will check config parameters required

View File

@ -1,7 +1,7 @@
#!/bin/bash
#
# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening
# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12 or CentOS Hardening
# Modify by: Samson-W (samson@hardenedlinux.org)
#
@ -53,13 +53,10 @@ audit_centos () {
# This function will be called if the script status is on enabled / audit mode
audit () {
if [ $OS_RELEASE -eq 1 ]; then
audit_debian
elif [ $OS_RELEASE -eq 2 ]; then
if [ $OS_RELEASE -eq 2 ]; then
audit_centos
else
crit "Current OS is not support!"
FNRET=44
audit_debian
fi
}
@ -102,12 +99,10 @@ apply_centos () {
# This function will be called if the script status is on enabled mode
apply () {
if [ $OS_RELEASE -eq 1 ]; then
apply_debian
elif [ $OS_RELEASE -eq 2 ]; then
if [ $OS_RELEASE -eq 2 ]; then
apply_centos
else
crit "Current OS is not support!"
apply_debian
fi
}

View File

@ -1,7 +1,7 @@
#!/bin/bash
#
# harbian-audit for Debian GNU/Linux 7/8/9 Hardening
# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12 Hardening
# todo test for centos
#
@ -18,7 +18,7 @@ VIRULSERVER_CENTOS='clamav-server clamav-data clamav-update clamav-filesystem cl
# This function will be called if the script status is on enabled / audit mode
audit () {
if [ $OS_RELEASE -eq 1 ]; then
if [ $OS_RELEASE -ne 2 ]; then
if [ $(dpkg -l | grep -c $VIRULSERVER) -ge 1 ]; then
if [ $(systemctl | grep $VIRULSERVER | grep -c "active running") -ne 1 ]; then
crit "$VIRULSERVER is not runing"
@ -31,7 +31,8 @@ audit () {
crit "$VIRULSERVER is not installed"
FNRET=1
fi
elif [ $OS_RELEASE -eq 2 ]; then
#CentOS:OS_RELEASE -eq 2
else
if [ $(rpm -qa | grep -c clamd) -ge 1 ]; then
ok "Clamav is installed"
FNRET=0
@ -39,33 +40,32 @@ audit () {
crit "Clamav is not install"
FNRET=1
fi
else
crit "Current OS is not support!"
fi
}
# This function will be called if the script status is on enabled mode
apply () {
if [ $OS_RELEASE -eq 1 ]; then
if [ $OS_RELEASE -ne 2 ]; then
if [ $FNRET = 0 ]; then
ok "$VIRULSERVER is enable"
elif [ $FNRET = 1 ]; then
warn "Install $VIRULSERVER"
apt-get install -y $VIRULSERVER
else
warn "Start server $VIRULSERVER"
systemctl start $VIRULSERVER
fi
elif [ $OS_RELEASE -eq 2 ]; then
if [ $FNRET = 0 ]; then
ok "$VIRULSERVER_CENTOS is enable"
elif [ $FNRET = 1 ]; then
warn "Install $VIRULSERVER_CENTOS"
yum install -y $VIRULSERVER_CENTOS
else
warn "Start server $VIRULSERVER"
systemctl start $VIRULSERVER
fi
warn "Install $VIRULSERVER"
apt-get install -y $VIRULSERVER
else
warn "Start server $VIRULSERVER"
systemctl start $VIRULSERVER
fi
#Centos: OS_RELEASE -eq 2
else
if [ $FNRET = 0 ]; then
ok "$VIRULSERVER_CENTOS is enable"
elif [ $FNRET = 1 ]; then
warn "Install $VIRULSERVER_CENTOS"
yum install -y $VIRULSERVER_CENTOS
else
warn "Start server $VIRULSERVER"
systemctl start $VIRULSERVER
fi
fi
}

View File

@ -1,7 +1,7 @@
#!/bin/bash
#
# harbian-audit for Debian GNU/Linux 9 Hardening
# harbian-audit for Debian GNU/Linux 9/10/11/12 Hardening
# todo test for centos
#
@ -49,12 +49,10 @@ audit_centos () {
# This function will be called if the script status is on enabled / audit mode
audit () {
if [ $OS_RELEASE -eq 1 ]; then
audit_debian
elif [ $OS_RELEASE -eq 2 ]; then
if [ $OS_RELEASE -eq 2 ]; then
audit_centos
else
crit "Current OS is not support!"
audit_debian
fi
}
@ -81,12 +79,10 @@ apply_centos () {
# This function will be called if the script status is on enabled mode
apply () {
if [ $OS_RELEASE -eq 1 ]; then
apply_debian
elif [ $OS_RELEASE -eq 2 ]; then
if [ $OS_RELEASE -eq 2 ]; then
apply_centos
else
crit "Current OS is not support!"
apply_debian
fi
}

View File

@ -1,7 +1,7 @@
#!/bin/bash
#
# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening
# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12 or CentOS Hardening
#
#
@ -76,13 +76,10 @@ audit_centos () {
# This function will be called if the script status is on enabled / audit mode
audit () {
if [ $OS_RELEASE -eq 1 ]; then
audit_debian
elif [ $OS_RELEASE -eq 2 ]; then
if [ $OS_RELEASE -eq 2 ]; then
audit_centos
else
crit "Current OS is not support!"
FNRET=44
audit_debian
fi
}
@ -135,13 +132,10 @@ apply_centos () {
# This function will be called if the script status is on enabled mode
apply () {
if [ $OS_RELEASE -eq 1 ]; then
apply_debian
elif [ $OS_RELEASE -eq 2 ]; then
if [ $OS_RELEASE -eq 2 ]; then
apply_centos
else
crit "Current OS is not support!"
FNRET=44
apply_debian
fi
}

View File

@ -108,7 +108,7 @@ check_config() {
-a always,exit -F path=/etc/audit/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
elif [ $OS_RELEASE -eq 1 ]; then
elif [ $OS_RELEASE -eq 1 -o $OS_RELEASE -eq 9 -o $OS_RELEASE -eq 10 -o $OS_RELEASE -eq 11 -o $OS_RELEASE -eq 12 ]; then
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/default/grub -F perm=wa -k config_file_change

View File

@ -1,7 +1,7 @@
#!/bin/bash
#
# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening
# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12 or CentOS Hardening
#
#
@ -68,13 +68,10 @@ audit_centos () {
# This function will be called if the script status is on enabled / audit mode
audit () {
if [ $OS_RELEASE -eq 1 ]; then
audit_debian
elif [ $OS_RELEASE -eq 2 ]; then
if [ $OS_RELEASE -eq 2 ]; then
audit_centos
else
crit "Current OS is not support!"
FNRET=44
audit_debian
fi
}
@ -121,12 +118,10 @@ apply_centos () {
# This function will be called if the script status is on enabled mode
apply () {
if [ $OS_RELEASE -eq 1 ]; then
apply_debian
elif [ $OS_RELEASE -eq 2 ]; then
if [ $OS_RELEASE -eq 2 ]; then
apply_centos
else
crit "Current OS is not support!"
apply_debian
fi
}
# This function will check config parameters required