<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
<channel><generator>http://textpattern.com/?v=4.2.0</generator>
<title>BSD Based</title>
<link>http://bsdbased.com/</link>

<description>FreeBSD from a hosting point of view</description>
<pubDate>Mon, 23 Aug 2010 23:30:46 GMT</pubDate>

<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/BSDBased" /><feedburner:info uri="bsdbased" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item><title>Firewall for VMware vSphere virtual machines [10]</title>
<description>&lt;p&gt;We have been using VMware vSphere in an environment where VM admins are not to be trusted as they are only customers who purchase resources from us. It might happen that they use their virtual machine and the assigned public IPv4 address to spoof network packets, share illegal materials over various P2P networks or attack other VM guests locally.&lt;br /&gt;
VMware offers no solutions for the above problems, the assumption is that &lt;span class="caps"&gt;ESX&lt;/span&gt; hosts are supposed to be inside of a protected corporate environment. Networking is done via virtual switches which only implement little network security.&lt;/p&gt;

	&lt;p&gt;&lt;strong&gt;What we need to prevent:&lt;/strong&gt;
	&lt;ul&gt;
		&lt;li&gt;&lt;span class="caps"&gt;MAC&lt;/span&gt;, IP spoofing&lt;/li&gt;
		&lt;li&gt;Illegal P2P traffic&lt;/li&gt;
		&lt;li&gt;Illegal &lt;span class="caps"&gt;SMTP&lt;/span&gt; traffic (spam relays, etc)&lt;/li&gt;
	&lt;/ul&gt;&lt;/p&gt;

	&lt;p&gt;&lt;strong&gt;What we already have:&lt;/strong&gt;
	&lt;ul&gt;
		&lt;li&gt;Forged transmit protection: VMware knows the &lt;span class="caps"&gt;MAC&lt;/span&gt; addresses associated to the network interfaces of the VM, so it can drop packets with forged source addresses. (Doesn&amp;#8217;t protect against IP spoofing)&lt;/li&gt;
	&lt;/ul&gt;&lt;/p&gt;

	&lt;p&gt;&lt;strong&gt;What we did:&lt;/strong&gt;&lt;br /&gt;
We created a small virtual machine where we installed OpenWrt, a small yet efficient Linux based firewall/router solution for embedded systems. &lt;/p&gt;

	&lt;p&gt;The VM parameters were:&lt;/p&gt;

	&lt;p&gt;&lt;span class="caps"&gt;CPU&lt;/span&gt;: 500mhz&lt;/p&gt;

	&lt;p&gt;&lt;span class="caps"&gt;RAM&lt;/span&gt;: 32MB&lt;/p&gt;

	&lt;p&gt;&lt;span class="caps"&gt;HDD&lt;/span&gt;: 64MB&lt;/p&gt;

	&lt;p&gt;Network interfaces: 2&lt;/p&gt;

	&lt;p&gt;The actual image only took 10MBs which already included every tool we needed.&lt;br /&gt;
Then we connected the interfaces between the VM and the outside network, and created a software bridge.&lt;/p&gt;

	&lt;p&gt;&lt;strong&gt;Benchmarking:&lt;/strong&gt;&lt;br /&gt;
We ran tests on an &lt;span class="caps"&gt;ESX&lt;/span&gt; server (4.0) with a quad core E5420 Xeon &lt;span class="caps"&gt;CPU&lt;/span&gt;.&lt;br /&gt;
Initiating a P2P network traffic from the protected VM resulted in 100% &lt;span class="caps"&gt;CPU&lt;/span&gt; pull for the bridge VM, the network troughput couldn&amp;#8217;t go any higher than 3.5MB/s. Increasing the &lt;span class="caps"&gt;CPU&lt;/span&gt; limit for the VM resulted in linear growth of network troughput. With 1Ghz we had 7MB/s, and without &lt;span class="caps"&gt;CPU&lt;/span&gt; limitation the &lt;span class="caps"&gt;CPU&lt;/span&gt; usage went up to 1.6Ghz maximizing our 100Mbit/s uplink. Turning on and off the firewall with many Layer2,3,7 rules didn&amp;#8217;t seem to affect the throughput performance. At least we knew that the bottleneck was the &lt;span class="caps"&gt;CPU&lt;/span&gt; and the bridge.&lt;br /&gt;
&lt;a href="http://bsdbased.com/images/8.png"&gt;&lt;img src="http://bsdbased.com/images/8.png" title="" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;

	&lt;p&gt;The results were somewhat disappointing so we started to dig further.&lt;br /&gt;
Our first guess was that the 32bit Bridge VM didn&amp;#8217;t use the HW Virtualization Technology in the &lt;span class="caps"&gt;CPU&lt;/span&gt;. To have VMware use the HW method we had to port openwrt to x86_64 &lt;span class="caps"&gt;CPU&lt;/span&gt;. The task was not easy and trivial but we managed to create an image. For our disappointment the results were nearly the same if not worse. Checking through pubications and papers we found that engineers at VMware made SW virtualization better than Intel-VT. &lt;a href="http://www.vmware.com/pdf/asplos235_adams.pdf"&gt;&lt;span class="caps"&gt;URL&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
In almost every of their benchmarks the software method was faster. Funny thing for Intel.&lt;/p&gt;

	&lt;p&gt;&lt;strong&gt;Bottom line:&lt;/strong&gt;&lt;br /&gt;
We implemented our ideas into the Bridging Firewall VM, changed the port groups of the VMs to be protected and now they are spam, warez and dos-attack free.&lt;/p&gt;

	&lt;p&gt;&lt;strong&gt;Do you need a production ready application-level firewall in your vSphere environment similar to this one?&lt;/strong&gt; Contact Us!&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/BSDBased/~4/5TzoxttQ7UU" height="1" width="1"/&gt;</description>
<link>http://feedproxy.google.com/~r/BSDBased/~3/5TzoxttQ7UU/firewall-for-vmware-vsphere-virtual-machines</link>
<pubDate>Wed, 28 Apr 2010 22:02:31 GMT</pubDate>
<dc:creator>jos</dc:creator>
<guid isPermaLink="false">tag:bsdbased.com,2010-04-27:7a1ec69e7f269aa2faabce5c6ca3fe98/4538ea98781b74ea649d5419ddd693ca</guid>
<feedburner:origLink>http://bsdbased.com/2010/04/29/firewall-for-vmware-vsphere-virtual-machines</feedburner:origLink></item>
<item><title>FreeBSD binary package repository howto [9]</title>
<description>&lt;p&gt;For a long time we have been trying to come up with a way to have a binary package repository which is based on heterogeneous package sources. (pkg_add/ports) &lt;br /&gt;
After playing with &amp;#8220;portupgrade&amp;#8221; and &amp;#8220;make package&amp;#8221; which often failed due to various reasons, it became obvious this method wont be beneficial in long-term. &lt;br /&gt;
This howto explains how to create the exact package replica of a jail full of installed packages. &lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;First create a jail and build/install packages. I have created a build jail only for this purpose.&lt;/li&gt;
	&lt;/ul&gt;

	&lt;ul&gt;
		&lt;li&gt;Use the script posted below to backup currently installed packages and setup a package tree similar to &amp;#8220;make package&amp;#8221; used at ports build. (Modify the first line according to your needs)&lt;/li&gt;
	&lt;/ul&gt;

	&lt;p&gt;&lt;div style="border-left: 5px solid grey; padding-left: 8px; font-family: Courier; font-size: 1.2em; text-align:left; letter-spacing: -0.3px; background-color: black; color: white;"&gt;&lt;br /&gt;
&lt;pre&gt;&lt;br /&gt;
&lt;span class="caps"&gt;PACKAGEDIR&lt;/span&gt;=/packages&lt;br /&gt;
mkdir -p $PACKAGEDIR/All&lt;br /&gt;
&lt;span class="caps"&gt;PACKAGELIST&lt;/span&gt;=`find /var/db/pkg -type d | awk -F/ {&amp;#8216;print $NF&amp;#8217;} | tail -n +2`&lt;br /&gt;
for i in $PACKAGELIST; do
    cd $PACKAGEDIR/All
    if [ ! -r $i.tbz ]; then
    echo &amp;#8220;Packaging $i&amp;#8221;
    pkg_create -b $i
    else
    echo &amp;#8220;Packaging $i skipped&amp;#8221;
    fi&lt;br /&gt;
done&lt;/p&gt;

	&lt;p&gt;for i in $PACKAGELIST; do
    cd $PACKAGEDIR/All
    &lt;span class="caps"&gt;ORIGIN&lt;/span&gt;=`grep &amp;#8220;@comment &lt;span class="caps"&gt;ORIGIN&lt;/span&gt;&amp;#8221; /var/db/pkg/$i/+CONTENTS | awk -F: {&amp;#8216;print $2&amp;#8217;}`
    &lt;span class="caps"&gt;ORIGIN&lt;/span&gt;_CAT=`echo $ORIGIN | awk -F/ {&amp;#8216;print $1&amp;#8217;}`
    &lt;span class="caps"&gt;ORIGIN&lt;/span&gt;_PORTNAME=`echo $ORIGIN | awk -F/ {&amp;#8216;print $2&amp;#8217;}`&lt;/p&gt;

    echo &amp;#8220;Linking $ORIGIN_CAT/$ORIGIN_PORTNAME&amp;#8221;

    [ -f $PACKAGEDIR/$ORIGIN_CAT/$i.tbz ] &amp;amp;&amp;amp; rm $PACKAGEDIR/$ORIGIN_CAT/$i.tbz
    [ -f $PACKAGEDIR/Latest/$ORIGIN_PORTNAME.tbz ] &amp;amp;&amp;amp; rm $PACKAGEDIR/Latest/$ORIGIN_PORTNAME.tbz
    &lt;span class="caps"&gt;FINDNAME&lt;/span&gt;=`echo $i |  sed &amp;#8216;s/\(.&lt;strong&gt;\)\-.&lt;/strong&gt;/\1/&amp;#8217;`
    &lt;span class="caps"&gt;OLD&lt;/span&gt;_TARGETS=`ls &lt;del&gt;1 | grep -e &amp;#8220;&lt;sup&gt;$FINDNAME&lt;/del&gt;[&lt;/sup&gt;-]*\.tbz&amp;#8221; | grep -v $i`

    [ ! -d $PACKAGEDIR/$ORIGIN_CAT ] &amp;amp;&amp;amp; mkdir -p $PACKAGEDIR/$ORIGIN_CAT
    [ ! -d $PACKAGEDIR/Latest ] &amp;amp;&amp;amp; mkdir -p $PACKAGEDIR/Latest

    for x in $OLD_TARGETS; do
        &lt;span class="caps"&gt;TEMP&lt;/span&gt;_ORIGIN_NAME=`tar -xjOf $x &amp;#8220;+CONTENTS&amp;#8221; | grep &amp;#8220;@comment &lt;span class="caps"&gt;ORIGIN&lt;/span&gt;&amp;#8221; | awk -F: {&amp;#8216;print $2&amp;#8217;} | awk -F/ {&amp;#8216;print $2&amp;#8217;}`
        if [ $ORIGIN_PORTNAME == $TEMP_ORIGIN_NAME ]; then
            echo &amp;#8220;Deleting unneeded target: $x&amp;#8221;
            [ -r $PACKAGEDIR/$ORIGIN_CAT/$x ] &amp;amp;&amp;amp; rm $PACKAGEDIR/$ORIGIN_CAT/$x;
            [ -r $PACKAGEDIR/All/$x ] &amp;amp;&amp;amp; rm $PACKAGEDIR/All/$x;
        fi
    done

    cd $PACKAGEDIR/$ORIGIN_CAT &amp;amp;&amp;amp; ln -s ../All/$i.tbz $i.tbz
    cd $PACKAGEDIR/Latest &amp;amp;&amp;amp; ln -s ../All/$i.tbz $ORIGIN_PORTNAME.tbz
done

	&lt;p&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/p&gt;

	&lt;p&gt;&lt;a href="http://bsdbased.com/file_download/1/package_repository.sh"&gt;Download&lt;/a&gt;&lt;/p&gt;

	&lt;p&gt;Explanation:&lt;br /&gt;
The first loop backs up all the installed packages on the system to $PACKAGEDIR/All. Then by going through the packages again the script recreates the symlinks used in FreeBSD packaging. It also checks for package files with  different versions (but same origin) and deletes those which are not installed. &lt;br /&gt;
Example #1:&lt;br /&gt;
A common roll-back scenario&lt;/p&gt;

	&lt;p&gt;mysql-server-5.1.43.tbz [installed]&lt;br /&gt;
mysql-server-5.1.45.tbz&lt;br /&gt;
To be deleted: mysql-server-5.1.45.tbz&lt;/p&gt;

	&lt;p&gt;Example #2:&lt;br /&gt;
Packages with different versions that can co-exist on the same system&lt;/p&gt;

	&lt;p&gt;ruby-1.8.7.248,1 [installed]&lt;br /&gt;
ruby-1.9.1.376_1,1 [installed]&lt;br /&gt;
To be deleted: none&lt;/p&gt;

	&lt;p&gt;The script checks for package origins and by determining that lang/ruby18 is different from lang/ruby19 both packages remain untouched and included to the repository.&lt;/p&gt;

	&lt;p&gt;Known bugs: Does not check for deleted packages. It&amp;#8217;s better to recreate the whole repository after a big portupgrade anyway.&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;Put the files onto a webserver using the following directory scheme:&lt;br /&gt;
&lt;code&gt;pub/FreeBSD/ports/&amp;lt;arch&amp;gt;/packages-&amp;lt;version&amp;gt;-release&lt;/code&gt;&lt;br /&gt;
Example:&lt;br /&gt;
&lt;code&gt;pub/FreeBSD/ports/i386/packages-7.2-release/Latest/bash.tbz&lt;/code&gt;&lt;/li&gt;
	&lt;/ul&gt;

	&lt;ul&gt;
		&lt;li&gt;Use this as a source with pkg_add (or pkg_replace):&lt;br /&gt;
&lt;code&gt;export PACKAGEROOT=http://example.com&lt;/code&gt;&lt;br /&gt;
Using &lt;code&gt;pkg_add -r bash&lt;/code&gt; will fetch from the following &lt;span class="caps"&gt;URL&lt;/span&gt;:&lt;br /&gt;
&lt;code&gt;http://example.com/pub/FreeBSD/ports/i386/packages-7.2-release/Latest/bash.tbz&lt;/code&gt;&lt;/li&gt;
	&lt;/ul&gt;&lt;img src="http://feeds.feedburner.com/~r/BSDBased/~4/RjzOnGL4EN4" height="1" width="1"/&gt;</description>
<link>http://feedproxy.google.com/~r/BSDBased/~3/RjzOnGL4EN4/freebsd-binary-package-repository-howto</link>
<pubDate>Tue, 23 Mar 2010 22:10:41 GMT</pubDate>
<dc:creator>jos</dc:creator>
<guid isPermaLink="false">tag:bsdbased.com,2010-03-23:7a1ec69e7f269aa2faabce5c6ca3fe98/cb5080d5ac23b159d55f8aece90f3c02</guid>
<feedburner:origLink>http://bsdbased.com/2010/03/23/freebsd-binary-package-repository-howto</feedburner:origLink></item>
<item><title>FreeBSD 7 jail source address selection [97]</title>
<description>&lt;p&gt;I was browsing through the changesets of the upcoming 7.3 release and stumbled upon a nice addition which would have come handy a few months ago.&lt;/p&gt;

	&lt;p&gt;According to the default behaviour, when jails are trying to reach a host through one of the external interfaces, the source address used for communication is taken from the interface which has route to the destination.&lt;br /&gt;
In other words, if you have a single external IP address, and a couple of jails on the local interface, the source address for outbound connections will be the address on the external interface. &lt;br /&gt;
This is especially annoying if you&amp;#8217;re trying to deploy per jail firewall rules for outgoing connections: you can&amp;#8217;t use the jail ip address as source address for matching packets.&lt;br /&gt;
Until now there we had three different approaches to overcome this problem:&lt;/p&gt;

	&lt;p&gt;&lt;strong&gt;Multiple routing tables&lt;/strong&gt;&lt;br /&gt;
The idea is that every process in a certain jail should use a routing table which has no default route, hereby restricting every outgoing connection. Note that incoming connections are assigned to the default (0) routing table, so you would still be able to access your services from the outside.&lt;/p&gt;

	&lt;p&gt;&lt;cite&gt;Add the following kernel configuration option and rebuild the kernel. The 2 is the number of &lt;span class="caps"&gt;FIB&lt;/span&gt; (Forward Information Base, synonym for a routing table here). The maximum value is 16.&lt;/cite&gt;&lt;/p&gt;

	&lt;p&gt;&lt;code&gt;options    ROUTETABLES=2&lt;/code&gt;&lt;/p&gt;

	&lt;p&gt;&lt;cite&gt;This number can be modified on boot time. To do so, add the following to /boot/loader.conf and reboot the system:&lt;/cite&gt;&lt;/p&gt;

	&lt;p&gt;&lt;code&gt;      net.fibs=6&lt;/code&gt;&lt;/p&gt;

      &lt;cite&gt;Set a loader tunable net.my_fibnum if needed. This means the default number of routing tables. If not specified, 0 will be used.&lt;/cite&gt;

      &lt;cite&gt;Set a loader tunable net.add_addr_allfibs if needed. This enables to add routes to all &lt;span class="caps"&gt;FIB&lt;/span&gt;s for new interfaces by default. When this is set to 0, it will only allocate routes on interface changes for the &lt;span class="caps"&gt;FIB&lt;/span&gt; of the caller when adding a new set of addresses to an interface. Note that this tunable is set to 1 by default.&lt;/cite&gt;

	&lt;p&gt;Then add jail_name_fib=n to your rc.conf or ezjail configuration to assign the jail process to a certain routing table.&lt;/p&gt;

	&lt;p&gt;&lt;strong&gt;Jail match support&lt;/strong&gt;&lt;br /&gt;
Find a firewall with jail match support. As we didn&amp;#8217;t want to use anything else but pf, we looked into the source and found that an actual support for matching jails could be added easily. We even got to the stage where we had beta patches, but due to the fact that we needed a stable solution in our production environment we dropped the idea. Not to mention that it would have never been merged into pf, as OpenBSD has no jails and FreeBSD has no pf fork. (They treat pf as a port, so feature additions have to go through OpenBSD first. Uh good luck with that.)&lt;/p&gt;

	&lt;p&gt;&lt;strong&gt;Uid match support&lt;/strong&gt;&lt;br /&gt;
Luckily pf has uid/gid match support, and by having all our jails use globally unique uids it became obvious that this method was the best so far.&lt;br /&gt;
&lt;code&gt;pass out on $ext_if inet proto tcp from ($ext_if) to any port 25 user &amp;gt; 1000 keep state&lt;/code&gt;&lt;br /&gt;
The above pf rule blocks outgoing smtp access for each process that has a &lt;span class="caps"&gt;UID&lt;/span&gt; larger than 1000.&lt;/p&gt;

	&lt;p&gt;&lt;strong&gt;Disabling source address selection for jails&lt;/strong&gt;&lt;br /&gt;
And finally the new addition of FreeBSD 7.3 allows you to disable the default source address selection method, always assigning the primary address of the jail to each outgoing packet. This can be done via the following sysctl flags:&lt;br /&gt;
&lt;code&gt;security.jail.ip4_saddrsel=0&lt;/code&gt; for IPv4&lt;br /&gt;
&lt;code&gt;security.jail.ip6_saddrsel=0&lt;/code&gt; for IPv6&lt;br /&gt;
Note that this is global and not a per jail setting. &lt;br /&gt;
Changeset: &lt;a href="http://svn.freebsd.org/viewvc/base?view=revision&amp;amp;revision=202924"&gt;r202924&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/BSDBased/~4/EDQgTr1dGJw" height="1" width="1"/&gt;</description>
<link>http://feedproxy.google.com/~r/BSDBased/~3/EDQgTr1dGJw/freebsd-7-jail-source-address-selection</link>
<pubDate>Fri, 05 Mar 2010 10:35:04 GMT</pubDate>
<dc:creator>jos</dc:creator>
<guid isPermaLink="false">tag:bsdbased.com,2010-03-05:7a1ec69e7f269aa2faabce5c6ca3fe98/17d4d18ae63446abccd903311e929b98</guid>
<feedburner:origLink>http://bsdbased.com/2010/03/05/freebsd-7-jail-source-address-selection</feedburner:origLink></item>
<item><title>ld-elf.so Local DoS Vulnerability or not [15]</title>
<description>&lt;p&gt;We have found an interesting feature in the FreeBSD run-time link editor (rtld), which links dynamic executables with their needed libraries at run time.&lt;/p&gt;

	&lt;p&gt;&lt;cite&gt;The ld-elf.so.1 utility itself is loaded by the kernel together with any dynamically-linked program that is to be executed. The kernel transfers control to the dynamic linker. After the dynamic linker has finished loading, relocating, and initializing the program and its required shared objects, it transfers control to the entry point of the program.&lt;/cite&gt;&lt;/p&gt;

	&lt;p&gt;It also has an executable flag, so let&amp;#8217;s try to execute it.&lt;/p&gt;

	&lt;p&gt;Results:&lt;br /&gt;
FreeBSD 6.3.x: &lt;br /&gt;
&lt;code&gt;$ /libexec/ld-elf.so.1&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;bash: /libexec/ld-elf.so.1: cannot execute binary file&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;$&lt;/code&gt;&lt;/p&gt;

	&lt;p&gt;FreeBSD 7.x:&lt;br /&gt;
&lt;code&gt;$ /libexec/ld-elf.so.1&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;(no return)&lt;/code&gt;&lt;/p&gt;

	&lt;p&gt;Turns out the ld-elf.so keeps loading itself over and over, maxing out a cpu core while doing so. I had to enforce a cputime limit in login.conf so funny users won&amp;#8217;t be able to profit from their discovery. &lt;br /&gt;
A fix isn&amp;#8217;t likely as &lt;a href="http://www.freebsd.org/cgi/query-pr.cgi?pr=i386/144116"&gt;it looks like this is just one of those things you shouldn&amp;#8217;t do&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/BSDBased/~4/eDQayIJ45bw" height="1" width="1"/&gt;</description>
<link>http://feedproxy.google.com/~r/BSDBased/~3/eDQayIJ45bw/ld-elfso-local-dos-vulnerability-or-not</link>
<pubDate>Mon, 22 Feb 2010 20:20:10 GMT</pubDate>
<dc:creator>jos</dc:creator>
<guid isPermaLink="false">tag:bsdbased.com,2010-02-22:7a1ec69e7f269aa2faabce5c6ca3fe98/5cfc2c39ef22825058c32504dad10b5c</guid>
<feedburner:origLink>http://bsdbased.com/2010/02/22/ld-elfso-local-dos-vulnerability-or-not</feedburner:origLink></item>
<item><title>Ruby/Quota [5]</title>
<description>&lt;p&gt;When looking to access quota under Ruby, we had to look for extensions and the first search revealed the &lt;a href="http://ruby-quota.sourceforge.net/"&gt;Ruby/Quota project&lt;/a&gt;, however it was unmaintained. Someone sent in a patch for NetBSD and support for newer Linux versions, but that was not applied either. We sent an email to the owner, but till now no response received.&lt;/p&gt;

	&lt;p&gt;So we took the &lt;span class="caps"&gt;CVS&lt;/span&gt;, imported it into git (using &lt;em&gt;git cvsimport&lt;/em&gt;), applied the patches, applied own patches, added a gemspec, extended the manual and uploaded it to Github. Tested under FreeBSD 7.2, Mac OS X 10.5.8 and Linux 2.6.24.&lt;/p&gt;

	&lt;p&gt;You can get it &lt;a href="http://github.com/axic/ruby-quota"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/BSDBased/~4/nuUZa4M_B_I" height="1" width="1"/&gt;</description>
<link>http://feedproxy.google.com/~r/BSDBased/~3/nuUZa4M_B_I/ruby-quota</link>
<pubDate>Mon, 07 Dec 2009 10:31:39 GMT</pubDate>
<dc:creator>alex</dc:creator>
<guid isPermaLink="false">tag:bsdbased.com,2009-11-27:7a1ec69e7f269aa2faabce5c6ca3fe98/9620b5bef4516d331cf2da682641b18b</guid>
<feedburner:origLink>http://bsdbased.com/2009/12/07/ruby-quota</feedburner:origLink></item>
<item><title>FreeBSD 8 VIMAGE + epair howto [29]</title>
<description>&lt;p&gt;The following text is about to show you how to use the new feature of FreeBSD 8: &lt;span class="caps"&gt;VIMAGE&lt;/span&gt; in a multi-jail environment.&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;Compile &lt;span class="caps"&gt;VIMAGE&lt;/span&gt; support into your kernel&lt;br /&gt;
Add the &amp;#8220;option &lt;span class="caps"&gt;VIMAGE&lt;/span&gt;&amp;#8221; to your kernel config and make sure to remove the &lt;span class="caps"&gt;SCTP&lt;/span&gt; support. Lack of &lt;span class="caps"&gt;SCTP&lt;/span&gt; support is one of the reasons &lt;span class="caps"&gt;VIMAGE&lt;/span&gt; is still considered to be experimental.&lt;/li&gt;
	&lt;/ul&gt;

	&lt;p&gt;If you don&amp;#8217;t know how to build your own custom kernel image, follow the detailed instructions of the corresponding &lt;a href="http://www.freebsd.org/doc/en/books/handbook/kernelconfig-building.html"&gt;FreeBSD Handbook chapter&lt;/a&gt; .&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;Reboot with your new kernel&lt;/li&gt;
	&lt;/ul&gt;

	&lt;ul&gt;
		&lt;li&gt;First let&amp;#8217;s create a pair of epair interfaces then quickly start two &lt;span class="caps"&gt;VIMAGE&lt;/span&gt; jails. I&amp;#8217;m using the same fs root to make it simple, but you should create your jails as you always do, you can even use ezjail to it. The only difference is the &amp;#8220;vnet&amp;#8221; jailparam which is passed as a command line argument to the jail binary. &lt;br /&gt;
If you use rc.conf you could try adding the &amp;#8220;vnet&amp;#8221; parameter to your jail_&lt;jailname&gt;_flags variable for automatic startup.&lt;/li&gt;
	&lt;/ul&gt;

&lt;div style="border-left: 5px solid grey; padding-left: 8px; font-family: Courier; font-size: 1.2em; text-align:left; letter-spacing: -0.3px; background-color: black; color: white;"&gt;
&lt;pre&gt;test# ifconfig epair create
epair0a
test# jail -c vnet name=tibi1 host.hostname=tibi1 path=/ persist
test# jls
   JID  IP Address      Hostname                      Path
     1  -               tibi1                         /
test# jail -c vnet name=tibi2 host.hostname=tibi2 path=/ persist
test# jls
   JID  IP Address      Hostname                      Path
     1  -               tibi1                         /
     2  -               tibi2                         /
&lt;/pre&gt;
&lt;/div&gt;

	&lt;p&gt;So we have two instances and an epair device. Let&amp;#8217;s see the interface list on the host.&lt;br /&gt;
&lt;div style="border-left: 5px solid grey; padding-left: 8px; font-family: Courier; font-size: 1.2em; text-align:left; letter-spacing: -0.3px; background-color: black; color: white;"&gt;&lt;pre&gt;
lo0: flags=8049&amp;lt;UP,LOOPBACK,RUNNING,MULTICAST&amp;gt; metric 0 mtu 16384
        options=3&amp;lt;RXCSUM,TXCSUM&amp;gt;
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
        inet6 ::1 prefixlen 128
        inet 127.0.0.1 netmask 0xff000000
epair0a: flags=8842&amp;lt;BROADCAST,RUNNING,SIMPLEX,MULTICAST&amp;gt; metric 0 mtu 1500
        ether 02:c0:64:00:04:0a
epair0b: flags=8842&amp;lt;BROADCAST,RUNNING,SIMPLEX,MULTICAST&amp;gt; metric 0 mtu 1500
        ether 02:c0:64:00:05:0b
&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;

	&lt;p&gt;Both sides of the pair is in the host system. Put one end into one of your jails with the ifconfig &lt;dev&gt; vnet &lt;jid&gt; command and verify the results by running ifconfig inside your jail.&lt;br /&gt;
&lt;div style="border-left: 5px solid grey; padding-left: 8px; font-family: Courier; font-size: 1.2em; text-align:left; letter-spacing: -0.3px; background-color: black; color: white;"&gt;&lt;pre&gt;
test# ifconfig epair0b vnet 1
test# jexec 1 ifconfig
lo0: flags=8008&amp;lt;LOOPBACK,MULTICAST&amp;gt; metric 0 mtu 16384
        options=3&amp;lt;RXCSUM,TXCSUM&amp;gt;
epair0b: flags=8842&amp;lt;BROADCAST,RUNNING,SIMPLEX,MULTICAST&amp;gt; metric 0 mtu 1500
        ether 02:c0:64:00:05:0b
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
OK, we have a layer 2 connection. Let&amp;#8217;s add some IPs and run a ping test&lt;br /&gt;
&lt;div style="border-left: 5px solid grey; padding-left: 8px; font-family: Courier; font-size: 1.2em; text-align:left; letter-spacing: -0.3px; background-color: black; color: white;"&gt;&lt;pre&gt;
test# jexec 1 ifconfig epair0b 192.168.11.2
test# ifconfig epair0a 192.168.11.1
test# ping 192.168.11.2
PING 192.168.11.2 (192.168.11.2): 56 data bytes
64 bytes from 192.168.11.2: icmp_seq=0 ttl=64 time=0.576 ms
64 bytes from 192.168.11.2: icmp_seq=1 ttl=64 time=0.081 ms
^C
--- 192.168.11.2 ping statistics ---
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.081/0.328/0.576/0.247 ms
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
It works!&lt;/p&gt;

	&lt;p&gt;Let&amp;#8217;s do the same with your other jail&lt;br /&gt;
&lt;div style="border-left: 5px solid grey; padding-left: 8px; font-family: Courier; font-size: 1.2em; text-align:left; letter-spacing: -0.3px; background-color: black; color: white;"&gt;&lt;br /&gt;
&lt;pre&gt;
test# ifconfig epair1b vnet 2
test# jexec 2 ifconfig epair1b 192.168.11.3
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
Oh wait, these are completely different set of epair interfaces, you can&amp;#8217;t use the same IP subnet on them. In order to mash them together on the host side, you have to make a bridge.&lt;br /&gt;
&lt;div style="border-left: 5px solid grey; padding-left: 8px; font-family: Courier; font-size: 1.2em; text-align:left; letter-spacing: -0.3px; background-color: black; color: white;"&gt;&lt;pre&gt;
test# ifconfig bridge create
bridge0
test# ifconfig bridge0 addm epair0a addm epair1a up
test#
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
The commands above will create a new bridge interface, and add the host side of both epair interfaces to the bridge.&lt;br /&gt;
You can see it with ifconfig as well:&lt;br /&gt;
&lt;div style="border-left: 5px solid grey; padding-left: 8px; font-family: Courier; font-size: 1.2em; text-align:left; letter-spacing: -0.3px; background-color: black; color: white;"&gt;&lt;pre&gt;
lo0: flags=8049&amp;lt;UP,LOOPBACK,RUNNING,MULTICAST&amp;gt; metric 0 mtu 16384
        options=3&amp;lt;RXCSUM,TXCSUM&amp;gt;
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
        inet6 ::1 prefixlen 128
        inet 127.0.0.1 netmask 0xff000000
epair0a: flags=8943&amp;lt;UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST&amp;gt; metric 0 mtu 1500
        ether 02:c0:64:00:04:0a
        inet 192.168.11.1 netmask 0xffffff00 broadcast 192.168.11.255
epair1a: flags=8942&amp;lt;BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST&amp;gt; metric 0 mtu 1500
        ether 02:c0:64:00:05:0a
bridge0: flags=8843&amp;lt;UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&amp;gt; metric 0 mtu 1500
        ether a6:4b:75:2d:2b:9b
        id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
        maxage 20 holdcnt 6 proto rstp maxaddr 100 timeout 1200
        root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
        member: epair1a flags=143&amp;lt;LEARNING,DISCOVER,AUTOEDGE,AUTOPTP&amp;gt;
                ifmaxaddr 0 port 5 priority 128 path cost 14183
        member: epair0a flags=143&amp;lt;LEARNING,DISCOVER,AUTOEDGE,AUTOPTP&amp;gt;
                ifmaxaddr 0 port 4 priority 128 path cost 14183
&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;

	&lt;p&gt;Let&amp;#8217;s put the host IP we set for epair0a earlier on the bridge interface instead and bring UP the host side of epair1. (Note: If you assign an IP to an interface, its state should automatically change to UP)&lt;/p&gt;

&lt;div style="border-left: 5px solid grey; padding-left: 8px; font-family: Courier; font-size: 1.2em; text-align:left; letter-spacing: -0.3px; background-color: black; color: white;"&gt;&lt;pre&gt;
test# ifconfig epair0a -alias
test# ifconfig bridge0 192.168.11.1
test# ifconfig epair1a up
test# ifconfig bridge0
bridge0: flags=8843&amp;lt;UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&amp;gt; metric 0 mtu 1500
        ether a6:4b:75:2d:2b:9b
        inet 192.168.11.1 netmask 0xffffff00 broadcast 192.168.11.255
        id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
        maxage 20 holdcnt 6 proto rstp maxaddr 100 timeout 1200
        root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
        member: epair1a flags=143&amp;lt;LEARNING,DISCOVER,AUTOEDGE,AUTOPTP&amp;gt;
                ifmaxaddr 0 port 5 priority 128 path cost 14183
        member: epair0a flags=143&amp;lt;LEARNING,DISCOVER,AUTOEDGE,AUTOPTP&amp;gt;
                ifmaxaddr 0 port 4 priority 128 path cost 14183
&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Running ping tests from the second jail, you can now ping your host and your other jail(s) too. &lt;br /&gt;
&lt;div style="border-left: 5px solid grey; padding-left: 8px; font-family: Courier; font-size: 1.2em; text-align:left; letter-spacing: -0.3px; background-color: black; color: white;"&gt;&lt;pre&gt;
test# jexec 2 ping 192.168.11.1
PING 192.168.11.1 (192.168.11.1): 56 data bytes
64 bytes from 192.168.11.1: icmp_seq=0 ttl=64 time=0.193 ms
^C
--- 192.168.11.1 ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.193/0.193/0.193/0.000 ms
test# jexec 2 ping 192.168.11.2
PING 192.168.11.2 (192.168.11.2): 56 data bytes
64 bytes from 192.168.11.2: icmp_seq=0 ttl=64 time=0.410 ms
64 bytes from 192.168.11.2: icmp_seq=1 ttl=64 time=0.089 ms
^C
--- 192.168.11.2 ping statistics ---
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.089/0.249/0.410/0.160 ms
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
Remember, now that you have separate networking stacks for each of your jails, the choice of topology is yours. &lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/BSDBased/~4/EPphznQiY4Q" height="1" width="1"/&gt;</description>
<link>http://feedproxy.google.com/~r/BSDBased/~3/EPphznQiY4Q/freebsd-8-vimage-epair-howto</link>
<pubDate>Sun, 06 Dec 2009 00:56:18 GMT</pubDate>
<dc:creator>jos</dc:creator>
<guid isPermaLink="false">tag:bsdbased.com,2009-12-05:7a1ec69e7f269aa2faabce5c6ca3fe98/63adfb8fa4424381c98563975c181259</guid>
<feedburner:origLink>http://bsdbased.com/2009/12/06/freebsd-8-vimage-epair-howto</feedburner:origLink></item>
<item><title>OpenSSH chroot and shell ambiguity [10]</title>
<description>&lt;p&gt;OpenSSH will fail in a scenario where the server is configured with chroot and a shell used by a user is not available outside, just inside the chroot.&lt;/p&gt;

	&lt;p&gt;The reason behind this is that ssh checks whether the given shell is a file and is executable, but this check doesn&amp;#8217;t takes the chroot path into account. This feature was introduced by &lt;a href="https://bugzilla.mindrot.org/show_bug.cgi?id=1352"&gt;this patch&lt;/a&gt; about a year ago.&lt;/p&gt;

	&lt;p&gt;We have &lt;a href="https://bugzilla.mindrot.org/show_bug.cgi?id=1679"&gt;filed a bugreport&lt;/a&gt; to OpenSSH.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/BSDBased/~4/v8kzDcH9j3g" height="1" width="1"/&gt;</description>
<link>http://feedproxy.google.com/~r/BSDBased/~3/v8kzDcH9j3g/openssh-chroot-and-shell-ambiguity</link>
<pubDate>Thu, 03 Dec 2009 07:30:17 GMT</pubDate>
<dc:creator>alex</dc:creator>
<guid isPermaLink="false">tag:bsdbased.com,2009-12-02:7a1ec69e7f269aa2faabce5c6ca3fe98/729a37331ea58cd718f4f19d0b00fb86</guid>
<feedburner:origLink>http://bsdbased.com/2009/12/03/openssh-chroot-and-shell-ambiguity</feedburner:origLink></item>
<item><title>FreeBSD LD_PRELOAD security fault [1]</title>
<description>&lt;p&gt;&lt;a href="http://seclists.org/fulldisclosure/2009/Nov/371"&gt;This issue&lt;/a&gt; was disclosed yesterday sharing a local root exploit for FreeBSD systems. &lt;a href="http://xorl.wordpress.com/2009/12/01/freebsd-ld_preload-security-bypass/"&gt;This blog post&lt;/a&gt; investigates and explains the issue, also the links and comments are worth reading. There are two types of exploits out there, one requires a setuid root binary to work, the other will use setuid(2).&lt;/p&gt;

	&lt;p&gt;An initial fix has been committed into the &lt;span class="caps"&gt;CVS&lt;/span&gt; today.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/BSDBased/~4/pJbTmLgC5k8" height="1" width="1"/&gt;</description>
<link>http://feedproxy.google.com/~r/BSDBased/~3/pJbTmLgC5k8/freebsd-ld_preload-security-fault</link>
<pubDate>Tue, 01 Dec 2009 22:01:05 GMT</pubDate>
<dc:creator>alex</dc:creator>
<guid isPermaLink="false">tag:bsdbased.com,2009-12-02:7a1ec69e7f269aa2faabce5c6ca3fe98/5ca05e43a565007083426ce3e052798a</guid>
<feedburner:origLink>http://bsdbased.com/2009/12/01/freebsd-ld_preload-security-fault</feedburner:origLink></item>
<item><title>PureFTPD virtual chroot [9]</title>
<description>&lt;p&gt;PureFTPD has a feature called &amp;#8220;virtual chroot&amp;#8221;, where it will mimic a chroot by its own means, but without using the chroot() system call.&lt;/p&gt;

	&lt;p&gt;An excerpt from the &lt;a href="http://download.pureftpd.org/pub/pure-ftpd/doc/FAQ"&gt;PureFTPD &lt;span class="caps"&gt;FAQ&lt;/span&gt;&lt;/a&gt;:&lt;/p&gt;

	&lt;p&gt;&lt;blockquote&gt;
  &amp;#8211; The &amp;#8216;virtual chroot&amp;#8217; implementation. With that feature, users can&lt;br /&gt;
follow all symbolic links, even when they don&amp;#8217;t point inside the jail. This&lt;br /&gt;
is very handy to set up directories shared by multiple users. Binary&lt;br /&gt;
packages are compiled with virtual chroot by default.&lt;/p&gt;

	&lt;p&gt;To enable the virtual chroot feature when you are compiling the server, use&lt;br /&gt;
the &amp;#8212;with-virtualchroot with ./configure . If you want a restricted chroot,&lt;br /&gt;
don&amp;#8217;t include &amp;#8212;with-virtualchroot.&lt;/p&gt;

	&lt;p&gt;Please note that the &lt;span class="caps"&gt;FTP&lt;/span&gt; server will never let people create new symbolic&lt;br /&gt;
links. Symbolic links have to be already there to be followed. Or if your&lt;br /&gt;
users can create symbolic links through Perl or &lt;span class="caps"&gt;PHP&lt;/span&gt; scripts, your hosting&lt;br /&gt;
platform is really badly configured. People can install any web file&lt;br /&gt;
browser, they don&amp;#8217;t need &lt;span class="caps"&gt;FTP&lt;/span&gt; to look at your system files. Recompile &lt;span class="caps"&gt;PHP&lt;/span&gt;&lt;br /&gt;
without &lt;span class="caps"&gt;POSIX&lt;/span&gt; functions and run all Perl scripts chrooted.&lt;br /&gt;
&lt;/blockquote&gt;&lt;/p&gt;

	&lt;p&gt;This feature is turned on by default in the FreeBSD ports.&lt;/p&gt;

	&lt;p&gt;Jos sent in a comment to the ports maintainer of pureftpd noting the above problem and today they have made this selectable when compiling the package.&lt;/p&gt;

	&lt;p&gt;Freshports &lt;a href="http://www.freshports.org/commit.php?category=ftp&amp;amp;port=pure-ftpd&amp;amp;files=yes&amp;amp;message_id=200911301037.nAUAbx5r030138@repoman.freebsd.org"&gt;commit message&lt;/a&gt; and &lt;a href="http://www.FreeBSD.org/cgi/cvsweb.cgi/ports/ftp/pure-ftpd/Makefile#rev1.71"&gt;direct link to &lt;span class="caps"&gt;CVS&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/BSDBased/~4/iaHYPK7zDFw" height="1" width="1"/&gt;</description>
<link>http://feedproxy.google.com/~r/BSDBased/~3/iaHYPK7zDFw/pureftpd-virtual-chroot</link>
<pubDate>Mon, 30 Nov 2009 13:51:58 GMT</pubDate>
<dc:creator>alex</dc:creator>
<guid isPermaLink="false">tag:bsdbased.com,2009-11-30:7a1ec69e7f269aa2faabce5c6ca3fe98/57421ba7f043c30be56e3e5e898afce5</guid>
<feedburner:origLink>http://bsdbased.com/2009/11/30/pureftpd-virtual-chroot</feedburner:origLink></item>
<item><title>Grow FreeBSD UFS filesystem on VmWare HDDs [22]</title>
<description>&lt;p&gt;In this artice I&amp;#8217;m going to show you how to expand your &lt;span class="caps"&gt;UFS&lt;/span&gt; filesystem under FreeBSD that runs in a Vmware Virtual Machine. &lt;/p&gt;

	&lt;p&gt;FreeBSD uses slices instead of traditional PC partitions. To sum it up shortly, it means that your whole disk contains only a single traditional partition with the partition type &amp;#8216;freebsd(165)&amp;#8217;. Inside this partition you will have slices. In a typical FreeBSD installation you have seperate slices for /, /usr, /var, /tmp and swap. In most cases the last slice on the partition is the /usr, and hopefully this is the one we have to extend, because in this case the only thing needed is to add some space to the end of the drive and extend the last slice. Sounds easy? Don&amp;#8217;t think so! &lt;/p&gt;

	&lt;p&gt;The main steps are:
	&lt;ol&gt;
		&lt;li&gt;Increase the actual (virtual) hdd size&lt;/li&gt;
		&lt;li&gt;Extend the partition to cover the whole disk&lt;/li&gt;
		&lt;li&gt;Extend the size of the last slice to cover the whole partition&lt;/li&gt;
		&lt;li&gt;Extend the actual &lt;span class="caps"&gt;UFS&lt;/span&gt; filesystem on the newly modified slice&lt;/li&gt;
	&lt;/ol&gt;&lt;/p&gt;

	&lt;p&gt;All the details:&lt;br /&gt;
First, forget livecds like gparted-live, knoppix, other partition hacking tools because they will not work.&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;Stop your VM and Edit its settings&lt;/li&gt;
	&lt;/ul&gt;

	&lt;ul&gt;
		&lt;li&gt;Increase &lt;span class="caps"&gt;HDD&lt;/span&gt; size and click OK&lt;br /&gt;
&lt;a href="http://bsdbased.com/images/6.png"&gt;&lt;img src="http://bsdbased.com/images/6.png" title="" alt="" /&gt;&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;

	&lt;ul&gt;
		&lt;li&gt;Boot into single user mode (select 4 in the FreeBSD boot menu)&lt;/li&gt;
	&lt;/ul&gt;

	&lt;ul&gt;
		&lt;li&gt;check your new disk via dmesg, you will see the increased block number&lt;br /&gt;
&lt;a href="http://bsdbased.com/images/7.png"&gt;&lt;img src="http://bsdbased.com/images/7.png" title="" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;
but your partition is still at the previous size (fdisk -s)&lt;br /&gt;
&lt;a href="http://bsdbased.com/images/3.png"&gt;&lt;img src="http://bsdbased.com/images/3.png" title="" alt="" /&gt;&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;

	&lt;ul&gt;
		&lt;li&gt;Let&amp;#8217;s change the partition size using fdisk -u&lt;br /&gt;
&lt;a href="http://bsdbased.com/images/5.png"&gt;&lt;img src="http://bsdbased.com/images/5.png" title="" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;
In my example my partition starts at 63 and has the size of 18860247 blocks&lt;br /&gt;
What you would normally do is to adjust the new size to totalblocks-start. In this case fdisk will complain that the ending block is not on cylinder boundry. Fdisk will fix the value you entered but if you want to do the math yourself here is how it should be done correctly:&lt;br /&gt;
cylinder_size = 16065 [blocks]&lt;br /&gt;
new size = trunc(totalblocks/cylinder_size)*cylinder_size-startblock&lt;br /&gt;
in my case&lt;br /&gt;
trunc(25165824/16065)*16065-63 = 25157727&lt;/li&gt;
	&lt;/ul&gt;

	&lt;ul&gt;
		&lt;li&gt;Next step is to extend the slice size. Slices are edited with the bsdlabel utility. You might need to mount a couple of more partitions to access your editor.&lt;br /&gt;
&lt;span class="caps"&gt;EDITOR&lt;/span&gt;=&amp;lt;yourfav&amp;gt; bsdlabel -e &lt;slice&gt; will bring up the slice table in your favorite editor. Now you need to change two things.&lt;/li&gt;
	&lt;ol&gt;
		&lt;li&gt;First the line where it says do not edit: change it to your new partition size.&lt;/li&gt;
		&lt;li&gt;To get the new size of the last slice you need to do the following calculations:&lt;br /&gt;
new_size_of_last_slice=partition_size-offset_of_last_slice&lt;/li&gt;
	&lt;/ol&gt;
	&lt;/ul&gt;

	&lt;ul&gt;
		&lt;li&gt;The last step is to extend the FS itself on the new slice. Make sure you don&amp;#8217;t have the slice in question mounted. Then run growfs /dev/&lt;slice&gt;. In my case it was /dev/da0s1f&lt;br /&gt;
&lt;a href="http://bsdbased.com/images/4.png"&gt;&lt;img src="http://bsdbased.com/images/4.png" title="" alt="" /&gt;&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;

	&lt;ul&gt;
		&lt;li&gt;To check your results run fsck, mount -a, df -h&lt;/li&gt;
		&lt;li&gt;If you&amp;#8217;re happy, you can reboot into multiuser mode now&lt;/li&gt;
	&lt;/ul&gt;&lt;img src="http://feeds.feedburner.com/~r/BSDBased/~4/LX0YUGW1T0M" height="1" width="1"/&gt;</description>
<link>http://feedproxy.google.com/~r/BSDBased/~3/LX0YUGW1T0M/grow-freebsd-ufs-filesystem-on-vmware-hdds</link>
<pubDate>Mon, 30 Nov 2009 06:31:56 GMT</pubDate>
<dc:creator>jos</dc:creator>
<guid isPermaLink="false">tag:bsdbased.com,2009-11-28:7a1ec69e7f269aa2faabce5c6ca3fe98/778bb59571aecc910b516aad9438b791</guid>
<feedburner:origLink>http://bsdbased.com/2009/11/30/grow-freebsd-ufs-filesystem-on-vmware-hdds</feedburner:origLink></item></channel>
</rss>
