This is an Apache config sanitizer, it checks to make sure there are no orphaned files in the Debian style sites-available/sites-enabled type setup and checks to make sure each virtual host has a valid DNS.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | #!/bin/bash # Apache config sanitizer.. Checks to make sure all sites are correctly configured # for DNS and checks for orphaned config files. # # By Gerhard Mack <gmack@innerfire.net> function getipaddress { if [[ "${1}" == 4 ]] then getent ahostsv4 "${2}" | grep STREAM | head -n 1 | cut -d ' ' -f 1 return fi if [[ "${1}" == 6 ]] then getent ahostsv6 "${2}" | grep STREAM | head -n 1 | cut -d ' ' -f 1 return fi } while read line do name= "$(basename $line)" #Ignore common standard files if [[ "${name}" == "000-default-le-ssl.conf" ]] then continue fi if [[ "${name}" == "default-ssl.conf" ]] then continue fi if [[ "${name}" == "000-default.conf" ]] then continue fi if [[ ! -e "/etc/apache2/sites-enabled/${name}" ]] then echo orphaned file : ${line} fi done <<< "$(find /etc/apache2/sites-available/ -name '*.conf')" while read line do array=( $line ) if [[ "${line:0:1}" == [0-9] ]] then VIP=$( echo ${array[0]} | cut -d: -f1 ) IPV=4 continue fi if [[ "${line:0:1}" == "[" ]] then VIP=$( echo ${array[0]} | cut -d\] -f1 | cut -d \[ -f2) IPV=6 continue fi if [[ "${line:0:1}" == "*" ]] then continue fi if [[ "${array[0]}" == "port" ]] then VHOST= "${array[3]}" IP=$(getipaddress ${IPV} ${VHOST}) if [[ -z "${IP}" ]] then echo ${VHOST} does not resolve. \(should be \"${VIP}\"\) continue fi if [[ "${IP}" == "::ffff:" * ]] then echo ${VHOST} does not have an IPv6 address. \(should be \"${VIP}\"\) continue fi if [[ "$IP" != "$VIP" ]] then echo vhost ${VHOST} points to \"${IP}\" \(should be \"${VIP}\"\) fi continue fi if [[ "$array[0]" == "alias[0]" ]] then VALIAS= "${array[1]}" IP=$(getipaddress ${IPV} ${VALIAS}) if [[ -z $IP ]] ; then echo ${VHOST} alias ${VALIAS} does not resolve. \(should be \"${VIP}\"\) continue fi if [[ ${IP} == "::ffff:" * ]] then echo ${VHOST} alias ${VALIAS} does not have an IPv6 address. \(should be \"${VIP}\"\) continue fi if [[ "$IP" != "$VIP" ]] ; then echo vhost ${VHOST} alias $VALIAS points to \"${IP}\" \(should be \"${VIP}\"\) fi continue fi done <<< "$(apachectl -S)" |
Pretty nice Gerhard! See you on Freenode?
At some point, I checked my IRC window and realized I had been idle for over a year so I’ve cut back to google hangouts/facebook/skype etc. Unless there is something I need or is arranged in advance.
Yeah I don’t really get on there much either. Been since May now, for instance.
There is always facebook, ring or google messenger.