<?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>*.hosting &#187; FreeBSD</title>
	<atom:link href="http://www.stardothosting.com/blog/category/freebsd/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stardothosting.com/blog</link>
	<description>Star Dot Hosting : Technology, Security, Virtualization and Cloud Computing</description>
	<lastBuildDate>Wed, 16 May 2012 19:07:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Centralized remote backup script with SSH key authentication</title>
		<link>http://www.stardothosting.com/blog/2011/02/09/centralized-remote-backup-script-with-ssh-key-authentication/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=centralized-remote-backup-script-with-ssh-key-authentication</link>
		<comments>http://www.stardothosting.com/blog/2011/02/09/centralized-remote-backup-script-with-ssh-key-authentication/#comments</comments>
		<pubDate>Wed, 09 Feb 2011 20:26:39 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell Scripting]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[centralized]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[systems administration]]></category>

		<guid isPermaLink="false">http://blog.stardothosting.com/?p=427</guid>
		<description><![CDATA[Greetings, It has been a while since we posted any useful tidbits for you , so we have decided to share one of our quick &#038; dirty centralized backup scripts. The script relies on ssh key based authentication, described here on this blog. It essentially parses a configuration file where each variable is separated by [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F02%2F09%2Fcentralized-remote-backup-script-with-ssh-key-authentication%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F02%2F09%2Fcentralized-remote-backup-script-with-ssh-key-authentication%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Greetings,</p>
<p>It has been a while since we posted any useful tidbits for you , so we have decided to share one of our quick &#038; dirty centralized backup scripts.</p>
<p>The script relies on ssh key based authentication, described <a href="http://blog.stardothosting.com/2009/12/07/script-to-distribute-ssh-keys-across-many-servers/">here</a> on this blog. It essentially parses a configuration file where each variable is separated by a comma and colon, as in the example config here :</p>
<pre>
hostname1,192.168.1.1,etc:var:root
hostname2,192.168.1.2,etc:var:root:usr
</pre>
<p>Note the intended backup directories in the 3rd variable, separated by colon&#8217;s. Simply populate the <b>backup-hosts.txt</b> config file (located in the same folder as the script) with all the hosts you want to be backed up. </p>
<p>The script then ssh&#8217;s to the intended host, and sends a tar -czf stream (securely) over ssh, to be output into the destination of your choice. Ideally you should centralize this script on a box that has direct access to alot of disk space.</p>
<p>Find the script here :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">#!/bin/sh<br />
# Centralized Linux Backup Script<br />
# By Star Dot Hosting , www.stardothosting.com<br />
# Uses SSH Key based authentication and remote ssh commands to tar.gz folders to iSCSI storage<br />
<br />
<br />
todaysdate=`date &quot;+%Y-%m-%d %H:%M:%S&quot;`<br />
backupdest=&quot;/backups/linux-backups&quot;<br />
<br />
echo &quot;Centralized Linux Backup: &quot; $todaysdate &gt; /var/log/linux-backup.log<br />
echo -e &quot;----------------------------------------------&quot; &gt;&gt; /var/log/linux-backup.log<br />
echo -e &gt;&gt; /var/log/linux-backup.log<br />
<br />
<br />
for obj0 in $(cat /usr/local/bin/backup-hosts.txt | grep -v &quot;\#&quot; | awk -F &quot;,&quot; '{printf &quot;%s\n&quot;, $2}');<br />
do<br />
&nbsp; &nbsp; &nbsp; &nbsp; backupname=`cat /usr/local/bin/backup-hosts.txt | grep -v &quot;\#&quot; | grep $obj0 | awk -F &quot;,&quot; '{printf &quot;%s\n&quot;, $1}'`<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; for obj1 in $(cat /usr/local/bin/backup-hosts.txt | grep -v &quot;\#&quot; | grep $obj0 | awk -F &quot;,&quot; '{printf &quot;%s\n&quot;, $3'} | awk '{gsub(&quot;:&quot;,&quot;\n&quot;);printf&quot;%s&quot;, $<br />
0}');<br />
&nbsp; &nbsp; &nbsp; &nbsp; do<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo -e &quot;backing up $obj0 with $obj1 directory&quot; &gt;&gt; /var/log/linux-backup.log<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ssh -l root $obj0 &quot;(cd /$obj1/ &amp;&amp; tar -czf - . -C /$obj1)&quot; &gt;&gt; $backupdest/$backupname.$obj1.tar.gz 2&gt;&amp;1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if [ &quot;$?&quot; -eq 1 ]<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo -e &quot;There were some errors while backing up $obj0 / $backupname within the $obj1 directory&quot; &gt;&gt; /var/log/linux-backup.log<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #exit 1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo -e &quot;Backup completed on $obj0 / $backupname while backing up $obj1 directory&quot; &gt;&gt; /var/log/linux-backup.log<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fi<br />
&nbsp; &nbsp; &nbsp; &nbsp; done<br />
done<br />
<br />
echo &quot;Backup Script Completed.&quot; &gt;&gt; /var/log/linux-backup.log<br />
cat /var/log/linux-backup.log | mail -s &quot;Centralized Backup Complete&quot; topsoperations@topscms.com</div></div>
<p>You could modify this script to keep different daily backups , pruned to keep only X number of days of backups (i.e. only 7 days worth). There is alot you can do here.</p>
<p>If you have a handful of linux or bsd servers that you would like to backup in a centralized location, without having an individual script to maintain on each server, then perhaps you could use or modify this script to suit your needs.</p>
<p>I hope this helps.</p>
<p><a class="a2a_button_digg" href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F02%2F09%2Fcentralized-remote-backup-script-with-ssh-key-authentication%2F&amp;linkname=Centralized%20remote%20backup%20script%20with%20SSH%20key%20authentication" title="Digg" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F02%2F09%2Fcentralized-remote-backup-script-with-ssh-key-authentication%2F&amp;linkname=Centralized%20remote%20backup%20script%20with%20SSH%20key%20authentication" title="Twitter" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a><a class="a2a_button_reddit" href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F02%2F09%2Fcentralized-remote-backup-script-with-ssh-key-authentication%2F&amp;linkname=Centralized%20remote%20backup%20script%20with%20SSH%20key%20authentication" title="Reddit" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a><a class="a2a_button_delicious" href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F02%2F09%2Fcentralized-remote-backup-script-with-ssh-key-authentication%2F&amp;linkname=Centralized%20remote%20backup%20script%20with%20SSH%20key%20authentication" title="Delicious" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a><a class="a2a_button_google_plusone addtoany_special_service" data-annotation="none" data-href="http://www.stardothosting.com/blog/2011/02/09/centralized-remote-backup-script-with-ssh-key-authentication/"></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F02%2F09%2Fcentralized-remote-backup-script-with-ssh-key-authentication%2F&amp;title=Centralized%20remote%20backup%20script%20with%20SSH%20key%20authentication" id="wpa2a_2"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.stardothosting.com/blog/2011/02/09/centralized-remote-backup-script-with-ssh-key-authentication/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Backup a live FreeBSD filesystem and remotely migrate to another server</title>
		<link>http://www.stardothosting.com/blog/2010/04/14/freebsd-backup-live-filesystem-and-remotely-migrate/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=freebsd-backup-live-filesystem-and-remotely-migrate</link>
		<comments>http://www.stardothosting.com/blog/2010/04/14/freebsd-backup-live-filesystem-and-remotely-migrate/#comments</comments>
		<pubDate>Wed, 14 Apr 2010 20:28:06 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[migration]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">http://blog.stardothosting.com/?p=302</guid>
		<description><![CDATA[Lately we&#8217;ve been all about live migrations / backups here at *.hosting. And why not? with the advent of such concepts as &#8220;self healing blade cloud environment&#8221; , we have made a point to testing / scripting live migration scenarios. Following on our last post of backing up LVM volumes, we have decided to make [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F04%2F14%2Ffreebsd-backup-live-filesystem-and-remotely-migrate%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F04%2F14%2Ffreebsd-backup-live-filesystem-and-remotely-migrate%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Lately we&#8217;ve been all about live migrations / backups here at *.hosting. And why not? with the advent of such concepts as &#8220;self healing blade cloud environment&#8221; , we have made a point to testing / scripting live migration scenarios.</p>
<p>Following on our last post of backing up LVM volumes, we have decided to make a simple post for &#8216;dumping&#8217; a live freebsd filesystem, compressing it mid-stream, and over the network (encrpyted through ssh of course) , before being saved as a file (or restored to a waiting live-cd mounted system).</p>
<p>By default in FreeBSD, it partitions your <b>var</b>, <b>usr</b>, <b>root</b directories. Ideally you should be backing these up into separate dump files. </p>
<p>Lets say, for the sake of argument, that your disk looks like this :</p>
<pre>
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/sd0s1a    989M    445M    465M    49%    /
/dev/sd0s1f    9.7G    5.2G    3.7G    59%    /usr
/dev/sd0s1e     19G    1.5G     16G     9%    /var
</pre>
<p>So lets dump the root partition since its the smallest :</p>
<pre>
dump -0uanL -f - /dev/sd0s1a | bzip2 | ssh user@0.0.0.0 "dd of=dump-root.bzip2"
</pre>
<p>Lets break down the options so you can fully understand what its doing :</p>
<p><b>-0</b> // dump level 0 = full backup<br />
<b>-u</b> // update the dumpdates file after a successful dump<br />
<b>-a</b> // bypass all tape length considerations; autosize<br />
<b>-n</b> // notify if attention is required<br />
<b>-L</b> // tell dump that it is a live filesystem for a consistent dump; it will take a snapshot</p>
<p>Alternatively you could dump the filesystem to a local file :</p>
<pre>
dump -0uanL -f - /dev/sd0s1a | bzip2 | dd of=/home/backups/dump-root.bzip2
</pre>
<p>If you wanted to dump from server1 and restore on server2 :</p>
<pre>
dump -0uanL -f - /dev/sd0s1a | ssh user@0.0.0.0 "restore rf -"
</pre>
<p>Again , this is a straightforward command. It is typically fast (within reason). You could script this for automated dumps/snapshots of your filesystem for full restores in a disaster scenario.</p>
<p><a class="a2a_button_digg" href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F04%2F14%2Ffreebsd-backup-live-filesystem-and-remotely-migrate%2F&amp;linkname=Backup%20a%20live%20FreeBSD%20filesystem%20and%20remotely%20migrate%20to%20another%20server" title="Digg" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F04%2F14%2Ffreebsd-backup-live-filesystem-and-remotely-migrate%2F&amp;linkname=Backup%20a%20live%20FreeBSD%20filesystem%20and%20remotely%20migrate%20to%20another%20server" title="Twitter" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a><a class="a2a_button_reddit" href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F04%2F14%2Ffreebsd-backup-live-filesystem-and-remotely-migrate%2F&amp;linkname=Backup%20a%20live%20FreeBSD%20filesystem%20and%20remotely%20migrate%20to%20another%20server" title="Reddit" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a><a class="a2a_button_delicious" href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F04%2F14%2Ffreebsd-backup-live-filesystem-and-remotely-migrate%2F&amp;linkname=Backup%20a%20live%20FreeBSD%20filesystem%20and%20remotely%20migrate%20to%20another%20server" title="Delicious" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a><a class="a2a_button_google_plusone addtoany_special_service" data-annotation="none" data-href="http://www.stardothosting.com/blog/2010/04/14/freebsd-backup-live-filesystem-and-remotely-migrate/"></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F04%2F14%2Ffreebsd-backup-live-filesystem-and-remotely-migrate%2F&amp;title=Backup%20a%20live%20FreeBSD%20filesystem%20and%20remotely%20migrate%20to%20another%20server" id="wpa2a_4"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.stardothosting.com/blog/2010/04/14/freebsd-backup-live-filesystem-and-remotely-migrate/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Migrate FreeBSD to Xen</title>
		<link>http://www.stardothosting.com/blog/2010/03/04/migrate-freebsd-to-xen/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=migrate-freebsd-to-xen</link>
		<comments>http://www.stardothosting.com/blog/2010/03/04/migrate-freebsd-to-xen/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 19:55:26 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Hosting]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[migration]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[xen]]></category>

		<guid isPermaLink="false">http://blog.stardothosting.com/?p=273</guid>
		<description><![CDATA[There seems to be a lot of tutorials with respect to how you can dump/restore FreeBSD implementations. However, none of them appear to be all encompassing what is actually required from <b>start to finish</b> during the entire process.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F03%2F04%2Fmigrate-freebsd-to-xen%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F03%2F04%2Fmigrate-freebsd-to-xen%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>There seems to be a lot of tutorials with respect to how you can dump/restore FreeBSD implementations. However, none of them appear to be all encompassing what is actually required from <b>start to finish</b> during the entire process.</p>
<p>The one thing that I think is lacking in proper documentation is utilizing FreeBSD in a LiveCD scenario (LiveFS) within a network capacity (necessary for migration).</p>
<p>We decided to write this tutorial so that people could have one place to establish all the necessary things required for this type of migration from start to finish.</p>
<p>In this scenario we actually migrated a FreeBSD implementation on VMWARE to XEN HVM. In the end, there were no technical problems with FreeBSD actually running after it was migrated &#8212; it ran beautifully actually.</p>
<p>I should note that this was tested with FreeBSD 7.2-RELEASE disc images. </p>
<p>Please find the guide below : </p>
<p><big><b><u>Prepare OLD Instance</big></b></u></p>
<p>1. Boot into old operating system</p>
<p>2. Take note of partition slices / slice names / sizes / etc</p>
<p>3. Reboot with FreeBSD LiveFS disc</p>
<p><big><b><u>Prepare NEW Xen</b></u></big></p>
<p>1. Boot Xen instance with FreeBSD Disc 1 ISO</p>
<p>2. Partition / install boot loader exactly the same slices as the old instance. To be extra careful, give your slices a bit more disc space than the old implementation.</p>
<p>3. Write changes &#038; reboot with FreeBSD LiveFS disc</p>
<p><big><b><u>Establish FreeBSD LiveFS environment</big></b></u></p>
<p>You need to establish a few things to get SSH / DUMP / RESTORE to work properly on both the &#8221;&#8217;old&#8221;&#8217; and &#8221;&#8217;new&#8221;&#8217; instances</p>
<p>1. Boot into FreeBSD LiveFS (Fixit > livefs)</p>
<p>2. Create the following folders :</p>
<pre>
/etc/ssh
/usr/sbin
/usr/bin
/root
/root/.ssh
</pre>
<p>3. Copy the following files :</p>
<pre>
cp /mnt2/bin/ps /bin
cp /mnt2/sbin/sysctl /sbin
cp /mnt2/etc/ssh/* /etc/ssh
cp /mnt2/bin/csh /bin
cp /mnt2/bin/cat > /bin
cp /mnt2/sbin/restore > /sbin
</pre>
<p>4. Set an IP address on both old and new instances:</p>
<p>new :</p>
<pre>ifconfig eth0 10.0.0.50 netmask 255.255.255.0</pre>
<p>old :</p>
<pre>ifconfig eth0 10.0.0.60 netmask 255.255.255.0</pre>
<p>5. Start sshd :</p>
<pre>
/mnt2/etc/rc.d/sshd forcestart
</pre>
<p><big><b><u>Start transferring slices</big></u></b></p>
<p>1. To allow for transferring of partitions properly, the /tmp partition should be mounted on the new Xen instance :</p>
<pre>mount -t ufs /dev/ad0s1e /tmp</pre>
<p>2. For the first partition you wish to transfer, mount the empty slice on the new xen instance :</p>
<pre>mount -t ufs /dev/ad0s1a /mnt/ufs.1</pre>
<p>Sometimes you have to fsck mark the filesystem clean to mount it :</p>
<pre>fsck /dev/ad0s1a</pre>
<p>3. On the old instance :</p>
<pre>dump -0aLf - /dev/ad0s1a | ssh 10.0.0.50 "cd /mnt/ufs.1 &#038;&#038; cat | restore -rf -"</pre>
<p>That should dump/restore the slice from old > new.</p>
<p><big><b><u>Final things on the new Xen instance</big></b></u></p>
<p>Dont forget to boot the new instance in single user mode and modify &#8221;&#8217;fstab&#8221;&#8217; to reflect the new slice names (if applicable), as well as &#8221;&#8217;rc.conf&#8221;&#8217; for any hard coded interface names, etc. FreeBSD won&#8217;t boot if the right slice names / interface names aren&#8217;t present. Or at least cause problems. </p>
<p>You can mount the /etc slice while still in the LiveFS for the new FreeBSD instance.</p>
<p>Hopefully this was helpful! Obviously this has nothing to do with Xen, other than the fact that we were migrating the FreeBSD vmware instance to Xen. </p>
<p>You can do this on &#8220;real&#8221; machines, or from xen to vmware or anywhere. As long as the hardware is compatible.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stardothosting.com/blog/2010/03/04/migrate-freebsd-to-xen/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>ProFTPD with MySQL Authentication</title>
		<link>http://www.stardothosting.com/blog/2009/11/02/proftpd-with-mysql-authentication/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=proftpd-with-mysql-authentication</link>
		<comments>http://www.stardothosting.com/blog/2009/11/02/proftpd-with-mysql-authentication/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 15:24:35 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[proftpd]]></category>

		<guid isPermaLink="false">http://blog.stardothosting.com/?p=231</guid>
		<description><![CDATA[Since this setup uses one FTP account to create user home directories and upload files, a compromise to this FTP user would cause the attacker to gain access to all FTP user home directories. ]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2009%2F11%2F02%2Fproftpd-with-mysql-authentication%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2009%2F11%2F02%2Fproftpd-with-mysql-authentication%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Since this setup uses one FTP account to create user home directories and upload files, a compromise to this FTP user would cause the attacker to gain access to all FTP user home directories. I guess it just depends on how much you trust the DefaultRoot directive in Proftpd. I run Proftpd in its own chroot environment in addition to using DefaultRoot, so I&#8217;m used to feeling pretty safe with my Proftpd install. Anyway, here&#8217;s how I did the install/configuration</p>
<p>1. install proftpd-mysql from the ports with WITH_QUOTA set:</p>
<pre>
cd /usr/ports/ftp/proftpd-mysql/
env WITH_QUOTA=yes make
env WITH_QUOTA=yes make install
</pre>
<p>2. Add the global proftpd user &#038; Proftpd group to your system.</p>
<p>I used uid &#038; gid 5500 simply because that&#8217;s what was used at one of the sites I was referencing (listed below).</p>
<pre>
pw groupadd -n Proftpd -g 5500
pw useradd proftpd -u 5500 -g Proftpd -s /sbin/nologin -d /dev/null -c "Proftpd User"
</pre>
<p>3. Create the mySQL database</p>
<pre>
create database proftpd;
grant all on proftpd.* to 'proftpd'@'localhost' identified by 'password'
</pre>
<p>( change &#8216;password&#8217; to something secret! )</p>
<p>4. Create the mySQL tables for the users &#038; quota</p>
<pre>
create table proftpdUsers (

sqlUID int unsigned auto_increment not null,
userName varchar(30) not null unique,
passwd varchar(80) not null,
uid int unsigned not null unique,
gid int unsigned not null,
homedir tinytext,
shell tinytext,
primary key(sqlUID)

) ;

create table proftpdGroups (

sqlGID int unsigned auto_increment not null,
groupName varchar(30) not null unique,
gid int unsigned not null unique,
members tinytext,
primary key(sqlGID)
);

CREATE TABLE proftpdQuotaLimits (
name VARCHAR(30),
quota_type ENUM("user", "group", "class", "all") NOT NULL,
per_session ENUM("false", "true") NOT NULL,
limit_type ENUM("soft", "hard") NOT NULL,
bytes_in_avail FLOAT NOT NULL,
bytes_out_avail FLOAT NOT NULL,
bytes_xfer_avail FLOAT NOT NULL,
files_in_avail INT UNSIGNED NOT NULL,
files_out_avail INT UNSIGNED NOT NULL,
files_xfer_avail INT UNSIGNED NOT NULL
);

CREATE TABLE proftpdQuotaTallies (
name VARCHAR(30) NOT NULL,
quota_type ENUM("user", "group", "class", "all") NOT NULL,
bytes_in_used FLOAT NOT NULL,
bytes_out_used FLOAT NOT NULL,
bytes_xfer_used FLOAT NOT NULL,
files_in_used INT UNSIGNED NOT NULL,
files_out_used INT UNSIGNED NOT NULL,
files_xfer_used INT UNSIGNED NOT NULL
);
</pre>
<p>5. Add a test user to the proftpd database</p>
<p>(assumes /home/ftp is where you keep your ftp users. Otherwise, change the homedir location). This is certainly not a necessary step, but you should probably check to see if your configuration is working. You can delete this user later.</p>
<pre>
insert into proftpdUsers values ( 0, 'test', 'test', 5500, 5500, '/home/ftp/test', '/sbin/nologin' );
</pre>
<p>6. Set your proftpd configuration to use the mySQL authentication and quotas:</p>
<p>(NOTE: this is not a complete configuration file, it&#8217;s basically just the default config file with mySQL auth &#038; quotas added, but note that the User and Group directives are the user &#038; group we added in step 2. )</p>
<pre>
MaxInstances 30

# Set the user and group under which the server will run.
User proftpd
Group Proftpd

# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
DefaultRoot ~

# Normally, we want files to be overwriteable.
AllowOverwrite on

# Bar use of SITE CHMOD by default
<Limit SITE_CHMOD>
DenyAll
</Limit>

# Log format and location
LogFormat               default "%t %h %a %s %m %f %b %T \"%r"\"
ExtendedLog             /var/log/proftpd.log ALL default
SystemLog               /var/log/proftpd.log ALL default
TransferLog             /var/log/proftpd.log ALL default

# Uncomment this if you have "invalid shell" errors in your proftpd.log
#RequireValidShell       off

# The passwords in MySQL are encrypted using CRYPT
SQLAuthTypes Plaintext Crypt
SQLAuthenticate users* groups*

# used to connect to the database
# databasename@host database_user user_password
SQLConnectInfo proftpd@localhost proftpd yourdatabasepassword

# Here we tell ProFTPd the names of the database columns in the "usertable"
# we want it to interact with. Match the names with those in the db
SQLUserInfo proftpdUsers userName passwd uid gid homedir shell

# Here we tell ProFTPd the names of the database columns in the "grouptable"
# we want it to interact with. Again the names match with those in the db
SQLGroupInfo proftpdGroups groupName gid members

# set min UID and GID - otherwise these are 999 each
SQLMinID 5000

#============
# User quotas
# ===========
QuotaEngine on
QuotaDirectoryTally on
QuotaDisplayUnits Mb
QuotaShowQuotas on

# create a user's home directory on demand if it doesn't exist
SQLHomedirOnDemand on

SQLNamedQuery get-quota-limit SELECT "name, quota_type, per_session, limit_type, bytes_in_avail, bytes_out_avail, bytes_xfer_avail, files_in_avail, files_out_avail, files_xfer_avail FROM proftpdQuotaLimits WHERE name = '%{0}' AND quota_type = '%{1}'"

SQLNamedQuery get-quota-tally SELECT "name, quota_type, bytes_in_used, bytes_out_used, bytes_xfer_used, files_in_used, files_out_used, files_xfer_used FROM proftpdQuotaTallies WHERE name = '%{0}' AND quota_type = '%{1}'"

SQLNamedQuery update-quota-tally UPDATE "bytes_in_used = bytes_in_used + %{0}, bytes_out_used = bytes_out_used + %{1}, bytes_xfer_used = bytes_xfer_used + %{2}, files_in_used = files_in_used + %{3}, files_out_used = files_out_used + %{4}, files_xfer_used = files_xfer_used + %{5} WHERE name = '%{6}' AND quota_type = '%{7}'" proftpdQuotaTallies

SQLNamedQuery insert-quota-tally INSERT "%{0}, %{1}, %{2}, %{3}, %{4}, %{5}, %{6}, %{7}" proftpdQuotaTallies

QuotaLimitTable sql:/get-quota-limit
QuotaTallyTable sql:/get-quota-tally/update-quota-tally/insert-quota-tally
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.stardothosting.com/blog/2009/11/02/proftpd-with-mysql-authentication/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Shell Script to Report On Hacking Attempts</title>
		<link>http://www.stardothosting.com/blog/2009/08/12/freebsd-pf-packet-filter-shell-script-to-report-on-hacking-attempts/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=freebsd-pf-packet-filter-shell-script-to-report-on-hacking-attempts</link>
		<comments>http://www.stardothosting.com/blog/2009/08/12/freebsd-pf-packet-filter-shell-script-to-report-on-hacking-attempts/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 13:59:34 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[alerting]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://blog.stardothosting.com/?p=173</guid>
		<description><![CDATA[It is always a good idea , when implementing open source firewall implementations (iptables, pf, etc), to build in as much reporting and verbosity as possible. Somewhere along the line, we wrote a script to provide daily reports on intrusion attempts to penetrate our network -- this usually happens when someone exceeds certain connection thresholds.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2009%2F08%2F12%2Ffreebsd-pf-packet-filter-shell-script-to-report-on-hacking-attempts%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2009%2F08%2F12%2Ffreebsd-pf-packet-filter-shell-script-to-report-on-hacking-attempts%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>It is always a good idea , when implementing open source firewall implementations (<a href="http://www.netfilter.org/" target="_new">iptables</a>, <a href="http://www.openbsd.org/faq/pf/" target="_new">pf</a>, etc), to build in as much reporting and verbosity as possible. </p>
<p>Having verbose reports on the state of your firewall, intrusion attempts and other information is key to ensuring the health and integrity of your network.</p>
<p>Somewhere along the line, we <a href="http://bash.cyberciti.biz/firewall/bsd-spamhaus-lasso-spam-database-update-pf-firewall/" target="_new">wrote a script</a> to provide daily reports on intrusion attempts to penetrate our network &#8212; this usually happens when someone exceeds certain connection thresholds.</p>
<p>It may not be the most informative data, but the script can be modified to provide other important statistical information. It can also be modified to be used with other <a href="http://www.pfsense.com/" target="new">firewall implementations</a>. I&#8217;m certain it wouldn&#8217;t be hard to convert this script to <a href="http://www.howtoforge.com/bash-script-for-configuring-iptables-firewall" target="_new">utilise iptables</a>.</p>
<p>Below you will find the script itself &#8212; it can be set to run daily as a cronjob perhaps. Also note that the script tries to resolve a hostname for the IP address to at least provide some quick &#038; easy information to the security administrators when determining coordinated attacks or attacks coming from compromised systems.</p>
<pre>
#!/bin/bash
# SDH PFCTL Daily Hack Table check

yesterday1=`date -v -1d +"%b"`
yesterday2=`date -v -1d +"%e"`
yesterday_display=`date -v -1d +"%b %d %Y"`

echo "" > /var/log/tablecheck.log

/sbin/pfctl -vvsTables > /var/log/pfctltables.log

echo "Firewall Table Audit: " $yesterday_display >> /var/log/tablecheck.log
echo -e "----------------------------------">> /var/log/tablecheck.log
echo -e "" >> /var/log/tablecheck.log

for obj0 in $(cat /var/log/pfctltables.log | grep "\-pa\-r\-" | awk -F "\t" '{printf "%s\n", $2}');
do
echo -e $obj0 "TABLE" >> /var/log/tablecheck.log
echo -e "--------------" >> /var/log/tablecheck.log

# this is because the date command outputs single digit non-aligned right, but pfctl doesnt display that way <img src='http://www.stardothosting.com/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />
if [ "$yesterday2" -le 9 ]
then
        /sbin/pfctl -t $obj0 -Tshow -vv | grep -A 4 -B 1 "$yesterday1  $yesterday2" >> /var/log/tablecheck.log 2>&#038;1
else
        /sbin/pfctl -t $obj0 -Tshow -vv | grep -A 4 -B 1 "$yesterday1 $yesterday2" >> /var/log/tablecheck.log 2>&#038;1
fi

if [ "$?" -eq 1 ]
then
        echo -e "No values found for yesterday" >> /var/log/tablecheck.log
        echo -e "" >> /var/log/tablecheck.log
else
        echo -e "Hostnames :" >> /var/log/tablecheck.log
        for obj1 in $(/sbin/pfctl -t $obj0 -Tshow -vv | grep -B 1 "$yesterday1 $yesterday2" | grep -v "Cleared" | grep -v "\-\-");
        do
        iphostnm=`/usr/bin/nslookup $obj1 | grep -A1 "Non-authoritative answer" | grep "name" | awk -F "=" '{printf "%s\n", $2}'`
        if [ "$?" -eq 0 ]
        then
                echo -e "$obj1 / $iphostnm" >> /var/log/tablecheck.log
        else
                echo -e "$obj1 / No host name found" >> /var/log/tablecheck.log
        fi
        done
       echo -e "" >> /var/log/tablecheck.log
fi

done

cat /var/log/tablecheck.log | mail -s "Firewall Table Report" you@youremail.com
</pre>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stardothosting.com/blog/2009/08/12/freebsd-pf-packet-filter-shell-script-to-report-on-hacking-attempts/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Creating a FreeBSD wireless access point</title>
		<link>http://www.stardothosting.com/blog/2009/04/28/creating-a-freebsd-wireless-access-point/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=creating-a-freebsd-wireless-access-point</link>
		<comments>http://www.stardothosting.com/blog/2009/04/28/creating-a-freebsd-wireless-access-point/#comments</comments>
		<pubDate>Tue, 28 Apr 2009 17:48:01 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[access point]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[wireless]]></category>

		<guid isPermaLink="false">http://blog.stardothosting.com/?p=33</guid>
		<description><![CDATA[To set up a wireless access point using FreeBSD, you need to have a compatible wireless card. We are using a Prism 2-based chipset. For a complete list of cards that are supported, consult the man page for wi, or visit the Wireless Network Interface Section of the FreeBSD documentation site.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2009%2F04%2F28%2Fcreating-a-freebsd-wireless-access-point%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2009%2F04%2F28%2Fcreating-a-freebsd-wireless-access-point%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><a href="http://en.wikipedia.org/wiki/Wireless_access_point" target="_new">Access points</a> are essentially wireless <a href="http://www.cisco.com/en/US/products/hw/switches/" target="_new">switches</a> or <A href="http://www.netgear.com/" target="_new">hubs</a>. Just like a switch or a hub, all clients communicate through the access point. FreeBSD allows us to easily create an access point with just very little configuration and just the right hardware</p>
<p>To set up a wireless access point using FreeBSD, you need to have a compatible wireless card. We are using a Prism 2-based chipset. For a complete list of cards that are supported, consult the man page for wi, or visit the Wireless Network Interface Section of the FreeBSD documentation site.</p>
<li>
<ul>
<strong>Configuring the kernel</strong></ul>
</li>
<p>Depending on how you wish to set up the access point will determine what options need to be added to the <a href="http://www.freebsd.org/doc/en/books/handbook/kernelconfig.html" target="_new">kernel config</a> file. If the wireless network device is being installed on a server that is currently running as a <a href="http://www.freebsd.org/doc/en/books/handbook/firewalls-pf.html" target="_new">Firewall/NAT</a>, then we only need to compile the wireless device driver into the kernel:</p>
<p><strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># Wireless NIC cards<br />
device &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;wlan &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# 802.11 support<br />
device &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;an &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# Aironet 4500/4800 802.11 wireless NICs.<br />
device &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;awi &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # BayStack 660 and others<br />
device &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;wi &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# WaveLAN/Intersil/Symbol 802.11 wireless NICs.<br />
device &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;wl &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# Older non 802.11 Wavelan wireless NIC.</div></div>
<p></strong></p>
<p>Choose the appropriate driver for your card from the list and include the wlan device, then recompile and install your kernel.</p>
<p>If this the wireless network device is going to be installed on a system that does not serve as a Firewall/NAT, then we would want to include the BRIDGE option, along with the appropriate wireless device driver in the kernel config file.</p>
<p><strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># Ethernet bridging support<br />
option&nbsp; &nbsp; &nbsp; BRIDGE<br />
<br />
# Wireless NIC cards<br />
device &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;wlan &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# 802.11 support<br />
device &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;an &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# Aironet 4500/4800 802.11 wireless NICs.<br />
device &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;awi &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # BayStack 660 and others<br />
device &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;wi &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# WaveLAN/Intersil/Symbol 802.11 wireless NICs.<br />
device &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;wl &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# Older non 802.11 Wavelan wireless NIC.</div></div>
<p></strong></p>
<p>The bridging option will allow the wireless device to communicate with the wired ethernet interface. We must also add a couple of options to the /etc/sysctl.conf file in order to establish the bridge between the two interfaces:</p>
<p><strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">net.inet.ip.forwarding=1<br />
net.link.ether.bridge.enable=1<br />
net.link.ether.bridge.config=wi0,fxp0</div></div>
<p></strong></p>
<p>Be sure and replace fxp0 with whatever wired ethernet interface you are using with your FreeBSD installation. For information on bridging, consult the Bridging Section of the FreeBSD Handbook.</p>
<ul>
<strong>Configuring the Wireless Interface</strong></ul>
<p>The configuration of the wireless interface is fairly straightforward, we just need to add a few more options than if it were a wired ethernet interface. The following is an example of ifconfig options for a wireless interface:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;strong&gt;ifconfig wi0 inet 10.0.0.5 netmask 255.255.255.0 <br />
ifconfig wi0 ssid My_Network channel 11 media DS/11Mbps mediaopt hostap up stationname &quot;My Network&quot;&lt;/strong&gt;</div></div>
<p>Of course this can all be setup in the /etc/rc.conf file so that these settings are retained every time the system boots. From this point, your access point should be up and broadcasting. There are just a couple more options to consider</p>
<ul>
<strong>Post Configuration</strong></ul>
<p>As stated earlier, if the wireless interface is installed in a server that is functioning as a Firewall/NAT, then the bridging option is unecessary. We just need to add a couple of rules to our firewall configuration files to allow traffic to be passed from the wireless interface.</p>
<p>If you are using PF as your Firewall/NAT solution, simply add the following lines to your /etc/pf.conf file<br />
<strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">pass in on wi0 from wi0:network to any keep state<br />
pass out on wi0 from any to $wi0:network keep state</div></div>
<p></strong></p>
<p>Replace wi0 with the appropriate interface name of your wireless card</p>
<p>If you are using IPfilter as your Firewall/NAT solution, then simply add the following lines to your /etc/ipf.rules file</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;strong&gt;pass in on wi0 from any to any keep state<br />
pass out on wi0 from any to any keep state&lt;/strong&gt;</div></div>
<p>Again, replace wi0 with the appropriate interface name of your wireless card.</p>
<ul>
<strong>Administration</strong></ul>
<p>Once the access point is configured and operational, we will want to see the clients that are associated with the access point. We can type the following command to get this information:</p>
<p><strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root@host# wicontrol -l<br />
1 station:<br />
ap[0]:<br />
&nbsp; &nbsp; &nbsp; &nbsp; netname (SSID): &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [ My_Network ]<br />
&nbsp; &nbsp; &nbsp; &nbsp; BSSID: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[ 00:04:23:60:89:d9 ]<br />
&nbsp; &nbsp; &nbsp; &nbsp; Channel: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[ 11 ]<br />
&nbsp; &nbsp; &nbsp; &nbsp; Quality/Signal/Noise [signal]: &nbsp;[ 0 / 51 / 0 ]<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [dBm]: &nbsp;[ 0 / -98 / -149 ]<br />
&nbsp; &nbsp; &nbsp; &nbsp; BSS Beacon Interval [msec]: &nbsp; &nbsp; [ 10 ]<br />
&nbsp; &nbsp; &nbsp; &nbsp; Capinfo: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[ ESS ]</div></div>
<p></strong></p>
<p>Now you should have a complete functioning access point up and running. You are encouraged to read more about the wicontrol and wi commands for further information. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.stardothosting.com/blog/2009/04/28/creating-a-freebsd-wireless-access-point/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dual Monitors in FreeBSD</title>
		<link>http://www.stardothosting.com/blog/2009/04/22/dual-monitors-in-freebsd/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=dual-monitors-in-freebsd</link>
		<comments>http://www.stardothosting.com/blog/2009/04/22/dual-monitors-in-freebsd/#comments</comments>
		<pubDate>Wed, 22 Apr 2009 19:54:35 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[dual monitors]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[workstation]]></category>
		<category><![CDATA[xserver]]></category>

		<guid isPermaLink="false">http://blog.stardothosting.com/?p=10</guid>
		<description><![CDATA[One of the headaches I've encountered is trying to get my Dual monitors working with my Ati/Radeon video card in FreeBSD. I've written a little tutorial to help those who may need help or are thinking of implementing a second monitor.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2009%2F04%2F22%2Fdual-monitors-in-freebsd%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2009%2F04%2F22%2Fdual-monitors-in-freebsd%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>To those (few) of you out there that actually use <a href="http://www.freebsd.org" target="_new">FreeBSD</a> <a href="http://www.onlamp.com/pub/a/bsd/2002/09/05/FreeBSD_Basics.html" target="_new">as a workstation</a> (myself included) , you may have had the opportunity to utilize dual monitors.</p>
<p>As a Systems Administrator who is usually working on 3-4 things simultaneously , it is crucial to be able to function with enough screen space.</p>
<p>One of the headaches I&#8217;ve encountered is trying to get my Dual monitors working with my Ati/Radeon video card in FreeBSD. I&#8217;ve written a little tutorial to help those who may need help or are thinking of implementing a second monitor.</p>
<p>I found out my video driver and pci configuration by executing the following commands :</p>
<pre><strong>X -configure
</strong></pre>
<pre><strong>pciconf -l</strong></pre>
<p>I entered the following as my xorg.conf (ATI / RADEON video driver):</p>
<pre><strong>Section "Files"
    RgbPath     "/usr/X11R6/lib/X11/rgb"
    FontPath   "/usr/X11R6/lib/X11/fonts/misc/"
    FontPath   "/usr/X11R6/lib/X11/fonts/TTF/"
    FontPath   "/usr/X11R6/lib/X11/fonts/Type1/"
    FontPath   "/usr/X11R6/lib/X11/fonts/75dpi/"
    FontPath   "/usr/X11R6/lib/X11/fonts/100dpi/"
    FontPath   "/usr/X11R6/lib/X11/fonts/local/"
EndSection

Section "Module"
        Load    "GLcore"
        Load    "i2c"
        Load    "bitmap"
        Load    "ddc"
        Load    "dri"
        Load    "extmod"
        Load    "freetype"
        Load    "glx"
        Load    "int10"
        Load    "type1"
        Load    "vbe"
EndSection

Section "InputDevice"
        Identifier      "Generic Keyboard"
        Driver          "kbd"
EndSection

Section "InputDevice"
        Identifier  "Configured Mouse"
        Driver      "mouse"
        Option      "Protocol" "auto"
        Option      "Device" "/dev/sysmouse"
        Option      "ZAxisMapping" "4 5 6 7"
EndSection

Section "Device"
        Identifier      "ATI Technologies, Inc. Radeon 9600 (R300 AP)"
        Driver          "ati"
        BusID           "PCI:1:0:0"
Option "MergedFB" "true" #Enable MergedFB function
 Option "MonitorLayout" "TMDS, CRT" # Use LCD and CRT even if you have 2 LCD's or CRT's
 Option "OverlayOnCRTC2" "true"
 Option "CRT2Position" "LeftOf" #Physical location of your secondary monitor in relationship to your primary monitor.
 Option "MetaModes" "1280x1024-1280x1024" #Monitor Resolutions for Primary-Secondary monitors
Option "MergedXineramaCRT2IsScreen0" "true" #determines which screen is going to be the primary screen; value can be "true" or "false
EndSection

Section "Monitor"
        Identifier      "Monitor gen'erico"
        Option          "DPMS"
        HorizSync       28-64
        VertRefresh     43-60
EndSection
Section "Screen"
        Identifier      "Default Screen"
        Device          "ATI Technologies, Inc. Radeon 9600 (R300 AP)"
        Monitor         "Monitor gen'erico"
        DefaultDepth    24
        SubSection "Display"
                Depth           1
                Modes           "1280x960" "1024x768" "800x600" "640x480"
        EndSubSection
        SubSection "Display"
                Depth           4
                Modes           "1280x960" "1024x768" "800x600" "640x480"
        EndSubSection
        SubSection "Display"
                Depth           8
                Modes           "1280x960" "1024x768" "800x600" "640x480"
        EndSubSection
        SubSection "Display"
                Depth           15
                Modes           "1280x960" "1024x768" "800x600" "640x480"
        EndSubSection
        SubSection "Display"
                Depth           16
                Modes           "1280x960" "1024x768" "800x600" "640x480"
        EndSubSection
        SubSection "Display"
                Depth           24
                Modes           "1280x1024" "1280x960" "1024x768" "800x600" "640x480"
                Virtual     2624 1200
        EndSubSection
EndSection

Section "ServerLayout"
        Identifier      "Default Layout"
        Screen          "Default Screen"
        InputDevice     "Generic Keyboard"
        InputDevice     "Configured Mouse"
EndSection

Section "DRI"
        Mode    0666
EndSection</strong></pre>
<p>Starting <a href="http://en.wikipedia.org/wiki/KDE3" target="_new">KDE</a> / Xorg initially displays two identical monitors. You need to use the &#8220;xrandr&#8221; utility to utilize the dual monitor configuration. The following script, when run after starting KDE will do this for you :</p>
<pre><strong>#!/bin/sh
xrandr --output DVI-1 --auto --output DVI-0 --auto --left-of DVI-1</strong></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.stardothosting.com/blog/2009/04/22/dual-monitors-in-freebsd/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Optimizing the FreeBSD kernel</title>
		<link>http://www.stardothosting.com/blog/2009/04/21/optimizing-the-freebsd-kernel/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=optimizing-the-freebsd-kernel</link>
		<comments>http://www.stardothosting.com/blog/2009/04/21/optimizing-the-freebsd-kernel/#comments</comments>
		<pubDate>Wed, 22 Apr 2009 03:08:25 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[optiimization]]></category>

		<guid isPermaLink="false">http://blog.stardothosting.com/?p=6</guid>
		<description><![CDATA[Without getting into too much detail, here are several things that we usually "omit" from the kernel options during make buildworld / buildkernel to provide for a 60-70% kernel footprint reduction]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2009%2F04%2F21%2Foptimizing-the-freebsd-kernel%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2009%2F04%2F21%2Foptimizing-the-freebsd-kernel%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Often we are asked by <a href="http://www.stardothosting.com/linux-vps-hosting" target="_new">VPS clients</a> utilizing the <a href="http://www.freebsd.org" target="_new">FreeBSD</a> operating system, how can they trim down the kernel in order to utilize the full memory footprint potential.</p>
<p>Without getting into too much detail, here are several things that we usually &#8220;omit&#8221; from the kernel options during make buildworld / buildkernel to provide for a 60-70% kernel footprint reduction in 7.1-PRERELEASE :</p>
<p><strong>makeoptions     DEBUG=-g                # Build kernel with gdb(1) debug symbols<br />
options         MSDOSFS                 # MSDOS Filesystem<br />
</strong></p>
<p><strong># Wireless NIC cards<br />
device          wlan            # 802.11 support<br />
device          wlan_wep        # 802.11 WEP support<br />
device          wlan_ccmp       # 802.11 CCMP support<br />
device          wlan_tkip       # 802.11 TKIP support<br />
device          wlan_amrr       # AMRR transmit rate control algorithm<br />
device          wlan_scan_ap    # 802.11 AP mode scanning<br />
device          wlan_scan_sta   # 802.11 STA mode scanning<br />
device          an              # Aironet 4500/4800 802.11 wireless NICs.<br />
device          ath             # Atheros pci/cardbus NIC&#8217;s<br />
device          ath_hal         # Atheros HAL (Hardware Access Layer)<br />
device          ath_rate_sample # SampleRate tx rate control for ath<br />
device          awi             # BayStack 660 and others<br />
device          ral             # Ralink Technology RT2500 wireless NICs.<br />
device          wi              # WaveLAN/Intersil/Symbol 802.11 wireless NICs.<br />
#device         wl              # Older non 802.11 Wavelan wireless NIC.</strong></p>
<p><strong></strong></p>
<p><strong>device          ural            # Ralink Technology RT2500USB wireless NICs<br />
device          rum             # Ralink Technology RT2501USB wireless NICs</strong></p>
<p>You can remove more ,but that should reduce your kernel size significantly. You should be able to recompile the kernel as per the <a href="http://www.freebsd.org/doc/en/books/handbook/makeworld.html" target="_new">FreeBSD documentation</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.stardothosting.com/blog/2009/04/21/optimizing-the-freebsd-kernel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

