Updated logger function to escape message part

This commit is contained in:
bergware
2023-10-02 22:16:23 +02:00
parent cabaa5a437
commit 3903686c5f
15 changed files with 25 additions and 26 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ function update_wireguard($ifname) {
$vtun = basename($wg,'.conf');
// interface has changed?
if (exec("grep -Pom1 ' dev $nic ' $wg")=='') {
exec("logger -t netconfig 'updated wireguard $vtun configuration'");
exec("logger -t netconfig -- \"updated wireguard $vtun configuration\"");
exec("sed -ri 's/ dev (br0|bond0|eth0) / dev $nic /' $wg");
}
// restart active wireguard tunnels
@@ -6,7 +6,7 @@ if [[ -n $1 ]]; then
fi
for cmd in $SERVICES; do
if /etc/rc.d/rc.$cmd update; then
logger -t network "reload service: $cmd"
logger -t network -- "reload service: $cmd"
/etc/rc.d/rc.$cmd reload >/dev/null 2>&1
fi
done
@@ -1,7 +1,7 @@
#!/bin/bash
lock=/tmp/atlock.tmp
logger -t network "update services: ${1:-1}s"
logger -t network -- "update services: ${1:-1}s"
rm -f $lock
echo "sleep ${1:-1};/usr/local/emhttp/webGui/scripts/reload_services $lock"|at -M now 2>/dev/null
exit 0
+1 -1
View File
@@ -34,7 +34,7 @@ while :; do
IP=$(ip -4 addr show dev $LINK|grep -Pom1 'inet \K.[^/]+')
PORT=$(wg show $WG listen-port)
upnpc -u $XML -m $LINK -e "WireGuard-$WG" -a $IP $PORT $PORT udp >/dev/null 2>&1
[[ $? -eq 0 ]] && logger -t upnpc "Added port $PORT/udp" || logger -t upnpc "Failed to add port $PORT/udp"
[[ $? -eq 0 ]] && logger -t upnpc -- "Added port $PORT/udp" || logger -t upnpc -- "Failed to add port $PORT/udp"
fi
done
fi
+4 -4
View File
@@ -38,18 +38,18 @@ add)
upnpc -u $XML -m $LINK -e $3 -a $4 $5 $6 $7 >/dev/null 2>&1
if [[ $? -eq 0 ]]; then
[[ -n $WG ]] && at -M -f ${POLLER}_start now 2>/dev/null
logger -t upnpc "Added port $5/$7"
logger -t upnpc -- "Added port $5/$7"
else
logger -t upnpc "Failed to add port $5/$7"
logger -t upnpc -- "Failed to add port $5/$7"
fi
;;
del)
upnpc -u $XML -m $LINK -d $3 $4 >/dev/null 2>&1
if [[ $? -eq 0 ]]; then
[[ -z $WG && -n $(pgrep -f $POLLER) ]] && pkill -f $POLLER
logger -t upnpc "Deleted port $3/$4"
logger -t upnpc -- "Deleted port $3/$4"
else
logger -t upnpc "Failed to delete port $3/$4"
logger -t upnpc -- "Failed to delete port $3/$4"
fi
;;
esac