0

I am writing a shell script to save ssl certificats for a list of domains. While loop is beaking early when openssl responds correcly.

#!/bin/bash
cat urls | while read url
do
    echo "processing $url ..."
    domain=`echo $url | cut -d'/' -f3 | cut -d':' -f1`
    timeout 30 openssl s_client -connect $domain:443 -servername $domain > $domain.pem 2>/dev/null
done

Here is an example of urls file:

 https://app.singstat.gov.sg/rss/rssfeed.aspx
 https://bugs.maemo.org/attachment.cgi?id=644
 https://www.audisaradarpb.com/sfp/SFP_EF_html/Portal/Public_Page/
 https://www.bankerstrust.com/news/index.html
user973296
  • 113
  • 1
  • 8

0 Answers0