<?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>blather.michaelwlucas.com</title>
	<atom:link href="http://blather.michaelwlucas.com/feed" rel="self" type="application/rss+xml" />
	<link>http://blather.michaelwlucas.com</link>
	<description>Get off the internet. Go do something in meatspace. Seriously.</description>
	<lastBuildDate>Tue, 21 May 2013 18:47:36 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>FreeBSD-update vs bind99-base</title>
		<link>http://blather.michaelwlucas.com/archives/1728</link>
		<comments>http://blather.michaelwlucas.com/archives/1728#comments</comments>
		<pubDate>Tue, 21 May 2013 18:47:36 +0000</pubDate>
		<dc:creator>Michael W Lucas</dc:creator>
				<category><![CDATA[bsd]]></category>
		<category><![CDATA[Tech]]></category>

		<guid isPermaLink="false">http://blather.michaelwlucas.com/?p=1728</guid>
		<description><![CDATA[<p>My master nameserver runs BIND 9.9, so I can do DNSSEC easily. I&#8217;ve installed from ports, but used the REPLACE_BASE option so that it overwrites the BIND 9.8.3 install included in the base system. That way I don&#8217;t have to worry about having multiple versions of the same command on different systems.</p> <p>I patch this <span style="color:#777"> . . . &#8594; Read More: <a href="http://blather.michaelwlucas.com/archives/1728">FreeBSD-update vs bind99-base</a></span>]]></description>
				<content:encoded><![CDATA[<p>My master nameserver runs BIND 9.9, so I can do DNSSEC easily. I&#8217;ve installed from ports, but used the REPLACE_BASE option so that it overwrites the BIND 9.8.3 install included in the base system. That way I don&#8217;t have to worry about having multiple versions of the same command on different systems.</p>
<p>I patch this system via freebsd-update. After applying the latest security patches, I got the following email:</p>
<p><code>The following files will be updated as part of updating to 9.1-RELEASE-p3:<br />
/usr/bin/dig<br />
/usr/bin/host<br />
/usr/bin/nslookup<br />
/usr/bin/nsupdate<br />
/usr/sbin/ddns-confgen<br />
/usr/sbin/dnssec-dsfromkey<br />
/usr/sbin/dnssec-keyfromlabel<br />
/usr/sbin/dnssec-keygen<br />
/usr/sbin/dnssec-revoke<br />
/usr/sbin/dnssec-settime<br />
/usr/sbin/dnssec-signzone<br />
/usr/sbin/lwresd<br />
/usr/sbin/named<br />
/usr/sbin/named-checkconf<br />
/usr/sbin/named-checkzone<br />
/usr/sbin/named-compilezone<br />
/usr/sbin/named-journalprint<br />
/usr/sbin/rndc-confgen</code></p>
<p>I don&#8217;t want freebsd-update to patch these files. I also don&#8217;t want to get an email every day telling me that I need to patch them. I know I <em>don&#8217;t</em> need to patch them.</p>
<p>The solution? Tell freebsd-update to ignore these files with the IgnorePaths directive in /etc/freebsd-update.conf. I copied the list of files from the email and added IgnorePaths before them.</p>
<p><code>...<br />
IgnorePaths /usr/bin/dig<br />
IgnorePaths /usr/bin/host<br />
IgnorePaths /usr/bin/nslookup<br />
IgnorePaths /usr/bin/nsupdate<br />
IgnorePaths /usr/sbin/ddns-confgen<br />
IgnorePaths /usr/sbin/dnssec-dsfromkey<br />
IgnorePaths /usr/sbin/dnssec-keyfromlabel<br />
IgnorePaths /usr/sbin/dnssec-keygen<br />
IgnorePaths /usr/sbin/dnssec-revoke<br />
IgnorePaths /usr/sbin/dnssec-settime<br />
IgnorePaths /usr/sbin/dnssec-signzone<br />
IgnorePaths /usr/sbin/lwresd<br />
IgnorePaths /usr/sbin/named<br />
IgnorePaths /usr/sbin/named-checkconf<br />
IgnorePaths /usr/sbin/named-checkzone<br />
IgnorePaths /usr/sbin/named-compilezone<br />
IgnorePaths /usr/sbin/named-journalprint<br />
IgnorePaths /usr/sbin/rndc-confgen<br />
...</code></p>
<p>The complication here is that I must watch out for BIND security advisories, rather than just trusting in the update process. But that&#8217;s normal.</p>
]]></content:encoded>
			<wfw:commentRss>http://blather.michaelwlucas.com/archives/1728/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DNSSEC Mastery #1 best-seller&#8230;</title>
		<link>http://blather.michaelwlucas.com/archives/1730</link>
		<comments>http://blather.michaelwlucas.com/archives/1730#comments</comments>
		<pubDate>Mon, 20 May 2013 15:44:20 +0000</pubDate>
		<dc:creator>Michael W Lucas</dc:creator>
				<category><![CDATA[Nonfiction Books]]></category>

		<guid isPermaLink="false">http://blather.michaelwlucas.com/?p=1730</guid>
		<description><![CDATA[<p>&#8230;in its extremely narrow category. The Kindle edition is #1 and the paperback is #3.</p> <p></p> <p>Admittedly, DNS books are not a big category. I&#8217;m not up against Stephen King here. But it&#8217;s my category, and I&#8217;ll take it. I cut my teeth on DNS and BIND Beating it out just seems somehow immoral. But <span style="color:#777"> . . . &#8594; Read More: <a href="http://blather.michaelwlucas.com/archives/1730">DNSSEC Mastery #1 best-seller&#8230;</a></span>]]></description>
				<content:encoded><![CDATA[<p>&#8230;in its extremely narrow category. The Kindle edition is #1 and the paperback is #3.</p>
<p><a href="http://blather.michaelwlucas.com/wp-content/uploads/2013/05/dnssecbestseller.png"><img src="http://blather.michaelwlucas.com/wp-content/uploads/2013/05/dnssecbestseller-300x122.png" alt="DNS Amazon ratings" width="300" height="122" class="alignleft size-medium wp-image-1731" /></a></p>
<p>Admittedly, DNS books are not a big category. I&#8217;m not up against Stephen King here. But it&#8217;s my category, and I&#8217;ll take it. I cut my teeth on <a href="http://www.amazon.com/gp/product/B0026OR2QS/ref=as_li_ss_tl?ie=UTF8&#038;camp=1789&#038;creative=390957&#038;creativeASIN=B0026OR2QS&#038;linkCode=as2&#038;tag=michaelwlucas-20">DNS and BIND</a> Beating it out just seems somehow immoral. But I&#8217;ll live with it.</p>
<p>This is only a best-seller because people bought it. Thanks, everyone.</p>
]]></content:encoded>
			<wfw:commentRss>http://blather.michaelwlucas.com/archives/1730/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The next FreeBSD book?</title>
		<link>http://blather.michaelwlucas.com/archives/1720</link>
		<comments>http://blather.michaelwlucas.com/archives/1720#comments</comments>
		<pubDate>Thu, 16 May 2013 15:36:23 +0000</pubDate>
		<dc:creator>Michael W Lucas</dc:creator>
				<category><![CDATA[bsd]]></category>
		<category><![CDATA[Nonfiction Books]]></category>

		<guid isPermaLink="false">http://blather.michaelwlucas.com/?p=1720</guid>
		<description><![CDATA[<p>BSDCan hasn&#8217;t officially started, and I keep getting asked when I will write a third edition of Absolute FreeBSD?</p> <p>The short answer is: I don&#8217;t know.</p> <p>The slightly longer answer is: it depends in part on you.</p> <p>The much longer answer is:</p> <p>FreeBSD has added lots of stuff since Absolute FreeBSD came out in 2007. <span style="color:#777"> . . . &#8594; Read More: <a href="http://blather.michaelwlucas.com/archives/1720">The next FreeBSD book?</a></span>]]></description>
				<content:encoded><![CDATA[<p>BSDCan hasn&#8217;t officially started, and I keep getting asked when I will write a third edition of <em>Absolute FreeBSD</em>?</p>
<p>The short answer is: I don&#8217;t know.</p>
<p>The slightly longer answer is: it depends in part on you.</p>
<p>The much longer answer is:</p>
<p>FreeBSD has added lots of stuff since <a href="https://www.michaelwlucas.com/nonfiction/absolute-freebsd">Absolute FreeBSD</a> came out in 2007. The big, screaming, basic change is that ZFS is really well-supported, and considered a core feature.</p>
<p>But you can&#8217;t install to ZFS. Or to a mirror. Or to any of the other really cool options available on FreeBSD. There&#8217;s good stuff there, but new users can&#8217;t have it.</p>
<p>There are ways around this. For a new user, they range from ugly to absurd. I had hopes for the new FreeBSD installer, but none of the rumored improvements have reached real users. I could write &#8220;To install FreeBSD, install PC-BSD.&#8221; But my gut rebels. If you want PC-BSD, install PC-BSD.</p>
<p>If I was to write a big FreeBSD book today, it would have to be &#8220;1001 ways to install FreeBSD.&#8221; It would cover getting FreeBSD onto ZFS, or mirrors, or GELI, or any of the other cool options. That&#8217;s not a fun book to write and would not be fun to read.</p>
<p>Some discussions at BSDCan give me hope for an improved installation process. I don&#8217;t care if it&#8217;s the current installer, or a port of PC-BSD&#8217;s installer, or a resurrected sysinstall.</p>
<p>I have no problem spending a chapter on planning an installation, or on things you should know before installing &#8212; just look at Absolute OpenBSD. But that chapter can&#8217;t be &#8220;Here&#8217;s FreeBSD disk management system, so you can boot off a live filesystem and manually edit disks and create zpools and GELIs and mirrors and and and&#8230;&#8221; Experienced FreeBSD users put up with this, but you can&#8217;t give this to a new user.</p>
<p>FreeBSD <em>should</em> have a decent partitioning scheme at boot. If the OpenBSD folks can manage that with their text-only installer, surely FreeBSD could do so. But at least it&#8217;s <em>possible</em> to partition the disk with the current installer.</p>
<p>So: if you&#8217;re a programmer and want a new version of the book, work on the installer.</p>
<p>If you&#8217;re not a programmer: bribe one.</p>
<p>I have some small books on FreeBSD on my schedule, but that&#8217;s a very different thing. Until the installer changes, Absolute FreeBSD 3 isn&#8217;t even on the schedule.</p>
]]></content:encoded>
			<wfw:commentRss>http://blather.michaelwlucas.com/archives/1720/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>DNSSEC Mastery print now on Amazon</title>
		<link>http://blather.michaelwlucas.com/archives/1717</link>
		<comments>http://blather.michaelwlucas.com/archives/1717#comments</comments>
		<pubDate>Thu, 16 May 2013 14:01:02 +0000</pubDate>
		<dc:creator>Michael W Lucas</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blather.michaelwlucas.com/?p=1717</guid>
		<description><![CDATA[<p>Amazon now has the print version of DNSSEC Mastery available.</p> <p>I set the initial price assuming that they would discount. How much will they discount it, and when? No idea. Amazon is not inscrutable, but scrutling them exceeds my abilities. SSH Mastery print has ranged from ~$14 to ~$17 at various times, based how much <span style="color:#777"> . . . &#8594; Read More: <a href="http://blather.michaelwlucas.com/archives/1717">DNSSEC Mastery print now on Amazon</a></span>]]></description>
				<content:encoded><![CDATA[<p>Amazon now has the <a href="http://www.amazon.com/gp/product/1484924479/ref=as_li_qf_sp_asin_tl?ie=UTF8&#038;camp=1789&#038;creative=9325&#038;creativeASIN=1484924479&#038;linkCode=as2&#038;tag=michaelwlucas-20">print version</a> of <a href="https://www.michaelwlucas.com/nonfiction/dnssec-mastery">DNSSEC Mastery</a> available.</p>
<p>I set the initial price assuming that they would discount. How much will they discount it, and when? No idea. Amazon is not inscrutable, but scrutling them exceeds my abilities. <a href="https://www.michaelwlucas.com/nonfiction/ssh-mastery">SSH Mastery</a> print has ranged from ~$14 to ~$17 at various times, based how much coffee Bezos fed the cloud that morning.</p>
]]></content:encoded>
			<wfw:commentRss>http://blather.michaelwlucas.com/archives/1717/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Books at BSDCan</title>
		<link>http://blather.michaelwlucas.com/archives/1714</link>
		<comments>http://blather.michaelwlucas.com/archives/1714#comments</comments>
		<pubDate>Tue, 14 May 2013 13:24:14 +0000</pubDate>
		<dc:creator>Michael W Lucas</dc:creator>
				<category><![CDATA[Chatter]]></category>
		<category><![CDATA[Nonfiction Books]]></category>

		<guid isPermaLink="false">http://blather.michaelwlucas.com/?p=1714</guid>
		<description><![CDATA[<p>I&#8217;m sure everyone who reads this blog knows I&#8217;ll be at BSDCan tonight through early Sunday morning. I will also have books for sale, however.</p> Absolute OpenBSD, $50 SSH Mastery, $20 DNSSEC Mastery (4 proof copies only), $20 <p>Cash only.</p> <p>If you buy a book, I&#8217;ll throw in a free Tilted Windmill Press T-shirt while <span style="color:#777"> . . . &#8594; Read More: <a href="http://blather.michaelwlucas.com/archives/1714">Books at BSDCan</a></span>]]></description>
				<content:encoded><![CDATA[<p>I&#8217;m sure everyone who reads this blog knows I&#8217;ll be at <a href="http://bsdcan.org">BSDCan</a> tonight through early Sunday morning. I will also have books for sale, however.</p>
<li>Absolute OpenBSD, $50
<li>SSH Mastery, $20
<li>DNSSEC Mastery (4 proof copies only), $20
<p>Cash only.</p>
<p>If you buy a book, I&#8217;ll throw in a free Tilted Windmill Press T-shirt while supplies last. Because why not.</p>
<p>I&#8217;ll also be giving away some books as review copies. If you want a review copy of Absolute OpenBSD, you&#8217;ll need to give me your email address. I&#8217;ll be handing it off to the NSP publicity department. Sorry to be a pain on that, but I have to pay for any Absolute OpenBSDs that aren&#8217;t review copies. (Or I can ship them back to the publisher, but that&#8217;s just a waste.) I&#8217;m more flexible with review copies of self-published books.</p>
]]></content:encoded>
			<wfw:commentRss>http://blather.michaelwlucas.com/archives/1714/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>First &#8220;DNSSEC Mastery&#8221; reviews</title>
		<link>http://blather.michaelwlucas.com/archives/1712</link>
		<comments>http://blather.michaelwlucas.com/archives/1712#comments</comments>
		<pubDate>Mon, 13 May 2013 13:17:04 +0000</pubDate>
		<dc:creator>Michael W Lucas</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blather.michaelwlucas.com/?p=1712</guid>
		<description><![CDATA[<p>Two reviews came out over the weekend, one from Peter Hansteen and the other from Justin Sherrill.</p> <p>Apparently this book also does not suck. Yay!</p> <p>I&#8217;ll be giving a live dramatic reading from the book &#8212; er, that is, teaching a course on DNSSEC &#8212; at BSDCan Wednesday morning this week.</p> ]]></description>
				<content:encoded><![CDATA[<p>Two reviews came out over the weekend, one from <a href="http://bsdly.blogspot.com/2013/05/dnssec-mastery-or-how-to-make-your-name.html">Peter Hansteen</a> and the other from <a href="http://www.shiningsilence.com/dbsdlog/2013/05/12/11756.html">Justin Sherrill</a>.</p>
<p>Apparently this book also does not suck. Yay!</p>
<p>I&#8217;ll be giving a live dramatic reading from the book &#8212; er, that is, teaching a course on DNSSEC &#8212; at <a href="https://www.bsdcan.org/2013/">BSDCan</a> Wednesday morning this week.</p>
]]></content:encoded>
			<wfw:commentRss>http://blather.michaelwlucas.com/archives/1712/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;Absolute OpenBSD&#8221; Kindle edition: problems and on sale</title>
		<link>http://blather.michaelwlucas.com/archives/1709</link>
		<comments>http://blather.michaelwlucas.com/archives/1709#comments</comments>
		<pubDate>Wed, 08 May 2013 13:01:07 +0000</pubDate>
		<dc:creator>Michael W Lucas</dc:creator>
				<category><![CDATA[bsd]]></category>
		<category><![CDATA[Nonfiction Books]]></category>

		<guid isPermaLink="false">http://blather.michaelwlucas.com/?p=1709</guid>
		<description><![CDATA[<p>I&#8217;ve heard from a few different readers that there are problems with the Kindle edition of Absolute OpenBSD. It&#8217;s by no means every copy in every format, but there are enough problem reports that it needs investigating.</p> <p>I&#8217;ve notified the publisher. They are investigating. When I have an update, I will post it.</p> <p>Generally, when <span style="color:#777"> . . . &#8594; Read More: <a href="http://blather.michaelwlucas.com/archives/1709">&#8220;Absolute OpenBSD&#8221; Kindle edition: problems and on sale</a></span>]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve heard from a few different readers that there are problems with the Kindle edition of <a href="https://www.michaelwlucas.com/nonfiction/absolute-openbsd-2nd-edition" title="Absolute OpenBSD">Absolute OpenBSD</a>. It&#8217;s by no means every copy in every format, but there are enough problem reports that it needs investigating.</p>
<p>I&#8217;ve notified the publisher. They are investigating. When I have an update, I will post it.</p>
<p>Generally, when a Kindle file has a problem, remove it from your device. When the new version appears, you can re-download it from Amazon.</p>
<p>And this is the point where I mention that <a href="http://post.oreilly.com/form/oreilly/viewhtml/9z1z7ls8clim2leruv8hmnkj4bkm9fh595nie678c70?imm_mid=0a7aa5&#038;cmp=em-code-books-videos-deal-day-absolute-openbsd">Absolute OpenBSD is O&#8217;Reilly&#8217;s Deal of the Day</a>. If you want the ebook, you can get it for 50% off.</p>
]]></content:encoded>
			<wfw:commentRss>http://blather.michaelwlucas.com/archives/1709/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Basic Ansible Playbooks</title>
		<link>http://blather.michaelwlucas.com/archives/1692</link>
		<comments>http://blather.michaelwlucas.com/archives/1692#comments</comments>
		<pubDate>Mon, 06 May 2013 17:33:48 +0000</pubDate>
		<dc:creator>Michael W Lucas</dc:creator>
				<category><![CDATA[Tech]]></category>

		<guid isPermaLink="false">http://blather.michaelwlucas.com/?p=1692</guid>
		<description><![CDATA[<p>Ansible is a tool for managing servers en masse, much like Puppet or CFEngine. Ansible has a shallower learning curve than either of those systems, however, and it&#8217;s idempotent. How do I know it has a shallower learning curve? Because I learned enough of it to do actual useful work in only a couple of <span style="color:#777"> . . . &#8594; Read More: <a href="http://blather.michaelwlucas.com/archives/1692">Basic Ansible Playbooks</a></span>]]></description>
				<content:encoded><![CDATA[<p><a href="http://ansible.cc ">Ansible</a> is a tool for managing servers en masse, much like Puppet or CFEngine. Ansible has a shallower learning curve than either of those systems, however, and it&#8217;s idempotent. How do I know it has a shallower learning curve? Because I learned enough of it to do actual useful work in only a couple of hours.</p>
<p>And before you reach for a dictionary, &#8220;idempotent&#8221; means that you can run the same script against your servers and have the end result be the same. You can run an Ansible script (or playbook) against a group of servers, take note of those that fail, modify the script, and run it again against the same group of servers, and Ansible will verify that the servers need the playbook run before running it. Only the servers that need the change will get it.</p>
<p>Why would this ever happen? Maybe a datacenter is cut off by a network issue, or a LDAP server chokes, or gremlins invade a server, or a script fails because an intruder has hacked the server and this is your early warning. Your management tools need to deal with all of these.</p>
<p>For example, I have an Ansible playbook that uploads a new PF configuration file and reloads the PF rules. Ansible compares the existing PF configuration to one being distributed, and if the file hasn&#8217;t changed, doesn&#8217;t reload the rules. This isn&#8217;t a huge deal for PF, but for some applications it&#8217;s vital.</p>
<p>Another nice feature about Ansible is that it uses only SSH and Python. Most Unixes acquire Python as an application dependency somewhere along the way, and it&#8217;s small enough that I have no real objection to installing on servers without it. And both Puppet and CFEngine have dedicated agent software, so some kind of agent is going to wind up on the managed machine anyway.</p>
<p>The biggest problem I had with Ansible was with playbooks. There&#8217;s a whole bunch of <a href="http://ansible.cc/docs/playbooks.html">playbook documentation</a>, and Ansible ships with sample playbooks, but they&#8217;re written somewhat like man pages, for people who already have some clue about the topic. So here are a couple really rudimentary Ansible playbooks, with explanations.</p>
<pre>---
- hosts: pf
  user: ansible
  sudo: yes
  tasks:
  - name: copy pf.mgmt.conf to servers
    action: copy src=/home/ansible/freebsd/etc/pf.mgmt.conf 
      dest=/etc/pf.mgmt.conf owner=root group=wheel mode=0644
    notify:
      - reload pf

  handlers:
    - name: reload pf
      action: shell /sbin/pfctl -f /etc/pf.conf</pre>
<p>Ansible playbooks are written in <a href="http://www.yaml.org/">YAML</a>, Yet Another Markup Language. I concede that my first thought on hearing the words &#8220;yes another markup language&#8221; is &#8220;that statement needs some obscenities between the second and third word.&#8221; But XML would be way overkill for Ansible. (And the YAML folks have changed their name to a different acronym, Yaml Ain&#8217;t Markup Language, trying to escape the stigma of being yet another bleeping bleepety-bleep markup language.)</p>
<p>All YAML files start with a triple dash. They are space-sensitive &#8212; <a href="http://www.yaml.org/faq.html">don&#8217;t use tabs, only spaces</a>.</p>
<p>At the top level (no indents), we have the triple dash and a dash </p>
<pre>---
- hosts: pf</pre>
<p>The leading hyphen basically means &#8220;new thing here,&#8221; as far as I can tell.</p>
<p>At the second level of configuration, indented two spaces, we have five sections: hosts, user, sudo, tasks, and handlers.</p>
<p>The hosts statement gives the name of a group of hosts. Ansible has an easily understood hosts file. This playbook applies to a group of hosts called &#8220;pf.&#8221;</p>
<p>The user definition tells ansible which user to use. Ansible should SSH into the target servers as the user &#8220;ansible.&#8221;</p>
<p>The sudo statement tells ansible to use sudo to perform this command. My ansible user on each host has sudo privileges, but needs a password. We&#8217;ll get an opportunity to enter the password when we run the playbook. (Ansible could log into the target server as root and avoid the need for sudo, or let the ansible user have sudo without a password, but the thought of doing either makes my spleen threaten to leap up my gullet and block my windpipe, so I don&#8217;t.)</p>
<p>The tasks section is where things get interesting. We actually do stuff here. I define a third level of indentation (four spaces) after the tasks statement, and start them with a dash.</p>
<p>Our first task has a name, &#8220;copy pf.mgmt.conf to servers.&#8221;</p>
<p>The action that follows uses the Ansible <a href="http://ansible.cc/docs/modules.html#copy">copy module</a>. I define a source file, a destination file, and set the owner and permissions.</p>
<p>The notify statement tells the task to activate the handler named &#8220;reload pf&#8221; If the action changes a target system, the action triggers the handler. If the action doesn&#8217;t change anything, the handler is not triggered.</p>
<p>We then have the handler section. It&#8217;s at the same indent level as tasks, sudo, user, and hosts, so it&#8217;s a major section. There&#8217;s one handler, &#8220;reload pf.&#8221; It performs one action, fires up a shell and runs a command.</p>
<p>Taken as a whole, this playbook copies a file to all the servers in the pf group and reloads the file. The file pf.mgmt.conf contains the IP addresses of my management hosts, as I <a href="http://blather.michaelwlucas.com/archives/1679">discussed elsewhere</a>.</p>
<p>Now let&#8217;s look at a slightly more complex playbook that does the same thing.</p>
<pre>
---
- hosts: linux-internal
  user: ansible
  sudo: yes
  tasks:
  - name: copy iptables.mgmt.conf to servers
    action: copy src=/home/ansible/linux/etc/iptables.mgmt.conf 
      dest=/etc/iptables.mgmt.conf owner=root group=root mode=0644
    notify:
      - reload ipset mgmt
  - name: copy iptables.rules to servers
    action: copy src=/home/ansible/linux/etc/solus.iptables.rules 
      dest=/etc/iptables.rules owner=root group=root mode=0644
    notify:
      - reload iptables

  handlers:
    - name: reload ipset mgmt
      action: shell /usr/sbin/ipset restore -! < /etc/iptables.mgmt.conf
    - name: reload iptables
      action: shell /sbin/iptables-restore -! < /etc/iptables.rules</pre>
<p>This playbook updates the firewall rules on my Linux hosts. These CentOS hosts are a little simpler in that they all share a common function (virtualization). They can have a common iptables ruleset as well as a common list of management addresses. <a href="http://blather.michaelwlucas.com/archives/1679">I talk about how I use ipsets, and why the rules are set up this way, elsewhere</a>. But the important thing is:</p>
<li>This is a single procedure, so it's one playbook.
<li>It updates two separate files.
<li>Changing each file runs a separate command.
<p>So, if the iptables.rules file changes, Ansible runs <code>iptables-restore</code>. If iptables.mgmt.conf changes, Ansible runs <code>ipset</code>.</p>
<p>To use these playbooks, I log in as the ansible user on the ansible server and run:</p>
<p><code>$ <strong>ansible-playbook -K <em>playbook-file-name.yml</em></strong></code></p>
<p>The -K tells ansible to ask for the sudo password. If your ansible user doen't need a sudo password, skip it. (But beware your spleen.)</p>
<p>Ansible will log onto every host in the group, check the files, update them if needed, and run the handler commands if it updates the files.</p>
<p>Ansible has many more modules than just copying files and running commands. It can assemble files from variables, install packages, and more. But a few small playbooks will get you started, and even the basic steps of managing servers firewall rules en masse will save you enough time to figure out the new modules.</p>
<p>I have no doubt that Puppet and CFEngine have serious use cases and environments where they're the best choice. What my network is most short on is sysadmin brainpower, however, and Ansible is a good fit for my feeble brain.</p>
]]></content:encoded>
			<wfw:commentRss>http://blather.michaelwlucas.com/archives/1692/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>iptables and ipsets</title>
		<link>http://blather.michaelwlucas.com/archives/1679</link>
		<comments>http://blather.michaelwlucas.com/archives/1679#comments</comments>
		<pubDate>Fri, 03 May 2013 14:49:21 +0000</pubDate>
		<dc:creator>Michael W Lucas</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[Tech]]></category>

		<guid isPermaLink="false">http://blather.michaelwlucas.com/?p=1679</guid>
		<description><![CDATA[<p>I&#8217;m dragging my work environment from &#8220;artisan system administration&#8221; to mass-managed servers. Part of this is rationalizing, updating, and centralizing management of packet filter rules on individual hosts. Like many environments, I have a list of &#8220;management IP addresses&#8221; with unlimited access to every host. Managing this is trivial on a BSD machine, thanks to <span style="color:#777"> . . . &#8594; Read More: <a href="http://blather.michaelwlucas.com/archives/1679">iptables and ipsets</a></span>]]></description>
				<content:encoded><![CDATA[<p>I&#8217;m dragging my work environment from &#8220;artisan system administration&#8221; to mass-managed servers. Part of this is rationalizing, updating, and centralizing management of packet filter rules on individual hosts. Like many environments, I have a list of &#8220;management IP addresses&#8221; with unlimited access to every host. Managing this is trivial on a BSD machine, thanks to pf.conf&#8217;s ability to include an outside file &#8212; you upload the new file of management addresses and run pfctl to read it. A PF rules file looks something like this:</p>
<p><code>ext_if="em0"<br />
include "/etc/pf.mgmt.conf"<br />
...<br />
pass in on $ext_if proto icmp from any to any<br />
#mgmt networks can talk to this host on any service<br />
pass in on $ext_if from <mgmt> to any<br />
...</code></p>
<p>The file pf.mgmt.conf looks like this:</p>
<p><code>table <mgmt> const { 192.0.2.0/24, 198.51.100.128/25 }</code></p>
<p>When I add new management addresses I copy <code>pf.mgmt.conf</code> to each machine, run <code>pfctl -f /etc/pf.conf</code>, and the new addresses can connect.</p>
<p>But surely there&#8217;s some similar function on a Linux box?</p>
<p>To complicate matters further, our environment includes both Ubuntu and CentOS machines. (Why? Because we don&#8217;t run operating systems, we run applications, and applications get picky about what they run on.) Each version has its own way of saving and restoring iptables rules. I want to use the same method for both operating systems. What we&#8217;ve used is a single rules file, /etc/iptables.rules, read by iptables-restore at boot. We specifically don&#8217;t want to trust a copy of the packet filter rules saved by the local machine, as problems can persist across reboots. The current iptables.rules looks something like this:</p>
<p><code>*filter<br />
#mgmt addrs<br />
-A INPUT -s 192.0.2.0/24 -i eth0 -j ACCEPT<br />
-A INPUT -s 198.51.100.128/25 -i eth0 -j ACCEPT<br />
#keep state<br />
-A INPUT  -p tcp -m state --state ESTABLISHED     -j ACCEPT<br />
-A OUTPUT -p tcp -m state --state NEW,ESTABLISHED -j ACCEPT<br />
-A INPUT  -p udp -m state --state ESTABLISHED     -j ACCEPT<br />
-A OUTPUT -p udp -m state --state NEW,ESTABLISHED -j ACCEPT<br />
#local stuff here<br />
...<br />
#permit ICMP<br />
-A INPUT -p icmp -j ACCEPT<br />
-A OUTPUT -p icmp -j ACCEPT<br />
-A INPUT -i eth0 -j DROP<br />
COMMIT</code></p>
<p>I don&#8217;t want to change /etc/iptables.rules for each machine at this point. They all vary slightly. (One day the machines will be classified by roles, but we&#8217;re in an intermediate stage right now.) Instead, I want to have the list of management addresses in a separate file. I want to copy the new file to the server, run a command, and have the new list of management addresses be live.</p>
<p><a href="http://ipset.netfilter.org/">ipsets</a> seems to be the way to do this. Let&#8217;s find out.</p>
<p>On my crashbox, I&#8217;ll create an ipset. I&#8217;m using an ipset of type nethash, because it takes CIDR blocks rather than individual IP addresses. The ipset is called mgmt, just like the management addresses on my BSD machines.</p>
<p><code># <strong>ipset create mgmt nethash</strong></code></p>
<p>It returns silently. Did it create the ipset?</p>
<p><code># <strong>ipset list</strong><br />
Name: mgmt<br />
Type: hash:net<br />
Header: family inet hashsize 1024 maxelem 65536<br />
Size in memory: 16760<br />
References: 0<br />
Members:</code></p>
<p>OK, it&#8217;s in memory. Now add some addresses.</p>
<p><code># <strong>ipset add mgmt 192.0.2.0/24</strong><br />
# <strong>ipset add mgmt 198.51.100.128/25</strong></code></p>
<p>Are those addresses really in the set? Let&#8217;s ask again.</p>
<p><code># <strong>ipset list mgmt</strong><br />
Name: mgmt<br />
...<br />
Members:<br />
192.0.2.0/24<br />
198.51.100.128/25</code></p>
<p>Now, export this to a file.</p>
<p><code># <strong>ipset save mgmt > iptables.mgmt.conf</strong></code></p>
<p>I use the file <code>iptables.mgmt.conf</code> to mirror <code>pf.mgmt.conf</code>. That file should contain something like this:</p>
<p><code>create mgmt hash:net family inet hashsize 1024 maxelem 65536<br />
add mgmt 192.0.2.0/24<br />
add mgmt 198.22.63.128/25<br />
add mgmt 198.51.100.128/25</code></p>
<p>Can I restore the ipset from the file? Destroy the set. </p>
<p><code># <strong>ipset destroy mgmt</strong><br />
# <strong>ipset list</strong></code></p>
<p>It&#8217;s gone. Now to restore it from memory.</p>
<p><code># <strong>ipset restore < iptables.mgmt.conf<br />
</strong># <strong>ipset list</strong><br />
...</code></p>
<p>All my rules are there.</p>
<p>Now, let&#8217;s teach iptables how to use an ipset. Rather than defining addresses, we use the <code>-m set</code> option.</p>
<p><code># <strong>iptables -A INPUT -i eth0 -m set --match-set mgmt src -j ACCEPT</strong></code></p>
<p>In the iptables.rule file, it would look like this.</p>
<p><code>*filter<br />
#allow mgmt IPs<br />
-A INPUT -i eth0 -m set --match-set mgmt src -j ACCEPT<br />
...</code></p>
<p>When you have several management networks, this is certainly much shorter and easier to read.</p>
<p>When you update the iptables.mgmt.conf file, read it in with <code>ipset restore</code>. You must use the <code>-!</code> flag. This tells ipset to ignore that the ipset already exists, and restore the contents of the ipset from the file.</p>
<p><code># <strong>ipset restore -! < iptables.mgmt.conf</strong></code></p>
<p>I can now copy this file to my hosts, run a command, and the packet filter rules are updated, without touching my main rules file.</p>
<p>I don&#8217;t recall anyone using a symbol as a command-line flag like this before, but I actually kind of like this one. &#8220;I said DO IT, damn you!&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://blather.michaelwlucas.com/archives/1679/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Penguicon Schedule</title>
		<link>http://blather.michaelwlucas.com/archives/1677</link>
		<comments>http://blather.michaelwlucas.com/archives/1677#comments</comments>
		<pubDate>Thu, 25 Apr 2013 15:08:13 +0000</pubDate>
		<dc:creator>Michael W Lucas</dc:creator>
				<category><![CDATA[Chatter]]></category>

		<guid isPermaLink="false">http://blather.michaelwlucas.com/?p=1677</guid>
		<description><![CDATA[<p>Someone pointed out that it would be nice to know when I&#8217;ll be doing what at Penguicon. So, here&#8217;s my schedule.</p> <p>Friday, 26 April: 6PM-7PM opening ceremonies 7PM-8PM Guest of Honor Social Hour 9PM-10PM OpenBSD (kind of obligatory)</p> <p>Saturday, 27 April: 10AM-noon: liquid nitrogen ice cream, my own flavor 5PM-6PM: Technology Publishing in 2013</p> <p>Sunday <span style="color:#777"> . . . &#8594; Read More: <a href="http://blather.michaelwlucas.com/archives/1677">Penguicon Schedule</a></span>]]></description>
				<content:encoded><![CDATA[<p>Someone pointed out that it would be nice to know when I&#8217;ll be doing what at Penguicon. So, here&#8217;s my schedule.</p>
<p>Friday, 26 April:<br />
6PM-7PM opening ceremonies<br />
7PM-8PM Guest of Honor Social Hour<br />
9PM-10PM OpenBSD (kind of obligatory)</p>
<p>Saturday, 27 April:<br />
10AM-noon: liquid nitrogen ice cream, my own flavor<br />
5PM-6PM: Technology Publishing in 2013</p>
<p>Sunday 28 April:<br />
3PM-4PM: closing ceremonies</p>
<p>Other than that, I&#8217;m basically free. You can find me elsewhere, as I&#8217;ll be playing free range author, but you can definitely intercept me at these times.</p>
]]></content:encoded>
			<wfw:commentRss>http://blather.michaelwlucas.com/archives/1677/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
