Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

Bash

get certificate validity end date

file="/path/to/cert"
openssl x509 -enddate -noout -in "$file"
https://snipt.net/embed/6b8f7fa0414e49696df5002e3239f3cb/
https://snipt.net/raw/6b8f7fa0414e49696df5002e3239f3cb/
6b8f7fa0414e49696df5002e3239f3cb
bash
Bash
2
2016-12-07T15:50:40
True
False
False
/api/public/snipt/141376/
get-certificate-validity-end-date
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nv">file</span><span class="o">=</span><span class="s2">&quot;/path/to/cert&quot;</span> </span><span id="L-2"><a name="L-2"></a>openssl x509 -enddate -noout -in <span class="s2">&quot;</span><span class="nv">$file</span><span class="s2">&quot;</span> </span></pre></div> </td></tr></table>
cert, expiration, linux, openssl, x509

Bash

get remote server cert in PEM format

1
2
3
4
server="www.example.com"
port=443
outFile="/some/file"
openssl s_client -showcerts -connect "$server:$port" < /dev/null | openssl x509 -outform PEM > "$outFile"
https://snipt.net/embed/eeaaedbea37b185b18e01b400ff00db6/
https://snipt.net/raw/eeaaedbea37b185b18e01b400ff00db6/
eeaaedbea37b185b18e01b400ff00db6
bash
Bash
4
2016-12-09T14:04:57
True
False
True
Sep 30, 2015 at 07:12 AM
/api/public/snipt/141318/
get-remote-server-cert-in-pem-format
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nv">server</span><span class="o">=</span><span class="s2">&quot;www.example.com&quot;</span> </span><span id="L-2"><a name="L-2"></a><span class="nv">port</span><span class="o">=</span>443 </span><span id="L-3"><a name="L-3"></a><span class="nv">outFile</span><span class="o">=</span><span class="s2">&quot;/some/file&quot;</span> </span><span id="L-4"><a name="L-4"></a>openssl s_client -showcerts -connect <span class="s2">&quot;</span><span class="nv">$server</span><span class="s2">:</span><span class="nv">$port</span><span class="s2">&quot;</span> &lt; /dev/null <span class="p">|</span> openssl x509 -outform PEM &gt; <span class="s2">&quot;</span><span class="nv">$outFile</span><span class="s2">&quot;</span> </span></pre></div> </td></tr></table>
bash, linux, openssl

Bash

yum update openssl

yum update openssl
https://snipt.net/embed/184e7629edee45a0ada38ed05fe5b8db/
https://snipt.net/raw/184e7629edee45a0ada38ed05fe5b8db/
184e7629edee45a0ada38ed05fe5b8db
bash
Bash
1
2016-12-08T17:49:20
True
False
False
/api/public/snipt/36536/
yum-update-openssl
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>yum update openssl </span></pre></div> </td></tr></table>
openssl, update, yum

Bash

How to check an SSL connection and server certificate.

$ openssl s_client -host www.google.com -port 443
https://snipt.net/embed/8ca067dd09635938a11b14aac258b867/
https://snipt.net/raw/8ca067dd09635938a11b14aac258b867/
8ca067dd09635938a11b14aac258b867
bash
Bash
1
2016-12-06T08:38:09
True
False
False
/api/public/snipt/29640/
how-to-check-an-ssl-connection-and-server-certificate
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>$ openssl s_client -host www.google.com -port 443 </span></pre></div> </td></tr></table>
certificate, openssl, ssl

Bash

create pkcs12 cert envelope with openssl

1
2
3
4
# mycert.crt - certificate file
# mykey.key - private key file

openssl pkcs12 -export -in mycert.crt -inkey mykey.key -out env.p12 -password stdin
https://snipt.net/embed/6b39879011e9b829a6c3d6644cd6d6ae/
https://snipt.net/raw/6b39879011e9b829a6c3d6644cd6d6ae/
6b39879011e9b829a6c3d6644cd6d6ae
bash
Bash
4
2016-12-05T10:22:43
True
False
False
/api/public/snipt/11486/
create-pkcs12-cert-envelope-with-openssl
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1"># mycert.crt - certificate file</span> </span><span id="L-2"><a name="L-2"></a><span class="c1"># mykey.key - private key file</span> </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a>openssl pkcs12 -export -in mycert.crt -inkey mykey.key -out env.p12 -password stdin </span></pre></div> </td></tr></table>
"public key", bash, certificate, openssl, p12, pkcs12, pki

Bash

Création d'un certificat SSL autosigné

1
2
3
openssl genrsa -out server.key 1024
openssl req -new -x509 -days 365 -key server.key -out server.crt
openssl x509 -in server.crt -text -noout
https://snipt.net/embed/df70fc641c68772f9d6ec125e8c485d7/
https://snipt.net/raw/df70fc641c68772f9d6ec125e8c485d7/
df70fc641c68772f9d6ec125e8c485d7
bash
Bash
3
2016-12-09T12:28:31
True
False
False
/api/public/snipt/4296/
creation-dun-certificat-ssl-autosigne
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>openssl genrsa -out server.key 1024 </span><span id="L-2"><a name="L-2"></a>openssl req -new -x509 -days <span class="m">365</span> -key server.key -out server.crt </span><span id="L-3"><a name="L-3"></a>openssl x509 -in server.crt -text -noout </span></pre></div> </td></tr></table>
cert, certificat, https, openssl, ssl
Copyrighted, illegal, or inappropriate content? Email [email protected].