<?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>evcz.tk &#187; curl</title>
	<atom:link href="http://evcz.tk/blog/tag/curl/feed/" rel="self" type="application/rss+xml" />
	<link>http://evcz.tk/blog</link>
	<description>my own pastebin :P</description>
	<lastBuildDate>Fri, 02 Jul 2010 23:20:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>CentOS import SSL certificate</title>
		<link>http://evcz.tk/blog/2008/10/24/centos-import-ssl-certificate/</link>
		<comments>http://evcz.tk/blog/2008/10/24/centos-import-ssl-certificate/#comments</comments>
		<pubDate>Fri, 24 Oct 2008 11:18:00 +0000</pubDate>
		<dc:creator>EvolutionCrazy</dc:creator>
				<category><![CDATA[howto]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://evcz.tk/blog/?p=34</guid>
		<description><![CDATA[Sometimes for certain applications using ssl cert based verification/encryption it&#8217;s usefull to point them to a directory that contains all the certificates If that can be done directly with a bash script it&#8217;s better There&#8217;s a nice script to do it directly, it just need a little modification to run on CentOS: http://jenders.vox.com/library/post/rtorrent-and-ssl-certificates-under-gentoo-linux.html The first [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes for certain applications using ssl cert based verification/encryption it&#8217;s usefull to point them to a directory that contains all the certificates <img src='http://evcz.tk/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>If that can be done directly with a bash script it&#8217;s better <img src='http://evcz.tk/blog/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p><span id="more-34"></span><br />
There&#8217;s a nice script to do it directly, it just need a little modification to run on CentOS:<br />
<a href="http://jenders.vox.com/library/post/rtorrent-and-ssl-certificates-under-gentoo-linux.html">http://jenders.vox.com/library/post/rtorrent-and-ssl-certificates-under-gentoo-linux.html</a></p>
<p>The first thing we need is openssl perl package (the one that have c_rehash in it)&#8230; you can get it with the command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">yum <span style="color: #c20cb9; font-weight: bold;">install</span> openssl-perl</pre></div></div>

<p>and then, just create the script:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">nano</span> <span style="color: #660033;">-w</span> import.cert.sh</pre></div></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
<span style="color: #007800;">SITE</span>=somesite.tld
&nbsp;
openssl s_client <span style="color: #660033;">-connect</span> <span style="color: #007800;">$SITE</span>:<span style="color: #000000;">443</span> <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">'/BEGIN CERTIFICATE/,/END CERTIFICATE/p'</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>pki<span style="color: #000000; font-weight: bold;">/</span>tls<span style="color: #000000; font-weight: bold;">/</span>certs<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$SITE</span>.crt
openssl x509 <span style="color: #660033;">-in</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>pki<span style="color: #000000; font-weight: bold;">/</span>tls<span style="color: #000000; font-weight: bold;">/</span>certs<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$SITE</span>.crt <span style="color: #660033;">-out</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>pki<span style="color: #000000; font-weight: bold;">/</span>tls<span style="color: #000000; font-weight: bold;">/</span>certs<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$SITE</span>.der <span style="color: #660033;">-outform</span> DER
openssl x509 <span style="color: #660033;">-in</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>pki<span style="color: #000000; font-weight: bold;">/</span>tls<span style="color: #000000; font-weight: bold;">/</span>certs<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$SITE</span>.der <span style="color: #660033;">-inform</span> DER <span style="color: #660033;">-out</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>pki<span style="color: #000000; font-weight: bold;">/</span>tls<span style="color: #000000; font-weight: bold;">/</span>certs<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$SITE</span>.pem <span style="color: #660033;">-outform</span> PEM
c_rehash
<span style="color: #7a0874; font-weight: bold;">unset</span> SITE</pre></td></tr></table></div>

<p>make it executable:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chmod</span> +x import.cert.sh</pre></div></div>

<p>run it:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>import.cert.sh</pre></div></div>

<p>and you are done, now you can eventually point your application to that certificate repository in case your app didn&#8217;t find it itself <img src='http://evcz.tk/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>for example you should run curl in this way:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">curl <span style="color: #660033;">-I</span> <span style="color: #660033;">--capath</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>pki<span style="color: #000000; font-weight: bold;">/</span>tls<span style="color: #000000; font-weight: bold;">/</span>certs<span style="color: #000000; font-weight: bold;">/</span> https:<span style="color: #000000; font-weight: bold;">//</span>somesite.tld</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://evcz.tk/blog/2008/10/24/centos-import-ssl-certificate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
