<?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>Zelut's Blog &#187; FreeBSD</title> <atom:link href="http://blog.zelut.org/category/freebsd/feed/" rel="self" type="application/rss+xml" /><link>http://blog.zelut.org</link> <description>Brain Dump of a Linux Admin</description> <lastBuildDate>Mon, 12 Jul 2010 14:15:55 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=abc</generator> <item><title>Freenode IRC over SSL in Irssi &#8211; FreeBSD</title><link>http://blog.zelut.org/2010/05/29/freenode-irc-over-ssl-in-irssi-freebsd/</link> <comments>http://blog.zelut.org/2010/05/29/freenode-irc-over-ssl-in-irssi-freebsd/#comments</comments> <pubDate>Sat, 29 May 2010 17:13:22 +0000</pubDate> <dc:creator>Christer</dc:creator> <category><![CDATA[FreeBSD]]></category><guid isPermaLink="false">http://blog.zelut.org/?p=187</guid> <description><![CDATA[I&#8217;ve been reconfiguring my Irssi installation this morning and wanted to document the steps I took. I use irssi on FreeBSD 8.0-RELEASE. Required Certificates In order to connect securely over SSL to freenode you need to ensure you have the certificate installed. On FreeBSD, this port is ca_root_nss. portmaster security/ca_root_nss Configure the Network and Server [...]]]></description> <content:encoded><![CDATA[<p>I&#8217;ve been reconfiguring my Irssi installation this morning and wanted to document the steps I took. I use irssi on FreeBSD 8.0-RELEASE.</p><p><strong>Required Certificates</strong></p><p>In order to connect securely over SSL to freenode you need to ensure you have the certificate installed. On FreeBSD, this port is ca_root_nss.</p><blockquote><p><code>portmaster security/ca_root_nss</code></p></blockquote><p><strong>Configure the Network and Server</strong></p><blockquote><p><code>/network add -nick 'nick' -realname 'real name' freenode<br /> /server add -auto -ssl_verify -ssl_cafile /usr/local/share/certs/ca-root-nss.crt -network freenode chat.freenode.net 7000<br /> /save</code></p></blockquote><p><em>Note: If the blog wraps the content, there are three commands above, prefixed with /. /network, /server and /save.</em></p><p>Now, when you open irssi, you&#8217;ll automagically connect to Freenode over SSL.</p> ]]></content:encoded> <wfw:commentRss>http://blog.zelut.org/2010/05/29/freenode-irc-over-ssl-in-irssi-freebsd/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Configure Lighttpd for gitweb on FreeBSD</title><link>http://blog.zelut.org/2010/05/23/configure-lighttpd-for-gitweb-on-freebsd/</link> <comments>http://blog.zelut.org/2010/05/23/configure-lighttpd-for-gitweb-on-freebsd/#comments</comments> <pubDate>Sun, 23 May 2010 21:36:57 +0000</pubDate> <dc:creator>Christer</dc:creator> <category><![CDATA[FreeBSD]]></category> <category><![CDATA[lighttpd]]></category><guid isPermaLink="false">http://blog.zelut.org/?p=184</guid> <description><![CDATA[I spent some time this afternoon setting up a public git repository for my project, Origami. I had a little bit of trouble getting the repository set up initially, particularly the cgi aspect of it all. Below outlines the steps I took to configure Lighttpd for gitweb, hosted on FreeBSD. Installation First, of course, I [...]]]></description> <content:encoded><![CDATA[<p>I spent some time this afternoon setting up a public git repository for my project, <a title="Origami - The art of Folding@Home" href="http://origami.zelut.org">Origami</a>. I had a little bit of trouble getting the repository set up initially, particularly the cgi aspect of it all. Below outlines the steps I took to configure Lighttpd for gitweb, hosted on FreeBSD.</p><p><strong>Installation</strong></p><p>First, of course, I installed the git port:</p><blockquote><p><code>portmaster devel/git</code></p></blockquote><p>I made sure to select the gitweb option, which is de-activated by default. The other options are up to you.</p><p><strong>Configuration</strong></p><p>Second, I configured Lighttpd in the simplest manner I could find. This solution uses the existing gitweb files in-place. This is contrary to what the pkg-message prescribes, but I like this idea because it&#8217;ll ensure that upgrades are handled automatically. I don&#8217;t plan to run any additional repositories either, so using the one central set of files is preferable in my situation. This is my configuration:</p><blockquote><p><code> $HTTP["host"] =~ "^origami.zelut.org" {<br /> $HTTP["url"] =~ "/gitweb/" {<br /> server.indexfiles = ( "gitweb.cgi" )<br /> }<br /> alias.url += ( "/gitweb/" =&gt; "/usr/local/share/examples/git/gitweb/" ),<br /> cgi.assign = ( ".cgi" =&gt; "/usr/bin/perl" )<br /> }<br /> </code></p></blockquote><p><strong>Repository Configuration</strong></p><p>Lastly, I update the repository configuration in /usr/local/share/examples/git/gitweb/gitweb.cgi to my repository location:</p><blockquote><p><code>our $projectroot = "/path/to/git/repository/"</code></p></blockquote><p><strong>Conclusion</strong></p><p>I find that Lighttpd configuration, once you get used to it, is much simpler than Apache configuration. It&#8217;s all a matter of taking the time to learn the options (and finding examples, like this one) and it gets simpler.</p><p>I think this configuration for gitweb is very clean, requires minimal configuration additions, and is hopefully pretty self explanatory. I hope it works for you as well.</p> ]]></content:encoded> <wfw:commentRss>http://blog.zelut.org/2010/05/23/configure-lighttpd-for-gitweb-on-freebsd/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Lighttpd on FreeBSD : Hard Lock on Upload?</title><link>http://blog.zelut.org/2010/05/02/lighttpd-on-freebsd-hard-lock-on-upload/</link> <comments>http://blog.zelut.org/2010/05/02/lighttpd-on-freebsd-hard-lock-on-upload/#comments</comments> <pubDate>Sun, 02 May 2010 18:08:46 +0000</pubDate> <dc:creator>Christer</dc:creator> <category><![CDATA[FreeBSD]]></category> <category><![CDATA[lighttpd]]></category><guid isPermaLink="false">http://blog.zelut.org/?p=172</guid> <description><![CDATA[Anytime I would upload a file to the server (in my case via Wordpress upload form), the server would hard-lock and I'd have to manually bring it back up.]]></description> <content:encoded><![CDATA[<p>I&#8217;ve recently migrated my server(s) to a new VPS, one which offers BSD as a hosting option. I have long been a fan of FreeBSD on my servers, so this was a deal I couldn&#8217;t pass up. I did, however, run into one fairly difficult problem based on my combination of FreeBSD and lighttpd web server. I felt it was important to blog about it so that &#8220;teh internets&#8221; could share the wisdom and, hopefully, others could solve this same issue quickly.</p><p><strong>Problem</strong></p><p>The web server seemed to work great. It was handling traffic efficiently. Logs were going where they were expected. Rewrites were working. All the main things that I would expect to test were working just fine. And then I uploaded a file.</p><p>Hard lock. Panic. Do not pass go. Do not collect $200. This was bad.</p><p>I was even able to reproduce it. Anytime I would upload a file to the server (in my case via WordPress upload form), the server would hard-lock and I&#8217;d have to manually bring it back up.</p><p><strong>Solution</strong></p><p>The solution was to manually define the <em>server.network-backend</em> value, instead of using the auto-detected value. Apparently, at the time of this writing, the auto-detection on FreeBSD is.. less than perfect. The solution that I found was to add the following line to my lighttpd.conf:</p><blockquote><p><code>server.network-backend = "writev"</code></p></blockquote><p>After restarting the lighttpd service things seemed to perform as expected.</p><p><strong>Conclusion</strong></p><p>FreeBSD is a great, stable hosting platform. Lighttpd is a lightweight, efficient web server. Together they provide me with a very efficient, stable web hosting environment. The simple detail is to define the right parameters for the platform in the configuration.</p> ]]></content:encoded> <wfw:commentRss>http://blog.zelut.org/2010/05/02/lighttpd-on-freebsd-hard-lock-on-upload/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Loop Mount .iso in FreeBSD</title><link>http://blog.zelut.org/2009/09/29/loop-mount-iso-in-freebsd/</link> <comments>http://blog.zelut.org/2009/09/29/loop-mount-iso-in-freebsd/#comments</comments> <pubDate>Tue, 29 Sep 2009 15:49:00 +0000</pubDate> <dc:creator>Christer</dc:creator> <category><![CDATA[FreeBSD]]></category> <category><![CDATA[.iso]]></category> <category><![CDATA[linux]]></category> <category><![CDATA[loop]]></category> <category><![CDATA[mount]]></category><guid isPermaLink="false">http://blog.zelut.org/?p=170</guid> <description><![CDATA[I needed to mount an .iso file this morning, which I&#8217;ve done dozens of times in Linux, and I realized the command I&#8217;d normally use in Linux does not work. For example: Linux mount -o loop image.iso /mnt This works fine in Linux and lets you &#8220;mount&#8221; the .iso file as if it were burned [...]]]></description> <content:encoded><![CDATA[<p>I needed to mount an .iso file this morning, which I&#8217;ve done dozens of times in Linux, and I realized the command I&#8217;d normally use in Linux does not work. For example:</p><p><strong>Linux</strong></p><blockquote><p><code>mount -o loop image.iso /mnt</code></p></blockquote><p>This works fine in Linux and lets you &#8220;mount&#8221; the .iso file as if it were burned and in the drive. This does not work on FreeBSD. You get an error like:</p><blockquote><p>mount: image.iso mount option  is unknown: Invalid argument</p></blockquote><p><strong>FreeBSD</strong></p><p>The solution (the only one I&#8217;ve found so far) is to use a much more in-depth command like:</p><blockquote><p><code>mount_cd9660 -o ro /dev/$(mdconfig -a -t vnode -f /path/to/file.iso) /mount-point</code></p></blockquote><p>Hopefully this little note helps someone else have less trouble than I did in mounting .iso images in FreeBSD.</p> ]]></content:encoded> <wfw:commentRss>http://blog.zelut.org/2009/09/29/loop-mount-iso-in-freebsd/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Configure FreeBSD To Use Blowfish Password Format</title><link>http://blog.zelut.org/2009/07/10/configure-freebsd-to-use-blowfish-password-format/</link> <comments>http://blog.zelut.org/2009/07/10/configure-freebsd-to-use-blowfish-password-format/#comments</comments> <pubDate>Fri, 10 Jul 2009 16:29:55 +0000</pubDate> <dc:creator>Christer</dc:creator> <category><![CDATA[FreeBSD]]></category> <category><![CDATA[blowfish]]></category> <category><![CDATA[md5]]></category> <category><![CDATA[security]]></category><guid isPermaLink="false">http://blog.zelut.org/?p=163</guid> <description><![CDATA[I&#8217;ve been spending a lot of time lately researching FreeBSD security solutions. Topics such as pf (packet filter), system hardening, etc. One of the tips that I thought I&#8217;d share here is a method of configuring your system to use blowfish encryption for passwords as opposed to the default MD5. If you are on a [...]]]></description> <content:encoded><![CDATA[<p>I&#8217;ve been spending a lot of time lately researching FreeBSD security solutions. Topics such as pf (packet filter), system hardening, etc. One of the tips that I thought I&#8217;d share here is a method of configuring your system to use blowfish encryption for passwords as opposed to the default MD5. If you are on a system that has a lot of users it might be prudent to update the encryption type to make your stored passphrase safer.</p><p><strong>Configure /etc/login.conf</strong></p><p>The password format is stored within the <a title="login.conf man page" href="http://www.freebsd.org/cgi/man.cgi?query=login.conf&amp;sektion=5">/etc/login.conf</a> file. The default value being &#8220;md5&#8243;. To update your configuration to use blowfish instead make the following change to your file:</p><blockquote><p>-       :passwd_format=md5:\</p></blockquote><blockquote><p>+       :passwd_format=blf:\</p></blockquote><p>After you&#8217;ve made this change you&#8217;ll need to rehash the login database, which is done using the <a title="cap_mkdb man page" href="http://www.freebsd.org/cgi/man.cgi?query=cap_mkdb&amp;sektion=1&amp;apropos=0&amp;manpath=FreeBSD+7.2-RELEASE">cap_mkdb</a> command:</p><blockquote><p>cap_mkdb /etc/login.conf</p></blockquote><p>At this point any newly assigned passwords will be created using blowfish instead of MD5. Any existing accounts will retain their MD5 password hash until the password is reset.</p> ]]></content:encoded> <wfw:commentRss>http://blog.zelut.org/2009/07/10/configure-freebsd-to-use-blowfish-password-format/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>pf (packet filter) Documentation</title><link>http://blog.zelut.org/2009/07/06/pf-packet-filter-documentation/</link> <comments>http://blog.zelut.org/2009/07/06/pf-packet-filter-documentation/#comments</comments> <pubDate>Mon, 06 Jul 2009 19:17:34 +0000</pubDate> <dc:creator>Christer</dc:creator> <category><![CDATA[FreeBSD]]></category> <category><![CDATA[packet filter]]></category> <category><![CDATA[pf]]></category><guid isPermaLink="false">http://blog.zelut.org/?p=160</guid> <description><![CDATA[I&#8217;m looking for some good pf (packet-filter) documentation if anyone has anything to suggest. I&#8217;ve added a second FreeBSD machine to my public-facing network, and may be adding a third soon. I want to make sure that my firewall is setup properly but I&#8217;m not very familiar with pf. Can anyone suggest a book, online [...]]]></description> <content:encoded><![CDATA[<p>I&#8217;m looking for some good pf (packet-filter) documentation if anyone has anything to suggest. I&#8217;ve added a second FreeBSD machine to my public-facing network, and may be adding a third soon. I want to make sure that my firewall is setup properly but I&#8217;m not very familiar with pf. Can anyone suggest a book, online document, etc that has good examples for setting up pf?</p> ]]></content:encoded> <wfw:commentRss>http://blog.zelut.org/2009/07/06/pf-packet-filter-documentation/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>Upcoming in FreeBSD 8.x</title><link>http://blog.zelut.org/2009/07/06/upcoming-in-freebsd-8-x/</link> <comments>http://blog.zelut.org/2009/07/06/upcoming-in-freebsd-8-x/#comments</comments> <pubDate>Mon, 06 Jul 2009 16:25:20 +0000</pubDate> <dc:creator>Christer</dc:creator> <category><![CDATA[FreeBSD]]></category> <category><![CDATA[jails]]></category> <category><![CDATA[ports]]></category> <category><![CDATA[xen]]></category><guid isPermaLink="false">http://blog.zelut.org/?p=158</guid> <description><![CDATA[A friend of mine shot me this article today (What&#8217;s cooking for FreeBSD 8?), which is a pretty detailed outline of the things coming up for FreeBSD 8. I have to say, some of the things have got be excited! Some of the highlights that I want to see: Parallel Ports Build (announcement) Jails v2 [...]]]></description> <content:encoded><![CDATA[<p>A friend of mine shot me this article today (<a title="What's cooking for FreeBSD 8?" href="http://ivoras.sharanet.org/freebsd/freebsd8.html">What&#8217;s cooking for FreeBSD 8?</a>), which is a pretty detailed outline of the things coming up for FreeBSD 8. I have to say, some of the things have got be excited! Some of the highlights that I want to see:</p><ul><li>Parallel Ports Build (<a title="parallel ports build - mailing list announcement" href="http://lists.freebsd.org/pipermail/freebsd-ports/2009-March/053736.html">announcement</a>)</li><li>Jails v2 (<a title="Jails v2 commit message" href="http://svn.freebsd.org/viewvc/base?view=revision&amp;revision=185435">commit message</a>)</li><li>Xen Dom-U support (<a title="xen dom-u support wiki" href="http://wiki.freebsd.org/FreeBSD/Xen">wiki page</a>)</li></ul><p>There is actually quite a bit more, but those are the immediate ones that look like they&#8217;d noticeably affect me. I&#8217;d really love to have FreeBSD setup on a VPS via Xen, with Jails for each of my services. Currently I have that setup at home (jails), but its on old hardware that takes forever to compile. Parallel Ports Build would sure be a nice improvement, assuming the hardware can handle it (which my current hardware cannot).</p><p>To any of you other FreeBSD users out there, what are you excited for in the list and why?</p> ]]></content:encoded> <wfw:commentRss>http://blog.zelut.org/2009/07/06/upcoming-in-freebsd-8-x/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>JailKit : How To Create SSH Jails</title><link>http://blog.zelut.org/2009/06/12/jailkit-how-to-create-ssh-jails/</link> <comments>http://blog.zelut.org/2009/06/12/jailkit-how-to-create-ssh-jails/#comments</comments> <pubDate>Fri, 12 Jun 2009 16:53:05 +0000</pubDate> <dc:creator>Christer</dc:creator> <category><![CDATA[CentOS]]></category> <category><![CDATA[FreeBSD]]></category> <category><![CDATA[chroot]]></category> <category><![CDATA[jail]]></category> <category><![CDATA[JailKit]]></category> <category><![CDATA[SSH]]></category><guid isPermaLink="false">http://blog.zelut.org/?p=150</guid> <description><![CDATA[Not long ago we rebuilt a number of servers within our production environment at work, migrating from FreeBSD to CentOS. One of the requirements in this migration was that we needed a server that would act as an SSH-only Jail on the new platform. This meant I needed to setup a system where users could [...]]]></description> <content:encoded><![CDATA[<p>Not long ago we rebuilt a number of servers within our production environment at work, migrating from FreeBSD to CentOS. One of the requirements in this migration was that we needed a server that would act as an SSH-only Jail on the new platform. This meant I needed to setup a system where users could SSH into a machine but the <em><strong>only</strong></em> thing they could do on that machine was SSH back out again. We used this as our &#8220;bounce&#8221; machine. Users would have outside access to their Desktops or other machines only by way of this secured SSH-only machine.</p><p>The solution I found was a tool called &#8220;<a title="JailKit" href="http://olivier.sessink.nl/jailkit/">JailKit</a>&#8220;, which allows you to create chroot jails is a very simple way. Below I&#8217;ll outline the requirements for installing JailKit and using it to create an SSH chrooted &#8220;Jail&#8221;.</p><p><strong>Step 1: Install JailKit</strong></p><p>I was unable to find an up to date package for JailKit on CentOS, so I did the following to install from source:</p><blockquote><p><code> yum install gcc make<br /> wget -c http://olivier.sessink.nl/jailkit/jailkit-2.7.tar.bz2<br /> tar xf jailkit-*.tar.bz2<br /> cd jailkit-*<br /> ./configure<br /> make<br /> make install<br /> </code></p></blockquote><p><strong>Step 2: Configuration</strong></p><p>Once you have JailKit built and installed you&#8217;ll need to configure it to provide the needed libraries and devices for your chroot SSH setup. Below is an example configuration I used for a JailKit setup on CentOS 5 x86_64 (using JailKit 2.5 at the time). <em>Note: This is not the entire configuration. These three sections, <code>uidbasics</code>, <code>ssh</code> and <code>basicshell</code> required minor changes and this was the end-product of those changes:</em></p><blockquote><p><code> [uidbasics]<br /> comment = common files for all jails that need user/group information<br /> libraries = /lib/libnsl.so.1, /lib64/libnsl.so.1, /lib/libnss*.so.2, /lib64/libnss*.so.2<br /> regularfiles = /etc/nsswitch.conf<br /> emptydirs = /home</code></p><p><code>[ssh]<br /> comment = ssh secure shell<br /> executables = /usr/bin/ssh<br /> includesections = netbasics, uidbasics<br /> devices = /dev/urandom, /dev/tty, /dev/null</code></p><p><code> </code><code>[basicshell]<br /> comment = bash based shell with several basic utilities<br /> executables = /bin/sh, /bin/bash, /bin/ls, /bin/cat, /bin/chmod, /bin/mkdir, /bin/cp, /bin/cpio, /bin/date, /bin/dd, /bin/echo, /bin/egrep, /bin/false, /bin/fgrep, /bin/grep, /bin/gunzip, /bin/gzip, /bin/ln, /bin/ls, /bin/mkdir, /bin/mktemp, /bin/more, /bin/mv, /bin/pwd, /bin/rm, /bin/rmdir, /bin/sed, /bin/sleep, /bin/sync, /bin/tar, /bin/touch, /bin/true, /bin/uncompress, /bin/zcat, /usr/bin/id<br /> regularfiles = /etc/motd, /etc/issue, /etc/bash.bashrc, /etc/bashrc, /etc/profile<br /> directories = /usr/lib/locale/en_US.utf8<br /> users = root<br /> groups = root<br /> includesections = uidbasics<br /> </code></p></blockquote><p><strong>Step 3: Populate The Jail Environment</strong></p><p>Once these changes are made JailKit should be configured to provide the needed libraries and devices to your SSH chroot. You can now generate the chroot by using these two commands:</p><blockquote><p><code> jk_init -v -f /home/chrootusers/ ssh<br /> jk_init -v -f /home/chrootusers/ basicshell<br /> </code></p></blockquote><p><strong>Step 4: Generate Users</strong></p><p>The final step in an SSH-chroot Jail setup is the creation of users. This step is a bit more complicated due to the fact that the users need to be created within the chroot setup <em>and</em> on the host system itself. The users will never have access to the host system, but that is where the initial authentication happens. Once they are authenticated they are pushed into the chroot jail and have limited permissions.</p><p>This script assumes two things that you should be aware of. If your configuration doesn&#8217;t match you&#8217;ll need to update the script accordingly:</p><ol><li>This script assumes your chrooted jail home directories will be in <code>/home/chrootusers/</code>.</li><li>This script assumes group-based SSH restrictions using a system group called <code>sshaccess</code>.</li><li>This script also attempts to create storage restrictions using filesystem quotas, but succeeds if quotas are not enabled. (See Appendix for information on enabling quotas.)</li></ol><p>Here is the script:</p><blockquote><p><code> #!/bin/bash<br /> #<br /> # This code is released under the Public Domain.<br /> # create jailed ssh accounts<br /> # christer.edwards@gmail.com<br /> # usage: ./chroot-jail username 'passwdhash'<br /> #</code></p><p><code>## sanity checks<br /> if [ $# -ne 2 ]; then<br /> echo "This application requires two arguments: username 'passwdhash' (single-quotes required)"<br /> exit 1<br /> fi</code></p><p><code>if [ ! -d /home/chrootusers/./home/ ]; then<br /> echo "This application assumes installation to /home/chrootusers"<br /> exit 1<br /> fi</code></p><p><code>getent passwd $1 &amp;&gt;/dev/null<br /> if [ $? -eq 0 ]; then<br /> echo "User $1 already exists on host system.  Please remove and re-create using this tool."<br /> exit 1<br /> fi</code></p><p><code>getent group sshaccess &amp;&gt;/dev/null<br /> if [ $? -ne 0 ]; then<br /> echo "This application assumes 'AllowGroups sshaccess' restriction in /etc/ssh/sshd_config. sshaccess group missing"<br /> exit 1<br /> fi</p><p>## creation<br /> echo<br /> echo "Creating User and Jailed Home Directory"<br /> echo<br /> useradd -m -d /home/chrootusers/./home/$1 -s /usr/sbin/jk_chrootsh -p $2 $1</p><p>echo "Adding User to 'sshaccess' Group"<br /> echo<br /> gpasswd -a $1 sshaccess &amp;&gt;/dev/null</p><p>JAILUID=$(id -u $1)<br /> JAILGID=$(id -g $1)</p><p>echo "Creating Required Internal Jail Passwd and Group Files"<br /> echo<br /> echo "$1:x:${JAILUID}:${JAILUID}::/home/$1:/bin/bash" &gt;&gt; /home/chrootusers/etc/passwd<br /> echo "$1:x:${JAILGID}:" &gt;&gt; /home/chrootusers/etc/group</p><p></code><code> echo "Applying Quota Restrictions"<br /> setquota -u $1 10240 15360 0 0 /home || echo "Unable to Apply Quota Restrictions.  Are Quotas enabled?"<br /> </code></p></blockquote><p>If you create all of your users using this script you should save yourself a fair amount of headache. Between the user-creation script and the JailKit tools, creating SSH chrooted jails becomes a very simple task.</p><p><strong>Appendix: Enabling Quotas</strong></p><p>When I first implemented this JailKit setup in production I invited a few of the users to do their worst to break out of the jail or otherwise interfere with the system and other users. One of the potential problems that we found was that of drive space. Because there were no storage limitations for the chrooted users, one user could create large files and interfere with the others (or the host system) by filling up the drive. Below I&#8217;ve outlined how to activate filesystem quotas on Red Hat Enterprise or CentOS machines and apply a 15M hard limit to your chrooted users:</p><p><strong>Configure usrquota</strong></p><p>Quotas are a filesystem-based feature that needs to be activated within the fstab. To activate the use of persistent quotas append the term &#8220;usrquota&#8221; to the mount options of /home/ in your fstab. Example:</p><blockquote><p><code>/dev/LocalVol/HOME    /home    ext3    defaults,usrquota    1 2</code></p></blockquote><p><strong>Activate usrquota</strong></p><p>Once this is configured the following four commands will install, configure and activate quotas.</p><blockquote><p><code>yum install quota<br /> mount -o remount /home/<br /> quotacheck -cmu /home/<br /> quotaon /home/</code></p></blockquote><p>At this point you aren&#8217;t applying any limits to the user (yet), but the quota management system is on and active. If you create your users using the script above they will be given a 10M soft limit (after 10M they will be given a warning) and a 15M hard limit (absolutely no more disk writes). You can change these values (last line in the script) based on your needs.</p> ]]></content:encoded> <wfw:commentRss>http://blog.zelut.org/2009/06/12/jailkit-how-to-create-ssh-jails/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>FreeBSD Security Update: 7.1-RELEASE-p4 Available</title><link>http://blog.zelut.org/2009/03/23/freebsd-security-update-71-release-p4-available/</link> <comments>http://blog.zelut.org/2009/03/23/freebsd-security-update-71-release-p4-available/#comments</comments> <pubDate>Mon, 23 Mar 2009 16:07:22 +0000</pubDate> <dc:creator>Christer</dc:creator> <category><![CDATA[FreeBSD]]></category> <category><![CDATA[security]]></category><guid isPermaLink="false">http://blog.zelut.org/?p=99</guid> <description><![CDATA[For those using FreeBSD, there has been another security update to the 7.1 release family.  According to the UPDATING file: 20090323:       p4      FreeBSD-SA-09:06.ktimer, FreeBSD-EN-09:01.kenv Correctly sanity-check timer IDs. [SA-09:06] Limit the size of malloced buffer when dumping environment variables. [EN-09:01] If you&#8217;re interested in applying this update to your system, here is the method I [...]]]></description> <content:encoded><![CDATA[<p>For those using FreeBSD, there has been another security update to the 7.1 release family.  According to the UPDATING file:</p><blockquote><p><code>20090323:       p4      FreeBSD-SA-09:06.ktimer, FreeBSD-EN-09:01.kenv<br /> Correctly sanity-check timer IDs. [SA-09:06]<br /> Limit the size of malloced buffer when dumping environment<br /> variables. [EN-09:01]</code></p></blockquote><p>If you&#8217;re interested in applying this update to your system, here is the method I use:</p><blockquote><p><code>csup -g -L2 cvsup.freebsd.org /usr/share/examples/cvsup/standard-supfile<br /> cd /usr/src<br /> make buildkernel &amp;&amp; make installkernel<br /> make buildworld &amp;&amp; make installworld<br /> reboot</code></p></blockquote><p>There are other methods for keeping your base system updated, but I prefer the compiling method. What other methods might you suggest?</p> ]]></content:encoded> <wfw:commentRss>http://blog.zelut.org/2009/03/23/freebsd-security-update-71-release-p4-available/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>Update: Weekly Update Reporting Via Portmaster</title><link>http://blog.zelut.org/2009/03/06/update-weekly-update-reporting-via-portmaster/</link> <comments>http://blog.zelut.org/2009/03/06/update-weekly-update-reporting-via-portmaster/#comments</comments> <pubDate>Fri, 06 Mar 2009 23:53:47 +0000</pubDate> <dc:creator>Christer</dc:creator> <category><![CDATA[FreeBSD]]></category> <category><![CDATA[cron]]></category> <category><![CDATA[host]]></category> <category><![CDATA[jail]]></category> <category><![CDATA[portmaster]]></category><guid isPermaLink="false">http://blog.zelut.org/?p=49</guid> <description><![CDATA[Not so long ago I wrote about how you can configure FreeBSD to email you regarding available updates on a weekly basis.  This is something that I have had in place for a while now, and I really enjoy the ability to keep things on the patched (read: bleeding) edge.  Recently I found a small [...]]]></description> <content:encoded><![CDATA[<p>Not so long ago I wrote about how you can configure <a title="freebsd update notifications via portmaster" href="http://blog.zelut.org/2009/02/21/weekly-update-notifications-via-portmaster/">FreeBSD to email you regarding available updates</a> on a weekly basis.  This is something that I have had in place for a while now, and I really enjoy the ability to keep things on the patched (read: bleeding) edge.  Recently I found a small issue with the setup I had been using.  I wanted to share the fix with anyone that may have been doing the same thing.</p><p>First of all, let me tell you about the issue I came across.</p><p>When I would recieve an email regarding available updates I would connect to the FreeBSD Jail and use <code>portmaster -a -d</code> to apply all available updates.  I noticed that the number of updates applied did not match the number of updates listed in the email.  Odd.  Well, after thinking about it for a bit I realized what the problem was.</p><p>The cron job (as seen in the previous post) was running at the same time on the FreeBSD host as well as the FreeBSD Jail.  Why is that a problem, you ask?  Remember the slight variation in the host cronjob verses the jail.  The host system is pulling down the updated ports tree before it compares and emails any available updates.  The problem is introduced because the jails start doing their comparison and email reporting right away, while the host system is fetching and applying the updated tree.  Oops!  The ports tree update isn&#8217;t finished fast enough for the jails to actually have the new information.</p><p>The solution I came up with is a very simple one.  Simply update the cron daily run time on the host to give it an adequate headstart from the jails.  On my systems the /etc/crontab files now look like this:</p><p><strong>HOST:<br /> </strong><code># Perform daily/weekly/monthly maintenance.<br /> 1   2   *   *   *   root    periodic daily<br /> 15  4   *   *   6   root    periodic weekly<br /> 30  5   1   *   *   root    periodic monthly<br /> </code></p><p><strong>JAIL:</strong><br /> <code># Perform daily/weekly/monthly maintenance.<br /> 1   3   *   *   *   root    periodic daily<br /> 15  4   *   *   6   root    periodic weekly<br /> 30  5   1   *   *   root    periodic monthly</code></p><p>If you didn&#8217;t notice the change look closer.  It&#8217;s a very small fix.  The &#8220;periodic daily&#8221; row on the host is now set to run at 2:00am while the same field is set to 3:00am on the jail.  I&#8217;m sure that is more than enough time for the host to update the ports tree before the jails start to do their reporting.</p><p>In conclusion, if you&#8217;re using a similar reporting system you&#8217;ll likely want to apply this small change as well.  Giving the host system enough time to update the ports tree will be critical in getting updated, accurate information within the jail systems.</p> ]]></content:encoded> <wfw:commentRss>http://blog.zelut.org/2009/03/06/update-weekly-update-reporting-via-portmaster/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced) (user agent is rejected)
Database Caching 2/14 queries in 0.091 seconds using disk

Served from: blog.zelut.org @ 2010-07-31 18:43:57 -->