<?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>Christopher J. Umina &#187; FreeBSD</title>
	<atom:link href="http://uminac.com/category/computers/freebsd/feed/" rel="self" type="application/rss+xml" />
	<link>http://uminac.com</link>
	<description>I&#039;m not creative enough for this, and you can&#039;t help me.</description>
	<lastBuildDate>Wed, 25 Jan 2012 17:14:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<meta name="generator" content="deGusto 1.0" />
		<item>
		<title>Avoiding Device Confusion in FreeBSD with ZFS</title>
		<link>http://uminac.com/2012/01/25/avoiding-device-confusion-in-freebsd-with-zfs/</link>
		<comments>http://uminac.com/2012/01/25/avoiding-device-confusion-in-freebsd-with-zfs/#comments</comments>
		<pubDate>Wed, 25 Jan 2012 17:14:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[FreeBSD]]></category>

		<guid isPermaLink="false">http://uminac.com/?p=407</guid>
		<description><![CDATA[In tutorial after tutorial, I find people creating zpools using a method that looks like: % zpool create tank /dev/da2 /dev/da3 /dev/da4 /dev/da5 But, what happens when you reboot without /dev/da2 plugged in? /dev/da3 becomes /dev/da2 and your pool is confused and weird and all that junk. A simple tip is to create a GPT [...]]]></description>
			<content:encoded><![CDATA[<p>In tutorial after tutorial, I find people creating zpools using a method that looks like:</p>
<p><code>% zpool create tank /dev/da2 /dev/da3 /dev/da4 /dev/da5</code></p>
<p>But, what happens when you reboot without /dev/da2 plugged in? /dev/da3 becomes /dev/da2 and your pool is confused and weird and all that junk.</p>
<p>A simple tip is to create a GPT on each disk you plan to add to a pool and rather than using the device node of /dev/da#p#, use the GPT partition ID device node that&#8217;s automatically created under /dev/gptid.</p>
<p>First, wipe the partition table on each of your disks, using:</p>
<p><code><br />
% dd if=/dev/zero of=/dev/da2 bs=512 count=1<br />
% dd if=/dev/zero of=/dev/da3 bs=512 count=1<br />
% dd if=/dev/zero of=/dev/da4 bs=512 count=1<br />
% dd if=/dev/zero of=/dev/da5 bs=512 count=1<br />
</code></p>
<p>Now create a new GPT on each disk, using:</p>
<p><code><br />
% gpart create -s gpt da2<br />
% gpart create -s gpt da3<br />
% gpart create -s gpt da4<br />
% gpart create -s gpt da5<br />
</code></p>
<p>Now create a FreeBSD ZFS partition on each disk. This is easy because we&#8217;re only making one partition per disk.</p>
<p><code><br />
% gpart add -t freebsd-zfs da2<br />
% gpart add -t freebsd-zfs da3<br />
% gpart add -t freebsd-zfs da4<br />
% gpart add -t freebsd-zfs da5<br />
</code></p>
<p>You should now see the gptids listed in /dev/gptid/</p>
<p><code><br />
# ls -l /dev/gptid<br />
total 0<br />
crw-r-----  1 root  operator    0, 126 Jan 23 15:44 1bcdc07f-4603-11e1-bd02-003048bb1b96<br />
crw-r-----  1 root  operator    0, 135 Jan 23 15:44 1cf8bda4-4603-11e1-bd02-003048bb1b96<br />
crw-r-----  1 root  operator    0, 143 Jan 23 15:44 1da00324-4603-11e1-bd02-003048bb1b96<br />
crw-r-----  1 root  operator    0, 151 Jan 23 15:45 1e83229b-4603-11e1-bd02-003048bb1b96<br />
</code></p>
<p>Now simply create your zpool however you like, using the gptid device node instead of the device ID.</p>
<p><code><br />
# zpool create external \<br />
    /dev/gptid/1bcdc07f-4603-11e1-bd02-003048bb1b96 \<br />
    /dev/gptid/1cf8bda4-4603-11e1-bd02-003048bb1b96 \<br />
    /dev/gptid/1da00324-4603-11e1-bd02-003048bb1b96 \<br />
    /dev/gptid/1e83229b-4603-11e1-bd02-003048bb1b96<br />
</code></p>
<p>And check on it&#8230;</p>
<p><code><br />
# zpool status external<br />
  pool: external<br />
 state: ONLINE<br />
 scan: none requested<br />
config:</p>
<p>	NAME                                          STATE     READ WRITE CKSUM<br />
	external                                      ONLINE       0     0     0<br />
	  gptid/1bcdc07f-4603-11e1-bd02-003048bb1b96  ONLINE       0     0     0<br />
	  gptid/1cf8bda4-4603-11e1-bd02-003048bb1b96  ONLINE       0     0     0<br />
	  gptid/1da00324-4603-11e1-bd02-003048bb1b96  ONLINE       0     0     0<br />
	  gptid/1e83229b-4603-11e1-bd02-003048bb1b96  ONLINE       0     0     0</p>
<p>errors: No known data errors<br />
</code></p>
<p>You can use the gpart utility to see all kinds of data about your partitions as well. This is useful to figure out which gptid belongs to which disk.</p>
]]></content:encoded>
			<wfw:commentRss>http://uminac.com/2012/01/25/avoiding-device-confusion-in-freebsd-with-zfs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ZFS Deduplication on Existing Pool</title>
		<link>http://uminac.com/2011/10/12/zfs-deduplication-on-existing-pool/</link>
		<comments>http://uminac.com/2011/10/12/zfs-deduplication-on-existing-pool/#comments</comments>
		<pubDate>Wed, 12 Oct 2011 14:33:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[FreeBSD]]></category>

		<guid isPermaLink="false">http://uminac.com/?p=359</guid>
		<description><![CDATA[<p>Similarly to enabling compression on a ZFS partition that already has data, enabling deduplication does not deduplicate the data that already exists. This was a problem for me.</p>]]></description>
			<content:encoded><![CDATA[<p>Similarly to enabling compression on a ZFS partition that already has data, enabling deduplication does not deduplicate the data that already exists. This was a problem for me. To add to the problem, this pool had many partitions and the partitions each had many snapshots, all of which I wanted to preserve.</p>
<p>The only solution seems to be moving all the data away and back. I bought 4 external hard drives, made a <a title="storagebomb" href="http://blumpkin.me/image/2358">storagebomb</a> and away I went. <a title="http://www.mebsd.com/configure-freebsd-servers/duplicate-zfs-pool-over-ssh-freebsd.html" href="http://www.mebsd.com/configure-freebsd-servers/duplicate-zfs-pool-over-ssh-freebsd.html">This page</a> has a good description of how to move an entire pool to a different device, preserving all the snapshots and whatnot.</p>
]]></content:encoded>
			<wfw:commentRss>http://uminac.com/2011/10/12/zfs-deduplication-on-existing-pool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Duplicity &amp; S3</title>
		<link>http://uminac.com/2011/05/23/duplicity-s3/</link>
		<comments>http://uminac.com/2011/05/23/duplicity-s3/#comments</comments>
		<pubDate>Mon, 23 May 2011 12:25:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[FreeBSD]]></category>

		<guid isPermaLink="false">http://uminac.com/?p=341</guid>
		<description><![CDATA[It works really well and it&#8217;s cheap. Try it. Also read: http://andyleonard.com/2009&#8230;-of-others/ I&#8217;ll post my script here later.]]></description>
			<content:encoded><![CDATA[<p>It works really well and it&#8217;s cheap.  Try it.  Also read: <a href="http://andyleonard.com/2009/03/02/duplicity-to-amazon-s3-on-freebsd-building-on-the-work-of-others/">http://andyleonard.com/2009&#8230;-of-others/</a></p>
<p>I&#8217;ll post my script here later.</p>
]]></content:encoded>
			<wfw:commentRss>http://uminac.com/2011/05/23/duplicity-s3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Headless FreeBSD Install</title>
		<link>http://uminac.com/2010/06/01/headless-freebsd-install/</link>
		<comments>http://uminac.com/2010/06/01/headless-freebsd-install/#comments</comments>
		<pubDate>Tue, 01 Jun 2010 16:54:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[FreeBSD]]></category>

		<guid isPermaLink="false">http://uminac.com/?p=268</guid>
		<description><![CDATA[Ever wanted to install without a keyboard and mouse on the system? Do it over serial console! Here&#8217;s how to make a CD that can do it. Extract the ISO Get your install ISO from somewhere and extract it to some directory. mkdir ./iso tar -C ./iso -pxf 8.0-RELEASE-i386-disc1.iso cd ./iso loader.conf Next thing to [...]]]></description>
			<content:encoded><![CDATA[<p>Ever wanted to install without a keyboard and mouse on the system?  Do it over serial console!  Here&#8217;s how to make a CD that can do it.</p>
<h3>Extract the ISO</h3>
<p>Get your install ISO from somewhere and extract it to some directory.</p>
<pre>
mkdir ./iso
tar -C ./iso -pxf 8.0-RELEASE-i386-disc1.iso
cd ./iso
</pre>
<h3>loader.conf</h3>
<p>Next thing to do is to tell the boot loader to start using the serial port.  This can be done by putting:</p>
<pre>console="comconsole"</pre>
<p>somewhere inside boot/loader.conf (obviously inside the iso directory)</p>
<h3>Make the ISO!</h3>
<p>Now wrap it all up into an iso using:</p>
<pre>mkisofs -J -r -b boot/cdboot -no-emul-boot -o 8.0-RELEASE-i386-disc1-serial.iso ./iso</pre>
<p>or something of the sort.</p>
<h3>You&#8217;re done!</h3>
<p>Go burn the ISO file and boot a system off the CD.  Set your terminal&#8217;s baud rate to 9600 and you&#8217;ll eventually see things booting up!</p>
]]></content:encoded>
			<wfw:commentRss>http://uminac.com/2010/06/01/headless-freebsd-install/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using portdowngrade</title>
		<link>http://uminac.com/2010/02/09/using-portdowngrade/</link>
		<comments>http://uminac.com/2010/02/09/using-portdowngrade/#comments</comments>
		<pubDate>Tue, 09 Feb 2010 17:31:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[downgrade]]></category>
		<category><![CDATA[old version]]></category>
		<category><![CDATA[portaudit]]></category>
		<category><![CDATA[portdowngrade]]></category>
		<category><![CDATA[ports]]></category>
		<category><![CDATA[portsdb]]></category>
		<category><![CDATA[portupgrade]]></category>

		<guid isPermaLink="false">http://uminac.com/?p=263</guid>
		<description><![CDATA[Recently, I needed to roll a port back to a much older revision. While I usually dislike this type of thing, I found it to be necessary this time. Somebody recommended that I use portdowngrade to revert the ports tree to the older version, so I could install it. Here&#8217;s my process: Verify Anonymous CVS [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I needed to roll a port back to a much older revision.  While I usually dislike this type of thing, I found it to be necessary this time.  Somebody recommended that I use portdowngrade to revert the ports tree to the older version, so I could install it.</p>
<p>Here&#8217;s my process:</p>
<h3>Verify Anonymous CVS Connectivity</h3>
<p>First, you must verify that you can connect to the anoncvs server.  You can find instructions in the <a href="http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/anoncvs.html">FreeBSD Handbook</a> for this process.</p>
<p>One thing you should probably be aware of is that there are a very limited number of anoncvs mirrors, which is why I chose the .tw one.</p>
<h3>Prepare Your Ports Tree</h3>
<p>You need to be sure that you have an updated portsdb installed so portdowngrade is able to find the matching ports with a search.</p>
<pre>portsdb -u</pre>
<h3>Installing &#038; Using portdowngrade</h3>
<pre>
cd /usr/ports/*/portdowngrade
make DEFAULT_CVS_SERVER=\":pserver:anoncvs@anoncvs.tw.freebsd.org:/home/ncvs\" install clean
</pre>
<p>Note that you may replace the server name with whichever mirror you chose in the earlier step.</p>
<p>Once installed, you may now downgrade the port using:</p>
<pre>portdowngrade devel/bugzilla</pre>
<p>for instance.  From here the <a href="http://portdowngrade.sourceforge.net/documentation.html">documentation</a> will be more than enough to show you how to get the downgraded port checked out and installed.</p>
<h3>The Missing Step: Making portupgrade Ignore the Port!</h3>
<p>This is easy as pie, but there are two ways to do it.  I chose to do both.</p>
<h4>Option 1: Edit the pkgtools.conf file</h4>
<p>Usually located in /usr/local/etc/, pkgtools.conf will allow you to specify an additional port in the HOLD_PKGS array like such:</p>
<pre>
HOLD_PKGS = [
    'bsdpan-*',
    'devel/bugzilla*'
]
</pre>
<h4>Option 2: +IGNOREME</h4>
<p>Creating a +IGNOREME file in the package directory will stop both portaudit and portmaster from upgrading the port.</p>
<pre>touch /var/db/pkg/bugzilla/+IGNOREME</pre>
]]></content:encoded>
			<wfw:commentRss>http://uminac.com/2010/02/09/using-portdowngrade/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>named inside a FreeBSD jail</title>
		<link>http://uminac.com/2008/09/29/named-inside-a-freebsd-jail/</link>
		<comments>http://uminac.com/2008/09/29/named-inside-a-freebsd-jail/#comments</comments>
		<pubDate>Mon, 29 Sep 2008 16:13:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[bind]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[jail]]></category>
		<category><![CDATA[named]]></category>

		<guid isPermaLink="false">http://uminac.com/?p=72</guid>
		<description><![CDATA[If you&#8217;ve ever tried to run named inside a FreeBSD jail you&#8217;ve seen this error: /etc/rc.d/named: WARNING: devfs_domount(): Unable to mount devfs on /var/named/dev devfs rule: ioctl DEVFSIO_RAPPLY: Operation not permitted devfs rule: ioctl DEVFSIO_RAPPLY: Operation not permitted The reason for this is that by default in FreeBSD named tries to run within a chroot. [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve ever tried to run named inside a FreeBSD jail you&#8217;ve seen this error:</p>
<pre>
/etc/rc.d/named: WARNING: devfs_domount(): Unable to mount devfs on /var/named/dev
devfs rule: ioctl DEVFSIO_RAPPLY: Operation not permitted
devfs rule: ioctl DEVFSIO_RAPPLY: Operation not permitted
</pre>
<p>The reason for this is that by default in FreeBSD named tries to run within a chroot.  The chroot for named requires /dev/zero, and /dev/random, so the rc script that starts named tries to mount a devfs for named.  The problem is that jails cannot mount, for obvious reasons.</p>
<p>The quick solution is to tell FreeBSD not to try to run named within a chroot.  The idea is that a jail is good enough.  You can do this by seting:</p>
<pre>named_chrootdir=""</pre>
<p>within the <b>JAIL&#8217;S</b> /etc/rc.conf.</p>
<p>The other option is to create the chroot dir for named from the host system for the jail before you start it.  This really doesn&#8217;t have too much of a benefit.  But it&#8217;s possible by issuing the following commands from the host system for your jail:</p>
<pre>
# mount -t devfs devfs /jails/jailhost.whatever.com/var/named/dev/
# devfs -m /jails/jailhost.whatever.com/var/named/dev/ rule -s 1 applyset
# devfs -m /jails/jailhost.whatever.com/var/named/dev/ rule apply path null unhide
# devfs -m /jails/jailhost.whatever.com/var/named/dev/ rule apply path random unhide
</pre>
<p>Once you&#8217;ve done that, you can start named in the jail, and you&#8217;ll have named running inside a chroot within a jail.  This doesn&#8217;t quell the error messages, but you can trust that they&#8217;re irrelevant, or if you feel like it, you can patch /etc/rc.d/named within the jail to not try to create/destroy chroots.  Find these lines of code:</p>
<pre>
# Mount a devfs in the chroot directory if needed
#
umount ${named_chrootdir}/dev 2>/dev/null
devfs_domount ${named_chrootdir}/dev devfsrules_hide_all
devfs -m ${named_chrootdir}/dev rule apply path null unhide
devfs -m ${named_chrootdir}/dev rule apply path random unhide
</pre>
<p>and make them look like this:</p>
<pre>
# Mount a devfs in the chroot directory if needed
#
#umount ${named_chrootdir}/dev 2>/dev/null
#devfs_domount ${named_chrootdir}/dev devfsrules_hide_all
#devfs -m ${named_chrootdir}/dev rule apply path null unhide
#devfs -m ${named_chrootdir}/dev rule apply path random unhide
</pre>
<p>Now you have to maintain this stupidity, if your mergemaster changes /etc/rc.d/named, but I guess it&#8217;s nice not to see errors.  You also can&#8217;t start your jails automatically at boot, because the chroot won&#8217;t exist yet&#8230;  So&#8230;. whatever.</p>
]]></content:encoded>
			<wfw:commentRss>http://uminac.com/2008/09/29/named-inside-a-freebsd-jail/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Stopping SSH SPAM with PF!</title>
		<link>http://uminac.com/2008/08/06/stopping-ssh-spam-with-pf/</link>
		<comments>http://uminac.com/2008/08/06/stopping-ssh-spam-with-pf/#comments</comments>
		<pubDate>Wed, 06 Aug 2008 20:09:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[bots]]></category>
		<category><![CDATA[pf]]></category>
		<category><![CDATA[spam]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://www.uminac.com/?p=51</guid>
		<description><![CDATA[If you&#8217;ve put a server accepting SSH connections on the internet you&#8217;ve probably noticed a TON of failed login attempts from various IP addresses and various (seemingly generic) usernames.  If not, you probably should have, and you may not be up to running a server if you don&#8217;t look at logs from time to time. [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve put a server accepting SSH connections on the internet you&#8217;ve probably noticed a TON of failed login attempts from various IP addresses and various (seemingly generic) usernames.  If not, you probably should have, and you may not be up to running a server if you don&#8217;t look at logs from time to time.</p>
<p>Either way, there&#8217;s a quick &amp; easy way to try to stop these annoying bots or whatever they are from bugging your server with PF.  Basically, on your rule where you pass SSH connections in through the firewall you can set a &#8216;max-src-conn-rate&#8217; or maximum source connection rate.  What this does is triggers something to happen when a host connects faster than a certain rate of allowed new connections.  In our case we&#8217;ll want to dump these users into a table that blocks everything from them.  So we create the table:</p>
<pre>table &lt;ssh-bruteforce&gt; persist</pre>
<p>The rule to drop people who are clearly spamming into our ssh-bruteforce table is:</p>
<pre>pass in on $ext_if inet proto tcp from any to any port ssh flags S/SA keep state (max-src-conn-rate 4/30, overload &lt;ssh-bruteforce&gt; flush global)</pre>
<p>Where the connection rate is 4 connections in 30 seconds (4/30).  From this point on, you just want to block them.  You can do that with:</p>
<pre>block in log quick on $ext_if from &lt;ssh-bruteforce&gt;</pre>
<p>Now anybody who tries to esablish connections faster than the rate specified in the pass rule gets dumped into that table, and blocked from accessing anything at all on your server.  <img src='http://uminac.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a title="Matt Horan!!!!!" href="http://matthoran.com/" target="_blank">mhoran</a>++</p>
]]></content:encoded>
			<wfw:commentRss>http://uminac.com/2008/08/06/stopping-ssh-spam-with-pf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

