aboutsummaryrefslogtreecommitdiffstats
path: root/daily-psk.template.rsc
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2023-08-09 18:56:29 +0200
committerGravatar Christian Hesse <mail@eworm.de>2023-08-15 11:26:18 +0200
commit2c3e077b8ec984f501156f757c72a57703f846b4 (patch)
tree9cb609e7515b68256a37a6efe06b8373ca6eae8f /daily-psk.template.rsc
parentc37739c2f6b050c965e0fa734309e1ecbed90add (diff)
parent92aca1aac05ba943fa41c9c6640265991a906e30 (diff)
Merge branch 'wifiwave2' into next
Diffstat (limited to 'daily-psk.template.rsc')
-rw-r--r--daily-psk.template.rsc26
1 files changed, 17 insertions, 9 deletions
diff --git a/daily-psk.template.rsc b/daily-psk.template.rsc
index 777f6c0..125e6c5 100644
--- a/daily-psk.template.rsc
+++ b/daily-psk.template.rsc
@@ -7,8 +7,8 @@
# update daily PSK (pre shared key)
# https://git.eworm.de/cgit/routeros-scripts/about/doc/daily-psk.md
#
-# !! This is just a template! Replace '%PATH%' with 'caps-man'
-# !! or 'interface wireless'!
+# !! This is just a template to generate the real script!
+# !! Pattern '%TEMPL%' is replaced, paths are filtered.
:local 0 "daily-psk%TEMPL%";
:global GlobalFunctionsReady;
@@ -55,24 +55,32 @@ $WaitFullyConnected;
:local Date [ /system/clock/get date ];
:local NewPsk [ $GeneratePSK $Date ];
-:foreach AccList in=[ /%PATH%/access-list/find where comment~$DailyPskMatchComment ] do={
- :local IntName [ /interface/wireless/access-list/get $AccList interface ];
- :local Ssid [ /interface/wireless/get $IntName ssid ];
- :local OldPsk [ /interface/wireless/access-list/get $AccList private-pre-shared-key ];
- # /interface/wireless above - /caps-man below
+:foreach AccList in=[ /caps-man/access-list/find where comment~$DailyPskMatchComment ] do={
+:foreach AccList in=[ /interface/wifiwave2/access-list/find where comment~$DailyPskMatchComment ] do={
+:foreach AccList in=[ /interface/wireless/access-list/find where comment~$DailyPskMatchComment ] do={
:local SsidRegExp [ /caps-man/access-list/get $AccList ssid-regexp ];
+ :local SsidRegExp [ /interface/wifiwave2/access-list/get $AccList ssid-regexp ];
:local Configuration ([ /caps-man/configuration/find where ssid~$SsidRegExp ]->0);
+ :local Configuration ([ /interface/wifiwave2/configuration/find where ssid~$SsidRegExp ]->0);
:local Ssid [ /caps-man/configuration/get $Configuration ssid ];
+ :local Ssid [ /interface/wifiwave2/configuration/get $Configuration ssid ];
:local OldPsk [ /caps-man/access-list/get $AccList private-passphrase ];
+ :local OldPsk [ /interface/wifiwave2/access-list/get $AccList passphrase ];
+ # /caps-man /interface/wifiwave2 above - /interface/wireless below
+ :local IntName [ /interface/wireless/access-list/get $AccList interface ];
+ :local Ssid [ /interface/wireless/get $IntName ssid ];
+ :local OldPsk [ /interface/wireless/access-list/get $AccList private-pre-shared-key ];
:local Skip 0;
:if ($NewPsk != $OldPsk) do={
$LogPrintExit2 info $0 ("Updating daily PSK for " . $Ssid . " to " . $NewPsk . " (was " . $OldPsk . ")") false;
- /interface/wireless/access-list/set $AccList private-pre-shared-key=$NewPsk;
/caps-man/access-list/set $AccList private-passphrase=$NewPsk;
+ /interface/wifiwave2/access-list/set $AccList passphrase=$NewPsk;
+ /interface/wireless/access-list/set $AccList private-pre-shared-key=$NewPsk;
- :if ([ :len [ /interface/wireless/find where name=$IntName !disabled ] ] = 1) do={
:if ([ :len [ /caps-man/actual-interface-configuration/find where configuration.ssid=$Ssid !disabled ] ] > 0) do={
+ :if ([ :len [ /interface/wifiwave2/actual-configuration/find where configuration.ssid=$Ssid ] ] > 0) do={
+ :if ([ :len [ /interface/wireless/find where name=$IntName !disabled ] ] = 1) do={
:foreach SeenSsid in=$Seen do={
:if ($SeenSsid = $Ssid) do={
$LogPrintExit2 debug $0 ("Already sent a mail for SSID " . $Ssid . ", skipping.") false;