{"id":3279,"date":"2015-01-12T10:46:22","date_gmt":"2015-01-12T01:46:22","guid":{"rendered":"https:\/\/www.pistolfly.com\/weblog\/?p=3279"},"modified":"2017-10-17T21:26:38","modified_gmt":"2017-10-17T12:26:38","slug":"testing-ssl-certificate-with-openssl","status":"publish","type":"post","link":"https:\/\/www.pistolfly.com\/weblog\/en\/2015\/01\/testing-ssl-certificate-with-openssl.html","title":{"rendered":"Testing SSL certificate with OpenSSL commands"},"content":{"rendered":"<p>Before installing SSL certificate and Intermediate CA certificate on Web server such as Apache, you may want to verify them.<br \/>\nYou can do it using OpenSSL openssl command.<\/p>\n<h2>Start SSL\/TLS server using openssl s_server<\/h2>\n<p>s_server implements a generic SSL\/TLS server which accepts connections from remote clients speaking SSL\/TLS.<\/p>\n<pre>openssl s_server -cert &lt;path\/to\/certificate&gt; -key &lt;path\/to\/private key&gt; -CAfile &lt;path\/to\/Intermediate CA certificate&gt;\r\n<\/pre>\n<p><strong>Example:<\/strong><\/p>\n<pre class=\"command-line\">$ openssl s_server -cert server.crt -key server.key -CAfile intermediate.crt \r\nUsing default temp DH parameters\r\nUsing default temp ECDH parameters\r\nACCEPT\r\n<\/pre>\n<h2>Test with openssl s_client<\/h2>\n<p>Connect to the server using openssl s_client and verify certificates.<br \/>\ns_client implements a generic SSL\/TLS client which can establish a transparent connection to a remote server speaking SSL\/TLS.<\/p>\n<pre>openssl s_client -connect localhost:4433 -CAfile &lt;path\/to\/CA certificate&gt;\r\n<\/pre>\n<p><strong>Example of CA certificate:<\/strong><\/p>\n<ul>\n<li>Mac OS X<br \/>\n\/etc\/openssl\/cert.pem<br \/>\n\/opt\/local\/etc\/openssl\/cert.pem\u3001\/opt\/local\/share\/curl\/curl-ca-bundle.crt (with MacPorts)\n<\/li>\n<li>\nUbuntu (You need to install ca-certificates using apt)<br \/>\n\/etc\/ssl\/certs\/ca-certificates.crt\n<\/li>\n<li>\nCentOS<br \/>\nCA certificate id in \/etc\/pki\/tls\/certs\/ca-bundle.crt but you don't have to specify it.\n<\/li>\n<\/ul>\n<p><strong>Example:<\/strong><\/p>\n<pre class=\"command-line\">$ openssl s_client -connect localhost:4433 -CAfile \/opt\/local\/share\/curl\/curl-ca-bundle.crt\r\nCONNECTED(00000003)\r\ndepth=3 (omitted)\r\nverify return:1\r\ndepth=2 (omitted)\r\nverify return:1\r\ndepth=1 (omitted)\r\nverify return:1\r\ndepth=0 (omitted)\r\nverify return:1\r\n---\r\nCertificate chain\r\n 0 s:(omitted)\r\n   i:(omitted)\r\n 1 s:(omitted)\r\n   i:(omitted)\r\n 2 s:(omitted)\r\n   i:(omitted)\r\n 3 s:(omitted)\r\n   i:(omitted)\r\n---\r\nServer certificate\r\n-----BEGIN CERTIFICATE-----\r\n(omitted)\r\n-----END CERTIFICATE-----\r\nsubject=(omitted)\r\nissuer=(omitted)\r\n---\r\nNo client certificate CA names sent\r\n---\r\nSSL handshake has read 4744 bytes and written 443 bytes\r\n---\r\nNew, TLSv1\/SSLv3, Cipher is ECDHE-RSA-AES256-GCM-SHA384\r\nServer public key is 2048 bit\r\nSecure Renegotiation IS supported\r\nCompression: zlib compression\r\nExpansion: zlib compression\r\nSSL-Session:\r\n    Protocol  : TLSv1.2\r\n    Cipher    : ECDHE-RSA-AES256-GCM-SHA384\r\n    Session-ID: (omitted)\r\n    Session-ID-ctx: \r\n    Master-Key: (omitted)\r\n    Key-Arg   : None\r\n    PSK identity: None\r\n    PSK identity hint: None\r\n    SRP username: None\r\n    TLS session ticket lifetime hint: 300 (seconds)\r\n    TLS session ticket:\r\n    (omitted)\r\n    Compression: 1 (zlib compression)\r\n    Start Time: 1421023132\r\n    Timeout   : 300 (sec)\r\n    Verify return code: 0 (ok)\r\n---\r\n<\/pre>\n<p>After you have installed certificates on the server, verify them with s_client like below.<br \/>\n -servername is needed for SNI (Server Name Indication).<\/p>\n<ul>\n<li>\nMac OS X<\/p>\n<pre class=\"command-line\">$ openssl s_client -connect www.example.com:443 -servername www.example.com -showcerts -CAfile \/opt\/local\/etc\/openssl\/cert.pem\r\n<\/pre>\n<\/li>\n<li>\nCentOS<\/p>\n<pre class=\"command-line\">$ openssl s_client -connect www.example.com:443 -servername www.example.com -showcerts\r\n<\/pre>\n<\/li>\n<li>\nUbuntu<br \/>\n(You need to install ca-certificates using apt)<\/p>\n<pre class=\"command-line\">$ openssl s_client -connect www.example.com:443 -servername www.example.com -showcerts -CAfile \/etc\/ssl\/certs\/ca-certificates.crt\r\n<\/pre>\n<\/li>\n<\/ul>\n<p>If you want to show expiring date of certificate, <\/p>\n<pre class=\"command-line\">$ echo | openssl s_client -connect www.example.com:443 -servername www.example.com -showcerts 2&gt;\/dev\/null | openssl x509 -noout -dates\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Before installing SSL certificate and Intermediate CA certificate on Web server such as Apache, you may want t &hellip; <a href=\"https:\/\/www.pistolfly.com\/weblog\/en\/2015\/01\/testing-ssl-certificate-with-openssl.html\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Testing SSL certificate with OpenSSL commands<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_locale":"en_US","_original_post":"2821","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[14,19],"tags":[],"class_list":["post-3279","post","type-post","status-publish","format-standard","hentry","category-network","category-security","en-US"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Testing SSL certificate with OpenSSL commands - Pistolfly<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pistolfly.com\/weblog\/en\/2015\/01\/testing-ssl-certificate-with-openssl.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Testing SSL certificate with OpenSSL commands - Pistolfly\" \/>\n<meta property=\"og:description\" content=\"Before installing SSL certificate and Intermediate CA certificate on Web server such as Apache, you may want t &hellip; Continue reading Testing SSL certificate with OpenSSL commands &rarr;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pistolfly.com\/weblog\/en\/2015\/01\/testing-ssl-certificate-with-openssl.html\" \/>\n<meta property=\"og:site_name\" content=\"Pistolfly\" \/>\n<meta property=\"article:published_time\" content=\"2015-01-12T01:46:22+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-10-17T12:26:38+00:00\" \/>\n<meta name=\"author\" content=\"Pistolfly\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Pistolfly\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.pistolfly.com\\\/weblog\\\/en\\\/2015\\\/01\\\/testing-ssl-certificate-with-openssl.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pistolfly.com\\\/weblog\\\/en\\\/2015\\\/01\\\/testing-ssl-certificate-with-openssl.html\"},\"author\":{\"name\":\"Pistolfly\",\"@id\":\"https:\\\/\\\/www.pistolfly.com\\\/weblog\\\/#\\\/schema\\\/person\\\/e779e918730b507907b3a35b77a9a2ab\"},\"headline\":\"Testing SSL certificate with OpenSSL commands\",\"datePublished\":\"2015-01-12T01:46:22+00:00\",\"dateModified\":\"2017-10-17T12:26:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.pistolfly.com\\\/weblog\\\/en\\\/2015\\\/01\\\/testing-ssl-certificate-with-openssl.html\"},\"wordCount\":199,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.pistolfly.com\\\/weblog\\\/#\\\/schema\\\/person\\\/e779e918730b507907b3a35b77a9a2ab\"},\"articleSection\":[\"network\",\"security\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.pistolfly.com\\\/weblog\\\/en\\\/2015\\\/01\\\/testing-ssl-certificate-with-openssl.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.pistolfly.com\\\/weblog\\\/en\\\/2015\\\/01\\\/testing-ssl-certificate-with-openssl.html\",\"url\":\"https:\\\/\\\/www.pistolfly.com\\\/weblog\\\/en\\\/2015\\\/01\\\/testing-ssl-certificate-with-openssl.html\",\"name\":\"Testing SSL certificate with OpenSSL commands - Pistolfly\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pistolfly.com\\\/weblog\\\/#website\"},\"datePublished\":\"2015-01-12T01:46:22+00:00\",\"dateModified\":\"2017-10-17T12:26:38+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.pistolfly.com\\\/weblog\\\/en\\\/2015\\\/01\\\/testing-ssl-certificate-with-openssl.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.pistolfly.com\\\/weblog\\\/en\\\/2015\\\/01\\\/testing-ssl-certificate-with-openssl.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.pistolfly.com\\\/weblog\\\/en\\\/2015\\\/01\\\/testing-ssl-certificate-with-openssl.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u30db\u30fc\u30e0\",\"item\":\"https:\\\/\\\/www.pistolfly.com\\\/weblog\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Testing SSL certificate with OpenSSL commands\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.pistolfly.com\\\/weblog\\\/#website\",\"url\":\"https:\\\/\\\/www.pistolfly.com\\\/weblog\\\/\",\"name\":\"Pistolfly\",\"description\":\"Developer Blog\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.pistolfly.com\\\/weblog\\\/#\\\/schema\\\/person\\\/e779e918730b507907b3a35b77a9a2ab\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.pistolfly.com\\\/weblog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.pistolfly.com\\\/weblog\\\/#\\\/schema\\\/person\\\/e779e918730b507907b3a35b77a9a2ab\",\"name\":\"Pistolfly\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0b3ddb2859adabf28a2b97ae9fff98772ddffc46088d11cad2b9a2cef66115e7?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0b3ddb2859adabf28a2b97ae9fff98772ddffc46088d11cad2b9a2cef66115e7?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0b3ddb2859adabf28a2b97ae9fff98772ddffc46088d11cad2b9a2cef66115e7?s=96&d=mm&r=g\",\"caption\":\"Pistolfly\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0b3ddb2859adabf28a2b97ae9fff98772ddffc46088d11cad2b9a2cef66115e7?s=96&d=mm&r=g\"},\"description\":\"Software Engineer in Tokyo, Japan\",\"url\":\"https:\\\/\\\/www.pistolfly.com\\\/weblog\\\/author\\\/pistolfly\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Testing SSL certificate with OpenSSL commands - Pistolfly","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.pistolfly.com\/weblog\/en\/2015\/01\/testing-ssl-certificate-with-openssl.html","og_locale":"en_US","og_type":"article","og_title":"Testing SSL certificate with OpenSSL commands - Pistolfly","og_description":"Before installing SSL certificate and Intermediate CA certificate on Web server such as Apache, you may want t &hellip; Continue reading Testing SSL certificate with OpenSSL commands &rarr;","og_url":"https:\/\/www.pistolfly.com\/weblog\/en\/2015\/01\/testing-ssl-certificate-with-openssl.html","og_site_name":"Pistolfly","article_published_time":"2015-01-12T01:46:22+00:00","article_modified_time":"2017-10-17T12:26:38+00:00","author":"Pistolfly","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Pistolfly","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.pistolfly.com\/weblog\/en\/2015\/01\/testing-ssl-certificate-with-openssl.html#article","isPartOf":{"@id":"https:\/\/www.pistolfly.com\/weblog\/en\/2015\/01\/testing-ssl-certificate-with-openssl.html"},"author":{"name":"Pistolfly","@id":"https:\/\/www.pistolfly.com\/weblog\/#\/schema\/person\/e779e918730b507907b3a35b77a9a2ab"},"headline":"Testing SSL certificate with OpenSSL commands","datePublished":"2015-01-12T01:46:22+00:00","dateModified":"2017-10-17T12:26:38+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pistolfly.com\/weblog\/en\/2015\/01\/testing-ssl-certificate-with-openssl.html"},"wordCount":199,"commentCount":0,"publisher":{"@id":"https:\/\/www.pistolfly.com\/weblog\/#\/schema\/person\/e779e918730b507907b3a35b77a9a2ab"},"articleSection":["network","security"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.pistolfly.com\/weblog\/en\/2015\/01\/testing-ssl-certificate-with-openssl.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.pistolfly.com\/weblog\/en\/2015\/01\/testing-ssl-certificate-with-openssl.html","url":"https:\/\/www.pistolfly.com\/weblog\/en\/2015\/01\/testing-ssl-certificate-with-openssl.html","name":"Testing SSL certificate with OpenSSL commands - Pistolfly","isPartOf":{"@id":"https:\/\/www.pistolfly.com\/weblog\/#website"},"datePublished":"2015-01-12T01:46:22+00:00","dateModified":"2017-10-17T12:26:38+00:00","breadcrumb":{"@id":"https:\/\/www.pistolfly.com\/weblog\/en\/2015\/01\/testing-ssl-certificate-with-openssl.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pistolfly.com\/weblog\/en\/2015\/01\/testing-ssl-certificate-with-openssl.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.pistolfly.com\/weblog\/en\/2015\/01\/testing-ssl-certificate-with-openssl.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u30db\u30fc\u30e0","item":"https:\/\/www.pistolfly.com\/weblog"},{"@type":"ListItem","position":2,"name":"Testing SSL certificate with OpenSSL commands"}]},{"@type":"WebSite","@id":"https:\/\/www.pistolfly.com\/weblog\/#website","url":"https:\/\/www.pistolfly.com\/weblog\/","name":"Pistolfly","description":"Developer Blog","publisher":{"@id":"https:\/\/www.pistolfly.com\/weblog\/#\/schema\/person\/e779e918730b507907b3a35b77a9a2ab"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pistolfly.com\/weblog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.pistolfly.com\/weblog\/#\/schema\/person\/e779e918730b507907b3a35b77a9a2ab","name":"Pistolfly","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/0b3ddb2859adabf28a2b97ae9fff98772ddffc46088d11cad2b9a2cef66115e7?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/0b3ddb2859adabf28a2b97ae9fff98772ddffc46088d11cad2b9a2cef66115e7?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0b3ddb2859adabf28a2b97ae9fff98772ddffc46088d11cad2b9a2cef66115e7?s=96&d=mm&r=g","caption":"Pistolfly"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/0b3ddb2859adabf28a2b97ae9fff98772ddffc46088d11cad2b9a2cef66115e7?s=96&d=mm&r=g"},"description":"Software Engineer in Tokyo, Japan","url":"https:\/\/www.pistolfly.com\/weblog\/author\/pistolfly"}]}},"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/paorzz-QT","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.pistolfly.com\/weblog\/wp-json\/wp\/v2\/posts\/3279","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pistolfly.com\/weblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pistolfly.com\/weblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pistolfly.com\/weblog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pistolfly.com\/weblog\/wp-json\/wp\/v2\/comments?post=3279"}],"version-history":[{"count":7,"href":"https:\/\/www.pistolfly.com\/weblog\/wp-json\/wp\/v2\/posts\/3279\/revisions"}],"predecessor-version":[{"id":4126,"href":"https:\/\/www.pistolfly.com\/weblog\/wp-json\/wp\/v2\/posts\/3279\/revisions\/4126"}],"wp:attachment":[{"href":"https:\/\/www.pistolfly.com\/weblog\/wp-json\/wp\/v2\/media?parent=3279"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pistolfly.com\/weblog\/wp-json\/wp\/v2\/categories?post=3279"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pistolfly.com\/weblog\/wp-json\/wp\/v2\/tags?post=3279"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}