2000-08-22 03:31:24 +04:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2004-10-11 19:00:51 +04:00
|
|
|
# $NetBSD: securelevel,v 1.6 2004/10/11 15:00:51 christos 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
|
|
|
|
2004-08-13 22:08:03 +04:00
|
|
|
$_rc_subr_loaded . /etc/rc.subr
|
2000-08-22 03:31:24 +04:00
|
|
|
|
|
|
|
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
|
|
|
#
|
2004-10-11 19:00:51 +04:00
|
|
|
osecurelevel=$(sysctl -n kern.securelevel)
|
2002-03-01 20:58:00 +03:00
|
|
|
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"
|