Community discussions

MUM Europe 2020
 
reeaws
just joined
Topic Author
Posts: 2
Joined: Fri Dec 13, 2013 10:04 pm

Blocking Spamhaus list

Mon Jan 27, 2014 6:18 pm

Hello everybody , i am new here so be gentle to me. Recently i bought a Mikrotik RB951G-2HnD and i am in love with Mikrotik. I always first do some reserch on the internet when i have a problem and then ask stupid questions.So i have a problem: i found this script and use it

////
# Generated by Joshaven Potter on Thu Jan 9 12:13:26 EST 2014
/ip firewall address-list
add list=blacklist address=183.136.213.200 comment=OpenBL
add list=blacklist address=61.147.116.13 comment=OpenBL
add list=blacklist address=117.79.239.117 comment=OpenBL
add list=blacklist address=61.147.113.165 comment=OpenBL
...

The implementation is simple… paste the following code into the terminal of any MikroTik and your router will grab the newest copy of my script file and run it regular basis.

The following will not block anything, it only adds IP’s to your address list. You will still have to create a firewall rule which will match src-address-list=Begone and drop the traffic in your input and or forward chains.
OpenBL

# Script which will download the drop list as a text file
/system script add name="Download_openbl" source={
/tool fetch url="http://joshaven.com/openbl.rsc" mode=http;
:log info "Downloaded openbl.rsc from Joshaven.com";
}

# Script which will Remove old Begone list and add new one
/system script add name="Replace_openbl" source={
:foreach i in=[/ip firewall address-list find ] do={
:if ( [/ip firewall address-list get $i comment] = "OpenBL" ) do={
/ip firewall address-list remove $i
}
}
/import file-name=openbl.rsc;
:log info "Removal old openbl and add new";
}

# Schedule the download and application of the openbl list
/system scheduler add comment="Download openbl list" interval=7d name="DownloadBegoneList" on-event=Download_openbl start-date=jan/01/1970 start-time=01:05:00
/system scheduler add comment="Apply openbl List" interval=7d name="InstallBegoneList" on-event=Replace_openbl start-date=jan/01/1970 start-time=01:15:00

SpamHaus

# Script which will download the drop list as a text file
/system script add name="Download_spamhaus" source={
/tool fetch url="http://joshaven.com/spamhaus.rsc" mode=http;
:log info "Downloaded spamhaus.rsc from Joshaven.com";
}

# Script which will Remove old Begone list and add new one
/system script add name="Replace_spamhaus" source={
:foreach i in=[/ip firewall address-list find ] do={
:if ( [/ip firewall address-list get $i comment] = "SpamHaus" ) do={
/ip firewall address-list remove $i
}
}
/import file-name=spamhaus.rsc;
:log info "Removal old openbl and add new";
}

# Schedule the download and application of the spamhaus list
/system scheduler add comment="Download spamnaus list" interval=7d name="DownloadSpamhausList" on-event=Download_spamhaus start-date=jan/01/1970 start-time=02:02:00
/system scheduler add comment="Apply spamnaus List" interval=7d name="InstallSpamhausList" on-event=Replace_spamhaus start-date=jan/01/1970 start-time=02:12:00



All nice and fine the script makes me a <black list> of Spamhaus IP's and openbl List. So now i whant to block this list so i use this command
add chain=forward src-address-list=!blacklist action=drop comment="drop BLACK LIST" disabled=no
and i have notice that my ping gets higher from 50 to 250 and my web pages crash.Can u pls help me find what is wrong in my rule or maybe find another one to block this IP's . Thank You!!!
 
deejayq
Member Candidate
Member Candidate
Posts: 195
Joined: Wed Feb 23, 2011 8:33 am

Re: Blocking Spamhaus list

Tue Jan 28, 2014 10:38 am

add chain=forward src-address-list=!blacklist action=drop comment="drop BLACK LIST" disabled=no
try without exclamation mark before blacklist
exclamation mark means NOT so you're blocking everything but the spammers :)
 
reeaws
just joined
Topic Author
Posts: 2
Joined: Fri Dec 13, 2013 10:04 pm

Re: Blocking Spamhaus list

Tue Jan 28, 2014 12:10 pm

Thank very much for u r answer deejayq. I told u i am new with Mikrotik. :lol:
 
cxsorious
just joined
Posts: 4
Joined: Tue Jul 16, 2013 6:51 pm

Re: Blocking Spamhaus list

Wed Jun 25, 2014 12:19 pm

Thanks :D

Who is online

Users browsing this forum: No registered users and 59 guests