diff options
-rw-r--r-- | files/usr/local/etc/jailctl.conf.freebsd_hypervisor | 1 | ||||
-rw-r--r-- | files/usr/local/sbin/jailctl.freebsd_hypervisor | 8 |
2 files changed, 5 insertions, 4 deletions
diff --git a/files/usr/local/etc/jailctl.conf.freebsd_hypervisor b/files/usr/local/etc/jailctl.conf.freebsd_hypervisor index 02b6065..a3a37dc 100644 --- a/files/usr/local/etc/jailctl.conf.freebsd_hypervisor +++ b/files/usr/local/etc/jailctl.conf.freebsd_hypervisor @@ -5,6 +5,7 @@ JAIL_DATASET='${hypervisor_jail_dataset}' TRUNK_INTERFACE='${hypervisor_trunk_interface}' DEFAULT_DOMAIN='${domain}' +DEFAULT_NAMESERVERS='${resolvers:-1.1.1.1}' DEFAULT_VLAN='${hypervisor_default_vlan}' DEFAULT_NETMASK='$(prefix2netmask "$hypervisor_default_prefix")' DEFAULT_OS_QUOTA='${hypervisor_default_os_quota}' diff --git a/files/usr/local/sbin/jailctl.freebsd_hypervisor b/files/usr/local/sbin/jailctl.freebsd_hypervisor index 3698aa4..03ed563 100644 --- a/files/usr/local/sbin/jailctl.freebsd_hypervisor +++ b/files/usr/local/sbin/jailctl.freebsd_hypervisor @@ -171,6 +171,8 @@ Options: : ${gateway:="${ip%.*}.1"} fi + : ${nameservers:="$DEFAULT_NAMESERVERS"} + [ $# -lt 1 ] && cmd::usage 'NAME not specified' [ $# -lt 2 ] && cmd::usage 'TEMPLATE not specified' [ $# -gt 2 ] && cmd::usage 'too many arguments' @@ -205,10 +207,8 @@ Options: cp -v /etc/localtime "${JAIL_HOME}/${name}/os/etc/localtime" # Generate /etc/resolv.conf in the jail (word-splitting intentional). - if [ -n "${nameservers:-} "]; then - printf 'nameserver %s\n' $nameservers >> "${JAIL_HOME}/${name}/os/etc/resolv.conf" - printf 'search %s\n' "${searchdomains:-$domain}" >> "${JAIL_HOME}/${name}/os/etc/resolv.conf" - fi + printf 'nameserver %s\n' $nameservers >> "${JAIL_HOME}/${name}/os/etc/resolv.conf" + printf 'search %s\n' "${searchdomains:-$domain}" >> "${JAIL_HOME}/${name}/os/etc/resolv.conf" # Get the jail's virtual interface name. local epair_name |