Identify and Collect TLS Certificate Information from hosts to files

This macos bash script prompts for a comma delimited list of hostnames directly in terminal window, it is used to Identify and Collect TLS Certificate Information form hosts to files if there is more than one and processes the following command(s) to derive show certs information for each hostname and each of these ports.

Ports Array:
1) 443, 2) 8443 3) 2197, 4) 139, 5) 3306 , 6) 80

1st Command applied this example is applying hostname (www.example.com) on port 443
openssl s_client -connect www.example.com:443 -showcerts

2nd Command applied
openssl s_client -connect www.example.com:443 | openssl x509 -text

The Script outputs of each of these commands saved by the hostname, port and 509 to the directory /Users/Shared.
For examples: 1) /Users/Shared/www.example.com.443.showcerts.txt 2) /Users/Shared/www.example.com.443.509.txt

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top
Share via
Copy link