From c5cf31a8591a371e48aae0f4753867d9281ef7a6 Mon Sep 17 00:00:00 2001 From: creme Date: Mon, 11 Nov 2024 17:35:52 +0100 Subject: [PATCH] www: merge stats and tools to '04-additional.sh' --- .../{05-tools.sh => 04-additional.sh} | 14 +++++++++++--- .../base/ddmesh/var/www_freifunk/04-stats.sh | 19 ------------------- 2 files changed, 11 insertions(+), 22 deletions(-) rename salt/freifunk/base/ddmesh/var/www_freifunk/{05-tools.sh => 04-additional.sh} (64%) delete mode 100755 salt/freifunk/base/ddmesh/var/www_freifunk/04-stats.sh diff --git a/salt/freifunk/base/ddmesh/var/www_freifunk/05-tools.sh b/salt/freifunk/base/ddmesh/var/www_freifunk/04-additional.sh similarity index 64% rename from salt/freifunk/base/ddmesh/var/www_freifunk/05-tools.sh rename to salt/freifunk/base/ddmesh/var/www_freifunk/04-additional.sh index df16e541..4fda7240 100755 --- a/salt/freifunk/base/ddmesh/var/www_freifunk/05-tools.sh +++ b/salt/freifunk/base/ddmesh/var/www_freifunk/04-additional.sh @@ -1,18 +1,26 @@ #!/usr/bin/env bash -# Show Tools only for internal FFDD-Network clients +# Show additional links only for internal FFDD-Network clients # FFDD-Network ALLOWED_IP="10.200.0.0/15" # get REMOTE_ADDR from CGI ENV IP="$REMOTE_ADDR" +hostname_short="$(cat /etc/hostname | awk -F'.' '{print $1}')" + check_cidr="/usr/bin/grepcidr $ALLOWED_IP <(echo $IP) >/dev/null" eval "$check_cidr" -hostname_short="$(cat /etc/hostname | awk -F'.' '{print $1}')" - # exclude network != FFDD-Network and NAT'ed Rules from ipX/nodeX.freifunk-dresden.de if [ "$?" -eq 0 ] && [ "$IP" != '10.200.0.1' ]; then + # stats + cat <<-EOM + Statistik +
DNS Stats
+
Monitorix
+ EOM + + # tools if [ "$(uci -qX get ffdd.sys.apache_ddos_prevent)" -eq '0' ]; then cat <<-EOM Tools diff --git a/salt/freifunk/base/ddmesh/var/www_freifunk/04-stats.sh b/salt/freifunk/base/ddmesh/var/www_freifunk/04-stats.sh deleted file mode 100755 index ff37d837..00000000 --- a/salt/freifunk/base/ddmesh/var/www_freifunk/04-stats.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash -# Show Stats Link only for internal FFDD-Network clients - -# FFDD-Network -ALLOWED_IP="10.200.0.0/15" -# get REMOTE_ADDR from CGI ENV -IP="$REMOTE_ADDR" - -check_cidr="/usr/bin/grepcidr $ALLOWED_IP <(echo $IP) >/dev/null" -eval "$check_cidr" - -# exclude network != FFDD-Network and NAT'ed Rules from ipX/nodeX.freifunk-dresden.de -if [ "$?" -eq 0 ] && [ "$IP" != '10.200.0.1' ]; then - cat <<-EOM - Statistik -
DNS Stats
-
Monitorix
- EOM -fi