mirror of
https://github.com/hackacad/bastille.git
synced 2025-12-23 18:50:46 +01:00
create: Add -n|--nameserver
This commit is contained in:
@@ -49,6 +49,7 @@ usage() {
|
|||||||
-M | --static-mac Generate a static MAC address for jail (VNET only).
|
-M | --static-mac Generate a static MAC address for jail (VNET only).
|
||||||
--no-validate Do not validate the release when creating the jail.
|
--no-validate Do not validate the release when creating the jail.
|
||||||
--no-boot Create jail with boot=off.
|
--no-boot Create jail with boot=off.
|
||||||
|
-n | --nameserver Specify a nameserver for the jail.
|
||||||
-p | --priority VALUE Set priority value for jail.
|
-p | --priority VALUE Set priority value for jail.
|
||||||
-T | --thick Creates a thick container, they consume more space as they are self contained and independent.
|
-T | --thick Creates a thick container, they consume more space as they are self contained and independent.
|
||||||
-V | --vnet Enable VNET, and attach to an existing, physical interface.
|
-V | --vnet Enable VNET, and attach to an existing, physical interface.
|
||||||
@@ -689,6 +690,11 @@ create_jail() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Apply nameserver (if set)
|
||||||
|
if [ -n "${OPT_NAMESERVER}" ]; then
|
||||||
|
sed -i '' "\#nameserver.*# s#nameserver.*#nameserver ${OPT_NAMESERVER}#" "${bastille_jail_resolv_conf}"
|
||||||
|
fi
|
||||||
|
|
||||||
# Apply values changed by the template. -- cwells
|
# Apply values changed by the template. -- cwells
|
||||||
if [ -z "${EMPTY_JAIL}" ] && [ -z "${LINUX_JAIL}" ]; then
|
if [ -z "${EMPTY_JAIL}" ] && [ -z "${LINUX_JAIL}" ]; then
|
||||||
bastille restart "${NAME}"
|
bastille restart "${NAME}"
|
||||||
@@ -722,6 +728,7 @@ DUAL_STACK=""
|
|||||||
VALIDATE_RELEASE="1"
|
VALIDATE_RELEASE="1"
|
||||||
PRIORITY="99"
|
PRIORITY="99"
|
||||||
OPT_GATEWAY=""
|
OPT_GATEWAY=""
|
||||||
|
OPT_NAMESERVER=""
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
case "${1}" in
|
case "${1}" in
|
||||||
-h|--help|help)
|
-h|--help|help)
|
||||||
@@ -744,7 +751,7 @@ while [ $# -gt 0 ]; do
|
|||||||
EMPTY_JAIL="1"
|
EMPTY_JAIL="1"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-g|--gateway)
|
-g|--gateway|--defaultrouter)
|
||||||
OPT_GATEWAY="${2}"
|
OPT_GATEWAY="${2}"
|
||||||
# Validate gateway
|
# Validate gateway
|
||||||
if [ -n "${OPT_GATEWAY}" ]; then
|
if [ -n "${OPT_GATEWAY}" ]; then
|
||||||
@@ -762,6 +769,16 @@ while [ $# -gt 0 ]; do
|
|||||||
STATIC_MAC="1"
|
STATIC_MAC="1"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
-n|--nameserver)
|
||||||
|
OPT_NAMESERVER="${2}"
|
||||||
|
# Validate nameserver
|
||||||
|
if [ -n "${OPT_NAMESERVER}" ]; then
|
||||||
|
if ! validate_ip "${OPT_NAMESERVER}" >/dev/null 2>/dev/null; then
|
||||||
|
error_exit "[ERROR]: Not a valid nameserver: ${OPT_NAMESERVER}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
-p|--priority)
|
-p|--priority)
|
||||||
if echo "${2}" | grep -Eoq "^[0-9]+$"; then
|
if echo "${2}" | grep -Eoq "^[0-9]+$"; then
|
||||||
PRIORITY="${2}"
|
PRIORITY="${2}"
|
||||||
|
|||||||
Reference in New Issue
Block a user