Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- path=$(pwd)
- OK=$(echo -e " \e[32mOK\e[39m")
- KO=$(echo -e " \e[31mKO\e[39m")
- ZY.1.2.1 ()
- {
- func="ZY.1.1"
- cd /etc/sudoers.d/
- if ! [ -z "$(egrep -i -R '(^|\s)!logfile($|\s)')" ]
- then
- echo -e -n $func $KO" " | tee -a $path/sudo_out
- echo -e -n "${PWD}/" | tee -a $path/sudo_out
- egrep -i -R '(^|\s)!logfile($|\s)' | tee -a $path/sudo_out
- fi
- if ! [ -z "$(cat /etc/sudoers | egrep '(^|\s)!logfile($|\s)')" ]
- then
- echo -n $func $KO | tee -a $path/sudo_out
- cat /etc/sudoers.bak | egrep '(^|\s)!logfile($|\s)' | tee -a $path/sudo_out
- else
- echo -e $func $OK | tee -a $path/sudo_out
- fi
- }
- ZY.1.2.2 ()
- {
- func="ZY.1.2.2"
- if [ -f /var/log/sudo.log ]
- then
- echo -e -$func $OK
- else
- echo -e $func $KO
- fi
- }
- ZY.1.2.4 ()
- {
- cd /etc/
- func="ZY.1.2.4"
- if [[ $(cat logrotate.conf | grep -A7 '/var/log/secure' | grep rotate | awk '{print $2}') -eq 13 ]]
- then
- echo -e $func $OK
- elif [[ $(grep -A7 -i "/var/log/secure" /etc/logrotate.d/* | awk -F "-" '{printf $2 "\n"}' | grep -i rotate | awk '{printf $2}') -eq 13 ]]
- then
- echo -e $func $OK
- elif [[ $(cat logrotate.conf | grep -A7 -i weekly | grep -i rotate | awk '{printf $2}') -eq 13 ]]
- then
- echo -e $func $OK
- else
- echo -e $func $KO
- fi
- }
- ZY.1.2.1
- ZY.1.2.2
- ZY.1.2.4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement