<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>logIt &#187; security</title>
	<atom:link href="https://lakm.us/logit/tag/security/feed/" rel="self" type="application/rss+xml" />
	<link>https://lakm.us/logit</link>
	<description>Log Around The Clock</description>
	<lastBuildDate>Sat, 06 Jun 2015 14:17:37 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Mobile WiFi NAS on Raspberry Pi with TrueCrypt</title>
		<link>https://lakm.us/logit/2014/06/mobile-wifi-nas-raspberry-pi-truecrypt/</link>
		<comments>https://lakm.us/logit/2014/06/mobile-wifi-nas-raspberry-pi-truecrypt/#comments</comments>
		<pubDate>Sun, 01 Jun 2014 04:23:18 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[ARM Linux]]></category>
		<category><![CDATA[General Linux]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[ARMv6]]></category>
		<category><![CDATA[file system]]></category>
		<category><![CDATA[fuse]]></category>
		<category><![CDATA[Raspberry Pi]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://lakm.us/logit/?p=778</guid>
		<description><![CDATA[Mobile NAS sounds like an idea worth waiting for to run on my mini Raspberry Pi Model A. Unfortunately, it only took me a while, before abandoning it. I&#8217;ve waited since writing about Raspberry Pi USB problem, that is to finally cut the backfeeding power line from the el cheapo powered USB hub. There comes [...]]]></description>
				<content:encoded><![CDATA[<p>Mobile <a href="http://en.wikipedia.org/wiki/Network-attached_storage" target="_blank">NAS</a> sounds like an idea worth waiting for to run on my mini <a href="http://www.raspberrypi.org/tag/model-a/" target="_blank">Raspberry Pi Model A</a>. Unfortunately, it only took me a while, before abandoning it. I&#8217;ve waited since <a href="../../../2013/03/raspberry-pi-common-usb-problems/" title="Raspberry Pi Common USB Problems" target="_blank">writing about Raspberry Pi USB problem</a>, that is to <a href="https://flic.kr/p/kqopvk" title="Cutting backfeed from el cheapo USB hub to make friend with dual rating power bank &#038; Raspberry Pi" target="_blank">finally cut the backfeeding power line from the <em>el cheapo</em> powered USB hub</a>. There comes new problem afterward, my &#8220;big storage&#8221; ―a <a href="http://www.seagate.com/external-hard-drives/portable-hard-drives/standard/backup-plus/" title="Backup Plus Slim Portable Drive" target="_blank">Seagate® Backup Plus Slim Portable Drive</a>, shipped with no bulky power supply line― can&#8217;t be mounted. Silence soon follows rotating motor sound a while after plugging-in. I&#8217;ve tried both <a href="http://en.wikipedia.org/wiki/Ext3" target="_blank">ext3</a> and <a href="http://en.wikipedia.org/wiki/NTFS-3G" target="_blank">NTFS (using ntfs-3g)</a> without luck. Later, as benchmark whether it is USB power in question, I try to connect the same set of <em>el cheapo</em> USB hub plus external power to laptop, and it works, leaving me stranded with other issue (is it USB 3.0? 256MB of the Model A? Anything?). I must say that it isn&#8217;t completely not-working as the USB hub set can mount with <a href="http://www.ebay.co.uk/itm/Ritmo-R-Driver-III-USB-2-0-to-sata-Ide-cable-/221221820375" title="R-Driver III USB 2.0 to sata / Ide cable" target="_blank">USB to IDE converter</a> and my old internal hard disk (noting that there shouldn&#8217;t be similar power issue this way). If only it weren&#8217;t for the AC power adapter and large size, this is Mobile NAS; beats me.</p>
<div class="wp-caption aligncenter" style="width: 460px"><img alt="Mobile NAS [Raspberry Pi hack] by aqila_rifti, on Flickr" src="https://farm6.staticflickr.com/5193/14317107955_73226c6432_n.jpg" title="Mobile NAS [Raspberry Pi hack] by aqila_rifti, on Flickr" width="320" height="320" /><p class="wp-caption-text">Battery power bank, WiFi USB stick, and thumb drive</p></div>
<p>I then turn away to motor-less small storage, a <a href="http://www.sandisk.com/products/usb/drives/cruzer-switch/" title="Sandisk Cruzer CZ52 " target="_blank">32 Gigs USB thumb drive</a> so I can move on to other concern: on-the-fly encryption. Hence, I follow <a href="http://kenfallon.com/truecrypt-on-a-respberry-pi-no-gui/" target="_blank">instructions to install True Crypt on Raspberry Pi</a>. After unpacking of <code>wxWidgets-2.8.12.tar.gz</code> and <code>TrueCrypt 7.1a Source.tar.gz</code> in place, putting header files from <code>pkcs-11-cryptoki2.20</code>, and then install <code>libfuse-dev</code>, the following <code>make</code> will require long time:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PKCS11_INC</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>truecrypt<span style="color: #000000; font-weight: bold;">/</span>pkcs<span style="color: #000000; font-weight: bold;">/</span>
&nbsp;
$ <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #007800;">NOGUI</span>=<span style="color: #000000;">1</span> <span style="color: #007800;">WX_ROOT</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>wxWidgets wxbuild
Configuring wxWidgets library...
Building wxWidgets library...
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>wxWidgets<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>common<span style="color: #000000; font-weight: bold;">/</span>string.cpp:<span style="color: #000000;">84</span>:<span style="color: #000000;">39</span>: warning: ‘wxEmptyString’ initialized and declared ‘extern’ <span style="color: #7a0874; font-weight: bold;">&#91;</span>enabled by default<span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></div></div>

<p><span id="more-778"></span></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #007800;">NOGUI</span>=<span style="color: #000000;">1</span> <span style="color: #007800;">WX_ROOT</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>wxWidgets wxbuild
Compiling Buffer.cpp
Compiling Exception.cpp
Compiling Event.cpp
...
..<span style="color: #000000; font-weight: bold;">/</span>Crypto<span style="color: #000000; font-weight: bold;">/</span>Aeskey.c:<span style="color: #000000;">527</span>:<span style="color: #000000;">25</span>: warning: operation on ‘ss<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">7</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>’ may be undefined <span style="color: #7a0874; font-weight: bold;">&#91;</span>-Wsequence-point<span style="color: #7a0874; font-weight: bold;">&#93;</span>
..<span style="color: #000000; font-weight: bold;">/</span>Crypto<span style="color: #000000; font-weight: bold;">/</span>Aeskey.c:<span style="color: #000000;">527</span>:<span style="color: #000000;">25</span>: warning: operation on ‘ss<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">7</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>’ may be undefined <span style="color: #7a0874; font-weight: bold;">&#91;</span>-Wsequence-point<span style="color: #7a0874; font-weight: bold;">&#93;</span>
..<span style="color: #000000; font-weight: bold;">/</span>Crypto<span style="color: #000000; font-weight: bold;">/</span>Aeskey.c:<span style="color: #000000;">527</span>:<span style="color: #000000;">25</span>: warning: operation on ‘ss<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">7</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>’ may be undefined <span style="color: #7a0874; font-weight: bold;">&#91;</span>-Wsequence-point<span style="color: #7a0874; font-weight: bold;">&#93;</span>
...
Converting Language.xml
Compiling Resources.cpp
Linking truecrypt</pre></div></div>

<p>I created the TrueCrypt volume separately via its desktop GUI with <code>ext3</code> file system to then mount it in Pi to a configured <a href="http://en.wikipedia.org/wiki/Samba_(software)" target="_blank">Samba share</a>. As pointed out in <a href="http://raspberrywebserver.com/serveradmin/share-your-raspberry-pis-files-and-folders-across-a-network.html" target="_blank">a post</a>, the following changes are added to <code>smb.conf</code></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">...
wins support = <span style="color: #c20cb9; font-weight: bold;">yes</span>
...
<span style="color: #7a0874; font-weight: bold;">&#91;</span>pitruecrypt<span style="color: #7a0874; font-weight: bold;">&#93;</span>
   <span style="color: #007800;">comment</span>= Pi Truecrypt Volume
   <span style="color: #007800;">path</span>=<span style="color: #000000; font-weight: bold;">&lt;</span>the <span style="color: #c20cb9; font-weight: bold;">mount</span> path of the USB thumb drive TrueCrypt volume<span style="color: #000000; font-weight: bold;">&gt;</span>
   <span style="color: #007800;">browseable</span>=Yes
   <span style="color: #007800;">writeable</span>=Yes
   only <span style="color: #007800;">guest</span>=no
   create <span style="color: #007800;">mask</span>=0777
   directory <span style="color: #007800;">mask</span>=0777
   <span style="color: #007800;">public</span>=no</pre></div></div>

<p>and then user-password are entered via interactive command.</p>
<p>For mobility, I already had the Pi as WiFi access point using <code><a href="hostap.epitest.fi/hostapd/" target="_blank">hostapd</a></code> (check <a href="http://sirlagz.net/2012/08/09/how-to-use-the-raspberry-pi-as-a-wireless-access-pointrouter-part-1/" target="_blank">these steps</a>) and <a href="http://www.amazon.com/HAME-10400mAh-Double-Indicators-Capacity/dp/B00B5OFC5I" target="_blank">power bank</a>, so it&#8217;s now matter of performance. In the case of <code><a href="http://www.samba.org/rsync/" target="_blank">rsync</a></code>, initial sync of some 1,500 items totaling in 1 Gig size elapses in approximately the same 12 minutes of time compared to one bulk file of the same size. Of course, over the next incremental sync, it only takes less than a minute for the thousand items to just update slight differences.</p>
<h3>Security</h3>
<p>Back to security, there surely risk by opening Samba share to mounted TrueCrypt volume. But, for me it would be practically manageable (cross my finger). There is more concern to the fate of <a href="http://truecrypt.sourceforge.net/" target="_blank">TrueCrypt</a> after it is being closed in such a weird way, given that <a href="https://opencryptoaudit.org/reports/iSec_Final_Open_Crypto_Audit_Project_TrueCrypt_Security_Assessment.pdf" target="_blank">last audit</a> finds nothing severe. Anyway, I found brute force tool, but no critical attack exists currently, unless e.g. it stays powered on and mounted, the person gain physical access. Beats me again.</p>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2014/06/mobile-wifi-nas-raspberry-pi-truecrypt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTTPS Using Server-Client Certificate Pair (1): Generate &amp; Sign by OpenSSL</title>
		<link>https://lakm.us/logit/2013/01/https-server-client-certificate-pair-1-generate-openssl/</link>
		<comments>https://lakm.us/logit/2013/01/https-server-client-certificate-pair-1-generate-openssl/#comments</comments>
		<pubDate>Wed, 23 Jan 2013 04:41:30 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[General Linux]]></category>
		<category><![CDATA[certificate]]></category>
		<category><![CDATA[https]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[SSL]]></category>

		<guid isPermaLink="false">http://lakm.us/logit/?p=451</guid>
		<description><![CDATA[Multiple command lines in the process of generating certificates using openssl can be quite confusing and easily mixed up over which-do-what. Most of them are repetitions of almost the same syntax (where the confusion comes). Background: I need to setup an HTTPS site with not just server certificate to secure it, but requiring also client [...]]]></description>
				<content:encoded><![CDATA[<p>Multiple command lines in the process of generating certificates using <code><a title="OpenSSL" href="http://www.openssl.org/" target="_blank">openssl</a></code> can be quite confusing and easily mixed up over which-do-what. Most of them are repetitions of almost the same syntax (where the confusion comes).</p>
<p>Background:<br />
I need to setup an <a title="HTTP Secure" href="http://en.wikipedia.org/wiki/HTTP_Secure" target="_blank">HTTPS</a> site with not just server certificate to secure it, but requiring also client side certificate. The site will only show the content to authorized users with the correct pair of server-client certificate. It will also expire after a certain date. The certificates are self-signed as they&#8217;re for closed environment usage.</p>
<p>This post covers two general processes: <em><strong>generating</strong></em> and <em><strong>signing</strong></em>.</p>
<p>How to <em><strong>generate</strong></em> SSL certificate using <code>openssl</code> is a straightforward process of:</p>
<ol>
<li>generate its key</li>
<li>create certificate request with that key</li>
<li>generate certificate from request and key</li>
</ol>
<p>Hence, in any type of the certificate I have a general <code>&lt;some-cert-key&gt;.key</code>, <code>&lt;some-cert-request&gt;.csr</code>, and <code>&lt;some-cert&gt;.crt</code>. When I mean &#8220;type&#8221;, they are <a href="http://en.wikipedia.org/wiki/Certificate_authority" title="Certificate Authority" target="_blank">CA (Certificate Authority)</a>, one/more server certificate, and one/more client certificate.</p>
<div class="wp-caption aligncenter" style="width: 460px"><img title="Generating Pair of Key-Certificate with openSSL" src="../../../../images/ssl-certificate-ca-server-client-illustration-1.png" alt="ssl-certificate-ca-server-client-illustration-1.png" width="286" height="226" /><p class="wp-caption-text">Generating Pairs of Key-Certificate with openSSL: CA, server, &amp; client</p></div>
<p>In terms of <strong>signing</strong> the certificates, all of them are signed using the CA. Which files to be used in the server will become the subject of the next post.</p>
<p><span id="more-451"></span><code>openssl</code> will run interactively. To go through all the recurring questions using prepared default answers, we need to create a config file first. I created <code>caconfig.cnf</code> (find it on the bottom of the post) and use <code>-config caconfig.cnf</code> option in some commands.</p>
<p>First, prepare set of directories to clearly separate what we&#8217;re working on (keys, requests, and resulting certificates in different places for server and user):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> certs
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> private
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> server
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> server<span style="color: #000000; font-weight: bold;">/</span>certs
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> server<span style="color: #000000; font-weight: bold;">/</span>creqs
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> server<span style="color: #000000; font-weight: bold;">/</span>ckeys
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> user
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> user<span style="color: #000000; font-weight: bold;">/</span>certs
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> user<span style="color: #000000; font-weight: bold;">/</span>creqs
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> user<span style="color: #000000; font-weight: bold;">/</span>ckeys</pre></div></div>

<p>Prepare &#8220;database&#8221; and index number to keep track of certificates issued:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">echo</span> 01 <span style="color: #000000; font-weight: bold;">&gt;</span> serial
<span style="color: #c20cb9; font-weight: bold;">touch</span> index.txt</pre></div></div>

<p>Generate the CA: (again) generate key, create request (the interactive part), and create certificate:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">openssl genrsa <span style="color: #660033;">-out</span> private<span style="color: #000000; font-weight: bold;">/</span>myCA.key <span style="color: #000000;">2048</span>
openssl req <span style="color: #660033;">-new</span> <span style="color: #660033;">-key</span> private<span style="color: #000000; font-weight: bold;">/</span>myCA.key <span style="color: #660033;">-out</span> certs<span style="color: #000000; font-weight: bold;">/</span>myCA.csr <span style="color: #660033;">-config</span> caconfig.cnf 
openssl req <span style="color: #660033;">-x509</span> <span style="color: #660033;">-days</span> <span style="color: #000000;">365</span> <span style="color: #660033;">-in</span> certs<span style="color: #000000; font-weight: bold;">/</span>myCA.csr <span style="color: #660033;">-out</span> certs<span style="color: #000000; font-weight: bold;">/</span>myCA.crt <span style="color: #660033;">-key</span> private<span style="color: #000000; font-weight: bold;">/</span>myCA.key</pre></div></div>

<p>We can always check:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">openssl x509 <span style="color: #660033;">-in</span> certs<span style="color: #000000; font-weight: bold;">/</span>myCA.crt <span style="color: #660033;">-text</span></pre></div></div>

<p>Now, <em><strong>generating</strong></em> for the <strong>server</strong>, I use the name <code>lakmus</code> as an example. First the key:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">openssl genrsa <span style="color: #660033;">-des3</span> <span style="color: #660033;">-out</span> server<span style="color: #000000; font-weight: bold;">/</span>ckeys<span style="color: #000000; font-weight: bold;">/</span>lakmus.key <span style="color: #000000;">2048</span></pre></div></div>

<p>(<a href="http://en.wikipedia.org/wiki/Triple_DES" title="Triple DES" target="_blank">Triple-DES</a> cipher will ask for pass phrase of 4 characters minimum)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Enter pass phrase <span style="color: #000000; font-weight: bold;">for</span> server<span style="color: #000000; font-weight: bold;">/</span>ckeys<span style="color: #000000; font-weight: bold;">/</span>lakmus.key:
Verifying - Enter pass phrase <span style="color: #000000; font-weight: bold;">for</span> server<span style="color: #000000; font-weight: bold;">/</span>ckeys<span style="color: #000000; font-weight: bold;">/</span>lakmus.key:</pre></div></div>

<p>Then, the request (which will ask for the above key pass phrase):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">openssl req <span style="color: #660033;">-new</span> <span style="color: #660033;">-key</span> server<span style="color: #000000; font-weight: bold;">/</span>ckeys<span style="color: #000000; font-weight: bold;">/</span>lakmus.key <span style="color: #660033;">-out</span> server<span style="color: #000000; font-weight: bold;">/</span>creqs<span style="color: #000000; font-weight: bold;">/</span>lakmus.csr <span style="color: #660033;">-config</span> caconfig.cnf</pre></div></div>

<p>Note that <code>organizationName</code> field needs to be the same with the CA certificate.</p>
<p>Then, <em><strong>signing</strong></em> it with the CA (and again check as text):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">openssl ca <span style="color: #660033;">-days</span> <span style="color: #000000;">365</span> <span style="color: #660033;">-in</span> server<span style="color: #000000; font-weight: bold;">/</span>creqs<span style="color: #000000; font-weight: bold;">/</span>lakmus.csr <span style="color: #660033;">-cert</span> certs<span style="color: #000000; font-weight: bold;">/</span>myCA.crt <span style="color: #660033;">-out</span> server<span style="color: #000000; font-weight: bold;">/</span>certs<span style="color: #000000; font-weight: bold;">/</span>lakmus.crt <span style="color: #660033;">-keyfile</span> private<span style="color: #000000; font-weight: bold;">/</span>myCA.key <span style="color: #660033;">-config</span> caconfig.cnf
&nbsp;
openssl x509 <span style="color: #660033;">-in</span> server<span style="color: #000000; font-weight: bold;">/</span>certs<span style="color: #000000; font-weight: bold;">/</span>lakmus.crt <span style="color: #660033;">-text</span></pre></div></div>

<p>During <em><strong>signing</strong></em> we&#8217;ll see something like (expiry date and validity periode)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Certificate is to be certified <span style="color: #000000; font-weight: bold;">until</span> <span style="color: #000000; font-weight: bold;">&lt;</span>some <span style="color: #c20cb9; font-weight: bold;">date</span><span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">365</span> days<span style="color: #7a0874; font-weight: bold;">&#41;</span>
Sign the certificate? <span style="color: #7a0874; font-weight: bold;">&#91;</span>y<span style="color: #000000; font-weight: bold;">/</span>n<span style="color: #7a0874; font-weight: bold;">&#93;</span>:</pre></div></div>

<p>and <code>index.txt</code> is updated:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">V	140123034822Z		01	unknown	<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">C</span>=ID<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">ST</span>=WEST JAVA<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">O</span>=My Organization<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">CN</span>=lakm.us
V	140123041441Z		02	unknown	<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">C</span>=ID<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">ST</span>=WEST JAVA<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">O</span>=My Organization<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">CN</span>=client</pre></div></div>

<p>Finally, the same <em><strong>generate</strong></em> with own key and <em><strong>sign</strong></em> with CA except this time is for <strong>client</strong>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">openssl genrsa <span style="color: #660033;">-des3</span> <span style="color: #660033;">-out</span> user<span style="color: #000000; font-weight: bold;">/</span>ckeys<span style="color: #000000; font-weight: bold;">/</span>client1.key <span style="color: #000000;">2048</span>
openssl req <span style="color: #660033;">-new</span> <span style="color: #660033;">-key</span> user<span style="color: #000000; font-weight: bold;">/</span>ckeys<span style="color: #000000; font-weight: bold;">/</span>client1.key <span style="color: #660033;">-out</span> user<span style="color: #000000; font-weight: bold;">/</span>creqs<span style="color: #000000; font-weight: bold;">/</span>client1.csr <span style="color: #660033;">-config</span> caconfig.cnf
&nbsp;
openssl ca <span style="color: #660033;">-in</span> user<span style="color: #000000; font-weight: bold;">/</span>creqs<span style="color: #000000; font-weight: bold;">/</span>client1.csr <span style="color: #660033;">-cert</span> certs<span style="color: #000000; font-weight: bold;">/</span>myCA.crt <span style="color: #660033;">-keyfile</span> private<span style="color: #000000; font-weight: bold;">/</span>myCA.key <span style="color: #660033;">-out</span> user<span style="color: #000000; font-weight: bold;">/</span>certs<span style="color: #000000; font-weight: bold;">/</span>client1.crt <span style="color: #660033;">-config</span> caconfig.cnf 
&nbsp;
openssl x509 <span style="color: #660033;">-in</span> user<span style="color: #000000; font-weight: bold;">/</span>certs<span style="color: #000000; font-weight: bold;">/</span>client1.crt <span style="color: #660033;">-text</span></pre></div></div>

<p>For the client certificate to be usable when importing to browser, convert it to <a href="http://en.wikipedia.org/wiki/PKCS_12" title="PKCS 12" target="_blank">PKCS 12</a></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">openssl pkcs12 <span style="color: #660033;">-export</span> <span style="color: #660033;">-clcerts</span> <span style="color: #660033;">-in</span> user<span style="color: #000000; font-weight: bold;">/</span>certs<span style="color: #000000; font-weight: bold;">/</span>client1.crt <span style="color: #660033;">-inkey</span> user<span style="color: #000000; font-weight: bold;">/</span>ckeys<span style="color: #000000; font-weight: bold;">/</span>client1.key <span style="color: #660033;">-out</span> user<span style="color: #000000; font-weight: bold;">/</span>certs<span style="color: #000000; font-weight: bold;">/</span>client1.p12</pre></div></div>

<p>It will ask for pass phrase and export password (that will be prompted when importing to browser)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Enter pass phrase <span style="color: #000000; font-weight: bold;">for</span> user<span style="color: #000000; font-weight: bold;">/</span>ckeys<span style="color: #000000; font-weight: bold;">/</span>client1.key:
Enter Export Password:
Verifying - Enter Export Password:</pre></div></div>

<p><a id="Troubleshooting" href="Troubleshooting" rel="bookmark" title="Troubleshooting"><br />
<h4>Troubleshooting</h4>
<p></a></p>
<p>If the CA generation already worked smoothly, it is better to remove the key, request, and certificate files of subsequent signing process before repeating them when any error is found. Otherwise it will finally show error such as:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">failed to update database
TXT_DB error number <span style="color: #000000;">2</span></pre></div></div>

<p>Or something like</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">No certificate matches private key</pre></div></div>

<p>when exporting to PKCS 12.</p>
<p>We can check the <code>index.txt</code>, <code>index.old</code>, <code>serial</code>, and <code>serial.old</code> to figure our situation by evaluating indexes of signed certificate.</p>
<p><a id="CAConfig" href="#CAConfig" rel="bookmark" title="CAConfig"><br />
<h4>CA Config</h4>
<p></a></p>
<p>I used parts from <a href="http://codeghar.wordpress.com/2008/03/17/create-a-certificate-authority-and-certificates-with-openssl/" title="Create a Certificate Authority and Certificates with OpenSSL" target="_blank">Code Ghar post</a> for my <code>caconfig.cnf</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span> ca <span style="color: #7a0874; font-weight: bold;">&#93;</span>
default_ca = CA_default
<span style="color: #7a0874; font-weight: bold;">&#91;</span> CA_default <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #c20cb9; font-weight: bold;">dir</span> = <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>arif<span style="color: #000000; font-weight: bold;">/</span>ssl
serial = <span style="color: #007800;">$dir</span><span style="color: #000000; font-weight: bold;">/</span>serial
database = <span style="color: #007800;">$dir</span><span style="color: #000000; font-weight: bold;">/</span>index.txt
new_certs_dir = <span style="color: #007800;">$dir</span><span style="color: #000000; font-weight: bold;">/</span>certs
certificate = <span style="color: #007800;">$dir</span><span style="color: #000000; font-weight: bold;">/</span>certs<span style="color: #000000; font-weight: bold;">/</span>myCAcert.crt
private_key = <span style="color: #007800;">$dir</span><span style="color: #000000; font-weight: bold;">/</span>private<span style="color: #000000; font-weight: bold;">/</span>myCA.key
default_days = <span style="color: #000000;">365</span>
default_md = md5
preserve = no
email_in_dn = no
nameopt = default_ca
certopt = default_ca
policy = policy_match
<span style="color: #7a0874; font-weight: bold;">&#91;</span> policy_match <span style="color: #7a0874; font-weight: bold;">&#93;</span>
countryName = match
stateOrProvinceName = match
organizationName = match
organizationalUnitName = optional
commonName = supplied
emailAddress = optional
<span style="color: #7a0874; font-weight: bold;">&#91;</span> req <span style="color: #7a0874; font-weight: bold;">&#93;</span>
default_bits = <span style="color: #000000;">2048</span> <span style="color: #666666; font-style: italic;"># Size of keys</span>
default_keyfile = key.pem <span style="color: #666666; font-style: italic;"># name of generated keys</span>
default_md = md5 <span style="color: #666666; font-style: italic;"># message digest algorithm</span>
string_mask = nombstr <span style="color: #666666; font-style: italic;"># permitted characters</span>
distinguished_name = req_distinguished_name
<span style="color: #7a0874; font-weight: bold;">&#91;</span> req_distinguished_name <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #666666; font-style: italic;"># Variable name Prompt string</span>
<span style="color: #666666; font-style: italic;">#------------------------- ----------------------------------</span>
0.organizationName = Organization Name <span style="color: #7a0874; font-weight: bold;">&#40;</span>company<span style="color: #7a0874; font-weight: bold;">&#41;</span>
organizationalUnitName = Organizational Unit Name <span style="color: #7a0874; font-weight: bold;">&#40;</span>department, division<span style="color: #7a0874; font-weight: bold;">&#41;</span>
emailAddress = Email Address
emailAddress_max = <span style="color: #000000;">40</span>
localityName = Locality Name <span style="color: #7a0874; font-weight: bold;">&#40;</span>city, district<span style="color: #7a0874; font-weight: bold;">&#41;</span>
stateOrProvinceName = State or Province Name <span style="color: #7a0874; font-weight: bold;">&#40;</span>full name<span style="color: #7a0874; font-weight: bold;">&#41;</span>
countryName = Country Name <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">2</span> letter code<span style="color: #7a0874; font-weight: bold;">&#41;</span>
countryName_min = <span style="color: #000000;">2</span>
countryName_max = <span style="color: #000000;">2</span>
commonName = Common Name <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">hostname</span>, IP, or your name<span style="color: #7a0874; font-weight: bold;">&#41;</span>
commonName_max = <span style="color: #000000;">64</span>
<span style="color: #666666; font-style: italic;"># Default values for the above, for consistency and less typing.</span>
<span style="color: #666666; font-style: italic;"># Variable name Value</span>
<span style="color: #666666; font-style: italic;">#------------------------ ------------------------------</span>
0.organizationName_default = My Organization
localityName_default = BOGOR
stateOrProvinceName_default = WEST JAVA
countryName_default = ID
emailAddress_default = fake<span style="color: #000000; font-weight: bold;">@</span>lakm.us
commonName_default = lakm.us</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2013/01/https-server-client-certificate-pair-1-generate-openssl/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Alas my LinkedIn password is in the file! (Howto check compromised password)</title>
		<link>https://lakm.us/logit/2012/06/alas-linkedin-password-file-howto-check-compromised-password/</link>
		<comments>https://lakm.us/logit/2012/06/alas-linkedin-password-file-howto-check-compromised-password/#comments</comments>
		<pubDate>Tue, 12 Jun 2012 08:59:10 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[Web Apps]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[privacy]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[shell script]]></category>
		<category><![CDATA[socialmedia]]></category>

		<guid isPermaLink="false">http://lakm.us/logit/?p=393</guid>
		<description><![CDATA[When LinkedIn privacy breach was about to be revealed during Yuval Ne&#8217;eman workshop in Tel Aviv University, suddenly the timeline trends were that of friends, telling people to change LinkedIn password. Both were separate issues and of course the privacy breach was then subsided from people&#8217;s attention. To tell you the truth, as a secret [...]]]></description>
				<content:encoded><![CDATA[<p>When <a href="http://blog.skycure.com/2012/06/linkedout-linkedin-privacy-issue.html" title="LinkedOut - A LinkedIn Privacy Issue" target="_blank">LinkedIn privacy breach</a> was about to be revealed during Yuval Ne&#8217;eman workshop in Tel Aviv University, suddenly the timeline trends were that of friends, telling people to <a href="http://blog.linkedin.com/2012/06/06/linkedin-member-passwords-compromised/" title="LinkedIn Blog" target="_blank">change LinkedIn password</a>. Both were separate issues and of course the privacy breach was then subsided from people&#8217;s attention. To tell you the truth, as a secret admirer of conspiracy theory (whether I admit it or not), this coincident was just too perfectly timed. But, I&#8217;m also curious whether my password was among the stolen 6,458,020 (yes: 6,4 millions) uploaded by the hacker in hashed <a href="http://en.wikipedia.org/wiki/SHA-1" title="http://en.wikipedia.org/wiki/SHA-1" target="_blank">SHA-1</a> without the user name.</p>
<div class="wp-caption alignnone" style="width: 460px"><a href="http://blog.skycure.com/2012/06/linkedout-linkedin-privacy-issue.html"><img alt="linkedin-uploading-contact-resized-skycure-dot-com.png" src="../../../../images/linkedin-uploading-contact-resized-skycure-dot-com.png" title="Snapshot of uploaded contact data from calendar (skycure.com)" width="420" height="197" /></a><p class="wp-caption-text">Snapshot of uploaded contact data from calendar (skycure.com)</p></div>
<p>There is not other way but to check my password against the <code>combo_not.txt</code> found via <a href="http://www.filestube.com/" title="Filestube.com" target="_blank">Filestube</a>. People already posted howto check this, the easiest way is doing <a href="http://news.ycombinator.com/item?id=4076768" title="Y Hacker News" target="_blank">a single line in the shell</a>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">printf</span> bandito <span style="color: #000000; font-weight: bold;">|</span> openssl sha1 <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-c10-</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-f</span> - combo_not.txt
00000d40df69b72328229d2425714f40d7d9a7a3</pre></div></div>

<p>Bingo! a match there for the password &#8220;bandito&#8221; (I choose this randomly expecting some person out there is using it). Another way (for comparison as I&#8217;m no security expert) is by this short python script (slightly altered from <a href="http://wordpress.phobostechnology.com/?p=149" title="LinkedIn Passwords – Change them" target="_blank">Phobos Technology blog post</a>):</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #483d8b;">&quot;&quot;&quot;
Save this file as linkedin_hash.py and ensure it's
in the same folder as combo_not.txt
Usage: python linkedin_hash.py hunter2
&quot;&quot;&quot;</span>
<span style="color: #ff7700;font-weight:bold;">from</span> hashlib <span style="color: #ff7700;font-weight:bold;">import</span> sha1
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span>
password = <span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>
hsh = sha1<span style="color: black;">&#40;</span>password<span style="color: black;">&#41;</span>.<span style="color: black;">hexdigest</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;SHA-1: %s&quot;</span> <span style="color: #66cc66;">%</span> hsh
x = <span style="color: #ff4500;">0</span>
<span style="color: #ff7700;font-weight:bold;">for</span> line <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'combo_not.txt'</span>,<span style="color: #483d8b;">'r'</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">if</span> hsh == line.<span style="color: black;">strip</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
        x += <span style="color: #ff4500;">1</span>
    <span style="color: #ff7700;font-weight:bold;">elif</span> <span style="color: #483d8b;">&quot;00000&quot;</span> + hsh<span style="color: black;">&#91;</span><span style="color: #ff4500;">5</span>:<span style="color: black;">&#93;</span> == line.<span style="color: black;">strip</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
        x += <span style="color: #ff4500;">1</span>
        <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Matching line: %s&quot;</span> <span style="color: #66cc66;">%</span> line
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Number of matches: %d&quot;</span> <span style="color: #66cc66;">%</span> x</pre></td></tr></table></div>

<p>My verdict is: <strong>my password is on the list</strong> and I&#8217;m considering a leap of faith from devoted conspiracy believer.</p>
<p>PS: I don&#8217;t find that &#8220;password&#8221; or &#8220;123456&#8243; as common passwords used by many people.<br />
PPS: A side story: Indonesians are found to be using weakest passwords (as <a href="http://bit.ly/JGECVM" title="Indonesia has weakest computer passwords: Researcher | The Jakarta Post">research over Yahoo ID revealed</a>)</p>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2012/06/alas-linkedin-password-file-howto-check-compromised-password/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
