cloudron-support: make nameserver list customizable
This commit is contained in:
@@ -35,9 +35,9 @@ readonly HELP_MESSAGE="
|
||||
--recreate-docker Deletes docker storage (containers and images) and recreates it without loss of data
|
||||
--send-diagnostics Collects server diagnostics and uploads it to ${PASTEBIN}
|
||||
--troubleshoot Dashboard down? Run tests to identify the potential problem
|
||||
--unbound-use-external-dns Forwards all Unbound requests to Google (8.8.8.8) and Cloudflare (1.1.1.1) DNS servers.
|
||||
Unbound is the internal DNS server used for recursive DNS queries. This is only needed
|
||||
--unbound-forward-dns Unbound is the internal DNS server used for recursive DNS queries. This is only needed
|
||||
if your network does not allow outbound DNS requests.
|
||||
Options are 'google', 'cloudflare' or comma separated custom server (e.g 8.8.8.8,1.1.1.1).
|
||||
--help Show this message
|
||||
"
|
||||
|
||||
@@ -329,7 +329,7 @@ function check_unbound() {
|
||||
fi
|
||||
|
||||
if ! host cloudron.io 127.0.0.150 &>/dev/null; then
|
||||
fail "Unbound is not resolving, maybe try forwarding all DNS requests. You can do this by running 'cloudron-support --unbound-use-external-dns' option"
|
||||
fail "Unbound is not resolving, maybe try forwarding all DNS requests. You can do this by running 'cloudron-support --unbound-forward-dns' option"
|
||||
host cloudron.io 127.0.0.150
|
||||
exit 1
|
||||
fi
|
||||
@@ -576,16 +576,23 @@ function check_expired_domain() {
|
||||
success "Domain ${dashboard_domain} is valid and has not expired"
|
||||
}
|
||||
|
||||
function unbound_use_external_dns() {
|
||||
function unbound_forward_dns() {
|
||||
local -r conf_file="/etc/unbound/unbound.conf.d/forward-everything.conf"
|
||||
|
||||
info "To remove the forwarding, please delete $conf_file and 'systemctl restart unbound'"
|
||||
|
||||
case "$2" in
|
||||
google) ns_list="8.8.8.8,4.4.4.4";; # https://developers.google.com/speed/public-dns
|
||||
cloudflare) ns_list="1.1.1.1,1.0.0.1";; # https://developers.cloudflare.com/1.1.1.1/ip-addresses/
|
||||
*) ns_list="$2";;
|
||||
esac
|
||||
|
||||
forward_addrs=$(echo "$ns_list" | tr ',' '\n' | sed 's/^/ forward-addr: /')
|
||||
|
||||
cat > $conf_file <<EOF
|
||||
forward-zone:
|
||||
name: "."
|
||||
forward-addr: 1.1.1.1
|
||||
forward-addr: 8.8.8.8
|
||||
${forward_addrs}
|
||||
EOF
|
||||
|
||||
systemctl restart unbound
|
||||
@@ -902,7 +909,7 @@ function check_services() {
|
||||
|
||||
check_disk_space
|
||||
|
||||
args=$(getopt -o "" -l "admin-login,disable-dnssec,enable-remote-support,disable-remote-support,help,owner-login,patch:,recreate-containers,recreate-docker,fix-docker-version,send-diagnostics,unbound-use-external-dns,troubleshoot,check-db-migrations,apply-db-migrations,check-services" -n "$0" -- "$@")
|
||||
args=$(getopt -o "" -l "admin-login,disable-dnssec,enable-remote-support,disable-remote-support,help,owner-login,patch:,recreate-containers,recreate-docker,fix-docker-version,send-diagnostics,unbound-forward-dns:,troubleshoot,check-db-migrations,apply-db-migrations,check-services" -n "$0" -- "$@")
|
||||
eval set -- "${args}"
|
||||
|
||||
while true; do
|
||||
@@ -919,7 +926,7 @@ while true; do
|
||||
--send-diagnostics) send_diagnostics; exit 0;;
|
||||
--troubleshoot) troubleshoot; exit 0;;
|
||||
--disable-dnssec) disable_dnssec; exit 0;;
|
||||
--unbound-use-external-dns) unbound_use_external_dns; exit 0;;
|
||||
--unbound-forward-dns) unbound_forward_dns "$2"; exit 0;;
|
||||
--recreate-containers) recreate_containers; exit 0;;
|
||||
--recreate-docker) recreate_docker; exit 0;;
|
||||
--fix-docker-version) fix_docker_version; exit 0;;
|
||||
|
||||
Reference in New Issue
Block a user