Advertisement
Guest User

Untitled

a guest
Apr 17th, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.81 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. echo "This script will install utilities necessary for testing. Please enter your password below (if prompted)"
  4. sudo apt-get -y install ldap-utils wget
  5. echo "Installation completed, the script will now begin testing (in 10 seconds)."
  6. sleep 10
  7.  
  8. GRADE=0
  9.  
  10. # Server: web
  11. echo -n "Testing server web for SSH and syslog: "
  12. ssh -o PasswordAuthentication=no root@192.168.37.10 "uname -a | grep Ubuntu" > /dev/null
  13. if [ $? -eq 0 ] ; then GRADE=$(($GRADE + 10)); echo "Success" ; fi
  14.  
  15. ssh -o PasswordAuthentication=no cis235@192.168.37.10 "logger cis235" > /dev/null
  16. if [ $? -eq 0 ] ; then GRADE=$(($GRADE + 10)); echo "Success" ; fi
  17.  
  18. # Server: auth
  19. echo -n "Testing server auth for SSH and syslog: "
  20. ssh -o PasswordAuthentication=no root@192.168.37.11 "uname -a | grep el7" > /dev/null
  21. if [ $? -eq 0 ] ; then GRADE=$(($GRADE + 10)); echo "Success" ; fi
  22.  
  23. ssh -o PasswordAuthentication=no cis235@192.168.37.11 "logger cis235" > /dev/null
  24. if [ $? -eq 0 ] ; then GRADE=$(($GRADE + 10)); echo "Success" ; fi
  25.  
  26. # Server: syslog
  27. echo -n "Testing server syslog for SSH and syslog: "
  28. ssh -o PasswordAuthentication=no root@192.168.37.12 "uname -a | grep el6" > /dev/null
  29. if [ $? -eq 0 ] ; then GRADE=$(($GRADE + 10)); echo "Success" ; fi
  30.  
  31. ssh -o PasswordAuthentication=no cis235@192.168.37.12 "logger cis235" > /dev/null
  32. if [ $? -eq 0 ] ; then GRADE=$(($GRADE + 10)); echo "Success" ; fi
  33.  
  34. # Rsyslog testing
  35. echo -n "Testing for correct logging to syslog server: "
  36. ssh -o PasswordAuthentication=no root@192.168.37.12 "grep cis235 /var/log/rsyslog_cis235/web/rsyslog.log" > /dev/null
  37. if [ $? -eq 0 ] ; then GRADE=$(($GRADE + 30)); echo -n "web... yes " ; fi
  38. ssh -o PasswordAuthentication=no root@192.168.37.12 "grep cis235 /var/log/rsyslog_cis235/auth/rsyslog.log" > /dev/null
  39. if [ $? -eq 0 ] ; then GRADE=$(($GRADE + 30)); echo -n "auth... yes " ; fi
  40. ssh -o PasswordAuthentication=no root@192.168.37.12 "grep cis235 /var/log/rsyslog_cis235/syslog/rsyslog.log" > /dev/null
  41. if [ $? -eq 0 ] ; then GRADE=$(($GRADE + 30)); echo "syslog... yes" ; fi
  42.  
  43. # LDAP test
  44. echo -n "Testing ldap server TLS function: "
  45. ldapsearch -ZZ -D "uid=cis235,ou=people,dc=cis235,dc=local" -w cis235 -p 389 -h 192.168.37.11 -b "dc=cis235,dc=local" > /dev/null
  46. if [ $? -eq 0 ] ; then GRADE=$(($GRADE + 50)) ; echo "Success" ; fi
  47. echo -n "Testing ldap server access to cn=config: "
  48. ldapsearch -D "cn=Manager,cn=config" -W -p 389 -h 192.168.37.11 -b "cn=config" > /dev/null
  49. if [ $? -eq 0 ] ; then GRADE=$(($GRADE + 50)) ; echo "Success" ; fi
  50.  
  51. # HTTP + LDAP check
  52. echo -n "Testing Apache HTTPS with LDAP login: "
  53. wget -qO- --no-check-certificate --http-user=cis235 --http-passwd=cis235 https://192.168.37.10/ > /dev/null
  54. if [ $? -eq 0 ] ; then GRADE=$(($GRADE + 50)) ; echo "Success" ; fi
  55.  
  56. echo All tests completed.
  57. echo Current Grade: $GRADE out of 300
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement