title: Using '-servername' param with openssl s_client
body: <p>I am installing a new SSL certificate on Centos6/Apache and my web browser keeps picking up the old certificate. To test my setup, I am using "openssl s_client" but I am seeing different results based on the "-servername" parameter. No one seems to us this parameter and it does not appear in the man pages but I saw it mentioned here <a href="https://www.shellhacks.com/openssl-check-ssl-certificate-expiration-date/" rel="noreferrer">OpenSSL: Check SSL Certificate Expiration Date and More </a>. </p>
  
  <p>If I run this command: </p>
  
  <p><code>echo | openssl s_client -connect example.com:443 2&gt;/dev/null | openssl x509 -noout -issuer -subject -dates</code></p>
  
  <p>I get the correct date for the certificate.</p>
  
  <p>(notBefore=Apr 20 00:00:00 2017 GMT notAfter=Apr 20 23:59:59 2018 GMT)</p>
  
  <p>However, if I intruduce the -servername parameter into the commmand</p>
  
  <p><code>echo | openssl s_client -servername example.com -connect example.com:443 2&gt;/dev/null | openssl x509 -noout -issuer -subject -dates</code></p>
  
  <p>I then get the expired date that my browser is showing - </p>
  
  <p>(notBefore=Apr 20 00:00:00 2016 GMT notAfter=Apr 20 23:59:59 2017 GMT)</p>
  
  <p>Can anyone explain why this is happening, as this must be related to the reason why my SSL certificate shows as expired in my browser.</p>
  
  <p>Thanks
  O </p>