Errata

Mastering FreeBSD and OpenBSD Security

Errata for Mastering FreeBSD and OpenBSD Security

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
Printed Page 57
middle of the page

in `e.g., run kdump | less`, `run` should not be bold.

Anonymous  May 04, 2008 
Printed Page 118
'Controlling User Access' paragraph

The sentence

"The user and group named <nothing here> on an OpenBSD system (BIND in FreeBSD), for example, [ .. ]"

is missing the name of the BIND user/group on OpenBSD.

Anonymous  Jun 20, 2008 
Printed Page 157
Example 4.9

There are a couple of (potential) problems with example 4.9.

a.) In the beginning, there's

OIFS="$IFS"
IFS="
"

and then later

IFS=$OLDIFS

which should be

IFS=$OIFS

(on a sidenote, the quotes around $IFS in `OIFS=$IFS` are obsolete)



b.) the line

mkdir -p ${level_dir}{$level}

should be

mkdir -p ${level_dir}${level}



c.) the whole problem with

IFS="
"
for line ...; do
IFS=$OLDIFS
...
IFS="
"

can be avoided by using read instead of a for loop. Here's an approach in awk that handles the situation pretty well:

$ cat foo.awk
#!/usr/bin/env awk -f

BEGIN \
{
FS=":";
passwd = "/etc/master.passwd";
}

/^#/ \
{
next;
}

{
uid = $3;
gid = $4;
if (uid >= 1000 && uid < 5000)
print >> (level_dir 1 passwd);
if (uid >= 5000 && uid < 10000)
print >> (level_dir 2 passwd);
if (gid != 101)
print >> (level_dir 3 passwd);
}

it could be called like this:

$ awk -v level_dir=bar -f foo.awk /etc/passwd;

and would get rid of the whole 'for line in ...' loop



d.) sorting is an expensive operation. If the resulting lists in level_dir should really be sorted, merge-sort teaches us that sorting small lists is less expensive and we should sort them instead.



e.) it's a little strange to have three loops that all loop over the same variables when what they do could easily be combined into a single loop



f.) the lines

mkdir -p ${level_dir}${level}
rm -rf ${level_dir}${level}/*
for dir in /etc /usr/local/etc; do
mkdir -p ${level_dir}${level}/${dir}
done
touch ${level_dir}${level}/etc/master.passwd
chown root:wheel ${level_dir}${level}/etc/master.passwd
chmod 600 ${level_dir}${level}/etc/master.passwd

would be a whole lot more readable this way:

curlev = ${level_dir}${level}
rm -rf ${curlev}
mkdir -p ${curlev}{/etc,/usr/local/etc}

# make sure master.passwd exists and has sane permissions
mpwd = ${curlev}/etc/master.passwd
touch ${mpwd}
chown root:wheel ${mpwd}
chmod 600 ${mpwd}

Anonymous  Jul 06, 2008 
Printed Page 185
5th para

configure BIND => configure djbdns

Anonymous