:PROPERTIES:
:ID:       9eedbc4b-a961-4057-b2d8-8f10845f0478
:mtime:    20220130165326
:ctime:    20220130165153
:END:
#+title: Vérification des cyphers suites acceptées par un serveur

* Howto
#+begin_src shell :results output verbatim
#!/usr/bin/env bash
# from https://superuser.com/questions/109213/how-do-i-list-the-ssl-tls-cipher-suites-a-particular-website-offers

# openssl requires the port number.
server='git.adrien.run:443'
delay=1

ciphers=$(openssl ciphers 'all:enull' | sed -e 's/:/ /g')

echo obtaining cipher list from $(openssl version).

for cipher in ${ciphers[@]}
do
echo -n testing $cipher...
result=$(echo -n | openssl s_client -cipher "$cipher" -connect $server 2>&1)
if [[ "$result" =~ ":error:" ]] ; then
  error=$(echo -n $result | cut -d':' -f6)
  echo no \($error\)
else
  if [[ "$result" =~ "cipher is ${cipher}" || "$result" =~ "cipher    :" ]] ; then
    echo yes
  else
    echo unknown response
    echo $result
  fi
fi
sleep $delay
done
#+end_src

* Référence
 * [[https://superuser.com/questions/109213/how-do-i-list-the-ssl-tls-cipher-suites-a-particular-website-offers][How do I list the ssl tls cipher suites a particular website offers]]
