diff options
author | Christian Hesse <mail@eworm.de> | 2023-01-22 12:16:06 +0100 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2023-01-22 12:16:06 +0100 |
commit | c7498c6397b706d191741d0a6634d4adfbd4c0db (patch) | |
tree | e1420218333583a4fcd036138dc23270c57ffa70 | |
parent | e6c256cd4b74599f3f539ca2c48adab91bd5ee8e (diff) |
daily-psk: fixes for CAPsMAN
-rw-r--r-- | daily-psk.capsman | 7 | ||||
-rw-r--r-- | daily-psk.template | 8 |
2 files changed, 9 insertions, 6 deletions
diff --git a/daily-psk.capsman b/daily-psk.capsman index 46e4e1d..81cb5a2 100644 --- a/daily-psk.capsman +++ b/daily-psk.capsman @@ -60,8 +60,9 @@ $WaitFullyConnected; :local NewPsk [ $GeneratePSK $Date ]; :foreach AccList in=[ /caps-man/access-list/find where comment~$DailyPskMatchComment ] do={ - :local Ssid [ /caps-man/access-list/get $AccList ssid-regexp ]; - :local Configuration [ /caps-man/configuration/get ([ find where ssid=$Ssid ]->0) name ]; + :local SsidRegExp [ /caps-man/access-list/get $AccList ssid-regexp ]; + :local Configuration ([ /caps-man/configuration/find where ssid~$SsidRegExp ]->0); + :local Ssid [ /caps-man/configuration/get $Configuration ssid ]; :local OldPsk [ /caps-man/access-list/get $AccList private-passphrase ]; :local Skip 0; @@ -69,7 +70,7 @@ $WaitFullyConnected; $LogPrintExit2 info $0 ("Updating daily PSK for " . $Ssid . " to " . $NewPsk . " (was " . $OldPsk . ")") false; /caps-man/access-list/set $AccList private-passphrase=$NewPsk; - :if ([ :len [ /caps-man/interface/find where configuration=$Configuration ] ] > 0) do={ + :if ([ :len [ /caps-man/actual-interface-configuration/find where configuration.ssid=$Ssid !disabled ] ] > 0) do={ :foreach SeenSsid in=$Seen do={ :if ($SeenSsid = $Ssid) do={ $LogPrintExit2 debug $0 ("Already sent a mail for SSID " . $Ssid . ", skipping.") false; diff --git a/daily-psk.template b/daily-psk.template index 373cc96..811f2f8 100644 --- a/daily-psk.template +++ b/daily-psk.template @@ -63,9 +63,11 @@ $WaitFullyConnected; :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 Ssid [ /caps-man/access-list/get $AccList ssid-regexp ]; - :local Configuration [ /caps-man/configuration/get ([ find where ssid=$Ssid ]->0) name ]; :local OldPsk [ /interface/wireless/access-list/get $AccList private-pre-shared-key ]; + # /interface/wireless above - /caps-man below + :local SsidRegExp [ /caps-man/access-list/get $AccList ssid-regexp ]; + :local Configuration ([ /caps-man/configuration/find where ssid~$SsidRegExp ]->0); + :local Ssid [ /caps-man/configuration/get $Configuration ssid ]; :local OldPsk [ /caps-man/access-list/get $AccList private-passphrase ]; :local Skip 0; @@ -75,7 +77,7 @@ $WaitFullyConnected; /caps-man/access-list/set $AccList private-passphrase=$NewPsk; :if ([ :len [ /interface/wireless/find where name=$IntName !disabled ] ] = 1) do={ - :if ([ :len [ /caps-man/interface/find where configuration=$Configuration ] ] > 0) do={ + :if ([ :len [ /caps-man/actual-interface-configuration/find where configuration.ssid=$Ssid !disabled ] ] > 0) do={ :foreach SeenSsid in=$Seen do={ :if ($SeenSsid = $Ssid) do={ $LogPrintExit2 debug $0 ("Already sent a mail for SSID " . $Ssid . ", skipping.") false; |