diff --git a/.github/workflows/params.yml b/.github/workflows/params.yml
index 75b50b7..74bd848 100644
--- a/.github/workflows/params.yml
+++ b/.github/workflows/params.yml
@@ -15,7 +15,7 @@ env:
{
"NAME": "Bind",
"VERSION": ["latest"],
- "ARCH": ["linux/amd64", "linux/386", "linux/arm64", "linux/arm/v7", "linux/arm/v6"]
+ "ARCH": ["linux/amd64", "linux/386", "linux/arm64", "linux/arm/v7", "linux/arm/v6", "linux/ppc64le", "linux/s390x"]
}
]
diff --git a/LICENSE.md b/LICENSE.md
index 95154ee..9335c0c 100644
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -1,6 +1,6 @@
MIT License
-Copyright (c) 2016 cytopia
+Copyright (c) 2022 cytopia
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/Makefile b/Makefile
index 30c8a7d..2f88ec4 100644
--- a/Makefile
+++ b/Makefile
@@ -81,13 +81,14 @@ manifest-push: docker-manifest-push
# -------------------------------------------------------------------------------------------------
# Test Targets
# -------------------------------------------------------------------------------------------------
+DEBUG = 0
.PHONY: test
test: _test-integration
test: update-readme
.PHONY: _test-integration
_test-integration:
- ./tests/start-ci.sh $(IMAGE) $(NAME) $(VERSION) $(DOCKER_TAG) $(ARCH)
+ ./tests/start-ci.sh $(IMAGE) $(NAME) $(VERSION) $(DOCKER_TAG) $(ARCH) $(DEBUG)
.PHONY: update-readme
update-readme:
diff --git a/README.md b/README.md
index 38709c0..ccf77c1 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,7 @@
[![](https://images.microbadger.com/badges/image/cytopia/bind.svg)](https://microbadger.com/images/cytopia/bind "bind")
[![License](https://img.shields.io/badge/license-MIT-%233DA639.svg)](https://opensource.org/licenses/MIT)
-**Available Architectures:** `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6`
+**Available Architectures:** `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6`, `ppc64le`, `s390x`
----
@@ -434,11 +434,39 @@ have entries in `/etc/resolv.conf`.
## Support
-If you need support, join the Gitter Chat: [![Join the chat at https://gitter.im/devilbox/Lobby](https://badges.gitter.im/devilbox/Lobby.svg)](https://gitter.im/devilbox/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+Get support here
+
+
+
## License
**[MIT License](LICENSE.md)**
-Copyright (c) 2016 [cytopia](https://github.com/cytopia)
+Copyright (c) 2022 [cytopia](https://github.com/cytopia)
diff --git a/data/docker-entrypoint.sh b/data/docker-entrypoint.sh
index f3f3d5c..7edc1d2 100755
--- a/data/docker-entrypoint.sh
+++ b/data/docker-entrypoint.sh
@@ -4,15 +4,17 @@ set -e
set -u
set -o pipefail
-# Enable debug of entrypoint
+# Enable bash debugging for this entrypoint script
if [ "${DEBUG:-}" = "1" ]; then
set -x
fi
-#################################################################################
-# VARIABLES
-#################################################################################
+####################################################################################################
+###
+### (1/5) VARIABLES
+###
+####################################################################################################
###
### Variables
@@ -42,9 +44,11 @@ DEFAULT_MAX_CACHE_TIME=10800
-#################################################################################
-# HELPER FUNCTIONS
-#################################################################################
+####################################################################################################
+###
+### (2/5) HELPER FUNCTIONS
+###
+####################################################################################################
###
### Log to stdout/stderr
@@ -78,6 +82,19 @@ log() {
}
+###
+### Log configuration file
+###
+log_file() {
+ local filename="${1}"
+
+ printf "%0.s-" {1..80}; echo
+ echo "${filename}"
+ printf "%0.s-" {1..80}; echo
+ cat "${filename}"
+}
+
+
###
### Wrapper for run_run command
###
@@ -104,12 +121,26 @@ is_int() {
}
+###
+### Check if a value has multiple lines
+###
+is_multiline() {
+ (( $(grep -c . <<<"${1}") > 1 ))
+}
+
+
###
### Check if a value is a valid IP address
###
-is_ip4() {
- # IP is not in correct format
- if ! echo "${1}" | grep -Eq '^([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})$'; then
+is_ip4_addr() {
+ local regex='^([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})$'
+
+ # Invalid input
+ if is_multiline "${1}"; then
+ return 1
+ fi
+ # Invalid IPv4
+ if ! echo "${1}" | grep -Eq "${regex}"; then
return 1
fi
@@ -133,73 +164,75 @@ is_ip4() {
[ "${o4}" -gt "255" ]; then
return 1
fi
- # All tests passed
- return 0
}
+
###
### Check if a value is a valid IPv4 address with CIDR mask
###
-is_ipv4_with_mask() {
- local string="${1}"
-
+is_ipv4_cidr() {
# http://blog.markhatton.co.uk/2011/03/15/regular-expressions-for-ip-addresses-cidr-ranges-and-hostnames/
- if ! echo "${1}" | grep -Eq '^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(3[0-2]|[1-2][0-9]|[0-9]))$'; then
+ local regex='^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(3[0-2]|[1-2][0-9]|[0-9]))$'
+
+ # Invalid input
+ if is_multiline "${1}"; then
+ return 1
+ fi
+ # Invalid IPv4 CIDR
+ if ! echo "${1}" | grep -Eq "${regex}"; then
return 1
fi
-
- # All tests passed
- return 0
}
+
###
### Check if a value is a valid IPv4 address or IPv4 address with CIDR mask
###
-is_ipv4_or_mask() {
+is_ipv4_addr_or_ipv4_cidr() {
# Is IPv4 or IPv4 with mask
- if is_ip4 "${1}" || is_ipv4_with_mask "${1}"; then
+ if is_ip4_addr "${1}" || is_ipv4_cidr "${1}"; then
return 0
fi
-
- # Failure
- return 1
}
-###
-### Check if a value matches any of four predefined address match list names
-###
-is_address_match_list() {
- # Matches "any" or "none" or "localhost" or "localnets"
- if [[ "${1}" == "any" || "${1}" == "none" || "${1}" == "localhost" || "${1}" == "localnets" ]] ; then
- return 0
- fi
-
- # Failure
- return 1
-}
###
### Check if a value is a valid cname
###
is_cname() {
- local string="${1}"
# https://stackoverflow.com/questions/106179/regular-expression-to-match-dns-hostname-or-ip-address
local regex='^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$'
# Is an IP already
- if is_ip4 "${string}"; then
+ if is_ip4_addr "${1}" || is_ipv4_cidr "${1}"; then
return 1
fi
# Match for valid CNAME
- echo "${string}" | grep -Eq "${regex}"
+ echo "${1}" | grep -Eq "${regex}"
+}
+
+
+###
+### Check if a value matches any of four predefined address match list names
+###
+is_address_match_list() {
+ # Matches "any" or "none" or "localhost" or "localnets"
+ if [[ "${1}" == "any" || "${1}" == "none" || "${1}" == "localhost" || "${1}" == "localnets" ]] ; then
+ return 0
+ fi
+
+ # Failure
+ return 1
}
-#################################################################################
-# ACTION FUNCTIONS
-#################################################################################
+####################################################################################################
+###
+### (3/5) ACTION FUNCTIONS
+###
+####################################################################################################
# Add Bind options with or without forwarder
#
@@ -239,6 +272,9 @@ add_options() {
fi
echo "};"
} > "${config_file}"
+
+ # Output configuration file
+ log_file "${config_file}"
}
@@ -316,6 +352,9 @@ add_wildcard_zone() {
fi
} > "${conf_file}"
+ # Output configuration file
+ log_file "${conf_file}"
+
# Forward Zone
{
echo "\$TTL ${ttl_time}"
@@ -337,6 +376,9 @@ add_wildcard_zone() {
fi
} > "${zone_file}"
+ # Output configuration file
+ log_file "${zone_file}"
+
# Reverse Zone
if [ -n "${reverse}" ]; then
{
@@ -352,6 +394,9 @@ add_wildcard_zone() {
echo "${reverse_addr}.in-addr.arpa. IN NS ns2.${domain}."
echo "${reverse_octet}.${reverse_addr}.in-addr.arpa. IN PTR ${reverse}."
} > "${zone_rev_file}"
+
+ # Output configuration file
+ log_file "${zone_rev_file}"
fi
# named.conf
@@ -384,9 +429,11 @@ add_wildcard_zone() {
-#################################################################################
-## BOOTSTRAP
-#################################################################################
+####################################################################################################
+###
+### (4/5) BOOTSTRAP
+###
+####################################################################################################
###
### Set Debug level
@@ -412,9 +459,11 @@ log "info" "Debug level: ${DEBUG_ENTRYPOINT}" "${DEBUG_ENTRYPOINT}"
-#################################################################################
-# ENTRYPOINT
-#################################################################################
+####################################################################################################
+###
+### (5/5) ENTRYPOINT
+###
+####################################################################################################
###
### Re-create BIND default config
@@ -443,6 +492,9 @@ if printenv DOCKER_LOGS >/dev/null 2>&1; then
echo "};"
} > "${NAMED_LOG_CONF}"
log "info" "BIND logging: to stderr via Docker logs" "${DEBUG_ENTRYPOINT}"
+
+ # Output configuration file
+ log_file "${NAMED_LOG_CONF}"
elif [ "${DOCKER_LOGS}" = "0" ]; then
log "info" "BIND logging: disabled explicitly" "${DEBUG_ENTRYPOINT}"
else
@@ -521,7 +573,6 @@ else
fi
-
###
### Add wildcard DNS
###
@@ -542,10 +593,10 @@ if printenv WILDCARD_DNS >/dev/null 2>&1; then
if ! tmp="$( ping -c1 "${my_add}" 2>&1 | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -1 )"; then
tmp="${my_add}"
fi
- if ! is_ip4 "${tmp}"; then
+ if ! is_ip4_addr "${tmp}"; then
# Try dig command second
tmp="$( dig @8.8.8.8 +short "${my_add}" A | head -1 )"
- if ! is_ip4 "${tmp}"; then
+ if ! is_ip4_addr "${tmp}"; then
log "warn" "CNAME '${my_add}' could not be resolved. Skipping to add wildcard" "${DEBUG_ENTRYPOINT}"
continue;
fi
@@ -555,7 +606,7 @@ if printenv WILDCARD_DNS >/dev/null 2>&1; then
fi
# If specified address is not a valid IPv4 address, skip it
- if ! is_ip4 "${my_add}"; then
+ if ! is_ip4_addr "${my_add}"; then
log "warn" "Invalid IP address '${my_add}': for *.${my_dom} -> ${my_add}. Skipping to add wildcard" "${DEBUG_ENTRYPOINT}"
continue;
fi
@@ -567,14 +618,22 @@ if printenv WILDCARD_DNS >/dev/null 2>&1; then
fi
echo "include \"${my_cfg}\";" >> "${NAMED_CONF}"
- add_wildcard_zone "${my_dom}" "${my_add}" "${my_cfg}" "1" "${my_rev}" \
- "${TTL_TIME}" "${REFRESH_TIME}" "${RETRY_TIME}" "${EXPIRY_TIME}" "${MAX_CACHE_TIME}" \
+ add_wildcard_zone \
+ "${my_dom}" \
+ "${my_add}" \
+ "${my_cfg}" \
+ "1" \
+ "${my_rev}" \
+ "${TTL_TIME}" \
+ "${REFRESH_TIME}" \
+ "${RETRY_TIME}" \
+ "${EXPIRY_TIME}" \
+ "${MAX_CACHE_TIME}" \
"${DEBUG_ENTRYPOINT}"
done
fi
-
###
### Add extra hosts
###
@@ -595,10 +654,10 @@ if printenv EXTRA_HOSTS >/dev/null 2>&1 && [ -n "$( printenv EXTRA_HOSTS )" ]; t
if ! tmp="$( ping -c1 "${my_add}" 2>&1 | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -1 )"; then
tmp="${my_add}"
fi
- if ! is_ip4 "${tmp}"; then
+ if ! is_ip4_addr "${tmp}"; then
# Try dig command second
tmp="$( dig @8.8.8.8 +short "${my_add}" A | head -1 )"
- if ! is_ip4 "${tmp}"; then
+ if ! is_ip4_addr "${tmp}"; then
log "warn" "CNAME '${my_add}' could not be resolved. Skipping to add extra host" "${DEBUG_ENTRYPOINT}"
continue;
fi
@@ -608,7 +667,7 @@ if printenv EXTRA_HOSTS >/dev/null 2>&1 && [ -n "$( printenv EXTRA_HOSTS )" ]; t
fi
# If specified address is not a valid IPv4 address, skip it
- if ! is_ip4 "${my_add}"; then
+ if ! is_ip4_addr "${my_add}"; then
log "warn" "Invalid IP address '${my_add}': for ${my_dom} -> ${my_add}. Skipping to add extra host" "${DEBUG_ENTRYPOINT}"
continue;
fi
@@ -620,8 +679,17 @@ if printenv EXTRA_HOSTS >/dev/null 2>&1 && [ -n "$( printenv EXTRA_HOSTS )" ]; t
fi
echo "include \"${my_cfg}\";" >> "${NAMED_CONF}"
- add_wildcard_zone "${my_dom}" "${my_add}" "${my_cfg}" "0" "${my_rev}" \
- "${TTL_TIME}" "${REFRESH_TIME}" "${RETRY_TIME}" "${EXPIRY_TIME}" "${MAX_CACHE_TIME}" \
+ add_wildcard_zone \
+ "${my_dom}" \
+ "${my_add}" \
+ "${my_cfg}" \
+ "0" \
+ "${my_rev}" \
+ "${TTL_TIME}" \
+ "${REFRESH_TIME}" \
+ "${RETRY_TIME}" \
+ "${EXPIRY_TIME}" \
+ "${MAX_CACHE_TIME}" \
"${DEBUG_ENTRYPOINT}"
done
else
@@ -629,7 +697,6 @@ else
fi
-
###
### Allow query
###
@@ -644,7 +711,7 @@ else
while read -r ip ; do
ip="$( echo "${ip}" | xargs -0 )"
- if ! is_ipv4_or_mask "${ip}" && ! is_address_match_list "${ip}"; then
+ if ! is_ipv4_addr_or_ipv4_cidr "${ip}" && ! is_address_match_list "${ip}"; then
log "err" "ALLOW_QUERY error: not a valid IPv4 address with optional mask: ${ip}" "${DEBUG_ENTRYPOINT}"
exit 1
fi
@@ -669,7 +736,6 @@ else
fi
-
###
### Allow recursion
###
@@ -684,7 +750,7 @@ else
while read -r ip ; do
ip="$( echo "${ip}" | xargs -0 )"
- if ! is_ipv4_or_mask "${ip}" && ! is_address_match_list "${ip}"; then
+ if ! is_ipv4_addr_or_ipv4_cidr "${ip}" && ! is_address_match_list "${ip}"; then
log "err" "ALLOW_RECURSION error: not a valid IPv4 address with optional mask: ${ip}" "${DEBUG_ENTRYPOINT}"
exit 1
fi
@@ -709,7 +775,6 @@ else
fi
-
###
### DNSSEC validation
###
@@ -731,7 +796,6 @@ fi
log "info" "DNSSEC Validation: ${DNSSEC_VALIDATE}" "${DEBUG_ENTRYPOINT}"
-
###
### Forwarder
###
@@ -739,7 +803,12 @@ if ! printenv DNS_FORWARDER >/dev/null 2>&1; then
log "info" "\$DNS_FORWARDER not set." "${DEBUG_ENTRYPOINT}"
log "info" "No custom DNS server will be used as forwarder" "${DEBUG_ENTRYPOINT}"
- add_options "${NAMED_OPT_CONF}" "${DNSSEC_VALIDATE}" "" "${_allow_query_block}" "${_allow_recursion_block}"
+ add_options \
+ "${NAMED_OPT_CONF}" \
+ "${DNSSEC_VALIDATE}" \
+ "" \
+ "${_allow_query_block}" \
+ "${_allow_recursion_block}"
else
# To be pupulated
@@ -751,7 +820,7 @@ else
while read -r ip ; do
ip="$( echo "${ip}" | xargs -0 )"
- if ! is_ip4 "${ip}"; then
+ if ! is_ip4_addr "${ip}"; then
log "err" "DNS_FORWARDER error: not a valid IP address: ${ip}" "${DEBUG_ENTRYPOINT}"
exit 1
fi
@@ -763,16 +832,21 @@ else
fi
done <<< "$( printenv DNS_FORWARDER | sed 's/,/\n/g' )"
-
if [ -z "${_forwarders_block}" ]; then
log "err" "DNS_FORWARDER error: variable specified, but no IP addresses found." "${DEBUG_ENTRYPOINT}"
exit 1
fi
log "info" "Adding custom DNS forwarder: ${DNS_FORWARDER}" "${DEBUG_ENTRYPOINT}"
- add_options "${NAMED_OPT_CONF}" "${DNSSEC_VALIDATE}" "${_forwarders_block}" "${_allow_query_block}" "${_allow_recursion_block}"
+ add_options \
+ "${NAMED_OPT_CONF}" \
+ "${DNSSEC_VALIDATE}" \
+ "${_forwarders_block}" \
+ "${_allow_query_block}" \
+ "${_allow_recursion_block}"
fi
+
###
### Start
###
diff --git a/tests/01-run.sh b/tests/01-run.sh
index f499252..80ebb03 100755
--- a/tests/01-run.sh
+++ b/tests/01-run.sh
@@ -13,13 +13,13 @@ IMAGE="${1}"
#VERSION="${3}"
TAG="${4}"
ARCH="${5}"
-
+DEBUG="${6}"
NAME="bind$( shuf -i 1000000000-2000000000 -n 1 )"
# DEBUG_ENTRYPOINT=2
-run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=1 -e DEBUG_ENTRYPOINT=2 ${IMAGE}:${TAG} &"
+run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=${DEBUG} -e DEBUG_ENTRYPOINT=2 ${IMAGE}:${TAG} &"
run "sleep 5"
sanity_check "${NAME}"
if ! run "docker exec ${NAME} named -V"; then
@@ -34,7 +34,7 @@ run "docker stop ${NAME}"
# DEBUG_ENTRYPOINT=1
-run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=1 -e DEBUG_ENTRYPOINT=1 ${IMAGE}:${TAG} &"
+run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=${DEBUG} -e DEBUG_ENTRYPOINT=1 ${IMAGE}:${TAG} &"
run "sleep 5"
sanity_check "${NAME}"
if ! run "docker exec ${NAME} named -V"; then
@@ -49,7 +49,7 @@ run "docker stop ${NAME}"
# DEBUG_ENTRYPOINT=0
-run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=1 -e DEBUG_ENTRYPOINT=1 ${IMAGE}:${TAG} &"
+run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=${DEBUG} -e DEBUG_ENTRYPOINT=1 ${IMAGE}:${TAG} &"
run "sleep 5"
sanity_check "${NAME}"
if ! run "docker exec ${NAME} named -V"; then
@@ -64,7 +64,7 @@ run "docker stop ${NAME}"
# DEBUG_ENTRYPOINT=null
-run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=1 ${IMAGE}:${TAG} &"
+run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=${DEBUG} ${IMAGE}:${TAG} &"
run "sleep 5"
sanity_check "${NAME}"
if ! run "docker exec ${NAME} named -V"; then
diff --git a/tests/02-wildcard-addr.sh b/tests/02-wildcard-addr.sh
index 8630166..8ffb417 100755
--- a/tests/02-wildcard-addr.sh
+++ b/tests/02-wildcard-addr.sh
@@ -13,13 +13,14 @@ IMAGE="${1}"
#VERSION="${3}"
TAG="${4}"
ARCH="${5}"
+DEBUG="${6}"
NAME="bind$( shuf -i 1000000000-2000000000 -n 1 )"
PORT="5300"
# DEBUG_ENTRYPOINT=2
-run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=1 -e DEBUG_ENTRYPOINT=2 -e 'WILDCARD_DNS=devilbox=1.1.1.1' -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
+run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=${DEBUG} -e DEBUG_ENTRYPOINT=2 -e 'WILDCARD_DNS=devilbox=1.1.1.1' -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
run "sleep 5"
sanity_check "${NAME}"
if ! run "dig @127.0.0.1 -p ${PORT} +short t1.devilbox | grep -E '^1\.1\.1\.1$'"; then
@@ -30,7 +31,7 @@ run "docker stop ${NAME}"
# DEBUG_ENTRYPOINT=1
-run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=1 -e DEBUG_ENTRYPOINT=1 -e 'WILDCARD_DNS=devilbox=1.1.1.1' -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
+run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=${DEBUG} -e DEBUG_ENTRYPOINT=1 -e 'WILDCARD_DNS=devilbox=1.1.1.1' -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
run "sleep 5"
sanity_check "${NAME}"
if ! run "dig @127.0.0.1 -p ${PORT} +short t1.devilbox | grep -E '^1\.1\.1\.1$'"; then
@@ -41,7 +42,7 @@ run "docker stop ${NAME}"
# DEBUG_ENTRYPOINT=0
-run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=1 -e DEBUG_ENTRYPOINT=0 -e 'WILDCARD_DNS=devilbox=1.1.1.1' -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
+run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=${DEBUG} -e DEBUG_ENTRYPOINT=0 -e 'WILDCARD_DNS=devilbox=1.1.1.1' -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
run "sleep 5"
sanity_check "${NAME}"
if ! run "dig @127.0.0.1 -p ${PORT} +short t1.devilbox | grep -E '^1\.1\.1\.1$'"; then
@@ -52,7 +53,7 @@ run "docker stop ${NAME}"
# DEBUG_ENTRYPOINT=null
-run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=1 -e 'WILDCARD_DNS=devilbox=1.1.1.1' -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
+run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=${DEBUG} -e 'WILDCARD_DNS=devilbox=1.1.1.1' -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
run "sleep 5"
sanity_check "${NAME}"
if ! run "dig @127.0.0.1 -p ${PORT} +short t1.devilbox | grep -E '^1\.1\.1\.1$'"; then
diff --git a/tests/03-wildcard-cname.sh b/tests/03-wildcard-cname.sh
index c83507d..18aecb9 100755
--- a/tests/03-wildcard-cname.sh
+++ b/tests/03-wildcard-cname.sh
@@ -13,13 +13,14 @@ IMAGE="${1}"
#VERSION="${3}"
TAG="${4}"
ARCH="${5}"
+DEBUG="${6}"
NAME="bind$( shuf -i 1000000000-2000000000 -n 1 )"
PORT="5300"
# DEBUG_ENTRYPOINT=2
-run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=1 -e DEBUG_ENTRYPOINT=2 -e 'WILDCARD_DNS=devilbox=google.com' -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
+run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=${DEBUG} -e DEBUG_ENTRYPOINT=2 -e 'WILDCARD_DNS=devilbox=google.com' -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
run "sleep 5"
sanity_check "${NAME}"
if [ "$( dig @127.0.0.1 -p ${PORT} +short www.devilbox | wc -l )" = "0" ]; then
@@ -30,7 +31,7 @@ run "docker stop ${NAME}"
# DEBUG_ENTRYPOINT=1
-run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=1 -e DEBUG_ENTRYPOINT=1 -e 'WILDCARD_DNS=devilbox=google.com' -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
+run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=${DEBUG} -e DEBUG_ENTRYPOINT=1 -e 'WILDCARD_DNS=devilbox=google.com' -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
run "sleep 5"
sanity_check "${NAME}"
if [ "$( dig @127.0.0.1 -p ${PORT} +short t1.devilbox | wc -l )" = "0" ]; then
@@ -41,7 +42,7 @@ docker stop "${NAME}"
# DEBUG_ENTRYPOINT=0
-run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=1 -e DEBUG_ENTRYPOINT=0 -e 'WILDCARD_DNS=devilbox=google.com' -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
+run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=${DEBUG} -e DEBUG_ENTRYPOINT=0 -e 'WILDCARD_DNS=devilbox=google.com' -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
run "sleep 5"
sanity_check "${NAME}"
if [ "$( dig @127.0.0.1 -p ${PORT} +short t1.devilbox | wc -l )" = "0" ]; then
@@ -52,7 +53,7 @@ docker stop "${NAME}"
# DEBUG_ENTRYPOINT=null
-run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=1 -e 'WILDCARD_DNS=devilbox=google.com' -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
+run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=${DEBUG} -e 'WILDCARD_DNS=devilbox=google.com' -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
run "sleep 5"
sanity_check "${NAME}"
if [ "$( dig @127.0.0.1 -p ${PORT} +short t1.devilbox | wc -l )" = "0" ]; then
diff --git a/tests/04-extrahosts-addr.sh b/tests/04-extrahosts-addr.sh
index 538de94..569e189 100755
--- a/tests/04-extrahosts-addr.sh
+++ b/tests/04-extrahosts-addr.sh
@@ -13,13 +13,14 @@ IMAGE="${1}"
#VERSION="${3}"
TAG="${4}"
ARCH="${5}"
+DEBUG="${6}"
NAME="bind$( shuf -i 1000000000-2000000000 -n 1 )"
PORT="5300"
# DEBUG_ENTRYPOINT=2
-run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=1 -e DEBUG_ENTRYPOINT=2 -e 'EXTRA_HOSTS=www.devilbox=1.1.1.1' -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
+run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=${DEBUG} -e DEBUG_ENTRYPOINT=2 -e 'EXTRA_HOSTS=www.devilbox=1.1.1.1' -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
run "sleep 5"
sanity_check "${NAME}"
if ! run "dig @127.0.0.1 -p ${PORT} +short www.devilbox | grep -E '^1\.1\.1\.1$'"; then
@@ -34,7 +35,7 @@ run "docker stop ${NAME}"
# DEBUG_ENTRYPOINT=1
-run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=1 -e DEBUG_ENTRYPOINT=1 -e 'EXTRA_HOSTS=www.devilbox=1.1.1.1' -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
+run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=${DEBUG} -e DEBUG_ENTRYPOINT=1 -e 'EXTRA_HOSTS=www.devilbox=1.1.1.1' -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
run "sleep 5"
sanity_check "${NAME}"
if ! run "dig @127.0.0.1 -p ${PORT} +short www.devilbox | grep -E '^1\.1\.1\.1$'"; then
@@ -49,7 +50,7 @@ run "docker stop ${NAME}"
# DEBUG_ENTRYPOINT=0
-run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=1 -e DEBUG_ENTRYPOINT=0 -e 'EXTRA_HOSTS=www.devilbox=1.1.1.1' -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
+run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=${DEBUG} -e DEBUG_ENTRYPOINT=0 -e 'EXTRA_HOSTS=www.devilbox=1.1.1.1' -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
run "sleep 5"
sanity_check "${NAME}"
if ! run "dig @127.0.0.1 -p ${PORT} +short www.devilbox | grep -E '^1\.1\.1\.1$'"; then
@@ -64,7 +65,7 @@ run "docker stop ${NAME}"
# DEBUG_ENTRYPOINT=null
-run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=1 -e 'EXTRA_HOSTS=www.devilbox=1.1.1.1' -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
+run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=${DEBUG} -e 'EXTRA_HOSTS=www.devilbox=1.1.1.1' -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
run "sleep 5"
sanity_check "${NAME}"
if ! run "dig @127.0.0.1 -p ${PORT} +short www.devilbox | grep -E '^1\.1\.1\.1$'"; then
diff --git a/tests/05-extrahosts-cname.sh b/tests/05-extrahosts-cname.sh
index 532bd14..36bebcf 100755
--- a/tests/05-extrahosts-cname.sh
+++ b/tests/05-extrahosts-cname.sh
@@ -13,13 +13,14 @@ IMAGE="${1}"
#VERSION="${3}"
TAG="${4}"
ARCH="${5}"
+DEBUG="${6}"
NAME="bind$( shuf -i 1000000000-2000000000 -n 1 )"
PORT="5300"
# DEBUG_ENTRYPOINT=2
-run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=1 -e DEBUG_ENTRYPOINT=2 -e 'EXTRA_HOSTS=www.devilbox=google.com' -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
+run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=${DEBUG} -e DEBUG_ENTRYPOINT=2 -e 'EXTRA_HOSTS=www.devilbox=google.com' -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
run "sleep 5"
sanity_check "${NAME}"
if [ "$( dig @127.0.0.1 -p ${PORT} +short www.devilbox | wc -l )" = "0" ]; then
@@ -34,7 +35,7 @@ run "docker stop ${NAME}"
# DEBUG_ENTRYPOINT=1
-run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=1 -e DEBUG_ENTRYPOINT=1 -e 'EXTRA_HOSTS=www.devilbox=google.com' -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
+run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=${DEBUG} -e DEBUG_ENTRYPOINT=1 -e 'EXTRA_HOSTS=www.devilbox=google.com' -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
run "sleep 5"
sanity_check "${NAME}"
if [ "$( dig @127.0.0.1 -p ${PORT} +short www.devilbox | wc -l )" = "0" ]; then
@@ -49,7 +50,7 @@ run "docker stop ${NAME}"
# DEBUG_ENTRYPOINT=0
-run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=1 -e DEBUG_ENTRYPOINT=0 -e 'EXTRA_HOSTS=www.devilbox=google.com' -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
+run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=${DEBUG} -e DEBUG_ENTRYPOINT=0 -e 'EXTRA_HOSTS=www.devilbox=google.com' -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
run "sleep 5"
sanity_check "${NAME}"
if [ "$( dig @127.0.0.1 -p ${PORT} +short www.devilbox | wc -l )" = "0" ]; then
@@ -64,7 +65,7 @@ run "docker stop ${NAME}"
# DEBUG_ENTRYPOINT=null
-run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=1 -e 'EXTRA_HOSTS=www.devilbox=google.com' -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
+run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=${DEBUG} -e 'EXTRA_HOSTS=www.devilbox=google.com' -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
run "sleep 5"
sanity_check "${NAME}"
if [ "$( dig @127.0.0.1 -p ${PORT} +short www.devilbox | wc -l )" = "0" ]; then
diff --git a/tests/06-ttl-time.sh b/tests/06-ttl-time.sh
index 5a93a01..5bef65b 100755
--- a/tests/06-ttl-time.sh
+++ b/tests/06-ttl-time.sh
@@ -13,13 +13,14 @@ IMAGE="${1}"
#VERSION="${3}"
TAG="${4}"
ARCH="${5}"
+DEBUG="${6}"
NAME="bind$( shuf -i 1000000000-2000000000 -n 1 )"
PORT="5300"
# DEBUG_ENTRYPOINT=2
-run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=1 -e DEBUG_ENTRYPOINT=2 -e 'EXTRA_HOSTS=www.devilbox=google.com' -e TTL_TIME=500 -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
+run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=${DEBUG} -e DEBUG_ENTRYPOINT=2 -e 'EXTRA_HOSTS=www.devilbox=google.com' -e TTL_TIME=500 -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
run "sleep 5"
sanity_check "${NAME}"
if ! run "dig @127.0.0.1 -p ${PORT} www.devilbox | grep -E '^www\.devilbox\.\s+500\s+IN\s+A'"; then
@@ -30,7 +31,7 @@ run "docker stop ${NAME}"
# DEBUG_ENTRYPOINT=1
-run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=1 -e DEBUG_ENTRYPOINT=1 -e 'EXTRA_HOSTS=www.devilbox=google.com' -e TTL_TIME=500 -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
+run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=${DEBUG} -e DEBUG_ENTRYPOINT=1 -e 'EXTRA_HOSTS=www.devilbox=google.com' -e TTL_TIME=500 -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
run "sleep 5"
sanity_check "${NAME}"
if ! run "dig @127.0.0.1 -p ${PORT} www.devilbox | grep -E '^www\.devilbox\.\s+500\s+IN\s+A'"; then
@@ -41,7 +42,7 @@ run "docker stop ${NAME}"
# DEBUG_ENTRYPOINT=0
-run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=1 -e DEBUG_ENTRYPOINT=0 -e 'EXTRA_HOSTS=www.devilbox=google.com' -e TTL_TIME=500 -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
+run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=${DEBUG} -e DEBUG_ENTRYPOINT=0 -e 'EXTRA_HOSTS=www.devilbox=google.com' -e TTL_TIME=500 -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
run "sleep 5"
sanity_check "${NAME}"
if ! run "dig @127.0.0.1 -p ${PORT} www.devilbox | grep -E '^www\.devilbox\.\s+500\s+IN\s+A'"; then
@@ -52,7 +53,7 @@ run "docker stop ${NAME}"
# DEBUG_ENTRYPOINT=null
-run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=1 -e 'EXTRA_HOSTS=www.devilbox=google.com' -e TTL_TIME=500 -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
+run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=${DEBUG} -e 'EXTRA_HOSTS=www.devilbox=google.com' -e TTL_TIME=500 -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
run "sleep 5"
sanity_check "${NAME}"
if ! run "dig @127.0.0.1 -p ${PORT} www.devilbox | grep -E '^www\.devilbox\.\s+500\s+IN\s+A'"; then
diff --git a/tests/07-docker-logs.sh b/tests/07-docker-logs.sh
index b7cd92a..10b590d 100755
--- a/tests/07-docker-logs.sh
+++ b/tests/07-docker-logs.sh
@@ -13,13 +13,14 @@ IMAGE="${1}"
#VERSION="${3}"
TAG="${4}"
ARCH="${5}"
+DEBUG="${6}"
NAME="bind$( shuf -i 1000000000-2000000000 -n 1 )"
PORT="5300"
# DEBUG_ENTRYPOINT=2
-run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=1 -e DEBUG_ENTRYPOINT=2 -e 'EXTRA_HOSTS=www.devilbox=google.com' -e DOCKER_LOGS=1 -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
+run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=${DEBUG} -e DEBUG_ENTRYPOINT=2 -e 'EXTRA_HOSTS=www.devilbox=google.com' -e DOCKER_LOGS=1 -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
run "sleep 5"
sanity_check "${NAME}"
run "dig @127.0.0.1 -p ${PORT} +short www.devilbox || true"
@@ -32,7 +33,7 @@ run "docker stop ${NAME}"
# DEBUG_ENTRYPOINT=1
-run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=1 -e DEBUG_ENTRYPOINT=1 -e 'EXTRA_HOSTS=www.devilbox=google.com' -e DOCKER_LOGS=1 -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
+run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=${DEBUG} -e DEBUG_ENTRYPOINT=1 -e 'EXTRA_HOSTS=www.devilbox=google.com' -e DOCKER_LOGS=1 -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
run "sleep 5"
sanity_check "${NAME}"
run "dig @127.0.0.1 -p ${PORT} +short www.devilbox || true"
@@ -45,7 +46,7 @@ run "docker stop ${NAME}"
# DEBUG_ENTRYPOINT=0
-run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=1 -e DEBUG_ENTRYPOINT=0 -e 'EXTRA_HOSTS=www.devilbox=google.com' -e DOCKER_LOGS=1 -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
+run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=${DEBUG} -e DEBUG_ENTRYPOINT=0 -e 'EXTRA_HOSTS=www.devilbox=google.com' -e DOCKER_LOGS=1 -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
run "sleep 5"
sanity_check "${NAME}"
run "dig @127.0.0.1 -p ${PORT} +short www.devilbox || true"
@@ -58,7 +59,7 @@ run "docker stop ${NAME}"
# DEBUG_ENTRYPOINT=null
-run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=1 -e 'EXTRA_HOSTS=www.devilbox=google.com' -e DOCKER_LOGS=1 -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
+run "docker run --rm --platform ${ARCH} --name ${NAME} -e DEBUG=${DEBUG} -e 'EXTRA_HOSTS=www.devilbox=google.com' -e DOCKER_LOGS=1 -p ${PORT}:53/udp ${IMAGE}:${TAG} &"
run "sleep 5"
sanity_check "${NAME}"
run "dig @127.0.0.1 -p ${PORT} +short www.devilbox || true"
diff --git a/tests/start-ci.sh b/tests/start-ci.sh
index 1777030..af107c6 100755
--- a/tests/start-ci.sh
+++ b/tests/start-ci.sh
@@ -17,6 +17,7 @@ NAME="${2}"
VERSION="${3}"
TAG="${4}"
ARCH="${5}"
+DEBUG="${6}"
declare -a TESTS=()
@@ -40,9 +41,14 @@ if [ "${#}" -eq "3" ]; then
# Run all tests
else
for i in "${TESTS[@]}"; do
- echo "################################################################################"
- echo "# [${CWD}/${i}] ${IMAGE}:${TAG} ${NAME}-${VERSION} (${ARCH})"
- echo "################################################################################"
- sh -c "${i} ${IMAGE} ${NAME} ${VERSION} ${TAG} ${ARCH}"
+ echo "########################################################################################################################"
+ echo "########################################################################################################################"
+ echo "###"
+ echo "### [${CWD}/${i}] ${IMAGE}:${TAG} ${NAME}-${VERSION} (${ARCH})"
+ echo "###"
+ echo "########################################################################################################################"
+ echo "########################################################################################################################"
+ sh -c "${i} ${IMAGE} ${NAME} ${VERSION} ${TAG} ${ARCH} ${DEBUG}"
+ printf "\\n\\n"
done
fi