Skip to content

Category Archives: FreeBSD

Passing options to the Exim port on FreeBSD

31-Dec-08

The Exim port on FreeBSD does not have a menu-driven configuration system accessible by running make config, although it does have a plethora of options described in /usr/ports/mail/exim/options.  If using portupgrade, you can pass these options with the -m flag; for example:
# portupgrade -m “WITH_CONTENT_SCAN=yes WITH_SASLAUTHD=yes WITH_DOMAINKEYS=yes” exim

Reloading and Testing pf rulesets

30-Dec-08

To test the ruleset in /etc/pf.conf, do the following:
sudo pfctl -n -f /etc/pf.conf
sudo pfctl -n -v -f /etc/pf.conf
The second pfctl command displays the rules you’ve created; however, it can be easy to miss a syntax error warning in the verbosity – the first command will make it easy to spot those.
You can test the ruleset by [...]

FreeBSD Jail Upgrade Instructions

29-Dec-08

When upgrading via a patch, installing the patch can be done by adding a “DESTDIR” argument to make:# make install DESTDIR=/u1/jail/192.168.0.12
When upgrading from source (Adapted from Upgrading a Jail from Source):# setenv JAIL /u1/jail/192.168.0.12
# mergemaster -pd -D $JAIL
# cd /usr/src && make installworld DESTDIR=$JAIL
# mergemaster -svd -D $JAIL

Editing rc_conf_files on FreeBSD

29-Dec-08

In FreeBSD’s /etc/default/rc.conf, the location of the rc.conf system configuration files is defined in the variable rc_conf_files. If you’re modularizing your rc.conf files – say, for use with Cfengine – you may be tempted to change the value of rc_conf_files in /etc/rc.conf or/etc/rc.conf.local. However, this change will not be picked up by itself – you need to call source_rc_confs after changing rc_conf_files, similar to this:
rc_conf_files=”/etc/rc.conf /etc/rc.conf.local /etc/rc.conf.amd”
source_rc_confs

(Tip seen [...]

Overriding portaudit’s known vulnerabilities check

29-Dec-08

When attempting to upgrade a port on FreeBSD, you may run into a problem like this:
> sudo portupgrade -rR php5
—> Upgrading ‘php5-5.1.6′ to ‘php5-5.1.6_1′ (lang/php5)
—> Building ‘/usr/ports/lang/php5′
===> Cleaning for autoconf-2.59_2
===> Cleaning for pkg-config-0.21
===> Cleaning for libxml2-2.6.26
===> Cleaning for perl-5.8.8
===> Cleaning for m4-1.4.4
===> Cleaning for help2man-1.36.4_1
===> Cleaning for gmake-3.81_1
===> Cleaning for libiconv-1.9.2_2
===> Cleaning for p5-gettext-1.05_1
===> Cleaning [...]

Checking for modified files in installed FreeBSD ports or packages

29-Dec-08

When upgrading FreeBSD ports, you will lose any customizations that you’ve made to files within the port; this is especially problematic with configuration files. A quick and easy way to check for modifications you may have made is to use the -g flag to pkg_info. For example:
> pkg_info -g -x drupal
Information for drupal-4.6.9:
Mismatched Checksums:
/usr/local/www/drupal/.htaccess fails the original MD5 [...]

Building FreeBSD Ports as an Unprivileged User

29-Dec-08

Set the following in /etc/make.conf:
WRKDIRPREFIX=/home/anl/ports-build
DISTDIR=/home/anl/ports-dist
WRKDIRPREFIX is a directory that the unprivileged user as able to write to; DISTDIR is the directory their downloads of source files are written to.
If the port you are building requires another port to be installed for it to be built, you will be prompted for the root password, so this technique is not suitable [...]

Index of Sysctl Definitions

29-Dec-08

EnderUNIX has a large glossary of user-contributed sysctl definitions.

Running a chrooted BIND in a FreeBSD Jail

28-Dec-08

(N.B. – This document was originally written in 2006; I have not verified that it remains applicable to FreeBSD in 2008.)
Running a chrooted BIND server within a FreeBSD jail requires mounting its devfs outside of the jail; this document provides an RCng start stop script to do that.
Attempting to start BIND using the stock RCng [...]

View Packets Logged by PF

28-Dec-08

Use tcpdump and the pflog0 device to view packets in real time:
# tcpdump -n -e -ttt -i pflog0
To examine the log file, do the following instead:
# tcpdump -n -e -ttt -r /var/log/pflog
See PF: Logging for more information.