<?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>Steve Jenkins&#039; Blog &#187; Linux</title>
	<atom:link href="http://stevejenkins.com/blog/category/technology/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://stevejenkins.com/blog</link>
	<description>Tech articles, product reviews, and other geeky stuff.</description>
	<lastBuildDate>Thu, 22 Dec 2011 19:59:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>How to Back Up a Linux Server to Amazon S3 with Duplicity and AutoMySQLBackup</title>
		<link>http://stevejenkins.com/blog/2011/11/how-to-back-up-a-linux-server-to-amazon-s3-with-duplicity-and-automysqlbackup/</link>
		<comments>http://stevejenkins.com/blog/2011/11/how-to-back-up-a-linux-server-to-amazon-s3-with-duplicity-and-automysqlbackup/#comments</comments>
		<pubDate>Sat, 05 Nov 2011 21:42:57 +0000</pubDate>
		<dc:creator>Steve Jenkins</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Reference]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Amazon]]></category>
		<category><![CDATA[Amazon backup]]></category>
		<category><![CDATA[Amazon S3]]></category>
		<category><![CDATA[AutoMYSQLBackup]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[backup to s3]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Duplicity]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[off-site]]></category>
		<category><![CDATA[RHEL]]></category>
		<category><![CDATA[S3]]></category>
		<category><![CDATA[s3 backup]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://stevejenkins.com/blog/?p=1752</guid>
		<description><![CDATA[I often say there are only two types of data: data that is backed up, and data that is waiting to be lost. Even if you&#8217;re the most contentious hax0r who always backs up your data, if your backups are stored in the same physical location as the source data, then your data is still &#8221;waiting [...]
Related posts:<ol>
<li><a href='http://stevejenkins.com/blog/2011/02/how-to-set-up-ushare-media-server-on-fedora-centos-to-stream-video-and-pictures-to-xbox-360-or-ps3/' rel='bookmark' title='How to set up uShare media server on Fedora / CentOS to stream video and pictures to Xbox 360 or PS3'>How to set up uShare media server on Fedora / CentOS to stream video and pictures to Xbox 360 or PS3</a></li>
<li><a href='http://stevejenkins.com/blog/2011/08/installing-opendkim-rpm-via-yum-with-postfix-or-sendmail-for-rhel-centos-fedora/' rel='bookmark' title='Installing OpenDKIM RPM via Yum with Postfix or Sendmail (for RHEL / CentOS / Fedora)'>Installing OpenDKIM RPM via Yum with Postfix or Sendmail (for RHEL / CentOS / Fedora)</a></li>
<li><a href='http://stevejenkins.com/blog/2010/07/how-to-backup-your-navigation-dvd-cd/' rel='bookmark' title='How to Backup your Navigation DVD/CD'>How to Backup your Navigation DVD/CD</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><a href="http://stevejenkins.com/blog/wp-content/uploads/2011/11/backup-Cloud.jpg"><img class="size-full wp-image-1756 alignright" title="Backup... TO THE CLOUD!" src="http://stevejenkins.com/blog/wp-content/uploads/2011/11/backup-Cloud.jpg" alt="" width="380" height="316" /></a>I often say there are only two types of data: <strong>data that is backed up</strong>, and<strong> data that is waiting to be lost</strong>.</p>
<p>Even if you&#8217;re the most contentious hax0r who always backs up your data, if your backups are stored in the same physical location as the source data, then your data is <em>still</em> &#8221;waiting to be lost&#8221; in the event of a fire, flood, theft, or other disaster. By combining Amazon&#8217;s low-priced S3 (Simple Storage Solution) Cloud-based storage solution with some excellent some open source backup tools, you can now be more prepared than ever without spending a fortune.</p>
<p>This how-to demonstrates how I combined the following tools to automate my off-site backups:</p>
<ul>
<li><a target="_blank" href="http://www.amazonaws.com/" target="_blank">Amazon S3</a>: cheap, secure, redundant, off-site storage service</li>
<li><a target="_blank" href="http://sourceforge.net/projects/automysqlbackup/" target="_blank">AutoMySQLBackup</a>: free software to create backups of MySQL databases</li>
<li><a target="_blank" href="http://duplicity.nongnu.org/" target="_blank">Duplicity</a>: free software that does smart backups to remote locations</li>
<li><a target="_blank" href="http://www.gnupg.org/" target="_blank">GPG</a>: allows encryption and signing of data for privacy</li>
<li><a target="_blank" href="http://blog.damontimm.com/bash-script-incremental-encrypted-backups-duplicity-amazon-s3/" target="_blank">dt-s3-backup.sh</a>: a slick shell script that ties all these tools together</li>
</ul>
<h2>Step 1: Set up your Amazon S3 Storage Bucket</h2>
<p>I won&#8217;t walk through all the steps to do this, as Amazon makes it easy. Just <a target="_blank" href="http://aws.amazon.com/" target="_blank">sign up</a> for their S3 service (you only pay for what you use), sign in, find the Security Credentials page and take note of your <strong>Access Key ID</strong> and your <strong>Secret Access Key</strong>. You&#8217;ll need them later. You should also set up an S3 Bucket to store your backups. Write down the name of your bucket for use in a later step.</p>
<h2>Step 2: Download AutoMySQLBackup (optional)</h2>
<p>If you don&#8217;t have any MySQL databases to back up, or you have your own preferred method of backup in your databases, you can skip this step. AutoMySQLBackup is a free utility that quickly and easily create dumps of your MySQL data &#8211; which we&#8217;ll back up to Amazon S3 in a later step.</p>
<p>Download <a target="_blank" href="http://sourceforge.net/projects/automysqlbackup/" target="_blank">AutoMySQLBackup</a> from SourceForge and run the simple install.sh script to set it up. I followed <a target="_blank" href="http://www.ducea.com/2006/05/27/backup-your-mysql-databases-automatically-with-automysqlbackup/" target="_blank">this excellent blog post</a> to help me get AutoMySQLBackup configured and working. I had to make a few minor changes because I&#8217;m using a more current version of AutoMySQLBackup and some of the variable names in the config file were different, but it&#8217;s pretty straightforward. Once you&#8217;ve got it backing up your databases, you&#8217;re ready to move on.</p>
<h2>Step 3: Download and Install Duplicity</h2>
<p>Duplicity is the program that does most of the heavy lifting in this situation. It manages the actual file backup (full or incremental), compression, encryption, and the file transfer to any number of off-site storage locations. Lots of documentation is available online, in case your needs differ from the ones explained here. As always, Google is your friend. <img src='http://stevejenkins.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>To install Duplicity if you&#8217;re running Fedora, RHEL, or CentOS, it&#8217;s as simple as doing:</p>
<pre>yum install duplicity</pre>
<p>For Ubuntu or Debian users, do:</p>
<pre>apt-get duplicity</pre>
<p>If you&#8217;re running some other flavor of Linux, refer to the <a target="_blank" href="http://duplicity.nongnu.org/" target="_blank">Duplicity website</a> for help installing.</p>
<h2>Step 4: Create a GPG Key for Backups</h2>
<p>Because you&#8217;re going to be transferring your precious data over the Internet, and storing it in an off-site location that shouldn&#8217;t be, but still technically <em>could</em> be, accessed by snooping Amazon employees or hackers, it&#8217;s best to encrypt your data before sending it&#8230; &#8220;<strong><em><a target="_blank" href="http://www.youtube.com/watch?v=-HRrbLA7rss" target="_blank">to the CLOUD!</a></em></strong>&#8221; Seriously, those commercials are so annoying.</p>
<p>Even if you already have a GPG key, I recommend creating a separate one just for backups (which we&#8217;ll also store in a secure location later so you&#8217;re never stuck without the ability to decrypt your data later). Do:</p>
<pre>gpg --gen-key</pre>
<p>You can accept all the defaults, but make sure you use a passphrase when creating this key, since Duplicity will require it. After you&#8217;ve answered all the questions, the output should look something like this:</p>
<pre>We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
.++++++++++++++++++++..+++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++++
.+++++..+++++.+++++++++++++++++++++++++++++++++++++++++++++.....&gt;.++++++++++................................+++++
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
+++++.++++++++++..++++++++++...++++++++++...+++++.+++++..+++++.+++++..+++++++++++++++.+++
++++++++++++..+++++++++++++++..++++++++++..+++++++++++++++++++++++++...+++++..+++++&gt;+++
+++++++&gt;.+++++&gt;+++++......................+++++^^^
gpg: key 1F6C9247 marked as ultimately trusted
public and secret key created and signed.

gpg: checking the trustdb
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0  valid:   2  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 2u
pub   2048R/1F6C9247 2011-11-05
      Key fingerprint = FC81 D8E3 8090 EEE3 1D98  E000 045C D80E 1F6C 9247
uid                  Backup Key &lt;backup@example.com&gt;
sub   2048R/12D6A5B0 2011-11-05</pre>
<p>Take note of your key&#8217;s public <strong>GPG Key ID</strong>, which is listed on the line where it says &#8220;key xxxxxxxx marked as ultimately trusted&#8221; (in this example, it&#8217;s <strong>1F6C9247). </strong>You can also find your GPG key&#8217;s public ID with:</p>
<pre>gpg --list-keys</pre>
<p>which will spit out something like:</p>
<pre>pub   2048R/1F6C9247 2011-11-05
uid                  Backup Key &lt;backup@example.com&gt;
sub   2048R/12D6A5B0 2011-11-05</pre>
<p>You&#8217;ll see your key&#8217;s ID on the top row after the slash. Write it down (don&#8217;t worry, it&#8217;s not a security risk like a password) to refer to in the next step.</p>
<h2>Step 5: Download and Configure dt-s3-backup Script</h2>
<p>While trying to make all the aforementioned tools work together, a stumped across a very cool script that already did it for me. <a target="_blank" href="http://blog.damontimm.com/bash-script-incremental-encrypted-backups-duplicity-amazon-s3/" target="_blank">This blog post</a> explains the script, and the script itself is <a target="_blank" href="https://github.com/thornomad/dt-s3-backup" target="_blank">hosted on GitHub</a>.</p>
<p>Download the script to your server (I put mine in <strong>/usr/local/bin</strong>) and then open it up in an editor. You&#8217;ll need to put the following in the appropriate locations inside the script:</p>
<ul>
<li>AWS_ACCESS_KEY_ID: Your Amazon Access Key (duh!)</li>
<li>AWS_SECRET_ACCESS_KEY: Your Amazon Secret Access Key (double duh!)</li>
<li>GPG_KEY: Your GPG Key ID of the key you created in the previous step</li>
<li>ROOT: I changed this to just &#8220;/&#8221; so that I could back up anything on the system. You&#8217;ll pick the exact directories you want in a bit.</li>
<li>DEST: Since we&#8217;re backing up to Amazon S3, comment out the &#8220;file:&#8221; line, uncomment the &#8220;s3+http:&#8221; line, and put the name of the Amazon S3 bucket you created for backups in the first step. If your bucket name were &#8220;my.awesome.backups&#8221; then this line would be <strong>DEST=&#8221;s3+http://my.awesome.backups/&#8221;</strong></li>
</ul>
<p>Skip the <strong>INCLIST</strong> and <strong>EXCLIST</strong> options for now, and tinker with the STATIC_OPTIONS to your liking. These will simply be passed to Duplicity, so you can check the Duplicity docs for all the possilibities. I have mine set to <strong>STATIC_OPTIONS=&#8221;&#8211;full-if-older-than 4W&#8221;</strong> which means my backup (which I run daily) will do incremental backups unless it&#8217;s been 4 weeks, in which case it will do a full backup. I also kept the default <strong>CLEAN_UP_TYPE</strong> and <strong>CLEAN_UP_VARIABLE</strong> settings. Again, refer to the Duplicity docs for other options.</p>
<p>Finally, I also tinkered with the Logfile settings and Email Alert settings.</p>
<h2>Step 6: Choose which directories to include and exclude</h2>
<p>Use the <strong>INCLIST</strong> and <strong>EXCLIST</strong> sections of the <strong>dt-s3-backup.sh</strong> script to list which directories you want to include and exclude while doing your backups. Examples are shown in the script. Make sure that whatever directory you used to store your database backups with AutoMySQLBackup is included. If you want hidden directories excluded, be sure to include them. The following are my lists:</p>
<pre>INCLIST=(  "/www/" \
           "/etc/" \
           "/home/" \
           "/root/" \
           "/usr/local/bin/" \
           "/usr/local/backups/db/" \
        )

 EXCLIST=(   "/www/logs" \
            "/etc/selinux" \
            "/home/*/Download/" \
            "/root/*/Download/" \
            "/home/*/.*/" \
            "/root/.*/" \
            "/home/*/logs" \
            "/home/*/Maildir" "/home/*/mail" "/root/Maildir" "/root/mail" \
        )</pre>
<p>These settings work for me, but there&#8217;s no guarantee they will work for you. It&#8217;s your data, so you should completely understand what is and isn&#8217;t going to be backed up.</p>
<h2>Step 7: Do a Test Run</h2>
<p>To test things out, find the following line in the dt-s3-backup.sh script and uncomment it (remove the #):</p>
<pre>#ECHO=$(which echo)</pre>
<p>As explained in the comments, this will run the script in test mode, which will spits out the full Duplicity command and send it to the email address you set up in the Email Alert settings.</p>
<p>Save your edited version of the script and run it with:</p>
<pre>dt-s3-backup.sh --backup</pre>
<p>Because it&#8217;s in test mode, it should think for a bit and then email you some output, which includes the full command that will be passed to Duplicity. If everything looks good, comment the <strong>#ECHO</strong> line out again, and go for it:</p>
<pre>dt-s3-backup.sh --backup</pre>
<p>Depending on many factors (the amount of data you&#8217;re backing up, the speed of your system, the speed of your connection to Amazon S3, the phase of the moon), you&#8217;ll have to wait for a bit. My system takes about 5 minutes to run a full backup.</p>
<p>If something goes wrong, check all your edits, and check the links to the other blog posts I&#8217;ve included. I won&#8217;t be any help answering support questions in this thread, because I&#8217;m not the author of any of these applications. <img src='http://stevejenkins.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h2>Step 8: Check Your Files</h2>
<p>Assuming your backup worked, you can ask Duplicity to list all the files in your backup with:</p>
<pre>dt-s3-backup.sh --list-current-files | more</pre>
<p>Keep in mind that these will count as a requests against your Amazon S3 allowance. You get a bunch of free ones, but managing your Amazon bill is completely your responsibility.</p>
<p>Other options for <strong>dt-s3-backup.sh</strong> are available in its <strong>README</strong> file. I recommend experimenting with them until you&#8217;re familiar with the ones you&#8217;ll need.</p>
<h2>Step 9: Automate</h2>
<p>Once everything is working as you want it, don&#8217;t forget to create cron jobs for AutoMySQLBackup and dt-s3-backup.sh, I dump my databases nightly, and I do an incremental backup with dt-s3-backup weekly. Use whatever settings work best for you.</p>
<h2>Step 10: Provide Feedback</h2>
<p>I always welcome your feedback, especially if you have suggestions for making the process in this article easier to do or understand. If you have a different backup method that works for you, please feel free to share it. Because I&#8217;m not the author of any of these utilities, however, I can&#8217;t provide support in using them. Check the links I&#8217;ve provided for support, or contact the application authors directly if you&#8217;re having trouble.</p>
<p>Good luck moving your data from &#8220;waiting to be lost&#8221; to &#8220;backed up.&#8221; I know I sleep better knowing I&#8217;m better prepared to deal with disaster!</p>
<p>Related posts:<ol>
<li><a href='http://stevejenkins.com/blog/2011/02/how-to-set-up-ushare-media-server-on-fedora-centos-to-stream-video-and-pictures-to-xbox-360-or-ps3/' rel='bookmark' title='How to set up uShare media server on Fedora / CentOS to stream video and pictures to Xbox 360 or PS3'>How to set up uShare media server on Fedora / CentOS to stream video and pictures to Xbox 360 or PS3</a></li>
<li><a href='http://stevejenkins.com/blog/2011/08/installing-opendkim-rpm-via-yum-with-postfix-or-sendmail-for-rhel-centos-fedora/' rel='bookmark' title='Installing OpenDKIM RPM via Yum with Postfix or Sendmail (for RHEL / CentOS / Fedora)'>Installing OpenDKIM RPM via Yum with Postfix or Sendmail (for RHEL / CentOS / Fedora)</a></li>
<li><a href='http://stevejenkins.com/blog/2010/07/how-to-backup-your-navigation-dvd-cd/' rel='bookmark' title='How to Backup your Navigation DVD/CD'>How to Backup your Navigation DVD/CD</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://stevejenkins.com/blog/2011/11/how-to-back-up-a-linux-server-to-amazon-s3-with-duplicity-and-automysqlbackup/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How To Use a Free StartSSL Certificate in Postfix for SSL/TLS</title>
		<link>http://stevejenkins.com/blog/2011/09/how-to-use-a-free-startssl-certificate-in-postfix-for-ssltls/</link>
		<comments>http://stevejenkins.com/blog/2011/09/how-to-use-a-free-startssl-certificate-in-postfix-for-ssltls/#comments</comments>
		<pubDate>Sat, 24 Sep 2011 02:59:35 +0000</pubDate>
		<dc:creator>Steve Jenkins</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Reference]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[certificate]]></category>
		<category><![CDATA[csr]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[key]]></category>
		<category><![CDATA[Postfix]]></category>
		<category><![CDATA[self-signed]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[StartSSL]]></category>
		<category><![CDATA[TLS]]></category>

		<guid isPermaLink="false">http://stevejenkins.com/blog/?p=1712</guid>
		<description><![CDATA[Most of us use self-signed SSL certificates when setting up secure SMTP connections on our servers. And why not? It&#8217;s free! You do have to put up with your mail client &#8220;warning&#8221; you that the identity of the remote server can&#8217;t be verified, but that&#8217;s worth the minor inconvenience for the price. But&#8230; what if [...]
Related posts:<ol>
<li><a href='http://stevejenkins.com/blog/2011/06/fixing-postfix-certificate-verification-failed-for-gmail-untrusted-issuer-error-message/' rel='bookmark' title='Fixing Postfix &#8220;certificate verification failed for gmail untrusted issuer&#8221; Error Message'>Fixing Postfix &#8220;certificate verification failed for gmail untrusted issuer&#8221; Error Message</a></li>
<li><a href='http://stevejenkins.com/blog/2010/08/renewing-a-self-signed-ssl-certificate-on-fedoracentos/' rel='bookmark' title='Renewing a Self-Signed SSL Certificate on Fedora/CentOS'>Renewing a Self-Signed SSL Certificate on Fedora/CentOS</a></li>
<li><a href='http://stevejenkins.com/blog/2011/01/how-to-get-dkim-and-domainkeys-working-with-postfix-on-rhel-5-centos-5-using-opendkim-and-dk-milter/' rel='bookmark' title='How to get DKIM and DomainKeys working with Postfix on RHEL 5 / CentOS 5 using OpenDKIM and dk-milter'>How to get DKIM and DomainKeys working with Postfix on RHEL 5 / CentOS 5 using OpenDKIM and dk-milter</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Most of us use self-signed SSL certificates when setting up secure SMTP connections on our servers. And why not? It&#8217;s free! You do have to put up with your mail client &#8220;warning&#8221; you that the identity of the remote server can&#8217;t be verified, but that&#8217;s worth the minor inconvenience for the price. But&#8230; what if you could use an <em>actual</em> SSL certificate on your server, <em>and</em> get rid of those warnings, and still do it for <em>free</em>?</p>
<p>You can &#8211; thanks to <a target="_blank" href="https://www.startssl.com/" target="_blank">StartSSL</a> - the self-proclaimed &#8220;Swiss Army Knife of Digital Certificates &amp; PKI.&#8221;</p>
<p>While the interface may not be as slick as other SSL providers (like GoDaddy or Network Solutions), what StartSSL lacks in design they make up for in value. You can actually get a 128/256-bit Encrypted Class 1 SSL/TLS + S.MIME certificate <strong>for free</strong>. Seriously, no strings attached.</p>
<h2>Step 1: Sign up and Get Verified</h2>
<p>The first step is to sign up at <a target="_blank" href="http://startssl.com/" target="_blank">StartSSL</a> and verify your personal identity via email, and also verify that you have admin authority for the domain. I noticed that Chrome won&#8217;t work properly with their authentication procedure, so you&#8217;ll need to use IE, Firefox, or Safari. I won&#8217;t go through all the verification steps here. Just follow the instructions on their website to get verified, and get to the Control Panel. Or, try their Express Lane option to get verified and receive a certificate in one step.</p>
<p><strong>IMPORTANT</strong>: Make sure you choose the proper domain and subdomain name for your certificate when you come to that point. You can change your mind later, but you&#8217;ll have to pay $25 to do so. Just be sure you understand everything before you start clicking buttons&#8230;</p>
<p>Eventually, you&#8217;ll reach the Certificates Wizard. Select a <strong>Web Server SSL/TLS Certificate</strong>. Then press the <strong>Skip&gt;&gt;</strong> button, because you&#8217;ll want to create your own private key and certificate request on your server.</p>
<h2>Step 2: Create Your Key and CSR</h2>
<p>The next screen is where you submit your certificate request (<strong>CSR</strong>). But first, you&#8217;ll need to build your private key and the CSR itself. Make a directory to store all your SSL files with</p>
<pre>mkdir -p /etc/ssl
cd /etc/ssl</pre>
<p>Of course, you can choose any directory to store your SSL stuff, and you may already even have one. Use whatever directory you like. I personally like <strong>/etc/ssl</strong> because it&#8217;s easy to remember.</p>
<p>Inside your <strong>/etc/ssl</strong> directory, do:</p>
<pre>openssl req -new -newkey rsa:2048 -nodes -keyout hostname.domain.key -out hostname.domain.csr</pre>
<p>You can use any filename you want for the key and csr, but I like to include the subdomain and hostname of the mail server in mine, such as <strong>mail.example.key</strong> and <strong>mail.example.csr</strong>.</p>
<p>This command build both your private key and the CSR. Answer the questions (you don&#8217;t have to answer the optional ones), and be sure that when it requests the <strong>Common Name</strong>, use hostname and domain name of your server as you&#8217;ll be entering it in your email client (such as <strong>mail.example.com</strong>). If you make a mistake anywhere along the way, you can CTRL+C out of it, or just re-run the command to write a new key and CSR over the existing ones.</p>
<p>Once the command is finished, do an <strong>ls</strong> to see the two files you just created.</p>
<p>Your private key must be kept, well, <em>private</em>. So get into the habit of setting proper permissions for private keys right after you make them.</p>
<pre>chmod 0640 hostname.domain.key</pre>
<h2>Step 3: Give your CSR to StartSSL and receive your certificate</h2>
<p>Spit out the contents of your CSR with:</p>
<pre>cat hostname.domain.csr</pre>
<p>Then copy the entire contents of the file (including the:</p>
<pre>-----BEGIN CERTIFICATE REQUEST-----</pre>
<p>and</p>
<pre>-----END CERTIFICATE REQUEST-----</pre>
<p>lines, then paste it into the text area of the StartSSL CSR request page.</p>
<p>Hit the <strong>Continue&gt;&gt;</strong> button, and then select the specific subomain and domain you&#8217;ll use (such as mail.example.com or www.example.com) to access your server. For the free Class 1 certificate, you can include the domain and only <em>one</em> subdomain. This means the certificate will work for example.com and www.example.com, or example.com and mail.example.com.</p>
<p>If you want your certificate to work for <em>two</em> or more subdomains in addition to the primary domain, you&#8217;ll need to pay $59.99 to become Class 2 verified. But the good news is that you can then generate unlimited Class 2 certificates, which allow multiple and/or wildcard subdomains on your certificates. This is actually what I did, and it&#8217;s still a bargain.</p>
<p>After your request is processed,  the certificate back from StartSSL, copy the contents and paste them into a file in your <strong>/etc/ssl</strong> directory called <strong>hostname.domain.crt</strong> (using your hostname and domain name, of course).</p>
<p>At this point, it&#8217;s a good idea to download all three files (key, csr, and crt) and store them somewhere safe. I have a secure USB key that I keep for such a purpose. Your <strong>.key</strong> file is irreplaceable at this point. If you lose it or accidentally delete it, you&#8217;ll have to revoke your certificate, which will cost you $25.</p>
<h2>Step 4: Download the StartSSL Bundle</h2>
<p>Certificates are about trust, and so you&#8217;ll need to inform your server that you trust StartSSL. List of certificate authorities that your server can trust are stored in Certificate Bundles. Download StartSSL&#8217;s bundle with:</p>
<pre>wget --no-check-certificate https://www.startssl.com/certs/ca-bundle.pem -O startssl-ca-bundle.pem</pre>
<p>If you have a pre-existing certificate bundle file somewhere on your server (such as ca-bundle.crt or cacert.pem), you may want to copy it into your <strong>/etc/ssl</strong> directory:</p>
<pre>cp /etc/pki/tls/certs/ca-bundle.crt /etc/ssl</pre>
<p>Then you&#8217;ll need to combine the StartSSL ca-bundle with your existing bundle (this step just copies the StartSSL bundle to the new filename if you didn&#8217;t have an existing bundle):</p>
<pre>cat startssl-ca-bundle.pem &gt;&gt; ca-bundle.crt</pre>
<p>Now edit your Postfix <strong>main.cf</strong> file and put in the updated locations of your private key, certificate, and bundle:</p>
<pre>smtpd_tls_key_file = /etc/ssl/mail.scuderia.key
smtpd_tls_cert_file = /etc/ssl/mail.scuderia.crt
smtpd_tls_CAfile = /etc/ssl/ca-bundle.crt
smtp_tls_CAfile = $smtpd_tls_CAfile</pre>
<p>This article assumes that you&#8217;ve probably already got Postfix set up for SSL/TLS with a self-signed certificate, so all the <strong>main.cf</strong> settings in addition to the ones I&#8217;ve mentioned above for TLS should already be in place. This article won&#8217;t explain how to do that (but there are plenty of great articles out there to get that working). I will, however, show you what the SMTP TLS section of my <strong>main.cf</strong> file looks like, in case it&#8217;s any help:</p>
<pre>
# SMTP TLS
smtpd_tls_auth_only = no
smtp_use_tls = yes
smtpd_use_tls = yes
smtp_tls_note_starttls_offer = yes
smtpd_tls_key_file = /etc/ssl/mail.domain.key
smtpd_tls_cert_file = /etc/ssl/mail.domain.crt
smtpd_tls_CAfile = /etc/ssl/cacert.pem
smtp_tls_CAfile = $smtpd_tls_CAfile
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom
</pre>
<p>Once you&#8217;ve got your settings right, restart Postfix with:</p>
<pre>service postfix restart</pre>
<p>Now you&#8217;re connecting to your outgoing mail server with a third-party signed certificate!</p>
<p>Related posts:<ol>
<li><a href='http://stevejenkins.com/blog/2011/06/fixing-postfix-certificate-verification-failed-for-gmail-untrusted-issuer-error-message/' rel='bookmark' title='Fixing Postfix &#8220;certificate verification failed for gmail untrusted issuer&#8221; Error Message'>Fixing Postfix &#8220;certificate verification failed for gmail untrusted issuer&#8221; Error Message</a></li>
<li><a href='http://stevejenkins.com/blog/2010/08/renewing-a-self-signed-ssl-certificate-on-fedoracentos/' rel='bookmark' title='Renewing a Self-Signed SSL Certificate on Fedora/CentOS'>Renewing a Self-Signed SSL Certificate on Fedora/CentOS</a></li>
<li><a href='http://stevejenkins.com/blog/2011/01/how-to-get-dkim-and-domainkeys-working-with-postfix-on-rhel-5-centos-5-using-opendkim-and-dk-milter/' rel='bookmark' title='How to get DKIM and DomainKeys working with Postfix on RHEL 5 / CentOS 5 using OpenDKIM and dk-milter'>How to get DKIM and DomainKeys working with Postfix on RHEL 5 / CentOS 5 using OpenDKIM and dk-milter</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://stevejenkins.com/blog/2011/09/how-to-use-a-free-startssl-certificate-in-postfix-for-ssltls/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Git Commands I Like</title>
		<link>http://stevejenkins.com/blog/2011/09/git-commands-i-like/</link>
		<comments>http://stevejenkins.com/blog/2011/09/git-commands-i-like/#comments</comments>
		<pubDate>Wed, 21 Sep 2011 00:44:38 +0000</pubDate>
		<dc:creator>Steve Jenkins</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Reference]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[develop]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[git commands]]></category>
		<category><![CDATA[GitHub]]></category>
		<category><![CDATA[master]]></category>
		<category><![CDATA[merge]]></category>
		<category><![CDATA[push]]></category>

		<guid isPermaLink="false">http://stevejenkins.com/blog/?p=1699</guid>
		<description><![CDATA[This is going to be one of those posts that is probably useless to everyone else, but valuable enough to me that I&#8217;ll read it over and over. These are the Git commands I use most when working with projects on my GitHub, and with Git repos to which I have read-only access. (Big thanks to Murray K. [...]
Related posts:<ol>
<li><a href='http://stevejenkins.com/blog/2010/09/my-favorite-imagemagick-commands/' rel='bookmark' title='My Favorite ImageMagick Commands'>My Favorite ImageMagick Commands</a></li>
<li><a href='http://stevejenkins.com/blog/2010/10/no-controllers-found-fix-set-up-dell-omsa-6-3-32-bit-on-rhel-centos-5-5-64-bit/' rel='bookmark' title='&#8220;No controllers found&#8221; fix: set up Dell OMSA 6.3 32-bit on RHEL / CentOS 5.5 64-bit'>&#8220;No controllers found&#8221; fix: set up Dell OMSA 6.3 32-bit on RHEL / CentOS 5.5 64-bit</a></li>
<li><a href='http://stevejenkins.com/blog/2011/01/no-controllers-found-fix-set-up-dell-omsa-6-4-32-bit-on-rhel-centos-5-5-64-bit/' rel='bookmark' title='“No controllers found” fix: set up Dell OMSA 6.4 32-bit on RHEL / CentOS 5.5 64-bit'>“No controllers found” fix: set up Dell OMSA 6.4 32-bit on RHEL / CentOS 5.5 64-bit</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>This is going to be one of those posts that is probably useless to everyone else, but valuable enough to me that I&#8217;ll read it over and over. These are the Git commands I use most when working with projects on my <a target="_blank" href="https://github.com/stevejenkins" target="_blank">GitHub</a>, and with Git repos to which I have read-only access.</p>
<p>(Big thanks to Murray K. and Todd L. for hand-holding me through this <img src='http://stevejenkins.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  )</p>
<p>For my projects, I use a watered down version of the branching model presented in <a target="_blank" href="http://nvie.com/posts/a-successful-git-branching-model/" target="_blank">this article</a>, so that I always have two branches:</p>
<ul>
<li><strong>Master</strong>: which always represents a release version of a project</li>
<li><strong>Develop</strong>: which represents the progress I&#8217;m making toward the next release version</li>
</ul>
<p>Therefore, for reasons that <em>should</em> be obvious, I always request that collaborators make pull requests only on the <strong>Develop</strong> branch.</p>
<h2>Making changes to Develop</h2>
<p>To check out my Develop branch, I do:</p>
<pre>git checkout develop</pre>
<p>I make whatever changes I want, and then make sure the files I want to include in commits are added with:</p>
<pre>git add &lt;filename&gt;</pre>
<p>(I only need to do this once per file.)</p>
<p>When I&#8217;m ready to commit at least one changed file, I do:</p>
<pre>git commit -a</pre>
<p>and then add notes about the changes I made.</p>
<p>Then I do:</p>
<pre>git push</pre>
<p>to push my local version of the <strong>Develop</strong> repo to GitHub.</p>
<h2>Merging Develop into Master</h2>
<p>Technically, with the branching model I&#8217;m using, I should <em>never</em> commit changes directly to Master. All updates should be put into Develop, and then once Develop represents a version that I think is ready to be released, and all the changes I want are committed to Develop and pushed, I merge Develop into Master with:</p>
<pre>git checkout master
git merge develop
git push</pre>
<h2>Checkout Out Someone Else&#8217;s Repo and Submitting A Diff</h2>
<p>When checking out someone else&#8217;s repo and submitting a diff to them, I do the following:</p>
<p>Do a git checkout of their develop branch with (usually):</p>
<pre>git checkout develop
git pull</pre>
<p>Then I create my own temporary branch from that with:</p>
<pre>git checkout -b develop_branchname</pre>
<p>Next, I edit or copy my changes into the branch and commit them with:</p>
<pre>git commit -a</pre>
<p>If I don&#8217;t have write/push access to the repo, I need to create a patch to send to the author with:</p>
<pre>git format-patch develop..develop_branchname</pre>
<p>After sending the diff, I can delete my temporary branch with:</p>
<pre>git checkout develop
git branch -D develop_branchname</pre>
<h2>Further Reading</h2>
<ul>
<li><a target="_blank" href="http://help.github.com/git-cheat-sheets/" target="_blank">GitHub Cheat Sheet</a></li>
</ul>
<p>Related posts:<ol>
<li><a href='http://stevejenkins.com/blog/2010/09/my-favorite-imagemagick-commands/' rel='bookmark' title='My Favorite ImageMagick Commands'>My Favorite ImageMagick Commands</a></li>
<li><a href='http://stevejenkins.com/blog/2010/10/no-controllers-found-fix-set-up-dell-omsa-6-3-32-bit-on-rhel-centos-5-5-64-bit/' rel='bookmark' title='&#8220;No controllers found&#8221; fix: set up Dell OMSA 6.3 32-bit on RHEL / CentOS 5.5 64-bit'>&#8220;No controllers found&#8221; fix: set up Dell OMSA 6.3 32-bit on RHEL / CentOS 5.5 64-bit</a></li>
<li><a href='http://stevejenkins.com/blog/2011/01/no-controllers-found-fix-set-up-dell-omsa-6-4-32-bit-on-rhel-centos-5-5-64-bit/' rel='bookmark' title='“No controllers found” fix: set up Dell OMSA 6.4 32-bit on RHEL / CentOS 5.5 64-bit'>“No controllers found” fix: set up Dell OMSA 6.4 32-bit on RHEL / CentOS 5.5 64-bit</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://stevejenkins.com/blog/2011/09/git-commands-i-like/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple CloudFront Invalidation of a Single File via HTTP</title>
		<link>http://stevejenkins.com/blog/2011/09/simple-cloudfront-invalidation-of-a-single-file-via-http/</link>
		<comments>http://stevejenkins.com/blog/2011/09/simple-cloudfront-invalidation-of-a-single-file-via-http/#comments</comments>
		<pubDate>Wed, 07 Sep 2011 06:05:38 +0000</pubDate>
		<dc:creator>Steve Jenkins</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Reference]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Amazon]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[CloudFront]]></category>
		<category><![CDATA[distribution]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[invalidate]]></category>
		<category><![CDATA[invalidation]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[simple]]></category>
		<category><![CDATA[single file]]></category>
		<category><![CDATA[URL]]></category>

		<guid isPermaLink="false">http://stevejenkins.com/blog/?p=1642</guid>
		<description><![CDATA[I found a great post by Clay Loveless who wrote a PHP script to batch invalidate files files on an Amazon Web Services CloudFront distribution. You rock, Clay. Amazon doesn&#8217;t even let us do that (yet?) via the AWS Mangament Console. Until now, when I wanted to manually invalidate a single file, I had to [...]
Related posts:<ol>
<li><a href='http://stevejenkins.com/blog/2011/11/how-to-back-up-a-linux-server-to-amazon-s3-with-duplicity-and-automysqlbackup/' rel='bookmark' title='How to Back Up a Linux Server to Amazon S3 with Duplicity and AutoMySQLBackup'>How to Back Up a Linux Server to Amazon S3 with Duplicity and AutoMySQLBackup</a></li>
<li><a href='http://stevejenkins.com/blog/2010/08/renewing-a-self-signed-ssl-certificate-on-fedoracentos/' rel='bookmark' title='Renewing a Self-Signed SSL Certificate on Fedora/CentOS'>Renewing a Self-Signed SSL Certificate on Fedora/CentOS</a></li>
<li><a href='http://stevejenkins.com/blog/2011/08/how-to-install-apc-alternative-php-cache-on-centos-5-6/' rel='bookmark' title='How to Install APC (Alternative PHP Cache) on CentOS 5.6'>How to Install APC (Alternative PHP Cache) on CentOS 5.6</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><a target="_blank" href="http://stevejenkins.com/blog/wp-content/uploads/2011/09/cloudfrontlogo.jpg"><img class="alignleft size-full wp-image-1648" title="Amazon Web Services CloudFront" src="http://stevejenkins.com/blog/wp-content/uploads/2011/09/cloudfrontlogo.jpg" alt="Amazon Web Services CloudFront" width="200" height="156" /></a>I found a <a href="http://claylo.com/post/6217485965/aws-cloudfront-invalidation-quickie" target="_blank">great post by Clay Loveless</a> who wrote a PHP script to batch invalidate files files on an Amazon Web Services CloudFront distribution. You rock, Clay. Amazon doesn&#8217;t even let us do that (yet?) via the AWS Mangament Console.</p>
<p>Until now, when I wanted to manually invalidate a single file, I had to fire up <a target="_blank" href="http://www.cloudberrylab.com/" target="_blank">CloudBerry S3 Explorer</a> and scroll through thousands of files to get to the one I wanted to invalidate. For automated on-the-fly batch sync and CloudFront invalidation, I still rely on the excellent <a target="_blank" href="http://s3tools.org/s3cmd" target="_blank">s3cmd</a> command-line tool.</p>
<p>I&#8217;m not a developer, but I can lightly hack my way around PHP code &#8211; especially when it&#8217;s as clean as Clay&#8217;s.  I took his excellent script one small step farther to allow invalidating a single file via HTTP (using your browser) by including the to-be-invalidated filename in a URL, with the ability to optionally pass the CloudFront Distribution ID via a separate variable in the URL (handy for those of us managing multiple distributions). I <em>highly</em> recommend making sure you place this file in a password protected area of your website.</p>
<p>So here&#8217;s my modified version of Clay&#8217;s PHP script providing a simple way to invalidate a single file on CloudFront using your browser:</p>
<div id="gist-1199777" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="cp">&lt;?php</span></div><div class='line' id='LC2'><span class="sd">/**</span></div><div class='line' id='LC3'><span class="sd"> * Super-simple AWS CloudFront Invalidation Script</span></div><div class='line' id='LC4'><span class="sd"> * Modified by Steve Jenkins &lt;steve stevejenkins com&gt; to invalidate a single file via URL.</span></div><div class='line' id='LC5'><span class="sd"> * </span></div><div class='line' id='LC6'><span class="sd"> * Steps:</span></div><div class='line' id='LC7'><span class="sd"> * 1. Set your AWS Access Key</span></div><div class='line' id='LC8'><span class="sd"> * 2. Set your AWS Secret Key</span></div><div class='line' id='LC9'><span class="sd"> * 3. Set your CloudFront Distribution ID (or pass one via the URL with &amp;dist)</span></div><div class='line' id='LC10'><span class="sd"> * 4. Put cf-invalidate.php in a web accessible and password protected directory</span></div><div class='line' id='LC11'><span class="sd"> * 5. Run it via: http://example.com/protected_dir/cf-invalidate.php?filename=FILENAME</span></div><div class='line' id='LC12'><span class="sd"> *    or http://example.com/cf-invalidate.php?filename=FILENAME&amp;dist=DISTRIBUTION_ID</span></div><div class='line' id='LC13'><span class="sd"> * </span></div><div class='line' id='LC14'><span class="sd"> * The author disclaims copyright to this source code.</span></div><div class='line' id='LC15'><span class="sd"> *</span></div><div class='line' id='LC16'><span class="sd"> * Details on what&#39;s happening here are in the CloudFront docs:</span></div><div class='line' id='LC17'><span class="sd"> * http://docs.amazonwebservices.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html</span></div><div class='line' id='LC18'><span class="sd"> * </span></div><div class='line' id='LC19'><span class="sd"> */</span></div><div class='line' id='LC20'><br/></div><div class='line' id='LC21'><span class="nv">$onefile</span> <span class="o">=</span> <span class="nv">$_GET</span><span class="p">[</span><span class="s1">&#39;filename&#39;</span><span class="p">];</span> <span class="c1">// You must include ?filename=FILENAME in your URL or this won&#39;t work</span></div><div class='line' id='LC22'><br/></div><div class='line' id='LC23'><span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nb">isset</span><span class="p">(</span><span class="nv">$_GET</span><span class="p">[</span><span class="s1">&#39;dist&#39;</span><span class="p">]))</span> <span class="p">{</span></div><div class='line' id='LC24'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">$distribution</span> <span class="o">=</span> <span class="s1">&#39;DISTRIBUTION_ID&#39;</span><span class="p">;</span> <span class="c1">// Your CloudFront Distribution ID, or pass one via &amp;dist=</span></div><div class='line' id='LC25'><span class="p">}</span> <span class="k">else</span> <span class="p">{</span></div><div class='line' id='LC26'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">$distribution</span> <span class="o">=</span> <span class="nv">$_GET</span><span class="p">[</span><span class="s1">&#39;dist&#39;</span><span class="p">];</span></div><div class='line' id='LC27'><span class="p">}</span></div><div class='line' id='LC28'><br/></div><div class='line' id='LC29'><span class="nv">$access_key</span> <span class="o">=</span> <span class="s1">&#39;AWS_ACCESS_KEY&#39;</span><span class="p">;</span> <span class="c1">// Your AWS Access Key goes here</span></div><div class='line' id='LC30'><span class="nv">$secret_key</span> <span class="o">=</span> <span class="s1">&#39;AWS_SECRET_KEY&#39;</span><span class="p">;</span> <span class="c1">// Your AWS Secret Key goes here</span></div><div class='line' id='LC31'><span class="nv">$epoch</span> <span class="o">=</span> <span class="nb">date</span><span class="p">(</span><span class="s1">&#39;U&#39;</span><span class="p">);</span></div><div class='line' id='LC32'><br/></div><div class='line' id='LC33'><span class="nv">$xml</span> <span class="o">=</span> <span class="s">&lt;&lt;&lt;EOD</span></div><div class='line' id='LC34'><span class="s">&lt;InvalidationBatch&gt;</span></div><div class='line' id='LC35'><span class="s">    &lt;Path&gt;{$onefile}&lt;/Path&gt;</span></div><div class='line' id='LC36'><span class="s">    &lt;CallerReference&gt;{$distribution}{$epoch}&lt;/CallerReference&gt;</span></div><div class='line' id='LC37'><span class="s">&lt;/InvalidationBatch&gt;</span></div><div class='line' id='LC38'><span class="s">EOD;</span></div><div class='line' id='LC39'><br/></div><div class='line' id='LC40'><br/></div><div class='line' id='LC41'><span class="sd">/**</span></div><div class='line' id='LC42'><span class="sd"> * You probably don&#39;t need to change anything below here.</span></div><div class='line' id='LC43'><span class="sd"> */</span></div><div class='line' id='LC44'><span class="nv">$len</span> <span class="o">=</span> <span class="nb">strlen</span><span class="p">(</span><span class="nv">$xml</span><span class="p">);</span></div><div class='line' id='LC45'><span class="nv">$date</span> <span class="o">=</span> <span class="nb">gmdate</span><span class="p">(</span><span class="s1">&#39;D, d M Y G:i:s T&#39;</span><span class="p">);</span></div><div class='line' id='LC46'><span class="nv">$sig</span> <span class="o">=</span> <span class="nb">base64_encode</span><span class="p">(</span></div><div class='line' id='LC47'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nb">hash_hmac</span><span class="p">(</span><span class="s1">&#39;sha1&#39;</span><span class="p">,</span> <span class="nv">$date</span><span class="p">,</span> <span class="nv">$secret_key</span><span class="p">,</span> <span class="k">true</span><span class="p">)</span></div><div class='line' id='LC48'><span class="p">);</span></div><div class='line' id='LC49'><br/></div><div class='line' id='LC50'><span class="nv">$msg</span> <span class="o">=</span> <span class="s2">&quot;POST /2010-11-01/distribution/</span><span class="si">{</span><span class="nv">$distribution</span><span class="si">}</span><span class="s2">/invalidation HTTP/1.0</span><span class="se">\r\n</span><span class="s2">&quot;</span><span class="p">;</span></div><div class='line' id='LC51'><span class="nv">$msg</span> <span class="o">.=</span> <span class="s2">&quot;Host: cloudfront.amazonaws.com</span><span class="se">\r\n</span><span class="s2">&quot;</span><span class="p">;</span></div><div class='line' id='LC52'><span class="nv">$msg</span> <span class="o">.=</span> <span class="s2">&quot;Date: </span><span class="si">{</span><span class="nv">$date</span><span class="si">}</span><span class="se">\r\n</span><span class="s2">&quot;</span><span class="p">;</span></div><div class='line' id='LC53'><span class="nv">$msg</span> <span class="o">.=</span> <span class="s2">&quot;Content-Type: text/xml; charset=UTF-8</span><span class="se">\r\n</span><span class="s2">&quot;</span><span class="p">;</span></div><div class='line' id='LC54'><span class="nv">$msg</span> <span class="o">.=</span> <span class="s2">&quot;Authorization: AWS </span><span class="si">{</span><span class="nv">$access_key</span><span class="si">}</span><span class="s2">:</span><span class="si">{</span><span class="nv">$sig</span><span class="si">}</span><span class="se">\r\n</span><span class="s2">&quot;</span><span class="p">;</span></div><div class='line' id='LC55'><span class="nv">$msg</span> <span class="o">.=</span> <span class="s2">&quot;Content-Length: </span><span class="si">{</span><span class="nv">$len</span><span class="si">}</span><span class="se">\r\n\r\n</span><span class="s2">&quot;</span><span class="p">;</span></div><div class='line' id='LC56'><span class="nv">$msg</span> <span class="o">.=</span> <span class="nv">$xml</span><span class="p">;</span></div><div class='line' id='LC57'><br/></div><div class='line' id='LC58'><span class="nv">$fp</span> <span class="o">=</span> <span class="nb">fsockopen</span><span class="p">(</span><span class="s1">&#39;ssl://cloudfront.amazonaws.com&#39;</span><span class="p">,</span> <span class="mi">443</span><span class="p">,</span> </div><div class='line' id='LC59'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">$errno</span><span class="p">,</span> <span class="nv">$errstr</span><span class="p">,</span> <span class="mi">30</span></div><div class='line' id='LC60'><span class="p">);</span></div><div class='line' id='LC61'><span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nv">$fp</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC62'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">die</span><span class="p">(</span><span class="s2">&quot;Connection failed: </span><span class="si">{</span><span class="nv">$errno</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="nv">$errstr</span><span class="si">}</span><span class="se">\n</span><span class="s2">&quot;</span><span class="p">);</span></div><div class='line' id='LC63'><span class="p">}</span></div><div class='line' id='LC64'><span class="nb">fwrite</span><span class="p">(</span><span class="nv">$fp</span><span class="p">,</span> <span class="nv">$msg</span><span class="p">);</span></div><div class='line' id='LC65'><span class="nv">$resp</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span><span class="p">;</span></div><div class='line' id='LC66'><span class="k">while</span><span class="p">(</span><span class="o">!</span> <span class="nb">feof</span><span class="p">(</span><span class="nv">$fp</span><span class="p">))</span> <span class="p">{</span></div><div class='line' id='LC67'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">$resp</span> <span class="o">.=</span> <span class="nb">fgets</span><span class="p">(</span><span class="nv">$fp</span><span class="p">,</span> <span class="mi">1024</span><span class="p">);</span></div><div class='line' id='LC68'><span class="p">}</span></div><div class='line' id='LC69'><span class="nb">fclose</span><span class="p">(</span><span class="nv">$fp</span><span class="p">);</span></div><div class='line' id='LC70'><span class="k">print</span> <span class="s1">&#39;&lt;pre&gt;&#39;</span><span class="o">.</span><span class="nv">$resp</span><span class="o">.</span><span class="s1">&#39;&lt;/pre&gt;&#39;</span><span class="p">;</span> <span class="c1">// Make the output more readable in your browser</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1199777/7c9b9f1cf5d62f3dc0e3c21345a27e2615d68232/cf-invalidate.php" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1199777#file_cf_invalidate.php" style="float:right;margin-right:10px;color:#666">cf-invalidate.php</a>
            <a href="https://gist.github.com/1199777">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>Related posts:<ol>
<li><a href='http://stevejenkins.com/blog/2011/11/how-to-back-up-a-linux-server-to-amazon-s3-with-duplicity-and-automysqlbackup/' rel='bookmark' title='How to Back Up a Linux Server to Amazon S3 with Duplicity and AutoMySQLBackup'>How to Back Up a Linux Server to Amazon S3 with Duplicity and AutoMySQLBackup</a></li>
<li><a href='http://stevejenkins.com/blog/2010/08/renewing-a-self-signed-ssl-certificate-on-fedoracentos/' rel='bookmark' title='Renewing a Self-Signed SSL Certificate on Fedora/CentOS'>Renewing a Self-Signed SSL Certificate on Fedora/CentOS</a></li>
<li><a href='http://stevejenkins.com/blog/2011/08/how-to-install-apc-alternative-php-cache-on-centos-5-6/' rel='bookmark' title='How to Install APC (Alternative PHP Cache) on CentOS 5.6'>How to Install APC (Alternative PHP Cache) on CentOS 5.6</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://stevejenkins.com/blog/2011/09/simple-cloudfront-invalidation-of-a-single-file-via-http/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>SSH slow to connect? Turn UseDNS off</title>
		<link>http://stevejenkins.com/blog/2011/09/ssh-slow-to-connect-turn-usedns-off/</link>
		<comments>http://stevejenkins.com/blog/2011/09/ssh-slow-to-connect-turn-usedns-off/#comments</comments>
		<pubDate>Tue, 06 Sep 2011 18:16:27 +0000</pubDate>
		<dc:creator>Steve Jenkins</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Reference]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[IPv6]]></category>
		<category><![CDATA[Redhat]]></category>
		<category><![CDATA[slow connect]]></category>
		<category><![CDATA[slow SSH]]></category>
		<category><![CDATA[sshd_config]]></category>
		<category><![CDATA[UseDNS]]></category>

		<guid isPermaLink="false">http://stevejenkins.com/blog/?p=1639</guid>
		<description><![CDATA[Another quick tidbit I learned when one of my CentOS boxes was slow to connect via SSH. Connection happened quickly when I would connect from a box on the same router, but connecting from my home machine caused a delay of 20-30 seconds each time. The fix was uncommenting this line in /etc/ssh/sshd_config: #UseDNS yes [...]
Related posts:<ol>
<li><a href='http://stevejenkins.com/blog/2010/08/set-up-vnc-on-rhel-5-5-centos-5-5/' rel='bookmark' title='Set up VNC on RHEL 5.5 / CentOS 5.5'>Set up VNC on RHEL 5.5 / CentOS 5.5</a></li>
<li><a href='http://stevejenkins.com/blog/2011/08/installing-opendkim-rpm-via-yum-with-postfix-or-sendmail-for-rhel-centos-fedora/' rel='bookmark' title='Installing OpenDKIM RPM via Yum with Postfix or Sendmail (for RHEL / CentOS / Fedora)'>Installing OpenDKIM RPM via Yum with Postfix or Sendmail (for RHEL / CentOS / Fedora)</a></li>
<li><a href='http://stevejenkins.com/blog/2011/01/building-postfix-2-8-on-rhel5-centos-5-from-source/' rel='bookmark' title='Building Postfix 2.8 on RHEL5 / CentOS 5 from Source'>Building Postfix 2.8 on RHEL5 / CentOS 5 from Source</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Another quick tidbit I learned when one of my CentOS boxes was slow to connect via SSH. Connection happened quickly when I would connect from a box on the same router, but connecting from my home machine caused a delay of 20-30 seconds each time. The fix was uncommenting this line in <strong>/etc/ssh/sshd_config</strong>:</p>
<pre>#UseDNS yes</pre>
<p>and changing it to:</p>
<pre>UseDNS no</pre>
<p>I believe the delays were being caused by a combination of IPv6 and DNS, but regardless of the cause, that was the fix.</p>
<p>Related posts:<ol>
<li><a href='http://stevejenkins.com/blog/2010/08/set-up-vnc-on-rhel-5-5-centos-5-5/' rel='bookmark' title='Set up VNC on RHEL 5.5 / CentOS 5.5'>Set up VNC on RHEL 5.5 / CentOS 5.5</a></li>
<li><a href='http://stevejenkins.com/blog/2011/08/installing-opendkim-rpm-via-yum-with-postfix-or-sendmail-for-rhel-centos-fedora/' rel='bookmark' title='Installing OpenDKIM RPM via Yum with Postfix or Sendmail (for RHEL / CentOS / Fedora)'>Installing OpenDKIM RPM via Yum with Postfix or Sendmail (for RHEL / CentOS / Fedora)</a></li>
<li><a href='http://stevejenkins.com/blog/2011/01/building-postfix-2-8-on-rhel5-centos-5-from-source/' rel='bookmark' title='Building Postfix 2.8 on RHEL5 / CentOS 5 from Source'>Building Postfix 2.8 on RHEL5 / CentOS 5 from Source</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://stevejenkins.com/blog/2011/09/ssh-slow-to-connect-turn-usedns-off/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to set up two NICs on different subnets with static routes and separate default gateways that remain after a reboot</title>
		<link>http://stevejenkins.com/blog/2011/09/how-to-set-up-two-nics-on-different-subnets-with-static-routes-and-separate-default-gateways-that-remain-after-a-reboot/</link>
		<comments>http://stevejenkins.com/blog/2011/09/how-to-set-up-two-nics-on-different-subnets-with-static-routes-and-separate-default-gateways-that-remain-after-a-reboot/#comments</comments>
		<pubDate>Mon, 05 Sep 2011 03:50:01 +0000</pubDate>
		<dc:creator>Steve Jenkins</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Reference]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[default gateway]]></category>
		<category><![CDATA[default route]]></category>
		<category><![CDATA[dual NICs]]></category>
		<category><![CDATA[eth0]]></category>
		<category><![CDATA[eth1]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[ifcfg-eth0]]></category>
		<category><![CDATA[ip route add]]></category>
		<category><![CDATA[ip rule add]]></category>
		<category><![CDATA[NIC]]></category>
		<category><![CDATA[persist]]></category>
		<category><![CDATA[policy routing table]]></category>
		<category><![CDATA[reboot]]></category>
		<category><![CDATA[remain]]></category>
		<category><![CDATA[route-eth0]]></category>
		<category><![CDATA[rt_tables]]></category>
		<category><![CDATA[static route]]></category>
		<category><![CDATA[subnet]]></category>

		<guid isPermaLink="false">http://stevejenkins.com/blog/?p=1618</guid>
		<description><![CDATA[This is one of those blog posts that&#8217;s more written for my own benefit to refer to later than for the benefit of the Web-at-large, but if someone else happens to stumble upon it and it helps you out, then cool. I had to migrate a Fedora box (the one that hosts my blog, actually) [...]
Related posts:<ol>
<li><a href='http://stevejenkins.com/blog/2010/01/using-the-local-default-gateway-with-a-windows-vpn-connection/' rel='bookmark' title='Using the Local Default Gateway with a Windows VPN Connection'>Using the Local Default Gateway with a Windows VPN Connection</a></li>
<li><a href='http://stevejenkins.com/blog/2011/02/how-to-set-up-ushare-media-server-on-fedora-centos-to-stream-video-and-pictures-to-xbox-360-or-ps3/' rel='bookmark' title='How to set up uShare media server on Fedora / CentOS to stream video and pictures to Xbox 360 or PS3'>How to set up uShare media server on Fedora / CentOS to stream video and pictures to Xbox 360 or PS3</a></li>
<li><a href='http://stevejenkins.com/blog/2011/08/installing-opendkim-rpm-via-yum-with-postfix-or-sendmail-for-rhel-centos-fedora/' rel='bookmark' title='Installing OpenDKIM RPM via Yum with Postfix or Sendmail (for RHEL / CentOS / Fedora)'>Installing OpenDKIM RPM via Yum with Postfix or Sendmail (for RHEL / CentOS / Fedora)</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>This is one of those blog posts that&#8217;s more written for my own benefit to refer to later than for the benefit of the Web-at-large, but if someone else happens to stumble upon it and it helps you out, then cool. <img src='http://stevejenkins.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I had to migrate a Fedora box (the one that hosts my blog, actually) from an old IP to a new IP on a different subnet, and I didn&#8217;t want any downtime during the DNS move. Luckily, my Fedora box has multiple NICs, but when I was using just the old IP address, I was only using one NIC (which was eth0). I wanted to give eth0 the <em>new</em> IP address, so first I edited <strong>/etc/sysconfig/network-scripts/ifcfg-eth0</strong> to include to the new IP address &amp; default gateway, then I set up <strong>/etc/sysconfig/network-scripts/ifcfg-eth1</strong> to use to the <em>existing</em> IP address &amp; gateway.</p>
<p>On my CentOS 5 boxes (which were also migrating to the new subnet) setting up the second NIC and plugging it in was enough to make everything <em>Just Work</em>. CentOS 5 seemed to be able to manage routes in and out of both IPs just fine. However, my Fedora 12 box was a bit more picky &#8211; even after I did a <strong>chkconfig NetworkManager off</strong> to stop NM from continually messing with my settings! I still don&#8217;t know why it doesn&#8217;t <em>Just Work</em> on Fedora, so if someone has an explanation for the difference, I&#8217;d love to hear about it in the comments. Anyway, Fedora can only have one default gateway, and it seemed to choose the one that was listed in the eth1 config file (I&#8217;m guessing it&#8217;s because that adapter comes up last). This resulted in me being able to connect to my box on the old IP on eth1, but not on the new IP on eth0.</p>
<p>I eventually found a solution by combining two excellent blog posts (<a target="_blank" href="http://kindlund.wordpress.com/2007/11/19/configuring-multiple-default-routes-in-linux/" target="_blank">this one</a> and <a target="_blank" href="http://www.cyberciti.biz/tips/configuring-static-routes-in-debian-or-red-hat-linux-systems.html" target="_blank">this one</a>) as well as some trial and error in figuring out how to make the changes persist on a reboot. Of course, after the DNS migration is complete in a week or so, I&#8217;ll remove all this configuration because I&#8217;ll only have one IP and one gateway, which is why I wanted to write all this down in my blog just in case I ever need to do it again. <img src='http://stevejenkins.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>The first blog post explained how to set up a new policy routing table entry with:</p>
<pre># echo "1 new" &gt;&gt; /etc/iproute2/rt_tables</pre>
<p>I called my policy routing table &#8220;new&#8221; because it was going to be applied for the new IP. The post then explained how to manually create two new route entries using the <strong>ip route add</strong> command, and also explained how to create two new rules entries in my &#8220;new&#8221; policy routing table using <strong>ip rule add</strong>. The problem is, however, that when I ran <strong>service network restart</strong>, the name of my &#8220;new&#8221; policy routing table would remain in <strong>/etc/iproute2/rt_tables</strong> (good) and the IP rules would also remain (also good), but both of the IP route commands would be lost (bad). And when I rebooted the machine, the policy routing table name &#8220;new&#8221; survived in <strong>/etc/iproute2/rt_tables</strong> (good), but all of the actual rules and route settings were lost (bad), making the machine unreachable again on the new IP (extremely bad).</p>
<p>The second blog post also discussed using the <strong>ip route add</strong> commands, but (kinda) explained how to make those settings persist by creating a <strong>/etc/sysconfig/network-scripts/route-eth0</strong> file and placing my <strong>ip route add</strong> commands inside&#8230; minus the <strong>ip route add</strong> part. So my <strong>/etc/sysconfig/network-scripts/route-eth0</strong> looks like this:</p>
<pre>123.456.789.0/24 dev eth0 src 123.456.789.25 table new
default via 123.456.789.1 dev eth0 table new</pre>
<p>This assumes that 123.456.789.0/24 is the network range on the new subnet I&#8217;m creating the route for, 123.456.789.25 is the new IP address on eth0, and 123.456.789.1 is the default gateway on the new subnet. Now, when the machine is rebooted or I run <strong>service network restart</strong> the <strong>ip route add</strong> commands will be executed.</p>
<p>But that still left the problem of making the rules survive a reboot, and neither blog post had any suggestions. However, since the rules persist on a <strong>service network restart</strong>, so only needed to make sure they were executed once every time the system booted &#8211; and that&#8217;s <em>exactly</em> what <strong>/etc/rc.d/rc.local</strong> is for. So I added these lines to my <strong>/etc/rc.d/rc.local</strong>:</p>
<pre># Temporary routing rules while two public NICs are active
ip rule add from xxx.xxx.xxx.25/32 table new
ip rule add to xxx.xxx.xxx.25/32 table new
ip route flush cache</pre>
<p>If you want more details, the second blog post does a good job explaining these rules.</p>
<p>I tested everything with a reboot (both IPs on both NICs responded to pings) and then also ran another <strong>service network restart</strong> for good measure. Everything worked, so I could go ahead and begin the migration of the DNS.</p>
<p>As a somewhat related aside, Postfix&#8217;s <a target="_blank" href="http://www.postfix.org/postconf.5.html#smtp_bind_address" target="_blank">smtp_bind_address</a> command also came in really handy during this migration to force Postfix to send mail out the new IP while both NICs were active and I waited for the DNS to propagate. Again, that&#8217;s more for my future reference than anything, but it wasn&#8217;t worth dedicating a whole blog post to that idea, so I&#8217;ll slap it in here.</p>
<p>And that&#8217;s how you run two NICs on two different subnets with static routes and separate default gateways on Fedora!</p>
<p>Related posts:<ol>
<li><a href='http://stevejenkins.com/blog/2010/01/using-the-local-default-gateway-with-a-windows-vpn-connection/' rel='bookmark' title='Using the Local Default Gateway with a Windows VPN Connection'>Using the Local Default Gateway with a Windows VPN Connection</a></li>
<li><a href='http://stevejenkins.com/blog/2011/02/how-to-set-up-ushare-media-server-on-fedora-centos-to-stream-video-and-pictures-to-xbox-360-or-ps3/' rel='bookmark' title='How to set up uShare media server on Fedora / CentOS to stream video and pictures to Xbox 360 or PS3'>How to set up uShare media server on Fedora / CentOS to stream video and pictures to Xbox 360 or PS3</a></li>
<li><a href='http://stevejenkins.com/blog/2011/08/installing-opendkim-rpm-via-yum-with-postfix-or-sendmail-for-rhel-centos-fedora/' rel='bookmark' title='Installing OpenDKIM RPM via Yum with Postfix or Sendmail (for RHEL / CentOS / Fedora)'>Installing OpenDKIM RPM via Yum with Postfix or Sendmail (for RHEL / CentOS / Fedora)</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://stevejenkins.com/blog/2011/09/how-to-set-up-two-nics-on-different-subnets-with-static-routes-and-separate-default-gateways-that-remain-after-a-reboot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing OpenDKIM RPM via Yum with Postfix or Sendmail (for RHEL / CentOS / Fedora)</title>
		<link>http://stevejenkins.com/blog/2011/08/installing-opendkim-rpm-via-yum-with-postfix-or-sendmail-for-rhel-centos-fedora/</link>
		<comments>http://stevejenkins.com/blog/2011/08/installing-opendkim-rpm-via-yum-with-postfix-or-sendmail-for-rhel-centos-fedora/#comments</comments>
		<pubDate>Tue, 16 Aug 2011 00:53:34 +0000</pubDate>
		<dc:creator>Steve Jenkins</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Reference]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[DKIM]]></category>
		<category><![CDATA[dkim-filter]]></category>
		<category><![CDATA[dkim-milter]]></category>
		<category><![CDATA[dkim-proxy]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[OpenDKIM]]></category>
		<category><![CDATA[opendkim-genkey]]></category>
		<category><![CDATA[opendkim-milter]]></category>
		<category><![CDATA[opendkim.conf]]></category>
		<category><![CDATA[Postfix]]></category>
		<category><![CDATA[RHEL]]></category>
		<category><![CDATA[rpm]]></category>
		<category><![CDATA[sendmail]]></category>
		<category><![CDATA[yum]]></category>
		<category><![CDATA[yum opendkim]]></category>

		<guid isPermaLink="false">http://stevejenkins.com/blog/?p=1518</guid>
		<description><![CDATA[For those who want or need to compile and install OpenDKIM from the source code, you can follow the instructions I wrote in this article. If you&#8217;re looking for the fastest and easiest way to get OpenDKIM running on a RedHat system, I currently maintain the OpenDKIM package in the Fedora and EPEL repositories. This article [...]
Related posts:<ol>
<li><a href='http://stevejenkins.com/blog/2010/09/how-to-get-dkim-domainkeys-identified-mail-working-on-centos-5-5-and-postfix-using-opendkim/' rel='bookmark' title='How to get DKIM (DomainKeys Identified Mail) working with Postfix on RHEL 5 / CentOS 5 using OpenDKIM'>How to get DKIM (DomainKeys Identified Mail) working with Postfix on RHEL 5 / CentOS 5 using OpenDKIM</a></li>
<li><a href='http://stevejenkins.com/blog/2011/01/how-to-get-dkim-and-domainkeys-working-with-postfix-on-rhel-5-centos-5-using-opendkim-and-dk-milter/' rel='bookmark' title='How to get DKIM and DomainKeys working with Postfix on RHEL 5 / CentOS 5 using OpenDKIM and dk-milter'>How to get DKIM and DomainKeys working with Postfix on RHEL 5 / CentOS 5 using OpenDKIM and dk-milter</a></li>
<li><a href='http://stevejenkins.com/blog/2011/02/tips-for-installing-amavis-new-clamav-and-spamassassin-using-postfix-on-fedora-12/' rel='bookmark' title='Tips for installing Amavis-new, ClamAV, and SpamAssassin using Postfix on Fedora 12'>Tips for installing Amavis-new, ClamAV, and SpamAssassin using Postfix on Fedora 12</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>For those who want or need to compile and install <a target="_blank" href="http://www.opendkim.org" target="_blank">OpenDKIM</a> from the source code, you can follow the instructions I wrote in <a title="How to get DKIM (DomainKeys Identified Mail) working with Postfix on RHEL 5 / CentOS 5 using OpenDKIM" href="http://stevejenkins.com/blog/2010/09/how-to-get-dkim-domainkeys-identified-mail-working-on-centos-5-5-and-postfix-using-opendkim/" target="_blank">this article</a>.</p>
<p>If you&#8217;re looking for the fastest and easiest way to get OpenDKIM running on a RedHat system, I currently maintain the <a target="_blank" href="https://admin.fedoraproject.org/pkgdb/acls/name/opendkim" target="_blank">OpenDKIM package</a> in the Fedora and EPEL repositories. This article will help you install the RPMs and then configure OpenDKIM with Postfix or Sendmail.</p>
<p>For general information about DKIM, check out <a target="_blank" href="http://www.dkim.org/" target="_blank">http://www.dkim.org/</a>. For more information about the OpenDKIM project, check out <a target="_blank" href="http://www.opendkim.org/" target="_blank">http://www.opendkim.org/</a>.</p>
<h2>Before you start</h2>
<p>This tutorial assumes the following:</p>
<ul>
<li>You are running a &#8220;modern&#8221; RedHat-compatible Linux distro (RHEL 5/6, CentOS 5/6, Fedora, etc).</li>
<li>You are running a milter-aware MTA, such as Postfix 2.3.3 or newer (do <strong>postconf -d mail_version</strong> to check) or Sendmail.</li>
<li>Your Postfix or Sendmail configuration is <strong>currently working</strong> (this is very important &#8211; you don&#8217;t want to troubleshoot two programs at once).</li>
<li>If you&#8217;re using Postfix, Sendmail is turned off (do <strong>service sendmail status</strong> to verify).</li>
<li>If you&#8217;re using Sendmail, Postfix is turned off (do <strong>service postfix status</strong> to verify).</li>
<li>The necessary commands in this tutorial are done as <strong>root.</strong> If you don&#8217;t know what that means, then you probably shouldn&#8217;t be doing this. You may be able to get away with just using sudo, but I wanted to make sure I didn&#8217;t run into any path issues, so I do it as <strong>root</strong>.</li>
</ul>
<h2>Install OpenDKIM with Yum</h2>
<p>If you&#8217;re running Fedora 14 (or newer) or RHEL/CentOS 5 (or newer) then you can use Yum to quickly install OpenDKIM (<strong>RHEL/CentOS users must have the <a target="_blank" href="http://fedoraproject.org/wiki/EPEL" target="_blank">EPEL repositories</a> enabled</strong>). Just do:</p>
<pre>yum install opendkim</pre>
<p>This will download and install OpenDKIM with all the default configuration options included below.</p>
<p>For those who like getting their hands dirtier, you can manually download one of my RPMs or even build your own RPM from my Source RPM, which are all available through the <a target="_blank" href="http://koji.fedoraproject.org/koji/packageinfo?packageID=12494" target="_blank">Fedora BuildSystem</a>.</p>
<h2>Generate keys for signing</h2>
<p>Now you&#8217;re getting to the fun part. You need to generate a <strong>private </strong>and a <strong>public</strong> key for each of the domains for which you wish to sign mail. The <strong>private</strong> key is stored away from prying eyes on your server, while the <strong>public</strong> key gets published in your domain&#8217;s DNS records so that receiving mail servers can verify your DKIM-signed mail.</p>
<p>To make things easy, the first time you start opendkim after installing the RPM package, it will generate a default set of keys in <strong>/etc/opendkim/keys/</strong> using your server&#8217;s domain name and the selector name &#8220;default.&#8221; However, if you want to sign for any virtual hosts or choose a different selector name than then default, you can easily generate your own keys. It really only takes a few seconds. Or, if you&#8217;re happy with the default keys, you can move on to the next step.</p>
<p>If you&#8217;re <em>really</em> hard-core, you can always build the keys manually. Or, you can use the easy script included with OpenDKIM to do it for you. I&#8217;ve manually generated enough keys in my life, so I use the script. <img src='http://stevejenkins.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Before running this script, decide now what the name of your <strong>selector</strong> is going to be. A selector is a unique keyword that is associated with both keys (public and private), included in all the signatures, and published in your DNS records. For simplicity, I use the word <strong>default</strong> as my default selector. Not very creative, but it&#8217;s effective. Feel free to choose something different, but if you do, you&#8217;ll need to use it consistently throughout your setup. Also, while this <em>should</em> go without saying, you should use your mail domain instead of <strong>example.com</strong> throughout the following steps.</p>
<p>Create your keys with:</p>
<pre>mkdir /etc/opendkim/keys/example.com
/usr/bin/opendkim-genkey -D /etc/opendkim/keys/example.com/ -d example.com -s default
chown -R opendkim:opendkim /etc/opendkim/keys/example.com
mv /etc/opendkim/keys/example.com/default.private /etc/opendkim/keys/example.com/default
</pre>
<p>You can do a <strong>man opendkim-genkey</strong> if you&#8217;re interested in what additional options are available when creating your keys. In this example, I used the <strong>-D</strong> (directory) option, the <strong>-d</strong> (domain) option, and the <strong>-s</strong> (selector) options. That&#8217;s all you need to get this going.</p>
<h2>Edit the configuration files</h2>
<p>You&#8217;re getting really close now. You need to create and/or edit <strong>four</strong> files:</p>
<ol>
<li>/<strong>etc/opendkim.conf</strong> &#8211; OpenDKIM&#8217;s main configuration file</li>
<li><strong>/etc/opendkim/KeyTable</strong> &#8211; a list of keys available for signing</li>
<li><strong></strong><strong>/etc/opendkim/SigningTable </strong>- a list of domains and accounts allowed to sign</li>
<li><strong>/etc/opendkim/TrustedHosts</strong> &#8211; a list of servers to &#8220;trust&#8221; when signing or verifying</li>
</ol>
<p>On install, the RPM package should have created a simple <strong>/etc/opendkim.conf</strong> file on your system. By default, this file is set up for <em>verification</em> only. In order to sign outgoing mail, you&#8217;ll have to comment, uncomment, and configure some additional options in the configuration file. Use your favorite text editor to open <strong>/etc/opendkim.conf</strong> and make it look like this:</p>
<pre class="brush:shell">## CONFIGURATION OPTIONS

# Specifies the path to the process ID file.
PidFile /var/run/opendkim/opendkim.pid

# Selects operating modes. Valid modes are s (signer) and v (verifier). Default is v.
Mode    sv

# Log activity to the system log.
Syslog  yes

# Log additional entries indicating successful signing or verification of messages.
SyslogSuccess yes

# If logging is enabled, include detailed logging about why or why not a message was
# signed or verified. This causes a large increase in the amount of log data generated
# for each message, so it should be limited to debugging use only.
#LogWhy yes

# Attempt to become the specified user before starting operations.
UserID  opendkim:opendkim

# Create a socket through which your MTA can communicate.
Socket  inet:8891@localhost

# Required to use local socket with MTAs that access the socket as a non-
# privileged user (e.g. Postfix)
Umask   002

# This specifies a file in which to store DKIM transaction statistics.
#Statistics              /var/spool/opendkim/stats.dat

## SIGNING OPTIONS

# Selects the canonicalization method(s) to be used when signing messages.
Canonicalization        relaxed/simple

# Domain(s) whose mail should be signed by this filter. Mail from other domains will
# be verified rather than being signed. Uncomment and use your domain name.
# This parameter is not required if a SigningTable is in use.
Domain                  example.com

# Defines the name of the selector to be used when signing messages.
Selector                default

# Gives the location of a private key to be used for signing ALL messages.
#KeyFile                 /etc/opendkim/keys/default.private

# Gives the location of a file mapping key names to signing keys. In simple terms,
# this tells OpenDKIM where to find your keys. If present, overrides any KeyFile
# setting in the configuration file.
KeyTable                 refile:/etc/opendkim/KeyTable

# Defines a table used to select one or more signatures to apply to a message based
# on the address found in the From: header field. In simple terms, this tells
# OpenDKIM how to use your keys.
SigningTable                 refile:/etc/opendkim/SigningTable

# Identifies a set of "external" hosts that may send mail through the server as one
# of the signing domains without credentials as such.
ExternalIgnoreList      refile:/etc/opendkim/TrustedHosts

# Identifies a set internal hosts whose mail should be signed rather than verified.
InternalHosts           refile:/etc/opendkim/TrustedHosts</pre>
<p>You can do <strong>man opendkim.conf</strong> for more information on each of the options in this file.</p>
<p>Uncomment the <strong>Domain</strong> option (and include your actual domain name), the <strong>KeyTable</strong>, <strong>SigningTable</strong>, <strong>ExternalIgnoreList</strong>, and <strong>InternalHosts</strong> options. Also, since you&#8217;ll be using a <strong>KeyTable</strong>, you can comment the <strong>KeyFile</strong> option.</p>
<p>Next, you&#8217;ll need to create the three text files that you just uncommented in your config file. First, using your favorite text editor, create an <strong>/etc/opendkim/KeyTable</strong> file that looks like this:</p>
<pre class="brush:shell">default._domainkey.example.com example.com:default:/etc/opendkim/keys/example.com/default</pre>
<p>The <strong>KeyTable</strong> file tells OpenDKIM <em>where to find</em> your keys. Each entry in the <strong>KeyTable</strong> file is a <strong>single line</strong> for each key location (for example, all of the text in the above example should be on a single line in your file). If you&#8217;re going to use multiple keys (to sign mail for virtual domains with different keys, for example), you&#8217;ll need to create a separate line in the <strong>KeyTable</strong> file for each domain, like this:</p>
<pre class="brush:shell">default._domainkey.example.com example.com:default:/etc/opendkim/keys/example.com/default
default._domainkey.example2.com example2.com:default:/etc/opendkim/keys/example2.com/default</pre>
<p>Next, you need to create or edit the <strong>/etc/opendkim/SigningTable</strong> file. A default version of this file should have been installed in <strong>/etc/opendkim</strong> when you installed the RPM, so just uncomment the following line (or edit the file to include this line) so it reads:</p>
<pre class="brush:shell">*@example.com default._domainkey.example.com</pre>
<p>The <strong>SigningTable</strong> file tells OpenDKIM <em>how to use</em> your keys, as in which senders should use which selectors for their signatures. In the above example, I&#8217;m saying that everyone (*) sending mail from the server &#8220;example.com&#8221; should use the selector named &#8220;default.&#8221; Again, for multiple domains and/or users, you&#8217;ll need multiple lines, like this:</p>
<pre class="brush:shell">*@example.com default._domainkey.example.com
bob@example2.com default._domainkey.example2.com
doug@example2.com default._domainkey.example2.com</pre>
<p>In that example, everyone (*) sending mail from the server &#8220;example.com&#8221; can sign mail and should use the selector named &#8220;default.&#8221; But only Bob and Doug can sign mail for &#8220;example2.com&#8221; (also using a selector named default). It&#8217;s important to note that the * wildcard symbol will <em>only</em> work if the SigningTable option uses the <strong>refile:</strong> prefix before the filename (see the <a target="_blank" href="http://opendkim.org/opendkim.conf.5.html" target="_blank">opendkim.conf documentation</a> for more details).</p>
<p>Next, create an <strong>/etc/opendkim/TrustedHosts</strong> file that looks like this:</p>
<pre class="brush:shell">127.0.0.1
hostname1.example1.com
hostname2.example1.com
example1.com
hostname1.example2.com
hostname2.example2.com
example2.com</pre>
<p>The <strong>TrustedHosts</strong> file tells OpenDKIM <em>who to let use</em> your keys. Because it&#8217;s referenced by the <strong>ExternalIgnoreList</strong> directive in your conf file, OpenDKIM will ignore this list of hosts when verifying <em>incoming</em> mail. And, because it&#8217;s also referenced by the <strong>InternalHosts</strong> directive, this same list of hosts will be considered &#8220;internal,&#8221; and OpenDKIM will sign their <em>outgoing</em> mail.</p>
<p><strong>IMPORTANT:</strong> Make sure you list the IP address for localhost (<strong>127.0.0.1</strong>) in the <strong>TrustedHosts</strong> file or OpenDKIM won&#8217;t sign mail sent from this server. If you have multiple servers on the same network that relay mail through this server and you want to sign their mail as well, they <em>must</em> be listed in the <strong>TrustedHosts</strong> file. Put each entry on its own line. An entry can be a hostname, domain name (e.g. &#8220;example.com&#8221;), IP address, an IPv6 address (including an IPv4 mapped address), or a CIDR-style IP specification (e.g. &#8220;192.168.1.0/24&#8243;).</p>
<p>It should also go without saying (but I&#8217;ll say it anyway) that if you&#8217;re planning to sign outgoing mail for remote hosts, your mail server should have been previously configured to allow relaying for those hosts.</p>
<h2>Edit your MTA configuration</h2>
<p>Now you&#8217;re ready to tell your MTA about OpenDKIM.</p>
<h3>Postfix Users:</h3>
<p>Telling Postfix about OpenDKIM is easy. Just add the following lines to your Postfix <strong>main.cf</strong> file:</p>
<pre class="brush:shell">smtpd_milters           = inet:127.0.0.1:8891
non_smtpd_milters       = $smtpd_milters
milter_default_action   = accept</pre>
<p>If you&#8217;re running a version of Postfix prior to 2.6, you may need to add:</p>
<pre>milter_protocol   = 2</pre>
<p>See <a target="_blank" href="http://www.postfix.org/MILTER_README.html#version">http://www.postfix.org/MILTER_README.html#version</a> for more info.</p>
<p><strong>Don&#8217;t restart Postfix yet!</strong> You need to have OpenDKIM running first, or you&#8217;ll get errors in your maillog.</p>
<h3>Sendmail Users:</h3>
<p>Edit the <strong>.mc</strong> configuration file that was used to build your current <strong>sendmail.cf</strong> file. Add the following line:</p>
<pre class="brush:shell">INPUT_MAIL_FILTER(`opendkim', `S=inet:8891@localhost')</pre>
<p>Then build and install a new <strong>sendmail.cf</strong>. If you don&#8217;t know how to build and install a <strong>sendmail.cf</strong> file, a quick Web search should shove you in the right direction. Explaining how to do that is beyond the scope of these instructions. I will, however, remind you that backing up your current sendmail.cf file is a good idea before you attempt any modifications.</p>
<h2>Start OpenDKIM and restart your MTA</h2>
<p>It&#8217;s time to fire things up! Assuming you&#8217;re using bash, do:</p>
<pre>hash -r</pre>
<p>to rehash your shell so you can find the init script.</p>
<p>Now start OpenDKIM with:</p>
<pre>service opendkim start</pre>
<p>You <em>should</em> get a message that says:</p>
<pre>Starting OpenDKIM Milter:     [  <span style="color: #00ff00;">OK</span>  ]</pre>
<p>However, if you get an error message such as:</p>
<pre>Starting OpenDKIM Milter: opendkim: /etc/opendkim.conf: configuration error at line 6: unrecognized parameter</pre>
<p>don&#8217;t freak out. You probably just mistyped something in one of the config files. Go to the line number of the file listed, and check your work against the example(s) in this article. Then try starting up OpenDKIM again.</p>
<p>Once it starts, Postfix users should refresh Postfix with:</p>
<pre>postfix reload</pre>
<p>and Sendmail users should do:</p>
<pre>service sendmail restart</pre>
<p>If everything looks good, I recommend running <strong>chkconfig</strong> on OpenDKIM to make sure it starts when you boot your server:</p>
<pre>chkconfig opendkim on</pre>
<p>If things didn&#8217;t go right, try some of these startup troubleshooting tips before moving on.</p>
<h2>Startup troubleshooting tips</h2>
<p><strong>Tip 1:</strong> The best advice I can give when troubleshooting any mail issues (including OpenDKIM) is to start a second shell session in another window and do:</p>
<pre>tail -f /var/log/maillog</pre>
<p>while you&#8217;re starting, stopping, and/or restarting OpenDKIM and your MTA. This allows you to see more details about any errors in your configuration.</p>
<p><strong>Tip 2:</strong> To get the most verbose information from OpenDKIM, make sure the <strong>LogWhy</strong> option in your <strong>/etc/opendkim.conf</strong> file is uncommented and set to <strong>Yes</strong>. If your outgoing mail isn&#8217;t getting signed and you want to know why, this should tell you.</p>
<p><strong>Tip 3:</strong> If you can&#8217;t get things working on your own, I recommend subscribing to the <strong>OpenDKIM-Users</strong> discussion list at <a target="_blank" href="http://lists.opendkim.org/">http://lists.opendkim.org/</a>. It&#8217;s a low-traffic list with very helpful and friendly members (including me!) who are happy to nudge you in the right direction.</p>
<p><span class="Apple-style-span" style="color: #000000; font-size: 22px; line-height: 32px;">Adding DNS Records</span></p>
<p>Now that your mail server is signing outgoing mail and verifying incoming mail, you&#8217;ll need to put some information in your DNS records to tell other mail servers how your keys are set up, and provide the public key for them to check that your mail is properly signed. Do:</p>
<pre>cat /etc/opendkim/keys/example.com/default.txt</pre>
<p>The output should look something like this:</p>
<pre>default._domainkey IN TXT "v=DKIM1; g=*; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDHY7Zl+n3SUldTYRUEU1BErHkKN0Ya52gazp1R7FA7vN5RddPxW/sO9JVRLiWg6iAE4hxBp42YKfxOwEnxPADbBuiELKZ2ddxo2aDFAb9U/lp47k45u5i2T1AlEBeurUbdKh7Nypq4lLMXC2FHhezK33BuYR+3L7jxVj7FATylhwIDAQAB" ; ----- DKIM default for example.com</pre>
<p>If you manage your own DNS or have full access to your domain&#8217;s zone file, you&#8217;ll need to paste the entire contents of the <strong>default.txt</strong> file at the bottom of your domain&#8217;s zone file. If you&#8217;re using a web interface to manage your zone file, be careful that the long lines of the public key don&#8217;t wrap and create line-feed characters (or fix them if they do). Otherwise, your public key won&#8217;t work.</p>
<p>If you&#8217;re using<strong> </strong>GoDaddy&#8217;s Total DNS, the TXT Name would  <strong>default._domainkey</strong> and the TXT Value would be <strong>everything inside the quotes</strong> (starting with v=). You can ignore the semi-colon and comments at the end.</p>
<p>If you&#8217;re using some other third-party DNS provider, follow their instructions for adding a new <strong>TXT Record.</strong></p>
<p>You should also add another TXT Record to your zone file that reads:</p>
<pre>_adsp._domainkey.example.com    IN    TXT    "dkim=unknown"</pre>
<p>This record publishes your <a target="_blank" href="http://en.wikipedia.org/wiki/Author_Domain_Signing_Practices" target="_blank">Author Domain Signing Practices</a>. &#8220;Unknown&#8221; is the least strict setting, and the best place to start. You can learn more and tinker with other options later, but most people just use &#8220;Unknown&#8221; for now, since ADSP is relatively new (as of the writing of this post).</p>
<p>And, as long as you&#8217;re messing with your domain&#8217;s zone file, now might be a good time to ensure that you already have a valid <a target="_blank" href="http://www.openspf.org/" target="_blank">SPF Record</a> in place. Having both DKIM and SPF in place will increase your chances of having your outgoing mail successfully delivered.</p>
<h2>Testing Things Out</h2>
<p>As I mentioned in my troubleshooting tips, the best way to see that everything is working on the server side is to keep an eye on your <strong>/var/log/maillog file.</strong> Do a:</p>
<pre>tail -f /var/log/maillog</pre>
<p>When OpenDKIM starts (or restarts), you should see lines like:</p>
<pre>opendkim[4397]: OpenDKIM Filter: mi_stop=1
opendkim[4397]: OpenDKIM Filter v2.4.2 terminating with status 0, errno = 0
opendkim[27444]: OpenDKIM Filter v2.4.2 starting (args: -x /etc/opendkim.conf)</pre>
<p>When you send a mail that gets successfully signed, you should see:</p>
<pre>opendkim[22254]: 53D0314803B: DKIM-Signature header added</pre>
<p>The best way to check that your signed mail is being authenticated and that your DNS records are properly set up is to use one of the free testing services. My favorites are:</p>
<ul>
<li>Brandon Checketts <a target="_blank" href="http://www.brandonchecketts.com/emailtest.php" target="_blank">Email Validator</a></li>
<li>Send a signed email to: <a target="_blank" href="mailto:autorespond+dkim@dk.elandsys.com">autorespond+dkim@dk.elandsys.com</a></li>
<li>Send a signed email to: <a target="_blank" href="mailto:sa-test@sendmail.net">sa-test@sendmail.net</a></li>
<li>Send a signed email to: <a target="_blank" href="mailto:check-auth@verifier.port25.com">check-auth@verifier.port25.com</a></li>
<li>(you can put all of the test email addresses in the <strong>To:</strong> field of a single outgoing message to test)</li>
</ul>
<p>Each of these will tell you if things are working properly, and give you some pointers on troubleshooting if needed.</p>
<p>If you have a <a target="_blank" href="http://gmail.com/" target="_blank">Gmail</a> account, you can also send a signed message there for a quick and easy test. address Here&#8217;s what a signed message in Gmail will look like:</p>
<div id="attachment_1658" class="wp-caption aligncenter" style="width: 1004px"><a href="http://stevejenkins.com/blog/wp-content/uploads/2011/08/DKIM-Test.jpg"><img class="size-full wp-image-1658" title="DKIM Test Message" src="http://stevejenkins.com/blog/wp-content/uploads/2011/08/DKIM-Test.jpg" alt="DKIM Test Message" width="994" height="357" /></a><p class="wp-caption-text">Look, Ma! My emails have DKIM Signatures!</p></div>
<p>The <strong>signed by:</strong> line tells you that the message has been verified as signed by the sender (you may need to press the <strong>show details</strong> link near the top of the message to see it). I like to click the <strong>Show Original</strong> link (under the Reply drop-down on the right) to see the signed headers in all their glory. <img src='http://stevejenkins.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h2>Further reading</h2>
<ul>
<li><a target="_blank" href="http://www.dkim.org/" target="_blank">DKIM.org</a> &#8211; the official site for DomainKeys Identified Mail</li>
<li><a target="_blank" href="http://www.opendkim.org/" target="_blank">OpenDKIM Project Site</a> &#8211; the program I used to get DKIM working</li>
<li><a target="_blank" href="http://www.elandsys.com/resources/sendmail/dkim.html" target="_blank">Sendmail DKIM</a> &#8211; a detailed article from Eland Systems about DKIM. They use the dkim-milter package, upon which OpenDKIM is based. I much prefer the newer OpenDKIM, but this article explains DKIM very well and has some good tips.</li>
<li><a target="_blank" href="http://dkimproxy.sourceforge.net/" target="_blank">Mail-DKIM and DKIM-proxy</a> &#8211; my first experiments with DKIM were with these tools. I never got it working quite right, but there&#8217;s lots of good info there.</li>
<li><a target="_blank" href="http://www.openspf.org/" target="_blank">OpenSPF.org</a> &#8211; not technically related to DKIM, but it&#8217;s another spam-fighting technique that you should be using if you&#8217;re sending email</li>
<li><a target="_blank" href="https://github.com/stevejenkins/OpenDKIM-Fedora" target="_blank">My OpenDKIM GitHub repo</a> &#8211; if you&#8217;d like to mess with the SPEC file or patches that I use to create the OpenDKIM package in the Fedora &amp; EPEL repos, knock yourself out! Please fork the &#8220;develop&#8221; branch and submit your pull requests there, as the &#8220;master&#8221; is intended only for release versions.</li>
</ul>
<p>Good luck! Pease post in the comments with your successes, questions, or suggestions.</p>
<p>Related posts:<ol>
<li><a href='http://stevejenkins.com/blog/2010/09/how-to-get-dkim-domainkeys-identified-mail-working-on-centos-5-5-and-postfix-using-opendkim/' rel='bookmark' title='How to get DKIM (DomainKeys Identified Mail) working with Postfix on RHEL 5 / CentOS 5 using OpenDKIM'>How to get DKIM (DomainKeys Identified Mail) working with Postfix on RHEL 5 / CentOS 5 using OpenDKIM</a></li>
<li><a href='http://stevejenkins.com/blog/2011/01/how-to-get-dkim-and-domainkeys-working-with-postfix-on-rhel-5-centos-5-using-opendkim-and-dk-milter/' rel='bookmark' title='How to get DKIM and DomainKeys working with Postfix on RHEL 5 / CentOS 5 using OpenDKIM and dk-milter'>How to get DKIM and DomainKeys working with Postfix on RHEL 5 / CentOS 5 using OpenDKIM and dk-milter</a></li>
<li><a href='http://stevejenkins.com/blog/2011/02/tips-for-installing-amavis-new-clamav-and-spamassassin-using-postfix-on-fedora-12/' rel='bookmark' title='Tips for installing Amavis-new, ClamAV, and SpamAssassin using Postfix on Fedora 12'>Tips for installing Amavis-new, ClamAV, and SpamAssassin using Postfix on Fedora 12</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://stevejenkins.com/blog/2011/08/installing-opendkim-rpm-via-yum-with-postfix-or-sendmail-for-rhel-centos-fedora/feed/</wfw:commentRss>
		<slash:comments>36</slash:comments>
		</item>
		<item>
		<title>How to Install APC (Alternative PHP Cache) on CentOS 5.6</title>
		<link>http://stevejenkins.com/blog/2011/08/how-to-install-apc-alternative-php-cache-on-centos-5-6/</link>
		<comments>http://stevejenkins.com/blog/2011/08/how-to-install-apc-alternative-php-cache-on-centos-5-6/#comments</comments>
		<pubDate>Tue, 02 Aug 2011 03:18:12 +0000</pubDate>
		<dc:creator>Steve Jenkins</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Reference]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[APC]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[CentOS 5]]></category>
		<category><![CDATA[CentOS 5.6]]></category>
		<category><![CDATA[CentOS 5.x]]></category>
		<category><![CDATA[install APC]]></category>
		<category><![CDATA[opcode]]></category>
		<category><![CDATA[optimizer]]></category>
		<category><![CDATA[php cache]]></category>

		<guid isPermaLink="false">http://stevejenkins.com/blog/?p=1461</guid>
		<description><![CDATA[There&#8217;s a lot of conflicting information out there on how to install the APC opcode cache on a CentOS 5.6 box. Here&#8217;s how I did it: This tutorial assumes you&#8217;re running CentOS 5.6 on a dedicated server, and that you have superuser (root) access. These instructions may also worked in a VPS or shared hosting [...]
Related posts:<ol>
<li><a href='http://stevejenkins.com/blog/2010/10/how-to-install-dell-omsa-5-5-on-a-dell-poweredge-2650-with-centos-5-rhel-5/' rel='bookmark' title='How to Install Dell OMSA 5.5 on a Dell PowerEdge 2650 with CentOS 5 / RHEL 5'>How to Install Dell OMSA 5.5 on a Dell PowerEdge 2650 with CentOS 5 / RHEL 5</a></li>
<li><a href='http://stevejenkins.com/blog/2010/11/how-to-install-denyhosts-to-block-ssh-attacks-on-rhel-6-centos-5-5-fedora-14/' rel='bookmark' title='How to Install DenyHosts to Block SSH Attacks on RHEL 6 / CentOS 5.5 / Fedora 14'>How to Install DenyHosts to Block SSH Attacks on RHEL 6 / CentOS 5.5 / Fedora 14</a></li>
<li><a href='http://stevejenkins.com/blog/2009/11/dkim-proxy-install-on-centos-5-4/' rel='bookmark' title='DKIM Proxy Install on CentOS 5.4'>DKIM Proxy Install on CentOS 5.4</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a lot of conflicting information out there on how to install the APC opcode cache on a CentOS 5.6 box. Here&#8217;s how I did it:<span id="more-1461"></span></p>
<p>This tutorial assumes you&#8217;re running CentOS 5.6 on a dedicated server, and that you have superuser (root) access. These instructions may also worked in a VPS or shared hosting environment, but if you run into trouble, you should contact your provider&#8217;s tech support to see if they have any alternative steps you should take.</p>
<p>First, you need to make sure the following packages are installed:</p>
<pre>yum install php-devel pcre-devel</pre>
<p>Because you&#8217;re going to be compiling a package, you&#8217;ll need a C compiler (like <strong>gcc</strong>) and <strong>make</strong>. The easiest way to install all the right development tools is with:</p>
<pre>yum groupinstall "Development Tools"</pre>
<p>Be sure to include those quotes.</p>
<p>Now you&#8217;re ready to download and untar the package:</p>
<pre>cd /usr/local/src
wget http://pecl.php.net/get/APC-3.1.9.tgz
tar -zxvf APC-3.1.9.tgz</pre>
<p>Now it&#8217;s time to set it up!</p>
<pre>cd APC-3.1.9
phpize
whereis php-config</pre>
<p>Take note of where <strong>php-config</strong> is located (it&#8217;s usually in <strong>/usr/bin/php-config</strong>) as you&#8217;ll need it in the next step. If it&#8217;s in a different location, use that for the php-config path below:</p>
<pre>./configure --enable-apc --enable-apc-mmap --with-apxs --with-php-config=/usr/bin/php-config
make
make install</pre>
<p>Next, if you have an <strong>/etc/php.d/</strong> directory on your server, create a file called <strong>/etc/php.d/apc.ini</strong> to store all your configuration settings (if it already exists, you can just edit the existing one). If you don&#8217;t have an <strong>/etc/php.d/</strong> directory, you can add these configuration settings to your existing <strong>php.ini</strong> file, which is usually located at <strong>/etc/php.ini</strong>.</p>
<p>Here&#8217;s an example of my <strong>apc.ini</strong> file, with lots of comments for some guidance. This is a pretty straightforward configuration, so feel free to copy and paste:</p>
<pre>; Enable the extension module
extension = apc.so

; Options for the APC module version &gt;= 3.1.3
; See http://www.php.net/manual/en/apc.configuration.php

; This can be set to 0 to disable APC.
apc.enabled=1
; The number of shared memory segments to allocate for the compiler cache.
apc.shm_segments=1
; The size of each shared memory segment, with M/G suffixe
apc.shm_size=64M
; A "hint" about the number of distinct source files that will be included or
; requested on your web server. Set to zero or omit if you're not sure;
apc.num_files_hint=1024
; Just like num_files_hint, a "hint" about the number of distinct user cache
; variables to store.  Set to zero or omit if you're not sure;
apc.user_entries_hint=4096
; The number of seconds a cache entry is allowed to idle in a slot in case this
; cache entry slot is needed by another entry.
apc.ttl=7200
; use the SAPI request start time for TTL
apc.use_request_time=1
; The number of seconds a user cache entry is allowed to idle in a slot in case
; this cache entry slot is needed by another entry.
apc.user_ttl=7200
; The number of seconds that a cache entry may remain on the garbage-collection list.
apc.gc_ttl=3600
; On by default, but can be set to off and used in conjunction with positive
; apc.filters so that files are only cached if matched by a positive filter.
apc.cache_by_default=1
; A comma-separated list of POSIX extended regular expressions.
apc.filters
; The mktemp-style file_mask to pass to the mmap module
apc.mmap_file_mask=/tmp/apc.XXXXXX
; This file_update_protection setting puts a delay on caching brand new files.
apc.file_update_protection=2
; Setting this enables APC for the CLI version of PHP (Mostly for testing and debugging).
apc.enable_cli=0
; Prevents large files from being cached
apc.max_file_size=1M
; Whether to stat the main script file and the fullpath includes.
apc.stat=1
; Vertification with ctime will avoid problems caused by programs such as svn or rsync by making
; sure inodes havn't changed since the last stat. APC will normally only check mtime.
apc.stat_ctime=0
; Whether to canonicalize paths in stat=0 mode or fall back to stat behaviour
apc.canonicalize=0
; With write_lock enabled, only one process at a time will try to compile an
; uncached script while the other processes will run uncached
apc.write_lock=1
; Logs any scripts that were automatically excluded from being cached due to early/late binding issues.
apc.report_autofilter=0
;This setting is deprecated, and replaced with apc.write_lock, so let's set it to zero.
apc.slam_defense=0</pre>
<p>The final step is to restart Apache with either:</p>
<pre>service httpd restart</pre>
<p>or</p>
<pre>apachectl restart</pre>
<p>To make sure APC is running, create a php file somewhere in your web root that simply contains:</p>
<pre>&lt;? phpinfo (); ?&gt;</pre>
<p>then load the file and scroll down to the APC section to verify that it&#8217;s enabled.</p>
<p>For some cool statistics, copy the <strong>usr/local/src/APC-3.1.9/apc.php</strong> file somewhere in your web root, and then open it in your browser. Edit the file on the server if you&#8217;d like to add a password and enable login to see more details. Here&#8217;s a peek at what it looks like:</p>
<p><a href="http://stevejenkins.com/blog/wp-content/uploads/2011/08/apc1.jpg"><img class="aligncenter size-full wp-image-1463" title="APC Cache Info" src="http://stevejenkins.com/blog/wp-content/uploads/2011/08/apc1.jpg" alt="APC Info Page" width="797" height="772" /></a></p>
<p>Congratulations! You&#8217;ve just installed APC on CentOS 5.6!</p>
<h2>Further Reading</h2>
<ul>
<li><a target="_blank" href="http://chrisgilligan.com/wordpress/how-to-configure-apc-cache-on-virtual-servers-with-php-running-under-fcgid/" target="_blank">How to Configure APC Cache on Virtual Servers with PHP running under FCGId</a> - Running APC in a shared hosting environment takes a little more tinkering.</li>
<li><a target="_blank" href="http://php.net/manual/en/" target="_blank">Alternative PHP Cache (APC) Manual</a></li>
<li><a target="_blank" href="http://pecl.php.net/package/APC" target="_blank">PECL APC package download page</a></li>
</ul>
<p>Related posts:<ol>
<li><a href='http://stevejenkins.com/blog/2010/10/how-to-install-dell-omsa-5-5-on-a-dell-poweredge-2650-with-centos-5-rhel-5/' rel='bookmark' title='How to Install Dell OMSA 5.5 on a Dell PowerEdge 2650 with CentOS 5 / RHEL 5'>How to Install Dell OMSA 5.5 on a Dell PowerEdge 2650 with CentOS 5 / RHEL 5</a></li>
<li><a href='http://stevejenkins.com/blog/2010/11/how-to-install-denyhosts-to-block-ssh-attacks-on-rhel-6-centos-5-5-fedora-14/' rel='bookmark' title='How to Install DenyHosts to Block SSH Attacks on RHEL 6 / CentOS 5.5 / Fedora 14'>How to Install DenyHosts to Block SSH Attacks on RHEL 6 / CentOS 5.5 / Fedora 14</a></li>
<li><a href='http://stevejenkins.com/blog/2009/11/dkim-proxy-install-on-centos-5-4/' rel='bookmark' title='DKIM Proxy Install on CentOS 5.4'>DKIM Proxy Install on CentOS 5.4</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://stevejenkins.com/blog/2011/08/how-to-install-apc-alternative-php-cache-on-centos-5-6/feed/</wfw:commentRss>
		<slash:comments>32</slash:comments>
		</item>
		<item>
		<title>Bricked WRT54G with Blinking Power Light. Hard reset? TFTP? Nope &#8211; New Power Adapter.</title>
		<link>http://stevejenkins.com/blog/2011/07/bricked-wrt54g-with-blinking-power-light-hard-reset-tftp-nope-new-power-adapter/</link>
		<comments>http://stevejenkins.com/blog/2011/07/bricked-wrt54g-with-blinking-power-light-hard-reset-tftp-nope-new-power-adapter/#comments</comments>
		<pubDate>Wed, 20 Jul 2011 15:58:08 +0000</pubDate>
		<dc:creator>Steve Jenkins</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Reference]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[blinking power light]]></category>
		<category><![CDATA[bricked]]></category>
		<category><![CDATA[bricked router]]></category>
		<category><![CDATA[DD-WRT]]></category>
		<category><![CDATA[Linksys]]></category>
		<category><![CDATA[router]]></category>
		<category><![CDATA[Tomato]]></category>
		<category><![CDATA[WRT54G]]></category>

		<guid isPermaLink="false">http://stevejenkins.com/blog/?p=1427</guid>
		<description><![CDATA[Like many owners of the ubiquitous Linksys WRT54G wireless router, I like to run aftermarket firmware on my device to unlock more of this router&#8217;s potential. I use one as my primary wireless router in my house, but I also use some as wireless Ethernet client bridges and wireless repeaters. So when I saw a [...]
Related posts:<ol>
<li><a href='http://stevejenkins.com/blog/2010/11/set-up-qos-in-tomato-or-dd-wrt-for-att-3g-microcell/' rel='bookmark' title='Set Up QoS in Tomato or DD-WRT for AT&amp;T 3G MicroCell'>Set Up QoS in Tomato or DD-WRT for AT&#038;T 3G MicroCell</a></li>
<li><a href='http://stevejenkins.com/blog/2010/09/reset-a-drac-iii-using-racadm-on-a-dell-2650-running-rhel-5-5-centos-5-5/' rel='bookmark' title='Reset a DRAC III using racadm on a Dell 2650 running RHEL 5.5 / CentOS 5.5'>Reset a DRAC III using racadm on a Dell 2650 running RHEL 5.5 / CentOS 5.5</a></li>
<li><a href='http://stevejenkins.com/blog/2010/10/how-to-configure-or-reset-a-drac-ii-easily-with-a-dos-boot-disk/' rel='bookmark' title='How to Configure or Reset a DRAC II Easily with a DOS Boot Disk'>How to Configure or Reset a DRAC II Easily with a DOS Boot Disk</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><a href="http://stevejenkins.com/blog/wp-content/uploads/2011/07/wrt54g.png"><img class="size-full wp-image-1428 alignleft" title="WRT54G" src="http://stevejenkins.com/blog/wp-content/uploads/2011/07/wrt54g.png" alt="WRT54G" width="309" height="282" /></a>Like many owners of the ubiquitous Linksys WRT54G wireless router, I like to run aftermarket firmware on my device to unlock more of this router&#8217;s potential. I use one as my primary wireless router in my house, but I also use some as wireless Ethernet client bridges and wireless repeaters. So when I saw a WRT54G v3 for sale near me for $40 on Craiglist, I couldn&#8217;t pass up the opportunity to grab another one. I offered $30 and the seller accepted.</p>
<p>When I picked up the unit, the first thing I noticed was that the previous owner had upgraded the antenna to the +7db versions. Score! My $30 outlay was looking like a better deal by the minute. I also noticed that the power supply was not Linksys branded, and the output rating on the adapter was 9V 300mA. Once I got home, I plugged it in to test, and the unit lit up. But then the power light started flashing&#8230; and then kept flashing. I pulled the plug, did a hard reset, and tried again. Suck! Was this thing bricked already?</p>
<p>I tried all the standard tricks to unbrick this router, including everything on <a target="_blank" title="Recover from a bad flash" href="http://www.dd-wrt.com/wiki/index.php/Recover_from_a_Bad_Flash" target="_blank">Recover from a Bad Flash</a> on the DD-WRT website and the article I&#8217;d used successfully in the past: <a target="_blank" href="http://www.wi-fiplanet.com/tutorials/article.php/3618616/Bricked-Or-How-to-Resurrect-a-Dead-Linksys-WRT54G.htm" target="_blank">Bricked! Or, How to Resurrect a Dead Linksys WRT54G</a> on WiFi Planet.</p>
<p>I was able to get my router to ping, using a combination of a 30/30/30 reset. I was also able to get a TFTP upload to complete successfully, using the original <a target="_blank" href="http://linksys.com/" target="_blank">Linksys</a> firmware, but I still couldn&#8217;t get the unit to boot or display the GUI. I also used TFTP to upload <a target="_blank" href="http://www.dd-wrt.com/" target="_blank">DD-WRT</a> mini and <a target="_blank" href="http://www.polarcloud.com/tomato/" target="_blank">Tomato</a>, but still had the same results. I hate to admit that I even tried jumping pins 15 and 16. But even that didn&#8217;t work.</p>
<p>I was about to toss the unit in the trash (keeping the upgraded antenna, of course), but then remembered that the power supply wasn&#8217;t stock. There&#8217;s some discussion as to what the correct power settings are for these units, as they were designed to accept a range of adapters. I&#8217;ve heard anywhere from 5V to 12V will work. So I figured since I was going to toss the router anyway, messing with the power couldn&#8217;t do much damage. So I hit <a target="_blank" href="http://radioshack.com/" target="_blank">The Shack</a> and purchased an adjustable wall wart that was capable of anywhere from 3-12V and 1000mA (otherwise known as 1 amp). I brought it home, plugged it in, and&#8230;</p>
<p>Everything worked. I had spent hours on resets, ping attempts, firmware upload attempts, taking it apart and putting it back together, all in vain. Power was the culprit. The unit must have been getting enough juice to turn on, and even ping, but eventually it would reset, flash all the lights, and attempt to boot up again &#8211; over, and over, and over. Giving it 12V and allowing it to draw up to 1 amp was the key. I uploaded the latest Tomato firmware, and now the unit runs like a champ!</p>
<p>So if your router is WRT54G is acting bricked, but nothing else seems to be working, maybe you should try the easy solution first: just swap out the power supply!</p>
<p>Related posts:<ol>
<li><a href='http://stevejenkins.com/blog/2010/11/set-up-qos-in-tomato-or-dd-wrt-for-att-3g-microcell/' rel='bookmark' title='Set Up QoS in Tomato or DD-WRT for AT&amp;T 3G MicroCell'>Set Up QoS in Tomato or DD-WRT for AT&#038;T 3G MicroCell</a></li>
<li><a href='http://stevejenkins.com/blog/2010/09/reset-a-drac-iii-using-racadm-on-a-dell-2650-running-rhel-5-5-centos-5-5/' rel='bookmark' title='Reset a DRAC III using racadm on a Dell 2650 running RHEL 5.5 / CentOS 5.5'>Reset a DRAC III using racadm on a Dell 2650 running RHEL 5.5 / CentOS 5.5</a></li>
<li><a href='http://stevejenkins.com/blog/2010/10/how-to-configure-or-reset-a-drac-ii-easily-with-a-dos-boot-disk/' rel='bookmark' title='How to Configure or Reset a DRAC II Easily with a DOS Boot Disk'>How to Configure or Reset a DRAC II Easily with a DOS Boot Disk</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://stevejenkins.com/blog/2011/07/bricked-wrt54g-with-blinking-power-light-hard-reset-tftp-nope-new-power-adapter/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fixing Postfix &#8220;certificate verification failed for gmail untrusted issuer&#8221; Error Message</title>
		<link>http://stevejenkins.com/blog/2011/06/fixing-postfix-certificate-verification-failed-for-gmail-untrusted-issuer-error-message/</link>
		<comments>http://stevejenkins.com/blog/2011/06/fixing-postfix-certificate-verification-failed-for-gmail-untrusted-issuer-error-message/#comments</comments>
		<pubDate>Tue, 07 Jun 2011 16:07:21 +0000</pubDate>
		<dc:creator>Steve Jenkins</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Reference]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[certificate]]></category>
		<category><![CDATA[certificate verification failed]]></category>
		<category><![CDATA[Equifax]]></category>
		<category><![CDATA[gmail untrusted issuer]]></category>
		<category><![CDATA[OpenSSL]]></category>
		<category><![CDATA[Postfix]]></category>
		<category><![CDATA[SSL Certificate]]></category>
		<category><![CDATA[Thawte]]></category>

		<guid isPermaLink="false">http://stevejenkins.com/blog/?p=1376</guid>
		<description><![CDATA[A while back, I noticed a recurring error in my maillog that read: postfix/smtp: certificate verification failed for gmail-smtp-in.l.google.com[74.125.53.27]:25: untrusted issuer /C=US/O=Equifax/OU=Equifax Secure Certificate Authority If you&#8217;re seeing this too, there&#8217;s an easy fix. The problem stems from the fact that Google changed certificate providers from Thawte to Equifax, and your mail system doesn&#8217;t recognize [...]
Related posts:<ol>
<li><a href='http://stevejenkins.com/blog/2011/09/how-to-use-a-free-startssl-certificate-in-postfix-for-ssltls/' rel='bookmark' title='How To Use a Free StartSSL Certificate in Postfix for SSL/TLS'>How To Use a Free StartSSL Certificate in Postfix for SSL/TLS</a></li>
<li><a href='http://stevejenkins.com/blog/2010/08/renewing-a-self-signed-ssl-certificate-on-fedoracentos/' rel='bookmark' title='Renewing a Self-Signed SSL Certificate on Fedora/CentOS'>Renewing a Self-Signed SSL Certificate on Fedora/CentOS</a></li>
<li><a href='http://stevejenkins.com/blog/2011/03/how-to-use-address-tagging-usertagexample-com-with-postfix/' rel='bookmark' title='How to use Address Tagging (user+tag@example.com) with Postfix'>How to use Address Tagging (user+tag@example.com) with Postfix</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>A while back, I noticed a recurring error in my maillog that read:</p>
<p><strong>postfix/smtp: certificate verification failed for gmail-smtp-in.l.google.com[74.125.53.27]:25: untrusted issuer /C=US/O=Equifax/OU=Equifax Secure Certificate Authority</strong></p>
<p>If you&#8217;re seeing this too, there&#8217;s an easy fix.<span id="more-1376"></span></p>
<p>The problem stems from the fact that Google changed certificate providers from Thawte to Equifax, and your mail system doesn&#8217;t recognize the Equifax certificate authority as valid. The solution is to add a copy of the Equifax certificate to Postfix&#8217;s local root certificate store. And while we&#8217;re at it, we may as well add Thawte&#8217;s as well.</p>
<h2>Step 1: Back up your original root certificate store</h2>
<p>Before messing with any of the settings, do the following to backup your original root certificate:</p>
<pre># cd /etc/postfix/ssl
# cp cacert.pem cacert.pem.bak</pre>
<h2>Step 2: Create local copies of Equifax and Thawte certificates</h2>
<p>Using your favorite text editor, create a file called <strong>Equifax_Secure_CA.pem</strong> in the <strong>/etc/postfix/ssl</strong> directory. Paste the following into the file:</p>
<pre>-----BEGIN CERTIFICATE-----
MIIDIDCCAomgAwIBAgIENd70zzANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJVUzEQMA4GA1UE
ChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5
MB4XDTk4MDgyMjE2NDE1MVoXDTE4MDgyMjE2NDE1MVowTjELMAkGA1UEBhMCVVMxEDAOBgNVBAoT
B0VxdWlmYXgxLTArBgNVBAsTJEVxdWlmYXggU2VjdXJlIENlcnRpZmljYXRlIEF1dGhvcml0eTCB
nzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAwV2xWGcIYu6gmi0fCG2RFGiYCh7+2gRvE4RiIcPR
fM6fBeC4AfBONOziipUEZKzxa1NfBbPLZ4C/QgKO/t0BCezhABRP/PvwDN1Dulsr4R+AcJkVV5MW
8Q+XarfCaCMczE1ZMKxRHjuvK9buY0V7xdlfUNLjUA86iOe/FP3gx7kCAwEAAaOCAQkwggEFMHAG
A1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEQMA4GA1UEChMHRXF1aWZheDEtMCsGA1UE
CxMkRXF1aWZheCBTZWN1cmUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMBoG
A1UdEAQTMBGBDzIwMTgwODIyMTY0MTUxWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUSOZo+SvS
spXXR9gjIBBPM5iQn9QwHQYDVR0OBBYEFEjmaPkr0rKV10fYIyAQTzOYkJ/UMAwGA1UdEwQFMAMB
Af8wGgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUAA4GBAFjOKer89961
zgK5F7WF0bnj4JXMJTENAKaSbn+2kmOeUJXRmm/kEd5jhW6Y7qj/WsjTVbJmcVfewCHrPSqnI0kB
BIZCe/zuf6IWUrVnZ9NA2zsmWLIodz2uFHdh1voqZiegDfqnc1zqcPGUIWVEX/r87yloqaKHee95
70+sB3c4
-----END CERTIFICATE-----</pre>
<p>Next, create a file called <strong>Thawte_Premium_Server_CA.pem</strong> in the <strong>/etc/postfix/ssl</strong> directory and paste the following into that file:</p>
<pre>-----BEGIN CERTIFICATE-----
MIIDJzCCApCgAwIBAgIBATANBgkqhkiG9w0BAQQFADCBzjELMAkGA1UEBhMCWkExFTATBgNVBAgT
DFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYDVQQKExRUaGF3dGUgQ29uc3Vs
dGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjEhMB8GA1UE
AxMYVGhhd3RlIFByZW1pdW0gU2VydmVyIENBMSgwJgYJKoZIhvcNAQkBFhlwcmVtaXVtLXNlcnZl
ckB0aGF3dGUuY29tMB4XDTk2MDgwMTAwMDAwMFoXDTIwMTIzMTIzNTk1OVowgc4xCzAJBgNVBAYT
AlpBMRUwEwYDVQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEdMBsGA1UEChMU
VGhhd3RlIENvbnN1bHRpbmcgY2MxKDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2VydmljZXMgRGl2
aXNpb24xITAfBgNVBAMTGFRoYXd0ZSBQcmVtaXVtIFNlcnZlciBDQTEoMCYGCSqGSIb3DQEJARYZ
cHJlbWl1bS1zZXJ2ZXJAdGhhd3RlLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA0jY2
aovXwlue2oFBYo847kkEVdbQ7xwblRZH7xhINTpS9CtqBo87L+pW46+GjZ4X9560ZXUCTe/LCaIh
Udib0GfQug2SBhRz1JPLlyoAnFxODLz6FVL88kRu2hFKbgifLy3j+ao6hnO2RlNYyIkFvYMRuHM/
qgeN9EJN50CdHDcCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQQFAAOBgQAm
SCwWwlj66BZ0DKqqX1Q/8tfJeGBeXm43YyJ3Nn6yF8Q0ufUIhfzJATj/Tb7yFkJD57taRvvBxhEf
8UqwKEbJw8RCfbz6q1lu1bdRiBHjpIUZa4JMpAwSremkrj/xw0llmozFyD4lt5SZu5IycQfwhl7t
UCemDaYj+bvLpgcUQg==
-----END CERTIFICATE-----</pre>
<h2>Step 3: Add the Equifax and Thawte certificates into your local root certificate file</h2>
<p>Add the two new certificates into your local root certificate file with:</p>
<pre>cat /etc/postfix/ssl/Equifax_Secure_CA.pem &gt;&gt; /etc/postfix/ssl/cacert.pem
echo >> /etc/postfix/ssl/cacert.pem
cat /etc/postfix/ssl/Thawte_Premium_Server_CA.pem &gt;&gt; /etc/postfix/ssl/cacert.pem</pre>
<p>(the second command above adds a line break between the two certs in your local root cert file)</p>
<h2>Step 4: Restart Postfix</h2>
<p>Restart Postfix with:</p>
<pre># service postfix restart</pre>
<p>Send a message through your SMTP server to a Gmail test address and you should no longer see those errors in your maillog!</p>
<p>Related posts:<ol>
<li><a href='http://stevejenkins.com/blog/2011/09/how-to-use-a-free-startssl-certificate-in-postfix-for-ssltls/' rel='bookmark' title='How To Use a Free StartSSL Certificate in Postfix for SSL/TLS'>How To Use a Free StartSSL Certificate in Postfix for SSL/TLS</a></li>
<li><a href='http://stevejenkins.com/blog/2010/08/renewing-a-self-signed-ssl-certificate-on-fedoracentos/' rel='bookmark' title='Renewing a Self-Signed SSL Certificate on Fedora/CentOS'>Renewing a Self-Signed SSL Certificate on Fedora/CentOS</a></li>
<li><a href='http://stevejenkins.com/blog/2011/03/how-to-use-address-tagging-usertagexample-com-with-postfix/' rel='bookmark' title='How to use Address Tagging (user+tag@example.com) with Postfix'>How to use Address Tagging (user+tag@example.com) with Postfix</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://stevejenkins.com/blog/2011/06/fixing-postfix-certificate-verification-failed-for-gmail-untrusted-issuer-error-message/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using apc
Page Caching using apc
Database Caching 3/121 queries in 0.061 seconds using apc
Object Caching 3309/3502 objects using apc

Served from: stevejenkins.com @ 2012-02-04 23:58:52 -->
