ports/148605: security/ipsec-tools rc.d/racoon startup script fails on boot (with racoon_create_dirs=yes and /var on mfs)
John Hein
jhein at symmetricom.com
Wed Jul 14 20:30:04 UTC 2010
>Number: 148605
>Category: ports
>Synopsis: security/ipsec-tools rc.d/racoon startup script fails on boot (with racoon_create_dirs=yes and /var on mfs)
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Jul 14 20:30:02 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator: John Hein
>Release: FreeBSD 5.x+
>Organization:
>Environment:
>Description:
This is a followon for ports/117128. The fix there doesn't work
on boot when the rc.d/racoon script is sourced in /etc/rc.
The reason is that on 4.x startup scripts were executed on boot.
In 5.x and later in run_rc_script in /etc/rc.subr, it is sourced
on boot.
This was not detected on my 4.x-based appliance until we updated
FreeBSD (to something newer than 4.x) recently.
As a result the racoon_create_dirs=NO in rc.d/racoon is not overridden
by a 'yes' setting in rc.conf (because _rc_conf_loaded is true and
thus load_rc_config doesn't override the NO).
Also (a second problem with rc.d/racoon on 5.x+), on boot rc.d scripts
are normally invoked with faststart instead of start, so the test at
the end fails, too.
>How-To-Repeat:
- install ipsec-tools
- rm -rf /var/db/racoon (or have /var on an mfs)
- add to /etc/rc.conf:
racoon_enable=yes
racoon_create_dirs=yes
rc_debug=yes
- reboot
Observe that you get ...
/usr/local/etc/rc.d/racoon: WARNING: /var/db/racoon is not a directory.
... and racoon does not start.
>Fix:
1) Don't set racoon_create_dirs=NO if it's already set.
2) Create directories on 'faststart' as well as 'start'.
Index: security/ipsec-tools/files/racoon.sh.in
===================================================================
RCS file: /base/FreeBSD-CVS/ports/security/ipsec-tools/files/racoon.sh.in,v
retrieving revision 1.7
diff -u -p -r1.7 racoon.sh.in
--- security/ipsec-tools/files/racoon.sh.in 27 Mar 2010 00:14:44 -0000 1.7
+++ security/ipsec-tools/files/racoon.sh.in 14 Jul 2010 19:30:22 -0000
@@ -17,7 +17,7 @@
#
[ -z "$racoon_enable" ] && racoon_enable="NO" # Disable by default
#racoon_flags="" # Flags to racoon program
-racoon_create_dirs=NO # Create $required_dirs (for
+racoon_create_dirs=${racoon_create_dirs:-NO} # Create $required_dirs (for
# /var mfs)?
. /etc/rc.subr
@@ -38,7 +38,7 @@ racoon_cleanup() {
}
load_rc_config $name
-if [ "$1" = start ] && checkyesno "${name}_create_dirs"; then
+if [ "$1" = start -o "$1" = faststart ] && checkyesno "${name}_create_dirs"; then
/bin/mkdir -p $required_dirs
fi
run_rc_command "$1"
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list