From f262ff99a83d1c588b9eb275e9b17bb076ab3c8b Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 9 Oct 2018 15:50:37 +0200 Subject: collect-wireless-mac: use function for notification --- collect-wireless-mac.capsman | 7 ++++--- collect-wireless-mac.local | 7 ++++--- collect-wireless-mac.template | 7 ++++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/collect-wireless-mac.capsman b/collect-wireless-mac.capsman index de2fdb8..d60710f 100644 --- a/collect-wireless-mac.capsman +++ b/collect-wireless-mac.capsman @@ -10,6 +10,8 @@ :global "email-general-to"; :global "email-general-cc"; +:global SendNotification; + :local "place-before" [ / caps-man access-list find where comment="--- collected above ---" disabled ]; :if ([ :len $"place-before" ] = 0) do={ :error "Missing disabled access-list entry with comment '--- collected above ---'"; @@ -40,9 +42,8 @@ $datetime . " connected to SSID " . $ssid . ", interface " . $interface); / log info $message; / 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" \ - subject=("[" . $identity . "] " . $mac . " connected to " . $ssid) \ - body=("A device with unknown MAC address connected to " . $ssid . " on " . $identity . ".\n\n" . \ + $SendNotification ("[" . $identity . "] " . $mac . " connected to " . $ssid) \ + ("A device with unknown MAC address connected to " . $ssid . " on " . $identity . ".\n\n" . \ "Controller: " . $identity . "\n" . \ "Interface: " . $interface . "\n" . \ "SSID: " . $ssid . "\n" . \ diff --git a/collect-wireless-mac.local b/collect-wireless-mac.local index e18d8c9..68d24a6 100644 --- a/collect-wireless-mac.local +++ b/collect-wireless-mac.local @@ -10,6 +10,8 @@ :global "email-general-to"; :global "email-general-cc"; +:global SendNotification; + :local "place-before" [ / interface wireless access-list find where comment="--- collected above ---" disabled ]; :if ([ :len $"place-before" ] = 0) do={ :error "Missing disabled access-list entry with comment '--- collected above ---'"; @@ -40,9 +42,8 @@ $datetime . " connected to SSID " . $ssid . ", interface " . $interface); / log info $message; / 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" \ - subject=("[" . $identity . "] " . $mac . " connected to " . $ssid) \ - body=("A device with unknown MAC address connected to " . $ssid . " on " . $identity . ".\n\n" . \ + $SendNotification ("[" . $identity . "] " . $mac . " connected to " . $ssid) \ + ("A device with unknown MAC address connected to " . $ssid . " on " . $identity . ".\n\n" . \ "Controller: " . $identity . "\n" . \ "Interface: " . $interface . "\n" . \ "SSID: " . $ssid . "\n" . \ diff --git a/collect-wireless-mac.template b/collect-wireless-mac.template index 7c7c6f9..f295281 100644 --- a/collect-wireless-mac.template +++ b/collect-wireless-mac.template @@ -11,6 +11,8 @@ :global "email-general-to"; :global "email-general-cc"; +:global SendNotification; + :local "place-before" [ / %PATH% access-list find where comment="--- collected above ---" disabled ]; :if ([ :len $"place-before" ] = 0) do={ :error "Missing disabled access-list entry with comment '--- collected above ---'"; @@ -42,9 +44,8 @@ $datetime . " connected to SSID " . $ssid . ", interface " . $interface); / log info $message; / %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" \ - subject=("[" . $identity . "] " . $mac . " connected to " . $ssid) \ - body=("A device with unknown MAC address connected to " . $ssid . " on " . $identity . ".\n\n" . \ + $SendNotification ("[" . $identity . "] " . $mac . " connected to " . $ssid) \ + ("A device with unknown MAC address connected to " . $ssid . " on " . $identity . ".\n\n" . \ "Controller: " . $identity . "\n" . \ "Interface: " . $interface . "\n" . \ "SSID: " . $ssid . "\n" . \ -- cgit v1.2.3-70-g09d2