Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- echo "This script will install utilities necessary for testing. Please enter your password below (if prompted)"
- sudo apt-get -y install ldap-utils wget
- echo "Installation completed, the script will now begin testing (in 10 seconds)."
- sleep 10
- GRADE=0
- # Server: web
- echo -n "Testing server web for SSH and syslog: "
- ssh -o PasswordAuthentication=no root@192.168.37.10 "uname -a | grep Ubuntu" > /dev/null
- if [ $? -eq 0 ] ; then GRADE=$(($GRADE + 10)); echo "Success" ; fi
- ssh -o PasswordAuthentication=no cis235@192.168.37.10 "logger cis235" > /dev/null
- if [ $? -eq 0 ] ; then GRADE=$(($GRADE + 10)); echo "Success" ; fi
- # Server: auth
- echo -n "Testing server auth for SSH and syslog: "
- ssh -o PasswordAuthentication=no root@192.168.37.11 "uname -a | grep el7" > /dev/null
- if [ $? -eq 0 ] ; then GRADE=$(($GRADE + 10)); echo "Success" ; fi
- ssh -o PasswordAuthentication=no cis235@192.168.37.11 "logger cis235" > /dev/null
- if [ $? -eq 0 ] ; then GRADE=$(($GRADE + 10)); echo "Success" ; fi
- # Server: syslog
- echo -n "Testing server syslog for SSH and syslog: "
- ssh -o PasswordAuthentication=no root@192.168.37.12 "uname -a | grep el6" > /dev/null
- if [ $? -eq 0 ] ; then GRADE=$(($GRADE + 10)); echo "Success" ; fi
- ssh -o PasswordAuthentication=no cis235@192.168.37.12 "logger cis235" > /dev/null
- if [ $? -eq 0 ] ; then GRADE=$(($GRADE + 10)); echo "Success" ; fi
- # Rsyslog testing
- echo -n "Testing for correct logging to syslog server: "
- ssh -o PasswordAuthentication=no root@192.168.37.12 "grep cis235 /var/log/rsyslog_cis235/web/rsyslog.log" > /dev/null
- if [ $? -eq 0 ] ; then GRADE=$(($GRADE + 30)); echo -n "web... yes " ; fi
- ssh -o PasswordAuthentication=no root@192.168.37.12 "grep cis235 /var/log/rsyslog_cis235/auth/rsyslog.log" > /dev/null
- if [ $? -eq 0 ] ; then GRADE=$(($GRADE + 30)); echo -n "auth... yes " ; fi
- ssh -o PasswordAuthentication=no root@192.168.37.12 "grep cis235 /var/log/rsyslog_cis235/syslog/rsyslog.log" > /dev/null
- if [ $? -eq 0 ] ; then GRADE=$(($GRADE + 30)); echo "syslog... yes" ; fi
- # LDAP test
- echo -n "Testing ldap server TLS function: "
- 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
- if [ $? -eq 0 ] ; then GRADE=$(($GRADE + 50)) ; echo "Success" ; fi
- echo -n "Testing ldap server access to cn=config: "
- ldapsearch -D "cn=Manager,cn=config" -W -p 389 -h 192.168.37.11 -b "cn=config" > /dev/null
- if [ $? -eq 0 ] ; then GRADE=$(($GRADE + 50)) ; echo "Success" ; fi
- # HTTP + LDAP check
- echo -n "Testing Apache HTTPS with LDAP login: "
- wget -qO- --no-check-certificate --http-user=cis235 --http-passwd=cis235 https://192.168.37.10/ > /dev/null
- if [ $? -eq 0 ] ; then GRADE=$(($GRADE + 50)) ; echo "Success" ; fi
- echo All tests completed.
- echo Current Grade: $GRADE out of 300
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement