#!/bin/bash # # .---. . . # | | | # |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-. # | | (.-' (.-' ( | ( )| | | | )( )| | (.-' # ' ' --' --' -' - -' ' ' -' -' -' ' - --' # # Freedom in the Cloud # # Run tests on the system # License # ======= # # Copyright (C) 2015-2016 Bob Mottram # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . PROJECT_NAME='freedombone' export TEXTDOMAIN=${PROJECT_NAME}-tests export TEXTDOMAINDIR="/usr/share/locale" RUN_STIG= function show_help { echo '' echo $"${PROJECT_NAME}-tests" echo '' echo $'Runs tests on the system' echo '' echo $' --help Show help' echo '' exit 0 } function test_app_function_type { filename=$1 fn_type=$2 app_name=$(echo "${filename}" | awk -F '-app-' '{print $2}') app_function=$(cat "${filename}" | grep "function ${fn_type}_${app_name} {" | awk -F "${fn_type}_" '{print $2}' | awk -F ' ' '{print $1}') if [ ! ${app_function} ]; then echo $"Application ${app_name} does not contain a function called '${fn_type}_${app_name}'" echo '' echo "See ${filename}" exit 72852 fi } function test_app_functions { FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-* # check that these functions exist interface_functions=( install remove backup_local backup_remote restore_local restore_remote upgrade reconfigure ) # for all the app scripts for filename in $FILES do # for each expected interface function for f in "${interface_functions[@]}" do test_app_function_type ${filename} $f done done } function test_unique_onion_ports { # test that some services are not assigned the same onion port FILES=src/${PROJECT_NAME}-app-* ports=$(grep -r "_ONION_PORT=" $FILES | awk -F ':' '{print $2}' | uniq | awk -F '=' '{print $2}') unique_ports=$(grep -r "_ONION_PORT=" $FILES | awk -F ':' '{print $2}' | uniq | awk -F '=' '{print $2}' | uniq) if [[ "$ports" != "$unique_ports" ]]; then echo $'Some onion ports are clashing' grep -r "_ONION_PORT=" $FILES | awk -F ':' '{print $2}' | uniq exit 637252 fi } function stig_log_msg { ESTATUS=$1 RED=$(tput setaf 1) BOLD=$(tput bold) GREEN=$(tput setaf 2) NORMAL=$(tput sgr0) MSG="$2" if [ $ESTATUS -eq 0 ];then printf "%s %s" "$GREEN$BOLD[ PASS ]$NORMAL" "$MSG" echo else printf "%s %s" "$RED$BOLD[ FAIL ]$NORMAL" "$MSG" echo fi } function stig_spinner { local pid=$1 local delay=0.1 while [ "$(ps -a | awk '{print $1}' | grep "$pid")" ]; do sleep $delay done printf " \b" wait $1 } function test_stig { if [ ! $RUN_STIG ]; then return fi STIG_TESTS_DIR=tests if [ ! -d $STIG_TESTS_DIR ]; then STIG_TESTS_DIR=~/${PROJECT_NAME}/tests if [ ! -d $STIG_TESTS_DIR ]; then echo $'No tests were found' exit 62725 fi fi CATCOLOR=1 SETLANG="en" source $STIG_TESTS_DIR/output.sh ##RHEL-06-000001 ##The system must use a separate file system for /tmp. mount | grep "on /tmp " >/dev/null 2>&1 & stig_spinner $! output "V-38455" $? ${SETLANG} ################ ##RHEL-06-000008 ##Vendor-provided cryptographic certificates must be installed to verify the integrity of system software. bash $STIG_TESTS_DIR/check-apt-key.sh >/dev/null 2>&1 & stig_spinner $! output "V-38476" $? ${SETLANG} ################ ##RHEL-06-000011 ##System security patches and updates must be installed and up-to-date. bash $STIG_TESTS_DIR/check-package-up2date.sh >/dev/null 2>&1 & stig_spinner $! output "V-38481" $? ${SETLANG} ################ ##RHEL-06-000013 ##The system package management tool must cryptographically verify the authenticity of system software packages during installation. stig_spinner $! output "V-38483" $? ${SETLANG} ################ ##RHEL-06-000015 ##The system package management tool must cryptographically verify the authenticity of all software packages during installation. stig_spinner $! output "V-38487" $? ${SETLANG} ################ ##RHEL-06-000016 ##A file integrity tool must be installed. dpkg -s aide >/dev/null 2>&1 & stig_spinner $! output "V-38489" $? ${SETLANG} ################ ##RHEL-06-000019 ##There must be no .rhosts or hosts.equiv files on the system. bash $STIG_TESTS_DIR/check-rhosts.sh > /dev/null 2>&1 & stig_spinner $! output "V-38491" $? ${SETLANG} ################ ##RHEL-06-000027 ##The system must prevent the root account from logging in from virtual consoles. bash $STIG_TESTS_DIR/check-consoles.sh virtual > /dev/null 2>&1 & stig_spinner $! output "V-38492" $? ${SETLANG} ################ ##RHEL-06-000028 ##The system must prevent the root account from logging in from serial consoles. bash $STIG_TESTS_DIR/check-consoles.sh serial > /dev/null 2>&1 & stig_spinner $! output "V-38494" $? ${SETLANG} ################ ##RHEL-06-000029 ##Default operating system accounts, other than root, must be locked. bash $STIG_TESTS_DIR/check-default-account.sh > /dev/null 2>&1 & stig_spinner $! output "V-38496" $? ${SETLANG} ################ ##RHEL-06-000030 ##The system must not have accounts configured with blank or null passwords. ##For more Detial http://www.cyberciti.biz/tips/how-to-linux-prevent-the-reuse-of-old-passwords.html ##For more Detial http://www.cyberciti.biz/tips/linux-or-unix-disable-null-passwords.html grep nullok /etc/pam.d/common-password > /dev/null 2>&1 & stig_spinner $! output "V-38497" $? ${SETLANG} ################ ##RHEL-06-000031 ##The /etc/passwd file must not contain password hashes. awk -F: '($2 != "x") {print; err=1} END {exit err}' /etc/passwd > /dev/null 2>&1 & stig_spinner $! output "V-38499" $? ${SETLANG} ################ ##RHEL-06-000032 ##The root account must be the only account having a UID of 0. bash $STIG_TESTS_DIR/check-root-uid.sh > /dev/null 2>&1 & stig_spinner $! output "V-38500" $? ${SETLANG} ################ ##RHEL-06-000033 ##The /etc/shadow file must be owned by root. ls -l /etc/shadow | awk '{print $3}' | grep "^root$" > /dev/null 2>&1 & stig_spinner $! output "V-38502" $? ${SETLANG} ################ ##RHEL-06-000034 ##The /etc/shadow file must be group-owned by root. ls -l /etc/shadow | awk '{print $4}' | grep "^root$" > /dev/null 2>&1 & stig_spinner $! output "V-38503" $? ${SETLANG} ################ ##RHEL-06-000035 ##The /etc/shadow file must have mode 0000. ls -l /etc/shadow | awk '{print $1}' | grep "^----------$" > /dev/null 2>&1 & stig_spinner $! output "V-38504" $? ${SETLANG} ################ ##RHEL-06-000036 ##The /etc/gshadow file must be owned by root. ls -l /etc/gshadow | awk '{print $3}' | grep "^root$" > /dev/null 2>&1 & stig_spinner $! output "V-38443" $? ${SETLANG} ################ ##RHEL-06-000037 ##The /etc/gshadow file must be group-owned by root. ls -l /etc/gshadow | awk '{print $4}' | grep "^root$" > /dev/null 2>&1 & stig_spinner $! output "V-38448" $? ${SETLANG} ################ ##RHEL-06-000038 ##The /etc/gshadow file must have mode 0000. ls -l /etc/gshadow | awk '{print $1}' | grep "^----------$" > /dev/null 2>&1 & stig_spinner $! output "V-38449" $? ${SETLANG} ################ ##RHEL-06-000039 ##The /etc/passwd file must be owned by root. ls -l /etc/passwd | awk '{print $3}' | grep "^root$" > /dev/null 2>&1 & stig_spinner $! output "V-38450" $? ${SETLANG} ################ ##RHEL-06-000040 ##The /etc/passwd file must be group-owned by root. ls -l /etc/passwd | awk '{print $4}' | grep "^root$" > /dev/null 2>&1 & stig_spinner $! output "V-38451" $? ${SETLANG} ################ ##RHEL-06-000041 ##The /etc/passwd file must have mode 0644 or less permissive. bash $STIG_TESTS_DIR/check-mode.sh /etc/passwd 644 > /dev/null 2>&1 & stig_spinner $! output "V-38457" $? ${SETLANG} ################ ##RHEL-06-000042 ##The /etc/group file must be owned by root. ls -l /etc/group | awk '{print $3}' | grep "^root$" > /dev/null 2>&1 & stig_spinner $! output "V-38458" $? ${SETLANG} ################ ##RHEL-06-000043 ##The /etc/group file must be group-owned by root. ls -l /etc/group | awk '{print $4}' | grep "^root$" > /dev/null 2>&1 & stig_spinner $! output "V-38459" $? ${SETLANG} ################ ##RHEL-06-000044 ##The /etc/group file must have mode 0644 or less permissive. bash $STIG_TESTS_DIR/check-mode.sh "/etc/group" 644 > /dev/null 2>&1 & stig_spinner $! output "V-38461" $? ${SETLANG} ################ ##RHEL-06-000045 ##Library files must have mode 0755 or less permissive. bash $STIG_TESTS_DIR/check-libs-mode.sh > /dev/null 2>&1 & stig_spinner $! output "V-38465" $? ${SETLANG} ################ ##RHEL-06-000046 ##Library files must be owned by root. bash $STIG_TESTS_DIR/check-libs-owner.sh > /dev/null 2>&1 & stig_spinner $! output "V-38466" $? ${SETLANG} ################ ##RHEL-06-000047 ##All system command files must have mode 755 or less permissive. bash $STIG_TESTS_DIR/check-cmd-mode.sh > /dev/null 2>&1 & stig_spinner $! output "V-38469" $? ${SETLANG} ################ ##RHEL-06-000048 ##All system command files must be owned by root. bash $STIG_TESTS_DIR/check-cmd-owner.sh > /dev/null 2>&1 & stig_spinner $! output "V-38472" $? ${SETLANG} ################ ##RHEL-06-000061 ##The system must disable accounts after three consecutive unsuccessful logon attempts. bash $STIG_TESTS_DIR/check-password.sh /etc/pam.d/common-auth pam_tally deny gt 3 > /dev/null 2>&1 & stig_spinner $! output "V-38573" $? ${SETLANG} ################ ##RHEL-06-000062 ##The system must use a FIPS 140-2 approved cryptographic hashing algorithm for generating account password hashes (system-auth). sed -e '/^#/d' -e '/^[ \t][ \t]*#/d' -e 's/#.*$//' -e '/^$/d' /etc/pam.d/* | grep password | grep pam_unix.so | grep sha512 > /dev/null 2>&1 & stig_spinner $! output "V-38574" $? ${SETLANG} ################ ##RHEL-06-000063 ##The system must use a FIPS 140-2 approved cryptographic hashing algorithm for generating account password hashes (login.defs). sed -e '/^#/d' -e '/^[ \t][ \t]*#/d' -e 's/#.*$//' -e '/^$/d' /etc/login.defs | grep "ENCRYPT_METHOD.*SHA512" > /dev/null 2>&1 & stig_spinner $! output "V-38576" $? ${SETLANG} ################ ##RHEL-06-000064 ##The system must use a FIPS 140-2 approved cryptographic hashing algorithm for generating account password hashes (libuser.conf). bash $STIG_TESTS_DIR/check-depends.sh > /dev/null 2>&1 & stig_spinner $! output "V-38577" $? ${SETLANG} ################ ##RHEL-06-000065 ##The system boot loader configuration file(s) must be owned by root. ls -l /boot/grub/grub.cfg | awk '{print $3}' | grep "^root$" > /dev/null 2>&1 & stig_spinner $! output "V-38579" $? ${SETLANG} ################ ##RHEL-06-000066 ##The system boot loader configuration file(s) must be group-owned by root. ls -l /boot/grub/grub.cfg | awk '{print $4}' | grep "^root$" > /dev/null 2>&1 & stig_spinner $! output "V-38581" $? ${SETLANG} ################ ##RHEL-06-000067 ##The system boot loader configuration file(s) must have mode 0600 or less permissive. bash $STIG_TESTS_DIR/check-grub-mode.sh > /dev/null 2>&1 & stig_spinner $! output "V-38583" $? ${SETLANG} ################ ##RHEL-06-000071 ##The system must allow locking of the console screen in text mode. dpkg -s screen >/dev/null 2>&1 & stig_spinner $! output "V-38590" $? ${SETLANG} ################ ##RHEL-06-000078 ##The system must implement virtual address space randomization. bash $STIG_TESTS_DIR/check-sysctl.sh kernel.randomize_va_space ne 2 >/dev/null 2>&1 & stig_spinner $! output "V-38596" $? ${SETLANG} ################ ##RHEL-06-000080 ##The system must not send ICMPv4 redirects by default. bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.conf.default.send_redirects ne 0 >/dev/null 2>&1 & stig_spinner $! output "V-38600" $? ${SETLANG} ################ ##RHEL-06-000081 ##The system must not send ICMPv4 redirects from any interface. bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.conf.all.send_redirects ne 0 >/dev/null 2>&1 & stig_spinner $! output "V-38601" $? ${SETLANG} ################ ##RHEL-06-000082 ##IP forwarding for IPv4 must not be enabled, unless the system is a router. bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.ip_forward ne 0 >/dev/null 2>&1 & stig_spinner $! output "V-38511" $? ${SETLANG} ################ ##RHEL-06-000083 ##The system must not accept IPv4 source-routed packets on any interface. bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.conf.all.accept_source_route ne 0 >/dev/null 2>&1 & stig_spinner $! output "V-38523" $? ${SETLANG} ################ ##RHEL-06-000084 ##The system must not accept ICMPv4 redirect packets on any interface. bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.conf.all.accept_redirects ne 0 >/dev/null 2>&1 & stig_spinner $! output "V-38524" $? ${SETLANG} ################ ##RHEL-06-000086 ##The system must not accept ICMPv4 secure redirect packets on any interface. bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.conf.all.secure_redirects ne 0 >/dev/null 2>&1 & stig_spinner $! output "V-38526" $? ${SETLANG} ################ ##RHEL-06-000089 ##The system must not accept IPv4 source-routed packets by default. bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.conf.default.accept_source_route ne 0 >/dev/null 2>&1 & stig_spinner $! output "V-38529" $? ${SETLANG} ################ ##RHEL-06-000090 ##The system must not accept ICMPv4 secure redirect packets by default. bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.conf.default.secure_redirects ne 0 >/dev/null 2>&1 & stig_spinner $! output "V-38532" $? ${SETLANG} ################ ##RHEL-06-000091 ##The system must ignore ICMPv4 redirect messages by default. bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.conf.default.accept_redirects ne 0 >/dev/null 2>&1 & stig_spinner $! output "V-38533" $? ${SETLANG} ################ ##RHEL-06-000092 ##The system must not respond to ICMPv4 sent to a broadcast address. bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.icmp_echo_ignore_broadcasts ne 1 >/dev/null 2>&1 & stig_spinner $! output "V-38535" $? ${SETLANG} ################ ##RHEL-06-000093 ##The system must ignore ICMPv4 bogus error responses. bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.icmp_ignore_bogus_error_responses ne 1 >/dev/null 2>&1 & stig_spinner $! output "V-38537" $? ${SETLANG} ################ ##RHEL-06-000095 ##The system must be configured to use TCP syncookies when experiencing a TCP SYN flood. bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.tcp_syncookies ne 1 >/dev/null 2>&1 & stig_spinner $! output "V-38539" $? ${SETLANG} ################ ##RHEL-06-000096 ##The system must use a reverse-path filter for IPv4 network traffic when possible on all interfaces. bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.conf.all.rp_filter ne 1 >/dev/null 2>&1 & stig_spinner $! output "V-38542" $? ${SETLANG} ################ ##RHEL-06-000097 ##The system must use a reverse-path filter for IPv4 network traffic when possible by default. bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv4.conf.default.rp_filter ne 1 >/dev/null 2>&1 & stig_spinner $! output "V-38544" $? ${SETLANG} ################ ##RHEL-06-000098 ##The IPv6 protocol handler must not be bound to the network stack unless needed. bash $STIG_TESTS_DIR/check-ipv6-enable.sh >/dev/null 2>&1 & stig_spinner $! output "V-38546" $? ${SETLANG} ################ ##RHEL-06-000099 ##The system must ignore ICMPv6 redirects by default. ##If IPv6 is disabled, this is not applicable. if [ -a /proc/net/if_inet6 ];then bash $STIG_TESTS_DIR/check-sysctl.sh net.ipv6.conf.default.accept_redirects ne 0 >/dev/null 2>&1 & stig_spinner $! output "V-38548" $? ${SETLANG} fi ################ ##RHEL-06-000120 ##The systems local IPv4 firewall must implement a deny-all, allow-by-exception policy for inbound iptables -L INPUT | head -n1 | grep "INPUT.*DROP" >/dev/null 2>&1 & stig_spinner $! output "V-38513" $? ${SETLANG} ################ ##RHEL-06-000124 ##The systems local IPv4 firewall must implement a deny-all, allow-by-exception policy for inbound grep -r dccp /etc/modprobe.conf /etc/modprobe.d >/dev/null 2>&1 & stig_spinner $! output "V-38514" $? ${SETLANG} ################ ##RHEL-06-000125 ##The Stream Control Transmission Protocol (SCTP) must be disabled unless required. grep -r sctp /etc/modprobe.conf /etc/modprobe.d >/dev/null 2>&1 & stig_spinner $! output "V-38515" $? ${SETLANG} ################ ##RHEL-06-000126 ##The Reliable Datagram Sockets (RDS) protocol must be disabled unless required. grep -r rds /etc/modprobe.conf /etc/modprobe.d >/dev/null 2>&1 & stig_spinner $! output "V-38516" $? ${SETLANG} ################ ##RHEL-06-000127 ##The Transparent Inter-Process Communication (TIPC) protocol must be disabled unless required. grep -r tipc /etc/modprobe.conf /etc/modprobe.d >/dev/null 2>&1 & stig_spinner $! output "V-38517" $? ${SETLANG} ################ ##RHEL-06-000133 ##All rsyslog-generated log files must be owned by root. bash $STIG_TESTS_DIR/check-rsyslog.sh owned >/dev/null 2>&1 & stig_spinner $! output "V-38518" $? ${SETLANG} ################ ##RHEL-06-000134 ##All rsyslog-generated log files must be group-owned by root. bash $STIG_TESTS_DIR/check-rsyslog.sh group-owned >/dev/null 2>&1 & stig_spinner $! output "V-38519" $? ${SETLANG} ################ ##RHEL-06-000135 ##All rsyslog-generated log files must have mode 0600 or less permissive. bash $STIG_TESTS_DIR/check-rsyslog.sh mode >/dev/null 2>&1 & stig_spinner $! output "V-38623" $? ${SETLANG} ################ ##RHEL-06-000138 ##System logs must be rotated daily. bash $STIG_TESTS_DIR/check-logrotate.sh >/dev/null 2>&1 & stig_spinner $! output "V-38624" $? ${SETLANG} ################ ##RHEL-06-000203 ##The xinetd service must be disabled if no network services utilizing it are enabled. bash $STIG_TESTS_DIR/check-services.sh xinetd >/dev/null 2>&1 & stig_spinner $! output "V-38582" $? ${SETLANG} ################ ##RHEL-06-000204 ##The xinetd service must be uninstalled if no network services utilizing it are enabled. bash $STIG_TESTS_DIR/check-packages.sh xinetd >/dev/null 2>&1 & stig_spinner $! output "V-38584" $? ${SETLANG} ################ ##RHEL-06-000206 ##The telnet-server package must not be installed. bash $STIG_TESTS_DIR/check-packages.sh telnetd >/dev/null 2>&1 & stig_spinner $! output "V-38587" $? ${SETLANG} ################ ##RHEL-06-000211 ##The telnet daemon must not be running. bash $STIG_TESTS_DIR/check-services.sh telnetd >/dev/null 2>&1 & stig_spinner $! output "V-38589" $? ${SETLANG} ################ ##RHEL-06-000213 ##The rsh-server package must not be installed. bash $STIG_TESTS_DIR/check-packages.sh rsh-server >/dev/null 2>&1 & stig_spinner $! output "V-38591" $? ${SETLANG} ################ ##RHEL-06-000214 ##The rshd service must not be running. bash $STIG_TESTS_DIR/check-services.sh rshd >/dev/null 2>&1 & stig_spinner $! output "V-38594" $? ${SETLANG} ################ ##RHEL-06-000216 ##The rexecd service must not be running. bash $STIG_TESTS_DIR/check-services.sh rexecd >/dev/null 2>&1 & stig_spinner $! output "V-38598" $? ${SETLANG} ################ ##RHEL-06-000218 ##The rlogind service must not be running. bash $STIG_TESTS_DIR/check-services.sh rlogind >/dev/null 2>&1 & stig_spinner $! output "V-38602" $? ${SETLANG} ################ ##RHEL-06-000220 ##The NIS(ypserv) package must not be installed. bash $STIG_TESTS_DIR/check-packages.sh nis >/dev/null 2>&1 & stig_spinner $! output "V-38603" $? ${SETLANG} ################ ##RHEL-06-000221 ##The nis(ypbind) service must not be running. bash $STIG_TESTS_DIR/check-services.sh nis >/dev/null 2>&1 & stig_spinner $! output "V-38604" $? ${SETLANG} ################ ##RHEL-06-000224 ##The cron service must be running. bash $STIG_TESTS_DIR/check-services.sh cron >/dev/null 2>&1 & stig_spinner $! output "V-38605" $? ${SETLANG} ################ ##RHEL-06-000227 ##The SSH daemon must be configured to use only the SSHv2 protocol. bash $STIG_TESTS_DIR/check-ssh.sh Protocol >/dev/null 2>&1 & stig_spinner $! output "V-38607" $? ${SETLANG} ################ ##RHEL-06-000230 ##The SSH daemon must set a timeout interval on idle sessions. sed -e '/^#/d' -e '/^[ \t][ \t]*#/d' -e 's/#.*$//' -e '/^$/d' /etc/ssh/sshd_config | grep "ClientAliveInterval" >/dev/null 2>&1 & stig_spinner $! output "V-38608" $? ${SETLANG} ################ ##RHEL-06-000231 ##The SSH daemon must set a timeout count on idle sessions. sed -e '/^#/d' -e '/^[ \t][ \t]*#/d' -e 's/#.*$//' -e '/^$/d' /etc/ssh/sshd_config | grep "ClientAliveCountMax" >/dev/null 2>&1 & stig_spinner $! output "V-38610" $? ${SETLANG} ################ ##RHEL-06-000234 ##The SSH daemon must ignore .rhosts files. bash $STIG_TESTS_DIR/check-ssh.sh rhosts >/dev/null 2>&1 & stig_spinner $! output "V-38611" $? ${SETLANG} ################ ##RHEL-06-000236 ##The SSH daemon must not allow host-based authentication. bash $STIG_TESTS_DIR/check-ssh.sh hostauth >/dev/null 2>&1 & stig_spinner $! output "V-38612" $? ${SETLANG} ################ ##RHEL-06-000237 ##The system must not permit root logins using remote access programs such as ssh. bash $STIG_TESTS_DIR/check-ssh.sh permitroot >/dev/null 2>&1 & stig_spinner $! output "V-38613" $? ${SETLANG} ################ ##RHEL-06-000239 ##The SSH daemon must not allow authentication using an empty password. bash $STIG_TESTS_DIR/check-ssh.sh emptypassword >/dev/null 2>&1 & stig_spinner $! output "V-38615" $? ${SETLANG} ################ ##RHEL-06-000241 ##The SSH daemon must not permit user environment settings. bash $STIG_TESTS_DIR/check-ssh.sh emptypasswordenvironment >/dev/null 2>&1 & stig_spinner $! output "V-38616" $? ${SETLANG} ################ ##RHEL-06-000243 ##The SSH daemon must be configured to use only FIPS 140-2 approved ciphers. bash $STIG_TESTS_DIR/check-ssh-ciphers.sh > /dev/null 2>&1 & stig_spinner $! output "V-38617" $? ${SETLANG} ################ ##RHEL-06-000247 ##The system clock must be synchronized continuously, or at least daily. bash $STIG_TESTS_DIR/check-services.sh ntp >/dev/null 2>&1 & stig_spinner $! output "V-38620" $? ${SETLANG} ################ ##RHEL-06-000248 ##The system clock must be synchronized to an authoritative time source. bash $STIG_TESTS_DIR/check-ntp-sources.sh >/dev/null 2>&1 & stig_spinner $! output "V-38621" $? ${SETLANG} ################ ##RHEL-06-000252 ##If the system is using LDAP for authentication or account information, the system must use a TLS connection using FIPS 140-2 approved cryptographic algorithms. #Waiting to figure out #stig_spinner $! #output "V-38625" $? ${SETLANG} ################ ##RHEL-06-000253 ##The LDAP client must use a TLS connection using trust certificates signed by the site CA. #Waiting to figure out #stig_spinner $! #output "V-38626" $? ${SETLANG} ################ ##RHEL-06-000256 ##The openldap-servers package must not be installed unless required. bash $STIG_TESTS_DIR/check-packages.sh sldap>/dev/null 2>&1 & stig_spinner $! output "V-38627" $? ${SETLANG} ################ ##RHEL-06-000257 ##The graphical desktop environment must set the idle timeout to no more than 15 minutes. #stig_spinner $! #output "V-38629" $? ${SETLANG} ################ ##RHEL-06-000258 ##The graphical desktop environment must automatically lock after 15 minutes of inactivity and the system must require user reauthentication to unlock the environment. #stig_spinner $! #output "V-38630" $? ${SETLANG} ################ ##RHEL-06-000259 ##The graphical desktop environment must have automatic lock enabled. #stig_spinner $! #output "V-38638" $? ${SETLANG} ################ ##RHEL-06-000260 ##The system must display a publicly-viewable pattern during a graphical desktop environment session lock. #stig_spinner $! #output "V-38639" $? ${SETLANG} ################ ##RHEL-06-000262 ##The atd service must be disabled. bash $STIG_TESTS_DIR/check-services.sh atd >/dev/null 2>&1 & stig_spinner $! output "V-38641" $? ${SETLANG} ################ ##RHEL-06-000269 ##Remote file systems must be mounted with the nodev option. if [ "$(mount | grep nfs | wc -l)" -gt 0 ];then bash $STIG_TESTS_DIR/check-nfs.sh nodev >/dev/null 2>&1 & stig_spinner $! output "V-38652" $? ${SETLANG} fi ################ ##RHEL-06-000270 ##Remote file systems must be mounted with the nosuid option. if [ "$(mount | grep nfs | wc -l)" -gt 0 ];then bash $STIG_TESTS_DIR/check-nfs.sh nosuid >/dev/null 2>&1 & stig_spinner $! output "V-38654" $? ${SETLANG} fi ################ ##RHEL-06-000271 ##The noexec option must be added to removable media partitions. if [ "$(grep -Hv ^0$ /sys/block/*/removable | sed s/removable:.*$/device\\/uevent/ | xargs grep -H ^DRIVER=sd | sed s/device.uevent.*$/size/ | xargs grep -Hv ^0$ | cut -d / -f 4 | wc -l)" -gt 0 ];then bash $STIG_TESTS_DIR/check-removable.sh >/dev/null 2>&1 & stig_spinner $! output "V-38655" $? ${SETLANG} fi ################ ##RHEL-06-000272 ##The system must use SMB client signing for connecting to samba servers using smbclient. bash $STIG_TESTS_DIR/check-depends.sh smb-signing >/dev/null 2>&1 & stig_spinner $! output "V-38656" $? ${SETLANG} ################ ##RHEL-06-000273 ##The system must use SMB client signing for connecting to samba servers using mount.cifs. bash $STIG_TESTS_DIR/check-depends.sh smb-sec >/dev/null 2>&1 & stig_spinner $! output "V-38657" $? ${SETLANG} ################ ##RHEL-06-000274 ##The system must prohibit the reuse of passwords within twenty-four iterations. grep remember /etc/pam.d/common-auth /etc/pam.d/common-password >/dev/null 2>&1 & stig_spinner $! output "V-38658" $? ${SETLANG} ################ ##RHEL-06-000275 ##The operating system must employ cryptographic mechanisms to protect information in storage. dmsetup status | grep -i "crypt" >/dev/null 2>&1 & stig_spinner $! output "V-38659" $? ${SETLANG} ################ ##RHEL-06-000276 ##The operating system must protect the confidentiality and integrity of data at rest. #dmsetup status | grep -i "crypt" >/dev/null 2>&1 & stig_spinner $! output "V-38661" $? ${SETLANG} ################ ##RHEL-06-000277 ##The operating system must employ cryptographic mechanisms to prevent unauthorized disclosure of data at rest unless otherwise protected by alternative physical measures. #dmsetup status | grep -i "crypt" >/dev/null 2>&1 & stig_spinner $! output "V-38662" $? ${SETLANG} ################ ##RHEL-06-000282 ##There must be no world-writable files on the system. bash $STIG_TESTS_DIR/check-world-writable.sh >/dev/null 2>&1 & stig_spinner $! output "V-38643" $? ${SETLANG} ################ ##RHEL-06-000286 ##The x86 Ctrl-Alt-Delete key sequence must be disabled. bash $STIG_TESTS_DIR/check-ctrl-alt-del.sh >/dev/null 2>&1 & stig_spinner $! output "V-38668" $? ${SETLANG} ################ ##RHEL-06-000288 ##The sendmail package must be removed. bash $STIG_TESTS_DIR/check-packages.sh sendmail >/dev/null 2>&1 & stig_spinner $! output "V-38671" $? ${SETLANG} ################ ##RHEL-06-000290 ##X Windows must not be enabled unless required. bash $STIG_TESTS_DIR/check-services.sh x11-common >/dev/null 2>&1 & stig_spinner $! output "V-38674" $? ${SETLANG} ################ ##RHEL-06-000294 ##All GIDs referenced in /etc/passwd must be defined in /etc/group check $STIG_TESTS_DIR/check-gids.sh >/dev/null 2>&1 & stig_spinner $! output "V-38681" $? ${SETLANG} ################ ##RHEL-06-000296 ##All accounts on the system must have unique user or account names check $STIG_TESTS_DIR/check-uniq-names.sh >/dev/null 2>&1 & stig_spinner $! output "V-38683" $? ${SETLANG} ################ ##RHEL-06-000302 ##A file integrity tool must be used at least weekly to check for unauthorized file changes, particularly the addition of unauthorized system libraries or binaries, or for unauthorized modification to authorized system libraries or binaries. bash $STIG_TESTS_DIR/check-aide-cron.sh > /dev/null 2>&1 & stig_spinner $! output "V-38695" $? ${SETLANG} ################ ##RHEL-06-000308 ##Process core dumps must be disabled unless needed. bash $STIG_TESTS_DIR/check-limits.sh core-dumps > /dev/null 2>&1 & stig_spinner $! output "V-38675" $? ${SETLANG} ################ ##RHEL-06-000309 ##The NFS server must not have the insecure file locking option enabled. bash $STIG_TESTS_DIR/check-nfs-insecure.sh > /dev/null 2>&1 & stig_spinner $! output "V-38677" $? ${SETLANG} ################ ##RHEL-06-000315 ##The Bluetooth kernel module must be disabled. bash $STIG_TESTS_DIR/check-bluetooth.sh > /dev/null 2>&1 & stig_spinner $! output "V-38682" $? ${SETLANG} ################ ##RHEL-06-000319 ##The system must limit users to 10 simultaneous system logins, or a site-defined number, in accordance with operational requirements. bash $STIG_TESTS_DIR/check-limits.sh maxlogins > /dev/null 2>&1 & stig_spinner $! output "V-38684" $? ${SETLANG} ################ ##RHEL-06-000320 ##The systems local firewall must implement a deny-all, allow-by-exception policy for forwarded packets. iptables -L FORWARD | head -n1 | grep "FORWARD.*DROP" >/dev/null 2>&1 & stig_spinner $! output "V-38686" $? ${SETLANG} ################ ##RHEL-06-000331 ##The Bluetooth service must be disabled. bash $STIG_TESTS_DIR/check-services.sh bluetooth >/dev/null 2>&1 & stig_spinner $! output "V-38691" $? ${SETLANG} ################ ##RHEL-06-000335 ##The operating system must manage information system identifiers for users and devices by disabling the user identifier after an organization defined time period of inactivity. bash $STIG_TESTS_DIR/check-inactive.sh >/dev/null 2>&1 & stig_spinner $! output "V-38694" $? ${SETLANG} ################ ##RHEL-06-000336 ##The sticky bit must be set on all public directories. bash $STIG_TESTS_DIR/check-sticky-bit.sh >/dev/null 2>&1 & stig_spinner $! output "V-38697" $? ${SETLANG} ################ ##RHEL-06-000337 ##All public directories must be owned by a system account. bash $STIG_TESTS_DIR/check-public-dir-owned.sh >/dev/null 2>&1 & stig_spinner $! output "V-38699" $? ${SETLANG} ################ ##RHEL-06-000345 ##The system default umask in /etc/login.defs must be 077. ##For more detial :http://stackoverflow.com/questions/10220531/how-to-set-system-wide-umask sed -e '/^#/d' -e '/^[ \t][ \t]*#/d' -e 's/#.*$//' -e '/^$/d' /etc/login.defs | grep -i "umask.*077" >/dev/null 2>&1 & stig_spinner $! output "V-38645" $? ${SETLANG} ################ ##RHEL-06-000346 ##The system default umask for daemons must be 027 or 022. ##For more detial :http://unix.stackexchange.com/questions/36220/how-to-set-umask-for-a-system-user sed -e '/^#/d' -e '/^[ \t][ \t]*#/d' -e 's/#.*$//' -e '/^$/d' /etc/init.d/rc | grep -i "umask.*027\|umask.*022" >/dev/null 2>&1 & stig_spinner $! output "V-38646" $? ${SETLANG} ################ ##RHEL-06-000347 ##There must be no .netrc files on the system. bash $STIG_TESTS_DIR/check-netrc.sh >/dev/null 2>&1 & stig_spinner $! output "V-38619" $? ${SETLANG} ################ ##RHEL-06-000356 ##The system must require administrator action to unlock an account locked by excessive failed login attempts. bash $STIG_TESTS_DIR/check-password.sh /etc/pam.d/common-auth pam_tally unlock_time lt 604800 > /dev/null 2>&1 & stig_spinner $! output "V-38592" $? ${SETLANG} ################ ##RHEL-06-000372 ##The operating system, upon successful logon/access, must display to the user the number of unsuccessful logon/access attempts since the last successful logon/access. sed -e '/^#/d' -e '/^[ \t][ \t]*#/d' -e 's/#.*$//' -e '/^$/d' /etc/pam.d/common-session | grep -i "pam_lastlog.so.*showfailed" > /dev/null 2>&1 & stig_spinner $! output "V-38501" $? ${SETLANG} ################ ##RHEL-06-000507 ##The operating system, upon successful logon, must display to the user the date and time of the last logon or access via ssh. sed -e '/^#/d' -e '/^[ \t][ \t]*#/d' -e 's/#.*$//' -e '/^$/d' /etc/ssh/sshd_config | grep -i "^PrintLastLog.*yes" > /dev/null 2>&1 & stig_spinner $! output "V-38484" $? ${SETLANG} ################ ##RHEL-06-000514 ##The package management tool must cryptographically verify the authenticity of all software packages during installation. bash $STIG_TESTS_DIR/check-apt-gpg.sh > /dev/null 2>&1 & stig_spinner $! output "V-38462" $? ${SETLANG} ################ ##RHEL-06-000515 ##The NFS server must not have the all_squash option enabled. bash $STIG_TESTS_DIR/check-nfs-all-squash.sh > /dev/null 2>&1 & stig_spinner $! output "V-38460" $? ${SETLANG} ################ ##RHEL-06-000521 ##The mail system must forward all mail for root to one or more system administrators. postmap -q root `postconf alias_maps | awk -F '=' '{print $2}'` > /dev/null 2>&1 & stig_spinner $! output "V-38446" $? ${SETLANG} ################ ##RHEL-06-000523 ##The systems local IPv6 firewall must implement a deny-all, allow-by-exception policy for inbound packets. ip6tables -L INPUT | head -n1 | grep "INPUT.*DROP" > /dev/null 2>&1 & stig_spinner $! output "V-38444" $? ${SETLANG} ################ ##RHEL-06-000526 ##Automated file system mounting tools must not be enabled unless needed. bash $STIG_TESTS_DIR/check-services.sh autofs >/dev/null 2>&1 & stig_spinner $! output "V-38437" $? ${SETLANG} ################ ##RHEL-06-000528 ##The noexec option must be added to the /tmp partition. sed -e '/^#/d' -e '/^[ \t][ \t]*#/d' -e 's/#.*$//' -e '/^$/d' /etc/fstab | grep "/tmp.*noexec" >/dev/null 2>&1 & stig_spinner $! output "V-57569" $? ${SETLANG} ################ ##RHEL-06-000529 ##The sudo command must require authentication. bash $STIG_TESTS_DIR/check-sudo.sh >/dev/null 2>&1 & stig_spinner $! output "V-58901" $? ${SETLANG} ################ echo '' echo "Passes: $PASSES" echo "Fails: $FAILS" if [ $FAILS -gt 0 ]; then exit 792353 fi } while [[ $# > 1 ]] do key="$1" case $key in -h|--help) show_help ;; -s|--stig) RUN_STIG=1 ;; *) # unknown option ;; esac shift done echo $'Running tests' test_app_functions test_unique_onion_ports test_stig echo $'All tests passed' exit 0