<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Tls on shocksolution.com</title><link>https://shocksolution.com/tags/tls/</link><description>Recent content in Tls on shocksolution.com</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Tue, 30 Nov 2021 03:20:26 +0000</lastBuildDate><atom:link href="https://shocksolution.com/tags/tls/index.xml" rel="self" type="application/rss+xml"/><item><title>Using SSL Certificates with the Apache Tomcat Web Server</title><link>https://shocksolution.com/posts/using-ssl-certificates-with-the-apache-tomcat-web-server/</link><pubDate>Tue, 30 Nov 2021 03:20:26 +0000</pubDate><guid>https://shocksolution.com/posts/using-ssl-certificates-with-the-apache-tomcat-web-server/</guid><description>&lt;h2 id="creating-pkcs12-files"&gt;Creating PKCS12 Files&lt;/h2&gt;&#10;&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/PKCS_12"&gt;PKCS #12&lt;/a&gt; is a format for storing multiple cryptography objects in a single archive file. You can store arbitrarily complex objects within a PKCS #12 archive, but the most common use is to store a single private key and its certificate chain. Create a PKCS12 file from PEM files:&lt;/p&gt;&#10;&lt;div class="code-block"&gt;&#10; &lt;button class="code-copy" type="button" hidden aria-label="Copy code to clipboard"&gt;&#10; &lt;span class="code-copy-label" aria-hidden="true"&gt;Copy&lt;/span&gt;&#10; &lt;/button&gt;&#10; &lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;openssl pkcs12 -export -in ssl_cert.pem -inkey key.pem -certfile bundle.crt -name &amp;#34;*.example.com&amp;#34; -out example.com.p12&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#10; &lt;/div&gt;&lt;p&gt;Depending on the product you&amp;rsquo;re working with, the documentation may call for a .pfx file instead of a .p12 file. PFX is an older format that was a predecessor to PKCS #12. In most modern systems, A PFX FILE AND A P12 FILE ARE EXACTLY THE SAME THING! You can just change the extension if needed and that will generally work. For example, the &lt;a href="https://shocksolution.com/2020/11/11/use-an-ssl-tls-certificate-with-eset-security-management-center-appliance/" title="Use%20an%20SSL/TLS%20Certificate%20with%20ESET%20Security%20Management%20Center%20Appliance"&gt;docs for ESET Security Management Center call for a pfx file, but a PKCS12 file will work just fine&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>How to use SSL/TLS certificates on a Netgear M4200/4300 switch</title><link>https://shocksolution.com/posts/ssl-tls-certificates-netgear-m4200-4300-switch/</link><pubDate>Fri, 03 Apr 2020 03:50:18 +0000</pubDate><guid>https://shocksolution.com/posts/ssl-tls-certificates-netgear-m4200-4300-switch/</guid><description>&lt;p&gt;If you operate a Netgear switch in an environment that is subject to compliance requirements such as PCI or HIPAA, you are probably doing vulnerability scans, and the HTTP management interface of your switches will generate medium vulnerabilities (at least from Nessus):&lt;/p&gt;&#10;&lt;p&gt;&lt;em&gt;SSL Self-Signed Certificate&lt;/em&gt;SSL Certificate Cannot Be Trusted* SSL Certificate Expiry&lt;/p&gt;&#10;&lt;p&gt;It &lt;strong&gt;IS&lt;/strong&gt; possible to use signed certificates to secure the HTTPS interface on a Netgear switch, but the process to do so is insanely obscure. I do not know how someone had time to figure this out! Apparently, even Netgear tech support didn&amp;rsquo;t have any idea.&lt;/p&gt;</description></item><item><title>curl or libcurl: SSL certificate problem: unable to get local issuer certificate</title><link>https://shocksolution.com/posts/curl-or-libcurl-ssl-unable-to-get-local-issuer-certificate/</link><pubDate>Tue, 10 Mar 2020 17:00:17 +0000</pubDate><guid>https://shocksolution.com/posts/curl-or-libcurl-ssl-unable-to-get-local-issuer-certificate/</guid><description>&lt;p&gt;curl, or an application that uses libcurl, may have a problem with an SSL certificate that works fine when using a web browser to access the same URL. Typical error output from curl looks like this:&lt;/p&gt;&#10;&lt;div class="code-block"&gt;&#10; &lt;button class="code-copy" type="button" hidden aria-label="Copy code to clipboard"&gt;&#10; &lt;span class="code-copy-label" aria-hidden="true"&gt;Copy&lt;/span&gt;&#10; &lt;/button&gt;&#10; &lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$ curl -v https://my-subdomain.mysecuresite.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; Trying xxx.xxx.xxx.xxx:443…&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; TCP_NODELAY set&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; Connected to my-subdomain.mysecuresite.com (xxx.xxx.xxx.xxx) port 443 (#0)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; ALPN, offering h2&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; ALPN, offering http/1.1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; successfully set certificate verify locations:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; CAfile: /etc/ssl/certs/ca-certificates.crt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; CApath: none&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; TLSv1.3 (OUT), TLS handshake, Client hello (1):&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; TLSv1.3 (IN), TLS handshake, Server hello (2):&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; TLSv1.2 (IN), TLS handshake, Certificate (11):&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; TLSv1.2 (OUT), TLS alert, unknown CA (560):&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; SSL certificate problem: unable to get local issuer certificate&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; Closing connection 0&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; curl: (60) SSL certificate problem: unable to get local issuer certificate&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; More details here: https://curl.haxx.se/docs/sslcerts.html &#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; curl failed to verify the legitimacy of the server and therefore could not&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; establish a secure connection to it. To learn more about this situation and&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; how to fix it, please visit the web page mentioned above.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#10; &lt;/div&gt;&lt;h2 id="troubleshooting-strategy"&gt;Troubleshooting Strategy&lt;/h2&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;A good starting point for any SSL error on a public-facing URL is to &lt;a href="https://%3Cwww.ssllabs.com/ssltest/%3E"&gt;analyze the URL at SSL Labs&lt;/a&gt;.&lt;/li&gt;&#10;&lt;li&gt;Does the error happen for all certificates issued by a specific Certificate Authority (CA)? If so, the system running curl may need to have a root certificate for that CA added or updated in its certificate repository. That&amp;rsquo;s a relatively rare problem, but might occur if the system running curl is very old. There&amp;rsquo;s a &lt;a href="https://stackoverflow.com/questions/24611640/curl-60-ssl-certificate-unable-to-get-local-issuer-certificate"&gt;comprehensive thread about this issue on Stack Overflow&lt;/a&gt;.&lt;/li&gt;&#10;&lt;li&gt;If the error only happens for one specific site, it&amp;rsquo;s likely that the site is missing an intermediate certificate. The command to diagnose this issue is also found in that Stack Overflow thread:&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;div class="code-block"&gt;&#10; &lt;button class="code-copy" type="button" hidden aria-label="Copy code to clipboard"&gt;&#10; &lt;span class="code-copy-label" aria-hidden="true"&gt;Copy&lt;/span&gt;&#10; &lt;/button&gt;&#10; &lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;openssl s_client -connect myhost.com:443 -servername myhost.com -showcerts&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#10; &lt;/div&gt;&lt;p&gt;The output should show a series of certificates, starting with the site certificate, and ending with the root certificate for the Certification Authority. If this chain only shows the site certificate, that&amp;rsquo;s the problem.&lt;/p&gt;</description></item><item><title>openssl unable to read/load/import SSL private key from GoDaddy</title><link>https://shocksolution.com/posts/openssl-unable-to-read-load-import-ssl-private-key-from-godaddy/</link><pubDate>Mon, 02 Dec 2019 13:24:00 +0000</pubDate><guid>https://shocksolution.com/posts/openssl-unable-to-read-load-import-ssl-private-key-from-godaddy/</guid><description>&lt;p&gt;&lt;a href="https://%3C%3Cwww.openssl.org/&amp;amp;gt%3E;"&gt;openssl&lt;/a&gt; is the standard open-source, command-line tool for manipulating SSL/TLS certificates on Linux, MacOS, and other UNIX-like systems. I recently ran into an interesting problem using openssl to convert a private key obtained from GoDaddy. Someone else used GoDaddy&amp;rsquo;s &amp;ldquo;wizard&amp;rdquo; interface to generate a certificate signing request (CSR) and private key, and saved the files on their Windows workstation. They purchased an SSL cert from GoDaddy, and shared all the files with me for installation on servers. GoDaddy saved the private key in the newer &lt;a href="https://en.wikipedia.org/wiki/PKCS_8"&gt;PKCS #8 format (pkcs8)&lt;/a&gt;, and one system required the key in the older &lt;a href="https://en.wikipedia.org/wiki/PKCS_1"&gt;PKCS #1 (pkcs1) format&lt;/a&gt;. It&amp;rsquo;s easy to tell the difference.&lt;/p&gt;</description></item><item><title>Creating Kubernetes Secrets Using TLS/SSL as an Example</title><link>https://shocksolution.com/posts/creating-kubernetes-secrets-using-tls-ssl-as-an-example/</link><pubDate>Fri, 14 Dec 2018 16:15:11 +0000</pubDate><guid>https://shocksolution.com/posts/creating-kubernetes-secrets-using-tls-ssl-as-an-example/</guid><description>&lt;p&gt;Creating Kubernetes secrets isn&amp;rsquo;t intuitive the first time you do it. A common reason to use a secret is to add a SSL/TLS certificate to a cluster. Kubernetes provides two ways to add a secret: directly on the command line, and from a YAML source file. First, let&amp;rsquo;s generate a test certificate to work with and select our cluster.&lt;/p&gt;&#10;&lt;h2 id="prerequisites"&gt;Prerequisites&lt;/h2&gt;&#10;&lt;div class="code-block"&gt;&#10; &lt;button class="code-copy" type="button" hidden aria-label="Copy code to clipboard"&gt;&#10; &lt;span class="code-copy-label" aria-hidden="true"&gt;Copy&lt;/span&gt;&#10; &lt;/button&gt;&#10; &lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout tls.key -out tls.crt -subj &amp;#34;/CN=foo.bar.com&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#10; &lt;/div&gt;&lt;p&gt;This command produces two files: tls.key and tls.cert. In production, you&amp;rsquo;d generate a key file and use it to obtain a certificate from a certificate authority.&lt;/p&gt;</description></item></channel></rss>