From e004d27b28bf3da43101948903c56a7cf66be4eb Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Mon, 30 Nov 2020 18:58:23 +0000 Subject: [PATCH 1/7] Fix processing of CONDITIONAL_FORWARDING_REVERSE Signed-off-by: Adam Warner --- advanced/Scripts/webpage.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 15471ad4..7cf0ae75 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -217,6 +217,11 @@ trust-anchor=.,20326,8,2,E06D44B80B8F1D39A95C0B0D7C65D08458E880409BBC68345710423 if [[ "${CONDITIONAL_FORWARDING}" == true ]]; then # Convert legacy "conditional forwarding" to rev-server configuration + delete_setting "REV_SERVER" + delete_setting "REV_SERVER_DOMAIN" + delete_setting "REV_SERVER_TARGET" + delete_setting "REV_SERVER_CIDR" + REV_SERVER=true add_setting "REV_SERVER" "true" @@ -226,7 +231,17 @@ trust-anchor=.,20326,8,2,E06D44B80B8F1D39A95C0B0D7C65D08458E880409BBC68345710423 REV_SERVER_TARGET="${CONDITIONAL_FORWARDING_IP}" add_setting "REV_SERVER_TARGET" "${REV_SERVER_TARGET}" - REV_SERVER_CIDR="${CONDITIONAL_FORWARDING_REVERSE}" + search="in-addr.arpa" + if [[ "$CONDITIONAL_FORWARDING_REVERSE" == *"$search" ]];then + arrRev=(${CONDITIONAL_FORWARDING_REVERSE//./ }) + case ${#arrRev[@]} in + 6 ) REV_SERVER_CIDR="${arrRev[3]}.${arrRev[2]}.${arrRev[1]}.${arrRev[0]}/32";; + 5 ) REV_SERVER_CIDR="${arrRev[2]}.${arrRev[1]}.${arrRev[0]}.0/24";; + 4 ) REV_SERVER_CIDR="${arrRev[1]}.${arrRev[0]}.0.0/16";; + 3 ) REV_SERVER_CIDR="${arrRev[0]}.0.0.0/8";; + esac + fi + if [ -z "${REV_SERVER_CIDR}" ]; then # Convert existing input to /24 subnet (preserves legacy behavior) # This sed converts "192.168.1.2" to "192.168.1.0/24" From 6cb8f3f403928620e23e35158ae4f89a34487df7 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Mon, 30 Nov 2020 21:18:25 +0000 Subject: [PATCH 2/7] Add some comments Signed-off-by: Adam Warner --- advanced/Scripts/webpage.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 7cf0ae75..ebeb64fa 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -217,6 +217,7 @@ trust-anchor=.,20326,8,2,E06D44B80B8F1D39A95C0B0D7C65D08458E880409BBC68345710423 if [[ "${CONDITIONAL_FORWARDING}" == true ]]; then # Convert legacy "conditional forwarding" to rev-server configuration + # Remove any existing REV_SERVER settings delete_setting "REV_SERVER" delete_setting "REV_SERVER_DOMAIN" delete_setting "REV_SERVER_TARGET" @@ -231,6 +232,11 @@ trust-anchor=.,20326,8,2,E06D44B80B8F1D39A95C0B0D7C65D08458E880409BBC68345710423 REV_SERVER_TARGET="${CONDITIONAL_FORWARDING_IP}" add_setting "REV_SERVER_TARGET" "${REV_SERVER_TARGET}" + #Convert CONDITIONAL_FORWARDING_REVERSE if neccasery e.g: + # 1.1.168.192.in-addr.arpa to 192.168.1.1/32 + # 1.168.192.in-addr.arpa to 192.168.1.0/24 + # 168.192.in-addr.arpa to 192.168.0.0/16 + # 192.in-addr.arpa to 192.0.0.0/8 search="in-addr.arpa" if [[ "$CONDITIONAL_FORWARDING_REVERSE" == *"$search" ]];then arrRev=(${CONDITIONAL_FORWARDING_REVERSE//./ }) @@ -241,7 +247,8 @@ trust-anchor=.,20326,8,2,E06D44B80B8F1D39A95C0B0D7C65D08458E880409BBC68345710423 3 ) REV_SERVER_CIDR="${arrRev[0]}.0.0.0/8";; esac fi - + + # If REV_SERVER_CIDR is not converted by the above, then use the REV_SERVER_TARGET variable to derive it if [ -z "${REV_SERVER_CIDR}" ]; then # Convert existing input to /24 subnet (preserves legacy behavior) # This sed converts "192.168.1.2" to "192.168.1.0/24" From 06c5fe2a89304ce73105964b867e20ee079ce2c9 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Mon, 30 Nov 2020 21:29:54 +0000 Subject: [PATCH 3/7] Set REV_SERVER_CIDR in the else condition if it is not in-addr.arpa Signed-off-by: Adam Warner --- advanced/Scripts/webpage.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index ebeb64fa..e9794cbf 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -246,6 +246,9 @@ trust-anchor=.,20326,8,2,E06D44B80B8F1D39A95C0B0D7C65D08458E880409BBC68345710423 4 ) REV_SERVER_CIDR="${arrRev[1]}.${arrRev[0]}.0.0/16";; 3 ) REV_SERVER_CIDR="${arrRev[0]}.0.0.0/8";; esac + else + # Set REV_SERVER_CIDR to whatever value it was set to + REV_SERVER_CIDR="$CONDITIONAL_FORWARDING_REVERSE" fi # If REV_SERVER_CIDR is not converted by the above, then use the REV_SERVER_TARGET variable to derive it From 4093959d3ede4151d5cb4e994f1b2e6ef744b007 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Mon, 30 Nov 2020 21:55:07 +0000 Subject: [PATCH 4/7] Appease stickler Signed-off-by: Adam Warner --- advanced/Scripts/webpage.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index e9794cbf..090d2a3a 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -239,7 +239,7 @@ trust-anchor=.,20326,8,2,E06D44B80B8F1D39A95C0B0D7C65D08458E880409BBC68345710423 # 192.in-addr.arpa to 192.0.0.0/8 search="in-addr.arpa" if [[ "$CONDITIONAL_FORWARDING_REVERSE" == *"$search" ]];then - arrRev=(${CONDITIONAL_FORWARDING_REVERSE//./ }) + arrRev=("${CONDITIONAL_FORWARDING_REVERSE//./ }") case ${#arrRev[@]} in 6 ) REV_SERVER_CIDR="${arrRev[3]}.${arrRev[2]}.${arrRev[1]}.${arrRev[0]}/32";; 5 ) REV_SERVER_CIDR="${arrRev[2]}.${arrRev[1]}.${arrRev[0]}.0/24";; From 58bc98ca44a457486862f738373e0d4114c878af Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Mon, 30 Nov 2020 22:30:59 +0000 Subject: [PATCH 5/7] Update advanced/Scripts/webpage.sh Signed-off-by: Adam Warner --- advanced/Scripts/webpage.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 090d2a3a..f7598000 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -232,7 +232,7 @@ trust-anchor=.,20326,8,2,E06D44B80B8F1D39A95C0B0D7C65D08458E880409BBC68345710423 REV_SERVER_TARGET="${CONDITIONAL_FORWARDING_IP}" add_setting "REV_SERVER_TARGET" "${REV_SERVER_TARGET}" - #Convert CONDITIONAL_FORWARDING_REVERSE if neccasery e.g: + #Convert CONDITIONAL_FORWARDING_REVERSE if necessary e.g: # 1.1.168.192.in-addr.arpa to 192.168.1.1/32 # 1.168.192.in-addr.arpa to 192.168.1.0/24 # 168.192.in-addr.arpa to 192.168.0.0/16 From f44b2f6aa3d1481de70efc674b6ca2dec44173aa Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Tue, 1 Dec 2020 17:27:21 +0000 Subject: [PATCH 6/7] Update advanced/Scripts/webpage.sh Signed-off-by: Adam Warner Co-authored-by: DL6ER --- advanced/Scripts/webpage.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index f7598000..e173759b 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -237,8 +237,7 @@ trust-anchor=.,20326,8,2,E06D44B80B8F1D39A95C0B0D7C65D08458E880409BBC68345710423 # 1.168.192.in-addr.arpa to 192.168.1.0/24 # 168.192.in-addr.arpa to 192.168.0.0/16 # 192.in-addr.arpa to 192.0.0.0/8 - search="in-addr.arpa" - if [[ "$CONDITIONAL_FORWARDING_REVERSE" == *"$search" ]];then + if [[ "${CONDITIONAL_FORWARDING_REVERSE}" == *"in-addr.arpa" ]];then arrRev=("${CONDITIONAL_FORWARDING_REVERSE//./ }") case ${#arrRev[@]} in 6 ) REV_SERVER_CIDR="${arrRev[3]}.${arrRev[2]}.${arrRev[1]}.${arrRev[0]}/32";; From 454c9a411c34e699484c335ffcc8e4a3b18c034c Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Tue, 1 Dec 2020 17:27:36 +0000 Subject: [PATCH 7/7] Update advanced/Scripts/webpage.sh Signed-off-by: Adam Warner Co-authored-by: DL6ER --- advanced/Scripts/webpage.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index e173759b..ef1d3ac9 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -247,7 +247,7 @@ trust-anchor=.,20326,8,2,E06D44B80B8F1D39A95C0B0D7C65D08458E880409BBC68345710423 esac else # Set REV_SERVER_CIDR to whatever value it was set to - REV_SERVER_CIDR="$CONDITIONAL_FORWARDING_REVERSE" + REV_SERVER_CIDR="${CONDITIONAL_FORWARDING_REVERSE}" fi # If REV_SERVER_CIDR is not converted by the above, then use the REV_SERVER_TARGET variable to derive it