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

<channel>
	<title>Aaron Toponce &#187;  &#187; Security</title>
	<atom:link href="http://pthree.org/category/security/feed/" rel="self" type="application/rss+xml" />
	<link>http://pthree.org</link>
	<description>Linux.  GNU.  Freedom.</description>
	<lastBuildDate>Sun, 21 Feb 2010 15:50:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0-alpha</generator>
		<item>
		<title>OFTC, SSL, NickServ and Irssi</title>
		<link>http://pthree.org/2010/02/01/oftc-ssl-nickserv-and-irssi/</link>
		<comments>http://pthree.org/2010/02/01/oftc-ssl-nickserv-and-irssi/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 12:30:10 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[irssi]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=1267</guid>
		<description><![CDATA[I&#8217;m on a bit of an IRC kick with the blogging lately, mainly because it seems I&#8217;m usually fine tuning my settings, and I like to share what I find. Hopefully, someone finds these posts useful. For today&#8217;s post, I&#8217;ve picked setting up an SSL connection on OFTC and securely identifying to NickServ when connecting. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m on a bit of an IRC kick with the blogging lately, mainly because it seems I&#8217;m usually fine tuning my settings, and I like to share what I find. Hopefully, someone finds these posts useful. For today&#8217;s post, I&#8217;ve picked setting up an SSL connection on <a href="http://oftc.net">OFTC</a> and securely identifying to NickServ when connecting. with <a href="http://irssi.org">Irssi</a>. Before beginning, it should be noted that the instructions for this tutorial <a href="http://www.oftc.net/oftc/NickServ/CertFP">can also be found on the OFTC site</a>. I&#8217;m merely taking that tutorial, and posting only the Irssi instructions here, more or less. However, if you use another client, you should read over that tutorial instead.</p>
<p><strong>Generating an OpenSSL Certificate</strong><br />
OFTC runs a forked version of hyperion-ircd that they call oftc-hybrid. It&#8217;s a patched version of hyperion that Freenode was running on their servers before the switch to ircd-seven. It supports IPV6, SSL, and CertFP with NickServ, that I&#8217;ll cover later in this post.</p>
<p>Before connecting to OFTC, we want to generate an OpenSSL certificate. This certificate will be used for authenticating to NickServ, and really isn&#8217;t related to setting up an SSL connection to OFTC. However, when you connect, you will be presenting OFTC with the generated certificate, and at that point, you will be able to add it to NickServ, because it&#8217;s been presented. If you already have your own personal certificate you want to use, then you can skip this step, and move on to connecting with SSL.</p>
<p>I&#8217;m going to assume you have OpenSSL installed. If you&#8217;re running any modern Unix-like operating system, such as GNU/Linux or one of the BSDs, chances are very high that it&#8217;s been installed by default. If not, install it, and continue with the rest of the post.</p>
<p>In this step, we&#8217;re going to generate our own self-signed personal OpenSSL certificate. So, fire up a terminal, type in the command below, and follow the on-screen instructions. The values you put here do not matter to OFTC in the least, so fill them in any way you wish. In my case, I&#8217;ll fill in the data for my personal certificate, but you fill in the values as you see fit. Replace &#8220;nick.key&#8221; and &#8220;nick.crt&#8221; with your IRC nick that you use for this connection.</p>
<pre>cd ~/.irssi
mkdir certs
cd certs
openssl req -nodes -newkey rsa:2048 -keyout nick.key -x509 -days 365 -out nick.crt
Generating a 2048 bit RSA private key
writing new private key to 'nick.key'
-----
Country Name (2 letter code) [US]:US
State or Province Name (full name) [Texas]:Utah
Locality Name (eg, city) [San Antonio]:Ogden
Organization Name (eg, company) [Stealth3]:eightyeight
Organizational Unit Name (eg, section) [ISP]:OFTC
Common Name (eg, YOUR name) []:Aaron Toponce
Email Address []:&#97;&#97;&#114;&#111;&#110;&#46;&#116;&#111;&#112;&#111;&#110;&#99;&#101;&#64;&#103;&#109;&#97;&#105;&#108;&#46;&#99;&#111;&#109;</pre>
<p>Now, if you look, you&#8217;ll have two newly generated files: &#8220;nick.key&#8221;, which is your private key and &#8220;nick.crt&#8221; which is your public self-signed certificate. Because &#8220;nick.key&#8221; is your private key, you want to guard it appropriately. Its permissions should be modified to only be readable (and maybe even writable) by you, and you alone. Also, because we have both the private and public key set, let&#8217;s go ahead and combine the files into one PEM file that we&#8217;ll present to NickServ when connecting:</p>
<pre>cat nick.crt nick.key > nick.pem
chmod 0400 nick.key nick.pem</pre>
<p><strong>Connecting with SSL</strong><br />
At this point, we are ready to connect to OFTC, and present our certificate to the server. So, fire up Irssi if you haven&#8217;t already:</p>
<pre>irssi -!</pre>
<p>Now that we&#8217;re in Irssi, we want to setup our SSL connections to OFTC. You should have ~/.irssi/certs/nick.pem available to send.</p>
<p>We will need to retrieve the CA certificate for verifying the server certificate. I personally like to put all my CA certificates in my certificates store, and this is where I deviate a little from the tutorial on the OFTC site. OFTC has their certificate signed by <a href="http://spi-inc.org">Software in the Public Interest</a>, so we&#8217;ll need their CA certificate. Fortunately, Debian, Ubuntu, and many other GNU/Linux operating systems provide this certificate for us, so we just need to identify the location of the certificate, and plug that into Irssi. If you don&#8217;t have that certificate, refer to the tutorial on the OFTC site for obtaining it and installing it on your system.</p>
<p>So, with Irssi waiting for our command, let&#8217;s tell it out to connect to OFTC:</p>
<pre>/network add oftc
/server add -auto -ssl -ssl_cert ~/.irssi/certs/nick.pem -ssl_verify -ssl_cafile /etc/ssl/certs/spi-cacert-2008.pem -network oftc irc.oftc.net 6697
/save
/connect oftc</pre>
<p>When we successfully connect, we should see that OFTC has accepted our self-signed certificate in the MOTD, and it should also show that we are connected securely to the network with SSL:</p>
<pre>16:20 [oftc] Irssi: Looking up irc.oftc.net
16:20 [oftc] Irssi: Connecting to irc.oftc.net [64.62.190.36] port 6697
16:20 [oftc] Irssi: Connection to irc.oftc.net established
16:20 [oftc] [charm.oftc.net]: *** Looking up your hostname...
16:20 [oftc] [charm.oftc.net]: *** Checking Ident
16:20 [oftc] [charm.oftc.net]: *** Found your hostname
16:20 [oftc] [charm.oftc.net]: *** No Ident response
16:20 [oftc] [charm.oftc.net]: *** Connected securely via TLSv1 AES256-SHA-256
16:20 [oftc] [charm.oftc.net]: *** Your client certificate fingerprint is 4A5463CE416649F72818B22945681D28250C1ACA
16:20 [oftc] >>> Welcome to the OFTC Internet Relay Chat Network eightyeight</pre>
<p>Sweet! We&#8217;re connected securely, and OFTC accepted my client certificate by printing the fingerprint for me. If the fingerprint is not displayed, then OFTC has not accepted my certificate, and I need to review the steps outlined above, or on their site.</p>
<p><strong>Authenticating to NickServ with SSL</strong><br />
From here on out, our connection is secured, and we can enjoy the safety that is encrypted packets. So, at this point, we need to register our nick with NickServ, if we haven&#8217;t already. It should be pointed out that Services has a complete help document provided. Messaging &#8220;help&#8221; to any of the Services bots will give you a break down of the available commands and their syntax. I would highly recommend becoming familiar with how to use the provided documentation.</p>
<pre>/msg NickServ help
04:22 [notice(NickServ!services@services.oftc.net)] *** NickServ Help ***
04:22 [notice(NickServ!services@services.oftc.net)] ACCESS: Maintains the nickname ACCESS list.
04:22 [notice(NickServ!services@services.oftc.net)] CERT: Maintains the nickname client certificate list.
04:22 [notice(NickServ!services@services.oftc.net)] DROP: Releases your nickname for use.
04:22 [notice(NickServ!services@services.oftc.net)] ENSLAVE: Enslave a nickname to this master nickname.
04:22 [notice(NickServ!services@services.oftc.net)] HELP: Shows this help.
04:22 [notice(NickServ!services@services.oftc.net)] IDENTIFY: Identify your nickname.
04:22 [notice(NickServ!services@services.oftc.net)] INFO: Get information on a nickname.
04:22 [notice(NickServ!services@services.oftc.net)] LINK: Link this nickname to a master nickname.
04:22 [notice(NickServ!services@services.oftc.net)] LIST: Shows a list of nicknames matching a specified pattern.
04:22 [notice(NickServ!services@services.oftc.net)] RECLAIM: Release your nickname for you to use.
04:22 [notice(NickServ!services@services.oftc.net)] REGAIN: Release your nickname for you to use.
04:22 [notice(NickServ!services@services.oftc.net)] REGISTER: Registers a nickname for your usage.
04:22 [notice(NickServ!services@services.oftc.net)] SENDPASS: Send a password reset request.
04:22 [notice(NickServ!services@services.oftc.net)] SET: Set nickname properties.
04:22 [notice(NickServ!services@services.oftc.net)] STATUS: Shows the identified status of a nickname
04:22 [notice(NickServ!services@services.oftc.net)] UNLINK: Unlink this nickname from a master nickname.
04:22 [notice(NickServ!services@services.oftc.net)] *** End of NickServ Help ***</pre>
<p>In this case, we&#8217;re interested in registering and then identifying. The syntax for registering is providing your password and email as arguments. Providing the correct email is key, so should you lose your password and you can no longer authenticate with SSL, you can have NickServ email you your password. So, I would recommend putting in a valid email here, and not some throw away string:</p>
<pre>/msg nickserv register password username@example.com
/msg nickserv identify password</pre>
<p>At this point, our nick is registered and we are identified to NickServ. If the nick you&#8217;re wishing to register is already registered, then you&#8217;ll either need to pick a different nick, or join #oftc on the network, and see if staff can assign that nick to you. At any event, you must be identified with a valid nick before you can proceed with the next steps.</p>
<p>Now that we are identified to NickServ, we need to add our hostmask to the access list. This is beneficial, so we won&#8217;t be asked to identify when we connect, which is what we want. So, we need to find our hostmask. This is simple enough by running a /WHOIS on yourself, and identifying your host string. So, it might be something like this:</p>
<pre>/WHOIS eightyeight
04:29 [oftc]      nick  | eightyeight
04:29 [oftc]      host  | ~88@c-12-130-240-233.hsd1.mn.comcast.net
04:29 [oftc]     gecos  | eightyeight
04:29 [oftc]    server  | charm.oftc.net [Freemont, CA, USA]
04:29 [oftc]      info  | user has identified to services
04:29 [oftc]  hostname  | 12.130.240.233
04:29 [oftc]      info  | is connected via SSL (secure link)
04:29 [oftc]      idle  | 0d 0h 1m 48s [signon: Sat Jan 30 16:20:12 2010]</pre>
<p>In this case, my host is &#8220;~88@c-12-130-240-233.hsd1.mn.comcast.net&#8221;. This is what I want to provide to NickServ:</p>
<pre>/msg nickserv access add *@c-12-130-240-233.hsd1.mn.comcast.net</pre>
<p>Good. Now we&#8217;re ready to add our self-signed certificate. Remember, when you connected, in the beginning of the MOTD, your certificate fingerprint was displayed. You will want to copy this output and paste it here. You can also use the &#8220;openssl&#8221; command to get the fingerprint of your cert, you will just need to remove the colons out of the string when providing it to NickServ. In my case, my fingerprint was 4A5463CE416649F72818B22945681D28250C1ACA, so I&#8217;m going to add that. Change the string for your fingerprint:</p>
<pre>/msg nickserv cert add 4A5463CE416649F72818B22945681D28250C1ACA</pre>
<p>That&#8217;s it! At this point, if you were to connect again (you must /disconnect and then /connect. /reconnect doesn&#8217;t apply the SSL settings, apparently (BUG?)), you will find that you will automatically identify to NickServ with your cert, and without a password. As you can imagine, this is highly secure. If you are not taking advantage of SSL, then your password can be sniffed on the wire, and your account could be compromised. In this case, we&#8217;re neglecting the password, and using public key cryptography instead to authenticate. I don&#8217;t know at this point if a MITM attack would be successful. So, bonus.</p>
<p>To see that it has succeeded, when you connect you should see the following at the end of the MOTD:</p>
<pre>05:14 [oftc2] >>> You have set user mode +i
05:14 [oftc2] >>> You have set user mode +R
05:14 [oftc2] [notice(NickServ!services@services.oftc.net)] You are connected using SSL and have provided a matching client certificate
05:14 [oftc2] [notice(NickServ!services@services.oftc.net)] for nickname eightyeight. You have been automatically identified.</pre>
<p><strong>Wrap-up</strong><br />
Congratulations! You are now connected securely to OFTC via SSL and you have identified to NickServ successfully with your self-signed certificate. The major benefits of this method, is you can ditch any client-side identification scripts, which is always a bonus. Further, your packets are now encrypted between you and the OFTC servers. OFTC also utilizes server-to-server encryption, so if you&#8217;re physically connected to a server in the United States, and someone you&#8217;re in private message with is physically connected to a server in Europe, not a single plaintext packet is sent on the wire between your client and his (assuming he&#8217;s connected via SSL as well).</p>
<p>A final not on SSL connections, is your computer clock that you are running Irssi on needs to be accurate. It would be recommended to use NTP to keep your clock in sync with Internet time servers. If your clock is too far off, you won&#8217;t be able to negotiate the OpenSSL handshake, and as a result, not be able to take advantage of the encrypted traffic. Also, OpenSSL certificates need to be valid. If your certificate expires, then you will not be able to present it to the server, and as a result, not be able to authenticate to NickServ. The dates on expiration are up to you, but validity is important. You can see the dates of your certificate with the following command:</p>
<pre>openssl x509 -noout -in nick.pem -dates</pre>
<p>Enjoy the security.</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2010/02/01/oftc-ssl-nickserv-and-irssi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Freenode, SSL and SASL Authentication with Irssi</title>
		<link>http://pthree.org/2010/01/31/freenode-ssl-and-sasl-authentication-with-irssi/</link>
		<comments>http://pthree.org/2010/01/31/freenode-ssl-and-sasl-authentication-with-irssi/#comments</comments>
		<pubDate>Sun, 31 Jan 2010 10:13:28 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[irssi]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=1255</guid>
		<description><![CDATA[Last night, Freenode made the migration from hyperion-ircd to a fork of charybdis-ircd they&#8217;re calling ircd-seven. There are a few notable changes in the new ircd code that are worth mentioning here that are of benefit to end users and clients. They are the ability to use OpenSSL encryption between client and server and the [...]]]></description>
			<content:encoded><![CDATA[<p>Last night, <a href="http://freenode.net">Freenode</a> made the migration from hyperion-ircd to a fork of charybdis-ircd they&#8217;re calling ircd-seven. There are a few notable changes in the new ircd code that are worth mentioning here that are of benefit to end users and clients. They are the ability to use OpenSSL encryption between client and server and the ability to use SASL authentication for authenticating to Services. Of course, as is standard, I&#8217;ll document this with <a href="http://irssi.org">Irssi</a>, but the general rules apply to most IRC clients.</p>
<p><strong>Connecting with SSL</strong><br />
Freenode is listening for SSL connections on ports 7000 and 7070, rather than the standard 6697. I don&#8217;t know what the logic here is for that, but does it matter? A port is a port is a port. So, for Irssi, setting this up is rather simple.</p>
<pre>/server add -auto -ssl -network freenode irc.freenode.net 7000</pre>
<p>Boom! Done.</p>
<p>Now, if you want to verify the Freenode server SSL certificate against a certificate authority (CA), then you&#8217;ll need to download the CA certificate from the authority that signed the server certificate. In this case, its <a href="http://gandi.net">Gandi.net</a>, and their CA certificate file can be found here: <a href="http://crt.gandi.net/GandiStandardSSLCA.crt">http://crt.gandi.net/GandiStandardSSLCA.crt</a>. However, using the file in its native DER format for Irssi wasn&#8217;t working for me. So, using openssl, I converted the binary DER data file to PEM format, at which the Freenode certificate would properly verify:</p>
<pre">cd /usr/share/ca-certificates
mkdir gandi.net
cd gandi.net
wget http://crt.gandi.net/GandiStandardSSLCA.crt
openssl x509 -inform der -outform pem &lt; /usr/share/ca-certificates/gandi.net/GandiStandardSSLCA.crt &gt; GandiStandardSSLCA.pem
ln -s /usr/share/ca-certificates/gandi.net/GandiStandardSSLCA.pem /etc/ssl/certs/GandiStandardSSLCA.pem</code>

With the Gandi.net CA certificate installed in the standard CA certificates store, I modified my server string in Irssi:
<pre>/server add -auto -ssl -ssl_cacert /etc/ssl/certs/GandiStandardSSLCA.pem -network freenode irc.freenode.net 7000</pre>
<p>Unfortunately, as much as I would like this to work, it doesn't. I kept ending up with this error:</p>
<pre>[freenode] Irssi: Connecting to irc.freenode.net [140.211.166.4] port 7070
Irssi: warning Could not verify SSL servers certificate:
Irssi: warning   Subject : /OU=Domain Control Validated/OU=Gandi Standard Wildcard SSL/CN=*.freenode.net
Irssi: warning   Issuer  : /C=FR/O=GANDI SAS/CN=Gandi Standard SSL CA
Irssi: warning   MD5 Fingerprint : F8:40:2C:D9:D6:46:1F:D0:38:5D:ED:21:69:8B:17:C4</pre>
<p>Digging deeper, it appears it's failing with:</p>
<pre>2 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: unable to get issuer certificate
the issuer certificate could not be found: this occurs if the issuer certificate of an untrusted certificate cannot be found.</pre>
<p>After a bit of hacking, and the help with Bazerka in #irssi, we found that my specific version of OpenSSL doesn't like the certificate chain. Because Irssi is using these libraries, it took a bit of mucking about to find enough data points, that you need to be running an extremely recent SVN build of Irssi (there's a bug with some SSL certificate verifications that affect us here), also with OpenSSL version 0.9.8k or later. I am not running either on Debian stable, so am I stuck not being able to verify the certificate Freenode gives me?</p>
<p>Well, not quite. The Gandi certificate is signed by UTN-USEFirst-Hardware, which in turn is signed by AddTrust External Root (if your browser has a CA certificates store, you can visit <a href="https://irc.freenode.net:7070">https://irc.freenode.net:7070</a>, and get the details of the certificate there, or use "openssl s_client" to download it and examine the details). So, if you have the USEFirst and AddTrust CA certificates, then you can verify those instead with older versions of OpenSSL or Irssi, and you'll be golden. So, if you have a CA certificate store, as most GNU/Linux distributions do, you can set the following instead:</p>
<pre>/server add -auto -ssl -ssl_verify -ssl_capath /etc/ssl/certs -network freenode irc.freenode.net 7000</pre>
<p>This will succeed, and when connected, you'll see usermode "+Z" meaning you're using a secure connection, and you've properly verified the server certificate Freenode is handing out. Notice the difference with "-ssl_capath" here and "-ssl_cacert" from above. This is key to making this work.</p>
<p><strong>Authenticating with SASL</strong><br />
Okay, after setting up SSL with Freenode, the next task for me was using SASL authentication rather than a server password to authenticate to NickServ. It should be noted that using SASL authentication is entirely optional! You don't have to use this method if you don't want. However, using the SASL authentication script I'm going to point to in a second has one nice feature that might be of interest to you: using Blowfish encryption on your password, and sending that to NickServ, should you not be using an SSL connection at all. If you're not interested in using an SSL connection, at least you can encrypt your password on the wire when authenticating using SASL.</p>
<p>Anyway, setting this up means getting Irssi in shape for SASL. By default. Irssi doesn't support SASL authentication out of the box, so we need a Perl script to make it happen. <a href="http://freenode.net/sasl/cap_sasl.pl">You can find that Perl script here</a>. After downloading the script, put it in your ~/.irssi/scripts directory, and link against it in the autorun directory. Something like this:</p>
<pre>cd ~/.irssi/scripts/
wget http://freenode.net/sasl/cap_sasl.pl
cd autorun
ln -s ../cap_sasl.pl cap_sasl.pl</pre>
<p>Now, you just need to load it in Irssi, and setup your username and password for authentication. A word of note here: when setting up SASL authentication, you need to be using your primary nick with NickServ, not any nick that you've linked against, or it will fail. I don't know why this is, but that's the case. So, in my case, my primary nick is "atoponce" and my secondary nick is "eightyeight". I use my secondary nick for all my IRC sessions, but when using the SASL command below, you must use your primary nick. While we're at it, we'll save everything we've done up to this point in the config:</p>
<pre>/RUN cap_sasl.pl
/sasl set freenode primary-nick password DH-BLOWFISH
/sasl save
/save</pre>
<p>First, if you haven't noticed already, you need some Perl libraries in place before you can run this script, namely Blowfish, DH and BIGNUM. If you're on Debian or Ubuntu, you can install them with:</p>
<pre>aptitude install libcrypt-blowfish-perl libcrypt-dh-perl libcrypt-openssl-bignum-perl</pre>
<p>Notice, I"m using DH-BLOWFISH in my example. "PLAIN" is also completely valid there for your mechanism. Also, notice I'm using "/sasl save" to save the settings to disk. You'll want this, so should you need to restart Irssi, everything will be in place, and you won't have to go through this procedure again.</p>
<p>If you've followed this tutorial rather closely, when you connect, you should see something like the following at the beginning of the connection:</p>
<pre>16:05 [freenode] Irssi: Looking up irc.freenode.net
16:05 [freenode] Irssi: Connecting to irc.freenode.net [140.211.166.4] port 7000
16:05 [freenode] Irssi: Connection to irc.freenode.net established
16:05 [freenode] [niven.freenode.net]: *** Looking up your hostname...
16:05 [freenode] [niven.freenode.net]: *** Checking Ident
16:05 [freenode] [niven.freenode.net]: *** Found your hostname
16:05 [freenode] [niven.freenode.net]: *** No Ident response
16:05 [freenode] Irssi: CLICAP: supported by server: identify-msg multi-prefix sasl
16:05 [freenode] Irssi: CLICAP: requesting: multi-prefix sasl
16:05 [freenode] Irssi: CLICAP: now enabled: multi-prefix sasl
16:05 [freenode] >>> eightyeight!88@oalug/member/pdpc.supporter.monthlybronze.eightyeight atoponce You are now logged in as atoponce.
16:05 [freenode] Irssi: SASL authentication successful
16:05 [freenode] >>> Welcome to the freenode Internet Relay Chat Network eightyeight</pre>
<p>You want to see "SASL authentication successful" in the output. If it fails then you will still need to provide your password manually to NickServ. You will likely need to review the steps outline above finding anything you might have missed. Remember, you're authenticating with your primary NickServ nick, not any others linked to it. In the output, you can see I'm authenticating with "atoponce", but using "eightyeight" when I actually connect.</p>
<p>One last work about SASL authentication: you no longer need a server password if you're utilizing this. Before, Freenode supported a server password that you could append to the end of your "/server" string for authentication. Freenode still supports this, although in "username:password" syntax rather than just "password". But, SASL authentication overrides the need for a server password, so you can take that out of your settings. It's not hurting anything if you leave it, but it's not doing anything beneficial either.</p>
<p><strong>Miscellaneous</strong><br />
With all that out of the way, I want to point out one major change that I welcome. That is the ability to join more than 20 channels simultaneously. Previously, with hyperion-ircd, you had to get Freenode staff to grant you usermode "+u" which gave you the ability to sit in more than 20 channels with one connection. If you're an IRC addict like I am, 20 is pretty freaking limiting. However, ircd-seven now supports the ability to connect to 120 simultaneous channels. You can see this in the MOTD output when you connect (emphasis placed):</p>
<pre>16:05 [freenode] >>> CHANTYPES=# EXCEPTS INVEX CHANMODES=eIbq,k,flj,CFLMPQScgimnprstz <b>CHANLIMIT=#:120</b> PREFIX=(ov)@+ MAXLIST=bqeI:100 MODES=4 NETWORK=freenode KNOCK STATUSMSG=@+ CALLERID=g are supported by this server
16:05 [freenode] >>> SAFELIST ELIST=U CASEMAPPING=rfc1459 CHARSET=ascii NICKLEN=16 CHANNELLEN=50 TOPICLEN=390 ETRACE CPRIVMSG CNOTICE DEAF=D MONITOR=100 are supported by this server
16:05 [freenode] >>> FNC TARGMAX=NAMES:1,LIST:1,KICK:1,WHOIS:1,PRIVMSG:4,NOTICE:4,ACCEPT:,MONITOR: EXTBAN=$,arx WHOX CLIENTVER=3.0 are supported by this server</pre>
<p>Very nice!</p>
<p>So, there you have it. SSL connectivity with SASL authentication and the ability to join up to 120 channels simultaneously on the new IRCD at Freenode. I personally welcome all these changes, and it's nice to see that every IRC server I'm currently connected with provides a secure connection. Call me paranoid, but I'm enjoying SSL.</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2010/01/31/freenode-ssl-and-sasl-authentication-with-irssi/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>How Travelers Can Protect Their Data</title>
		<link>http://pthree.org/2010/01/03/how-travelers-can-protect-their-data/</link>
		<comments>http://pthree.org/2010/01/03/how-travelers-can-protect-their-data/#comments</comments>
		<pubDate>Sun, 03 Jan 2010 15:56:04 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Laptops]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=1217</guid>
		<description><![CDATA[I used to travel quite extensively around the country, and even had the opportunity to leave the country and go abroad. My laptop was always with me. As a result, I was very concerned for the integrity and safety of my data. As such, I took the necessary precautions that travelers can take when their [...]]]></description>
			<content:encoded><![CDATA[<p>I used to travel quite extensively around the country, and even had the opportunity to leave the country and go abroad. My laptop was always with me. As a result, I was very concerned for the integrity and safety of my data. As such, I took the necessary precautions that travelers can take when their laptops are with them. This post is hopefully informational should you decide to travel with your faithful friend (I call my laptop &#8220;Kratos&#8221;- the Greek God who always did Zeus&#8217; will and bidding).</p>
<p>First, a disclaimer. This post is not meant to be a sure method for defeating attackers. Rule number one in computer security is that if an attacker has physical access to your machine, all bets as to data integrity and physical safety are off. However, than doesn&#8217;t mean that you can make the process so tedious and time consuming for the attacker, that he will likely not bother and move to another victim. This post is about those methods. If they&#8217;re going to attack you, why not at least make it challenging for them?</p>
<p>If you have the ability, this post requires wiping your disk by starting from scratch. So, if you have data on that disk, you should probably back that up first. If it&#8217;s a new laptop, and you&#8217;re not invested into the operating system, then maybe you don&#8217;t need to worry about it. Just realize, that from this point on, if you decide to &#8220;follow along&#8221; with your own equipment, this will wipe your data, and if you didn&#8217;t back up your data first, you&#8217;re the moron, not me.</p>
<p>Okay, with that out of the way, shall we continue?</p>
<p><strong>Step One</strong>: Prepare your hard drive.<br />
The goal of this step is to install an encrypted filesystem. So, before we do that, we need to do some preparation. In order to get to that point, you will need to write random or pseudorandom data to the entire disk. This will take some time. My experience has show that laptop drives usually operate around 30MBps, so if you have a 300GB drive, this will take you just under 3 hours. The reason for doing this is to confuse the attacker just exactly where the encrypted filesystems reside. If the entire disk is underlined with random or pseudorandom data (it doesn&#8217;t necessarily need to be cryptographically secure here), then when looking at the drive level, it will be practically improbable to determine where the encrypted filesystem starts and where it ends. If you skip this step, then it&#8217;s quite obvious, and rather than wast his time on the entire disk, the attacker can focus his efforts on just the obvious encrypted portions of the disk.</p>
<p>Now, some tools for installing encrypted filesystems will already have this step built in, such as the Debian installer, but some won&#8217;t. You&#8217;ll need to discover your vendor&#8217;s documentation to see if this is the case. I would say it doesn&#8217;t hurt to be safe, and take this step anyway, but it&#8217;s up to you.</p>
<p>There are many utilities for writing random or pseudorandom data to the drive. Probably the best tool will be <a href="http://www.dban.org/">DBAN</a>, or Derik&#8217;s Boot and Nuke. This utility is generally used for destroying data, but in this case, we&#8217;ll use it for preparing data. Download the live CD, burn it, and reboot your machine. I would recommend selecting the &#8220;PRNG Stream&#8221; from the menu. This will normally write pseudorandom data to the disk 4 times. However, it shows a progress report on the number of passes, so after it completes its first pass, you can reboot. It&#8217;s important to note that selecting &#8220;Quick Erase&#8221; will do a single pass of zeros. This isn&#8217;t what we want. We&#8217;re trying to deter attackers by not giving them the boundaries of our encrypted filesystems. If you choose &#8220;Quick Erase&#8221;, then you&#8217;ll be clearly showing them where those boundaries exist. As tempting as it may be, don&#8217;t select it.</p>
<p>If you&#8217;re familiar with Linux live CDs, you can boot into a live environment, such as KNOPPIX, pull up a terminal and run the following, assuming the drive you&#8217;re preparing is &#8220;/dev/sda&#8221;:</p>
<pre>dd if=/dev/urandom of=/dev/sda</pre>
<p>The point is getting random or pseudorandom data down on the entire disk. However you accomplish that, is up to you.</p>
<p>After a few hours pass (depending on the size of your drive, and if you cancel the operation after a single pass of PRNG Stream), you are now ready to reboot into your operating system installer if it provides the ability to encrypt the filesystems, or into a separate utility for doing so.</p>
<p><strong>Step Two</strong>: Set up volumes or partitions and encrypt<br />
With the Debian installer, and most GNU/Linux installers, you can set up your partitions or logical volumes, then tell the installer to encrypt them, even with some options on the cryptography. When you&#8217;ve defined your filesystem boundaries (I&#8217;m not going to cover that here), and you&#8217;re ready to encrypt, you&#8217;ll inevitably be required to type in a username and passphrase. Some encryption utilities will use this passphrase as a seed for the encryption algorithm, so the stronger the passphrase, the stronger the seed, and this the more unlikely an attack will be successful on the filesystem. So, choose wisely and choose securely.</p>
<p><strong>Step Three</strong>: Install the operating system<br />
Whether it be Windows, Mac, Linux or whatever operating system that supports encrypted filesystems, you&#8217;re now ready to install it. Follow the operating system&#8217;s installer to the end, reebot, and make any additional final preparations to your computer before putting down the data. You should at this point be able to boot the computer, provide the necessary username and passphrase, and use your operating system as normal. If not, you&#8217;ll need to spend some time with your operating system&#8217;s documentation or encrypted filesystem documentation to get to that point. This post isn&#8217;t about that, so Google might be your friend here.</p>
<p>Okay, so now we have a usable operating system running on top of a fully encrypted drive. If we were to stop here, we wouldn&#8217;t make things very challenging for the attacker. We want to do that. So, we&#8217;re going to start adding some hurdles along the way. If the attacker has the stamina, then so be it. I&#8217;m guess that most attackers, when faced with each of these hurdles, likely won&#8217;t bother, and move to their next victim, rather than waste time trying to figure out how to get from Point A to Point B.</p>
<p><strong>Step Four</strong>: Password protect your BIOS<br />
This will vary widely on hardware, so consult your vendor&#8217;s documentation on how to boot into your laptop BIOS and set an administrator password. However, this functionality should be provided on most modern BIOSes. When found, go ahead and set the password. It can be whatever you want. I would recommend making it hard to guess, but it doesn&#8217;t really need to be on the same level as the encryption passphrase you provided earlier. Just don&#8217;t make it successful to a dictionary attack, and you should be good. Don&#8217;t reboot. Stay in your BIOS for the next step.</p>
<p><strong>Step Five</strong>: Change your boot order to boot off the hard drive first<br />
The reason for setting the administrator password in the BIOS was so we can tell the BIOS that we always want it booting from the hard drive first, rather than from the floppy, CDROM, network or USB. This step is necessary to hopefully avoid the Evil Maid attack, something <a href="http://pthree.org/2009/10/23/evil-maid/">I&#8217;ve already blogged about here</a>. In summary, the Evil Maid attack is booting your computer from a USB or CDROM, replacing your bootloader by installing a custom bootloader with a keylogger, and powering down. Then, when you boot your machine, and enter the encryption passphrase, it gets stored on disk, or sent over the network to a remote server. After you leave your laptop a second time, the attacker comes back to your computer, boots off the hard drive, provides the newly discovered encryption credentials, and steals your data.</p>
<p>So, if your laptop is BIOS password protected to only boot from the hard drive, this is a good deterrent. Why? Well, in order to remove the password off the BIOS, so the attacker can boot from some other medium, they will need to disassemble the laptop to get to the motherboard, and flash the BIOS. This is easier said than done on laptops. Have you ever taken your laptop apart? I have. I&#8217;ve take apart both my old HP Pavilion and my current ThinkPad T61. They&#8217;re a royal pain, and extremely time consuming.</p>
<p>A good attacker will be paranoid for time. They don&#8217;t want to get caught. If it means spending 3 hours disassembling a laptop just to flash the BIOS, so they can install their custom bootloader and keylogger, chances are high he&#8217;ll move on to another victim. Now, that&#8217;s not to say that every attacker can&#8217;t do this, or they know they have the time, and your data is that valuable to them. Maybe the attacker is skilled at disassembling Dell, Lenovo and HP laptops, so it&#8217;s only a 30 minute inconvenience that he knows he can make. But, maybe not. At least this is a moderately challenging task, and I&#8217;d be willing to bet most attackers won&#8217;t bother.</p>
<p><strong>Step Six</strong>: Physically lock down your laptop or take it with you<br />
Again, just another deterrent, but locking your laptop down to a secure location could provide enough of a challenge to deter physical theft, should all efforts being made at getting to your data fail. After all, there is value in the hardware itself. EBAY is probably making a killing of such scenarios without knowing specifics. This doesn&#8217;t mean the attacker isn&#8217;t skilled at lock picking or doesn&#8217;t have a strong set of bolt cutters with them. However, if the time it takes to remove the laptop from the premises is a challenging effort, the attacker likely won&#8217;t bother, and move on.</p>
<p>With that said, I had my car broken into once. They were after my stereo. Thankfully, they were caught in the act, and found guilty in court of seven counts of theft and property damage, among other things. However, in the car before mine, they couldn&#8217;t successfully remove the deck from the dash. It was bolted down. So, out of frustration, they physically destroyed the deck and the dash. Not out of failing to remove it, but out of anger for not succeeding. Your laptop may fall victim to such physical damage.</p>
<p>So, if you can carry it with you, you probably should. When I was on the road, I took my laptop with me everywhere I went for fear of physical damage or theft. I would take it with me to dinner. I would take it with me to events. I would take it with me sight seeing. I was paranoid. Sure, I run the risk of damage while traveling with it, but I know how to treat my bag carrying the laptop. At least then I&#8217;m somewhat in control. Further, an attacker can&#8217;t attack what isn&#8217;t there. But, when I couldn&#8217;t take it with me, I would lock it down securely, and hope it remained in tact when I returned.</p>
<p><strong>Step Seven</strong>: Remove the data and/or encrypt it a second time<br />
Many operating systems support encrypting directories and files on top of the filesystem itself. This means you can have an encrypted directory in your home folder, where the valuable data resides. Should the attacker successfully get access to your encrypted filesystem, if you chose a different passphrase for your encrypted directory, hopefully, they won&#8217;t get access to that.</p>
<p>But, keeping that sort of sensitive data on the drive might not be wise, even if it is encrypted. So, it would be best to have that data on an encrypted USB disk. Your only concern should be making sure you don&#8217;t lose that drive. Even if it&#8217;s not stolen data, lost data still sucks. Backups here help.</p>
<p>At my place of employment, we&#8217;re developing a virtualization solution where all the developers will have virtual desktops in our datacenter. The idea is to keep the data off of the developer&#8217;s laptop. So, when they login to their laptop, they then must login to the VPN, then use RDP or SPICE (yeah, we&#8217;re deploying RHEV) to login to their remote desktop, and work from there. At this point, the laptop becomes a mere dummy terminal, not storing a single piece of data- even email. There are concerns, like if the developer doesn&#8217;t have Internet access, or if the datacenter is compromised, but from a traveling perspective, keeping the data off of the traveling laptop is a net win. Some hotels might have crappy WIFI, but at least security has come first, and the data is safe.</p>
<p><strong>Appendix A</strong>: Learn how to remove and restore your bootloader<br />
This is a crucial skill, I think. It doesn&#8217;t really fit into the above steps per se, so I&#8217;ve added it as an appendix. The idea is simple. When traveling from another country to the United States, the Department of Homeland Security thinks it&#8217;s fun to ignore the Constitution, and seize and search your laptop without a warrant. <a href="http://www.schneier.com/blog/">Bruce Scheier has covered this extensively</a>, so I&#8217;ll let you read up on his posts about the topic. If you&#8217;re running an encrypted filesystem, they can detain you until you provide them with the passphrase, at which point they can then image your drive, keeping your data. This is wrong on so many levels, but you have a good deterrent- wipe your bootloader before landing.</p>
<p>When I traveled to Canada for training, I was already aware of the DHS doing this at customs. So, before being required to turn off my laptop during landing, I wiped the bootloader, and prepared a script in my mind should the DHS want my to power on my laptop. I was resolved that I wouldn&#8217;t lie, as that would be perjury, but I would dance around the issue as best I could. The script would go something like this:</p>
<blockquote><p>Agent: Can you power on your laptop please?<br />
Me: Sure, but while on the road, something happened, and it will no longer boot. It says it&#8217;s missing an operating system. I&#8217;m hoping to get it fixed when I get back to the office.<br />
Agent: Will you power it on anyway please?<br />
Me: Sure.<br />
(I power on the computer, at which point, it behaves exactly as described.)<br />
Agent: Okay, thank you. Carry on.</p></blockquote>
<p>When I was returning from my Canada trip, and passing through customs, the agent asked me to remove the laptop from my bag and open it. I was already prepared with a removed bootloader, and my heart was racing to go through the script. When I opened the laptop, we proceeded to swipe it looking for traces of explosives. When he was satisfied, he said thank you, I put the laptop back in my bag, and was on my way. I was a bit bummed that I didn&#8217;t get to defeat the DHS at their own game, but was relieved at the same time that I didn&#8217;t miss my flight home.</p>
<p>After I was on US soil, I boot off a rescue CD, and restored my bootloader, and was able to boot back into my Debian install without trouble. This takes some practice and know-how, but I think it&#8217;s really quite worth it should that scenario ever present itself. Of course, who knows what would happen? Maybe I would be detained until they could fix the problem with my laptop, at which point, I would still be required to turn over the passphrase, and they image the disk. Who knows? Still worth a shot, and it&#8217;s easy to do, if you know what you&#8217;re doing. Just don&#8217;t lie.</p>
<p><strong>Appendix B</strong>: Stay with your belongings through metal detectors<br />
Again, this is something that doesn&#8217;t really fit in the steps above, so it&#8217;s in the appendix as well. When you are entering an airport, and your belongings have to go through XRAY, there is an attack to steal laptops that is rather trivial and easy to setup. All it requires is three people- two attackers and the victim.</p>
<p>The attackers find a victim with a laptop (or bag obviously carrying a laptop) they want. They both position themselves immediately in front of the victim when standing in line to go through security. By the time the first attacker reaches the metal detector, the victim has likely placed their personal belongings on the belt to go through the XRAY machine. The first attacker goes through the metal detector without a problem. He waits at the end of the conveyor belt to get his belongings as well as snatch the laptop. The second attacker, however, causes problems going through. Every time he attempts to go through, something in his pockets, or otherwise, causes the detector to go off. Now, generally, it only takes 2 or 3 attempts before the agent will just get his magic want, and swipe him down from head to foot. But, two to three attempts is all the time that is needed for the victim&#8217;s bag or laptop to go through XRAY, at which point the first attacker takes the computer, and disappears into the crowd before the victim even had an opportunity to get through. It&#8217;s sneaky, it&#8217;s effective, it&#8217;s fast and it&#8217;s clean. Further, TSA isn&#8217;t keeping track of who&#8217;s belongings belong to who. For all they know, that was their laptop, not yours.</p>
<p>How do you avoid this attack? When I traveled, I stood at the XRAY machine with my hand on my laptop bin, and I sent it through the same time I went through. I never gave it a chance to get ahead of me. This would slow down the line a bit sometimes. In fact, I would let people go ahead of me while I waited. I took no chances. I&#8217;ll go through metal detection faster than my laptop will go through XRAY, so I can wait for it to come down the belt right into my own hands. It requires a bit of patience and stubbornness, but I think it&#8217;s worth it. You&#8217;ll likely not bump into the cranky people behind you again, so no biggie.</p>
<p><strong>Conclusion</strong><br />
So, there you have it. Those are the procedures and steps I would take when traveling with my laptop. I would recommend the same to you. Really, it boils down to determination, knowledge and a bit of luck. You can avoid the worst if you are sufficiently paranoid. There&#8217;s nothing wrong with taking the extra precautions to protect your data and your laptop from theft or damage. Of course, these steps aren&#8217;t bullet proof, and everything comes at a cost. There might be a slight inconvenience to the traveler to jump through some of these hoops. But, what is it worth? If the cost of the inconvenience outweighs the cost of the data, then some or all of these steps might not be necessary. If the cost of the data outweighs the cost of the inconvenience, then I would say stick to each step religiously. That&#8217;s just me.</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2010/01/03/how-travelers-can-protect-their-data/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Evil Maid</title>
		<link>http://pthree.org/2009/10/23/evil-maid/</link>
		<comments>http://pthree.org/2009/10/23/evil-maid/#comments</comments>
		<pubDate>Fri, 23 Oct 2009 13:10:51 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=1175</guid>
		<description><![CDATA[Two weeks ago, we had the Utah Open Source Conference, and I gave a presentation on how to crack passwords when you have physical access to a box. You can find my slides and materials here (3MB tar.gz). As an overview of my presentation, I discussed that if you have physical access to a machine, [...]]]></description>
			<content:encoded><![CDATA[<p>Two weeks ago, we had the <a href="http://2009.utosc.com">Utah Open Source Conference</a>, and I gave a presentation on how to crack passwords when you have physical access to a box. <a href="http://aarontoponce.org/utosc2009-toponce-archive.tar.gz">You can find my slides and materials here</a> (3MB tar.gz). As an overview of my presentation, I discussed that if you have physical access to a machine, you can easily get administrative rights (root on Unix-like machines), and as a result, get access to the password database and user accounts, and use software to brute force the passwords out of the database.</p>
<p>I then finished up showing how to break encrypted filesystems using the cold boot attack. <a href="http://citp.princeton.edu/memory/">The University of Princeton has an excellent white paper, video and software on how to make this possible</a>. The idea is simple- read the contents of RAM immediately after a shutdown, then use software to search through that memory dump finding a passphrase used on the encrypted filesystem. The only problem with this attack, is the limited scope of software in which it is effective against.</p>
<p><a href="http://theinvisiblethings.blogspot.com/2009/10/evil-maid-goes-after-truecrypt.html">Enter Evil Maid</a>.</p>
<p>The idea is simple. Because you still have access to the target machine, rather than doing a cold boot attack, memory dumps and additional processing on the RAM dump, install a different boot loader that contains a key logger. When the target enters the encryption passphrase on his machine, the key logger will have grabbed every key stroke, either saving it somewhere on disk for later retrieval, sending it over the Internet to the attacker, or whatever is necessary to get the passphrase.</p>
<p>THIS WILL WORK ON ANY OPERATING SYSTEM AND IS EFFECTIVE AGAINST ANY FILESYSTEM ENCRYPTION SOFTWARE!</p>
<p>This is more effective than the cold boot attack, or even the &#8220;<a href="http://www.stoned-vienna.com/">stoned boot</a>&#8221; attack that Bruce Schneier covered earlier this year, but it&#8217;s still not without its weaknesses. This attack assumes that the target will power on the computer at a later time, and enter the passphrase for the encrypted filesystem. The attacker would not want to actually steal the powered down computer.</p>
<p>This is why it is called &#8220;Evil Maid&#8221;- you leave your computer in the hotel room, the housekeeping maid comes in to clean your room, but while there, installs the boot loader and key logger, then repowers down your computer. When you return to the hotel room, you power on, enter the passphrase, do you work, or whatever. The next day, when the maid returns, she returns, most likely to either retrieve the key and restore the previous boot loader, erasing her tracks. Now she has access to your data, can image the drive for offline analysis and have all sorts of nasty fun.</p>
<p>This should say something about encrypted filesystems. They really only protect you if the drive is stolen, and the computer has been powered down. Other than that, there is an important security lesson to learn here. If someone has physical access to your computer, with the intent to do harm, <a href="http://blogs.zdnet.com/security/?p=4662&#038;tag=nl.e019">there is no stopping them</a> from getting administrative rights on the machine, installing software, archiving data, imaging drives, etc. As a result, this should tell you something valuable: if possible, as in the case with laptops, keep your computer with you in untrusted environments.</p>
<p>There are possible protective measures to protect yourself against such an attack. Storing your computer in a strong box under lock and key might work. Although the attacker only needs to be proficient with lock picks, this is a good first safe measure. Many hotels offer such strong boxes. Second would be hardening your BIOS to help prevent such an attack. Again, just a &#8220;speed bump&#8221; do a dedicated attacker, but it could be enough to deter. Lastly, because this attack assumes installing software on non-encrypted boot partitions or sectors, getting a hash of the non-encrypted boot partition and storing on a separate USB key could be valuable. Thus, when you travel, before you boot the machine from the hard disk, you could boot from a live CD, and check the hash of the boot sector against the hash stored on your key. Of course, if the attacker ever gets access to your USB key, the hash could be corrupted or modified.</p>
<p>Long story short- don&#8217;t leave sensitive data on your machine in untrusted environments, such as hotel rooms. Take your computer with you whenever you can and shut it down when not in use.</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2009/10/23/evil-maid/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Scrubbing Hard Disk Data</title>
		<link>http://pthree.org/2009/08/31/scrubbing-hard-disk-data/</link>
		<comments>http://pthree.org/2009/08/31/scrubbing-hard-disk-data/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 01:52:26 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=1120</guid>
		<description><![CDATA[I&#8217;ve recently had the opportunity with wiping 13 SCSI drives. The drives are small- 36 and 18 gigabyte drives, and they do contain sensitive data. They will be sent off to a third party for physical destruction, but we need to make sure that the data is completely overwritten on the disk in a secure [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently had the opportunity with wiping 13 SCSI drives. The drives are small- 36 and 18 gigabyte drives, and they do contain sensitive data. They will be sent off to a third party for physical destruction, but we need to make sure that the data is completely overwritten on the disk in a secure manner. This means using a utility that can overwrite bit-for-bit on the disk level. Fortunately, there are many utilities for making this possible.</p>
<p>The most popular of these, is DBAN, or Darik&#8217;s Boot and Nuke. It comes as a CD or USB image that you boot from, rather than the disk, then choose in a menu which wiping method you wish to choose. Of the choices, there are:</p>
<ul>
<li><strong>Quick Erase</strong>- One pass, writing nothing but zeroes.</li>
<li><strong>RCMP TSSIT OPS-II</strong>- Eight passes using random writes and compliments on each pass.</li>
<li><strong>DoD Short</strong>- Three pass version of the stronger seven pass below. Each pass is random data written.</li>
<li><strong>DoD 5220.22-M</strong>- Sever passes using random data at each pass.</li>
<li><strong>Gutmann Wipe</strong>- 35 passes across the hard drive as described by security expert Peter Gutmann and Colin Plumb.</li>
<li><strong>PRNG</strong>- Arbitrary number of passes specified by the user using a pseudo random number generator for writing random data on each pass.</li>
</ul>
<p>For most secure scrubbing purposes, a quick erase is more than good enough. There have been no published papers to date on recovering overwritten date after a single pass. Is that to say it&#8217;s not possible? No, of course not. For what it&#8217;s worth, all the drives that leave my possession only get a single pass. However, if you or or organization is more paranoid about getting the data off the platters, there are other options available that will do more passes on the drive.</p>
<p>The next option in the DBAN menu is the RCMP TSSIT OPS-II wipe. This pass uses a source for a pseudo-random number generator as the first pass, then produces the compliment of that first pass as the data for the second. The idea behind this method is switch the bit on the disk platter from one to zero as often as possible. By using a random source for the initial pass, then writing the compliment, we&#8217;ve successfully written two passes on disk. At this point, it should be &#8220;good enough&#8221; for even the most seasoned data recovery company. However, this pass does that dance three more times, for a total of eight passes.</p>
<p>The Department of Defense, in the United States of America, has established a standard for sanitizing disks that contain TOP SECRET data. They have two standards. The first is the &#8220;DoD Short&#8221; wipe. This is a short three pass wipe. Nothing fancy about it. Each pass uses a pseudo-random number generator as the source for the overwriting data, and makes three passes with this source. The &#8220;DoD 5220.22-M&#8221; is the more secure DoD sanitization method, which uses seven passes across the disk instead of three. Each pass uses a pseudo-random number generator for the source of the data.</p>
<p>The next method is for the ultra-paranoid company or individual. This wipe is known as the &#8220;Gutmann Wipe&#8221;, and it&#8217;s built to take advantage of different hard disk encoding mechanisms. Essentially, there are two main encoding schemes for storing the data on your disk: MFM and RLL. All modern drives today use the RLL encoding scheme. Essentially, RLL is a lossless compression encoding scheme, making it possible to fit more data on the disk platters. Because MFM and RLL store data differently on the drive, using a certain method might be optimized for MFM encoded drives, but won&#8217;t work well with RLL and vice-versa.</p>
<p>The method behind calculating the data to the disk is rather simple: generate a unique list of one-bit numbers (zeros and ones), then two-bit numbers, then a three-bit numbers, then finally four-bit numbers uniquely. After this list of numbers has been generated, begin writing. This list is as defined in hexadecimal:</p>
<ol>
<li>1-bit: 0&#215;000, 0xFFF</li>
<li>2-bit: 0&#215;555, 0xAAA</li>
<li>3-bit: 0&#215;249, 0&#215;492, 0&#215;942, 0&#215;6DB, 0xB6D, 0xDB6</li>
<li>4-bit: 0&#215;111, 0&#215;222, 0&#215;333, 0&#215;444, 0&#215;666, 0&#215;777, 0&#215;888, 0&#215;999, 0xBBB, 0xCCC, 0xDDD, 0xEEE</li>
</ol>
<p>If you want to convert this list to binary, then think about it in terms of the &#8220;number of bits&#8221;. For example, with one bit, you only have two options: a zero or a one. With two bits, you have a possible combination of 4 numbers: all zeroes, all ones, zero then one or one then zero. Because we&#8217;ve already defined &#8220;all zeroes&#8221; and &#8220;all ones&#8221; in the one-bit number, we don&#8217;t need to repeat them in the 2-bit, 3-bit or 4-bit representation. Now, why repeating that bit 3 times? Well, the least common denominator of three and four is twelve. The idea is that I&#8217;m writing patterns, not necessarily static data. So, the pattern needs to repeat through the 12-bit number. For example, take the 4-bit number
<pre>0x999</pre>
<p> What is this in a 12-bit binary representation? Isn&#8217;t it:
<pre>100110011001</pre>
<p> or if you were to separate it out:
<pre>1001 1001 1001</pre>
<p> Do you see the pattern of two ones followed by two zeroes, followed by two ones followed by two zeroes, etc? That&#8217;s the idea. Writing patterns to the disk.</p>
<p>So, how do we put all these numbers together, so we can sanitize the data securely for both RLL and MFM drives? <a title="Gutmann Method" href="http://en.wikipedia.org/wiki/Gutmann_method" target="_blank">Wikipedia has a good article on it</a>, and explains that the first and last four writes are random data from a secure random number generator. Then, at pass five through pass 31, we use the 1-bit through 4-bit numbers we came up with, and begin writing, some of them used two or three times, based on the drive encoding scheme it&#8217;s targeting.</p>
<p>Lastly, if this isn&#8217;t enough, you have one last option, where you can specify the number of passes for wiping the data. The pseudo-random number generator that is used for the other passes is chosen here, and each pass writes random data to the disk.</p>
<p>This is a great utility for sanitizing disks, however, I&#8217;ve found DBAN to be spotty on certain hardware configurations. For one, it&#8217;s x86-based only, which means you won&#8217;t be able to boot this on Sparc or HPPA-RISC hardware. Also, even on some x86-based hardware, I&#8217;ve found DBAN to hardlock, not ever getting to the menu for me to begin wiping. So, what can I do? Am I up a creek without a paddle? Most definitely not!</p>
<p>KNOPPIX is a solid LiveCD that loads the Linux kernel and the Debian user-space utilities, giving you a live desktop, complete with all the tools you would need for rescuing and wiping machines. KNOPPIX has been soundly tested against a vast array of hardware, and it sees very active development with a vibrant community behind it. How can KNOPPIX securely delete the data off your drives? Well, GNU Shred from the <a href="http://www.gnu.org/software/coreutils/">GNU Coreutils</a> package is a flexible package for choosing the number of passes against a drive. Because you&#8217;ve booted into a live Linux environment, you also have /dev/zero, /dev/random and /dev/urandom as a source of endless data for sending to your drives. In my specific situation of wiping the 13 SCSI drives, I booted into a KNOPPIX CD, executed &#8217;shred&#8217; and told it to do three passes, then one last pass of zeroes, hiding any evidence of data sanitization. Many other GNU/Linux distributions provide live environments (CD or USB) that you could take advantage of. Ubuntu, openSUSE, Debian and Fedora are just a few worth mentioning.</p>
<p>Of course, if you&#8217;re running an encrypted filesystem worth its salt, then there really is no practical reason for scrubbing the data off your drives, and the encrypted representation of your data doesn&#8217;t mean squat without the private key to that data.</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2009/08/31/scrubbing-hard-disk-data/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>GnuPG Up And Close</title>
		<link>http://pthree.org/2009/06/08/gnupg-up-and-close/</link>
		<comments>http://pthree.org/2009/06/08/gnupg-up-and-close/#comments</comments>
		<pubDate>Tue, 09 Jun 2009 06:09:15 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Cryptology]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=1069</guid>
		<description><![CDATA[Every GNU/Linux distribution ships with GnuPG by default. While they all don&#8217;t ship with the same GUI frontend, they do ship with the the same CLI backend. So, we&#8217;ll be interfacing with that throughout this informational session. I&#8217;m not presenting this as anything necessarily useful. Rather, I hope you find it informational/educational, and learn a [...]]]></description>
			<content:encoded><![CDATA[<p>Every GNU/Linux distribution ships with GnuPG by default. While they all don&#8217;t ship with the same GUI frontend, they do ship with the the same CLI backend. So, we&#8217;ll be interfacing with that throughout this informational session. I&#8217;m not presenting this as anything necessarily useful. Rather, I hope you find it informational/educational, and learn a little bit with how GnuPG works &#8220;under the hood&#8221;. So, let&#8217;s have some fun. First, a list of the &#8220;standard&#8221; algorithms that ship with GnuPG on a GNU/Linux system. This is completely based on the type of main public and private keys as well as any subkeys that you&#8217;ve generated. You can see a list of supported cipher, digest and compression algorithms by invoking the gpg binary and passing &#8220;&#8211;version&#8221; as an option. For example, here is the output from my Debian GNU/Linux unstable laptop:</p>
<pre>$ gpg -v --version
gpg (GnuPG) 1.4.9
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Home: ~/.gnupg
Supported algorithms:
Pubkey: RSA, RSA-E, RSA-S, ELG-E, DSA
Cipher: 3DES (S2), CAST5 (S3), BLOWFISH (S4), AES (S7), AES192 (S8),
        AES256 (S9), TWOFISH (S10)
Hash: MD5 (H1), SHA1 (H2), RIPEMD160 (H3), SHA256 (H8), SHA384 (H9),
      SHA512 (H10), SHA224 (H11)
Compression: Uncompressed (Z0), ZIP (Z1), ZLIB (Z2), BZIP2 (Z3)</pre>
<p>So, for ciphers, I support 3DES, CAST5, BLOWFISH, AES, AES192, AES256 and BLOWFISH. For digest hashes, I support MD5, SHA1, RIPEMD160, SHA224, SHA256, SHA384 and SHA512. Lastly, for compression algorithms, I support uncompressed, ZIP, ZLIB and BZIP2. Your output my vary slightly one way or the other. For example, you may not see the full suite of SHA algorithms. This can be obtained by generating an RSA subkey for signing only. Other ciphers might include IDEA, CAMELLIA128, CAMELLIA192 and CAMELLIA256, and you could have TIGER and WHIRLPOOL as possible supported hashes.</p>
<p>With all these algorithms, how do you know which to use and when? Fortunately, GnuPG takes care of that for you automatically. However, you can tell it what you would to prefer to use for each, if you like. You can set these in your ~/.gnupg/gpg.conf file. The options you are looking to set are &#8220;default-preference-list&#8221;, &#8220;personal-cipher-preferences&#8221;, &#8220;personal-digest-preferences&#8221; and &#8220;personal-compress-preferences&#8221;. For myself, here is what I have set in my gpg.conf:</p>
<pre>default-preference-list 3DES CAST5 BLOWFISH AES AES192 AES256 TWOFISH MD5 SHA1 RIPEMD160 SHA224 SHA256 SHA384 SHA512 Uncompressed ZIP ZLIB BZIP2
personal-cipher-preferences TWOFISH AES256 AES192 AES BLOWFISH CAST5 3DES
personal-digest-preferences SHA512 SHA384 SHA256 SHA224 SHA1 RIPEMD160 MD5
personal-compress-preferences BZIP2 ZLIB ZIP Uncompressed</pre>
<p>Now, when we printed out the verbose version, we saw in parenthesis S2, S3, H8, H9, Z1, Z2 and so on. We can use these instead of the name in our gpg.conf if we so wish. I prefer the name, as I can&#8217;t recall the key to the algorithm, and it&#8217;s easier to read. So, in my case, I list out everything that I want for a default list of preferences, then I choose the order of which to pick from when encrypting, signing and compressing. So, for encryption, I have set TWOFISH as my first choice, with AES256 as my second choice, then AES192 as my third, and so forth. I&#8217;ve done the same with my preferred digest hashing algorithm choosing SHA512 first, then SHA384 second, and so on, and the same with compression.</p>
<p>Why set the preference? For starters, if you&#8217;re like me, you sign all your email by default. You probably want your signature to withstand the test of time as long as possible. Given the strength of today&#8217;s hardware, why not choose the strongest encryption and hash algorithms? But on a more practical note, if you&#8217;re encrypting data to yourself, this would tell GnuPG to use TWOFISH as the encryption algorithm. This means that if you want to decrypt it at a later date, maybe on another computer, you&#8217;ll need to make sure TWOFISH is compiled into GnuPG. How would you know what was used? We&#8217;ll cover that in a bit.</p>
<p>However, what about encrypting to someone else other than yourself? How do these preferences come into play? Well, you can also set preferences in your public key. The purpose of this, is when people grab a copy of your key, and they want to encrypt something to you, GnuPG will negotiate the first preferred algorithm that is common between the two end points (the one doing the encrypting and the one receiving the encrypted data).</p>
<p>For example, let&#8217;s suppose Alice has a GnuPG keypair as does Bob. In Alice&#8217;s public key, which Bob has a legitimate copy of, she has set a cipher preference order of: TWOFISH BLOWFISH AES CAST5 and 3DES. Bob wants to encrypt data to Alice. Because he has a copy of her public key, he can do this. The question here is, which algorithm will be chosen for the encryption? Well, Alice prefers TWOFISH as a first pick. If Bob has compiled TWOFISH support in his copy of GnuPG, then it will be used. Suppose he doesn&#8217;t have TWOFISH support. Then the next preferred algorithm is BLOWFISH, because it&#8217;s Alice&#8217;s second pick. Let&#8217;s say Bob does support it, then BLOWFISH is the algorithm used for encrypting the data to Alice. When Alice receives the encrypted data, she&#8217;ll use the BLOWFISH algorithm along with her private key to decrypt the data. Should she wish to reply, her copy of GnuPG will pull out the preferences from Bob&#8217;s public key, and go through the same process looking for the first preferred algorithm by Bob that is supported by both parties. The &#8220;SSL handshake&#8221; works much in this same manner.</p>
<p>Digest hashing works much the same way, but slightly different. Because the recipient doesn&#8217;t matter with signed data, then rather than looking to public keys for the digest algorithm preference, you turn to your gpg.conf file, if listed, and use that there. If the recipient, or recipients have a copy of your public key, <em>and</em> the same digest algorithm compiled into their copy of GnuPG, they can verify your signature. If either is missing, the public key, or the algorithm, the signature will fail, and GnuPG will explain the problem. This process is the same for compression algorithms.</p>
<p>So, we&#8217;ve made the preferences in our gpg.conf, but how do we set them in the public key, so we can distribute this to others? Well, in this case, we need to edit our key. From the terminal (I&#8217;ve snipped out the noise, focusing only on what&#8217;s important):</p>
<pre>$ gpg --edit-key KEYID
gpg (GnuPG) 1.4.9; Copyright (C) 2008 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Secret key is available.
[ ... SNIP ... ]

Command&gt;</pre>
<p>We are now sitting at a command prompt that we can use to pass commands in an interactive fashion. I should mention that all this can be done non-interactively. Checking out the gpg manual will provide the list of options for making this possible. Typing &#8220;help&#8221; will give us the list of commands that we can pass:</p>
<pre>Command&gt; help
[... SNIP ...]
pref        list preferences (expert)
showpref    list preferences (verbose)
setpref     set preference list for the selected user IDs
[... SNIP ...]</pre>
<p>The commands that we are interested in &#8220;pref&#8221; and &#8220;setpref&#8221;. Passing &#8220;pref&#8221; might give us something like the following:</p>
<pre>Command&gt; pref
[ultimate] (1). Aaron &lt;aaron@example.com&gt;
     S10 S9 S8 S7 S4 S3 S2 H10 H9 H8 H11 H2 H3 H1 Z3 Z2 Z1 Z0 [mdc] [no-ks-modify]</pre>
<p>See those algorithm codes we saw at the beginning of this tutorial? They are listed in the preferred order that we wish to have each algorithm. In my case, I have all my encryption algorithms lists, from strong to weak, then hashing from strong to weak, then compression from most tight to no compression. What if I wanted to set a different order, or maybe not include some preferences: Using &#8220;setpref&#8221; makes this possible:</p>
<pre>Command> setpref S10 S9 S8 S7 H10 H9 H8 H2 H3 Z2 Z1 Z3 Z0
Set preference list to:
     Cipher: TWOFISH, AES256, AES192, AES, 3DES
     Digest: SHA512, SHA384, SHA256, SHA1, RIPEMD160
     Compression: ZLIB, ZIP, BZIP2, Uncompressed
     Features: MDC, Keyserver no-modify
Really update the preferences? (y/N)</pre>
<p>Typing &#8220;y&#8221; will of course make the setting in your key. At this point, you&#8217;ll be asked to enter your private key passphrase successfully before continuing. At that point, it will be statically set in your public key, and you can send your key off to the keyservers and emailed to your family and friends, so they can immediately start taking advantage of the new preferences. Type &#8220;quit&#8221; to leave the prompt.</p>
<p>Now, let&#8217;s say you have some signed and encrypted data, and you&#8217;re curious of the algorithms used when creating the cipher text. This can be done by passing the &#8220;&#8211;list-packets&#8221; option to gpg to see the data packets. We&#8217;ll need to turn on verbosity as well. For example, the output of a file I sent to a friend using the Mutt email client (emphasis mine):</p>
<pre>gpg -v --list-packets file.txt
gpg: armor header: Version: GnuPG v2.0.11 (GNU/Linux)
[... SNIP ...]
<b>gpg: AES256 encrypted data</b>
<b>:compressed packet: algo=3</b>
<b>&#58;onepass_sig packet</b>: keyid CE7911B7FC04088F
	version 3, sigclass 0x01, <b>digest 8</b>, pubkey 1, last=1
:literal data packet:
	mode t (74), created 1244484492, name="mutt-helios-1000-24974-13",
	raw data: unknown length
</pre>
<p>Here, I can easily see that AES256 was used for the encryption algorithm, but what&#8217;s this compressed &#8220;algo=3&#8243; and &#8220;onepass_sig packet digest 8&#8243; stuff? Well, in order to understand those, we need to turn to <a href="http://www.faqs.org/rfcs/rfc4880.html">RFC 4880</a>. This RFC describes the OpenPGP message format and the standards used. Browse your way down to section 9, and you&#8217;ll see what &#8220;algo=3&#8243; means for compression and &#8220;digest 8&#8243; is for signatures. It appears, according to that RFC, that BZIP2 was used for compression and SHA256 was used for the hashing algorithm. So, in this case, Christer and myself preferred those settings higher than the others, and my GnuPG acknowledged those preferences and did the encrypting, signing and compressing as told. We can see these by &#8220;editing&#8221; his key:</p>
<pre>$ gpg --edit-key christer
[... SNIP ...]
Command&gt; pref
[  full  ] (1). Christer &lt;christer@example.com&gt;
     S9 S8 S7 S3 S2 H2 H8 H3 Z2 Z3 Z1 [mdc] [no-ks-modify]
[... SNIP ...]

Command&gt; quit</pre>
<p>Christer places AES256 has his first preferred encryption algorithm. Because I also support this algorithm, this is used for the encryption. SHA1 is his preferred digest hashing algorithm with SHA256 as his second preferred, but remember that for the signature and compression, these preferences are found in my gpg.conf instead. I prefer SHA512 as my first preference, but he doesn&#8217;t list it as suported (according to his public key), so I move down to SHA384. Again, he doesn&#8217;t list it, so I try SHA256. He lists it, so it&#8217;s used. Lastly, BZIP2 as the compression algorithm, and he lists it, thus it&#8217;s chosen. Thus, the results we got. Make sense?</p>
<p>I hope this has been informative. It&#8217;s been great discovering the details of how these algorithms were chosen, and it&#8217;s been fun playing with all sorts of encrypted emails and files to get to the guts of the GunPG process. If I&#8217;ve misrepresented any data here, or you have questions, please let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2009/06/08/gnupg-up-and-close/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>My SSH Tips &#8211; Yes, More Than One</title>
		<link>http://pthree.org/2008/12/11/my-ssh-tips-yes-more-than-one/</link>
		<comments>http://pthree.org/2008/12/11/my-ssh-tips-yes-more-than-one/#comments</comments>
		<pubDate>Thu, 11 Dec 2008 23:09:26 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=740</guid>
		<description><![CDATA[There is a meme going on with Planet Debian right now about SSH tips. Here&#8217;s mine.
I used to travel the country teaching Linux System Administrators. I have spent many a day in airports, hotels and training centers. Whenever there was a network connection available, I was on it, mainly with SSH. SSH is so flexible, [...]]]></description>
			<content:encoded><![CDATA[<p>There is a meme going on with Planet Debian right now about SSH tips. Here&#8217;s mine.</p>
<p>I used to travel the country teaching Linux System Administrators. I have spent many a day in airports, hotels and training centers. Whenever there was a network connection available, I was on it, mainly with SSH. SSH is so flexible, that here is how I configured it, and how I managed it.</p>
<p>First, my ~aaron/.ssh/config:</p>
<pre>Host *
    Cipher=blowfish
    CompressionLevel=9
    ServerAliveInterval=30
Host *.server1.com
    GSSAPIAuthentication=yes
Host *.server2.com
    ForwardAgent=yes
Host foo
    Hostname foo.server2.com
    Port=22222
Host bar
    Hostname bar.server2.com
    Port=22000
Host baz
    Hostname baz.server2.com</pre>
<p>Then, my ~aaron/.zshrc:</p>
<pre>alias foo='ssh foo'
alias bar='ssh bar'
alias baz='ssh baz'</pre>
<p>Now, from the terminal (assuming I&#8217;m using SSH keys to authenticate):</p>
<pre>&lt;&lt;&lt; 15:18.27 Thu Dec 11 2008!~
&lt;&lt;&lt; aaron@kratos!3045 B:94% (0:45:31)
&gt;&gt;&gt; for HOST in foo bar baz; do ssh $HOST 'touch ~/.hushlogin'; done</pre>
<p>So, what&#8217;s going on here? In my SSH config, I&#8217;ve first chosen to use the Blowfish algorithm, as it&#8217;s light and fast, and I&#8217;ve turned compression on to the max to minimize the data passed on the wire as some connections just suck when it comes to bandwidth. I&#8217;m forwarding my SSH agent to *.server2.com, so I don&#8217;t have to always enter the SSH key passphrase after I&#8217;ve already entered it on my client. Of course, this should be on trusted systems only, and *.server2.com represents my personal servers here. I&#8217;ve set the connection to send a TCP SYN packet every 30 seconds, so I don&#8217;t lose the connection on some shoddy networks. Then, one specific host, I&#8217;ve setup support for Kerberos authentication, and all the rest, I&#8217;ve setup host shortcuts, telling SSH what hostname and port to use. Basically, I like typing as little as possible on the terminal</p>
<p>Then, on all SSH machines that I have access to, I don&#8217;t like the message of the day, if one exists, so I create the ~aaron/.hushlogin to stop that from displaying on my terminal. Finally, in my ~aaron/.zshrc, I created a few aliases for making it easy to get to the host- again, minimizing my typing as much as possible. So, I can just type &#8220;foo&#8221; on the terminal, and I will &#8220;ssh foo&#8221; which means to &#8220;ssh foo.server2.com&#8221;.</p>
<p>Beautiful.</p>
<p>However, not all is done. I also am a big fan of hiding any and all network traffic. It&#8217;s no ones business to see my packets. So, I have another alias setup in my ~aaron/.zshrc:</p>
<pre>alias tunnelfoo="'pkill ssh; ssh -4fgN -D 8081 -L 8080:localhost:3128 foo"</pre>
<p>This connects to foo setting up both a dynamic and static SOCKS proxy. First, however, you&#8217;ll notice that it runs &#8220;pkill ssh&#8221; before setting up the tunnel. I do this, because when I suspend my laptop, then resume on a different connection, that process is still running, and trying to re-establish the proxy fails, saying the ports are already bound. So, I just always kill any SSH connection when tunneling. This could be a little of a pain, if I already setup an SSH connection before running this alias. Also, the static SOCKS assumes that there is Squid proxy on the other end to tunnel the connection through. All I need to do now, is setup Firefox to connect to localhost on either port 8080 if I want to use Squid on the other end, or port 8081 if I want SSH to handle the proxied TCP/IP packets. Both are useful. I would recommend the FoxyProxy extension, if you aren&#8217;t already using it. It makes it easy to connect to these ports and tunnel your SSH traffic.</p>
<p>Finally, when I&#8217;m at remote locations, and I want access back into the network before I leave (this could be useful in the training center, where I may need to administer or play with student machines from the hotel), I&#8217;ll setup a reverse SSH tunnel, to get back into the network:</p>
<pre>ssh -4fgNR 8080:remote.server.com:22 foo.server2.com</pre>
<p>Now, when I get somewhere else, other than the location I was just at, I can run the following two commands to get back into that network:</p>
<pre>&lt;&lt;&lt; 15:33.43 Thu Dec 11 2008!~
&lt;&lt;&lt; aaron@kratos!3048 B:98% (0:20:38)
&gt;&gt;&gt; ssh foo
&lt;&lt;&lt; 15:33.46 Thu Dec 11 2008!~
&lt;&lt;&lt; aaron@foo!471
&gt;&gt;&gt; ssh -p 8080 localhost
Password:
[aaron@remote.server.com:~]$</pre>
<p>Now, I&#8217;m back into the network where I setup this remote SSH tunnel to begin with. From here, I can do work from home, the hotel, the airport, or wherever I happen to be. Those are my SSH tips. They make SSH much more enjoyable to be working with. Of course, I&#8217;m using SSH keys or Kerberos to authenticate, so I never need to deal with passwords when moving about networks.</p>
<p>Cheers!</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2008/12/11/my-ssh-tips-yes-more-than-one/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>GNU Shred</title>
		<link>http://pthree.org/2008/12/02/gnu-shred/</link>
		<comments>http://pthree.org/2008/12/02/gnu-shred/#comments</comments>
		<pubDate>Wed, 03 Dec 2008 01:02:08 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://pthree.org/2008/12/02/gnu-shred/</guid>
		<description><![CDATA[So, due to the bad shape of the economy I was let go from my position as a Linux instructor and guru. As unfortunate as it is, I have to press forward looking for the best job that fits my skill set.
However, the point of this post isn&#8217;t to complain about being laid off, or [...]]]></description>
			<content:encoded><![CDATA[<p>So, due to the bad shape of the economy I was let go from my position as a Linux instructor and guru. As unfortunate as it is, I have to press forward looking for the best job that fits my skill set.</p>
<p>However, the point of this post isn&#8217;t to complain about being laid off, or the bad shape of the economy. Rather, while employed, I was given a 120 GB LaCie Rugged hard drive that was called the &#8220;gurudisk&#8221; (being a &#8220;Linux Guru&#8221; from &#8220;Guru Labs&#8221;. Get it?). The gurudisk had everything on it necessary for easing the installation of Linux on computers. Kickstart and AutoYast files were used for automating the install of the instructor machine, while scripts and RPMs were used to automate the configuration and additional software installation of the instructor machine, and DHCP, DNS, TFTP and PXE, along with Kickstart and AutoYast files, were used for automating student machines. Using the gurudisk, I could do a full classroom install, complete with instructor machine and 20 student machines, in under an hour. The gurudisk held  RHEL 5, RHEL 5.1, Fedora 6, SLES 10, SUSE Linux 10.1 and Oracle 4.5 disk ISOs and software, as well as RPMs, scripts and config files. It was truly a welcomed companion.</p>
<p>However, all of that can easily fit in 40 GB of space, so what to do with the rest of the 80 GB? Well, most of us began using that space for personal data. Music, videos, scripts, documents and so forth. I&#8217;m not one to carry music or movies with me, so that didn&#8217;t interest me much. Rather, I wanted the ability to take the gurudisk further with using Ubuntu and Debian. So, I had an &#8220;isos&#8221; directory on my gurudisk, where I kept more updated ISOs, including RHEL 5.2, Fedora 9 and 10, Ubuntu 8.04 LTS, Debian 4.0, openSUSE 11, OpenSolaris, FreeBSD, OpenBSD, and others.  At one point, I had an entire Ubuntu repository mirroring 8.04 and 8.10 on the gurudisk. Lastly, if that&#8217;s not enough, I had VMWare, KVM, Xen and VirtualBox virtual machines with clean, vanilla installations of a few of the major distributions. I took advantage of my space, and it also came to the welcome approval of many students.</p>
<p>When news came yesterday that I had lost my job, and that I would need to turn in my gurudisk, I wanted to first get my Ubuntu mirror, virtual machines and ISOs off the disk. Then, I wanted to experience, first hand, &#8220;shredding&#8221; the data on the disk. Thus, we have now reached the topic of this post- GNU shred.</p>
<p>I had heard from students over and over again that zeroing out the drive using /dev/zero is not sufficient for secure data deletion. I full heartedly disagree, and I&#8217;m sure I&#8217;ll bring out the emotion of many of you in the comments. Here&#8217;s why I think /dev/zero is more than sufficient for secure data destruction:</p>
<ul>
<li>On older dive encoding schemes, mainly RLL and MFM, data was not written in exactly the same spot every time. As such, there was left over charge from the previous write, and expensive data recovery hardware could use math and averages to discover what the data once was. As such, a method known as the &#8220;Gutmann Method&#8221; became the standard of destroying data. Patters of ones and zeros would be written to the disk, in such a way that maximizing flipping the bits, minimizing the average left over charge. After seven passes, the residual charge would be so minute, that it would be virtually impossible to recover the data. Do 35 passes, and the data is gone for sure.</li>
<li>Drives today do not use RLL or MFM encoding, and also, the bits are much more close together then they were in days gone by. The data has to be written in exactly the same spot, or data destruction is likely on other data existing on the disk. As such, there is no left over residual charge from rewriting the data. A single pass over existing data removes any existence of that data.</li>
<li>Supposedly, top secret, mega government, super computers administered my corporations with endless amounts of cash flow can recover data on ATA drives, even after seven passes. However, there has been no academic study, no scientific evidence, no hard cold proof. All we have is hearsay and rumors of people we know claimed to recover the data using these killer machines or algorithms on ATA drives.</li>
</ul>
<p>So, with that in mind, after backing up my data, a single zeroing of the entire drive would be more than sufficient for a couple reasons. First, my bosses and company don&#8217;t have the resources, the time and money, or the care to recover any data off of my gurudisk. Second, the data I was deleting wasn&#8217;t necessarily personal, as no passwords or private keys or information was stored on the disk. So, even if the data could be recovered, of what use would it be to anyone? Little, if any. Chances are good that the drive will sit on a shelf, unattended and unused, and when it does make it back into commission, it will just be formatted with ext3, files put on, and used as any other drive. So, /dev/zero it is.</p>
<p>Or not.</p>
<p>I&#8217;m a mathematician at heart. I love math and logic puzzles as well as cryptography and many an algorithm. If I had the time and money, I would finish college, and get a Doctorate in Mathematics. However, that&#8217;s a dream that just isn&#8217;t realistic at this point in my life, but I still enjoy pulling out my HP49G+, and crunching the numbers. So, the algorithm used in Gutmann&#8217;s Method is interesting. More interesting are the pseudo-random number generators used in cryptographic applications. So, I decided to give GNU shred a try, seeing as though it&#8217;s part of coreutils, and see what the result is. I ran the following command:</p>
<pre>shred -v -z /dev/sdc</pre>
<p>This means that GNU shred will make 26 total passes, with the 26th pass being straight zeros to hide the fact that the disk has been shredded. Once finished, I&#8217;ll add one final pass as an easter egg to the next person who gets the gurudisk. So, 27 total passes to the disk. What I&#8217;m mostly interested in, is the time it will take to finish. From my understanding, it will write pseudo-random numbers to the disk on the first, middle and second-to-last passes, due to passing &#8216;-z&#8217; to zero the shred. Writing random data to 120 GB of disk is going to take some time. In fact, I timed it, and it took 5 hours and 20 minutes. Which means it will last at least 16 hours to run to completion. But then there is the one and zero pattern writing that will take place in between. I would expect this to go substantially faster than writing random data, and it does- about three times as fast. Three passes can be completed in 5 hours and 20 minutes, give or take, based on the pattern. There are 23 final passes at this rate, which is approximately 41 hours. Add the 16 on top of that, and it&#8217;s going to take 58 total hours to complete all 26 passes. That&#8217;s almost 2 and a half days! In fact, as I&#8217;m writing this, it&#8217;s 18:00 the next day, and I&#8217;m only on pass 11, writing the pattern &#8220;333333&#8243; in hexadecimal to the disk. The next pass will be my second random data pass. When I get out of bet tomorrow, I expect to be on pass 18, give or take.</p>
<p>I figure, even though I&#8217;m long past any possible data retrieval, it&#8217;s fun to watch. Even more entertaining is the heat emanating off of the disk- it&#8217;s fairly warm, which I guess makes sense, as the disks have been going non-stop for almost 24 hours. Would I recommend GNU shred for wiping your data? No. Again, /dev/zero will be more than sufficient, and fast too, at roughly 30 MB per second on a SATA or USB 2.0 disk. Which, by the way, this disk is connected via FireWire 400 (I&#8217;m not a fan of the USB speed burst). I&#8217;d love to see this run to completion, but I&#8217;ll probably cancel it sometime tomorrow morning, install my easter egg, then be on my way to return the disk.</p>
<p>Long live hacking!</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2008/12/02/gnu-shred/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Identification vs Identity</title>
		<link>http://pthree.org/2008/09/20/identification-vs-identity/</link>
		<comments>http://pthree.org/2008/09/20/identification-vs-identity/#comments</comments>
		<pubDate>Sat, 20 Sep 2008 13:54:37 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=685</guid>
		<description><![CDATA[I had an interesting discussion yesterday at work, that I would like to share here.  It was in regards to when the proper time presents itself to show identification versus identifying them on the outset.  As you can probably imagine, this was the subject of GnuPG key signing.  So, let&#8217;s start first [...]]]></description>
			<content:encoded><![CDATA[<p>I had an interesting discussion yesterday at <a href="http://www.gurulabs.com">work</a>, that I would like to share here.  It was in regards to when the proper time presents itself to show identification versus identifying them on the outset.  As you can probably imagine, this was the subject of GnuPG key signing.  So, let&#8217;s start first with a couple definitions:</p>
<p><u>Identity</u>: the state or fact of remaining the same one or ones, as under varying aspects or conditions.<br />
<u>Identification</u>: an act or instance of identifying; the state of being identified.</p>
<p>You see, your identity is who you are, while your identification verifies your identity.  This is an important realization that many of us in the tech-world don&#8217;t seem to grasp when wishing to sign GnuPG keys of others.</p>
<p>Public key cryptography is a wonderful technology.  It gives us the ability to create a system in which encrypting and decrypting files can be done with the compromising integrity of the encryption.  GnuPG is a decentralized system that enables end users, such as you and I, to create a web of trust, bypassing certificate authorities.  This is done by using your own private GPG key to sign the public key of another.  The more signatures on that key, the more that key can be trusted.  If those who have signed your key have a great deal of signatures also, then a web of trust is created, and trust strengthens.  The deeper those signature levels can do, as well as the wider they can spread, on a single key, the more you can trust the person owning that key.</p>
<p>It has been a long-standing acceptance that when you wish to sign another&#8217;s public key, that you check a government issued form of identification, such as a drivers license or passport, so you can verify with their picture that they are who they claim to be.  I have no objections with this.  However, I would have also asked my own mother for her identification before signing her public key.  Thanks to my coworkers, I&#8217;ve changed my view on asking for identification, and the change stems from a simple sentence:</p>
<blockquote><p>All you kneed to verify is their identity, <u><b>not</b></u> their identification.</p></blockquote>
<p>In other words, you are there to verify that they are who they claim to be, or their <em>identity</em>.  What if it&#8217;s your mother?  Cerntainly, you already believe her claim to be your mother.  What about your wife?  Will you put 10 years of marriage and trust second to checking her government issued form of identification?  What about coworkers?  Hopefully, your company has done the necessary identity checks, including possibly a background check, on the employee.  Is checking his identification really needed?  Especially if you have worked with him for a great deal of time?</p>
<p>Let&#8217;s look at the process of key signing, then the reason behind it.  GPG key signing is a 3 fold process:</p>
<ol>
<li>Verify that you have the proper key installed in your public keyring by asking them for the fingerprint of their key</li>
<li>Verify they are who they claim to be by verifying their identity</li>
<li>Sign their public key</li>
</ol>
<p>Notice, that no where did I mention a government form of ID.  Instead, I said to verify their identity.  If it&#8217;s my wife, she&#8217;s already been identified.  If it&#8217;s my coworker or boss, they too have already been identified.  If it&#8217;s a close friend or relative, again, they have clearly identified themselves to me without a government ID.  However, if I am not familiar enough with the person to establish a trusting relationship, then checking for their identification would be appropriate.  Maybe I&#8217;m at a keysigning party, and I have never met any of the people there.  Maybe I&#8217;ve done online conversations with the individual, but have never met him face-to-face.  Asking for identification would be important.  But if it&#8217;s a close friend, or acquaintance, asking for identification could be insulting to the established relationship, as trust should already be present.  Verifying their identity is already accomplished.  All I need to do is make sure I have the proper key installed by asking for the fingerprint of his key, then I can sign away.</p>
<p>See the difference?  Asking for identification when trust has already been established is redundant, and unnecessary.  The whole point of key signing is to establish trust.  If trust exists, then asking for identification is not needed.  What do you want to know from the ID?  That they can drive?  That they can leave the country and come back in?  This breaks the traditional stance of keysigning, where regardless of the individual, you ask for identification.  Well, long-standing traditions should be questioned for validity.  Doing something, &#8220;because that&#8217;s how we&#8217;ve always done it&#8221;, isn&#8217;t necessarily correct.</p>
<p>I know some who will not sign a key without verifying identification, even if they have a long standing relationship with you already.  I used to be one of these individuals.  You want your key signed?  Show me some ID.  Now, after the brief, but intense, discussion yesterday, I&#8217;ve changed my position.  Key signing is about building trust.  If you trust the person already, what&#8217;s the point of asking for ID?  If you don&#8217;t, your reasons for verifying the identity of the individual are warranted.</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2008/09/20/identification-vs-identity/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What Goes Out Can Come Back In</title>
		<link>http://pthree.org/2008/06/05/what-goes-out-can-come-back-in/</link>
		<comments>http://pthree.org/2008/06/05/what-goes-out-can-come-back-in/#comments</comments>
		<pubDate>Thu, 05 Jun 2008 14:58:45 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://pthree.org/?p=592</guid>
		<description><![CDATA[Remember the old saying &#8220;What goes up must come down&#8221;, referring to the gravitational pull?  Well, I have a similar saying for firewalls: What goes out can come back in.  This is a cool SSH trick that will stump even the most seasoned network administrators.
The trick is port forwarding.  The idea is [...]]]></description>
			<content:encoded><![CDATA[<p>Remember the old saying &#8220;What goes up must come down&#8221;, referring to the gravitational pull?  Well, I have a similar saying for firewalls: What goes out can come back in.  This is a cool SSH trick that will stump even the most seasoned network administrators.</p>
<p>The trick is port forwarding.  The idea is that a box will be listening for connections on a port that you specify.  If a connection is made, the packets are then transferred through the SSH connection to the box at the other end on a different port that you have specified.  So, the obvious is, you need access to an SSH server to make this possible.  Let&#8217;s take a specific example.</p>
<p>I&#8217;m at work.  The company mail server is not accessible from the Internet, so when I get home, I can&#8217;t read my corporate mail.  One specific day during the week, however, I need access.  I try to convince the network administrator to punch a hole in the firewall, or at least give me VPN access, but nothing.  No ports open for tightest security is his approach.  So, seeing as though I have access to an SSH server at home, I open an outbound port that will allow me to connect back in.  In otherwords, piggy-backing off of the SSH connection to my home SSH server.  I issue the following command from work, just before I leave:</p>
<pre>ssh -R 22225:mail.company.com:25 -fN ssh.home.com</pre>
<p>What is this saying exactly?  It&#8217;s saying that the SSH server on ssh.home.com will be listening for mail traffic on port 22225.  When a connection is made, the packets will be forwarded through the SSH connection to mail.company.com in the corporate office on port 25.  As far as the connection is concerned, mail.company.com received a port 25 packet as if it came from the box internally on the corporate LAN.  All I need to do, is launch my favorite email client that supports TCP proxies, and connect to ssh.home.com on port 22225 to make the connection.  Simple as pie.</p>
<p>Let&#8217;s look at another example:</p>
<pre>ssh -R 22222:foo.example.com:22 -fN ssh.home.com</pre>
<p>This example is saying that the SSH server on ssh.home.com will be listening for SSH traffic on port 22222.  If a connection is made, the packets will be forwarded through the SSH connection to foo.example.com in the corporate office on port 22.  This is a great way to get SSH access to machines in the office that are not accessible to the Internet.</p>
<p>Cool, eh?  Who would&#8217;ve thought that the developers of the most secure-by-default Unix, OpenBSD, would be providing me with simple tools to bypass firewalls?</p>
<p>Now, the question remains, what about the firewall?  My only response- what about it?  If you have an outbound Internet connection, your only task may be to find out what port is open for the outbound connections.  If you have access to an SSH server that you can configure, then change the port on the SSH box to match your corporate outbound port, and you&#8217;ve effectively bypassed any and all firewalls that may be in place, both out an in.  The only way, the <b><u>ONLY</u></b> way you can keep me from bypassing your firewall is to completely cut outbound connections to the Inertnet.  Completely, and totally isolate the corporate network.  Then, you have a impenetrable firewall.</p>
<p>So, as I mentioned earlier, &#8220;What goes out can come back in&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2008/06/05/what-goes-out-can-come-back-in/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Securing Your Connection On Freenode</title>
		<link>http://pthree.org/2007/07/15/securing-your-connection-on-freenode/</link>
		<comments>http://pthree.org/2007/07/15/securing-your-connection-on-freenode/#comments</comments>
		<pubDate>Mon, 16 Jul 2007 04:08:57 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.pthree.org/2007/07/15/securing-your-connection-on-freenode/</guid>
		<description><![CDATA[Freenode offers a couple wonderful services to any IRC user that I&#8217;m afraid many just know about.  They outline it very well on their website, but I&#8217;m afraid that many an IRC user aren&#8217;t taking advantage of them.  As such, seeing as though my blog syndicates a couple planets, hopefully I will reach [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://freenode.net">Freenode</a> offers a couple wonderful services to any IRC user that I&#8217;m afraid many just know about.  They outline it very well on their website, but I&#8217;m afraid that many an IRC user aren&#8217;t taking advantage of them.  As such, seeing as though my blog syndicates a couple planets, hopefully I will reach a broad readership who use IRC, and hopefully, I will be able to convince those readers to take advantage of these services.</p>
<p>First, a Freenode cloak and what a it is.  When you connect to an IRC server, the server looks up your hostname, and if the servers are in round robin DNS, a server with the least load and shortest ping times is chosen.  When connected, your nick, coupled with your hostname, provide a unique identifier for your connection.  The only problem is, unless cloaked, anyone can see your hostname, and create a DoS attack on you personally.  While rare, and isolated incidents, the exposure makes you vulnerable.  Freenode cloaks solve this issue.</p>
<p><a href="http://freenode.net/faq.shtml#cloaks">What is a cloak?</a>  A cloak hides your hostmak, which contains your IP address and/or domain name, keeping others from seeing where your IRC session is connected, and keeping you effectively secure from outside DoS attacks.  For example, when you join a channel, your hostmask is displayed as follows:</p>
<pre>21:25 -!- lamer [n=user@222.14.84.1] has joined #ubuntu</pre>
<p>Here we can plainly see the user &#8220;lamer&#8221; and his IP address.  While that might not be the IP address that he is located at, but rather just his IRC session, he is potentially prone to a DoS attack.  Now, image that he was cloaked by Freenode staff:</p>
<pre>21:25 -!- lamer [n=user@unaffiliated/lamer] has joined #ubuntu</pre>
<p>We know his nick, as is needed to communicate with him, but we know nothing of his domain or IP address.  A DoS attack on this user would be ineffective.</p>
<p>Unaffiliated cloaks are handed out with no strings attached.  The user is asked to <a href="http://freenode.net/faq.shtml#nicksetup">follow a few basic rules</a> before the cloak can be given, but if they are met, they are handed out freely and willingly.  However, it would be much appreciated if the user would <a href="http://freenode.net/pdpc_donations.shtml">financially donate to Freenode</a>.  Such users are given a special cloak, part of &#8220;project cloaks&#8221;.  The following cloak would be applied if our user &#8220;lamer&#8221; above donated at the bronze level:</p>
<pre>21:25 -!- lamer [n=user@pdpc/supporter/bronze/lamer] has joined #ubuntu</pre>
<p>This cloak is a special cloak that can be worn with pride showing that you are helping Freenode keep up with necessary server maintenance and general overhead.  There are many other cloaks that can be applied, if you are involved with a certain project.  Ubuntu has such cloaks for approved members, which you have probably seen around the network:</p>
<pre>21:25 -!- lamer [n=user@ubuntu/member/lamer] has joined #ubuntu</pre>
<p>There are many, <a href="http://freenode.net/primary_groups.shtml">many other project cloaks</a> that can be applied, such as Gentoo development, Wikipedia editing and even cooking.  Regardless of the cloak, your domain/IP is hidden from the users on the network, effectively killing any chance for a personal DoS attack.  If anything else, they look cool and show your involvement with a specific project.</p>
<p>Now, I&#8217;d like to move on to another topic, effectively securing your connection even further.  The topic is avoiding a specific router exploit called the <a href="https://help.ubuntu.com/community/FixDCCExploit">DCC exploit</a>.  Rather than go into the details of how it is executed, the DCC exploit is troublesome for large channels, as it causes massive quits from the channel, effectively flooding the channel.  Large channels are getting better, and most routers have patched the bug through firmware updates, but there are still users that are being affected.</p>
<p>What happens in most channels, is if you are affected by this exploit, then usually you will be temporarily banned from the channel until you either patch your router&#8217;s firmware, or connect to Freenode on a different port.  While patching your router&#8217;s firmware should be your first priority, it definitely isn&#8217;t the easiest, and you could end up with a dead router if executed poorly.  The easiest way to patch this bug is to connect to Freenode on port 8001 as the exploit only affects users on port 6667.  Check your IRC client&#8217;s documentation on how to connect to servers on different ports.Check your IRC client&#8217;s documentation on how to connect to servers on different ports.</p>
<p>These two tools secure your connection on Freenode, making it pretty difficult to remove you from the network unless you&#8217;re Freenode staff.  While your connection is not secured via encryption, and still in plain text on the wire, unless connected to Freenode&#8217;s hidden service via tor, you can rest assured that you&#8217;ll stay connected, given the fact that you have a stable ISP.</p>
<p>I would HIGHLY recommend taking full advantages of these two services: acquiring a cloak, and connecting on port 8001, if you spend any amount of time on Freenode.  Join #freenode for further information regarding these topics.</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2007/07/15/securing-your-connection-on-freenode/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Image Puzzle</title>
		<link>http://pthree.org/2007/05/02/image-puzzle/</link>
		<comments>http://pthree.org/2007/05/02/image-puzzle/#comments</comments>
		<pubDate>Thu, 03 May 2007 01:57:19 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Freedom]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.pthree.org/2007/05/02/image-puzzle/</guid>
		<description><![CDATA[This image will circumvent Digital Restrictions Management on HD-DVD AACS disks.  I have licensed this image under the Creative Commons Attribution 3.0 United States license.  Enjoy!

]]></description>
			<content:encoded><![CDATA[<p>This image will circumvent Digital Restrictions Management on HD-DVD AACS disks.  I have licensed this image under the <a href="http://creativecommons.org/licenses/by/3.0/us/">Creative Commons Attribution 3.0 United States license</a>.  Enjoy!</p>
<div align="center"><img src='http://www.pthree.org/wp-content/uploads/2007/05/magic_image.png' alt='magic_image.png' /></div>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2007/05/02/image-puzzle/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>More SSH Tips</title>
		<link>http://pthree.org/2007/03/24/more-ssh-tips/</link>
		<comments>http://pthree.org/2007/03/24/more-ssh-tips/#comments</comments>
		<pubDate>Sat, 24 Mar 2007 23:18:58 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.pthree.org/2007/03/24/more-ssh-tips/</guid>
		<description><![CDATA[I just love OpenSSH.  That is the single greatest tool on unix-like operating systems, as far as I am concerned.  I&#8217;ve blogged about SSH plenty.  SSH tunneling, SSH forwarding, SSHFS and more.  Needless to say, I believe that SSH is the single most flexible and powerful package on unix-like operating systems. [...]]]></description>
			<content:encoded><![CDATA[<p>I just love OpenSSH.  That is the single greatest tool on unix-like operating systems, as far as I am concerned.  I&#8217;ve blogged about SSH plenty.  SSH tunneling, SSH forwarding, SSHFS and more.  Needless to say, I believe that SSH is the single most flexible and powerful package on unix-like operating systems.  And, with this post, it just gets better.</p>
<p>First, I&#8217;m not sure if you are aware, but in your ~/.ssh/config file, you can specify all the servers that you connect to, with their associated port (being that they are running SSH on a non-standard port other than 22).  This makes it easy on the typing when sitting at the shell.  For example, rather than type this:</p>
<pre>aaron@hercules:~$ ssh -p 22222 aaron@some.remote.server.com</pre>
<p>I can add the following to my ~/.ssh/config file:</p>
<pre>Host some.remote.server.com
Port 22222</pre>
<p>Now, I just need to type:</p>
<pre>aaron@hercules:~$ ssh aaron@some.remote.server.com</pre>
<p>Very nice.  Of course, there is a lot more you can put in your SSH config file, and you can have multiple hosts with their associated ports in the file as well.  If you look at your /etc/ssh/ssh_config file, you can see a much broader range of options that can exist in your ~/.ssh/config.</p>
<p>Next in line is your SSH keys.  You can setup your SSH server to allow key-based authentication rather than the traditional user/password.  Which means, that rather than enter your password every time you try to connect to a remote SSH server, you can have your SSH key authenticate you automatically.  First, you need to generate a key:</p>
<pre>aaron@hercules:~$ ssh-keygen -t dsa</pre>
<p>Enter a passphrase for your key, and give it the name of the file to save it to (default is fine).  Now that you have a DSA SSH key generated, we need to get that key on the remote server, so we don&#8217;t have to type our password all the time.  So, this is where a really cool tool called &#8217;ssh-copy-id&#8217; comes in.  ssh-copy-id is just a script that makes an SSH connection to the remote server specified, secure copies the newly generated key over and appends it to ~/.ssh/authorized_keys.  For example:</p>
<pre>aaron@hercules:~$ ssh-copy-id -i .id_dsa.pub aaron@some.remote.server.com</pre>
<p>It will ask for the user password just once, as you need to verify you are who you say you are.  When entered correctly, the key is copied over and appended.  You need the &#8216;-i&#8217; to take your identity with you.  This isn&#8217;t always needed, but type it anyway in good practice, as it will never hurt anything.  Now, when logging into some.remote.server.com, you won&#8217;t need to worry about entering your password.  The server will look at the SSH keypair, and if they match, you&#8217;re set.  You should, however, add your SSH identity before connecting, otherwise, you&#8217;ll always be prompted to enter your SSH key passphrase.  This can easily be done with:-</p>
<pre>aaron@hercules:~$ ssh-add</pre>
<p>Now, you&#8217;ll be asked for your passphrase once.  Your SSH identity will be added to the keyring, and you can SSH to the remote server as many times as you like, save your identity is saved in the keyring.  Gnome provides this keyring by default, so, if you stay logged into Gnome, so will your SSH identity.  As soon as you log out and then back in, you&#8217;ll need to re-add it.</p>
<p>So, there you go.  Two simple tips to get your OpenSSH behaving the way you want, and with ease.  Key based authentication is the only way to go, definitely if developing on the remote server with SVN+SSH.  Your password can be a major problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2007/03/24/more-ssh-tips/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Setting The Standards Bar</title>
		<link>http://pthree.org/2007/02/21/setting-the-standards-bar/</link>
		<comments>http://pthree.org/2007/02/21/setting-the-standards-bar/#comments</comments>
		<pubDate>Wed, 21 Feb 2007 14:41:03 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Gaim]]></category>
		<category><![CDATA[Jabber]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.pthree.org/2007/02/21/setting-the-standards-bar/</guid>
		<description><![CDATA[One of the things that I hate about instant messaging clients is the lack of adherence to standards.  In fact, the specification that I think should be adhered to the most, isn&#8217;t.  I&#8217;ve blogged about this before, so I apologize to the planets that I am syndicated to in advance for duplicating content. [...]]]></description>
			<content:encoded><![CDATA[<p>One of the things that I hate about instant messaging clients is the lack of adherence to standards.  In fact, the specification that I think should be adhered to the most, isn&#8217;t.  <a href="http://www.pthree.org/2006/07/19/streamline-client-encryption-before-i-lose-my-mind/">I&#8217;ve blogged about this before</a>, so I apologize to the planets that I am syndicated to in advance for duplicating content.  However, due to the recent poll about which IM client you use, I&#8217;ve setup another.<br />
<a href="http://www.pthree.org/2007/02/17/poll-select-your-linux-im-client/"><br />
In the last poll</a>, the top 5 Linux clients that are currently in operation are, as a result of my poll, in order from most used to least:</p>
<ol>
<li>Gaim</li>
<li>Kopete</li>
<li>Gajim</li>
<li>Gossip</li>
<li>aMSN</li>
</ol>
<p>I look at those clients, and recognize that there isn&#8217;t a single standard between any two of them for encrypting your messages.  There are just too many options:</p>
<ul>
<li><u>gaim-encryption</u>: Only works with Gaim, or clients implementing the Gaim code.</li>
<li><u>otr</u>: a good alternative, working with Gaim, Adium for Mac and Trillian for Windows, but not available for other clients.</li>
<li><u>otr-proxy</u>: probably a better alternative than it&#8217;s parent, allowing any IM client that can utilize a proxy access.  However, at the moment, it only works for AIM and ICQ protocols, alienating many users.</li>
<li><u>GnuPG</u>: In my opinion, the best alternative using your personal GnuPG keypair, but, only implemented in Gajim and Psi.</li>
</ul>
<p>I&#8217;m sure there are other options, but I think the point is made.  I should be able to choose any IM client, and encrypt my traffic with a standard spec that is implemented across the table, regardless of which client my friends choose.</p>
<p>As mentioned, I personally favor using my private and public GnuPG keypair.  To me, that just makes sense.  Why keep track of two keys, one for IM, and the other for everything else?  But, I would be willing to see otr or otr-proxy as the standard as well.  The point is just setting the standard, then implementing it across clients.</p>
<p>As such, here is another poll.  Should an encryption standard be set, regardless of IM client or protocol, given the information that I outlined here?</p>
<p>I should mention that I use Jabber as my means of IM communication.  Jabber, by default, implements SSL/TLS.  So, my traffic is already incrypted on the wire with my friends.  However, can I trust that the Jabber server I or my friends connect to are not decrypting and logging the chat sessions?  Something to think about.</p>
<div>
	<div class='democracy'>
		<strong class="poll-question">Should there be a starndard encryption process among IM clients?</strong>
		<div class='dem-results'>
		<form action='http://pthree.org/wp-content/plugins/democracy/democracy.php' onsubmit='return dem_Vote(this)'>
		<ul>
			<li>
					<input type='radio' id='dem-choice-17' value='17' name='dem_poll_3' />
					<label for='dem-choice-17'>Yes</label>
			</li>
			<li>
					<input type='radio' id='dem-choice-18' value='18' name='dem_poll_3' />
					<label for='dem-choice-18'>No</label>
			</li>
		</ul>
			<input type='hidden' name='dem_poll_id' value='3' />
			<input type='hidden' name='dem_action' value='vote' />
			<input type='submit' class='dem-vote-button' value='Vote' />
			<a href='/category/security/feed/?dem_action=view&amp;dem_poll_id=3' onclick='return dem_getVotes("http://pthree.org/wp-content/plugins/democracy/democracy.php?dem_action=view&amp;dem_poll_id=3", this)' rel='nofollow' class='dem-vote-link'>View Results</a>
		</form>
		</div>
	</div></div>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2007/02/21/setting-the-standards-bar/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>My GnuPG Locality Solution</title>
		<link>http://pthree.org/2007/02/20/my-gnupg-locality-solution/</link>
		<comments>http://pthree.org/2007/02/20/my-gnupg-locality-solution/#comments</comments>
		<pubDate>Tue, 20 Feb 2007 22:14:46 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.pthree.org/2007/02/20/my-gnupg-locality-solution/</guid>
		<description><![CDATA[Yesterday, I provided a problem about how to use my GnuPG key regardless of my location.  In reality, there are only 3 computers that I sit at:  Hercules, my laptop, and my main companion; Zeus, my &#8220;other&#8221; desktop, that is actually far more powerful than Hercules, but my wife is always on it [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday, <a href="http://www.pthree.org/2007/02/19/my-gnupg-locality-problem/">I provided a problem</a> about how to use my GnuPG key regardless of my location.  In reality, there are only 3 computers that I sit at:  Hercules, my laptop, and my main companion; Zeus, my &#8220;other&#8221; desktop, that is actually far more powerful than Hercules, but my wife is always on it with Windows XP; and Poseidon, my workstation at work.  So, really, the security that I need to worry about is minimal (2 at home, and 1 at work), and I can be fairly pragmatic about it.</p>
<p>I have to say that some really interesting solutions came in regards to my problem.  Encrypted loopback filesystems, smartcards, splitting the key, and others.  I don&#8217;t think my solution is superior.  Actually, I really like splitting the key that <a href="http://www.digital-scurf.org/">Daniel Silverstone</a> came up with.  Trully genius.  However, my solution was the best that I could come up with, and probably fairly obvious.  So, at any rate&#8230;</p>
<p>The solution I came up with allows me to keep my GPG key on one computer at home, with the other two taking advantage of that PC.  Here&#8217;s what I did to solve the problem:</p>
<ol>
<li> Recognize that I have an SSH port open for remote access.</li>
<li> Secured the SSH port a bit by completely disabling username/password authentication, root logins and, of course, obscured it by moving the default port off of 22.</li>
<li> Generated SSH keys, using a strong cryptographic passphrase, <a href="http://www.pthree.org/2007/02/10/ssh-key-authentication/">following this tutorial</a>.</li>
<li> Appended the public keys to ~/.ssh/authorized_keys on the remote server.</li>
<li> Installed, and configured, <a href="http://www.pthree.org/2007/02/10/sshfs/">following this tutorial</a>, SSHFS.</li>
<li> Restarted the remote SSH daemon.</li>
<li> Wrote an alias to mount the remote SSFS .gnupg directory to my local .gnupg directory (using compression).</li>
</ol>
<p>With this, I use the Gnome SSH agent, that is already running, to add my local public SSH key to the agent.  Then, with that added, after entering my passphrase, I run the alias I created earlier to mount the SSHFS to my directory.  Now, I can use KGpg, Enigmail, and pretty much anything GPG-related on my local machine using my GnuPG key as if it were running locally, and yet take advantage of the remote SSH key.  The only thing is, as it is running through SSH, it tends to be a bit slow for encrypting, decrypting and signing.  However, I only need to keep one copy of my GPG key, and I can keep it where I know that it is secure.  So the decrease in speed performance is worth the saftey and integrity of the key.  Also, I only need to run the process of adding my key to the agent and mounting SSHFS once, which is nice.</p>
<p><u style="color: red">DISCLAIMER:</u>  Because I mounted SSHFS using public key authentication, the mount exists as long as I stay logged into my box, or if I unmount it using <tt>fusermount -u</tt>.  This could pose a threat, if anyone has access to my workstation.  As such, when leaving the computer, I need to remember to lock it every time, or logout.  Not keeping in this practice of locking my workstation or logging out, could compromise the key.  However, when logged out, the agent dies, thus losing the key in the agent, and unmounting the SSHFS, which means my private GPG key is no longer on the computer.  So, either I need to lock the workstation, or logout every time I leave the PC.  Fortunately, this is in standard practice with current behavior, so it won&#8217;t be a problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://pthree.org/2007/02/20/my-gnupg-locality-solution/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
