Community discussions

 
CodeXploit
newbie
Topic Author
Posts: 37
Joined: Sun Jun 01, 2014 1:40 pm

Sending E-mail when IP is added to address list

Mon Jan 25, 2016 12:10 pm

Hi,

I am trying to make this simple thing (i guess) and have no succes with it. I have firewall rule that detects port scanning. I would like that when another IP is added to dinamic Address list to trigger the Script that notifies me about that activity.

I have this working script allready in but i would like to be trigered when another port scanning attemps is made.

/tool e-mail send to=my.email@whatever.com subject="Port Scanning" start-tls=yes from=my.gmail@gmail.com password=youwishuknew port=587

I have a feeling im missing something obvius...

i tried this script but with no success.

:foreach i in [/ip firewall address-list find list=port scanners] do={ /tool e-mail send to=my.email@whatever.com subject="Port Scanning" start-tls=yes from=my.gmail@gmail.com password=youwishuknew port=587 body=("Port scanning From: " . [/ip firewall address-list get $i address])}
 
scampbell
Trainer
Trainer
Posts: 457
Joined: Thu Jun 22, 2006 5:20 am
Location: Wellington, NZ
Contact:

Re: Sending E-mail when IP is added to address list

Wed Feb 03, 2016 1:27 am

Use the log function in the firewall rule and have the action specified as an e-mail.

/ip firewall filter
add action=add-src-to-address-list address-list=PSD (insert matchers here) chain=forward log=yes log-prefix=PSD

/system logging action
add email-to=myaddress@somewhere.com name=emailPSD target=email
/system logging
add action=emailPSD prefix=PSD topics=firewall,info

Whenever a match occurs, you get an e-mail. Hopefully you do not get too many :-)
MTCNA, MTCWE, MTCRE, MTCTCE, MTCSE, MTCINE, Trainer
___________________
Mikrotik Distributor - New Zealand
http://www.campbell.co.nz
 
CodeXploit
newbie
Topic Author
Posts: 37
Joined: Sun Jun 01, 2014 1:40 pm

Re: Sending E-mail when IP is added to address list

Wed Feb 03, 2016 10:17 am

Use the log function in the firewall rule and have the action specified as an e-mail.

/ip firewall filter
add action=add-src-to-address-list address-list=PSD (insert matchers here) chain=forward log=yes log-prefix=PSD

/system logging action
add email-to=myaddress@somewhere.com name=emailPSD target=email
/system logging
add action=emailPSD prefix=PSD topics=firewall,info

Whenever a match occurs, you get an e-mail. Hopefully you do not get too many :-)

Worked like a charm. Thank you !
 
scampbell
Trainer
Trainer
Posts: 457
Joined: Thu Jun 22, 2006 5:20 am
Location: Wellington, NZ
Contact:

Re: Sending E-mail when IP is added to address list

Wed Feb 03, 2016 10:17 pm

Excellent :-)
MTCNA, MTCWE, MTCRE, MTCTCE, MTCSE, MTCINE, Trainer
___________________
Mikrotik Distributor - New Zealand
http://www.campbell.co.nz

Who is online

Users browsing this forum: No registered users and 12 guests