<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
>
<channel>
	<title>G-Loaded Journal &#187; Encryption</title>
	<atom:link href="http://www.g-loaded.eu/tag/encryption/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.g-loaded.eu</link>
	<description>An open-source software and technology related journal</description>
	<lastBuildDate>Mon, 05 Dec 2011 19:55:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
		<item>
		<title>How to change the expiration date of a GPG key</title>
		<link>http://www.g-loaded.eu/2010/11/01/change-expiration-date-gpg-key/</link>
		<comments>http://www.g-loaded.eu/2010/11/01/change-expiration-date-gpg-key/#comments</comments>
		<pubDate>Mon, 01 Nov 2010 16:54:24 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Encryption]]></category>
		<category><![CDATA[GPG]]></category>
		<category><![CDATA[Maintenance]]></category>
		<category><![CDATA[PKI]]></category>
		<category><![CDATA[Security]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/?p=2035</guid>
		<description><![CDATA[This post is a step-by-step tutorial on how to extend the expiration date of your GPG keys or reset it in case the keys have already expired. But, before we go through how to change the date, I&#8217;d like to write a few things about why setting an expiration date on your GPG keys is [...]]]></description>
			<content:encoded><![CDATA[<p>This post is a step-by-step tutorial on how to extend the expiration date of your <a href="http://www.gnupg.org/">GPG</a> keys or reset it in case the keys have already expired. But, before we go through how to change the date, I&#8217;d like to write a few things about why setting an expiration date on your GPG keys is important.<br />
<span id="more-2035"></span></p>
<h4>The importance of the GPG/PGP key expiration date</h4>
<p>Most people set their GPG keys to never expire. There is no problem with that. Unless they lose the private key or it gets stolen or they just forget its passphrase. In such a case, the public key, which has probably been published to several key servers around the world and retrieved by an arbitrary number of other people, is practically useless and, apart from removing it from some of the keyservers, they can do absolutely nothing else about it, unless, of course, they had previously generated a <em>revocation certificate</em> for the public key and they still have access to this certificate. In those not so rare cases that the revocation certificate is not available, the only way to let those who have already grabbed a copy of the public key know that they should not use that key any more is by notifying them directly, which is not always possible since the actual number of the holders of that specific public key is not known.</p>
<p>Setting an <strong>expiration date</strong> on your keys is a very good <strong>security measure</strong>. It lets the holders of the public key know the key&#8217;s end-of-life date. On the other hand, you can always extend the key&#8217;s expiration date and send the updated key to the key servers. When others find out that your public key has expired, the very first thing they do will be to refresh it from a key server, in which case they&#8217;ll retrieve your updated public key. Even if you lose the private key or forget the passphrase or even lose the revocation certificate too, a time will come that the public key will expire, which indicates that it is invalid and should not be trusted any more. This is important.</p>
<h4>Change the expiration date of a GPG key</h4>
<p>In this section I describe how to extend or reset a key&#8217;s expiration date using <strong>gpg</strong> from the command line. There are probably several graphical front-ends out there that might simplify this procedure, but, since graphical frontends are not usually cross-platform, I choose to use the command-line gpg utility. So, here is how we do it.</p>
<p>First of all, you have to know the ID of the key you need to edit:</p>
<pre class="console">
$ gpg --list-keys
pub   1024D/B989893B 2007-03-07 [expired: 2009-12-31]
uid                  George Notaras &lt;gnotaras@example.org&gt;
sub   4096g/320D81EE 2007-03-07 [expired: 2009-12-31]
</pre>
<p>The ID in question is B989893B, so we edit the key with that ID:</p>
<pre class="console">
$ gpg --edit-key B989893B
</pre>
<p>You should have entered the <strong>gpg shell</strong> by now. To see a list of the available commands you can always invoke the <strong>help</strong> command.</p>
<p>First of all, list the keys so you know what you are editing:</p>
<pre class="console">
gpg> list
pub  1024D/B989893B  created: 2007-03-07  expired: 2009-12-31  usage: SCA
                     trust: ultimate       validity: ultimate
sub  4096g/320D81EE  created: 2007-03-07  expired: 2009-12-31  usage: E
[ ultimate] (1). George Notaras &lt;gnotaras@example.org&gt;
</pre>
<p>By default, no subkey (sub) is selected, which means that we work on the primary key (pub). It is possible to select the subkey you will be working on by invoking the <strong>key</strong> command followed by the number (index) of the subkey you wish to select. If no arguments or index &#8217;0&#8242; is passed to the <strong>key</strong> command, any subkey is deselected and you will be working on the primary key.</p>
<pre class="console">
gpg> key 0
pub  1024D/B989893B  created: 2007-03-07  expired: 2009-12-31  usage: SCA
                     trust: ultimate       validity: ultimate
sub  4096g/320D81EE  created: 2007-03-07  expired: 2009-12-31  usage: E
[ ultimate] (1). George Notaras &lt;gnotaras@example.org&gt;
</pre>
<p>Now use the <strong>expire</strong> command to set an expiration time for the primary key.</p>
<pre class="console">
gpg> expire
Changing expiration time for the primary key.
Please specify how long the key should be valid.
         0 = key does not expire
      <n>  = key expires in n days
      <n>w = key expires in n weeks
      <n>m = key expires in n months
      <n>y = key expires in n years
Key is valid for? (0) 2y
Key expires at 10/28/12 03:51:07
Is this correct? (y/N) y
You need a passphrase to unlock the secret key for
user: "George Notaras &lt;gnotaras@example.org&gt;"
1024-bit DSA key, ID XXXXXXXX, created 2007-03-07
pub  1024D/B989893B  created: 2007-03-07  expires: 2012-10-28  usage: SCA
                     trust: ultimate       validity: ultimate
sub  4096g/320D81EE  created: 2007-03-07  expired: 2009-12-31  usage: E
[ ultimate] (1). George Notaras &lt;gnotaras@example.org&gt;
</pre>
<p>The output above indicates that the expiration date of the <strong>primary public key</strong> has been set to 2012-10-28. Note that, the expiration date has also been changed on your <strong>primary private key</strong> of the keypair. You can issue the <strong>toggle</strong> command to verify the private key&#8217;s expiration date. Don&#8217;t worry about that. It is the private <strong>subkeys</strong>, which never expire, that are actually used when you decrypt and sign data. Read more on this in a special note at the end of this section. For now, just issue the <strong>toggle</strong> command once again to return to <em>public key editing mode</em>.</p>
<p>In this example case, there is one public subkey on which we need to set a new expiration date. That&#8217;s <em>key number 1</em>. We select that with the <strong>key</strong> command:</p>
<pre class="console">
gpg> key 1
pub  1024D/B989893B  created: 2007-03-07  expires: 2012-10-28  usage: SCA
                     trust: ultimate       validity: ultimate
sub*  4096g/320D81EE  created: 2007-03-07  expired: 2009-12-31  usage: E
[ ultimate] (1). George Notaras &lt;gnotaras@example.org&gt;
</pre>
<p>Set a new expiration time on that subkey by invoking the <strong>expire</strong> command:</p>
<pre class="console">
gpg> expire
Changing expiration time for a subkey.
Please specify how long the key should be valid.
         0 = key does not expire
      <n>  = key expires in n days
      <n>w = key expires in n weeks
      <n>m = key expires in n months
      <n>y = key expires in n years
Key is valid for? (0) 2y
Key expires at 10/28/12 03:02:43
Is this correct? (y/N) y
You need a passphrase to unlock the secret key for
user: "George Notaras &lt;gnotaras@example.org&gt;"
1024-bit DSA key, ID XXXXXXXX, created 2007-03-07
pub  1024D/B989893B  created: 2007-03-07  expires: 2012-10-28  usage: SCA
                     trust: ultimate       validity: ultimate
sub* 4096g/320D81EE  created: 2007-03-07  expires: 2012-10-28  usage: E
[ ultimate] (1). George Notaras &lt;gnotaras@example.org&gt;
</pre>
<p>Now it seems that everything is set up fine. You have changed the expiration dates of your keys. You can always use the <strong>list</strong> command to list the keys. Use the <strong>toggle</strong> command to toggle between <em>public</em> and <em>private</em> key <em>editing mode</em>.</p>
<p>As a final step you need to <em>save</em> your changes. Invoke the <strong>save</strong> command.</p>
<pre class="console">
gpg> save
</pre>
<p>So, now you can update the public key that is stored on the various keyservers. To achieve this use the following command. In this example, the keyserver at <code>pgp.mit.edu</code> is used.</p>
<pre class="console">
$ gpg --keyserver pgp.mit.edu --send-keys B989893B
gpg: sending key B989893B to hkp server pgp.mit.edu
</pre>
<p>Enjoy.</p>
<h5>Important Note</h5>
<p>If you tried to use the <strong>expire</strong> command in <em>private key editing mode</em>, you would notice that it is not possible to change the expiration date of any subkeys in this mode. Actually, the private subkeys <strong>never expire</strong>. Although, I haven&#8217;t investigated this, common sense indicates that, since private subkeys are used to <em>sign</em> and <em>decrypt</em> data and that they are not meant to be distributed, it wouldn&#8217;t make any sense if they expired.</p>
<p>Theoritically speaking, the owner of an expired private key should still have the ability to <strong>decrypt</strong> data and also be able to <strong>sign</strong> data, even if all public subkeys of the current keypair have expired, since it is always possible to reset the expiration date on the currently expired public keys.</p>
<p>As I mentioned earlier, I haven&#8217;t investigated this, but I think that non-expiring private keys make a lot of sense.</p>
<h4>Final Thoughts</h4>
<p>This article described in detail how to <strong>change the expiration date</strong> of GPG/PGP keys. This should be a standard key maintenance procedure if you set an expiration date on your keys.</p>
<p>Setting an expiration date on your keys is not mandatory as long as you have taken other measures to protect the private key and the public key&#8217;s revocation certificate by backing it up and storing it at another location. But, in general, it is a good habit as explained in this article&#8217;s introduction. I by no means am a GPG/PGP expert. I wrote this guide because I realized that most people do not set an expiration date on their keys because they do not know how to change it and extend the key&#8217;s life or because they have not realized the importance of the expiration date or simply because they do not care. I hope you find this tutorial useful and start setting an expiration date on your keys from now on.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2010/11/01/change-expiration-date-gpg-key/">How to change the expiration date of a GPG key</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2005/11/10/be-your-own-ca/" rel="bookmark">Be your own Certificate Authority (CA)</a></li>
<li><a href="http://www.g-loaded.eu/2005/11/10/ssh-with-keys/" rel="bookmark">Setup the SSH server to use keys for authentication</a></li>
<li><a href="http://www.g-loaded.eu/2010/04/12/a-change-of-plans-regarding-a-web-based-vcs-manager/" rel="bookmark">A change of plans regarding a web-based VCS manager</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2010/11/01/change-expiration-date-gpg-key/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>SSL-enabled Name-based Apache Virtual Hosts with mod_gnutls</title>
		<link>http://www.g-loaded.eu/2007/08/10/ssl-enabled-name-based-apache-virtual-hosts-with-mod_gnutls/</link>
		<comments>http://www.g-loaded.eu/2007/08/10/ssl-enabled-name-based-apache-virtual-hosts-with-mod_gnutls/#comments</comments>
		<pubDate>Fri, 10 Aug 2007 05:35:49 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Compiling]]></category>
		<category><![CDATA[Encryption]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Review]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Servers]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/2007/08/10/ssl-enabled-name-based-apache-virtual-hosts-with-mod_gnutls/</guid>
		<description><![CDATA[This article describes how to implement SSL-enabled name-based vhosts &#8211; that is secure virtual hosts which share the same IP address and port &#8211; with the SNI-capable mod_gnutls module for Apache&#8217;s httpd web server. Server Name Indication (SNI), as described in section 3.1 of the RFC3546, is a TLS extension which makes the configuration of [...]]]></description>
			<content:encoded><![CDATA[<p>This article describes how to implement SSL-enabled name-based vhosts &#8211; that is secure virtual hosts which share the same IP address and port &#8211; with the <strong>SNI</strong>-capable <a href="http://www.outoforder.cc/projects/apache/mod_gnutls/">mod_gnutls</a> module for Apache&#8217;s httpd web server.<br />
<span id="more-438"></span><br />
<em>Server Name Indication</em> (<strong>SNI</strong>), as described in section 3.1 of the <a href="http://www.ietf.org/rfc/rfc3546.txt">RFC3546</a>, is a TLS extension which makes the configuration of SSL-enabled name-based virtual hosts possible. This extention eliminates the need for the assignment of one IP address per secure virtual host, therefore the cost for secure web hosting is greatly reduced, as all secure virtual hosts can share the same IP address and port combination. SNI is a huge step forward as it promotes security by making secure web services easier and cheaper to implement. The current version of <a href="http://www.openssl.org/">OpenSSL</a> &#8211; 0.98 at the time of writing &#8211; does not support SNI yet, but this is planned for the upcoming 0.99 release. On the other hand, <a href="http://www.outoforder.cc/projects/apache/mod_gnutls/">mod_gnutls</a>, an experimental module for Apache&#8217;s <a href="http://httpd.apache.org/">httpd</a> which has been around for 2+ years, includes support for <strong>SNI</strong>.</p>
<h4>Introduction</h4>
<p>Searching the web for mod_gnutls binary distribution packages or information on how to set it up returned very few relevant results. This was a surprise, as, at this moment, the only implementation that supports SNI is mod_gnutls. So, I decided to write a tutorial on how to set things up for a test. I hope you find it useful.</p>
<p>The test that is described in this guide includes:</p>
<ol>
<li>The compilation of the mod_gnutls module.</li>
<li>The generation of SSL certificates.</li>
<li>The configuration of the SSL-enabled name-based virtual hosts.</li>
</ol>
<p>This test was performed on a server that runs <a href="http://fedoraproject.org/">Fedora</a> 7.</p>
<h4>Installation</h4>
<p>In order to compile mod_gnutls, you will need the development tools for Fedora:</p>
<pre class="console"># yum groupinstall "Development Tools"</pre>
<p>Install the mod_gnutls dependencies:</p>
<pre class="console"># yum install httpd-devel gnutls-devel</pre>
<p>As an unprivileged user, download the mod_gnutls distribution and compile it.</p>
<pre class="console">
$ wget http://www.outoforder.cc/downloads/mod_gnutls/mod_gnutls-0.2.0.tar.bz2
$ tar -xjvf mod_gnutls-0.2.0.tar.bz2
$ cd mod_gnutls-0.2.0
$ ./configure --prefix=/usr
$ make
</pre>
<p>Do not use the &#8216;<code>make install</code>&#8216; script, but perform the installation manually &#8211; it is only one library.</p>
<p>As root, copy <strong>libmod_gnutls.so</strong> to the directory that holds the Apache modules (usually <code>/usr/lib/httpd/modules</code>) and rename it to <strong>mod_gnutls.so</strong> for consistency:</p>
<pre class="console"># cp mod_gnutls-0.2.0/src/.libs/libmod_gnutls.so /usr/lib/httpd/modules/mod_gnutls.so</pre>
<p>During the compilation, two keys, <code>dhfile</code> and <code>rsafile</code>, have been generated in the <code>mod_gnutls-0.2.0/data/</code> directory. It is absolutely important to copy these files in httpd&#8217;s configuration directory (usually <code>/etc/httpd/conf/</code>), otherwise mod_gnutls will never work. This is undocumented, and I found out about it after some trial&#038;error.</p>
<p>As root:</p>
<pre class="console"># cp mod_gnutls-0.2.0/data/{dh,rsa}file /etc/httpd/conf/</pre>
<p>Installation is complete.</p>
<h4>SSL certificates</h4>
<p>In this test installation, two virtual hosts will be used. Thus, two SSL certificates will be required. Please read my article on how to <a href="http://www.g-loaded.eu/2005/11/10/be-your-own-ca/">generate SSL certificates</a> for your servers, as this information is beyond the scope of this document. Alternatively, you may use a ready-made <strong>script</strong> which will create those certificates for you quickly. Such scripts are shipped will almost all Linux distributions. Please consult your distribution&#8217;s documentation for more information.</p>
<h4>HTTPd Configuration</h4>
<p>The configuration of the Apache web server includes two phases:</p>
<ol>
<li>The configuration of the main server.</li>
<li>The configuration of the virtual hosts.</li>
</ol>
<p>In the following instructions, some brief notes about what each directive does is included. For more detailed information, please consult the <a href="http://www.outoforder.cc/projects/apache/mod_gnutls/docs/">mod_gnutls documentation</a>.</p>
<h5>Main Server Configuration</h5>
<p>This includes setting some general mod_gnutls options, which will be inherited by all virtual hosts.</p>
<p>But, first of all, httpd needs to be set to listen on port 443 (in addition to port 80). Instead of specifying the SSL port only (<code>Listen 443</code>) which will lead httpd to listen to all the available network interfaces, you may specify the exact network interface on which the server will listen. For example:</p>
<pre class="codesnp">Listen 192.168.0.1:443</pre>
<p>Next, load mod_gnutls:</p>
<pre class="codesnp">LoadModule gnutls_module modules/mod_gnutls.so</pre>
<p>Add some MIME-types for downloading Certificates and CRLs from your web sites (taken from the <code>mod_ssl</code> configuration):</p>
<pre class="codesnp">
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl    .crl
</pre>
<p>It is suggested that you use a session cache for mod_gnutls. This will increase its performance. In this example, the <strong>dbm</strong> cache type is used. This cache type requires a directory where mod_gnutls will actually save SSL session data. So, creating a directory for this purpose and giving ownership to the user that runs Apache (usually <code>apache</code> or <code>www-data</code>) is needed. Assuming that the Apache user is <code>apache</code>, as root issue the commands:</p>
<pre class="console">
# mkdir -m 0700 /var/cache/mod_gnutls_cache
# chown apache:apache /var/cache/mod_gnutls_cache
</pre>
<p>Now, back to the Apache configuration. The following directive sets the <strong>dbm</strong> SSL Session Cache for mod_gnutls:</p>
<pre class="codesnp">
GnuTLSCache dbm "/var/cache/mod_gnutls_cache"
</pre>
<p>Set a timeout for the SSL Session Cache entries. Usually, this is set to 300 seconds:</p>
<pre class="codesnp">
GnuTLSCacheTimeout 300
</pre>
<p>Finally, specify that on the <code>192.168.0.1:443</code> interface and port there will be name-based virtual hosts; that is vhosts that <em>share</em> the specified interface and port:</p>
<pre class="codesnp">
NameVirtualHost 192.168.0.1:443
</pre>
<h5>Virtual Host Configuration</h5>
<p>The example virtual hosts are: <code>v1.example.org</code> and <code>v2.example.org</code>. It is assumed that two SSL certificates with the canonical name (CN) correctly set to each of the aforementioned vhost domains have been generated.</p>
<p>In the following vhost configs, only the absolutely required directives have been used. The rest of the options are inherited from the main server.</p>
<pre class="codesnp">
&lt;VirtualHost 192.168.0.1:443&gt;
    ServerName v1.example.org:443
    GnuTLSEnable on
    GnuTLSCertificateFile /etc/pki_custom/certs/v1.example.org.crt
    GnuTLSKeyFile /etc/pki_custom/private/v1.example.org.key
    DocumentRoot "/var/www/v1/public_html"
&lt;/VirtualHost&gt;
&lt;VirtualHost 192.168.0.1:443&gt;
    ServerName v2.example.org:443
    GnuTLSEnable on
    GnuTLSCertificateFile /etc/pki_custom/certs/v2.example.org.crt
    GnuTLSKeyFile /etc/pki_custom/private/v2.example.org.key
    DocumentRoot "/var/www/v2/public_html"
&lt;/VirtualHost&gt;
</pre>
<h4>Testing the setup</h4>
<p>Having finished with the configuration, <strong>review</strong> the changes, <strong>restart</strong> the server and <strong>check</strong> the error logs for any errors.</p>
<p>Use a <em>web browser</em> to visit each of the virtual hosts by using the HTTPS protocol:</p>
<pre class="codesnp">
https://v1.example.org/
https://v2.example.org/
</pre>
<p>Until now, the web server did not support the SNI TLS extension. Therefore, when visiting the <code>v2.example.org</code> virtual host, you would see <strong>two</strong> warnings in your browser. The first one would be because the vhost&#8217;s certificate has not been issued by a trusted Certificate Authority &#8211; this is normal as it was you who issued that certificate &#8211; and the other one because on a server without SNI support it is actually the V1 vhost&#8217;s certificate that is used when visiting V2 vhost over https. Remember the <a href="http://httpd.apache.org/docs/2.0/ssl/ssl_faq.html#vhosts2">limitation</a> with SSL and name-based virtual hosts?</p>
<p>With mod_gnutls, the server supports the SNI TLS extension. Although the virtual hosts are name-based, no matter which one you visit, the relevant certificate for each vhost is used and the only warning you see is the one about the certificates being self-signed. You can get rid of these by purchasing a certificate that is issued by a trusted Certificate Authority.</p>
<h4>Conclusion</h4>
<p><strong>mod_gnutls</strong> works. Actually, it was a real pleasure to see SNI work!</p>
<p>It is important to note though that mod_gnutls is still in <em>experimental</em> phase. Therefore, performance issues should be considered as normal when using it.</p>
<p>At the moment of writing, my server uses Fedora 7 as an operating system. As I haven&#8217;t upgraded my desktop to F7 yet and my server does not have any development tools installed, I compiled mod_gnutls on a Fedora 6 system and used it on Fedora 7. I do not know if that was the reason &#8211; and I did not have the necessary free time to investigate &#8211; or anything else, but, during the use of mod_gnutls, my server&#8217;s load average increased significantly.</p>
<p><a href="http://www.flickr.com/photos/maxshots/1067120133/" title="Load Average increase during mod_gnutls testing on a production web server"><img src="http://farm2.static.flickr.com/1198/1067120133_38398a4fe8_o.png" width="597" height="255" alt="Load average increase during mod_gnutls testing" /></a></p>
<p>I will test mod_gnutls again soon and post the new results, if they are different than the ones I present in this article. I highly recommend that you try it, as it is currently the only way to easily achieve SSL-enabled name-based virtual hosts using the SNI TLS extension. Note, that this extension will be supported by openssl 0.99, so the moment that SNI goes mainstream and such a setup becomes easy and cheap to implement with any Linux distribution is close.</p>
<p>One last thing that has not been mentioned at all is about SNI support in <strong>web browsers</strong>. Currently, with the exception of Safari (this is unconfirmed, please correct me if I am wrong), the latest versions of all major web browsers, Firefox and other Mozilla-based browsers, Internet Explorer, Opera, support SNI.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2007/08/10/ssl-enabled-name-based-apache-virtual-hosts-with-mod_gnutls/">SSL-enabled Name-based Apache Virtual Hosts with mod_gnutls</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2007/11/14/mod_gnutls-binary-for-apache/" rel="bookmark">mod_gnutls binary for Apache</a></li>
<li><a href="http://www.g-loaded.eu/2005/11/05/assign-virtual-ips-to-your-nic/" rel="bookmark">Assign Virtual IPs to your NIC</a></li>
<li><a href="http://www.g-loaded.eu/2011/11/28/speed-up-apache-by-including-htaccess-files-into-httpd-conf/" rel="bookmark">Speed up Apache by including htaccess files into httpd.conf</a></li>
<li><a href="http://www.g-loaded.eu/2011/09/27/mod_gnutls-rc4-cipher-beast/" rel="bookmark">How to configure mod_gnutls to use the RC4 cipher to mitigate the SSL/TLS vulnerability</a></li>
<li><a href="http://www.g-loaded.eu/2008/05/10/use-mod_deflate-to-compress-web-content-delivered-by-apache/" rel="bookmark">Use mod_deflate to Compress Web Content delivered by Apache</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2007/08/10/ssl-enabled-name-based-apache-virtual-hosts-with-mod_gnutls/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Auto-closing SSH tunnels</title>
		<link>http://www.g-loaded.eu/2006/11/24/auto-closing-ssh-tunnels/</link>
		<comments>http://www.g-loaded.eu/2006/11/24/auto-closing-ssh-tunnels/#comments</comments>
		<pubDate>Fri, 24 Nov 2006 04:33:00 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Encryption]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Remote]]></category>
		<category><![CDATA[Shell]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/2006/11/24/auto-closing-ssh-tunnels/</guid>
		<description><![CDATA[In some of my older articles, at least where an SSH tunnel is involved, I keep mentioning a specific way of initializing such an encrypted tunnel, which results in the automatic closure of the tunnel after the job on the remote server is finished. Since this is my method of choice, I decided to provide [...]]]></description>
			<content:encoded><![CDATA[<p>In some of my older articles, at least where an SSH tunnel is involved, I keep mentioning a specific way of initializing such an encrypted tunnel, which results in the automatic closure of the tunnel after the job on the remote server is finished. Since this is my method of choice, I decided to provide some detailed explanation in this post, so that it can be used as a reference in future articles.<br />
<span id="more-306"></span></p>
<h4>What is a tunnel</h4>
<p>Assume that an <a href="http://www.g-loaded.eu/2005/11/10/ssh-with-keys/" title="SSH Server Configuration HOWTO">SSH</a> and a <a href="http://www.g-loaded.eu/2005/11/10/configure-vnc-server-in-fedora/" title="VNC Server Configuration HOWTO">VNC</a> server are up and running on the machine <code>remote.example.org</code>. The remote firewall does not allow direct connections to the VNC port &#8211; assume that this is TCP port 5901 &#8211; from the network, which is generally a good idea. In this case, we will connect to the remote VNC service from the local workstation through the remote SSH server, by using a feature of the SSH protocol, called <em>local port forwarding</em> or, simply, tunneling.</p>
<p>Such a tunnel can be initialized from the local workstation with the following:</p>
<pre class="console">[me@local]$ ssh -L 25901:127.0.0.1:5901 me@remote.example.org</pre>
<p>When executed, the above statement has the following results:</p>
<ol>
<li>forwards the local port 25901 on the local workstation to port 5901 on the remote machine through the ssh connection. The port 25901 is an example and it could be any other available TCP port on the local machine. The result is that any request made on the local port 25901 is transfered to port 5901 on the remote machine through the encrypted SSH connection.</li>
<li>connects us to the remote SSH server and logs our remote user &#8220;<code>me</code>&#8221; in.</li>
</ol>
<p>In order to connect to the remote VNC service through that tunnel, it is required to keep the connection to the ssh server open and, from another local terminal, connect to the local port 25901 with the vnc client:</p>
<pre class="console">[me@local]$ vncviewer 127.0.0.1:25901:1</pre>
<p>By closing the vnc client and by logging out of the remote shell, the tunnel is destroyed too. </p>
<h4>A better way</h4>
<p>The previous method is too far from being convenient in the everyday use. Things could be a lot better if we could just create the SSH tunnel and launch vncviewer in one line of code. This can be achieved by using the <strong>-f</strong> and <strong>-N</strong> flags when connecting to the remote SSH server:</p>
<pre class="console">
[me@local]$ ssh -f -N -L 25901:127.0.0.1:5901 me@remote.example.org; \
              vncviewer 127.0.0.1:25901:1
</pre>
<p>The <strong>-f</strong> switch instructs the ssh client to fork the ssh session to the background. Therefore, we remain at our local terminal&#8217;s prompt, from where we can execute more commands on our local machine. In this case, with a single line of code, we created the tunnel and executed vncviewer. However, the <strong>-f</strong> switch has one requirement. It cannot be used on its own. It needs to be accompanied either by the <strong>-N</strong> switch or we have to execute a specific command on the remote machine.</p>
<p>In this case, the <strong>-f -N</strong> combination keeps the tunnel up and running in the background, but the drawback is that it runs forever, requiring us to explicitly kill the ssh process if the tunnel is not needed any more. Even if we close vncviewer, the following command confirms that the tunnel is still running, which was actually expected:</p>
<pre class="console">[me@local]$ ps ax | grep ssh | grep -v grep</pre>
<h4>The best way &#8211; Tunnels that auto-close</h4>
<p>As it has been mentioned previously, instead of using the <strong>-f -N</strong> switch combination, we can just use <strong>-f</strong> alone, but also execute a command on the remote machine. But, which command should be executed, since we only need to initialize a tunnel?</p>
<p>This is when <code>sleep</code> can be the most useful command of all! In this particular situation, <strong>sleep</strong> has two advantages:</p>
<ol>
<li>it does nothing, so no resources are consumed</li>
<li>the user can specify for how long it will be executed</li>
</ol>
<p>How these help in auto-closing the ssh tunnel is explained below.</p>
<p>We start the ssh session in the background, while executing the sleep command for 10 seconds on the remote machine. The number of seconds is not crucial. At the same time, we execute vncviewer exactly as before:</p>
<pre class="console">
[me@local]$ ssh -f -L 25901:127.0.0.1:5901 me@remote.example.org sleep 10; \
              vncviewer 127.0.0.1:25901:1
</pre>
<p>In this case, the ssh client is instructed to fork the ssh session to the background (<code>-f</code>), create the tunnel (<code>-L 25901:127.0.0.1:5901</code>) and execute the sleep command on the remote server for 10 seconds (<code>sleep 10</code>).</p>
<p>The difference between this method and the previous one (<strong>-N</strong> switch), basically, is that in this case the ssh client&#8217;s primary goal is not to create the tunnel, but rather to execute the sleep command for 10 seconds. The creation of the tunnel is some kind of side-effect, a secondary goal. If <code>vncviewer</code> was not used, the ssh client would exit after the 10 sec period, as it would have no more jobs to do, destroying the tunnel at the same time.</p>
<p>During the execution of the sleep command, if another process, <code>vncviewer</code> in this case, starts using that tunnel and keeps it occupied beyond the 10 sec period, then, even if the ssh client finishes its remote job (execution of sleep), it cannot exit because another process occupies the tunnel. In other words, the ssh client cannot destroy the tunnel because it would have to kill vncviewer as well. When vncviewer stops using the tunnel, then the ssh client exits too, as it has already accomplished its goal.</p>
<p>This way, no ssh processes are left running in the background.</p>
<h4>Further Enhancements</h4>
<p>Although this is not a general article about the SSH protocol, the following ssh client switches may prove useful in some situations.</p>
<p>The <strong>-C</strong> switch may be used in order to apply compression to the transfered data between the local workstation and the remote server. This will save some bandwidth, but will increase the cpu load.</p>
<p>Also, a specific encryption algorithm may be specified with the <strong>-c</strong> option. The blowfish cipher is a rather good choice, which offers good encryption and low cpu utilization.</p>
<pre class="console">
[me@local]$ ssh -C -c blowfish -f -L 25901:127.0.0.1:5901 me@remote.example.org sleep 10; \
              vncviewer 127.0.0.1:25901:1
</pre>
<p>Finally, the <strong>-v</strong> flag can also be used for verbose output.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2006/11/24/auto-closing-ssh-tunnels/">Auto-closing SSH tunnels</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2005/10/20/ssh-tunnels-headaches/" rel="bookmark">SSH Tunnels Headaches</a></li>
<li><a href="http://www.g-loaded.eu/2005/11/10/configure-vnc-server-in-fedora/" rel="bookmark">Set up the VNC Server in Fedora</a></li>
<li><a href="http://www.g-loaded.eu/2006/11/06/netcat-a-couple-of-useful-examples/" rel="bookmark">Netcat &#8211; a couple of useful examples</a></li>
<li><a href="http://www.g-loaded.eu/2006/01/06/partition-images-with-partimage-and-partimaged/" rel="bookmark">Partition images with Partimage and Partimaged</a></li>
<li><a href="http://www.g-loaded.eu/2005/11/10/ssh-with-keys/" rel="bookmark">Setup the SSH server to use keys for authentication</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2006/11/24/auto-closing-ssh-tunnels/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Encrypt devices using dm-crypt and LUKS</title>
		<link>http://www.g-loaded.eu/2005/11/10/encrypt-devices-using-dm-crypt-and-luks/</link>
		<comments>http://www.g-loaded.eu/2005/11/10/encrypt-devices-using-dm-crypt-and-luks/#comments</comments>
		<pubDate>Thu, 10 Nov 2005 14:28:22 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[Container]]></category>
		<category><![CDATA[Desktop]]></category>
		<category><![CDATA[dm-crypt]]></category>
		<category><![CDATA[Encryption]]></category>
		<category><![CDATA[Filesystem]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[LUKS]]></category>
		<category><![CDATA[Security]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/2005/11/10/encrypt-devices-using-dm-crypt-and-luks/</guid>
		<description><![CDATA[Secure your data in encrypted partitions and removable volumes, or even volumes within a file, using dm-crypt and the flexibility of LUKS. In this article I describe how I encrypted a ZIP diskette and a partition contained in a file.]]></description>
			<content:encoded><![CDATA[<p>&quot;<em><strong>Encryption</strong> is the process of obscuring information to make it unreadable without special knowledge.</em>&quot; -WikiPedia-</p>
<p>There are many different methods to encrypt data using various encryption algorithms (ciphers). In this document I describe in short how to encrypt a device with one of the most contemporary methods, using <strong>dm-crypt</strong> and <strong>LUKS</strong>. Actually, devices cannot be encrypted. It&#8217;s the block devices which are volumes that can be. This means that you can encrypt a hard disk partition, a ZIP disk, a usb flash stick, or even a volume within a file.<br />
<span id="more-96"></span><br />
<strong>dm-crypt</strong> is a device mapper that uses the 2.6 kernel&#8217;s cryptoapi. We will not use dm-crypt directly to setup the block device mappings because of its complexity, but instead we&#8217;ll use an enhanced version of a program called <strong>cryptsetup</strong>, which has the <strong>LUKS</strong> extension enabled. The reason for using LUKS (Linux Uniﬁed Key Setup) is that it uses a partition header to store the encryption-setup information, so, in contrast to other existing methods, the user can:</p>
<ul>
<li>change the encrypted volume&#8217;s passphrase without having to re-encrypt the data</li>
<li>have multiple passphrases for the same data</li>
<li>transport or migrate data on different systems</li>
</ul>
<p>The most important thing though is that all this convenience does not have an impact on data security, meaning that data is still very safe. Well, this is LUKS. Win32 compatibility is not yet possible, but will be in the near future through <a href="http://www.truecrypt.org/">TrueCrypt</a>.</p>
<h4>Prerequisites</h4>
<p>A Linux 2.6 kernel with <strong>device mapper</strong> and <strong>dm-crypt</strong> support is needed. On Fedora Core 4 systems you really don&#8217;t have to do anything as the kernel has device mapper and dm-crypt enabled as modules (<em>dm-mod</em> and <em>dm-crypt</em> respectively). The modules are loaded automatically when the system needs them.</p>
<p>Before reading any further, <strong>you must be sure</strong> that you know the exact device node you are going to encrypt. This is no joke, as you can <strong>lose your data</strong>, by a simple and fool mistake. So, take note!</p>
<p>Furthermore, you need to install <strong>cryptsetup-luks</strong> package and <strong>util-linux</strong> package. We will need the latter for encrypting a filesystem within a file, but this is probably already installed.</p>
<h4>Encrypting a volume</h4>
<p>In this section I will encrypt a ZIP disk. The very same process can be used for any block device that is a volume, meaning that it can be formatted with a mountable filesystem. So, you can encrypt a hard disk partition, a USB stick, a Compact Flash card etc.</p>
<p>First of all, <strong>be sure</strong> that you know your volume&#8217;s exact device node in /dev. If you use multiple hotplugable devices, which you connect to your machine in a random order, you should consider writing some UDEV rules, so that you know which node corresponds with a certain actual device. You can read my <a href="http://www.g-loaded.eu/2005/09/18/udev/">blog post</a> on that. A simple mistake can lead to loss of data. I have setup UDEV in a such way, that every time I connect my USB ZIP drive and insert a disk, a symlink to the disk&#8217;s node is created in a directory /dev/mydev/. So, I can reach the ZIP diskette by directing the commands to the symlink /dev/mydev/zipdisk.</p>
<p>If your volume is already mounted, <strong>unmount</strong> it before proceeding. Mine is, so I run:</p>
<pre class="console"># umount /dev/mydev/zipdisk</pre>
<h5>Fill the disk with random data</h5>
<p>Filling the disk with random data before encrypting is a good habit and it strengthens security as well. If you don&#8217;t want to do so, you can simply skip this step. This process is CPU intensive and the time it takes depends on the available CPU horsepower, the size of the partition and the speed it can be written. It can be many hours, even days, for very large hard disk partitions. The worst thing is that there is no progress indicator, so you just wait for it to finish. I run this:</p>
<pre class="console"># dd if=/dev/urandom of=/dev/mydev/zipdisk</pre>
<p>Substitute /dev/mydev/zipdisk with the path to your device node. In my case, it took my USB 1.1 ZIP drive 10 whole minutes to fill an 100MB ZIP disk. Well, it&#8217;s not the fastest thing in the world, but I still like it.</p>
<h5>Create the LUKS partition</h5>
<p>Now, I will create a LUKS partition on the ZIP disk. As root I run:</p>
<pre class="console"># cryptsetup --verbose --cipher &quot;aes-cbc-essiv:sha256&quot; --key-size 256 --verify-passphrase luksFormat /dev/mydev/zipdisk</pre>
<p>If you use a kernel older than 2.6.10, do not include the &#8211;cipher option. The default AES with 256-bit key is absolutely fine. Cryptsetup will ask for a passphrase twice. What this does is the initialization of the LUKS partition.</p>
<h5>Set up the device mapping</h5>
<p>In order to use this partition, a device mapping must be set up between the physical partition on the ZIP diskette and a new virtual block device, which can then be mounted. I call it virtual because it&#8217;s just a layer between the physical ZIP disk and the system. Writes to this virtual block device will be encrypted and reads decrypted. To create the device mapping as root:</p>
<pre class="console"># cryptsetup luksOpen /dev/mydev/zipdisk encr-zipdisk</pre>
<p><strong>encr-zipdisk</strong> is just a name for the new block device that is created in <strong>/dev/mapper/</strong>. After creating a filesystem on it, this virtual block device can be mounted and used as normal.</p>
<h5>Create a filesystem on the new block device</h5>
<p>You can create any file system you like on the new volume. For my ZIP diskette, an MSDOS FAT16 filesystem is more than enough, so I run as root:</p>
<pre class="console"># mkdosfs -v -F 16 -n &quot;ENCR1&quot; /dev/mapper/encr-zipdisk</pre>
<p>What worths mentioning is that you create the filesystem on the virtual volume, /dev/mapper/encr-zipdisk in my case, and not the physical one.</p>
<h5>Mount the new volume</h5>
<p>Now I can mount the volume as normal. For example:</p>
<pre class="console"># mount -t vfat -o rw /dev/mapper/encr-zipdisk /mnt/tmp/</pre>
<p>An fstab entry with all the proper mount options could simplify mounting. All data that is written to the disk gets encrypted.</p>
<h5>Unmounting</h5>
<p>Before removing the disk from the drive, I have to unmount it:</p>
<pre class="console"># umount /mnt/tmp/</pre>
<p>And then delete the device mapping as root:</p>
<pre class="console"># cryptsetup luksClose encr-zipdisk</pre>
<p>This removes the association and I normally can eject the ZIP disk.</p>
<h5>In short</h5>
<p>Just a review of the procedure to mount and unmount the disk, considering that a proper fstab entry has been added.</p>
<p>To mount:</p>
<pre class="console"># cryptsetup luksOpen /dev/mydev/zipdisk encr-zipdisk
# mount /dev/mapper/encr-zipdisk</pre>
<p>To unmount:</p>
<pre class="console"># umount /dev/mapper/encr-zipdisk
# cryptsetup luksClose encr-zipdisk</pre>
<p>Pretty fast and easy.</p>
<h4>Encrypt a filesystem within a file</h4>
<p>In order to use LUKS to encrypt a filesystem that is contained in a file, you actually have to follow the same steps as when encrypting a physical partition, plus two. These include:</p>
<ul>
<li>The creation of a file that will contain the encrypted partition</li>
<li>Set up an association between this file and a free loop device, so that it can be used by cryptsetup as a block device. At the moment, cryptsetup cannot use a file as a block device directly. That&#8217;s why this step is needed.</li>
</ul>
<p>So, let&#8217;s create the file. The following command creates an 100MB file, named &quot;<strong>container1</strong>&quot;, which is full of random data:</p>
<pre class="console">dd if=/dev/urandom of=container1 bs=1024 count=100000</pre>
<p>To create a mapping between this file and a free loop device, we&#8217;ll use <strong>losetup</strong> (part of util-linux). Check which loop device is free in your system with the command:</p>
<pre class="console">losetup -f</pre>
<p>For me it was <em>/dev/loop0</em>. So, I map the &quot;container1&quot; file to /dev/loop0. As root:</p>
<pre class="console"># losetup /dev/loop0 /path/to/container1</pre>
<p>From now on, the steps are exactly the same as before. We just use /dev/loop0 instead of the ZIP disk:</p>
<pre class="console"># cryptsetup --verbose --cipher &quot;aes-cbc-essiv:sha256&quot; --key-size 256 --verify-passphrase luksFormat /dev/loop0
# cryptsetup luksOpen /dev/loop0 encr-container1
# mkfs.ext3 /dev/mapper/encr-container1
# mount -t ext3 -o rw,defaults /dev/mapper/encr-container1 /mnt/tmp/</pre>
<p>We can now copy some files to our encrypted partition, like on a regular disk partition. We unmount it and delete the device mappings with the following commands:</p>
<pre class="console"># umount /mnt/tmp/
# cryptsetup luksClose encr-container1
# losetup -d /dev/loop0</pre>
<p>So, to mount a LUKS encrypted filesystem within a file you need to create <strong>two device mappings</strong> before you mount it for use. Of course some automation can be achieved using scripts, but you will still have to supply the passphrase in order to use the encrypted partitions.</p>
<h4>Further Reading</h4>
<p>Apart from reading the cryptsetup and losetup man pages, you can check the following URLs for more info:</p>
<ol>
<li><a href="http://www.saout.de/misc/dm-crypt/">The dm-crypt homepage</a></li>
<li><a href="http://www.saout.de/tikiwiki/tiki-index.php">The dm-crypt wiki</a></li>
<li><a href="http://www.saout.de/tikiwiki/tiki-index.php?page=EncryptedDeviceUsingLUKS">A HOWTO about encrypting a USB HDD</a></li>
<li><a href="http://luks.endorphin.org/">The LUKS homepage</a></li>
</ol>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2005/11/10/encrypt-devices-using-dm-crypt-and-luks/">Encrypt devices using dm-crypt and LUKS</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2006/11/05/truecrypt-on-2618-kernels/" rel="bookmark">TrueCrypt on 2.6.18 kernels</a></li>
<li><a href="http://www.g-loaded.eu/2005/09/19/a-different-approach-hal/" rel="bookmark">A different approach&#8230;HAL</a></li>
<li><a href="http://www.g-loaded.eu/2005/09/18/udev/" rel="bookmark">UDEV</a></li>
<li><a href="http://www.g-loaded.eu/2005/11/10/packet-writing-on-cdrw-and-dvdrw-media/" rel="bookmark">Packet Writing on CDRW and DVDRW media</a></li>
<li><a href="http://www.g-loaded.eu/2009/01/04/always-use-a-block-device-label-or-its-uuid-in-fstab/" rel="bookmark">Always use a block device label or its UUID in fstab</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2005/11/10/encrypt-devices-using-dm-crypt-and-luks/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Be your own Certificate Authority (CA)</title>
		<link>http://www.g-loaded.eu/2005/11/10/be-your-own-ca/</link>
		<comments>http://www.g-loaded.eu/2005/11/10/be-your-own-ca/#comments</comments>
		<pubDate>Thu, 10 Nov 2005 13:33:40 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[Certificates]]></category>
		<category><![CDATA[Encryption]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[OpenSSL]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[TLS]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/2005/11/10/be-your-own-ca/</guid>
		<description><![CDATA[This article describes how to become your own Certificate Authority (CA) and issue your own server certificates. Be advised that noone else, apart from you, your internal network's people or your friends, will or should trust this kind of certificates (self-signed). These are intended only for providing secure communication with your own services or for testing purposes.]]></description>
			<content:encoded><![CDATA[<p>I declare from the beginning that I am no authority on digital <strong>certificates</strong>.<br />
This document is a summary of all the articles I have read about <strong>openssl</strong>. It describes in short how to become your own <strong>Certificate Authority</strong> (CA) and how to create and sign your own <strong>certificate requests</strong>. Make no mistake, these certificates are good only for personal use or for use in your intranet in order to provide a secure way to login or communicate with your services, so that passwords or other data is not transmitted in the clear. Noone else will or should trust these certificates.<br />
<span id="more-94"></span></p>
<h4>Prerequisites</h4>
<p>The package <strong>openssl</strong> should be installed in the machine you will use to manage your certificates or create the certificate requests.</p>
<h4>First things first&#8230;</h4>
<p>The <strong>openssl</strong> package comes with some scripts that can help you create your server certificates fast, but here I will describe how to set things up from scratch in a new directory, so that you can customize things later if you like or delete everything without touching openssl&#8217;s or the system&#8217;s default files. This article is based on a Fedora installation, but will do for all distributions.</p>
<h5>Creating the necessary directories</h5>
<p>First of all we will create a directory tree where all certificate stuff will be kept. Fedora&#8217;s default directory is <strong>/etc/pki/tls/</strong>. So, as root, we create our own directories:</p>
<pre class="console"># mkdir -m 0755 /etc/pki_jungle</pre>
<p>And then we create our CA&#8217;s directory tree:</p>
<pre class="console">
# mkdir -m 0755 \
     /etc/pki_jungle/myCA \
     /etc/pki_jungle/myCA/private \
     /etc/pki_jungle/myCA/certs \
     /etc/pki_jungle/myCA/newcerts \
     /etc/pki_jungle/myCA/crl
</pre>
<ul>
<li><strong>myCA</strong> is our Certificate Authority&#8217;s directory.</li>
<li><strong>myCA/certs</strong> directory is where our server certificates will be placed.</li>
<li><strong>myCA/newcerts</strong> directory is where openssl puts the created certificates in PEM (unencrypted) format and in the form <em>cert_serial_number.pem</em> (eg 07.pem). Openssl needs this directory, so we create it.</li>
<li><strong>myCA/crl</strong> is where our certificate revokation list is placed.</li>
<li><strong>myCA/private</strong> is the directory where our private keys are placed. Be sure that you set restrictive permissions to all your private keys so that they can be read only by root, or the user with whose priviledges a server runs. If anyone steals your private keys, then things get really bad.</li>
</ul>
<h5>Initial openssl configuration</h5>
<p>We are going to copy the default openssl configuration file (<strong>openssl.cnf</strong>) to our CA&#8217;s directory. In Fedora, this file exists in <strong>/etc/pki/tls</strong>. So, we copy it to our CA&#8217;s dir and name it <strong>openssl.my.cnf</strong>. As root:</p>
<pre class="console"># cp /etc/pki/tls/openssl.cnf /etc/pki_jungle/myCA/openssl.my.cnf</pre>
<p>This file does not need to be world readable, so we change its attributes:</p>
<pre class="console"># chmod 0600 /etc/pki_jungle/myCA/openssl.my.cnf</pre>
<p>We also need to create two other files. This file serves as a database for openssl:</p>
<pre class="console"># touch /etc/pki_jungle/myCA/index.txt</pre>
<p>The following file contains the next certificate&#8217;s serial number. Since we have not created any certificates yet, we set it to &quot;<strong>01</strong>&quot;:</p>
<pre class="console"># echo '01' > /etc/pki_jungle/myCA/serial</pre>
<h4>Things to remember</h4>
<p>Here is a small legend with <strong>file extensions</strong> we will use for the created files and their meaning. All files that will be created will have one of these extensions:</p>
<ul>
<li><strong>KEY</strong> &#8211; Private key (Restrictive permissions should be set on this)</li>
<li><strong>CSR</strong> &#8211; Certificate Request (This will be signed by our CA in order to create the server certificates. Afterwards it is not needed and can be deleted)</li>
<li><strong>CRT</strong> &#8211; Certificate (This can be publicly distributed)</li>
<li><strong>PEM</strong> &#8211; We will use this extension for files that contain both the Key and the server Certificate (Some servers need this). Permissions should be restrictive on these files.</li>
<li><strong>CRL</strong> &#8211; Certificate Revokation List (This can be publicly distributed)</li>
</ul>
<h4>Create the CA Certificate and Key</h4>
<p>Now, that all initial configuration is done, we may create a self-signed certificate, that will be used as our CA&#8217;s certificate. In other words, we will use this to sign other certificate requests.</p>
<p>Change to our CA&#8217;s directory. <span style="text-decoration:underline;">This is where we should issue all the openssl commands because here is our openssl&#8217;s configuration file (openssl.my.cnf).</span> As root:</p>
<pre class="console"># cd /etc/pki_jungle/myCA/</pre>
<p>And then create your CA&#8217;s Certificate and Private Key. As root:</p>
<pre class="console"># openssl req -config openssl.my.cnf -new -x509 -extensions v3_ca -keyout private/myca.key -out certs/myca.crt -days 1825</pre>
<p>This creates a self-signed certificate with the default CA extensions which is valid for 5 years. You will be prompted for a <strong>passphrase</strong> for your CA&#8217;s private key. <span style="text-decoration:underline;">Be sure that you set a strong passphrase.</span> Then you will need to provide some info about your CA. Fill in whatever you like. Here is an example:</p>
<pre class="codesnp">Country Name (2 letter code) [GB]:GR
State or Province Name (full name) [Berkshire]:Greece
Locality Name (eg, city) [Newbury]:Thessaloniki
Organization Name (eg, company) [My Company Ltd]:My Network
Organizational Unit Name (eg, section) []:My Certificate Authority
Common Name (eg, your name or your server's hostname) []:server.example.com
Email Address []:whatever@server.example.com</pre>
<p>Two files are created:</p>
<ul>
<li><strong>certs/myca.crt</strong> &#8211; This is your CA&#8217;s certificate and can be publicly available and of course world readable.</li>
<li><strong>private/myca.key</strong> &#8211; This is your CA&#8217;s private key. Although it is protected with a passphrase you should restrict access to it, so that only root can read it:
<pre class="console"># chmod 0400 /etc/pki_jungle/myCA/private/myca.key</pre>
</li>
</ul>
<h4>More openssl configuration (mandatory)</h4>
<p>Because we use a custom directory for our certificates&#8217; management, some modifications to <strong>/etc/pki_jungle/myCA/openssl.my.cnf</strong> are necessary. Open it in your favourite text editor as root and find the following part (around line 35):</p>
<pre class="codesnp">[ CA_default ]
dir     = ../../CA      # Where everything is kept
certs       = $dir/certs        # Where the issued certs are kept
crl_dir     = $dir/crl      # Where the issued crl are kept
database    = $dir/index.txt    # database index file.
#unique_subject = no            # Set to 'no' to allow creation of
                    # several ctificates with same subject.
new_certs_dir   = $dir/newcerts     # default place for new certs.
certificate = $dir/cacert.pem   # The CA certificate
serial      = $dir/serial       # The current serial number
#crlnumber  = $dir/crlnumber    # the current crl number must be
                    # commented out to leave a V1 CRL
crl     = $dir/crl.pem      # The current CRL
private_key = $dir/private/cakey.pem    # The private key
RANDFILE    = $dir/private/.rand    # private random number file
x509_extensions = usr_cert      # The extentions to add to the cert
</pre>
<p>You should modify the following settings in order to coform to our custom directory and our custom CA key and certificate:</p>
<pre class="codesnp">[ CA_default ]
dir     = <strong>.</strong>                # <strong>&lt;&#45;&#45;CHANGE THIS</strong>
certs       = $dir/certs
crl_dir     = $dir/crl
database    = $dir/index.txt
#unique_subject = no
new_certs_dir   = $dir/newcerts
certificate = $dir/<strong>certs/myca.crt</strong>   # <strong>&lt;&#45;&#45;CHANGE THIS</strong>
serial      = $dir/serial
#crlnumber  = $dir/crlnumber
crl     = $dir/crl.pem
private_key = $dir/private/<strong>myca.key</strong>    # <strong>&lt;&#45;&#45;CHANGE THIS</strong>
RANDFILE    = $dir/private/.rand
x509_extensions = usr_cert</pre>
<h4>Create a Server certificate</h4>
<p>Further openssl.my.cnf file&#8217;s customization is possible, so that we define our policy for certificate creation and signing or define our desired extensions for the new certificates. I may add this info to a future version of this document. It&#8217;s easy though, just try to familiarize yourself with the openssl.cnf&#8217;s structure and you&#8217;ll figure it out.</p>
<p>Anyway, the certificates we are going to create, without customizing openssl.my.cnf any further, are <strong>general purpose certificates</strong> and their usage in not restricted to server authentication only. One thing that you should take a note of is that <strong>the private keys will not be protected by a passphrase</strong>, so that when the services are restarted they do not ask for a passphrase. This means that you should <strong>set restrictive permissions on the private keys</strong>, so that only root or the user under whose priviledges a server runs can read these files.</p>
<h5>Generate a Certificate Request</h5>
<p>First, we change to our CA&#8217;s directory:</p>
<pre class="console"># cd /etc/pki_jungle/myCA/</pre>
<p>Then we create the certificate request:</p>
<pre class="console"># openssl req -config openssl.my.cnf -new -nodes -keyout private/server.key -out server.csr -days 365</pre>
<p>The <strong>-nodes</strong> option is needed so that the private key is not protected with a passphrase. If you do not intend to use the certificate for server authentication, you should not include it in the above command.<br />
You can customize the number of days you want this certificate to be valid for.</p>
<p>You will be prompted for the certificate&#8217;s info. Here is an example:</p>
<pre class="codesnp">Country Name (2 letter code) [GB]:GR
State or Province Name (full name) [Berkshire]:Greece
Locality Name (eg, city) [Newbury]:Thessaloniki
Organization Name (eg, company) [My Company Ltd]:My Network
Organizational Unit Name (eg, section) []:My Web Server
Common Name (eg, your name or your server's hostname) []:www.server.example.com
Email Address []:whatever@server.example.com</pre>
<p>The <strong>Common Name (CN)</strong> is the info that uniquely distinguishes your service, so be sure that you type it correctly.<br />
When prompted for some extra attributes (challenge password, optional company name) just hit the [Enter] key.</p>
<p>Two files are created:</p>
<ul>
<li><strong>server.csr</strong> &#8211; this is the certificate request.</li>
<li><strong>private/server.key</strong> &#8211; this is the private key, which is not protected with a passphrase.</li>
</ul>
<p>Set restrictive permissions on the private key. Only root or the user that is used to run the server should be able to read it. For example:</p>
<pre class="console"># chown root.root /etc/pki_jungle/myCA/private/server.key
# chmod 0400 /etc/pki_jungle/myCA/private/server.key</pre>
<p>Or:</p>
<pre class="console"># chown root.apache /etc/pki_jungle/myCA/private/server.key
# chmod 0440 /etc/pki_jungle/myCA/private/server.key</pre>
<h5>Sign the Certificate Request</h5>
<p>Now we are going to sign the certificate request and generate the server&#8217;s certificate.</p>
<p>First, we change to our CA&#8217;s directory:</p>
<pre class="console"># cd /etc/pki_jungle/myCA/</pre>
<p>Then we sign the certificate request:</p>
<pre class="console"># openssl ca -config openssl.my.cnf -policy policy_anything -out certs/server.crt -infiles server.csr</pre>
<p>You will need to supply the CA&#8217;s private key in order to sign the request. You can check the openssl.my.cnf file about what <strong>policy_anything</strong> means. In short, the fields about the Country, State or City is not required to match those of your CA&#8217;s certificate.</p>
<p>After all this is done two new files are created:</p>
<ul>
<li><strong>certs/server.crt</strong> &#8211; this is the server&#8217;s certificate, which can be made available publicly.</li>
<li><strong>newcerts/01.pem</strong> &#8211; This is exactly the same certificate, but with the certificate&#8217;s serial number as a filename. It is not needed.</li>
</ul>
<p>You can now delete the certificate request (server.csr). It&#8217;s no longer needed:</p>
<pre class="console"># rm -f /etc/pki_jungle/myCA/server.csr</pre>
<h5>Verify the certificate</h5>
<p>You can see the certificate&#8217;s info with the following:</p>
<pre class="console"># openssl x509 -subject -issuer -enddate -noout -in /etc/pki_jungle/myCA/certs/server.crt</pre>
<p>Or the following:</p>
<pre class="console"># openssl x509 -in certs/server.crt -noout -text</pre>
<p>And verify that the certificate is valid for server authentication with the following:</p>
<pre class="console"># openssl verify -purpose sslserver -CAfile /etc/pki_jungle/myCA/certs/myca.crt /etc/pki_jungle/myCA/certs/server.crt</pre>
<h5>Server certificate and key in one file</h5>
<p>Some servers, for example vsftpd, require that both the private key and the certificate exist in the same file. In a situation like that just do the following:</p>
<pre class="console"># cat certs/server.crt private/server.key > private/server-key-cert.pem</pre>
<p>You should restrict access to the final file and delete server.crt and server.key since thay are no longer needed.</p>
<pre class="console"># chown root.root private/server-key-cert.pem
# chmod 0400 private/server-key-cert.pem
# rm -f certs/server.crt
# rm -f private/server.key</pre>
<h4>Revoke a Server Certificate</h4>
<p>If you do not want a certificate to be valid any more, you have to revoke it. This is done with the command:</p>
<pre class="console"># openssl ca -config openssl.my.cnf -revoke certs/server.crt</pre>
<p>Then you should generate a new CRL (Certificate Revokation List):</p>
<pre class="console"># openssl ca -config openssl.my.cnf -gencrl -out crl/myca.crl</pre>
<p>The CRL file is <strong>crl/myca.crl</strong>.</p>
<h4>Distribute your certificates and CRL</h4>
<p>Your CA&#8217;s certificate and your servers&#8217; certificates should be distributed to those who trust you so they can import them in their client software (web browsers, ftp clients, email clients etc). The CRL should also be published.</p>
<h4>Further Reading</h4>
<p>As I have said from the beginning, this document is just a summary of what I have read. Here are some useful links that will get you started:</p>
<ol>
<li><a href="http://www.tldp.org/HOWTO/SSL-Certificates-HOWTO/index.html">The SSL Certificates HOWTO</a></li>
<li><a href="http://sial.org/howto/openssl/">The OpenSSL Documentation</a></li>
<li><a href="http://www.technoids.org/openssl.cnf.html">The openssl.cnf documentation</a></li>
<li><a href="http://sial.org/howto/openssl/ca/">OpenSSL Certificate Authority Setup</a></li>
</ol>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2005/11/10/be-your-own-ca/">Be your own Certificate Authority (CA)</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2007/11/22/root-certificate-programs-the-root-of-all-trust/" rel="bookmark">Root Certificate Programs &#8211; The root of all trust</a></li>
<li><a href="http://www.g-loaded.eu/2007/08/10/ssl-enabled-name-based-apache-virtual-hosts-with-mod_gnutls/" rel="bookmark">SSL-enabled Name-based Apache Virtual Hosts with mod_gnutls</a></li>
<li><a href="http://www.g-loaded.eu/2009/10/12/free-personal-email-certificates-program-discontinued-by-thawte/" rel="bookmark">Free Personal Email Certificates Program discontinued by Thawte</a></li>
<li><a href="http://www.g-loaded.eu/2005/11/10/ssh-with-keys/" rel="bookmark">Setup the SSH server to use keys for authentication</a></li>
<li><a href="http://www.g-loaded.eu/2005/11/10/configure-vnc-server-in-fedora/" rel="bookmark">Set up the VNC Server in Fedora</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2005/11/10/be-your-own-ca/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Set up the VNC Server in Fedora</title>
		<link>http://www.g-loaded.eu/2005/11/10/configure-vnc-server-in-fedora/</link>
		<comments>http://www.g-loaded.eu/2005/11/10/configure-vnc-server-in-fedora/#comments</comments>
		<pubDate>Thu, 10 Nov 2005 13:28:16 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[Encryption]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Remote]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[SSH]]></category>
		<category><![CDATA[VNC]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/2005/11/10/configure-vnc-server-in-fedora/</guid>
		<description><![CDATA[This article describes in brief how to configure VNC server instances for one or multiple users on a remote machine, how to use VNC to start graphical applications on boot and finally how to enhance security by connecting to the server through encrypted SSH tunnels.]]></description>
			<content:encoded><![CDATA[<p>&quot;<em><strong>Virtual Network Computing (VNC)</strong> is a desktop protocol to remotely control another computer. It transmits the keyboard presses and mouse clicks from one computer to another relaying the screen updates back in the other direction, over a network.</em>&quot; -WikiPedia-</p>
<p>This article describes in brief how to configure <strong>VNC server</strong> instances for one or multiple users on a remote machine, how to use <strong>VNC</strong> to start graphical applications on boot and finally how to enhance <strong>security</strong> by connecting to the server through encrypted <strong>SSH</strong> tunnels.<br />
<span id="more-93"></span></p>
<h4>Prerequisites</h4>
<p>A <strong>user account</strong> should exist on the remote machine.<br />
The RPM packages <strong>vnc-server</strong> and <strong>vnc</strong> should be installed on the remote machine and your workstation respectively.</p>
<h4>Setting up the server</h4>
<p>I assume that we have setup a remote user account, named &quot;<strong>leopard</strong>&quot; and we want to start an X session through VNC for this user.</p>
<p>In Fedora Core or Red Hat based distros in general, all we have to do is define the VNC server instances in <strong>/etc/sysconfig/vncservers</strong>. These will be started by the vncserver initscript. This has to be done <strong>as root</strong>. Edit this file so that it contains the following:</p>
<pre class="codesnp">VNCSERVERS=&quot;3:leopard&quot;
VNCSERVERARGS[3]=&quot;-geometry 1024x768 -depth 16&quot;</pre>
<p>With these we define that a vnc server instance should be started as user leopard on <strong>display 3</strong> and we also set some options for this server such as <strong>resolution</strong> and <strong>color depth</strong>. Each VNC server instance <em>listens on port 5900 plus the display number</em> on which the server runs. In our case, leopard&#8217;s vnc server would listen on <strong>port 5903</strong>.</p>
<p>For multiple vnc instances <strong>/etc/sysconfig/vncservers</strong> would look like this:</p>
<pre class="codesnp">VNCSERVERS=&quot;1:tiger 2:albatros 3:leopard&quot;
VNCSERVERARGS[1]=&quot;-geometry 1024x768 -depth 16&quot;
VNCSERVERARGS[2]=&quot;-geometry 800x600 -depth 8&quot;
VNCSERVERARGS[3]=&quot;-geometry 1024x768 -depth 16&quot;</pre>
<p>These would listen on ports <strong>5901</strong>, <strong>5902</strong>, <strong>5903</strong> respectively.</p>
<h4>User Configuration</h4>
<p>There is one more thing that needs to be done on the remote machine. User leopard&#8217;s vnc password needs to be set. So, as user leopard give the command:</p>
<pre class="console"># vncpasswd</pre>
<p>We are prompted for a password. This is the password that we will use when we connect to leopard&#8217;s vnc server instance. This password is saved in <strong>/home/leopard/.vnc/passwd</strong>.</p>
<h4>Start the VNC server</h4>
<p>After the initial configuration is done we restart the vnc service. As root:</p>
<pre class="console"># service vncserver restart</pre>
<p>To make VNC server to start on boot:</p>
<pre class="console"># chkconfig vncserver on</pre>
<h4>More User Configuration</h4>
<p>After the VNC service is started, some new files are created in <strong>/home/leopard/.vnc/</strong> directory. These include leopard&#8217;s vnc server log file, pid file and an X startup script. As user leopard we edit the script in order to customize some settings. The default <strong>/home/leopard/.vnc/xstartup</strong> script contains some commands that are executed when the VNC server is started. These include:</p>
<pre class="codesnp">xsetroot -solid grey
vncconfig -iconic &#38;
xterm -geometry 80x24+10+10 -ls -title &quot;$VNCDESKTOP Desktop&quot; &#38;
twm &#38;</pre>
<p><strong>xsetroot</strong> in this case sets the background color.<br />
<strong>vncconfig</strong> is a supplementary program that can be used to control the vnc server. Apart from this, when run without arguments it acts as a helper application and its main purpose is to provide support for clipboard transfers between the client (vncviewer) and the vnc server.<br />
<strong>xterm</strong> starts an xterm terminal.<br />
<strong>twm</strong> starts the X server&#8217;s default window manager. We probably want to change that to a more user friendly window manager, eg fluxbox.</p>
<p>The VNC server, apart from letting us control a remote machine using a graphical interface, it <strong>serves as a way to start graphical applications on boot</strong>. For example, I want my favourite p2p program, amule, to start on boot. So, I add this to the <strong>/home/leopard/.vnc/xstartup</strong> script. This is how my xstartup file looks like:</p>
<pre class="codesnp">xsetroot -solid grey
vncconfig -iconic &#38;
xterm -geometry 80x24+10+10 -ls -title &quot;$VNCDESKTOP Desktop&quot; -e ./menu &#38;
amule &#38;
fluxbox &#38; </pre>
<p><strong>menu</strong> is a script of mine that is executed when xterm is started.<br />
Remember to put the &quot;<strong>&#38;</strong>&quot; symbol after each command, so that it goes to the background and the xstartup script continues on.</p>
<p>Restart the VNC service for the changes to take effect. As root:</p>
<pre class="console"># service vncserver restart</pre>
<h4>Connect to the VNC server</h4>
<p>In our example, leopard&#8217;s vnc server listens for connections on port <strong>5903</strong>. So, <span style="text-decoration:underline;">open this port</span> in the remote machine&#8217;s firewall.</p>
<p>We connect to the remote machine using a vnc viewer. Having installed the <strong>vnc</strong> package, connect to to the server with the following command:</p>
<pre class="console"># vncviewer 192.168.0.1:5903:3</pre>
<p>The general usage is :</p>
<pre class="codesnp">vncviewer [Server's IP]:[Port]:[Display]</pre>
<p>We are prompted for the password and eventually connect to the server. Closing the vncviewer&#8217;s window, does not affect the server or the programs we run on it. If we reconnect everything will be there.</p>
<p><em><span style="text-decoration:underline;">Special Note:</span></em> There is no need, actually it&#8217;s pointless and could give you some trouble, to logoff from your remote X session. If this happens, generally you need to restart the VNC service on the remote machine to get your remote desktop back. If you want to stop working on your remote desktop, just close the vncviewer&#8217;s window and you are done.</p>
<h4>Security</h4>
<p>The VNC protocol is not a secure communication protocol. The use of a vnc password provides security at the level of server access (it&#8217;s vulnerable to brute-force attacks though), but the whole VNC session is transmitted in the clear, without encryption. The easiest, but most effective, way to secure our connection to the VNC server is to connect through an encrypted <strong>SSH tunnel</strong>. This way the whole session will be encrypted.</p>
<p>The rest assume that you have the SSH server up and running on your remote machine (server.example.com) and you know what SSH tunnels are.</p>
<p>So, what we are going to do is to create an encrypted tunnel, and connect to our VNC server through it. We also want this tunnel to be <strong>automatically closed</strong> as soon as we shut down vncviewer. All this is done with the following command:</p>
<pre class="console"># ssh -f -L 25903:127.0.0.1:5903 leopard@server.example.com sleep 10; vncviewer 127.0.0.1:25903:3</pre>
<p>This is what it does:</p>
<ul>
<li><strong>-L 25903:127.0.0.1:5903</strong> forwards our local port 25903 to port 5903 on the remote machine. In other words, it creates the tunnel.</li>
<li><strong>-f</strong> forks the SSH session to the background, while <strong>sleep</strong> is being executed on the remote machine. This ssh option is needed because we want to execute the following command (vncviewer) in the same <em>local</em> machine&#8217;s terminal.</li>
<li><strong>vncviewer</strong> connects to the forwarded local port 25903 in order to connect to the VNC server through the encrypted tunnel.</li>
</ul>
<p>The <strong>sleep</strong> command is of major importance in the above line as it keeps the encrypted tunnel open for 10 seconds. If no application uses it during this period of time, then it&#8217;s closed. Contrariwise, if an application uses it during the 10 sec period, then the tunnel remains open until this application is shut down. This way the tunnel is <strong>automatically closed</strong> at the time we close vncviewer&#8217;s window, without leaving any SSH processes running on our workstation. This is pure convenience! More information can be found at the <a href="http://www.g-loaded.eu/2006/11/24/auto-closing-ssh-tunnels/">Auto-closing SSH Tunnels</a> article.</p>
<p>Using SSH tunnels to conect to your VNC server has two advantages:</p>
<ol>
<li>The whole session is encrypted.</li>
<li>Keeping port 5903 open on your remote machine <em>is no longer needed</em>, since all take place through the SSH tunnel. So, noone will know that you run a VNC server on the remote machine.</li>
</ol>
<h4>Further Reading</h4>
<p>I recommend that you read the man pages. Everything is in there:</p>
<pre>
# man vncserver
# man Xvnc
# man vncconfig
# man vncviewer
# man ssh
</pre>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2005/11/10/configure-vnc-server-in-fedora/">Set up the VNC Server in Fedora</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2005/10/20/ssh-tunnels-headaches/" rel="bookmark">SSH Tunnels Headaches</a></li>
<li><a href="http://www.g-loaded.eu/2006/11/24/auto-closing-ssh-tunnels/" rel="bookmark">Auto-closing SSH tunnels</a></li>
<li><a href="http://www.g-loaded.eu/2005/11/10/ssh-with-keys/" rel="bookmark">Setup the SSH server to use keys for authentication</a></li>
<li><a href="http://www.g-loaded.eu/2006/11/06/netcat-a-couple-of-useful-examples/" rel="bookmark">Netcat &#8211; a couple of useful examples</a></li>
<li><a href="http://www.g-loaded.eu/2010/03/26/python-ssh-server-unix-twisted-conch/" rel="bookmark">Python SSH Server for UNIX Systems using Twisted.conch</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2005/11/10/configure-vnc-server-in-fedora/feed/</wfw:commentRss>
		<slash:comments>39</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Setup the SSH server to use keys for authentication</title>
		<link>http://www.g-loaded.eu/2005/11/10/ssh-with-keys/</link>
		<comments>http://www.g-loaded.eu/2005/11/10/ssh-with-keys/#comments</comments>
		<pubDate>Thu, 10 Nov 2005 13:13:12 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[Encryption]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Public Keys]]></category>
		<category><![CDATA[Remote]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[SSH]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/2005/11/10/ssh-with-keys/</guid>
		<description><![CDATA[In this article I describe how to configure the SSH server, so that users authenticate using keys, how to generate DSA keys using ssh-keygen, how to configure ssh-agent and finally how to use ssh-add to manage cached passphrases.]]></description>
			<content:encoded><![CDATA[<p>&quot;<em><strong>Secure Shell</strong> or <strong>SSH</strong> is both a computer program and an associated network protocol designed for logging into and executing commands on a networked computer.</em>&quot; -WikiPedia-</p>
<p>An SSH server can be set up in various ways, but in this document I&#8217;ll describe how it can be configured to:</p>
<ul>
<li>only support connections through the 2nd version of the SSH protocol (SSH-2)</li>
<li>use DSA keys for user authentication, without permitting authentication with passwords</li>
<li>allow only a specific group of users to connect</li>
</ul>
<p><span id="more-91"></span><br />
The SSH-2 protocol, apart from many other useful features, provides stronger security than SSH-1. It&#8217;s a bit more cpu hungry than the latter, but this should not be a problem. Using the above configuration, someone must be extremely lucky to manage to break into our system.</p>
<p>But, let me say a few words about how the authentication is done. The user creates a keypair, which consists of a private key, that can be protected with a passphrase, and a public key. The public key is transfered to the server and the private key is kept in our workstation. We assume that the user has accounts in both the server machine and his workstation. Everytime he tries to connect to the server, the keys are validated and the user is granted access.</p>
<h4>Prerequisites</h4>
<p>A <strong>user account</strong> in the SSH server machine.</p>
<p>You need to install the following packages to the SSH server machine:</p>
<ul>
<li>openssh</li>
<li>openssh-server</li>
</ul>
<p>The client machines should have the following:</p>
<ul>
<li>openssh</li>
<li>openssh-clients</li>
</ul>
<h4>First things first&#8230;</h4>
<p>I assume that our server machine (<strong><em>server.example.com</em></strong>) is a headless one and that the SSH server is up and running with the default configuration. This permits users, including root, to login with their username/password combination. I also assume that we have already set up a user account on the server with the username &quot;<strong><em>leopard</em></strong>&quot;. From a client machine (<strong><em>pc1.example.com</em></strong>) we connect like this:</p>
<pre class="console"># ssh leopard@server.example.com</pre>
<h5>Keypair generation</h5>
<p>The default key directory is &quot;<strong>~/.ssh</strong>&quot;. Create this directory <strong>in both</strong> the user leopard&#8217;s home on the server and in your current home directory on the client machine and chmod it so that only the users have access to it.</p>
<pre class="console"># mkdir ~/.ssh
# chmod 0700 ~/.ssh</pre>
<p>Now, we will create our keypair <span style="text-decoration:underline;">on our client machine</span>. The following command creates a standard 1024-bit DSA keypair:</p>
<pre class="console"># ssh-keygen -t dsa -f ~/.ssh/id_dsa</pre>
<p>You will be asked for a <strong>passphrase</strong> for the private key. You can type any phrase here or leave it blank. Keep in mind that if you do not set a passphrase for you private key and someone else gets access to it, then it will take him only a few seconds to connect to your user account on the server. Anyway, this is up to you. After the key generation is finished, the files <strong>id_dsa</strong> (private key) and <strong>id_dsa.pub</strong> (public key) are created in the <strong>~/.ssh/</strong> directory.</p>
<p>Now, we will copy the public key to the <em>/home/leopard/.ssh/</em> directory on the server saving it with the name <strong>authorized_keys</strong> and delete id_dsa.pub from our client machine, just because it&#8217;s not needed to be there.</p>
<pre class="console"># scp ~/.ssh/id_dsa.pub leopard@server.example.com:~/.ssh/authorized_keys
# rm -f ~/.ssh/id_dsa.pub</pre>
<p>Make sure that you chmod both keys so that only the respective users have access to them. Issue the following command on <strong>both</strong> the server and the client machine:</p>
<pre class="console"># chmod 0600 ~/.ssh/*</pre>
<h5>A limited group of SSH users</h5>
<p>As an extra security measure, we will create a new group <span style="text-decoration:underline;">on the server machine</span> and configure the SSH server to only allow this group&#8217;s members to authenticate. So, we create a group named &quot;<strong>sshusers</strong>&quot; and add user &quot;<strong>leopard</strong>&quot; to it. This has to be done as root:</p>
<pre class="console"># groupadd sshusers
# usermod -a -G sshusers leopard</pre>
<h4>The SSH Server configuration</h4>
<p>The SSH server&#8217;s configuration file is <strong>/etc/ssh/sshd_config</strong>. Most of the default options do not need to be modified. What we&#8217;ll do is to set it up so that only the members of the &quot;<strong>sshusers</strong>&quot; group can authenticate using keys instead of passwords. So, as root, fire up your favourite text editor and edit the server configuration file.<br />
<em>NOTE</em>: It&#8217;s a good habit to create backups before editing system files.<br />
The options that need to be modified are shown below:</p>
<pre class="codesnp">
Port 22
Protocol 2
AddressFamily inet
ListenAddress 192.168.0.1</pre>
<p>With these we configure the server to listen on port 22, accept connections only over the SSH-2 protocol, use the IPv4 address family and bind on the 192.168.0.1 IP address. Only the &quot;<strong>protocol</strong>&quot; option is really critical. You can set the others as you like or leave the defaults.</p>
<pre class="codesnp">HostKey /etc/ssh/ssh_host_dsa_key</pre>
<p>Uncomment or add this line. This is exactly the same as the default option, but needs to be uncommented in the server configuration file, so that the server shows its DSA key&#8217;s fingerprint when the client tries to authenticate the server during the connection process. If this is not set, then the server shows its RSA key&#8217;s fingerprint (the reason is unknown to me).</p>
<pre class="codesnp">
LoginGraceTime 2m
PermitRootLogin no
MaxAuthTries 1</pre>
<p>The <strong>LoginGraceTime</strong> option sets a time limit for the user authentication process. If this time passes and the user has not yet authenticated succesfully, then the server closes the connection. Leave this value to the default &quot;<span style="text-decoration:underline;">2m</span>&quot; until everything is set up properly, so that you have enough time to read any server messages. After that, you can lower it to a reasonable value. I have set it to &quot;<span style="text-decoration:underline;">20s</span>&quot;.<br />
Setting the &quot;<strong>PermitRootLogin</strong>&quot; option to &quot;<span style="text-decoration:underline;">no</span>&quot; the server does not allow root to login directly. You can still use &quot;<strong>su</strong>&quot; after you have succesfully logged in as a normal user.<br />
The &quot;<strong>MaxAuthTries</strong>&quot; option sets the maximum login attempts per connection. Since we use keys and key validation never fails, we set it to &quot;1&quot;.</p>
<pre class="codesnp">
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys</pre>
<p>These are the default options. I just add them here so that you make sure they are set up properly in your config.</p>
<pre class="codesnp">
RSAAuthentication no
PasswordAuthentication no
UsePAM no
KerberosAuthentication no
GSSAPIAuthentication no</pre>
<p>We do not want the server to let users authenticate using passwords or use SSH-1 based authentication methods. You should comment out any Kerberos or GSSAPI options too.</p>
<pre class="codesnp">AllowGroups sshusers</pre>
<p>Only users that belong to the &quot;<strong>sshusers</strong>&quot; group can authenticate. Any other user will be rejected without even being given the oportunity to authenticate.</p>
<pre class="codesnp">MaxStartups 2</pre>
<p>This option specifies the maximum number of concurrent unauthenticated connections to the SSH Server. It has nothing to do with the number of authenticated connections. The default value is &quot;10&quot;. We lower this value in order to limit the connections from third parties which do not have an account on our server machine.</p>
<pre class="codesnp">Banner /etc/ssh/banner</pre>
<p>Finaly, you can set a text file that will be displayed as a banner when someone connects to the server. Just remember that it is displayed before the authentication takes place, so do not be very descriptive. The banner is not really needed.</p>
<p>This is all we have to do. The rest of the configuration options should be left to their default values, unless you need something different. This is up to you.</p>
<h5>Restarting the server</h5>
<p>Now, that we have finished editing the config file, we need to restart the server, so that our changes take effect. Before that, I would recommend deleting any existing server keys. Don&#8217;t worry, they will be recreated as soon as the service is restarted. A quick way to delete all the keys is to:</p>
<pre class="console"># rm -f ssh_host*key*</pre>
<p>Then restart the server:</p>
<pre class="console"># service sshd restart</pre>
<p>Note that the key creation time may vary from machine to machine, so it may take a few minutes if the CPU is slow.</p>
<p>The server logging is done through syslog and authentication information is sent to <em>/var/log/secure</em>. This file should not be world-readable.</p>
<p>A last thing is to take a note of the server&#8217;s DSA public key fingerprint, so that we can compare it with the fingerprint the server sends to our client when we connect. This is important for connections to the server from locations other than our LAN in order to be sure that we actually connect to our server. On the server console type:</p>
<pre class="console"># ssh-keygen -l -f /etc/ssh/ssh_host_dsa_key.pub</pre>
<p>Take a note of the fingerprint.</p>
<h4>Connect to the server</h4>
<p>To connect to our SSH server from our client machine (pc1.example.com), we type:</p>
<pre class="console"># ssh leopard@server.example.com</pre>
<p>I suggest that the first time you connect you should add the <strong>-v</strong> option to the above command for verbose output.</p>
<p>Before the user authentication takes place, the ssh client will try to authenticate the SSH server. Since, there is no stored information about your server it will present you the server&#8217;s public DSA key fingerprint so you can compare it with the fingerprint you had previously taken a note of during the server configuration. If the fingerprints are identical, you can answer positively to the question. At this time the file <strong>~/.ssh/known_hosts</strong> is created on your client machine and it contains the trusted SSH server&#8217;s information. You will never be asked again if you trust this server. If the fingerprint comparison took you longer than the server&#8217;s <strong>LoginGraceTime</strong>, the user authentication does not take place. Just try to reconnect. This time you will eventually log in succesfully using key authentication.</p>
<h5>Hashing the known_hosts file</h5>
<p>Because the servers&#8217; hostnames and addresses are stored in plain text in the <strong>known_hosts</strong> file, hashing it is a good habit. This can be done using the ssh-keygen utility. Type:</p>
<pre class="console"># ssh-keygen -H -f ~/.ssh/known_hosts</pre>
<p>This process makes it unreadable, but the ssh programs can still read the contents. Make sure you permanently delete the <strong>known_hosts.old</strong> backup file.</p>
<h5>Change your private key&#8217;s passphrase</h5>
<p>If you ever need to change the private key&#8217;s passphrase you can use ssh-keygen:</p>
<pre class="console"># ssh-keygen -p -f ~/.ssh/id_dsa</pre>
<h4>The ssh-agent</h4>
<p>Although key authentication has many advantages over the authentication with passwords, it has one significant drawback: we have to type the passphrase every time we make a connection to the SSH server. One solution would be not to use a passphrase for our private key. But, this is unacceptable. If someone else gets access to our key and finds out to which servers we connect, things get really bad. A second solution is to use the <strong>ssh-agent</strong> (part of the openssh package) which caches our passphrase in the memory and then it&#8217;s automatically used when we make the connection to the SSH server. This way, we only need to type the passphrase once. This is by far more secure than not using a passphrase.</p>
<p>The ssh-agent is a small daemon that runs in the background. When it is run, it exports some environment variables (SSH_AUTH_SOCK, SSH_AGENT_PID) which can be used by programs like <strong>ssh-add</strong> in order to manage the agent&#8217;s cached info or by other programs like the <strong>ssh client</strong> in order to use this cached info for user authentication. These environment variables must be available to these programs, so the ssh-agent needs to be started in our login shell. There are many different ways to start the agent. Here I&#8217;ll describe a rather simple, but very efficient one.</p>
<h5>The ssh-agent&#8217;s configuration</h5>
<p>What we need is to start the agent when we login to our client machine&#8217;s shell and stop it when we log out. So, we add the following line to <strong>~/.bash_profile</strong>:</p>
<pre class="codesnp">eval `ssh-agent`</pre>
<p>Why do we use <strong>eval</strong>? When the ssh-agent is started, it just prints some commands to the stdout. These commands set and export the environment variables we talked about earlier. We use eval, so that these commands are actually executed, or better, evaluated by the shell, so the environment variables are made available to all applications that can use them.</p>
<p>We add the following line to <strong>~/.bash_logout</strong></p>
<pre class="codesnp">eval `ssh-agent -k`</pre>
<p>This &quot;unsets&quot; the environment variables and kills the agent every time we logout.</p>
<h5>Management of cached passphrases</h5>
<p>A small utility called <strong>ssh-add</strong> is used to manage the cached passphrases.</p>
<p>To add a key to the ssh-agent&#8217;s cache, we issue the command:</p>
<pre class="console"># ssh-add ~/.ssh/id_dsa</pre>
<p>We are prompted for the passphrase. After typing it succesfully, it gets cached. From now on, the cached passphrase will be automatically used for every connection we make to the SSH server. Convenient!<br />
If we store our key to the standard location <em>~/.ssh/</em> and name it with the standard filename <em>id_dsa</em>, then ssh-add can be run without arguments. Our key will be used.</p>
<p>To list the cached keys we type:</p>
<pre class="console"># ssh-add -l</pre>
<p>To remove a cached key:</p>
<pre class="console"># ssh-add -d ~/.ssh/id_dsa</pre>
<p>To empty the ssh-agent&#8217;s cache:</p>
<pre class="console"># ssh-add -D</pre>
<h4>Further Reading</h4>
<p>There are numerous articles around the web about SSH. Just use google. Keep in mind though that all the necessary info is in the man pages. You should not just read them, but rather study them:</p>
<ol>
<li><a href="http://www.openssh.org/manual.html">The official openssh manuals</a></li>
<li><a href="http://www.openssh.org/faq.html">The openssh FAQ</a></li>
</ol>
<p><small>This article appeared in the <a href="http://digg.com/">digg.com</a> homepage on November 16th, 2005. I thank all &#8220;diggers&#8221; by heart.</small></p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2005/11/10/ssh-with-keys/">Setup the SSH server to use keys for authentication</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2005/11/10/configure-vnc-server-in-fedora/" rel="bookmark">Set up the VNC Server in Fedora</a></li>
<li><a href="http://www.g-loaded.eu/2005/11/10/be-your-own-ca/" rel="bookmark">Be your own Certificate Authority (CA)</a></li>
<li><a href="http://www.g-loaded.eu/2006/11/24/auto-closing-ssh-tunnels/" rel="bookmark">Auto-closing SSH tunnels</a></li>
<li><a href="http://www.g-loaded.eu/2010/03/26/python-ssh-server-unix-twisted-conch/" rel="bookmark">Python SSH Server for UNIX Systems using Twisted.conch</a></li>
<li><a href="http://www.g-loaded.eu/2006/11/06/netcat-a-couple-of-useful-examples/" rel="bookmark">Netcat &#8211; a couple of useful examples</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2005/11/10/ssh-with-keys/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>SSH Tunnels Headaches</title>
		<link>http://www.g-loaded.eu/2005/10/20/ssh-tunnels-headaches/</link>
		<comments>http://www.g-loaded.eu/2005/10/20/ssh-tunnels-headaches/#comments</comments>
		<pubDate>Thu, 20 Oct 2005 12:45:34 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Encryption]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Remote]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[SSH]]></category>
		<category><![CDATA[Tips]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/?p=58</guid>
		<description><![CDATA[I&#8217;m writing a VNC mini howto and I got stuck with something. I wanted to do the following with a single command: create the SSH tunnel (local port forwarding) execute vncviewer on the local machine have the SSH tunnel to be automatically closed at the time vncviewer was closed After about one hour of trial [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m writing a VNC mini howto and I got stuck with something. I wanted to do the following with a single command:</p>
<ul>
<li>create the SSH tunnel (local port forwarding)</li>
<li>execute vncviewer on the local machine</li>
<li>have the SSH tunnel to be <strong>automatically</strong> closed at the time vncviewer was closed</li>
</ul>
<p><span id="more-58"></span><br />
After about one hour of trial and error and man page reading, I ended up with a very useful line of code:</p>
<pre class="console">ssh -f -L 25930:127.0.0.1:5904 -C me@remote sleep 10; vncviewer 127.0.0.1:25930:4</pre>
<p>What this does is:</p>
<ul>
<li>forwards local port 25930 to remote port 5904</li>
<li>forks the ssh session to the background executing a sleep command on the remote machine</li>
<li>executes vncviewer so that it connects to the vnc server through the tunnel</li>
</ul>
<p>What I badly needed was a way to auto-close the tunnel at the time vncviewer was closed. This seems to do it. The <strong>sleep</strong> command keeps the tunnel open for ten seconds. After this period of time it&#8217;s closed, unless vncviewer or some other application uses it. In this case, it is closed at the time this application stops using it. Pretty fu..ing cool!! I have wasted all my head&#8217;s juice until I managed to figure this out&#8230;</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2005/10/20/ssh-tunnels-headaches/">SSH Tunnels Headaches</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2006/11/24/auto-closing-ssh-tunnels/" rel="bookmark">Auto-closing SSH tunnels</a></li>
<li><a href="http://www.g-loaded.eu/2005/11/10/configure-vnc-server-in-fedora/" rel="bookmark">Set up the VNC Server in Fedora</a></li>
<li><a href="http://www.g-loaded.eu/2006/11/06/netcat-a-couple-of-useful-examples/" rel="bookmark">Netcat &#8211; a couple of useful examples</a></li>
<li><a href="http://www.g-loaded.eu/2005/11/10/ssh-with-keys/" rel="bookmark">Setup the SSH server to use keys for authentication</a></li>
<li><a href="http://www.g-loaded.eu/2006/04/08/linux-tips-pack-i/" rel="bookmark">Linux Tips &#8211; Pack I</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2005/10/20/ssh-tunnels-headaches/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
	</channel>
</rss>

