2000-08-22 03:31:24 +04:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2002-03-22 07:33:57 +03:00
|
|
|
# $NetBSD: securelevel,v 1.4 2002/03/22 04:34:00 thorpej Exp $
|
2000-08-22 03:31:24 +04:00
|
|
|
#
|
|
|
|
|
|
|
|
# PROVIDE: securelevel
|
2000-09-06 05:05:43 +04:00
|
|
|
# REQUIRE: aftermountlkm ipnat mountd
|
2002-03-22 07:33:57 +03:00
|
|
|
# BEFORE: DAEMON
|
2000-08-22 03:31:24 +04:00
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
|
|
|
name="securelevel"
|
|
|
|
start_cmd="securelevel_start"
|
|
|
|
stop_cmd=":"
|
|
|
|
|
|
|
|
securelevel_start()
|
|
|
|
{
|
2002-03-01 20:58:00 +03:00
|
|
|
# if $securelevel is set higher, change it here, else if
|
|
|
|
# it is 0, change it to 1 here, before we start daemons
|
|
|
|
# or login services.
|
2000-08-22 03:31:24 +04:00
|
|
|
#
|
2002-03-01 20:58:00 +03:00
|
|
|
osecurelevel=`sysctl -n kern.securelevel`
|
|
|
|
if [ -n "$securelevel" -a "$securelevel" != "$osecurelevel" ]; then
|
|
|
|
if [ "$securelevel" -lt "$osecurelevel" ]; then
|
|
|
|
echo "Can't lower securelevel."
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo -n "Setting securelevel: "
|
|
|
|
sysctl -w kern.securelevel=$securelevel
|
|
|
|
fi
|
2000-08-22 03:31:24 +04:00
|
|
|
else
|
2002-03-01 20:58:00 +03:00
|
|
|
if [ "$osecurelevel" = 0 ]; then
|
2000-08-22 03:31:24 +04:00
|
|
|
echo -n "Setting securelevel: "
|
|
|
|
sysctl -w kern.securelevel=1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
load_rc_config $name
|
|
|
|
run_rc_command "$1"
|