collect-wireless-mac: use function for notification

This commit is contained in:
Christian Hesse 2018-10-09 15:50:37 +02:00
parent 9d53c82d1c
commit f262ff99a8
3 changed files with 12 additions and 9 deletions

View file

@ -10,6 +10,8 @@
:global "email-general-to"; :global "email-general-to";
:global "email-general-cc"; :global "email-general-cc";
:global SendNotification;
:local "place-before" [ / caps-man access-list find where comment="--- collected above ---" disabled ]; :local "place-before" [ / caps-man access-list find where comment="--- collected above ---" disabled ];
:if ([ :len $"place-before" ] = 0) do={ :if ([ :len $"place-before" ] = 0) do={
:error "Missing disabled access-list entry with comment '--- collected above ---'"; :error "Missing disabled access-list entry with comment '--- collected above ---'";
@ -40,9 +42,8 @@
$datetime . " connected to SSID " . $ssid . ", interface " . $interface); $datetime . " connected to SSID " . $ssid . ", interface " . $interface);
/ log info $message; / log info $message;
/ caps-man access-list add place-before=$"place-before" comment=$message mac-address=$mac disabled=yes; / caps-man access-list add place-before=$"place-before" comment=$message mac-address=$mac disabled=yes;
/ tool e-mail send to=$"email-general-to" cc=$"email-general-cc" \ $SendNotification ("[" . $identity . "] " . $mac . " connected to " . $ssid) \
subject=("[" . $identity . "] " . $mac . " connected to " . $ssid) \ ("A device with unknown MAC address connected to " . $ssid . " on " . $identity . ".\n\n" . \
body=("A device with unknown MAC address connected to " . $ssid . " on " . $identity . ".\n\n" . \
"Controller: " . $identity . "\n" . \ "Controller: " . $identity . "\n" . \
"Interface: " . $interface . "\n" . \ "Interface: " . $interface . "\n" . \
"SSID: " . $ssid . "\n" . \ "SSID: " . $ssid . "\n" . \

View file

@ -10,6 +10,8 @@
:global "email-general-to"; :global "email-general-to";
:global "email-general-cc"; :global "email-general-cc";
:global SendNotification;
:local "place-before" [ / interface wireless access-list find where comment="--- collected above ---" disabled ]; :local "place-before" [ / interface wireless access-list find where comment="--- collected above ---" disabled ];
:if ([ :len $"place-before" ] = 0) do={ :if ([ :len $"place-before" ] = 0) do={
:error "Missing disabled access-list entry with comment '--- collected above ---'"; :error "Missing disabled access-list entry with comment '--- collected above ---'";
@ -40,9 +42,8 @@
$datetime . " connected to SSID " . $ssid . ", interface " . $interface); $datetime . " connected to SSID " . $ssid . ", interface " . $interface);
/ log info $message; / log info $message;
/ interface wireless access-list add place-before=$"place-before" comment=$message mac-address=$mac disabled=yes; / interface wireless access-list add place-before=$"place-before" comment=$message mac-address=$mac disabled=yes;
/ tool e-mail send to=$"email-general-to" cc=$"email-general-cc" \ $SendNotification ("[" . $identity . "] " . $mac . " connected to " . $ssid) \
subject=("[" . $identity . "] " . $mac . " connected to " . $ssid) \ ("A device with unknown MAC address connected to " . $ssid . " on " . $identity . ".\n\n" . \
body=("A device with unknown MAC address connected to " . $ssid . " on " . $identity . ".\n\n" . \
"Controller: " . $identity . "\n" . \ "Controller: " . $identity . "\n" . \
"Interface: " . $interface . "\n" . \ "Interface: " . $interface . "\n" . \
"SSID: " . $ssid . "\n" . \ "SSID: " . $ssid . "\n" . \

View file

@ -11,6 +11,8 @@
:global "email-general-to"; :global "email-general-to";
:global "email-general-cc"; :global "email-general-cc";
:global SendNotification;
:local "place-before" [ / %PATH% access-list find where comment="--- collected above ---" disabled ]; :local "place-before" [ / %PATH% access-list find where comment="--- collected above ---" disabled ];
:if ([ :len $"place-before" ] = 0) do={ :if ([ :len $"place-before" ] = 0) do={
:error "Missing disabled access-list entry with comment '--- collected above ---'"; :error "Missing disabled access-list entry with comment '--- collected above ---'";
@ -42,9 +44,8 @@
$datetime . " connected to SSID " . $ssid . ", interface " . $interface); $datetime . " connected to SSID " . $ssid . ", interface " . $interface);
/ log info $message; / log info $message;
/ %PATH% access-list add place-before=$"place-before" comment=$message mac-address=$mac disabled=yes; / %PATH% access-list add place-before=$"place-before" comment=$message mac-address=$mac disabled=yes;
/ tool e-mail send to=$"email-general-to" cc=$"email-general-cc" \ $SendNotification ("[" . $identity . "] " . $mac . " connected to " . $ssid) \
subject=("[" . $identity . "] " . $mac . " connected to " . $ssid) \ ("A device with unknown MAC address connected to " . $ssid . " on " . $identity . ".\n\n" . \
body=("A device with unknown MAC address connected to " . $ssid . " on " . $identity . ".\n\n" . \
"Controller: " . $identity . "\n" . \ "Controller: " . $identity . "\n" . \
"Interface: " . $interface . "\n" . \ "Interface: " . $interface . "\n" . \
"SSID: " . $ssid . "\n" . \ "SSID: " . $ssid . "\n" . \