Browse Subversion Repository
Contents of /checkssl.bash
Parent Directory
| Revision Log
Revision 22 -
( show annotations)
( download)
Wed Feb 19 06:43:47 2020 UTC
(4 years, 3 months ago)
by elge
File size: 1987 byte(s)
imporing the rest of shot1 incl enforce check
| 1 |
#!/bin/bash |
| 2 |
set -e |
| 3 |
|
| 4 |
debug=0 |
| 5 |
|
| 6 |
[[ ! -f $HOME/masspie/cacert.pem ]] && echo $HOME/masspie/cacert.pem is required && exit 1 |
| 7 |
|
| 8 |
ehlo=pro5s2.nethence.com |
| 9 |
#ehlo=`curl -s ip.nethence.com | sed -n 1p | awk '{print $NF}' | sed 's/\.$//'` |
| 10 |
echo using $ehlo as EHLO |
| 11 |
|
| 12 |
function checkssl { |
| 13 |
[[ -z $mx ]] && echo function $0 requires \$mx && exit 1 |
| 14 |
|
| 15 |
#we only need the last result with 'Verify', as it repeats in parenthesis what 'Verification' said above |
| 16 |
if raw=`echo Q | timeout --preserve-status -k 5s 10s /usr/local/bin/openssl s_client -4 -showcerts -verify 5 -CAfile $HOME/masspie/cacert.pem -starttls smtp -name $ehlo -servername $mx -connect $mx:25 -crlf 2>/dev/null`; then |
| 17 |
issuer=`echo "$raw" | grep -E '^issuer='` |
| 18 |
cipher=`echo "$raw" | grep -E 'Cipher is|^Server public key is'` |
| 19 |
|
| 20 |
[[ -n $issuer ]] && echo -e $mx\\t$issuer >> $piece.ssl.issuer |
| 21 |
[[ -n $cipher ]] && echo -e $mx\\t$cipher >> $piece.ssl.cipher |
| 22 |
|
| 23 |
unset issuer cipher |
| 24 |
fi |
| 25 |
result=`echo "$raw" | grep -E 'Cipher is|Verify return code'` |
| 26 |
echo -e $mx\\t$result |
| 27 |
|
| 28 |
#-CApath /etc/ssl/certs |
| 29 |
#-brief |
| 30 |
#-verify_return_error |
| 31 |
|
| 32 |
unset raw result |
| 33 |
} |
| 34 |
|
| 35 |
function processpiece { |
| 36 |
rm -f $piece.ssl.issuer $piece.ssl.cipher |
| 37 |
for mx in `cat $piece`; do |
| 38 |
checkssl |
| 39 |
done > $piece.ssl && echo $piece done || echo $piece FAIL; unset mx |
| 40 |
} |
| 41 |
|
| 42 |
#echo -n entering domains/mx/dane/ ... |
| 43 |
#mkdir -p domains/mx/dane/ |
| 44 |
#cd domains/mx/dane/ |
| 45 |
|
| 46 |
#echo -n splitting mx.unique into 50 pieces... |
| 47 |
#split -a2 -d -nl/50 ../mx.unique mx.unique && echo done |
| 48 |
|
| 49 |
#real 392m40.484s |
| 50 |
#user 195m10.038s |
| 51 |
#sys 33m7.304s |
| 52 |
echo -n starting 50 processes to process those... |
| 53 |
#for piece in mx.unique48; do |
| 54 |
echo writing to mx.uniqueXX.ssl mx.uniqueXX.ssl.issuer mx.uniqueXX.ssl.cipher |
| 55 |
for piece in mx.unique[0-9][0-9]; do |
| 56 |
processpiece & |
| 57 |
done && echo all pieces processing done || echo all pieces processing FAIL; unset piece |
| 58 |
cat <<EOF |
| 59 |
|
| 60 |
watch live with |
| 61 |
|
| 62 |
ps auxfww | grep checkssl | grep -v grep |
| 63 |
cd mass/splitted/domains/mx/dane/ |
| 64 |
tail -F *.ssl |
| 65 |
|
| 66 |
EOF |
| 67 |
time wait |
| 68 |
|
|