<?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>Designoplasty Web Design and Development Blog &#187; Security</title>
	<atom:link href="http://designoplasty.com/tag/security/feed/" rel="self" type="application/rss+xml" />
	<link>http://designoplasty.com</link>
	<description>HTML, Javascript, PHP, and Me</description>
	<lastBuildDate>Fri, 14 May 2010 01:22:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Simple File Encryption on Mac OS X (and Unix)</title>
		<link>http://designoplasty.com/2009/05/17/simple-file-encryption-on-mac-os-x-and-unix/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=simple-file-encryption-on-mac-os-x-and-unix</link>
		<comments>http://designoplasty.com/2009/05/17/simple-file-encryption-on-mac-os-x-and-unix/#comments</comments>
		<pubDate>Mon, 18 May 2009 05:02:13 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://designoplasty.com/?p=666</guid>
		<description><![CDATA[

For a while now I had been using encrypted disk images, as recommended by Apple to store encrypted files. But the minimum disk image size is 10 megabytes, which is awfully large to store a 4K text file. Also, if I want to look at the file I have to mount the disk image, go [...]]]></description>
			<content:encoded><![CDATA[<img src="http://photos.smugmug.com/photos/539309430_6i2jw-L.jpg" class="floatright" style="width: 500px; height: 333px;" alt="openssl and encrypting files on Mac OS X" />

<p>For a while now I had been using encrypted disk images, as recommended by Apple to store encrypted files. But the minimum disk image size is 10 megabytes, which is awfully large to store a 4K text file. Also, if I want to look at the file I have to mount the disk image, go to the file in the finder, open it and then eventually close it and eject the disk image. What a pain. I knew there had to be a better way.</p>

<p>The better was is to use openssl. I believe it&#8217;s available on all platforms and comes pre-installed on all Unix like platforms. I can sort of see why Apple doesn&#8217;t talk about this because there are a ton a options and figuring out which is the best or what they even mean is difficult. Even just getting started is hard. So without covering the myriad of functionality openssl has, here is how to encrypt and decrypt files.</p>

<p>To encrypt a file:</p>

<pre><code>openssl enc -aes256 -salt -in <i>myfile.txt</i> -out <i>myfile.crypt</i></code></pre>

<p>You will receive a prompt for a password that will later be used when you decrypt the file. This is what the parameters mean:</p>

<dl>
  <dt>enc</dt>
  <dd>openssl has all sorts of sub-commands and &#8220;enc&#8221; is the one that specifies you want to encrypt (or decrypt) data.</dd>
  <dt>-aes256</dt>
  <dd>openssl supports tons of different encryption schemes and even allows you to write your own. For our purposes 256-bit AES is a good choice although you&#8217;re free to investigate the others.</dd>
  <dt>-salt</dt>
  <dd>
    <p>The documentation says to always use this, but is worded in such a way that you don&#8217;t know if it&#8217;s the default. Just to amuse you, here is what the docs say for the opposite option, -nosalt:</p>
    <blockquote>This is the default for compatibility with previous versions of OpenSSL and SSLeay.</blockquote>
    <p>That is just phrased weird, kind of making it sound like it&#8217;s only the default in some cases? Instead of &#8220;for&#8221; do they mean &#8220;to provide&#8221;? Very odd. The output would indicate that -nosalt is not the default. Just put -salt in to be safe.</p>
  </dd>
</dl>

<p>To decrypt the file:</p>

<pre><code>openssl enc -d -aes256 -in <i>myfile.crypt</i></code></pre>

<p>Here that addition of the -d option is what makes openssl decide to decrypt the file. -salt only needs to be used for encryption. The command as written will send the output to standard output, but you can use the -out parameter if you wish. For my purposes, that would just be one more file I&#8217;d need to delete so if I don&#8217;t need to change it I&#8217;d rather not created it.</p>

<h3>Important Notes</h3>

<p>Once you start encrypting files, things get a little overwhelmingly crazy. Especially if you have Time Machine running. You don&#8217;t want to go decrypting those files into files in backed up folders. For this reason I have a /tmp file in my home directory that I have told Time Machine specifically not to back up. For now, Time Machine does not back up the trash so you don&#8217;t have to worry as much about what happens between you deleting the file and emptying the trash.</p>

<p>This is a problem for encrypted disk images to some extent as well, but not quite as much. Time Machine is not a friend to decrypted data, no matter where it comes from.</p>

<p>Secondly, although openssl is amazingly complex it is equally amazingly unhelpful. Just so you know, the man page for the sub command enc is retreived at man enc. Bizarre, I know. Also, there&#8217;s no &#8211;help option, however if you just pretend there is you will often get what you want. It usually responds to options it doesn&#8217;t know with a help page.</p>

<p>And finally, like me, you will want to create small scripts to make this faster and so you will remember what encryption algorithm you used. I have named mine <i>enc</i>:</p>

<pre><code>#!/bin/bash

openssl enc -aes256 -salt -in "$1" -out "$1.crypt"</code></pre>

<p>and <i>dec</i>:</p>

<pre><code>#!/bin/bash

openssl enc -d -aes256 -in "$1"</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://designoplasty.com/2009/05/17/simple-file-encryption-on-mac-os-x-and-unix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>End of the Month Blues</title>
		<link>http://designoplasty.com/2009/04/01/end-of-the-month-blues/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=end-of-the-month-blues</link>
		<comments>http://designoplasty.com/2009/04/01/end-of-the-month-blues/#comments</comments>
		<pubDate>Wed, 01 Apr 2009 23:50:34 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Safari]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Slimbox]]></category>

		<guid isPermaLink="false">http://designoplasty.com/?p=404</guid>
		<description><![CDATA[

Last night I was trying to finish up some stuff for a small client so I&#8217;d have everything they need done by the end of the month. It was kind of a trial as I upgraded their site to use Slimbox 2 and was running into an issue that was totally messing me up. It [...]]]></description>
			<content:encoded><![CDATA[<img src="http://photos.smugmug.com/photos/503627124_Kvoht-M.png" class="floatright" style="width: 256px; height: 256px;" alt="Web Security" />

<p>Last night I was trying to finish up some stuff for a small client so I&#8217;d have everything they need done by the end of the month. It was kind of a trial as I upgraded their site to use <a href="http://www.digitalia.be/software/slimbox2">Slimbox 2</a> and was running into an issue that was totally messing me up. It turned out to be a directory permissions issue. While I love Safari, it could have been a bit more clear about the fact that it couldn&#8217;t read the files in a certain directory. That is, when you say it took &#8220;this long&#8221; to read a file, I tend to assume that you actually read that file. Never assume.</p>

<p>I was just finishing up and looking forward to some TV when I noticed some links at the bottom of the pages. Oh great, the site had been hacked. By a hacker who had a lot of time on his hands. The hacker had gone into my custom code and found the exact place to include his links. I was amazed. Luckily, he was very clean about it, and since I use Subversion to track all my code, I just deleted all the files in the directory and copied the right ones back, changed the passwords, and did some other stuff.</p>

<p>From the looks of it, I think the user had full access to the account. The passwords were on the weaker side and I left them that way because quite honestly this isn&#8217;t a site with that much traffic. There&#8217;s no customer data stored on the site or anything like that. I can&#8217;t imagine it would have been worth his while to hack it. It&#8217;s also a site that&#8217;s clearly maintained, so I just don&#8217;t see the point. But it took me a while to deal with it. Now the passwords are ridiculously strong.</p>

<p>I really don&#8217;t like the web host this customer is using. It&#8217;s Lunarpages. They don&#8217;t support sftp, or ssh, or any number of other things and they&#8217;re all around lame. So we will be moving the site to a new host soon.</p>

<p>I used to be more easy going about this, if customers had a host, I wouldn&#8217;t try to get them to change, but now that I have a host that I know is economical, secure, and easy to use, I think I&#8217;ll be more likely to suggest the switch. It&#8217;s easy enough to cost justify, and will save all of us pain in the future.</p>]]></content:encoded>
			<wfw:commentRss>http://designoplasty.com/2009/04/01/end-of-the-month-blues/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Firefox 3.0.8 Security Update Released</title>
		<link>http://designoplasty.com/2009/03/27/firefox-308-security-update-released/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=firefox-308-security-update-released</link>
		<comments>http://designoplasty.com/2009/03/27/firefox-308-security-update-released/#comments</comments>
		<pubDate>Sat, 28 Mar 2009 02:35:26 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Bugs]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Standards]]></category>
		<category><![CDATA[Web Browsers]]></category>

		<guid isPermaLink="false">http://designoplasty.com/?p=386</guid>
		<description><![CDATA[

Firefox has released a security update. Firefox isn&#8217;t my primary browser, that&#8217;s Safari, so sometimes I feel like there&#8217;s a security update available every time I open Firefox or Opera.

Of course I test on them, though. I like that there are multiple browsers now, it&#8217;s a much healthier community. And they&#8217;re all better than Internet [...]]]></description>
			<content:encoded><![CDATA[<img src="http://photos.smugmug.com/photos/500185408_KAXwy-L.png" class="floatright" style="width: 256px; height: 256px;" alt="Firefox Icon" />

<p>Firefox has released a <a href="http://blog.mozilla.com/blog/2009/03/27/firefox-308-security-release-now-available/">security update</a>. Firefox isn&#8217;t my primary browser, that&#8217;s Safari, so sometimes I feel like there&#8217;s a security update available every time I open Firefox or Opera.</p>

<p>Of course I test on them, though. I like that there are multiple browsers now, it&#8217;s a much healthier community. And they&#8217;re all better than Internet Explorer. Open source also seems to really work for browsers. I think any time you need to conform to standards, your product should be open source. If there&#8217;s predefined work that people can do for free, by all means, allow them to do it! I wonder if Microsoft is aware of that concept?</p>

<p>One thing I would like is for Firefox to render form elements, such as text inputs, the same as other browsers. Firefox adds some space around them that&#8217;s not styleable, so firefox inputs are always a couple of pixels bigger than they are in other browsers.</p>]]></content:encoded>
			<wfw:commentRss>http://designoplasty.com/2009/03/27/firefox-308-security-update-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
