Last active
August 29, 2015 14:07
-
-
Save aauren/b4e868ad05bf79ceaf45 to your computer and use it in GitHub Desktop.
Salt Command To Check For Open HTTPS Ports + Find Domain Name If Apache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Command to find all servers and show whether they have an SSL port open or not | |
salt '*' cmd.run "if netstat -an 2>/dev/null |grep -qE '.*(443|8443)+[ \t]+.*LISTEN[ \t]*$'; then echo '+++SSL Port Found+++'; apachectl -S 2>&1 |grep -E '(:443|port 443)'; else echo '---SSL Port Not Found---'; fi" | |
# Same command as above, except only display servers with an open SSL port | |
salt '*' cmd.run "if netstat -an 2>/dev/null |grep -qE '.*(443|8443)+[ \t]+.*LISTEN[ \t]*$'; then echo '+++SSL Port Found+++'; apachectl -S 2>&1 |grep -E '(:443|port 443)'; else echo '---SSL Port Not Found---'; fi" |tac | sed '/---SSL Port Not Found---/,+1 d' |tac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment