Validate jib during jail import

This commit is contained in:
JRGTH
2023-07-19 10:56:20 -04:00
parent 61e7084b33
commit 72bd211f7b

View File

@@ -152,6 +152,11 @@ update_jailconf() {
sed -i '' "s|path.*=.*;|path = ${bastille_jailsdir}/${TARGET_TRIM}/root;|" "${JAIL_CONFIG}"
sed -i '' "s|mount.fstab.*=.*;|mount.fstab = ${bastille_jailsdir}/${TARGET_TRIM}/fstab;|" "${JAIL_CONFIG}"
fi
# Check for the jib script
if grep -qw "vnet" "${JAIL_CONFIG}"; then
vnet_requirements
fi
fi
}
@@ -209,6 +214,7 @@ generate_config() {
# See if we need to generate a vnet network section
if [ "${IS_VNET_JAIL:-0}" = "1" ]; then
NETBLOCK=$(generate_vnet_jail_netblock "${TARGET_TRIM}" "" "${VNET_DEFAULT_INTERFACE}")
vnet_requirements
else
# If there are multiple IP/NIC let the user configure network
if [ -n "${IPV4_CONFIG}" ]; then
@@ -335,6 +341,17 @@ workout_components() {
fi
}
vnet_requirements() {
# VNET jib script requirement
if [ ! "$(command -v jib)" ]; then
if [ -f "/usr/share/examples/jails/jib" ] && [ ! -f "/usr/local/bin/jib" ]; then
install -m 0544 /usr/share/examples/jails/jib /usr/local/bin/jib
else
warn "Warning: Unable to locate/install jib script required by VNET jails."
fi
fi
}
config_netif() {
# Get interface from bastille configuration
if [ -n "${bastille_network_loopback}" ]; then