Update caddy-jail.sh

master
basilhendroff 2020-07-28 16:46:15 +08:00 committed by GitHub
parent e6bdf367a1
commit a0d920bfcb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 59 additions and 1 deletions

View File

@ -20,13 +20,18 @@ JAIL_INTERFACES=""
DEFAULT_GW_IP=""
INTERFACE="vnet0"
VNET="on"
POOL_PATH=""
JAIL_NAME="caddy"
STANDALONE_CERT=0
SELFSIGNED_CERT=0
DNS_CERT=0
NO_CERT=0
JAILS_MOUNT=$(zfs get -H -o value mountpoint $(iocage get -p)/iocage)
SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "${SCRIPT}")
. "${SCRIPTPATH}"/caddy-config
INCLUDES_PATH="${SCRIPTPATH}"/includes
RELEASE=$(freebsd-version | sed "s/STABLE/RELEASE/g" | sed "s/-p[0-9]*//")
@ -37,6 +42,59 @@ if ! [ -e "${SCRIPTPATH}"/nextcloud-config ]; then
exit 1
fi
# Check that necessary variables were set by nextcloud-config
if [ -z "${JAIL_IP}" ]; then
echo 'Configuration error: JAIL_IP must be set'
exit 1
fi
if [ -z "${JAIL_INTERFACES}" ]; then
echo 'JAIL_INTERFACES not set, defaulting to: vnet0:bridge0'
JAIL_INTERFACES="vnet0:bridge0"
fi
if [ -z "${DEFAULT_GW_IP}" ]; then
echo 'Configuration error: DEFAULT_GW_IP must be set'
exit 1
fi
if [ -z "${POOL_PATH}" ]; then
echo 'Configuration error: POOL_PATH must be set'
exit 1
fi
if [ -z "${TIME_ZONE}" ]; then
echo 'Configuration error: TIME_ZONE must be set'
exit 1
fi
if [ -z "${HOST_NAME}" ]; then
echo 'Configuration error: HOST_NAME must be set'
exit 1
fi
if [ $STANDALONE_CERT -eq 0 ] && [ $DNS_CERT -eq 0 ] && [ $NO_CERT -eq 0 ] && [ $SELFSIGNED_CERT -eq 0 ]; then
echo 'Configuration error: Either STANDALONE_CERT, DNS_CERT, NO_CERT,'
echo 'or SELFSIGNED_CERT must be set to 1.'
exit 1
fi
if [ $STANDALONE_CERT -eq 1 ] && [ $DNS_CERT -eq 1 ] ; then
echo 'Configuration error: Only one of STANDALONE_CERT and DNS_CERT'
echo 'may be set to 1.'
exit 1
fi
if [ $DNS_CERT -eq 1 ] && [ -z "${DNS_PLUGIN}" ] ; then
echo "DNS_PLUGIN must be set to a supported DNS provider."
echo "See https://caddyserver.com/docs under the heading of \"DNS Providers\" for list."
echo "Be sure to omit the prefix of \"tls.dns.\"."
exit 1
fi
#if [ $DNS_CERT -eq 1 ] && [ -z "${DNS_ENV}" ] ; then
# echo "DNS_ENV must be set to a your DNS provider\'s authentication credentials."
# echo "See https://caddyserver.com/docs under the heading of \"DNS Providers\" for more."
# exit 1
#fi
#if [ $DNS_CERT -eq 1 ] ; then
# DL_FLAGS="tls.dns.${DNS_PLUGIN}"
# DNS_SETTING="dns ${DNS_PLUGIN}"
#fi
#####
#
# Jail Creation