Skip to content

Instantly share code, notes, and snippets.

@marcinpraczko
Created October 17, 2014 14:11
Show Gist options
  • Save marcinpraczko/4dbc05e2f509a6a45ab6 to your computer and use it in GitHub Desktop.
Save marcinpraczko/4dbc05e2f509a6a45ab6 to your computer and use it in GitHub Desktop.
SSL - Testing SNI with openssl
# Tested on:
# CentOS release 6.5 (x86_64)
# OpenSSL: OpenSSL 1.0.1e-fips 11 Feb 2013
# This is basic example of testing SNI with openssl command
# Required - 2 valid SSL certs with keys
# No checking Intermedaite SSL certs so far
# Setup server - listen on localhost:4433 by default.
openssl s_server -www \
-servername www.domain1.com -cert www.domain1.com.crt -key www.domain1.com.key \
-servername www.domain2.com -cert2 www.domain2.com.crt -key2 www.domain2.com.key
# --- www.domain1.com ---
# Connect with www.domain1.com
openssl s_client -servername www.domain1.com -connect localhost:4433
# Reply from server
ACCEPT
Hostname in TLS extension: "www.domain1.com"
# --- www.domain2.com ---
# Connect with www.domain2.com
openssl s_client -servername www.domain2.com -connect localhost:4433
# Reply from server
ACCEPT
Hostname in TLS extension: "www.domain2.com"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment