service: respect nojailvnet keyword

In the 761d2bb5b9 we added nojailvnet
keyword. The nojailvnet keyword is used to skip startup scripts in
jails that are run without VNET.

The service.sh was omitted in this commit. The service.sh
even documents that this is the same code as in rc - so lets reflect
that.

Submitted by:	Adam Wołk <a.wolk@fudosecurity.com>
Sponsored by:	Fudo Security
This commit is contained in:
Mariusz Zaborski 2021-03-01 23:18:58 +01:00
parent 94f2e42f5e
commit 05b267e232

View File

@ -83,6 +83,9 @@ if [ -n "$RESTART" ]; then
skip="-s nostart" skip="-s nostart"
if [ `/sbin/sysctl -n security.jail.jailed` -eq 1 ]; then if [ `/sbin/sysctl -n security.jail.jailed` -eq 1 ]; then
skip="$skip -s nojail" skip="$skip -s nojail"
if [ `/sbin/sysctl -n security.jail.vnet` -ne 1 ]; then
skip="$skip -s nojailvnet"
fi
fi fi
[ -n "$local_startup" ] && find_local_scripts_new [ -n "$local_startup" ] && find_local_scripts_new
files=`rcorder ${skip} ${local_rc} 2>/dev/null` files=`rcorder ${skip} ${local_rc} 2>/dev/null`
@ -113,6 +116,9 @@ if [ -n "$ENABLED" -o -n "$RCORDER" ]; then
skip="-s nostart" skip="-s nostart"
if [ `/sbin/sysctl -n security.jail.jailed` -eq 1 ]; then if [ `/sbin/sysctl -n security.jail.jailed` -eq 1 ]; then
skip="$skip -s nojail" skip="$skip -s nojail"
if [ `/sbin/sysctl -n security.jail.vnet` -ne 1 ]; then
skip="$skip -s nojailvnet"
fi
fi fi
[ -n "$local_startup" ] && find_local_scripts_new [ -n "$local_startup" ] && find_local_scripts_new
files=`rcorder ${skip} /etc/rc.d/* ${local_rc} 2>/dev/null` files=`rcorder ${skip} /etc/rc.d/* ${local_rc} 2>/dev/null`