mirror of
https://github.com/ovh/debian-cis.git
synced 2024-12-22 14:05:23 +01:00
8.2.5_syslog-ng_remote_host.sh 8.2.6_remote_syslog-ng_acl.sh 8.3.1_install_tripwire.sh
This commit is contained in:
parent
f0bff32503
commit
d373b6f937
@ -12,13 +12,13 @@
|
||||
set -e # One error, it's over
|
||||
set -u # One variable unset, it's over
|
||||
|
||||
FILES=$(grep "file(" /etc/syslog-ng/syslog-ng.conf | grep '"' | cut -d'"' -f 2)
|
||||
PERMISSIONS='640'
|
||||
USER='root'
|
||||
GROUP='adm'
|
||||
|
||||
# This function will be called if the script status is on enabled / audit mode
|
||||
audit () {
|
||||
FILES=$(grep "file(" $SYSLOG_BASEDIR/syslog-ng.conf | grep '"' | cut -d'"' -f 2)
|
||||
for FILE in $FILES; do
|
||||
has_file_correct_ownership $FILE $USER $GROUP
|
||||
if [ $FNRET = 0 ]; then
|
||||
|
57
bin/hardening/8.2.5_syslog-ng_remote_host.sh
Executable file
57
bin/hardening/8.2.5_syslog-ng_remote_host.sh
Executable file
@ -0,0 +1,57 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# CIS Debian 7 Hardening
|
||||
# Authors : Thibault Dewailly, OVH <thibault.dewailly@corp.ovh.com>
|
||||
#
|
||||
|
||||
#
|
||||
# 8.2.5 Configure rsyslog to Send Logs to a Remote Log Host (Scored)
|
||||
#
|
||||
|
||||
set -e # One error, it's over
|
||||
set -u # One variable unset, it's over
|
||||
|
||||
#destination d_httpd_error { tcp("10.1.0.31" log_fifo_size(100000000) template("<187>$MSGHDR$MSG\n") template_escape(no)); };
|
||||
|
||||
PATTERN='^destination.*(tcp|udp)[[:space:]]*\([[:space:]]*\".*\"[[:space:]]*\)'
|
||||
FILES='/etc/syslog-ng/syslog-ng.conf /etc/syslog-ng/conf.d/*'
|
||||
|
||||
# This function will be called if the script status is on enabled / audit mode
|
||||
audit () {
|
||||
does_pattern_exists_in_file "$FILES" "$PATTERN"
|
||||
if [ $FNRET != 0 ]; then
|
||||
crit "$PATTERN not present in $FILES"
|
||||
else
|
||||
ok "$PATTERN present in $FILES"
|
||||
fi
|
||||
}
|
||||
|
||||
# This function will be called if the script status is on enabled mode
|
||||
apply () {
|
||||
does_pattern_exists_in_file "$FILES" "$PATTERN"
|
||||
if [ $FNRET != 0 ]; then
|
||||
crit "$PATTERN not present in $FILES, please set a remote host to send your logs"
|
||||
else
|
||||
ok "$PATTERN present in $FILES"
|
||||
fi
|
||||
}
|
||||
|
||||
# This function will check config parameters required
|
||||
check_config() {
|
||||
:
|
||||
}
|
||||
|
||||
# Source Root Dir Parameter
|
||||
if [ ! -r /etc/default/cis-hardenning ]; then
|
||||
echo "There is no /etc/default/cis-hardenning file, cannot source CIS_ROOT_DIR variable, aborting"
|
||||
exit 128
|
||||
else
|
||||
. /etc/default/cis-hardenning
|
||||
if [ -z $CIS_ROOT_DIR ]; then
|
||||
echo "No CIS_ROOT_DIR variable, aborting"
|
||||
fi
|
||||
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
|
42
bin/hardening/8.2.6_remote_syslog-ng_acl.sh
Executable file
42
bin/hardening/8.2.6_remote_syslog-ng_acl.sh
Executable file
@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# CIS Debian 7 Hardening
|
||||
# Authors : Thibault Dewailly, OVH <thibault.dewailly@corp.ovh.com>
|
||||
#
|
||||
|
||||
#
|
||||
# 8.2.6 Accept Remote rsyslog Messages Only on Designated Log Hosts (Not Scored)
|
||||
#
|
||||
|
||||
set -e # One error, it's over
|
||||
set -u # One variable unset, it's over
|
||||
|
||||
# This function will be called if the script status is on enabled / audit mode
|
||||
audit () {
|
||||
info "Not implemented yet"
|
||||
}
|
||||
|
||||
# This function will be called if the script status is on enabled mode
|
||||
apply () {
|
||||
info "Not implemented yet"
|
||||
}
|
||||
|
||||
# This function will check config parameters required
|
||||
check_config() {
|
||||
:
|
||||
}
|
||||
|
||||
# Source Root Dir Parameter
|
||||
if [ ! -r /etc/default/cis-hardenning ]; then
|
||||
echo "There is no /etc/default/cis-hardenning file, cannot source CIS_ROOT_DIR variable, aborting"
|
||||
exit 128
|
||||
else
|
||||
. /etc/default/cis-hardenning
|
||||
if [ -z $CIS_ROOT_DIR ]; then
|
||||
echo "No CIS_ROOT_DIR variable, aborting"
|
||||
fi
|
||||
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
|
57
bin/hardening/8.3.1_install_tripwire.sh
Executable file
57
bin/hardening/8.3.1_install_tripwire.sh
Executable file
@ -0,0 +1,57 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# CIS Debian 7 Hardening
|
||||
# Authors : Thibault Dewailly, OVH <thibault.dewailly@corp.ovh.com>
|
||||
#
|
||||
|
||||
#
|
||||
# 8.2.1 Install the syslog-ng package (Scored)
|
||||
#
|
||||
|
||||
set -e # One error, it's over
|
||||
set -u # One variable unset, it's over
|
||||
|
||||
# NB : in CIS, AIDE has been chosen, however we chose tripwire
|
||||
PACKAGE='tripwire'
|
||||
|
||||
# This function will be called if the script status is on enabled / audit mode
|
||||
audit () {
|
||||
is_pkg_installed $PACKAGE
|
||||
if [ $FNRET != 0 ]; then
|
||||
crit "$PACKAGE is not installed !"
|
||||
else
|
||||
ok "$PACKAGE is installed"
|
||||
fi
|
||||
}
|
||||
|
||||
# This function will be called if the script status is on enabled mode
|
||||
apply () {
|
||||
is_pkg_installed $PACKAGE
|
||||
if [ $FNRET = 0 ]; then
|
||||
ok "$PACKAGE is installed"
|
||||
else
|
||||
crit "$PACKAGE is absent, installing it"
|
||||
apt_install $PACKAGE
|
||||
info "Tripwire is now installed but not fully functionnal, please see readme to go further"
|
||||
fi
|
||||
}
|
||||
|
||||
# This function will check config parameters required
|
||||
check_config() {
|
||||
:
|
||||
}
|
||||
|
||||
# Source Root Dir Parameter
|
||||
if [ ! -r /etc/default/cis-hardenning ]; then
|
||||
echo "There is no /etc/default/cis-hardenning file, cannot source CIS_ROOT_DIR variable, aborting"
|
||||
exit 128
|
||||
else
|
||||
. /etc/default/cis-hardenning
|
||||
if [ -z $CIS_ROOT_DIR ]; then
|
||||
echo "No CIS_ROOT_DIR variable, aborting"
|
||||
fi
|
||||
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
|
20
bin/postinstall/tripwire.sh
Executable file
20
bin/postinstall/tripwire.sh
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# CIS Debian 7 Hardening
|
||||
#
|
||||
|
||||
# If you followed this CIS hardenning, this script follows 8.3.1_install_tripwire.sh
|
||||
# After installing tripwire, you may want to run those few commented commands to make it fully functionnal
|
||||
|
||||
echo "Generating Site key file..."
|
||||
twadmin -m G -S /etc/tripwire/site.key # Generates Site key file
|
||||
echo "Generating Local key file..."
|
||||
twadmin -m G -S /etc/tripwire/$(hostname -f)-local.key # Generate local key file
|
||||
echo "Generating encrypted policy..."
|
||||
twadmin -m P /etc/tripwire/twpol.txt # Apply new policy with generated site key file
|
||||
echo "Generating Local database with newly created key..."
|
||||
/usr/sbin/twadmin --create-cfgfile -S /etc/tripwire/site.key /etc/tripwire/twcfg.txt # Init database with generated local key file
|
||||
echo "Testing tripwire database update"
|
||||
tripwire -m i # Test configuration update
|
||||
~
|
@ -1,2 +1,3 @@
|
||||
# Configuration for script of same name
|
||||
status=enabled
|
||||
SYSLOG_BASEDIR='/etc/syslog-ng'
|
||||
|
2
etc/conf.d/8.2.5_syslog-ng_remote_host.cfg
Normal file
2
etc/conf.d/8.2.5_syslog-ng_remote_host.cfg
Normal file
@ -0,0 +1,2 @@
|
||||
# Configuration for script of same name
|
||||
status=enabled
|
2
etc/conf.d/8.2.6_remote_syslog-ng_acl.cfg
Normal file
2
etc/conf.d/8.2.6_remote_syslog-ng_acl.cfg
Normal file
@ -0,0 +1,2 @@
|
||||
# Configuration for script of same name
|
||||
status=enabled
|
2
etc/conf.d/8.3.1_install_tripwire.cfg
Normal file
2
etc/conf.d/8.3.1_install_tripwire.cfg
Normal file
@ -0,0 +1,2 @@
|
||||
# Configuration for script of same name
|
||||
status=enabled
|
11
lib/utils.sh
11
lib/utils.sh
@ -44,17 +44,6 @@ set_sysctl_param() {
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Network
|
||||
#
|
||||
|
||||
is_ipv6_disabled_by_bootloader() {
|
||||
#if
|
||||
#
|
||||
:
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Dmesg
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user