Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Checking TLSv1.3 support using openssl

Tags:

bash

tls1.3

I'm using openssl to check if there is tlsv1.3 support or not over the list of domains. I've write the script but the script doesn't get stopped its waits for me to press CTRL+D than it gives me a result. here is the scirpt

!/usr/bin/env bash

filename='domains.txt'
while read line;do
domain=$line

if openssl s_client -connect $domain:443 -tls1_3 2>/dev/null | grep -q 'Protocol  : TLSv1.3'; then
  echo "tls V 1.3 being used "
else
 echo "tls v 1.3 not begin used"
fi
done <$filename

I've also used echo with openssl like this

echo "x" | openssl s_client -connect www.example.com:443 -tls1_3 2>/dev/null | grep  'Protocol  : TLSv1.3'

NOTE: When i run the command on terminal for individual site i get the result without typing CRTL+D but when i used it in script using loop and if statement its waits for me to press CTRL+D. Its really strange.

I've also tried echo "q" | openssl command

like image 677
Salman Ali Avatar asked Jul 14 '26 22:07

Salman Ali


1 Answers

Do like:

echo Q | timeout 1 openssl s_client -connect www.example.com:443 -tls1_3 2>/dev/null

Passing Q will make it quit fast, and when can't connect timeout will make it quit.

like image 198
KamilCuk Avatar answered Jul 20 '26 16:07

KamilCuk