Separate command to change dynamic dns settings
This commit is contained in:
parent
4bdd922522
commit
97b25053bf
|
@ -320,159 +320,6 @@ function choose_default_domain_name {
|
||||||
save_configuration_values
|
save_configuration_values
|
||||||
}
|
}
|
||||||
|
|
||||||
function dynamic_dns_setup {
|
|
||||||
W=(1 freedns.afraid.org
|
|
||||||
2 dyn.com
|
|
||||||
3 zoneedit.com
|
|
||||||
4 no-ip.com
|
|
||||||
5 easydns.com
|
|
||||||
6 dnsomatic.com
|
|
||||||
7 dns.he.net
|
|
||||||
8 tunnelbroker.net
|
|
||||||
9 sitelutions.com
|
|
||||||
10 dnsexit.com
|
|
||||||
11 changeip.com
|
|
||||||
12 zerigo.com
|
|
||||||
13 dhis.org
|
|
||||||
14 nsupdate.info
|
|
||||||
15 loopia.com
|
|
||||||
16 namecheap.com
|
|
||||||
17 ovh.com
|
|
||||||
18 dtdns.com
|
|
||||||
19 giradns.com
|
|
||||||
20 duiadns.net
|
|
||||||
21 ddnss.de
|
|
||||||
22 dynv6.com
|
|
||||||
23 ipv4.dynv6.com
|
|
||||||
24 spdyn.de
|
|
||||||
25 freemyip.com
|
|
||||||
26 cloudxns.net)
|
|
||||||
|
|
||||||
# shellcheck disable=SC2068
|
|
||||||
selection=$(dialog --backtitle $"Freedombone Configuration" --title $"Dynamic DNS" --menu $"Choose Dynamic DNS provider, or ESC for none:" 24 60 32 "${W[@]}" 3>&2 2>&1 1>&3)
|
|
||||||
|
|
||||||
if [ ! "$selection" ]; then
|
|
||||||
if [ -f /etc/systemd/system/inadyn.service ]; then
|
|
||||||
systemctl stop inadyn
|
|
||||||
systemctl disable inadyn
|
|
||||||
fi
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
case $selection in
|
|
||||||
1) DDNS_PROVIDER="default@freedns.afraid.org";;
|
|
||||||
2) DDNS_PROVIDER="default@www.dyn.com";;
|
|
||||||
3) DDNS_PROVIDER="default@www.zoneedit.com";;
|
|
||||||
4) DDNS_PROVIDER="default@www.no-ip.com";;
|
|
||||||
5) DDNS_PROVIDER="default@www.easydns.com";;
|
|
||||||
6) DDNS_PROVIDER="default@www.dnsomatic.com";;
|
|
||||||
7) DDNS_PROVIDER="default@dns.he.net";;
|
|
||||||
8) DDNS_PROVIDER="default@www.tunnelbroker.net";;
|
|
||||||
9) DDNS_PROVIDER="default@www.sitelutions.com";;
|
|
||||||
10) DDNS_PROVIDER="default@www.dnsexit.com";;
|
|
||||||
11) DDNS_PROVIDER="default@www.changeip.com";;
|
|
||||||
12) DDNS_PROVIDER="default@www.zerigo.com";;
|
|
||||||
13) DDNS_PROVIDER="default@www.dhis.org";;
|
|
||||||
14) DDNS_PROVIDER="default@nsupdate.info";;
|
|
||||||
15) DDNS_PROVIDER="default@www.loopia.com";;
|
|
||||||
16) DDNS_PROVIDER="default@www.namecheap.com";;
|
|
||||||
17) DDNS_PROVIDER="default@www.ovh.com";;
|
|
||||||
18) DDNS_PROVIDER="default@www.dtdns.com";;
|
|
||||||
19) DDNS_PROVIDER="default@giradns.com";;
|
|
||||||
20) DDNS_PROVIDER="default@www.duiadns.net";;
|
|
||||||
21) DDNS_PROVIDER="default@ddnss.de";;
|
|
||||||
22) DDNS_PROVIDER="default@dynv6.com";;
|
|
||||||
23) DDNS_PROVIDER="default@ipv4.dynv6.com";;
|
|
||||||
24) DDNS_PROVIDER="default@spdyn.de";;
|
|
||||||
25) DDNS_PROVIDER="default@freemyip.com";;
|
|
||||||
26) DDNS_PROVIDER="default@www.cloudxns.net";;
|
|
||||||
esac
|
|
||||||
save_configuration_values
|
|
||||||
|
|
||||||
valid_ddns_username=
|
|
||||||
valid_ddns_password=
|
|
||||||
if [[ "$DDNS_PROVIDER" == "none" ]]; then
|
|
||||||
if [ -f /etc/systemd/system/inadyn.service ]; then
|
|
||||||
systemctl stop inadyn
|
|
||||||
systemctl disable inadyn
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
while [ ! $valid_ddns_username ]
|
|
||||||
do
|
|
||||||
data=$(mktemp 2>/dev/null)
|
|
||||||
dialog --backtitle $"Freedombone Configuration" \
|
|
||||||
--inputbox $"Dynamic DNS provider username" 10 30 "$(grep 'DDNS_USERNAME' temp.cfg | awk -F '=' '{print $2}')" 2> "$data"
|
|
||||||
sel=$?
|
|
||||||
case $sel in
|
|
||||||
0) possible_username=$(cat "$data")
|
|
||||||
if [ "$possible_username" ]; then
|
|
||||||
if [ ${#possible_username} -gt 1 ]; then
|
|
||||||
valid_ddns_username=$(cat "$data")
|
|
||||||
# shellcheck disable=SC2034
|
|
||||||
DDNS_USERNAME="$valid_ddns_username"
|
|
||||||
rm -f "$data"
|
|
||||||
break;
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
1) rm -f "$data"
|
|
||||||
exit 1;;
|
|
||||||
255) rm -f "$data"
|
|
||||||
exit 1;;
|
|
||||||
esac
|
|
||||||
rm -f "$data"
|
|
||||||
done
|
|
||||||
save_configuration_values
|
|
||||||
|
|
||||||
while [ ! $valid_ddns_password ]
|
|
||||||
do
|
|
||||||
data=$(mktemp 2>/dev/null)
|
|
||||||
dialog --backtitle $"Freedombone Configuration" \
|
|
||||||
--clear \
|
|
||||||
--insecure \
|
|
||||||
--passwordbox $"Dynamic DNS provider password" 10 30 "$(grep 'DDNS_PASSWORD' temp.cfg | awk -F '=' '{print $2}')" 2> "$data"
|
|
||||||
sel=$?
|
|
||||||
case $sel in
|
|
||||||
0) possible_password=$(cat "$data")
|
|
||||||
if [ "$possible_password" ]; then
|
|
||||||
if [ ${#possible_password} -gt 1 ]; then
|
|
||||||
valid_ddns_password=$(cat "$data")
|
|
||||||
DDNS_PASSWORD=$valid_ddns_password
|
|
||||||
break;
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
1) rm -f "$data"
|
|
||||||
exit 1;;
|
|
||||||
255) rm -f "$data"
|
|
||||||
exit 1;;
|
|
||||||
esac
|
|
||||||
rm -f "$data"
|
|
||||||
if [ ${#DDNS_PASSWORD} -lt "$MINIMUM_PASSWORD_LENGTH" ]; then
|
|
||||||
dialog --title $"Password quality check" --msgbox $"The password given was too short. It must be at least $MINIMUM_PASSWORD_LENGTH characters. You may need to change your password on the dynamic DNS provider's web site." 10 40
|
|
||||||
DDNS_PASSWORD=""
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
save_configuration_values
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function choose_dynamic_dns {
|
|
||||||
DDNS_PROVIDER="none"
|
|
||||||
|
|
||||||
if [[ "$SYSTEM_TYPE" != "mesh"* && "$ONION_ONLY" == "no" ]]; then
|
|
||||||
dialog --title $"Dynamic DNS" \
|
|
||||||
--backtitle $"Freedombone Configuration" \
|
|
||||||
--yesno $"\\nConfigure a dynamic DNS service?\\n\\nIf it is already handled by your internet router then select 'no'." 10 50
|
|
||||||
sel=$?
|
|
||||||
case $sel in
|
|
||||||
0) dynamic_dns_setup;;
|
|
||||||
255) exit 1;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
save_configuration_values
|
|
||||||
}
|
|
||||||
|
|
||||||
function choose_debian_repo {
|
function choose_debian_repo {
|
||||||
if [[ "$MINIMAL_INSTALL" == "no" ]]; then
|
if [[ "$MINIMAL_INSTALL" == "no" ]]; then
|
||||||
|
|
||||||
|
@ -1100,7 +947,7 @@ function interactive_config {
|
||||||
choose_rng
|
choose_rng
|
||||||
choose_debian_repo
|
choose_debian_repo
|
||||||
"${PROJECT_NAME}-wifi" --networksinteractive "$WIFI_NETWORKS_FILE"
|
"${PROJECT_NAME}-wifi" --networksinteractive "$WIFI_NETWORKS_FILE"
|
||||||
choose_dynamic_dns
|
"${PROJECT_NAME}-ddns"
|
||||||
choose_default_domain_name
|
choose_default_domain_name
|
||||||
choose_email_address
|
choose_email_address
|
||||||
interactive_key_recovery
|
interactive_key_recovery
|
||||||
|
|
|
@ -1981,11 +1981,12 @@ function menu_top_level {
|
||||||
13 $"Add Clacks"
|
13 $"Add Clacks"
|
||||||
14 $"Check for updates"
|
14 $"Check for updates"
|
||||||
15 $"Performance Benchmarks"
|
15 $"Performance Benchmarks"
|
||||||
16 $"Power off the system"
|
16 $"Change Dynamic DNS settings"
|
||||||
17 $"Restart the system")
|
17 $"Power off the system"
|
||||||
|
18 $"Restart the system")
|
||||||
|
|
||||||
# shellcheck disable=SC2068
|
# shellcheck disable=SC2068
|
||||||
selection=$(dialog --backtitle $"Freedombone Administrator Control Panel" --title $"Administrator Control Panel" --menu $"Choose an operation, or ESC to exit:" 24 60 24 "${W[@]}" 3>&2 2>&1 1>&3)
|
selection=$(dialog --backtitle $"Freedombone Administrator Control Panel" --title $"Administrator Control Panel" --menu $"Choose an operation, or ESC to exit:" 25 60 25 "${W[@]}" 3>&2 2>&1 1>&3)
|
||||||
|
|
||||||
if [ ! "$selection" ]; then
|
if [ ! "$selection" ]; then
|
||||||
break
|
break
|
||||||
|
@ -2012,8 +2013,9 @@ function menu_top_level {
|
||||||
13) add_clacks;;
|
13) add_clacks;;
|
||||||
14) check_for_updates;;
|
14) check_for_updates;;
|
||||||
15) performance_benchmarks;;
|
15) performance_benchmarks;;
|
||||||
16) shut_down_system;;
|
16) "${PROJECT_NAME}-ddns";;
|
||||||
17) restart_system;;
|
17) shut_down_system;;
|
||||||
|
18) restart_system;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,199 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# _____ _ _
|
||||||
|
# | __|___ ___ ___ _| |___ _____| |_ ___ ___ ___
|
||||||
|
# | __| _| -_| -_| . | . | | . | . | | -_|
|
||||||
|
# |__| |_| |___|___|___|___|_|_|_|___|___|_|_|___|
|
||||||
|
#
|
||||||
|
# Freedom in the Cloud
|
||||||
|
#
|
||||||
|
# Change dynamic dns settings
|
||||||
|
#
|
||||||
|
# License
|
||||||
|
# =======
|
||||||
|
#
|
||||||
|
# Copyright (C) 2018 Bob Mottram <bob@freedombone.net>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
PROJECT_NAME='freedombone'
|
||||||
|
|
||||||
|
export TEXTDOMAIN=${PROJECT_NAME}-ddns
|
||||||
|
export TEXTDOMAINDIR="/usr/share/locale"
|
||||||
|
|
||||||
|
source "$PROJECT_INSTALL_DIR/${PROJECT_NAME}-vars"
|
||||||
|
source "/usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-config"
|
||||||
|
|
||||||
|
function dynamic_dns_setup {
|
||||||
|
DDNS_PROVIDER='none'
|
||||||
|
|
||||||
|
W=(1 freedns.afraid.org
|
||||||
|
2 dyn.com
|
||||||
|
3 zoneedit.com
|
||||||
|
4 no-ip.com
|
||||||
|
5 easydns.com
|
||||||
|
6 dnsomatic.com
|
||||||
|
7 dns.he.net
|
||||||
|
8 tunnelbroker.net
|
||||||
|
9 sitelutions.com
|
||||||
|
10 dnsexit.com
|
||||||
|
11 changeip.com
|
||||||
|
12 zerigo.com
|
||||||
|
13 dhis.org
|
||||||
|
14 nsupdate.info
|
||||||
|
15 loopia.com
|
||||||
|
16 namecheap.com
|
||||||
|
17 ovh.com
|
||||||
|
18 dtdns.com
|
||||||
|
19 giradns.com
|
||||||
|
20 duiadns.net
|
||||||
|
21 ddnss.de
|
||||||
|
22 dynv6.com
|
||||||
|
23 ipv4.dynv6.com
|
||||||
|
24 spdyn.de
|
||||||
|
25 freemyip.com
|
||||||
|
26 cloudxns.net)
|
||||||
|
|
||||||
|
# shellcheck disable=SC2068
|
||||||
|
selection=$(dialog --backtitle $"Freedombone Configuration" --title $"Dynamic DNS" --menu $"Choose Dynamic DNS provider, or ESC for none:" 24 60 32 "${W[@]}" 3>&2 2>&1 1>&3)
|
||||||
|
|
||||||
|
if [ ! "$selection" ]; then
|
||||||
|
if [ -f /etc/systemd/system/inadyn.service ]; then
|
||||||
|
systemctl stop inadyn
|
||||||
|
systemctl disable inadyn
|
||||||
|
fi
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
case $selection in
|
||||||
|
1) DDNS_PROVIDER="default@freedns.afraid.org";;
|
||||||
|
2) DDNS_PROVIDER="default@www.dyn.com";;
|
||||||
|
3) DDNS_PROVIDER="default@www.zoneedit.com";;
|
||||||
|
4) DDNS_PROVIDER="default@www.no-ip.com";;
|
||||||
|
5) DDNS_PROVIDER="default@www.easydns.com";;
|
||||||
|
6) DDNS_PROVIDER="default@www.dnsomatic.com";;
|
||||||
|
7) DDNS_PROVIDER="default@dns.he.net";;
|
||||||
|
8) DDNS_PROVIDER="default@www.tunnelbroker.net";;
|
||||||
|
9) DDNS_PROVIDER="default@www.sitelutions.com";;
|
||||||
|
10) DDNS_PROVIDER="default@www.dnsexit.com";;
|
||||||
|
11) DDNS_PROVIDER="default@www.changeip.com";;
|
||||||
|
12) DDNS_PROVIDER="default@www.zerigo.com";;
|
||||||
|
13) DDNS_PROVIDER="default@www.dhis.org";;
|
||||||
|
14) DDNS_PROVIDER="default@nsupdate.info";;
|
||||||
|
15) DDNS_PROVIDER="default@www.loopia.com";;
|
||||||
|
16) DDNS_PROVIDER="default@www.namecheap.com";;
|
||||||
|
17) DDNS_PROVIDER="default@www.ovh.com";;
|
||||||
|
18) DDNS_PROVIDER="default@www.dtdns.com";;
|
||||||
|
19) DDNS_PROVIDER="default@giradns.com";;
|
||||||
|
20) DDNS_PROVIDER="default@www.duiadns.net";;
|
||||||
|
21) DDNS_PROVIDER="default@ddnss.de";;
|
||||||
|
22) DDNS_PROVIDER="default@dynv6.com";;
|
||||||
|
23) DDNS_PROVIDER="default@ipv4.dynv6.com";;
|
||||||
|
24) DDNS_PROVIDER="default@spdyn.de";;
|
||||||
|
25) DDNS_PROVIDER="default@freemyip.com";;
|
||||||
|
26) DDNS_PROVIDER="default@www.cloudxns.net";;
|
||||||
|
esac
|
||||||
|
save_configuration_values
|
||||||
|
|
||||||
|
valid_ddns_username=
|
||||||
|
valid_ddns_password=
|
||||||
|
if [[ "$DDNS_PROVIDER" == "none" ]]; then
|
||||||
|
if [ -f /etc/systemd/system/inadyn.service ]; then
|
||||||
|
systemctl stop inadyn
|
||||||
|
systemctl disable inadyn
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
while [ ! $valid_ddns_username ]
|
||||||
|
do
|
||||||
|
data=$(mktemp 2>/dev/null)
|
||||||
|
dialog --backtitle $"Freedombone Configuration" \
|
||||||
|
--inputbox $"Dynamic DNS provider username" 10 30 "$(grep 'DDNS_USERNAME' temp.cfg | awk -F '=' '{print $2}')" 2> "$data"
|
||||||
|
sel=$?
|
||||||
|
case $sel in
|
||||||
|
0) possible_username=$(cat "$data")
|
||||||
|
if [ "$possible_username" ]; then
|
||||||
|
if [ ${#possible_username} -gt 1 ]; then
|
||||||
|
valid_ddns_username=$(cat "$data")
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
DDNS_USERNAME="$valid_ddns_username"
|
||||||
|
rm -f "$data"
|
||||||
|
break;
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
1) rm -f "$data"
|
||||||
|
exit 1;;
|
||||||
|
255) rm -f "$data"
|
||||||
|
exit 1;;
|
||||||
|
esac
|
||||||
|
rm -f "$data"
|
||||||
|
done
|
||||||
|
save_configuration_values
|
||||||
|
|
||||||
|
while [ ! $valid_ddns_password ]
|
||||||
|
do
|
||||||
|
data=$(mktemp 2>/dev/null)
|
||||||
|
dialog --backtitle $"Freedombone Configuration" \
|
||||||
|
--clear \
|
||||||
|
--insecure \
|
||||||
|
--passwordbox $"Dynamic DNS provider password" 10 30 "$(grep 'DDNS_PASSWORD' temp.cfg | awk -F '=' '{print $2}')" 2> "$data"
|
||||||
|
sel=$?
|
||||||
|
case $sel in
|
||||||
|
0) possible_password=$(cat "$data")
|
||||||
|
if [ "$possible_password" ]; then
|
||||||
|
if [ ${#possible_password} -gt 1 ]; then
|
||||||
|
valid_ddns_password=$(cat "$data")
|
||||||
|
DDNS_PASSWORD=$valid_ddns_password
|
||||||
|
break;
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
1) rm -f "$data"
|
||||||
|
exit 1;;
|
||||||
|
255) rm -f "$data"
|
||||||
|
exit 1;;
|
||||||
|
esac
|
||||||
|
rm -f "$data"
|
||||||
|
if [ ${#DDNS_PASSWORD} -lt "$MINIMUM_PASSWORD_LENGTH" ]; then
|
||||||
|
dialog --title $"Password quality check" --msgbox $"The password given was too short. It must be at least $MINIMUM_PASSWORD_LENGTH characters. You may need to change your password on the dynamic DNS provider's web site." 10 40
|
||||||
|
DDNS_PASSWORD=""
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
save_configuration_values
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function choose_dynamic_dns {
|
||||||
|
DDNS_PROVIDER="none"
|
||||||
|
|
||||||
|
if [[ "$SYSTEM_TYPE" != "mesh"* && "$ONION_ONLY" == "no" ]]; then
|
||||||
|
dialog --title $"Dynamic DNS" \
|
||||||
|
--backtitle $"Freedombone Configuration" \
|
||||||
|
--yesno $"\\nConfigure a dynamic DNS service?\\n\\nIf it is already handled by your internet router then select 'no'." 10 50
|
||||||
|
sel=$?
|
||||||
|
case $sel in
|
||||||
|
0) dynamic_dns_setup;;
|
||||||
|
255) exit 1;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
save_configuration_values
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ ! "$CONFIGURATION_FILE" ]; then
|
||||||
|
CONFIGURATION_FILE=$HOME/${PROJECT_NAME}.cfg
|
||||||
|
fi
|
||||||
|
|
||||||
|
read_configuration_values
|
||||||
|
choose_dynamic_dns
|
||||||
|
|
||||||
|
exit 0
|
Loading…
Reference in New Issue