<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<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/"
	>

<channel>
	<title>openssl &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://en.wordpress.com/tag/openssl/</link>
	<description>Feed of posts on WordPress.com tagged "openssl"</description>
	<pubDate>Tue, 01 Dec 2009 08:25:26 +0000</pubDate>

	<generator>http://en.wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[create self signed multi domain certificate]]></title>
<link>http://thomaswabner.wordpress.com/2009/11/17/create-self-signed-multi-domain-certificate/</link>
<pubDate>Tue, 17 Nov 2009 16:29:37 +0000</pubDate>
<dc:creator>Thomas Wabner</dc:creator>
<guid>http://thomaswabner.wordpress.com/2009/11/17/create-self-signed-multi-domain-certificate/</guid>
<description><![CDATA[I have a domain mydomain.com with some sub level domains like nexus.mydomain.com svn.mydomain.com ww]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I have a domain mydomain.com with some sub level domains like</p>
<ul>
<li>nexus.mydomain.com</li>
<li>svn.mydomain.com</li>
<li>www.mydomain.com</li>
</ul>
<p>Now I need a self signed certificate for all these domains because I want to use them over HTTPS. There are some steps to do this. First of all: you don&#8217;t need for this propose your own root certificate. You should replace all occurence of <em>mydomain.com</em> with your own domain name and sub domains.</p>
<p>On the <a href="http://www.gentoo.org">gentoo</a> server where the apache should host the domains, I have to create the certificate. I do following steps:</p>
<ol>
<li><strong>Generate a private key</strong>
<pre class="brush: bash;">
openssl genrsa -des3 -out server.key 1024
</pre>
</li>
<li><strong>Generate a CSR (Certificate Signing Request)</strong>
<pre class="brush: bash;">
openssl req -new -key mydomain.key -out mydomain.csr

Country Name (2 letter code) [DE]:DE
State or Province Name (full name) [Sachsen]:Sachsen
Locality Name (eg, city) [Leipzig]:Leipzig
Organization Name (eg, company) [My Company Ltd]:mydomain.com
Organizational Unit Name (eg, section) []:Information Technology
Common Name (eg, your name or your server's hostname) []:mydomain.com
Email Address []:thomas dot wabner at mydomain dot com
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
</pre>
</li>
<li><strong>Remove Passphrase from Key</strong>
<pre class="brush: bash;">
cp mydomain.key mydomain.key.org
openssl rsa -in mydomain.key.org -out mydomain.key
</pre>
</li>
<li><strong>Generating a Self-Signed Certificate</strong>
<p>
To include all required subdomains a extensions file must be used. For example I have created a file /home/waffel/ssl/mydomain_extensions with following content:</p>
<pre class="brush: bash;">
[ mydomain_http ]
nsCertType      = server
keyUsage        = digitalSignature,nonRepudiation,keyEncipherment
extendedKeyUsage        = serverAuth
subjectKeyIdentifier    = hash
authorityKeyIdentifier  = keyid,issuer
subjectAltName          = @mydomain_http_subject
[ mydomain_http_subject ]
DNS.1 = www.mydomain.com
DNS.2 = nexus.mydomain.com
DNS.3 = trac.mydomain.com
DNS.4 = svn.mydomain.com
</pre>
</p>
<p>The last command to create the certificate is:</p>
<pre class="brush: bash;">
openssl x509 -req -days 365 -in mydomain.csr -signkey mydomain.key -out mydomain.crt -extfile /home/waffel/ssl/mydomain_extensions -extensions mydomain_http
</pre>
</li>
</ol>
<p>In the apache configuration for the ssl host&#8217;s I have enabled the ssl module with following content:</p>
<pre class="brush: bash;">
...
ServerAlias svn.mydomain.com trac.mydomain.com nexus.mydomain.com

        ErrorLog /var/log/apache2/ssl_mydomain_error_log
        &#60;IfModule log_config_module&#62;
                TransferLog /var/log/apache2/ssl_mydomain_access_log
        &#60;/IfModule&#62;

        SSLEngine on
        SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
        SSLCertificateFile /etc/apache2/ssl/mydomain.crt
        SSLCertificateKeyFile /etc/apache2/ssl/mydomain.key
        SSLCertificateChainFile /etc/ssl/cacert.pem
        &#60;FilesMatch &#34;\.(cgi&#124;shtml&#124;phtml&#124;php)$&#34;&#62;
                SSLOptions +StdEnvVars
        &#60;/FilesMatch&#62;
        &#60;Directory &#34;/var/www/localhost/cgi-bin&#34;&#62;
                SSLOptions +StdEnvVars
        &#60;/Directory&#62;
        &#60;IfModule log_config_module&#62;
                CustomLog /var/log/apache2/ssl_mydomain_request_log \
                        &#34;%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \&#34;%r\&#34; %b&#34;
        &#60;/IfModule&#62;
...
</pre>
<p>For exmaple if you need such certificate to connect your <a href="http://maven.apache.org">maven</a> with a self installed <a href="http://nexus.sonatype.org">nexus</a> repositiory over https you can follow the article from <a href="http://ahoehma.wordpress.com/2009/11/17/maven-https-repository-with-self-signed-ssl-certificate/">ahoehma</a>.</p>
<p>A more detailed description with some beckground information about the certificate creation can be found <a href="http://www.akadia.com/services/ssh_test_certificate.html">here</a>.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Ubuntu 8.04下利用openssl创建一个新数字证书]]></title>
<link>http://freshventure.wordpress.com/2009/11/15/ubuntu-8-04%e4%b8%8b%e5%88%a9%e7%94%a8openssl%e5%88%9b%e5%bb%ba%e4%b8%80%e4%b8%aa%e6%96%b0%e6%95%b0%e5%ad%97%e8%af%81%e4%b9%a6/</link>
<pubDate>Sun, 15 Nov 2009 11:18:31 +0000</pubDate>
<dc:creator>freshventure</dc:creator>
<guid>http://freshventure.wordpress.com/2009/11/15/ubuntu-8-04%e4%b8%8b%e5%88%a9%e7%94%a8openssl%e5%88%9b%e5%bb%ba%e4%b8%80%e4%b8%aa%e6%96%b0%e6%95%b0%e5%ad%97%e8%af%81%e4%b9%a6/</guid>
<description><![CDATA[Ubuntu默认的数字证书有效期只有一个月，到期后，可以重新申请一个： cd /etc/ssh openssl req  -new -x509 -days 3650 -key ../private/s]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Ubuntu默认的数字证书有效期只有一个月，到期后，可以重新申请一个：</p>
<p>cd /etc/ssh</p>
<p>openssl req  -new -x509 -days 3650 -key ../private/ssl-cert-snakeoil.key  -out ssl-cert-snakeoil.pem</p>
<p>反正只是自己使用，也不用再签名什么的了，完整的流程可以参考<a href="http://firefly.javaeye.com/blog/177544">Openssl简明使用手册</a>，以及<a href="http://rhythm-zju.blog.163.com/blog/static/310042008015115718637/">基于 OpenSSL 的 CA 建立及证书签发</a>。</p>
<p>此外第三方免费的SSL认证有CAcert.org，可惜直到目前他们都没有得到Mozilla的认可，根证书不能进入Firefox，更不用说IE了，所以没什么用。</p>
<p>通常情况，要申请成默认根证书，需要通过Webtrust的审计，$75,000 up-front plus ~$10,000 per year。还真是要不少银子</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Quickie HowTo - Apache with SSL]]></title>
<link>http://jasonk2600.wordpress.com/2009/11/14/quickie-howto-apache-with-ssl/</link>
<pubDate>Sat, 14 Nov 2009 22:42:21 +0000</pubDate>
<dc:creator>jasonk2600</dc:creator>
<guid>http://jasonk2600.wordpress.com/2009/11/14/quickie-howto-apache-with-ssl/</guid>
<description><![CDATA[Installation Install OpenSSL from the FreeBSD ports collection. # cd /usr/ports/security/openssl # m]]></description>
<content:encoded><![CDATA[Installation Install OpenSSL from the FreeBSD ports collection. # cd /usr/ports/security/openssl # m]]></content:encoded>
</item>
<item>
<title><![CDATA[OpenSSL : Decryption]]></title>
<link>http://jongampark.wordpress.com/2009/11/12/openssl-decryption/</link>
<pubDate>Fri, 13 Nov 2009 04:41:39 +0000</pubDate>
<dc:creator>jongampark</dc:creator>
<guid>http://jongampark.wordpress.com/2009/11/12/openssl-decryption/</guid>
<description><![CDATA[어제 올린 포스트에서 언급했듯이, 오늘은 Decryption 쪽을 포스팅해본다. 오늘 올릴 소스코드는 완전한 것이 아니라, 어떤 method의 한 부분을 보여주는데, 적어도 Ope]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>어제 올린 포스트에서 언급했듯이, 오늘은 Decryption 쪽을 포스팅해본다. 오늘 올릴 소스코드는 완전한 것이 아니라, 어떤 method의 한 부분을 보여주는데, 적어도 OpenSSL의 함수를 사용하는 부분에 대해서만은 완전한 소스의 형태를 갖추고 있다.</p>
<pre class="brush: cpp;">
	const char *validationRawData = [validataionData bytes];
	if( validataionData )
	{
		int validationLength = [validataionData length];
		int totalLength = 0; // For decrypted length

		int result = 0;
		unsigned char inputBuffer[8], outputBuffer[8];
		int inputLength = 0, outputLength = 0;

		bzero( inputBuffer, sizeof( inputBuffer ) );
		bzero( outputBuffer, sizeof( outputBuffer ) );

		char finalBuffer[64];
		bzero( finalBuffer, sizeof( finalBuffer ) );

		// Initialize cipher context
		EVP_CIPHER_CTX ctx;
		EVP_CIPHER_CTX_init( &#38;amp;ctx );

		// Copy a key
		unsigned char keyForDES[8];
		memcpy( keyForDES, kKeyText, 8 ); // &#38;quot;LXFExpor&#38;quot;

		result = EVP_DecryptInit( &#38;amp;ctx, EVP_des_ecb(), keyForDES, NULL);
		if( result )
		{

			int byteLeft = validationLength;
			int bytesToCopy = 0;
			int inputLoc = 0, outputLoc = 0;

			while( byteLeft &#38;gt; 0 )
			{
				if( byteLeft &#38;lt; 8 )
				{
					bytesToCopy = byteLeft;
					byteLeft = 0;
				}
				else
				{
					bytesToCopy = 8;
					byteLeft -= 8;
				}

				bzero( inputBuffer, sizeof( inputBuffer ) );
				memcpy( inputBuffer, validationRawData + inputLoc, bytesToCopy );
				inputLoc += bytesToCopy;

				bzero( outputBuffer, sizeof( outputBuffer ) );
				inputLength = bytesToCopy;
				result = EVP_DecryptUpdate( &#38;amp;ctx, outputBuffer, &#38;amp;outputLength, inputBuffer, inputLength );
				if( result )
				{
					memcpy( finalBuffer + outputLoc, outputBuffer, outputLength );
					outputLoc += outputLength;

					isSuccessful = YES;
				}
				else
				{
					isSuccessful = NO;
					break;
				}
			}

			bzero( outputBuffer, sizeof( outputBuffer ) );
			result = EVP_DecryptFinal( &#38;amp;ctx, outputBuffer, &#38;amp;outputLength );
			if( result )
			{
				memcpy( finalBuffer + outputLoc, outputBuffer, outputLength );
				outputLoc += outputLength;

				totalLength = outputLoc;

				isSuccessful = YES;
			}
			else
				isSuccessful = NO;

		}
		else
			isSuccessful = NO;
</pre>
<p>역시 주의할 부분은 EVP_DecryptUpdate() 함수의 호출부분이다. 이 함수의 호출 결과가 바로 바로 생각하는 단계의 것을 반영하지 않고, 다음 단계에 가서야 반영될 수있다. 직접 디버깅해 보면 좋을 것이다.</p>
<p>덧대서 말하자면 Mac에서는 libcrypto.dylib과 libssl.dylib을 링크해야 한다.<br />
Windows에서는 좀 다르다. 현재 비공식 배포판이 있는데, Unix나 Mac의 것과 조금 다른 이름의 라이브러리로 되어 있다.<br />
쉽게 파악할 수있기에 여기서는 설명을 하지 않겠다.</p>
<p>여기서 잠깐 부언 설명을 하자면, output buffer와 input buffer의 데이터 타입이 unsigned char의 어레이로 되어 있다. 이 점은 참 시사하는 바가 있다. 물론 사용할 수있는 암호화 기법마다 키의 길이가 다르고 output으로 나오는 길이가 다르기 때문에 int나 long이나 혹은 long long과 같은 데이터 타입을 사용하기가 좀 그렇다. char의 어레이로 하는 편이 여러가지로 난데, 여기엔 아마 또 하나의 고려사항이 있는 듯하다. byte ordering이 그것이다. 다양한 플랫폼으로 포팅을 할 때, 유념해야 할 사항 중의 하나가 바로 byte ordering이다. 의외로 미국에는 특히 인도계나 중국계가 그런데, Unix를 모르는 전산과 출신들이 많다. 컴퓨터하면 Windows만 아는 것이다. 근데 생각해 보자, 전산을 한 사람이 Windows는 모를 수있어도, Unix를 모른다는게 말이 되는가? 내가 본 소스 중에 이 byte ordering을 생각하지 않고 막 짠 것들이 꽤 있다. 근데, 자기가 테스트 한 머신에서는 되니까 그냥 되는구나하고 submit를 해 버린거다. 경력 15년이란다.. 어이그.. 내가 그런 것들 밑에서 일한다는게.. 정말..<br />
아무튼&#8230; 그 소스 코드는 Unix를 모르는, Windows만 아는 사람이 만든거다. Unix를 쓰면 바로 Byte Ordering에 노출될텐데 말이지. 하긴&#8230;Intel Processor가 골치 아픈 구조이긴 하다. 세상의 거의 모든 Processor들이 다 Big Endian인데, Intel Processor들은 혼자서 Little Endian이다. 이거 참 웃기는 구조다. 통신도 Big Endian이 기본이다. 거의 모든 표준 규약이 Big Endian을 기반으로 한다. 왜 인텔의 프로세서 디자이너들은 little endian으로 만들었을까? 하다 못해 ARM core도 인텔이 fab을 한건 little endian으로 돈다. 다른 업체들이 만든건 Big Endian으로 돌지..<br />
뭐 투덜대는건 그만하고&#8230; OpenSSL의 이런 구조는 porting할때 상당히 편하게 만드는 구조다. 이런 면은 참 생각을 잘하고 만든거 같다.</p>
<p>근데.. 그래도 역시 처음 사용하는 사람을 어리둥정하게 만드는 것은, 어디서부터 시작해야할지 모르게 만드는 함수 이름들과 MAN 페이지의 설명.. 이 OpenSSL을 보면, C++의 namespace보다 Objective-C처럼 클래스나 메소드 이름을 잘 정하는 것이 실제로 더 생산성을 높이고 관리하게 편하게 만드는 것이라는 것을 알 수있다. 물론 기본을 잘하고 namespace가 있으면 더 좋겠지만, 실제론 그런가?</p>
<p>근데 Cocoa나 Foundation 클래스 중에 이 OpenSSL을 wrapping해서 만든게 분명 있을텐데&#8230; KeyChain에 관련된 것과 CFAuthorization인가 등이 관련이 있을거 같은데 (그리고 특히 Keychain에 관련된 것들은 확실히 사용하고 있다.), 아무리 봐도 직접적으로 DES나 RSA, MD5, blowfish등을 언급한 도큐먼트가 Cocoa엔 없다.. 이거 참&#8230;&#8230;</p>
<p>참.. 그리고 Mac에는 이거 외에도 또 암호화 기술을 사용할 수있게 하는 것이 있다. CC_로 시작되는 건데, 이름하여 Common Crypto API다. 몇가지 함수 이름을 보자면 CC_MD5_Init, CC_SHA1_Update, CCCryptorCreate 등등이다.</p>
<p>지금보니 뭔가 구조가 OpenSSL의 것과 비슷하다.<br />
CCCryptorCreate(),  CCCryptorUpdate(), CCCryptorFinal()&#8230;  비슷하지 않은가?<br />
함수 이름들이 훨씬 정리가 잘 되어 있다. 근데 Mac이외에는 이 Common Crypto API의 MAN페이지가 검색되지 않는 것으로 보아, Apple사가 만들고 Mac에서만 쓰이는 것 같다.<br />
혹은 BSD? 음.. 제목쪽에 BSD Library Functions Manual 라고 써져있는 것으로 보아 BSD Unix에서 쓰이는 것인가보다.</p>
<p><span style="color:#ff0000;"><strong>ADDED</strong></span> : 보니까 이 Common Crypto library는 Apple의 Open Source인 것같다.<br />
여기 링크가 있다. <a href="http://developer.apple.com/opensource/security/">http://developer.apple.com/opensource/security/</a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[OpenSSL 사용법]]></title>
<link>http://jongampark.wordpress.com/2009/11/11/openssl-%ec%82%ac%ec%9a%a9%eb%b2%95/</link>
<pubDate>Thu, 12 Nov 2009 05:34:02 +0000</pubDate>
<dc:creator>jongampark</dc:creator>
<guid>http://jongampark.wordpress.com/2009/11/11/openssl-%ec%82%ac%ec%9a%a9%eb%b2%95/</guid>
<description><![CDATA[OpenSSL을 사용하려고 하면 몇가지 문제에 봉착하게 된다. 우선 쉽게 설명이 잘 되어 있는 문서가 전무하다. OpenSSL 웹사이트를 가면 몇가지 설명을 볼 수가 있는데, 대개]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>OpenSSL을 사용하려고 하면 몇가지 문제에 봉착하게 된다.</p>
<p>우선 쉽게 설명이 잘 되어 있는 문서가 전무하다. OpenSSL 웹사이트를 가면 몇가지 설명을 볼 수가 있는데, 대개 제대로 설명이 안되어 있다.  예를 들어 DES로 encryption과 decryption을 한다고 하자. MAN -s 3 ssl 로 OpenSSL에 대한 설명을 보면, 뭘 어디서부터 손대야 할지 알 수가 없다. 그래서 찾다 찾다 DES를 직접 건드려보기로 했다. 이때 중요한 함수가 몇개 있다.</p>
<pre class="brush: cpp;">
void DES_random_key(DES_cblock *ret);

int DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule);
int DES_key_sched(const_DES_cblock *key, DES_key_schedule *schedule);
int DES_set_key_checked(const_DES_cblock *key,
       DES_key_schedule *schedule);
void DES_set_key_unchecked(const_DES_cblock *key,
       DES_key_schedule *schedule);

void DES_set_odd_parity(DES_cblock *key);
int DES_is_weak_key(const_DES_cblock *key);

void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output,
       DES_key_schedule *ks, int enc);
</pre>
<p>여기서 어떤 함수를 써야 하는지 파악하기 위해서, 간단한 예제라도 있으면 좋겠는데, 전혀 그렇지 않다.<br />
굳이 찾자면, OpenSSL의 test 폴더에 있는 샘플 코드를 보는 것이다.<br />
아무튼 MAN 페이지를 아무리 찾아봐도, 저 schedule 변수가 뭐할때 쓰는건지, checked와 unchecked key의 차이는 뭔지 알 수가 없다. 물론 이것은 암호화 자체의 spec에 준하는 함수이기 때문에 DES 자체를 이해하는 것이 필요하다. 하지만 DES 문서를 봐도 때로는 알 수가 없다.<br />
그러다가 OpenSSL의 mailing list에서, 직접 특정 암호화 함수를 사용하지 말고 high-level 함수를 이용하는 것이 더 좋다라는 답변을 들었다. 음.. 그게 뭐지? 힌트로 얻은 것이 <span style="color:#993300;"><strong>EVP_EncryptInit_ex()</strong></span>였다.<br />
아.. command라인에서 쓰더라도 openssl 명령을 쓰고 그 옆에 어떤 암호화 기법을 쓸지를 정해주지 않던가? (물론 바로 암호화 명령을 써도 되지만) 음.. 함수들도 그렇게 구성이 되어 있구나.. 그런 것을 알게 되었다. 근데 이런 설명이 MAN 페이지엔 제대로 되어 있지 않다. (혹 이 시점에서 MAN 페이지 구석 구석 찾아보고 &#8220;있는데?&#8221; 하는 분들 있을지 모르겠다. 여기서 말하고자 하는 건, 눈에 확 띄지 않는다는 뜻이다. )</p>
<p>그래서 MAN 페이지를 뚤어지게 찾아보다가 찾아내서 만든 코드가 아래의 코드다.</p>
<pre class="brush: cpp;">
- (char *)generateCipherText:(NSString *)inputString withCipherTextLength:(int *)cipherTextLength
{
	BOOL isSuccessful = YES;

	const char *inputCString = [inputString cStringUsingEncoding:NSASCIIStringEncoding];
	int sourceLength = strlen( inputCString );

	int result = 0;
	unsigned char inputBuffer[16], outputBuffer[16];
	int outputLength = 0;
	int inputLength = 0;

	bzero( inputBuffer, 16 );
	bzero( outputBuffer, 16 );

	char *finalBuffer;
	finalBuffer = (char *)malloc( 64 );
	bzero( finalBuffer, 64 );

	// Initialize cipher context
	EVP_CIPHER_CTX ctx;
	EVP_CIPHER_CTX_init( &#38;amp;ctx );

	// Copy a key
	unsigned char keyForDES[8];
	memcpy( keyForDES, kKeyText, 8 ); // &#38;quot;LXFExpor&#38;quot;

	result = EVP_EncryptInit(&#38;amp;ctx, EVP_des_ecb(), keyForDES, NULL);
	if( result )
	{
		int byteLeft = sourceLength;
		int bytesToCopy;
		int inputLoc = 0, outputLoc = 0;

		while( byteLeft &#38;gt; 0 )
		{
			if( byteLeft &#38;lt; 8 )
			{
				bytesToCopy = byteLeft;
				byteLeft = 0;
			}
			else
			{
				bytesToCopy = 8;
				byteLeft -= 8;
			}

			bzero( inputBuffer, 16 );
			memcpy( inputBuffer, inputCString+inputLoc, bytesToCopy );
			inputLoc += bytesToCopy;

			bzero( outputBuffer, 16 );
			inputLength = bytesToCopy;
			result = EVP_EncryptUpdate(&#38;amp;ctx, outputBuffer, &#38;amp;outputLength, inputBuffer, inputLength);
			if( result )
			{
				memcpy( finalBuffer+outputLoc, outputBuffer, outputLength );
				outputLoc += outputLength;
			}
			else
			{
				isSuccessful = NO;
				break;
			}
		}

		bzero( outputBuffer, 16 );
		result = EVP_EncryptFinal( &#38;amp;ctx, outputBuffer, &#38;amp;outputLength );
		if( result )
		{
			memcpy( finalBuffer+outputLoc, outputBuffer, outputLength );
			outputLoc += outputLength;

			*cipherTextLength = outputLoc;

			isSuccessful = YES;
		}
		else
		{
			isSuccessful = NO;
		}
	}
	else
		isSuccessful = NO;

	EVP_CIPHER_CTX_cleanup(&#38;amp;ctx);

	if( isSuccessful == NO )
	{
		NSGetCriticalAlertPanel( @&#38;quot;Cirtical Information&#38;quot;, @&#38;quot;It couldn't create a registration file.&#38;quot;, @&#38;quot;OK&#38;quot;, nil, nil );

		return (char *)-1;
	}
	else
		return finalBuffer;
}
</pre>
<p>위의 코드는 암호화를 하는 부분, 즉 cipher 과정이다. 혹 암호화에 익숙하지 않으신 분들에겐 encryption이란 말이 더 편하게 들릴지 모르겠다. encryption == cipher, decryption == decipher로 이해하시면 되겠다.</p>
<p>간단해 보이지 않는가? 암호화 하는 부분만 떼어내면 참 간단한 코드다. 그런데 이게 예가 MAN page에 나오질 않는다.<br />
Oreilly에서 OpenSSL에 관련된 책이 단 한권 나오긴 한다. 물론 SSL에 대한 것이어서 암호화에 대한 것보단 socket을 열어서 SSH로 connection을 하는 쪽에 더 촛점이 맞추어져 있는거 같긴하다. 그 부분으로써 암호화에 대한 설명이 나온다. 왜냐하면 SSH 세션을 열면, 그 안에서 통신의 안전을 위해서 암호화 기법이 사용되기 때문이다.</p>
<p>근데 보기엔 간단해 보이지만, 저 코드를 완성하는데 꼬박 하루가 걸렸다. 왜일까?<br />
OpenSSL의 구현에 묘한 점이 있기때문인데, 바로 <span style="color:#993300;"><strong>EVP_EncryptUpdate()</strong></span>이 호출되는 부분이다. 앞에서 언급한 &#8220;도대체 어디서부터 시작해야 하나&#8221;라는 것이 OpenSSL을 사용하기 힘들게 만드는 첫번째 이유라면, 두번째가 바로 이 함수때문 같다. (암호화 자체를 이해하는거야&#8230; 당연히 암호화에 대해 아는 사람이 OpenSSL을 시도하는 거라고 생각하니 제끼고.. )</p>
<p>이 함수가 동작하는데 좀 묘한 면이 있는데.. 사실 Encryption을 할때와 Decryptiond을 할때가 조금 패턴이 다르다.<br />
즉 이 함수가 호출될때, input에 들어있는 original text가 output에 encryption이 되어서 바로 들어갈때도 있고, 아닐때도 있다는 것이다. 아마 기억에 encryption때는 바로 바로 들어갔던거 같고, decryption때가 바로 안들어가고, 그 다음 iteration때 들어갔던 것 같다. 그때, outputLength가 실제 변환된 것만큼 되지 않고 0으로 되더라는 것이다. 그래서.. 아.. 뭘 잘못 사용하고 있나보다 하고 그거 알아내려다가 하루 웬 종일 지나갔다. 알고보니 다음 단계에서 세팅되는 것이다.<br />
아마 decryption때 그런것 같은데, encryption때는 <span style="color:#993300;"><strong>EVP_EncryptFinal()</strong></span>가 호출되기 직전, 즉 마지막으로 encryption을 할때  그랬던 것같다. 아 맞다. 그런 거 같다. 그래서 outputLength가 0이 되더라도 놀라지 말고 끝까지, 즉 <span style="color:#993300;"><strong>EVP_EncryptFinal()</strong></span>를 호출하라는 것이다.</p>
<p>OpenSSL이 이렇게 움직이는 이유는 bit stuffing때문인거 같다. MPEG4/H-264의 CABAC을 구현할때랑 JPEG Encoder/Decoder를 구현할때, 이 bit stuffing을 많이 사용했는데, 처음 구현할때는 고생했다. (USC에서..) 근데 회사에서 하니 아무래도 한번 해 본거라, 대충 어떻게 할지 방향이 이미 잡혀 있기에 고생 자체는 안했다. 시간이 들었을 뿐.<br />
근데 내가 bit stuffing을 구현하는 것은 modulo 연산을 이용해서, 실제 일정 길이의 비트가 필요하기 전에, 그것을 충분히 대응해 줄 수있게 버퍼를 미리 채워주게 구현해서 아무런 문제가 없는데, 아마 그렇게 구현하지 않으면 (modulo 연산이 생각보다  헷갈린 면이 있어서 ), 해당 스텝내에 encoding 혹은 decoding을 하려 하면, 일정양의 비트 데이터를 확보해야 하는데, 미처 준비가 안될 수있다. 그럼 다음 스템으로 그 처리를 넘기면 그때는 확실하게 확보가 되기 때문에 (아닐 수도 있다. 데이터의 끝부분에서 미쳐 준비가 안되는 일이 생기곤 한다. ) 그렇게 구현이 되었겠다 싶다.</p>
<p>이런 설명이 있어야 한다. 없으니 제대로 동작하는데도 마치 안되는 것처럼 생각되어서 하루를 낭비하지 않는가?<br />
으&#8230; USC에서 내 개인 프로젝트 못하고 이것으로 하루 웬종일 썼다.</p>
<p>다음에는 decoding 부분을 포스팅해 보겠다.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[OpenSSL version 1.0.0 Beta 4 released]]></title>
<link>http://cloudtesting.wordpress.com/2009/11/10/openssl-version-1-0-0-beta-4-released/</link>
<pubDate>Tue, 10 Nov 2009 16:23:25 +0000</pubDate>
<dc:creator>Phil Smith - Cloud Testing</dc:creator>
<guid>http://cloudtesting.wordpress.com/2009/11/10/openssl-version-1-0-0-beta-4-released/</guid>
<description><![CDATA[OpenSSL &#8211; The Open Source toolkit for SSL/TLS http://www.openssl.org/ OpenSSL is currently in ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><blockquote><p>OpenSSL &#8211; The Open Source toolkit for SSL/TLS<br />
http://www.openssl.org/</p>
<p>OpenSSL is currently in a release cycle. The fourth beta is now released.<br />
This is expected be the final or penultimate beta depending on the number<br />
of bugs reported.</p>
<p>The beta release is available for download via HTTP and FTP from the<br />
following master locations (the various FTP mirrors you can find under<br />
http://www.openssl.org/source/mirror.html):</p>
<p>o http://www.openssl.org/source/<br />
o ftp://ftp.openssl.org/source/</p>
<p>The file names of the beta are:</p>
<p>o openssl-1.0.0-beta4.tar.gz<br />
Size: 4000628<br />
MD5 checksum: f22750164e1db42145803fed8104df57<br />
SHA1 checksum: f590232651b9033365e0aa9a2279cdef6519884c</p>
<p>The checksums were calculated using the following command:</p>
<p>openssl md5 &#60; openssl-1.0.0-beta4.tar.gz<br />
openssl sha1 &#60; openssl-1.0.0-beta4.tar.gz</p>
<p>Please download and test them as soon as possible. This new OpenSSL<br />
version incorporates 120 documented changes and bugfixes to the<br />
toolkit (for a complete list see http://www.openssl.org/source/exp/CHANGES).</p>
<p>Also check the latest snapshots at ftp://ftp.openssl.org/snapshot/<br />
or CVS (see http://www.openssl.org/source/repos.html) to avoid<br />
reporting previously fixed bugs.</p>
<p>Since the third beta, the following has happened:</p>
<p>- Initial TLS session renegotiation fix<br />
- TLS ticket and SNI coexistance fix<br />
- Several DTLS fixes and updates.<br />
- Custom OCSP headers.<br />
- Check return values properly on some functions.<br />
- Some documentation for X509 chain verification functions.<br />
- Time routines fixed for CRL generation.<br />
- Additional PRNG duplication protection.<br />
- Cross compilation updates.<br />
- Build system fixes including VMS.<br />
- Other bug fixes.</p>
<p>Reports and patches should be sent to openssl-bugs@openssl.org.<br />
Discussions around the development of OpenSSL should be sent to<br />
openssl-dev@openssl.org.  Anything else should go to<br />
openssl-users@openssl.org.</p>
<p>The best way, at least on Unix, to create a report is to do the<br />
following after configuration:</p>
<p>make report</p>
<p>That will do a few basic checks of the compiler and bc, then build<br />
and run the tests.  The result will appear on screen and in the file<br />
&#8220;testlog&#8221;.  Please read the report before sending it to us.  There<br />
may be problems that we can&#8217;t solve for you, like missing programs.</p>
<p>Yours,<br />
The OpenSSL Project Team&#8230;</p>
<p>Mark J. Cox             Ben Laurie          Andy Polyakov<br />
Ralf S. Engelschall     Richard Levitte     Geoff Thorpe<br />
Dr. Stephen Henson      Bodo Möller		Ulf Möller<br />
Lutz Jänicke            Nils Larsch</p></blockquote>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[MD5, SHA1 funciones de hash]]></title>
<link>http://seifreed.org/2009/11/10/md5-sha1-funciones-de-has/</link>
<pubDate>Tue, 10 Nov 2009 00:41:38 +0000</pubDate>
<dc:creator>Marc Rivero López</dc:creator>
<guid>http://seifreed.org/2009/11/10/md5-sha1-funciones-de-has/</guid>
<description><![CDATA[Es algo bastante extendido en Internet. MD5 y SHA1 sirve para comprobar la integridad de un fichero.]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Es algo bastante extendido en Internet. MD5 y SHA1 sirve para comprobar la integridad de un fichero.</p>
<p>Es decir si ese fichero<strong> ha podido ser modificado o no</strong>.</p>
<p>Naturalmente es un tema bastante importante ya que, con este tipo de métodos podemos verificar que realmente estamos descargando y usando algo que proviene de la fuente original y no ha sido modificado por terceros.</p>
<p>Empezaremos por MD5 de echo es el más conocido y extendido por Internet.</p>
<p><span style="color:#ff0000;"><strong>Que es MD5?</strong></span></p>
<blockquote><p>Es uno de los algoritmos de reducción criptográficos diseñados por el profesor <a title="Ronald Rivest" href="http://es.wikipedia.org/wiki/Ronald_Rivest">Ronald Rivest</a> del <a title="MIT" href="http://es.wikipedia.org/wiki/MIT">MIT</a> (<em>Massachusetts Institute of Technology</em>, Instituto Tecnológico de Massachusetts). Fue desarrollado en <a title="1991" href="http://es.wikipedia.org/wiki/1991">1991</a> como reemplazo del algoritmo <a title="MD4" href="http://es.wikipedia.org/wiki/MD4">MD4</a> después de que <a title="Hans Dobbertin" href="http://es.wikipedia.org/wiki/Hans_Dobbertin">Hans Dobbertin</a> descubriese su debilidad.A pesar de su amplia difusión actual, la sucesión de problemas de seguridad detectados desde que, en <a title="1996" href="http://es.wikipedia.org/wiki/1996">1996</a>, <a title="Hans Dobbertin" href="http://es.wikipedia.org/wiki/Hans_Dobbertin">Hans Dobbertin</a> anunciase una <a title="Colisión (hash)" href="http://es.wikipedia.org/wiki/Colisi%C3%B3n_%28hash%29">colisión de <em>hash</em></a> plantea una serie de dudas acerca de su uso futuro.</p></blockquote>
<p>Como comentaba antes, MD5 es el sistema más utilizado.</p>
<p><span style="color:#ff0000;"><strong>Comprobando MD5 en Windows</strong></span></p>
<p>Veamos un ejemplo:</p>
<p>Nos queremos descargar una ISO de Debian, por ejemplo vamos a la página de descargas.</p>
<p><a href="http://cdimage.debian.org/debian-cd/5.0.3/i386/iso-cd/" target="_blank">Pagina de descargas de Debian</a></p>
<p>Nos descargamos la ISO.</p>
<p>La página de descargas ya nos ofrece un fichero para comprobar las firmas que es este:</p>
<p><a href="http://cdimage.debian.org/debian-cd/5.0.3/i386/iso-cd/MD5SUMS" target="_blank">Fichero MD5</a></p>
<p>Vamos a sacar el MD5 de la imagen del CD de Debian en Windows. Yo lo he echo con el programa MD5SUM.</p>
<p>Lo podemos descargar de aqui:</p>
<p><a href="http://www.etree.org/md5com.html" target="_blank">MD5SUM</a></p>
<p>Después de descargarlo y probarlo nos sale esto:</p>
<p><a href="http://seifreed.wordpress.com/files/2009/11/comprobar_md51.png"><img class="aligncenter size-full wp-image-1813" title="comprobar_md5" src="http://seifreed.wordpress.com/files/2009/11/comprobar_md51.png" alt="comprobar_md5" width="500" height="143" /></a></p>
<p>Como veis nos da el hash, ahora vamos a comprobarlo con el hash que nos ofrecen:</p>
<p><a href="http://seifreed.wordpress.com/files/2009/11/md5_comprobado.png"><img class="aligncenter size-full wp-image-1814" title="md5_comprobado" src="http://seifreed.wordpress.com/files/2009/11/md5_comprobado.png" alt="md5_comprobado" width="497" height="24" /></a></p>
<p>Si miráis en la web que os he pasado antes la de <a href="http://cdimage.debian.org/debian-cd/5.0.3/i386/iso-cd/MD5SUMS" target="_blank">Fichero MD5</a>. Podemos ver que la firma ofrecida y la que hemos comprobado <strong>son iguales</strong>. Es decir, la ISO que tenemos es <strong>totalmente original</strong>.</p>
<p><strong><span style="color:#ff0000;">Comprobando MD5 en Ubuntu:</span></strong></p>
<p>Primero de todo instalaremos un paquete que nos hace falta:</p>
<blockquote><p>sudo apt-get install sleuthkit</p></blockquote>
<p>Instalamos el paquete y ya podemos comprobar la integridad del fichero.</p>
<p><a href="http://seifreed.wordpress.com/files/2009/11/md5_ubuntu.png"><img class="aligncenter size-full wp-image-1815" title="md5_ubuntu" src="http://seifreed.wordpress.com/files/2009/11/md5_ubuntu.png" alt="md5_ubuntu" width="500" height="120" /></a></p>
<p>Con esto obtenemos el hash MD5 en Ubuntu</p>
<p><span style="color:#ff0000;"><strong>Comprobando MD5 en MAC OS X</strong></span></p>
<p>En MAC utilizaremos una herramienta que nos comprueba el hash, lo podemos encontrar aquí:</p>
<p><a href="http://www.apple.com/downloads/macosx/networking_security/md5_eternalstormssoftware.html" target="_blank">MD5</a></p>
<p>Lo utilizamos y calculamos el hash MD5 que queramos:</p>
<p><a href="http://seifreed.wordpress.com/files/2009/11/md5_mac_os_x.png"><img class="aligncenter size-full wp-image-1816" title="MD5_mac_os_x" src="http://seifreed.wordpress.com/files/2009/11/md5_mac_os_x.png" alt="MD5_mac_os_x" width="500" height="161" /></a></p>
<p>Ahora vamos por el SHA1.</p>
<p>Aunque no tan utilizado como el MD5, se tiende a migrar ya hacia el SHA1.</p>
<blockquote><p>es un sistema de <a title="Función hash" href="http://es.wikipedia.org/wiki/Funci%C3%B3n_hash">funciones <em>hash</em></a> criptográficas relacionadas de la <a title="Agencia de Seguridad Nacional de los Estados Unidos" href="http://es.wikipedia.org/wiki/Agencia_de_Seguridad_Nacional_de_los_Estados_Unidos">Agencia de Seguridad Nacional de los Estados Unidos</a> y publicadas por el <em>National Institute of Standards and Technology</em> (NIST). El primer miembro de la familia fue publicado en <a title="1993" href="http://es.wikipedia.org/wiki/1993">1993</a> es oficialmente llamado <strong>SHA</strong>. Sin embargo, hoy día, no oficialmente se le llama <strong>SHA-0</strong> para evitar confusiones con sus sucesores. Dos años más tarde el primer sucesor de SHA fue publicado con el nombre de <strong>SHA-1</strong>. Existen cuatro variantes más que se han publicado desde entonces cuyas diferencias se basan en un diseño algo modificado y rangos de salida incrementados: <strong>SHA-224</strong>, <strong>SHA-256</strong>, <strong>SHA-384</strong>, y <strong>SHA-512</strong> (llamándose <strong>SHA-2</strong> a todos ellos).</p></blockquote>
<p>Vamos a ver como podemos comprobar la firma SHA1.</p>
<p>En la misma imagen de Debian.</p>
<p>Primero vemos como la página nos ofrece las firmas de hash</p>
<p><a href="http://cdimage.debian.org/debian-cd/5.0.3/i386/iso-cd/SHA1SUMS" target="_blank">Hashes SHA1</a></p>
<p>Comprobando firmas sha1 en Windows</p>
<p>Para hacer la comprobación de sha1 nos tenemos que descargar el ejecutable, lo podemos encontrar aqui:</p>
<p><a href="ftp://ftp.gnupg.org/gcrypt/binary/sha1sum.exe" target="_blank">Sha1sum</a></p>
<p>Lo ejecutamos y comprobamos la firma</p>
<p><a href="http://seifreed.wordpress.com/files/2009/11/sha1_windows.png"><img class="aligncenter size-full wp-image-1817" title="sha1_windows" src="http://seifreed.wordpress.com/files/2009/11/sha1_windows.png" alt="sha1_windows" width="500" height="35" /></a></p>
<p>Ya tenemos nuestra firma SHA1 que podemos comprobar con nuestro fichero.</p>
<p><span style="color:#ff0000;"><strong>Comprobando Sha1 en Ubuntu.</strong></span></p>
<p>Con el paquete que instalamos antes no haría falta instalar nada más.</p>
<p>Miremos como se hace:</p>
<p><a href="http://seifreed.wordpress.com/files/2009/11/sha1_ubuntu.png"><img class="aligncenter size-full wp-image-1818" title="sha1_ubuntu" src="http://seifreed.wordpress.com/files/2009/11/sha1_ubuntu.png" alt="sha1_ubuntu" width="500" height="52" /></a></p>
<p>Ya tenemos nuestra firma en sha1.</p>
<p>Comprobando Sha1 en MAC OS X</p>
<p>Por último en mac, para hacerlo utilizaremos la librería de openssl +sha1</p>
<p>veamos el comando sería así:</p>
<blockquote><p>/usr/bin/openssl sha1 fichero</p></blockquote>
<p>Asi que veamos un ejemplo:</p>
<p><a href="http://seifreed.wordpress.com/files/2009/11/sha1_mac_osx.png"><img class="aligncenter size-full wp-image-1819" title="sha1_mac_osx" src="http://seifreed.wordpress.com/files/2009/11/sha1_mac_osx.png" alt="sha1_mac_osx" width="447" height="51" /></a></p>
<p>Y hasta aquí todo, espero que desde ahora vigiléis lo que os bajais.</p>
<p>&#160;</p>
<p>Saludos</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[How to use DES in OpenSSL library?]]></title>
<link>http://jongampark.wordpress.com/2009/11/08/how-to-use-des-in-openssl-library/</link>
<pubDate>Mon, 09 Nov 2009 01:15:15 +0000</pubDate>
<dc:creator>jongampark</dc:creator>
<guid>http://jongampark.wordpress.com/2009/11/08/how-to-use-des-in-openssl-library/</guid>
<description><![CDATA[Well, I would like to use DES or BASE64 which are symmetric, i.e. encryption of a plain text produce]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Well, I would like to use DES or BASE64 which are symmetric, i.e. encryption of a plain text produces a cypher text, and description of the cypher text produce the original plain text.</p>
<p>However, only by reading its MAN page, it turned out to be very very very difficult to understand and use it.</p>
<p>Even at the OpenSSL web site, there was no good tutorial on how to use it.</p>
<p>I wasted almost a whole day to figure out how to use it, and fortunately I think I found it.</p>
<p>Well, if you download the source codes, there is a directory for testing, &#8220;test&#8221;. And there is a destest.c.</p>
<p>And.. <a href="http://www.google.com/codesearch/p?hl=en&#38;sa=N&#38;cd=2&#38;ct=rc#_Ty5tsRhOz8/openssl-0.9.7g/crypto/des/destest.c&#38;q=destest.c">here is the one from Google code search</a>.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Setting SSL with Apache 2.x on Windows]]></title>
<link>http://luckylarry.wordpress.com/2009/11/08/setting-ssl-with-apache-2-x-on-windows/</link>
<pubDate>Sun, 08 Nov 2009 01:08:04 +0000</pubDate>
<dc:creator>luckylarry</dc:creator>
<guid>http://luckylarry.wordpress.com/2009/11/08/setting-ssl-with-apache-2-x-on-windows/</guid>
<description><![CDATA[Pretty similar to setting up SSL on unix/linux and actually not that hard to do. Just a few things t]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Pretty similar to setting up SSL on unix/linux and actually not that hard to do. Just a few things to remember as a checklist.</p>
<p>If your Apache install didn’t include openSSL then you’ll need to download a few things:</p>
<p>Normally you can find <strong>mod_ssl.so</strong> in your apache install directory in modules.<br />
In conf/extras you’ll find <strong>httpd_ssl.conf</strong></p>
<p>Or just download Apache with openSSL here. Next step is to create a certificate. Only thing to look at really is your server name in your <strong>httpd.conf</strong> file (found in the conf/ directory). You use your server name in your certificate setup – these must match otherwise you’ll get errors (it’ll still work though).</p>
<p><a rel="bookmark" href="http://luckylarry.co.uk/2009/10/setting-ssl-with-apache-2-x-on-windows/">Setting SSL with Apache 2.x on Windows</a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[How to generate a self-signed OpenSSL certificate for Apache]]></title>
<link>http://freddyandersen.wordpress.com/2009/11/04/how-to-generate-a-self-signed-openssl-certificate-for-apache/</link>
<pubDate>Wed, 04 Nov 2009 18:39:06 +0000</pubDate>
<dc:creator>Freddy</dc:creator>
<guid>http://freddyandersen.wordpress.com/2009/11/04/how-to-generate-a-self-signed-openssl-certificate-for-apache/</guid>
<description><![CDATA[There are just a few quick and easy steps to generate a certificate without a passphrase for Apache.]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>There are just a few quick and easy steps to generate a certificate without a passphrase for Apache. First you have to generate a key for your host:</p>
<blockquote>
<pre>[root@heimdull]# openssl genrsa 1024 &#62; host.key
<div id="_mcePaste">Generating RSA private key, 1024 bit long modulus</div>
<div id="_mcePaste">..........................................++++++</div>
<div id="_mcePaste">.........++++++</div>
<div id="_mcePaste">e is 65537 (0x10001)</div>

Generating RSA private key, 1024 bit long modulus.............
.............................++++++.........++++++e is 65537 (0x10001)</pre>
</blockquote>
<p>Now you have your host key file that you will use in the Apache configuration file and to generate the actual certificate</p>
<blockquote>
<pre>[root@heimdull]# openssl req -new -x509 -nodes -sha1 -days 365 -key host.key &#62; host.crt
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [GB]:GB
State or Province Name (full name) [Berkshire]:Berkshire
Locality Name (eg, city) [Newbury]: Newbury
Organization Name (eg, company) [My Company Ltd]:My Company Ltd
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:www.myserver.com
Email Address []:</pre>
</blockquote>
<p>Now you have to move these files somewhere that is related to you Apache installation and in your httpd.conf or httpd-ssl.conf file you will need these lines:</p>
<blockquote>
<pre>SSLEngine on
  SSLCertificateFile /Apache-home/ssl/host.crt
  SSLCertificateKeyFile /Apache-home/ssl/host.key</pre>
</blockquote>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Install web server di PCBSD]]></title>
<link>http://gopanx.wordpress.com/2009/11/01/install-web-server-di-pcbsd/</link>
<pubDate>Sun, 01 Nov 2009 07:13:32 +0000</pubDate>
<dc:creator>gopanx</dc:creator>
<guid>http://gopanx.wordpress.com/2009/11/01/install-web-server-di-pcbsd/</guid>
<description><![CDATA[Akhirnya langsung ketemu juga cara install webserver di PCBSD. Sudah saya praktekkan dan berhasil 10]]></description>
<content:encoded><![CDATA[Akhirnya langsung ketemu juga cara install webserver di PCBSD. Sudah saya praktekkan dan berhasil 10]]></content:encoded>
</item>
<item>
<title><![CDATA[Membangun VPN dengan OpenVPN di Ubuntu]]></title>
<link>http://brokenz1.wordpress.com/2009/10/31/membangun-vpn-dengan-openvpn-di-ubuntu/</link>
<pubDate>Sat, 31 Oct 2009 15:35:41 +0000</pubDate>
<dc:creator>brokenz1</dc:creator>
<guid>http://brokenz1.wordpress.com/2009/10/31/membangun-vpn-dengan-openvpn-di-ubuntu/</guid>
<description><![CDATA[Apa itu VPN Virtual Private Netwok (VPN) merupakan suatu bentuk private network yang melalui (tunnel]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Apa itu VPN</p>
<p style="text-align:justify;">Virtual Private Netwok (VPN) merupakan suatu bentuk private network yang melalui (tunneled) public network (internet), dengan menekankan pada keamanan data dan akes global melalui internet. Sebuah VPN memiliki kemampuan best-effort, atau memiliki Service Level Agreement (SLA) antara pelanggan VPN dengan provider layanan VPN. Secara umum, sebuah VPN memiliki topologi yang lebih kompleks dibanding point-to-point. Sebuah VPN memungkinkan pengguna komputer untuk mengakses jaringan lewat sebuah IP address yang berbeda dengan IP address sebenarnya yang dipakai untuk menghubungkan komputer pengguna ke internet.</p>
<p><!--more-->Cara Install OpenVPN di Ubuntu</p>
<div id="_mcePaste">brokenz@brokenz:~$ sudo aptitude install openvpn</div>
<div id="_mcePaste">[sudo] password for brokenz:</div>
<div id="_mcePaste">Reading package lists&#8230; Done</div>
<div id="_mcePaste">Building dependency tree</div>
<div id="_mcePaste">Reading state information&#8230; Done</div>
<div id="_mcePaste">Reading extended state information</div>
<div id="_mcePaste">Initializing package states&#8230; Done</div>
<div id="_mcePaste">The following NEW packages will be installed:</div>
<div id="_mcePaste">libpkcs11-helper1{a} openssl-blacklist{a} openvpn openvpn-blacklist{a}</div>
<div id="_mcePaste">0 packages upgraded, 4 newly installed, 0 to remove and 1 not upgraded.</div>
<div id="_mcePaste">Need to get 7854kB of archives. After unpacking 16.1MB will be used.</div>
<div id="_mcePaste">Do you want to continue? [Y/n/?] y</div>
<div id="_mcePaste">Writing extended state information&#8230; Done</div>
<div id="_mcePaste">Get:1 http://kambing.ui.ac.id jaunty/main openssl-blacklist 0.4.2ubuntu1 [6338kB]http://trikjos.wordpress.com/2009/07/02/install-avast-antivirus-di-ubuntu-8-04/</div>
<div id="_mcePaste">18% [1 openssl-blacklist 1467972/6338kB 23%]                   7178B/s 14min 49s</div>
<p>Apabila tampilan berakhir seperti ini maka anda sudah berhasil menginstall openvpn di komputer anda.</p>
<p>Unpacking libpkcs11-helper1 (from &#8230;/libpkcs11-helper1_1.05-1_i386.deb) &#8230;</p>
<p>Selecting previously deselected package openvpn-blacklist.</p>
<p>Unpacking openvpn-blacklist (from &#8230;/openvpn-blacklist_0.3_all.deb) &#8230;</p>
<p>Selecting previously deselected package openvpn.</p>
<p>Unpacking openvpn (from &#8230;/openvpn_2.1~rc11-1ubuntu3_i386.deb) &#8230;</p>
<p>Processing triggers for man-db &#8230;</p>
<p>Setting up openssl-blacklist (0.4.2ubuntu1) &#8230;</p>
<p>Setting up libpkcs11-helper1 (1.05-1) &#8230;</p>
<p>Setting up openvpn-blacklist (0.3) &#8230;</p>
<p>Setting up openvpn (2.1~rc11-1ubuntu3) &#8230;</p>
<p>* Restarting virtual private network daemon(s)&#8230;                               *   No VPN is running.</p>
<p>Processing triggers for libc6 &#8230;</p>
<p>ldconfig deferred processing now taking place</p>
<p>Reading package lists&#8230; Done</p>
<p>Building dependency tree</p>
<p>Reading state information&#8230; Done</p>
<p>Reading extended state information</p>
<p>Initializing package states&#8230; Done</p>
<p>Writing extended state information&#8230; Done</p>
<p>brokenz@brokenz:~$</p>
<p>Konfigurasi OpenVPN</p>
<p style="text-align:justify;">Sebelum melakukan konfigurasi langkah pertama yang kita lakukan adalah inisialisasi beberapa variabel system yang akan digunakan nanti. Ikuti langkah-langkah dibawah ini, pertama kita akan menginialisasi lokasi direktori dari OpenVPN, direktori /etc/openvpn merupakan tempat file konfigurasi, file privat keys server dan penyimpanan sertifikat digital server.</p>
<p>brokenz@brokenz:~$ export OPENVPN=/etc/openvpn</p>
<p style="text-align:justify;">Selanjutnya kita inisialisasi direktori yang akan digunakan untuk menyimpan file public keys dan privat keys yang nanti dihasilkan pada saat proses pembuatan keys.</p>
<p>brokenz@brokenz:~$ export KEY_DIR=$OPENVPN/keys</p>
<p style="text-align:justify;">Selanjutnya adalah inisialisasi dari panjang keys yang akan digunakan VPN nanti, yang perlu diingat disini adalah semakin panjang keys yang kita buat akan semakin tinggi tingkat security tapi akan berakibat semakin lama waktu koneksi yang akan kita butuhkan.</p>
<p>brokenz@brokenz:~$ export KEY_SIZE=1024</p>
<p style="text-align:justify;">Selanjutnya adalah inisialisasi kode negara, propinsi, kota, organisasi, email dan nama untuk digital certificate. Inisialisasi ini dibuat untuk mempersingkat waktu pembuatan digital certificate.</p>
<p>brokenz@brokenz:~$ export KEY_COUNTRY=ID</p>
<p>brokenz@brokenz:~$ export KEY_PROVINCE=&#8221;Jatim&#8221;</p>
<p>brokenz@brokenz:~$ export KEY_CITY=&#8221;Surabaya&#8221;</p>
<p>brokenz@brokenz:~$ export KEY_ORG=&#8221;OSUM&#8221;</p>
<p>brokenz@brokenz:~$ export KEY_EMAIL=&#8221;satriyaningjagat@gmail.com&#8221;</p>
<p>brokenz@brokenz:~$ export KEY_COMMON=&#8221;Lukman Prihandika&#8221;</p>
<p>brokenz@brokenz:~$ export KEY_CONFIG=$OPENVPN/openssl.conf</p>
<p style="text-align:justify;">Kemudian kita copy file openssl.conf di /usr/share/doc/openvpn/examples/easy-rsa/ ke direktori /etc/openvpn/</p>
<p>brokenz@brokenz:~$ su -</p>
<p>Password:</p>
<p>Script started, file is /var/log/activities/20091031-22:11.42-root.log</p>
<p>root@brokenz:~# cp /usr/share/doc/openvpn/examples/easy-rsa/2.0/openssl.cnf /etc/openvpn/</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Crea tu propia entidad certificadora]]></title>
<link>http://fsandin.wordpress.com/2009/10/15/crea-tu-propia-entidad-certificadora/</link>
<pubDate>Thu, 15 Oct 2009 20:51:34 +0000</pubDate>
<dc:creator>fsandin</dc:creator>
<guid>http://fsandin.wordpress.com/2009/10/15/crea-tu-propia-entidad-certificadora/</guid>
<description><![CDATA[Poco a poco, cada día van apareciendo en nuestra vida los certificados digitales que nos sirven para]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><img class="alignright" src="http://www.fnmt.es/content/imagenes/tarjetas/cert/criptografica.jpg" alt="" width="130" height="107" />Poco a poco, cada día van apareciendo en nuestra vida los certificados digitales que nos sirven para identificarnos y firmar de forma digital las acciones que realizamos en internet. Pero si lo que necesitas es tener unos cuantos certificados para realizar tus pruebas de programación, estarías muy limitado con los certificados que podrás obtener de forma gratuita.</p>
<p>Para ello lo mejor que puedes hacer es crear tu propia entidad certificadora, utilizando el proyecto OpenSSL. Con ello podrás generar tanto certificados de servidor como de cliente para poder hacer todas las pruebas que necesites. Vamos por partes:</p>
<p><img class="aligncenter" src="http://i279.photobucket.com/albums/kk139/fsandin/web/openssl.jpg" alt="" width="300" height="115" /></p>
<h2>Instalar el software</h2>
<p>Para instalar openSSL en linux, sólo es necesario introducir el siguiente comando en el terminal</p>
<pre>apt-get install openssl</pre>
<p>Para obtener la versión para Windows, puedes bajar los binarios desde <a href="http://www.openssl.org/related/binaries.html">aquí</a>.</p>
<p>Como ayuda para facilitar la creación de certificados crearemos los siguientes ficheros de configuración:</p>
<p><strong>config1.txt</strong> con el siguiente contenido</p>
<pre>basicConstraints = critical,CA:FALSE
extendedKeyUsage = serverAuth</pre>
<p><strong>config2.txt</strong> con el siguiente contenido</p>
<pre>basicConstraints = critical,CA:FALSE
extendedKeyUsage = clientAuth</pre>
<h2>Crear la entidad certificadora</h2>
<p>Los primero que hay que hacer es crear las claves de la entidad certificadora, que será la que genere el resto de certificados. Desde el terminal sólo tendrás que introducir la siguiente instrucción:</p>
<pre>openssl req -x509 -newkey rsa:2048 -keyout cakey.pem -days 3650 -out cacert.pem</pre>
<p>Lo que significa que estamos creando una nueva entidad que generará certificados X509 con algoritmo de encriptación rsa de 2048 bytes. Generará la clave privada de la entidad en el fichero<strong> cakey.pem</strong> y la clave publica en el <strong>cacert.pem</strong>.</p>
<p>El parámetro -days con <strong>3650</strong> indica que la entidad certificadora no expirará en 10 años.</p>
<p>Nos pedirá una contraseña para nuestra entidad certificadora, que es muy importante no perder. Nos pedirá también una serie de datos (País, Nombre de Empresa&#8230;), que nos identifica como entidad certificadora.</p>
<p>Este paso sólo es necesario realizarlo la primera vez, o cuando la entidad certificadora que teníamos haya expirado.</p>
<h2>Generar certificado de servidor</h2>
<p>Podemos crear tantos certificados de servidor como queramos, siguiendo estos pasos:</p>
<p>Primero generamos la clave privada del nuevo certificado digital:</p>
<pre>openssl genrsa -des3 -out serv-priv.pem -passout pass:<span style="color:#ff9900;"><strong>password</strong></span> 2048</pre>
<p>Con esto generamos la clave privada la cual tendrá un algoritmo de cifrado triple des (-des3) de 2048 y se almacenara en el fichero (-out) serv-priv.pem y con el comando -passout pass: indicamos la contraseña para nuestra clave privada.</p>
<p>El siguiente paso es generar la petición del certificado para indicar el propietario del mismo:</p>
<pre>openssl req -new -subj "<span style="color:#99cc00;">/DC=fsandin.wordpress.com/OU=wordpress.com/CN=fsandin</span>"
-key serv-priv.pem -passin pass:<strong><span style="color:#ff9900;">password</span></strong> -out petic-certificado-serv.pem</pre>
<p>Con el parametro <strong>-subj</strong> le indicamos a quien pertenece el certificado, para ello ponemos entre comillas cada uno de los apartados que identifican al servidor, separados por / . Le asociamos a la petición la clave privada que hemos hecho en el comando anterior <strong>-key serv-priv.pem</strong> utilizando la contraseña de la clave privada <strong>-passing pass:<span style="color:#ff9900;">password</span></strong>. La petición se almacenará en el fichero <strong>petic-certificado-serv.perm</strong></p>
<p>Por último generamos el certificado:</p>
<pre>openssl x509 -CA cacert.pem -CAkey cakey.pem -req -in petic-certificado-serv.pem
-days 3650 -extfile config1.txt -sha1 -CAcreateserial -out servidor-cert.pem</pre>
<p>Con esto estamos creando un certificado del tipo<strong> x509</strong> cuya entidad certificadora está en <strong>cacert.pem</strong>, su clave privada en <strong>cakey.pem</strong> y que el certificado a generar tendrá las especificaciones definidas en el apartado anterior, almacenadas en el fichero de petición <strong>petic-certificado-serv.pem</strong>.</p>
<p>El certificado tendrá una validez de diez años y su uso estará destinado para ser certificado de servidor (descrito en el fichero de configuración <strong>config1.txt</strong>)</p>
<p>Para algunos servidores (como apache), los ficheros necesarios para utilizar el certificado son <strong>servidor-cert.pem</strong> y <strong>serv-priv.pem</strong>. Para IIS se necesita realizar la importación, por lo que será necesario exportarlo con el siguiente comando.</p>
<pre>openssl pkcs12 -export -in servidor-cert.pem -inkey serv-priv.pem -certfile
cacert.pem -out cert-serv-pck12.p12</pre>
<h2>Generar certificado de cliente</h2>
<p>Igual que para los certificados para servidor, empezamos generando la clave privada del cliente:</p>
<pre>openssl genrsa -des3 -passout pass:<strong><span style="color:#ff9900;">password</span></strong> -out client-priv.pem 2048</pre>
<p>Ahora generamos la petición del certificado:</p>
<pre>openssl req -new -key client-priv.pem -passin pass:<strong><span style="color:#ff9900;">password</span></strong> -subj
"<span style="color:#99cc00;">/CN=NOMBRE Nombre y Apellidos - NIF 00000000A/OU=wordpress.com
/DN=fsandin.wordpress.com</span>" -out petic-cert-client.pem</pre>
<p>Si estructuramos el parámetro -subj igual que los certificados de identificación (DNIe, FNMT&#8230;) le indicamos a quién pertenece el certificado y podremos simular el comportamiento de los mismos.</p>
<p>Emitimos el certificado cliente :</p>
<pre>openssl x509 -CA cacert.pem -CAkey cakey.pem -req -in petic-cert-client.pem
-set_serial <strong><span style="color:#ff9900;">3</span></strong> -days 365 -extfile config2.txt -sha1 -out client-cert.pem</pre>
<p>El certificado tendrá una validez de un año, el número de certificado indicado con el parámetro <strong>-set_serial</strong> debería ser único.</p>
<p>Al ejecutar esta línea nos pedirá el password que le pusimos a nuestra entidad certificadora obteniendo finalmente el fichero client-cert.pem que es nuestro certificado.</p>
<p>Y por último vamos a exportarlo para enviárselo a su nuevo dueño. Para ello necesitamos crear con nuestro certificado un fichero comprimido en formato <strong>pkcs12</strong>.</p>
<pre>openssl pkcs12 -export -in client-cert.pem -inkey client-priv.pem
-certfile cacert.pem -out cert-cliente-pck12.p12</pre>
<p>Al ejecutar esto nos pedirá la contraseña del certificado cliente, un Export Password, que es la contraseña que teneis que poner para comprimir el archivo y que será la que se necesita para importarla en el navegador. Por último pedirá que verifiquéis el Export Password para confirmar que se ha introducido correctamente.</p>
<p>Fuente: <a href="http://www.bulma.net/impresion.phtml?nIdNoticia=2280">bulma.net</a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Network Security with OpenSSL]]></title>
<link>http://esal.wordpress.com/2009/10/15/network-security-with-openssl/</link>
<pubDate>Thu, 15 Oct 2009 08:31:07 +0000</pubDate>
<dc:creator>esal</dc:creator>
<guid>http://esal.wordpress.com/2009/10/15/network-security-with-openssl/</guid>
<description><![CDATA[Network Security with OpenSSL By Pravir Chandra , Matt Messier, John Viega Publisher : O&#8217;Reill]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p style="text-align:center;"><strong>Network Security with OpenSSL</strong></p>
<p style="text-align:center;">By Pravir Chandra , Matt Messier, John Viega</p>
<p><img class="aligncenter size-full wp-image-1099" title="Network Security with OpenSSL - Pravir Chandra, Matt Messier" src="http://esal.wordpress.com/files/2009/10/network-security-with-openssl-pravir-chandra-matt-messier.jpg" alt="Network Security with OpenSSL - Pravir Chandra, Matt Messier" width="289" height="380" /></p>
<p style="text-align:center;"><span style="color:#0000ff;"><a href="http://www.ziddu.com/download/6777357/tworkSecuritywithOpenSSL-PravirChandraMattMessier.pdf.html"><img src="http://bse.depdiknas.go.id/images_gif/download.gif" border="0" alt="" width="91" height="31" /></a></span></p>
<address>Publisher : O&#8217;Reilly </address>
<address>Pub Date : June 2002<br />
ISBN : 0-596-00270-X </address>
<address>Pages : 384</address>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[ Implementing a secure web server using CentOS, Apache, PHP, MySQL, OpenSSL, &amp; Drupal]]></title>
<link>http://traviskuennen.wordpress.com/2009/10/12/implementing-a-secure-web-server-using-centos-apache-php-mysql-openssl-drupal/</link>
<pubDate>Mon, 12 Oct 2009 03:21:22 +0000</pubDate>
<dc:creator>traviskuennen</dc:creator>
<guid>http://traviskuennen.wordpress.com/2009/10/12/implementing-a-secure-web-server-using-centos-apache-php-mysql-openssl-drupal/</guid>
<description><![CDATA[Below are the procedures to install a LAMP stack the easy way using YUM. I prefer to remove the pre ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><strong>Below are the procedures to install a LAMP stack the easy way using YUM. I prefer to remove the pre packaged RMPs, and compile the libraries manually however this can be a lengthy process. With that in mind here is the easy way!</strong></p>
<p>Section 1 (Operating System Installation)<br />
1.1 If you have not already installed CentOS, use the configuration options below.<br />
1.2 If you have a fully functional OS up and running, check the settings below.</p>
<p>Section 2 (Installation of Apache)<br />
2.1 Download and install apache.<br />
<code>yum install httpd httpd-devel httpd-server</code><br />
2.2 Configure Apache to start on all run levels<br />
<code>chkconfig --level 012345 httpd on</code><br />
2.3 (optional step) Enable clean URLs<br />
<code>vi /etc/httpd/conf/httpd.conf</code><br />
Add the following lines to the modules section<br />
<code>LoadModule rewrite_module modules/mod_rewrite.so<br />
AddModule mod_rewrite.c</code><br />
Add the following lines to your virtual host<br />
<code>Directory /var/www/example.com<br />
RewriteEngine on<br />
RewriteBase /<br />
RewriteCond %{REQUEST_FILENAME} !-f<br />
RewriteCond %{REQUEST_FILENAME} !-d<br />
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]<br />
/Directory</code></p>
<p>Section 3 (Installation of MySQL)<br />
3.1 Download and install MySQL Server<br />
<code>yum install mysql mysql-devel mysql-server</code><br />
3.2 Change config to start MySQL at all run levels.<br />
<code>chkconfig --level 012345 mysqld on</code><br />
3.3 Start the MySQL server<br />
<code>/etc/init.d/mysqld start</code><br />
3.4 Change the root password<br />
<code>/usr/bin/mysqladmin -u root password 'new-password'<br />
/usr/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'</code></p>
<p>Section 4 (Installation of programming libraries)<br />
4.1 Download and install the PHP, Perl, and Python Libraries<br />
(Note you may only need PHP)<br />
<code>yum install perl perl-devel<br />
yum install php php-mysql php-devel php-mbstring php-mcrypt php-gd</code><br />
4.2 Edit the php config file<br />
<code>vi /etc/php.ini</code><br />
Change the memory limit to 128MB<br />
<code>memory_limit = 16M --&#62; 128M</code><br />
Enable mbstring<br />
<code>;mbstring.http_input = auto</code></p>
<p>Section 5 (Installation of OpenSSL)<br />
5.1 Download and install OpenSSL<br />
yum install openssl<br />
5.2<br />
openssl genrsa 1024 &#62; is418.key<br />
5.3<br />
chmod 400 is418.key<br />
5.4<br />
openssl req -new -x509 -nodes -sha1 -days 50 -key is418.key &#62; is418.cert<br />
5.5<br />
Country Name (2 letter code) [GB]:US<br />
State or Province Name (full name) [Berkshire]:Colorado<br />
Locality Name (eg, city) [Newbury]:Denver<br />
Organization Name (eg, company) [My Company Ltd]:is418 @ ITT-Tech<br />
Organizational Unit Name (eg, section) []:B Team<br />
Common Name (eg, your name or your server&#8217;s hostname) []:node1.bteam.is418.net<br />
Email Address []:tkuennen@ieee.org</p>
<p>Section 6 (Installation of PHPMyAdmin)<br />
Download and install PHPMyAdmin<br />
6.1 Promote yourself to root<br />
su -<br />
6.2 Change to your web directory<br />
cd /var/www/html<br />
6.3 Download PHPMyAdmin<br />
wget -c http://prdownloads.sourceforge.net/phpmyadmin/phpMyAdmin-2.11.9.5-englis&#8230;<br />
6.4 Unzip the package<br />
tar xvfz phpMyAdmin-2.11.9.5-english.tar.gz<br />
6.5 Move the install directory to a human readable format<br />
mv phpMyAdmin-2.11.9.5-english phpmyadmin<br />
6.6 Change to the phpmyadmin directory<br />
cd phpmyadmin<br />
6.7 Copy the samle php file to the running config file<br />
cp config.sample.inc.php config.inc.php<br />
6.8. Open the new config file and edit the server string<br />
vi config.inc.php<br />
:<br />
$cfg['Servers'][$i]['auth_type'] = ‘http‘; # default is cookies<br />
:<br />
6.9. Restart Apache<br />
/etc/init.d/httpd restart</p>
<p>Test the installation by navigating to your web server via a browser.<br />
https://your.domain.com/phpmyadmin/</p>
<p>Section 7 (Installing Drupal)<br />
7.1 Download Drupal<br />
wget http://drupal.org/files/projects/drupal-x.x.tar.gz<br />
7.2 Extract the package<br />
tar -zxvpf drupal-x.x.tar.gz<br />
7.3 Move the files to the /var/www/html directory<br />
mv drupal-x.x/* drupal-x.x/.htaccess /var/www/html<br />
7.4 Create the settings file from the template<br />
cp /var/www/html/default.settings.php /var/www/html/setting.php<br />
7.5 Change permissions for the installation process<br />
chmod a+w sites/default/settings.php<br />
7.6 Create the database<br />
mysqladmin -u username -p create databasename<br />
7.7 Run the install script<br />
point to https://localhost and follow the onscreen instructions</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Amazon AWS Signatures]]></title>
<link>http://matthewneale.net/2009/10/11/amazon-aws-signatures/</link>
<pubDate>Sun, 11 Oct 2009 18:56:46 +0000</pubDate>
<dc:creator>Matt</dc:creator>
<guid>http://matthewneale.net/2009/10/11/amazon-aws-signatures/</guid>
<description><![CDATA[Last Thursday I presented an afternoon overview on Web Services to a group. We were using soapUI to ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Last Thursday I presented an afternoon overview on Web Services to a group. We were using <a href="http://www.soapui.org/">soapUI</a> to demonstrate some SOAP Web Services written for a customer, and I wanted to demonstrate also that it is just as easy to call public services which are remote. For this I chose the <a href="https://affiliate-program.amazon.com/gp/advertising/api/detail/main.html">Amazon Product Advertising API</a>, partly due to the fact that it’s already an example on Eviware’s soapUI <a href="http://www.soapui.org/gettingstarted/your_first_soapUI_project.html">website</a>, and partly because Amazon is such a well-known company. This post is a very short follow-up to explain how to do properly, something which I had to use a nasty workaround for during the afternoon.</p>
<p>The problem was the signature required in the header of the SOAP request, which I had to drop-to an executable I had written to generate. I would rather have used an off-the-shelf tool, but I couldn’t get <a href="http://www.openssl.org/">openssl</a> to work (completely due to user-error you understand).</p>
<p>I knew it was one of a few gotchas that was giving me the problem but I didn&#8217;t have the time to figure it out. Now I have, so what follows is, in as few a number of steps as I can manage, a 1-2-3 of how to send a request to the Amazon Product Advertising API.</p>
<p>Before we begin, <a href="http://aws.amazon.com/">sign-up</a> to Amazon AWS. Amazon will send you an email &#8211; follow the link provided in the email and grab your <em>AWS Access Key ID</em> and <em>Secret Access Key</em> and paste them somewhere &#8211; we’ll need them in a moment.</p>
<p>To send a SOAP request (without WS-Security):</p>
<ol>
<li>Run soapUI</li>
<li>Create a new project with the Product Advertising API&#8217;s WSDL by entering the URL:</li>
</ol>
<p style="padding-left:60px;"><a href="http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl">http://webservices.amazon.com/AWSECommerceService/<br />
AWSECommerceService.wsdl</a></p>
<ol start="3">
<li>In the Navigator pane on the left of the soapUI main window, find the request for the <em>ItemSearch</em> action and paste in:</li>
</ol>
<pre class="brush: xml;">
&#60;soapenv:Envelope xmlns:soapenv=&#34;http://schemas.xmlsoap.org/soap/envelope/&#34; xmlns:ns=&#34;http://webservices.amazon.com/AWSECommerceService/2009-10-01&#34;&#62;
   &#60;soapenv:Header xmlns:aws=&#34;http://security.amazonaws.com/doc/2007-01-01/&#34;&#62;
      &#60;aws:AWSAccessKeyId&#62;?&#60;/aws:AWSAccessKeyId&#62;
      &#60;aws:Timestamp&#62;?&#60;/aws:Timestamp&#62;
      &#60;aws:Signature&#62;?&#60;/aws:Signature&#62;
   &#60;/soapenv:Header&#62;
   &#60;soapenv:Body&#62;
      &#60;ns:ItemSearch&#62;
         &#60;ns:AWSAccessKeyId&#62;?&#60;/ns:AWSAccessKeyId&#62;
         &#60;ns:Shared&#62;
            &#60;ns:SearchIndex&#62;DVD&#60;/ns:SearchIndex&#62;
         &#60;/ns:Shared&#62;
         &#60;ns:Request&#62;
            &#60;ns:Title&#62;Allo Allo&#60;/ns:Title&#62;
         &#60;/ns:Request&#62;
      &#60;/ns:ItemSearch&#62;
   &#60;/soapenv:Body&#62;
&#60;/soapenv:Envelope&#62;
</pre>
<ol start="4">
<li>Replace the search criteria if you don’t wish to search for Allo Allo DVDs (I do &#8211; it is hilarious)</li>
<li>Insert your <em>AWS Access Key ID</em> in the two places provided.</li>
<li>Choose a date and time for the timestamp. Right now will do.</li>
<li>Concatenate the name of the action you are invoking and the timestamp in the format YYYY-MM-DDTHH:MM:SSZ, e.g. ItemSearch2009-10-11T16:11:30Z.</li>
<li>Generate the signature using <em>openssl</em> as follows, inserting your <em>Secret Access Key</em> where indicated:</li>
</ol>
<p style="padding-left:60px;">$ echo -n ItemSearch2009-10-11T16:11:30Z &#124; openssl dgst -sha256 -hmac <em>secret_access_key</em> -binary &#124; openssl enc -base64</p>
<ol start="9">
<li>Paste the timestamp and the signature into the request where indicated and click the ‘Play’ button in soapUI to send the request. If all is well you&#8217;ll get a set of results from Amazon.</li>
</ol>
<p>If you don’t have <em>openssl</em> you can download it from <a href="http://www.openssl.org/">http://www.openssl.org/</a>. There are links to binaries there, including for Windows.</p>
<p>The -n option to <em>echo</em> is very important, and was where my problem lay. On UNIX it suppresses the carriage return &#8211; important since we don&#8217;t want a carriage return as part of the text to be signed. On Windows however there is no equivalent (to my knowledge) and including the carriage return gives the wrong signature.</p>
<p>My best suggestion for a workaround for Windows is as follows. Open up notepad and write the text to be signed &#8220;ItemSearch2009-10-11T16:11:30Z&#8221; into it with no newline after. Save it, making sure to save with ANSI encoding (an option in the Save Dialog). Then at the prompt, execute the following command, again inserting your <em>Secret Access Key</em> where indicated, and the filename of the file that you just created.</p>
<p style="padding-left:60px;">$ openssl dgst -sha256 -hmac <em>secret_access_key</em> -binary <em>filename</em> &#124; openssl enc -base64</p>
<p>If you’re not using <em>openssl</em>, or you just want verification, assuming the hypothetical <em>Secret Access Key</em> of 1234, I get the following:</p>
<p style="padding-left:60px;">$ echo -n ItemSearch2009-10-11T16:11:30Z &#124; openssl dgst -sha256 -hmac 1234 -binary &#124; openssl enc -base64</p>
<p style="padding-left:60px;">FRnAn5puzTwI47vJ33sQHYQ9SSSIBjChTKd8u8Mbfs4=</p>
<p>If you’re getting the same then you’re okay <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Full documentation of the Amazon Web Services security can be found <a href="http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/index.html?RequestAuthenticationArticle.html">here</a>.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Wget and https]]></title>
<link>http://finkers.wordpress.com/2009/10/06/wget-and-https/</link>
<pubDate>Tue, 06 Oct 2009 19:10:03 +0000</pubDate>
<dc:creator>monipol</dc:creator>
<guid>http://finkers.wordpress.com/2009/10/06/wget-and-https/</guid>
<description><![CDATA[GNU Wget is a popular file download program, being installed by default on many Linux distributions.]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><a title="GNU Wget" href="http://www.gnu.org/software/wget/">GNU Wget</a> is a popular file download program, being installed by default on many Linux distributions. Recent Mac OS versions don&#8217;t ship Wget, though – Apple ships <a title="cURL" href="http://curl.haxx.se">cURL</a> instead.</p>
<p>Fink provides a wget package that installs Wget. It includes SSL (https) support provided by Mac OS built-in OpenSSL.  There&#8217;s a problem with that, though: on Mac OS versions earlier than 10.6, Apple&#8217;s OpenSSL doesn&#8217;t use the trusted root certificates available on the system (the ones listed by Keychain.app), so it is not able to validate SSL certificates on its own. Note that OpenSSL itself (independently of being shipped with Mac OS) isn&#8217;t distributed with root certificates by default.</p>
<p>Because of this, on Mac OS versions earlier than 10.6 the command</p>
<pre>wget https://fedorahosted.org</pre>
<p>won&#8217;t work:</p>
<pre>ERROR: cannot verify fedorahosted.org's certificate,
issued by `/C=US/O=Equifax/OU=Equifax Secure
Certificate Authority':
Unable to locally verify the issuer's authority.
To connect to fedorahosted.org insecurely, use
`--no-check-certificate'.
Unable to establish SSL connection.</pre>
<p>There are a couple of options to circumvent this. As the error message says, it&#8217;s possible to use &#8211;no-check-certificate, which is insecure. Another option is &#8211;ca-certificate=file where file is a bundle of trusted certification authority certificates. Fink provides a package called ca-bundle that installs a convenient file containing a bundle of CA certificates commonly used by open source Web browsers. After running</p>
<pre>fink install ca-bundle</pre>
<p>you should be able to use /sw/etc/ssl/certs/ca-bundle.crt with Wget:</p>
<pre>wget --ca-certificate=/sw/etc/ssl/certs/ca-bundle.crt \
https://fedorahosted.org</pre>
<p>Fortunately, you may specify that option in one of <a title="Wget startup files" href="http://www.gnu.org/software/wget/manual/html_node/Startup-File.html">Wget&#8217;s startup files</a> (e.g. $HOME/.wgetrc or /sw/etc/wgetrc) by adding the following line to your startup file of choice:</p>
<pre>ca_certificate = /sw/etc/ssl/certs/ca-bundle.crt</pre>
<p>And voilà!, you may use wget as usual:</p>
<pre>wget https://fedorahosted.org</pre>
<p>This is particularly useful if you&#8217;re using Wget as your <a title="Fink User's Guide - Download Settings" href="http://www.finkproject.org/doc/users-guide/conf.php#downloading">DownloadMethod</a> and Fink needs to download a source file from an https URL.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Enviar emails con PHPMailer y Gmail]]></title>
<link>http://enbuscaycaptura.wordpress.com/2009/10/04/enviar-emails-con-phpmailer-y-gmail/</link>
<pubDate>Sun, 04 Oct 2009 23:15:03 +0000</pubDate>
<dc:creator>enbuscaycaptura</dc:creator>
<guid>http://enbuscaycaptura.wordpress.com/2009/10/04/enviar-emails-con-phpmailer-y-gmail/</guid>
<description><![CDATA[PHPMailer es una clase php para enviar emails basada en el componente active server ASPMail. Permite]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><a href="http://enbuscaycaptura.wordpress.com/files/2009/10/logo.jpg"><img class="aligncenter size-full wp-image-227" title="logo" src="http://enbuscaycaptura.wordpress.com/files/2009/10/logo.jpg" alt="logo" width="360" height="83" /></a></p>
<p>PHPMailer es una clase php para enviar emails basada en el componente active server ASPMail. Permite de una forma sencilla tareas complejas como por ejemplo:</p>
<ul>
<li>Enviar mensajes de correo con ficheros adjuntos (attachments)</li>
<li>Enviar mensajes de correo en formato HTML</li>
</ul>
<p>Con PHPMailer se pueden enviar emails vía sendmail, PHP mail(), o con <a href="http://es.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol" target="_blank">SMTP</a>.</p>
<p>Entre las nuevas cualidades esta la posibilidad de enviar Emails utilizando el servidor SMTP de Gmail, con lo cual resolvemos el problema de no tener un servidor SMTP para hacer los envíos.<!--more--></p>
<p>Para hacer una prueba de como enviar emails  utilizando el servidor SMTP de Gmail necesitamos:</p>
<ul>
<li>Un servidor local instalado como puede ser XAMPP</li>
<li>Tener instalado <a href="http://es.wikipedia.org/wiki/OpenSSL" target="_blank">OpenSSL</a> (XAMPP ya incorpora esa librería) <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
<li><a href="http://phpmailer.worxware.com/index.php?pg=sf&#38;p=dl" target="_blank">PHPMailer</a>(la versión en este ejemplo es la v5 )</li>
<li>Una Cuenta de Gmail</li>
</ul>
<p>Lo primero será descomentar de php.ini la librería openSSL , guardar cambios y reiniciar el servidor. (quitar el ; de delante)</p>
<p><code>;extension=php_openssl.dll</code></p>
<p>Una vez descargarda la librería PHPMailer  y creada nuestra cuenta de Gmail, descomprimimos la carpeta que contiene las librerías.</p>
<p>Abrimos un editor e introducimos el código siguiente.</p>
<p><code>&#60;?php<br />
include_once('./phpmailerv5/class.phpmailer.php'); //incluimos la ruta a la clase phpmailer</code></p>
<p><code>$mail = new PHPMailer();<br />
$mail-&#62;IsSMTP();// envío vía SMTP</code></p>
<p><code>$mail-&#62;SMTPAuth = true; // turn on SMTP authentication<br />
$mail-&#62;SMTPSecure = "ssl"; // sets the prefix to the server<br />
$mail-&#62;Host = 'smtp.gmail.com';<br />
$mail-&#62;Port = 465;</p>
<p>$mail-&#62;Username = 'tu_cuenta@gmail.com'; // SMTP username</p>
<p>$mail-&#62;Password = '*********';// SMTP password</p>
<p>$mail-&#62;IsHTML(true); // send as HTML</p>
<p></code></p>
<p><code>$mail-&#62;Body="&#60;P&#62;Email utilizando PHPMailer y Gmail&#60;/P&#62;  ";   // cuerpo del mensaje</p>
<p></code></p>
<p><code>// Introducimos la información del remitente del mensaje</code></p>
<p><code>$mail-&#62;From       = "tu_cuenta@gmail.com";   // se puede usar la misma cuenta u otra<br />
$mail-&#62;FromName   = "Nombre Remite";//Asunto<br />
$mail-&#62;Subject    = "PHPMailer Test Gmail";</p>
<p></code></p>
<p><code>// y los destinatarios del mensaje. Podemos especificar más de un destinatario<br />
$mail-&#62;AddAddress('destino@mail.com','nombre_destinatario');<br />
$mail-&#62;AddAttachment("ruta/images/phpmailer.gif");// adjuntamos un imagen o un file   opcional</p>
<p>// se notifica si se ha enviado o no</p>
<p>if(!$mail-&#62;Send()) {</p>
<p>echo "Error de envío: " . $mail-&#62;ErrorInfo;</p>
<p>} else {</p>
<p>echo "El mensaje ha sido enviado con éxito";</p>
<p>}</p>
<p>?&#62;</p>
<p></code></p>
<p>Guardamos el script con un nombre (ej. mail.php) y nos vamos a nuestro localhost y lo ejecutamos.</p>
<p>Si queremos mandar un email con imágenes adjuntas y un diseño más completo tan solo tenemos que diseñar un documento html con cualquier editor, por ejemplo dreamweaver, e incluirlo en nuestro script de la siguiente manera.</p>
<p><code>&#60;?php<br />
include_once ('./phpmailerv5/class.phpmailer.php'); //incluimos la clase phpmailer<br />
$mail = new PHPMailer();<br />
$mail-&#62;IsSMTP(); // send via SMTP<br />
$mail-&#62;SMTPAuth = true; // turn on SMTP authentication<br />
$mail-&#62;SMTPSecure = "ssl"; // sets the prefix to the server<br />
$mail-&#62;Host = 'smtp.gmail.com';<br />
$mail-&#62;Port = 465;<br />
$mail-&#62;Username = 'tu_cuenta@gmail.com'; // SMTP username<br />
$mail-&#62;Password = '**********'; // SMTP password<br />
$mail-&#62;AltBody = 'Para ver el mensaje use un visor de email compatible con HTML'; // mensaje opcional</p>
<p>// importar contenido de un html para incluirlo en el mail<br />
$mail-&#62;MsgHTML(file_get_contents('archivo.html')); // incluir ruta archivo html<br />
$mail-&#62;AddAttachment('images/phpmailer.gif'); // incluir ruta de imagenes que usa el archivo html<br />
$mail-&#62;AddAttachment('images/phpmailer_mini.gif'); // incluir ruta de imagenes que usa el archivo html</p>
<p>// Introducimos la información del remitente del mensaje<br />
$mail-&#62;From = "remitente@gmail.com";<br />
$mail-&#62;FromName = "nombre_remite";</p>
<p>//Asunto<br />
$mail-&#62;Subject = "Email de prueba con imágenes";</p>
<p>// y los destinatarios del mensaje. Podemos especificar más de un destinatario<br />
$mail-&#62;AddAddress('destino@gmail.com', 'nombre_destino');</p>
<p>if (!$mail-&#62;Send()) {<br />
echo "Error de envío: " . $mail-&#62;ErrorInfo;<br />
} else {<br />
echo "Mensaje enviado con éxito";<br />
}</p>
<p>?&#62;</p>
<p></code></p>
<p>Guardamos el script con un nombre (ej. mail2.php) y nos vamos a nuestro localhost y lo ejecutamos.</p>
<p>el resultado de su envío sería el siguiente:</p>
<p><a href="http://enbuscaycaptura.wordpress.com/files/2009/10/mail.jpeg"><img class="aligncenter size-full wp-image-234" title="mail" src="http://enbuscaycaptura.wordpress.com/files/2009/10/mail.jpeg" alt="mail" width="600" height="375" /></a></p>
<p>Y eso es todo.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[[security] Encrypt files in the command line using OpenSSL]]></title>
<link>http://nixtricks.wordpress.com/2009/10/03/security-encrypt-files-in-the-command-line-using-openssl/</link>
<pubDate>Sat, 03 Oct 2009 20:39:10 +0000</pubDate>
<dc:creator>kousik</dc:creator>
<guid>http://nixtricks.wordpress.com/2009/10/03/security-encrypt-files-in-the-command-line-using-openssl/</guid>
<description><![CDATA[In order to make our life easier, first let&#8217;s create two aliases to encrypt (sslenc) and decry]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>In order to make our life easier, first let&#8217;s create two aliases to encrypt (sslenc) and decrypt (ssldec) files in the command line using OpenSSL, respectively:</p>
<div style="border:1px dotted black;padding:1em;"><code> $ alias sslenc='openssl aes-256-cbc -salt -a'<br />
$ alias ssldec='openssl aes-256-cbc -d -a'<br />
</code></div>
<p>In order to encrypt a file, say <em>filename.txt</em>, you should do something like this:</p>
<div style="border:1px dotted black;padding:1em;"><code>$  sslenc -in filename.txt -out filename.txt.enc &#38;&#38; rm -f filename.txt</code></div>
<p>which first encrypts the input file to <em>filename.txt.enc</em> (&#8220;enc&#8221; suffix  is there just to tell you that it is encrypted) and then the <code>rm</code> command removes the input file.  To decrypt it into <em>new_filename.txt</em> use the following:</p>
<div style="border:1px dotted black;padding:1em;"><code> $ ssldec -in filename.txt.enc -out new_filename.txt</code></div>
<p><span style="color:#ffffff;">.</span></p>
<p>Now back to  beginning: let&#8217;s explain the various flags in the aliases given in the top:</p>
<ul>
<li><code>aes-256-cbc</code>: a command to encrypt using the  <a href="http://en.wikipedia.org/wiki/Advanced_Encryption_Standard">Advanced Encryption Standard</a> cipher with key size of 256 bit, which makes use of the <a href="http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher-block_chaining_.28CBC.29">Cipher-Block Chaining</a> mode. Currently aes-256-cbc is the the standard cipher choice of the US government. You may change this command (i.e., &#8220;<code>aes-256-cbc</code>&#8221;) by &#8220;<code>enc -aes-256-cbc</code>&#8221; which means the same thing, but in a longhand: encrypt (enc) using the cipher, aes-256-cbc.</li>
<li><code>-salt</code>: adds strength to the encryption and should always be used. (see wikipedia page for <a href="http://en.wikipedia.org/wiki/Salt_%28cryptography%29">salt</a>).</li>
<li><code>-a</code>: indicates that the encrypted output will be base64 encoded, this allows you to view it in a text editor or paste it in an email (optional).</li>
<li><code>-d</code>: for file decryption.</li>
</ul>
<p>You may also be interested in the <a href="http://en.wikipedia.org/wiki/Key_size">wikipedia article</a> which talks about the key size.</p>
<p><strong>Reference:</strong> <a href="http://tombuntu.com/index.php/2007/12/12/simple-file-encryption-with-openssl/" target="_blank">link</a>.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[[Solved] ssl_error_rx_record_too_long]]></title>
<link>http://wildanm.wordpress.com/2009/09/17/ssl_error_rx_record_too_long/</link>
<pubDate>Thu, 17 Sep 2009 06:01:04 +0000</pubDate>
<dc:creator>Wildan Maulana</dc:creator>
<guid>http://wildanm.wordpress.com/2009/09/17/ssl_error_rx_record_too_long/</guid>
<description><![CDATA[Update : After disable all the virtual host, and enable only the secure one (using the configuration]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><strong>Update : </strong></p>
<p>After disable all the virtual host, and enable only the secure one (using the configuration below), everything work as expected.</p>
<p>To make sure, the server talk in a secure mode (using ssl), try access the server using http://</p>
<p><strong>http://openthinklabs.wm:443</strong></p>
<p>If you receive a bad request information from the browser, like the one below :</p>
<p><a href="http://wildanm.wordpress.com/files/2009/09/bad_request.png"><img src="http://wildanm.wordpress.com/files/2009/09/bad_request.png" alt="bad_request" title="bad_request" width="500" height="312" class="aligncenter size-full wp-image-1009" /></a></p>
<p>Your ssl configuration is correct. </p>
<p>If you see plain text, you willl get <strong>ssl_error_rx_record_too_long</strong> error when accessing the page using https. </p>
<hr />
<p>After following tutorial at [1] i get ssl_error_rx_record_too_long error. </p>
<p><a href="http://wildanm.wordpress.com/files/2009/09/ssl_error_rx_record_too_long.png"><img src="http://wildanm.wordpress.com/files/2009/09/ssl_error_rx_record_too_long.png" alt="ssl_error_rx_record_too_long" title="ssl_error_rx_record_too_long" width="500" height="312" class="aligncenter size-full wp-image-1006" /></a>. </p>
<p>Didn&#8217;t find any solution yet &#8230;</p>
<p>Here is my virtual host setting :</p>
<pre class="brush: php;">
NameVirtualHost *:443
&lt;VirtualHost *:443&gt;
	ServerAdmin wildan.m@gmail.com
        ServerName openthinklabs.wm

	DocumentRoot /home/wildan/jobstuff/OpenThinkLabs/webapps/openthinklabs

	&lt;Directory &quot;/home/wildan/jobstuff/OpenThinkLabs/webapps/openthinklabs&quot;&gt;
		Options Indexes FollowSymLinks MultiViews
		AllowOverride All
		Order allow,deny
		allow from all
		# This directive allows us to have apache2's default start page
                # in /apache2-default/, but still have / go to the right place
                #RedirectMatch ^/$ /apache2-default/
	&lt;/Directory&gt;

	ErrorLog /var/log/apache2/openthinklabs_error.log

	# Possible values include: debug, info, notice, warn, error, crit,
	# alert, emerg.
	LogLevel debug

	CustomLog /var/log/apache2/openthinklabs.log combined
ServerSignature On

SSLEngine On
SSLCertificateFile /etc/apache2/ssl.cert/server.crt
SSLCertificateKeyFile /etc/apache2/ssl.key/server.key

#SSLCertificateChainFile /etc/apache2/ssl.cert/my-ca.crt
#SSLCACertificateFile /etc/apache2/ssl.cert/my-ca.crt

JkMount /alfresco ajp13
JkMount /alfresco/* ajp13

JkMount /cas ajp13
JkMount /cas/* ajp13

&lt;Location /alfresco&gt;
AuthType CAS
AuthName &quot;CAS&quot;
require valid-user
CASScope /alfresco
&lt;/Location&gt;

&lt;Location /share&gt;
AuthType CAS
AuthName &quot;CAS&quot;
require valid-user
CASScope /share
&lt;/Location&gt;

&lt;Location /examples&gt;
AuthType CAS
AuthName &quot;CAS&quot;
require valid-user
CASScope /examples
&lt;/Location&gt;

&lt;/VirtualHost&gt;
</pre>
<p><strong>References :</strong></p>
<p>[1]. <a href="http://www.tc.umn.edu/~brams006/selfsign.html">http://www.tc.umn.edu/~brams006/selfsign.html</a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[howto: generate RSA public/private key using openssl]]></title>
<link>http://kasolutions.wordpress.com/2009/07/30/howto-generate-rsa-publicprivate-key-using-openssl/</link>
<pubDate>Thu, 30 Jul 2009 06:05:49 +0000</pubDate>
<dc:creator>aneeska</dc:creator>
<guid>http://kasolutions.wordpress.com/2009/07/30/howto-generate-rsa-publicprivate-key-using-openssl/</guid>
<description><![CDATA[Its easier than you think it is! Here&#8217;s what you should do 1. create a private key of N bit lo]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Its easier than you think it is!</p>
<p>Here&#8217;s what you should do</p>
<p style="padding-left:30px;">1. create a private key of N bit long</p>
<p style="padding-left:30px;">2. extract public key from the private key juist generated</p>
<h3>Details</h3>
<p>Now the HOW</p>
<p>Create a Private key</p>
<p style="padding-left:30px;"><em>$ openssl genrsa -out privatekey.txt 1024</em></p>
<p style="padding-left:60px;"><em>- genrsa tells openssl to generate the private key of 1024 bit long modulus and save it into the files privatekey.txt</em></p>
<p>Extract Public key from the Private key</p>
<p style="padding-left:30px;"><em>$ openssl rsa -in privatekey.txt -pubout -out publickey.txt</em></p>
<p style="padding-left:60px;"><em>- pubout argument tells openssl to extract the publib key from the private key stored in the files privatekey.txt and store it in the file publickey.txt</em></p>
<p><a href="http://en.wikipedia.org/wiki/DomainKeys_Identified_Mail" target="_blank">DKIM</a> is a posible application of them.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[POC Oracle Data Guard : Day 2]]></title>
<link>http://ardhian.wordpress.com/2009/07/23/poc-oracle-data-guard-day-2/</link>
<pubDate>Thu, 23 Jul 2009 00:55:55 +0000</pubDate>
<dc:creator>ardhian</dc:creator>
<guid>http://ardhian.wordpress.com/2009/07/23/poc-oracle-data-guard-day-2/</guid>
<description><![CDATA[Projek POC Oracle Data Guard di kantor memasuki hari kedua. Kemaren tim CTI sudah melakukan konfigur]]></description>
<content:encoded><![CDATA[Projek POC Oracle Data Guard di kantor memasuki hari kedua. Kemaren tim CTI sudah melakukan konfigur]]></content:encoded>
</item>
<item>
<title><![CDATA[Instalar Apache2 con SSL en Ubuntu 9.04 (Jaunty)]]></title>
<link>http://elreinodelterror.wordpress.com/2009/07/21/instalar-apache2-con-ssl-en-ubuntu-9-04-jaunty/</link>
<pubDate>Tue, 21 Jul 2009 23:13:34 +0000</pubDate>
<dc:creator>jenarocenteno</dc:creator>
<guid>http://elreinodelterror.wordpress.com/2009/07/21/instalar-apache2-con-ssl-en-ubuntu-9-04-jaunty/</guid>
<description><![CDATA[Esta es una guía para ayudar en la instalación de Apache2 con soporte para SSL en un servidor Ubuntu]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Esta es una guía para ayudar en la instalación de Apache2 con soporte para SSL en un servidor Ubuntu 9.04 (Jaunty). Esta guía asume que para esto ya se tiene instalado un stack LAMP (Linux, Apache, MySQL y PHP) en la máquina donde se desea realizar la instalación. No será necesario contar con el stack completo sin embargo si es necesario al menos contar con Apache2 instalado en el equipo.</p>
<p>Para verificar que efectivamente contamos con todos los requisitos tecleamos en la terminal:<br />
<code><br />
sudo apt-get install apache2 apache2.2-common apache2-utils openssl openssl-blacklist openssl-blacklist-extra<br />
</code></p>
<p><!--more--><br />
Para configurar un servidor seguro, se utiliza en este caso criptografía de clave pública para crear un par de llaves, una pública y una privada. En la mayoría de los casos, el certificado que se genera localmente en el equipo tiene que ser enviado junto con varios requisitos a una Autoridad Certificadora (CA por sus siglas en inglés). La CA verifica su petición y su identidad, y luego le devuelve un certificado para asegurar el servidor. En este caso como no tenemos ni el dinero ni el tiempo suficiente (:D) tendremos que crear nuestro propio certificado, firmado por nosotros mismos. Sin embargo, es importante recalcar que estos certificados no deberán ser utilizados en ambientes de producción. El problema con este tipo de certificados es que no son aceptados de manera automática por los navegadores, por lo que tendremos que (al menos en FireFox) crear una excepción para el sitio con el cerficado que estamos creando nosotros. Pero para fines de demostrar los pasos será más que suficiente.</p>
<p><strong>Primero:</strong> Generamos un CSR (Petición de Firma de Certificado)</p>
<p>Para generar el CSR debemos crear nuestra llave (key):<br />
<code><br />
openssl genrsa -des3 -out server.key 4096<br />
</code></p>
<p>Puede ejecutar su propio servidor sin una clave. Esto es conveniente proque no necesitaría en este caso estar introduciendo la clave cada que requiera iniciar el servidor de https. Pero es demasiado inseguro, no recomendable ya que compromete seriamente la seguridad del sistema. De cualquier manera, es posible elegir ejecutar el servidor seguro sin clave eliminando la opción <code>-des3</code> con lo que el comando quedaría de la siguiente manera:<br />
<code><br />
openssl rsa -in server.key -out server.key.insegura<br />
</code></p>
<p>Al ejecutar este comando en cualquiera de sus dos formas presentadas anteriormente el sistema nos requerirá varia información que acompañará al certificado, la ubicación de la companía, el nombre de la misma, el nombre de quien firma el certificado y varias cosas mas. Todos estos datos son guardados en el archivo <code>/etc/ssl/openssl.cnf</code>. Si se requieren mas llaves para mas servidores o sitios que se ejecutarán en el mismo equipo se pueden agregar mendiante:<br />
<code><br />
openssl req -new -key server.key -out server.csr<br />
</code></p>
<p>Este certificado (el archivo server.csr en este caso) es el que deberemos enviar a la Autoridad Certificadora (CA).</p>
<p>Una vez que hemos generado nuestro certificado necesitamos instalarlo en el servidor.</p>
<p><strong>Segundo:</strong> Crear un Certificado Firmado por nosotros mismos.<br />
Para firmar nuestro certificado de manera local ejecutamos:<br />
<code><br />
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt<br />
</code></p>
<p>El comando anterior nos va a requerir que introduzcamos la clave de nuestra llave (si optamos por utilizar una clave segura, de otro modo no solicitará esta información), que es la clave que introdujimos al crear nuestra Petición de Firma de Certificado (CSR). Una vez que hemos ingresado la clave correcta, se generará un cerficiado y se almacenará con el nombre <code>server.crt</code> en nuestro servidor.</p>
<p><strong>Tercero:</strong> Instalar el Certificado<br />
Para instalar el certificado vamos a copiar los archivos server.crt y server.key a un directorio donde en adelante podremos almacenar todos los certificados de nuestro equipo.</p>
<p>Vamos a crear un directorio ssl dentro del directorio de configuración de apache y enseguida copiamos los archivos generados:<br />
<code><br />
sudo mkdir /etc/apache2/ssl/<br />
sudo cp server.crt /etc/apache2/ssl/<br />
sudo cp server.key /etc/apache2/ssl/<br />
</code></p>
<p><strong>Cuarto:</strong> Habilitar el módulo SSL para Apache2<br />
Ejecutamos el siguiente comando:<br />
<code><br />
sudo a2enmod ssl<br />
</code></p>
<p><strong>Quinto:</strong> Crear y habilitar el sitio SSL<br />
Vamos a crear un VirtualHost para nuestro sitio:<br />
<code> sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/www.misitio.com</code></p>
<p>Luego, editamos el archivo www.misitio.com</p>
<p><code> sudo gedit /etc/apache2/sites-available/www.misitio.com</code><br />
Y lo dejamos con el siguiente contenido:</p>
<pre><code>&#60;VirtualHost *:443&#62;</code>
<code>    ServerAdmin webmaster@localhost
	ServerName www.misitio.com
	LogLevel warn
	ErrorLog /var/log/apache2/www.misitio.com.error.log
	CustomLog /var/log/apache2/www.misitio.com.access.log combined</code>

	<code>DocumentRoot /var/www/www.misitio.com/</code>

	<code>&#60;Directory /var/www/www.misitio.com/&#62;</code>
		<code>Options Indexes FollowSymLinks MultiViews
		AllowOverride All
		Order allow,deny
		allow from all</code>
	<code>&#60;/Directory&#62;</code>

        <code>SSLEngine On
        SSLCertificateFile    /etc/apache2/ssl/server.crt
        SSLCertificateKeyFile /etc/apache2/ssl/server.key
        SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown</code>
<code>&#60;/VirtualHost&#62;</code></pre>
<p>Por último, habilitamos el sitio que acabamos de crear:</p>
<p><code><br />
sudo a2ensite www.misitio.com<br />
</code></p>
<p><strong>Sexto:</strong> Habilitar Apache2 para que escuche en el puerto 443.<br />
Necesitamos editar el archivo ports.conf:</p>
<p><code><br />
sudo gedit /etc/apache2/ports.conf<br />
</code></p>
<p>Al abrirlo se ve de la siguiente manera:<br />
<code><br />
# If you just change the port or add more ports here, you will likely also<br />
# have to change the VirtualHost statement in<br />
# /etc/apache2/sites-enabled/000-default</code></p>
<p><code>NameVirtualHost *:80<br />
Listen 80<br />
# SSL name based virtual hosts are not yet supported, therefore no<br />
# NameVirtualHost statement here<br />
Listen 443</code></p>
<p>Vamos a agregar el NameVirtualHost al puerto de https (443). Así que al terminar deberá quedar de esta manera :<br />
<code><br />
# If you just change the port or add more ports here, you will likely also<br />
# have to change the VirtualHost statement in<br />
# /etc/apache2/sites-enabled/000-default</code><br />
<code><br />
NameVirtualHost *:80<br />
Listen 80<br />
# SSL name based virtual hosts are not yet supported, therefore no<br />
NameVirtualHost *:443<br />
Listen 443<br />
</code></p>
<p>No hay que olvidar editar el archivo <code>/etc/hosts</code> si se esta corriendo de manera local el sitio www.misitio.com y apuntarlo a 127.0.0.1</p>
<p>Ahora reiniciamos el servidor:<br />
<code><br />
sudo /etc/init.d/apache2 restart<br />
</code></p>
<p>Si se ha optado por utilizar una llave con clave, el servidor requerirá que tecleemos la contraseña para poder continuar, en caso contrario no arrancará el servicio.</p>
<p><strong>Séptimo:</strong> Acceder al servidor.<br />
Ahora es posible acceder al servidor en la dirección https://www.misitio.com. Si se ha utilizado un certificado que nostros mismos hemos firmado, el navegador nos indicará que ha fallado la conexión segura, es cuestión de ignorar simplemente el mensaje y agregar una excepción de seguridad para nuestro sitio.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Apache + openssl = creazione di certificati per connessioni cifrate (pt.2)]]></title>
<link>http://toastedtech.wordpress.com/2009/07/17/apache-openssl-creazione-di-certificati-per-connessioni-cifrate-pt-2/</link>
<pubDate>Thu, 16 Jul 2009 23:51:55 +0000</pubDate>
<dc:creator>lespeol</dc:creator>
<guid>http://toastedtech.wordpress.com/2009/07/17/apache-openssl-creazione-di-certificati-per-connessioni-cifrate-pt-2/</guid>
<description><![CDATA[Come promesso, oggi configuriamo per bene apache, con un occhio per il firewall. Iniziamo col dire c]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Come promesso, oggi configuriamo per bene apache, con un occhio per il firewall.</p>
<p><img class="aligncenter size-medium wp-image-1761" title="ssl_cover_logo" src="http://toastedtech.wordpress.com/files/2009/07/ssl_cover_logo.jpg?w=300" alt="ssl_cover_logo" width="300" height="137" /></p>
<p><!--more--></p>
<p>Iniziamo col dire che bisogna installare <a href="http://www.apache.org/">Apache</a> e controllare che il modulo sia caricato.</p>
<p>Questo modulo è sicuramente presente, ma potrebbe essere commentato.</p>
<p>Lo cerchiamo nel file httpd.conf (nella mia macchina risiede in /etc/httpd/conf/httpd.conf)</p>
<pre>#LoadModule ssl_module modules/mod_ssl.so</pre>
<p>Se lo è, lo decommentiamo.</p>
<pre>LoadModule ssl_module modules/mod_ssl.so</pre>
<p>Se non fosse presente, (nel caso si usi una versione di apache &#60; 1.3) ci basta scaricarlo e installarlo da <a href="http://www.modssl.org/source/">qui</a>.</p>
<p>A questo punto possiamo preoccuparci di due cose fondamentali:</p>
<ol>
<li>Trovare il file ssl.conf (per me risiede in /etc/httpd/conf.d/ssl.conf)</li>
<li>Decidere dove dire al server su quale porta stare in ascolto</li>
</ol>
<p>Infatti una volta trovati i file httpd.conf e ssl.conf, dobbiamo inserire soltanto su uno dei due file le porte su cui stare in ascolto.</p>
<p>Avendo deciso di usare soltano una connessione cifrata, quindi l&#8217;utilizzo del protocollo https, diremo al web server di rimanere in ascolto sultanto sulla porta 443 (invece della porta 80 &#8211; http).</p>
<p>Io ho deciso di scriverlo su httpd.conf.</p>
<pre>#Listen 80
Listen 443</pre>
<p>A questo punto dobbiamo soltanto decidere l&#8217;indirizzo del nostro server e creare un VirtualHost sul file ssl.conf.</p>
<p>Facciamo un po&#8217; di chiarezza su questo file.</p>
<p>Tutto ciò che è definito all&#8217;esterno di &#60;VirtualHost&#62; vale per tutte le pagine, mentre ciò che è definito all&#8217;interno vale soltanto per le pagine che appartengono a quell&#8217;indirizzo.</p>
<p>Prima di continuare, facciamo un passo in dietro. Nella prima parte abbiamo creato i cetificati per il server e per il client che vuole entrare nel sito tramite certificato.</p>
<p>Per quanto riguarda il server, consiglio di mettere chiave e certificato in una cartella apposita, per esempio /etc/httpd/ssl, così da saperlo ritrovare ed utilizzare facilmente. In questa sede faremo riferimento a questa configurazione.</p>
<p>Scegliamo l&#8217;indirizzo per il server. Io ho usato 192.168.0.2 (originale eh???) ed editiamo il file ssl.conf in questo modo:</p>
<pre>NameVirtualHost 192.168.0.2:443
&#60;VirtualHost 192.168.0.2:443&#62;
  #DI DEFAULT SU LINUX C'è QUESTA ROOT
  DocumentRoot "/var/www/html"
  SSLEngine on
  SSLOptions +StrictRequire
  &#60;Directory /&#62;
    SSLRequireSSL
  &#60;/Directory&#62;
  SSLProtocol -all +TLSv1 +SSLv3
  SSLCipherSuite HIGH:MEDIUM:!aNULL:+SHA1:+MD5:+HIGH:+MEDIUM
  #QUESTO è IL CERTIFICATO DEL SERVER
  SSLCertificateFile /etc/httpd/ssl/server.crt
  #QUESTA è LA CHIAVE DEL SERVER
  SSLCertificateKeyFile /etc/httpd/ssl/server.key
  #NOI VOGLIAMO CHE L'INDEX NON RICHIEDA IL CERTIFICATO
  SSLVerifyClient none
  #CERTIFICATO DELLA CA
  SSLCACertificateFile /etc/httpd/ssl/CA.crt
  #MA NELLA ZONA "https://192.168.0.2/secure"
  #VOGLIAMO CHE VENGA RICHIESTO IL CERTIFICATO
  &#60;Location /secure&#62;
    SSLVerifyClient require
    SSLVerifyDepth 1
  &#60;/Location&#62;
  SSLProxyEngine off
  &#60;IfModule mime.c&#62;
    AddType application/x-x509-ca-cert      .crt
    AddType application/x-pkcs7-crl         .crl
  &#60;/IfModule&#62;
  #SERVE PER IE
  SetEnvIf User-Agent ".*MSIE.*" \
  nokeepalive ssl-unclean-shutdown \
  downgrade-1.0 force-response-1.0
&#60;/VirtualHost&#62;</pre>
<p>Ora non ci resta che riavviare httpd</p>
<pre>[root@frontend~] /etc/init.d/httpd restart</pre>
<p>Se funziona ci chiederà la pass-phrase del server.</p>
<p>Ultimo accorgimento:</p>
<p>siccome siamo degli esperti in sicurezza dobbiamo anche settare il firewall da permettere in entrata soltanto comunicazioni sulla porta 443.</p>
<p>Quindi:</p>
<pre>[root@frontend~] iptables -t filter -I INPUT -p tcp --dport 443 -j ACCEPT</pre>
<p>A questo punto è davvero tutto.</p>
<p>Se avete domande&#8230; fate pure. Ciao!</p>
<p>PS: un grazie va anche ad akane. Il server lo abbiamo configurato insieme.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Apache + openssl = creazione di certificati per connessioni cifrate (pt.1)]]></title>
<link>http://toastedtech.wordpress.com/2009/07/15/apache-openssl-creazione-di-certificati-per-connessioni-cifrate-pt-1/</link>
<pubDate>Wed, 15 Jul 2009 10:21:22 +0000</pubDate>
<dc:creator>lespeol</dc:creator>
<guid>http://toastedtech.wordpress.com/2009/07/15/apache-openssl-creazione-di-certificati-per-connessioni-cifrate-pt-1/</guid>
<description><![CDATA[Di recente ho dovuto configurare un web server in modo da permettere una connessione cifrata per una]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Di recente ho dovuto configurare un web server in modo da permettere una connessione cifrata per una zona &#8220;sicura&#8221; del sito.</p>
<p>La prima domanda è stata: ma come lo creo un certificato? Chi me lo firma?</p>
<p><img class="aligncenter size-medium wp-image-1756" title="42-20504685" src="http://toastedtech.wordpress.com/files/2009/07/chiave1.jpg?w=200" alt="42-20504685" width="200" height="300" /></p>
<p>Praticamente potremmo scegliere di farcelo firmare da alcune CA (<a href="http://it.wikipedia.org/wiki/Certificate_authority">Certification Autority</a>) vere, pagando le stesse perché certifichino che il mio sito è sicuro.</p>
<p>Ma io devo soltanto fare delle prove&#8230; e allora come faccio?</p>
<p>La risposta è <a href="http://www.openssl.org/">openssl</a>.</p>
<p><!--more--></p>
<p>Piccola spiegazione di quello che faremo:</p>
<ul>
<li>Creazione certificato e chiave CA</li>
<li>Creazione certificato e chiave Server</li>
<li>Creazione certificato e chiave Client</li>
</ul>
<p>Per quanto riguarda il Server, lo configureremo in modo che la pagina iniziale, nonostante (https://frontend/index.html) sia consultabile da tutti, mentre la sezione https://frontend/secure sia visibile soltanto con un certificato.</p>
<p>Praticamente ho assunto il ruolo di CA, di server e infine anche di client (per testarlo).</p>
<p>Il primo passo sarà creare una chiave privata ed un certificato standard <a href="http://it.wikipedia.org/wiki/X.509">X.509</a> per la CA.</p>
<p>LATO CA</p>
<p>Quindi digitiamo da root:</p>
<pre>[root@localhost ~]# openssl genrsa -des3 -out CA.key 2048</pre>
<p>Praticamente stiamo richiedendo la generazione di una chiave privata RSA utilizzando l&#8217;algoritmo <a href="http://it.wikipedia.org/wiki/Triple_DES">Triple DES</a>, salvata con il nome CA.key. Di default la lunghezza è 512 bit, ma noi l&#8217;abbiamo richiesta da 2048 bit.</p>
<p>Durante la creazione della chiave ci verrà richiesta una &#8220;pass-phrase&#8221;. Dobbiamo assolutamente ricordarcela perché verrà richiesta ogni volta che useremo la chiave privata della CA.</p>
<pre>Generating RSA private key, 2048 bit long modulus
..................................................................
........................+++
...............+++
e is 65537 (0x10001)
Enter pass phrase for CA.key:
Verifying - Enter pass phrase for CA.key:</pre>
<p>Dalla chiave possiamo ora creare il certificato:</p>
<pre>[root@localhost ~]# openssl req -new -key CA.key -x509 -days 3650 -out CA.crt</pre>
<p>Il nostro certificato, firmato con la chiave CA.key avrà il nome CA.crt.</p>
<ul>
<li>new : vuoldire nuova richiesta</li>
<li>key : specifichiamo con quale chiave firmare il certificato</li>
<li>x509 : è il formato del certificato</li>
<li>days : il tempo in giorni di validità del certificato (3650 giorni = 10 anni)</li>
<li>out : il file che conterrà il certificato</li>
</ul>
<p>A questo punto, durante la creazione del certificato, dovremo inserire dei dati che di default sono quelli dentro le parentesi quadre:</p>
<pre>Enter pass phrase for CA.key:
You are about to be asked to enter information that will be
incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name
or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [GB]:IT
State or Province Name (full name) [Berkshire]: Italy
Locality Name (eg, city) [Newbury]: Perugia
Organization Name (eg, company) [My Company Ltd]: Company New
Organizational Unit Name (eg, section) []: CA NEW
Common Name (eg, your name or your server's hostname) []: CA NEW
Email Address []: nostra@mail.bo</pre>
<p>NB: Abbiamo appena creato la chiave della CA e il rispettivo certificato.</p>
<p>LATO SERVER</p>
<p>Traformiamcii da SERVER e generiamo la chiave privata per il server con il nome server.key:</p>
<pre>[root@localhost ~] openssl genrsa -des3 -out server.key 1024</pre>
<p>Ora possiamo creare dalla chiave la RICHIESTA DI CERTIFICATO che sarà in un secondo momento elaborata dalla CA per la creazione del certificato, firmato con la chiave privata della CA.</p>
<pre>[root@localhost ~]# openssl req -new -key server.key -out server.csr -config /usr/share/ssl/openssl.cnf</pre>
<p>NB: con l&#8217;opzione -config dobbiamo specificare il percorso del file openssl.cnf. Nel mio caso (Scientific Linux) era contenuto in /usr/share/ssl/openssl.cnf</p>
<pre>Enter pass phrase for server.key:
You are about to be asked to enter information that will be incorporated into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [GB]: IT
State or Province Name (full name) [Berkshire]: Italy
Locality Name (eg, city) [Newbury]: Perugia
Organization Name (eg, company) [My Company Ltd]: Pava
Organizational Unit Name (eg, section) []: Web Server        
Common Name (eg, your name or your server's hostname) []:frontend/secure
Email Address []:info@miosito.it 

Please enter the following 'extra' attributes to be sent with your certificate request
A challenge password []:
An optional company name []:</pre>
<p>IMPORTANTE:  Su &#8220;Common Name&#8221; dobbiamo specificare perfettamente quale zona sarà cifrata. Se cambiamo nome al sito i semplicemente alla parte che vogliamo sia sicura, dobbiamo generare un altro certificato e specificare il nuovo hostname.<br />
Mentre gli ultimi due campi solitamente sono lasciati vuoti.</p>
<p>Ora possiamo diventare di nuovo la grande CA ed elaborare la richiesta del server, firmandola con la chiave privata della CA, ottenendo così il certificato:</p>
<pre>[root@localhost ~]# openssl x509 -req -in server.csr -out server.crt -sha1 -CA CA.crt -CAkey CA.key -CAcreateserial -days 2190
Signature ok
subject=/C=IT/ST=Italy/L=Miacittà/O=Perugia  Azienda/OU=Servizi
Web/CN=frontend/secure/emailAddress=info@miosito.it
Getting CA Private Key
Enter pass phrase for CA.key:</pre>
<p>NB: la pass-phrase scelta per il server, dovrà essere inserita ogni volta che il servizio &#8220;httpd&#8221;  viene riavviato.<br />
Esiste un modo per settarlo una volta in modo che venga memorizzato, ma non verrà trattato qui, ora.</p>
<p>LATO CLIENT</p>
<p>Lavoriamo ora per creare il certificato del client così da testare il server.<br />
Creiamo prima di tutto la chiave per il cliente</p>
<pre>[root@localhost ~]# openssl genrsa -out client.key 1024</pre>
<p>Proseguiamo con la richiesta di certificato:</p>
<pre>[root@localhost ~]# openssl  req -new -key client.key -out client.csr -config /usr/share/ssl/openssl.cnf</pre>
<p>Ora trasformandoci da CA possiamo esportare il certificato del cliente in formato pem:</p>
<pre>[root@localhost ~]# openssl x509 -CA CA.crt -CAkey CA.key -csr -in client.csr -out client.pem -days 100</pre>
<p>Ed infine convertirlo in formato .p12 per permettere l&#8217;importazione nel browser dell&#8217;utente:</p>
<pre>[root@localhost ~]# openssl pkcs12 -export -clcerts -in client.pem -inkey client.key -out client.p12</pre>
<p>A questo punto il client dovrà installare il proprio certificato sul browser semplicemente importando il file “client.p12” sul browser andando sulla sezione “certificati personali” e facendo un “import”.<br />
Il client è ora pronto a visualizzare l&#8217;intero sito, comprendente la zona “sicura”.</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>Nella seconda parte, configureremo il nostro Web Server, con tanto di iptables.</p>
<p>Bye bye</p>
</div>]]></content:encoded>
</item>

</channel>
</rss>
