Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. path=$(pwd)
  4. OK=$(echo -e " \e[32mOK\e[39m")
  5. KO=$(echo -e " \e[31mKO\e[39m")
  6.  
  7. ZY.1.2.1 ()
  8. {
  9. func="ZY.1.1"
  10.  
  11. cd /etc/sudoers.d/
  12.  
  13. if ! [ -z "$(egrep -i -R '(^|\s)!logfile($|\s)')" ]
  14. then
  15. echo -e -n $func $KO" " | tee -a $path/sudo_out
  16. echo -e -n "${PWD}/" | tee -a $path/sudo_out
  17. egrep -i -R '(^|\s)!logfile($|\s)' | tee -a $path/sudo_out
  18. fi
  19. if ! [ -z "$(cat /etc/sudoers | egrep '(^|\s)!logfile($|\s)')" ]
  20. then
  21. echo -n $func $KO | tee -a $path/sudo_out
  22. cat /etc/sudoers.bak | egrep '(^|\s)!logfile($|\s)' | tee -a $path/sudo_out
  23. else
  24. echo -e $func $OK | tee -a $path/sudo_out
  25. fi
  26. }
  27.  
  28. ZY.1.2.2 ()
  29. {
  30.  
  31. func="ZY.1.2.2"
  32.  
  33. if [ -f /var/log/sudo.log ]
  34. then
  35. echo -e -$func $OK
  36. else
  37. echo -e $func $KO
  38. fi
  39. }
  40.  
  41. ZY.1.2.4 ()
  42.  
  43. {
  44. cd /etc/
  45. func="ZY.1.2.4"
  46. if [[ $(cat logrotate.conf | grep -A7 '/var/log/secure' | grep rotate | awk '{print $2}') -eq 13 ]]
  47. then
  48. echo -e $func $OK
  49. elif [[ $(grep -A7 -i "/var/log/secure" /etc/logrotate.d/* | awk -F "-" '{printf $2 "\n"}' | grep -i rotate | awk '{printf $2}') -eq 13 ]]
  50. then
  51. echo -e $func $OK
  52. elif [[ $(cat logrotate.conf | grep -A7 -i weekly | grep -i rotate | awk '{printf $2}') -eq 13 ]]
  53. then
  54. echo -e $func $OK
  55. else
  56. echo -e $func $KO
  57. fi
  58. }
  59.  
  60.  
  61. ZY.1.2.1
  62. ZY.1.2.2
  63. ZY.1.2.4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement