So put the script as wiki ?An option is writing a script that pulls IP's off a PBL and updates your block list, later you can inform the user that he might be infected with a virus and limit his service until he takes action, some ISP's do this, not the best option since PBL tend to put the whole subnet in rather than a specific IP.
Another option is to monitor traffic per specific user on port 25, legitimate users don't send tons of messages hence low number of packets per given time, if you see an abnormal increase in traffic on port 25 then its safe to assume that the user might be a spammer, just like that script you provided.
Oops, I still fear.Yes try that, however not to disturb service first monitor how the script behaves and if it yields results then implement it.
Don't just jump right in
So goto PPPoE router and goto CONNECTION TRACKING and see, who are connected to port 25 ?The first step should be monitoring which IP usues 25 port and make some statistics and then you can inform "suspected" users that they generate traffic on port 25 and ask them to check if all is configured properly.
No, it won't. Or at least it should not. Nowadays, no ordinary customer should have legitimate reasons to make outgoing connections to port 25/tcp, unless they are running their own mail server. Most email providers use alternative ports for client ESMTP (587/tcp and 465/tcp - the latter is not officially assigned but is a de-facto standard anyways), which also usually assume mandatory encryption and authentication.When I asked some experts at other forums, they say to block port 25 at your PPPOE router and core router.
is that a solution ?
But I guess, every customer outlook will stop working.
All the customers are either using Godaddy or Hostgator mostly for their websites and emails.No, it won't. Or at least it should not. Nowadays, no ordinary customer should have legitimate reasons to make outgoing connections to port 25/tcp, unless they are running their own mail server. Most email providers use alternative ports for client ESMTP (587/tcp and 465/tcp - the latter is not officially assigned but is a de-facto standard anyways), which also usually assume mandatory encryption and authentication.When I asked some experts at other forums, they say to block port 25 at your PPPOE router and core router.
is that a solution ?
But I guess, every customer outlook will stop working.
So, I'd suggest asking business customers if they are running an on-premises mail server, then allow outgoing 25/tcp for those who are, block for everyone else.
No, they won't. Quick google search shows that both Godaddy and Hostgator use 465/tcp for mail sending.So, if I block port 25, will they stop working ?
add action=add-src-to-address-list address-list=TRAFFIC_MX_SRC address-list-timeout=4h chain=forward dst-address-list=!TRAFFIC_MX_ALLOW dst-port=110,995,143,993,25,465,585 out-interface=ETH-WAN-ISP1 protocol=tcp
add action=add-src-to-address-list address-list=TRAFFIC_MX_SRC address-list-timeout=4h chain=output dst-address-list=!TRAFFIC_MX_ALLOW dst-port=110,995,143,993,25,465,585 out-interface=ETH-WAN-ISP1 protocol=tcp
add action=reject chain=forward dst-port=110,995,143,993,25,465,585 out-interface=ETH-WAN-ISP1 protocol=tcp src-address-list=!TRAFFIC_MX_ALLOW
add action=reject chain=outputt-port=110,995,143,993,25,465,585 out-interface=ETH-WAN-ISP1 protocol=tcp src-address-list=!TRAFFIC_MX_ALLOW
This is a good suggestion.Do not try to unblock entire customer subnets on PBL's. They exist for a reason. Customers can unblock themselves based on several conditions (e.g. fixed ip and mx/ptr records).
Also, you could host a smtp relay for your customers with a strict enough eula enabling you to get exclusion on most black lists and allowing you to restrict customer access on abuse.
I think I should better block them port 25 and then wait for emails of customers.No, they won't. Quick google search shows that both Godaddy and Hostgator use 465/tcp for mail sending.So, if I block port 25, will they stop working ?
No, just advertise it passively on your website. Your customers can continue with their current settings. If they experience problems with PBL (which is, imo, their problem) you can refer them to your relaying server.This is a good suggestion.Do not try to unblock entire customer subnets on PBL's. They exist for a reason. Customers can unblock themselves based on several conditions (e.g. fixed ip and mx/ptr records).
Also, you could host a smtp relay for your customers with a strict enough eula enabling you to get exclusion on most black lists and allowing you to restrict customer access on abuse.
So, I should better host a mail server myself and use it as SMTP relay ?
Then email all customers to use that as outgoing server ?
But isn't that too much load for my mail server ?
Okay let me ask my developer if he knows about it. Very confusingNo, just advertise it passively on your website. Your customers can continue with their current settings. If they experience problems with PBL (which is, imo, their problem) you can refer them to your relaying server.This is a good suggestion.Do not try to unblock entire customer subnets on PBL's. They exist for a reason. Customers can unblock themselves based on several conditions (e.g. fixed ip and mx/ptr records).
Also, you could host a smtp relay for your customers with a strict enough eula enabling you to get exclusion on most black lists and allowing you to restrict customer access on abuse.
So, I should better host a mail server myself and use it as SMTP relay ?
Then email all customers to use that as outgoing server ?
But isn't that too much load for my mail server ?
You will have to invest time and material for your email server, but at least this infrastructure is under your control. And you're not the one to blame.
Not true in 100% .....If they experience problems with PBL (which is, imo, their problem) you can refer them to your relaying server.
Whats your final suggestion ?Not true in 100% .....If they experience problems with PBL (which is, imo, their problem) you can refer them to your relaying server.
If PBL blocks whole subnet instead of particular addresses then it backfires on "good guys". They have no chance to remove themselves from PBL as subnet is owned by ISP and they are not guilty but they have to "serve" sentence.
It is better to prevent than to cure ....
So, 1st step is block port 25.As /22 subnet owner try to remove whole subnet from PBL.
Check who is responsible for mail traffic.
Warn/inform users from the top of the usage list about problems.
Block 25 port ... leave 587 open
You need to choose: difficulties for customers or blocked subnet .....
"To ban or not to ban ? That it admins' question"
add action=drop chain=output dst-port=25 out-interface=ETH-WAN-ISP1 protocol=tcp src-address=IPofClient1
add action=drop chain=output dst-port=25 out-interface=ETH-WAN-ISP1 protocol=tcp src-address=IPofClient2
....
add action=drop chain=output dst-port=25 out-interface=ETH-WAN-ISP1 protocol=tcp src-address=IPofClientN
Okay so block the port 25 completely.Warn/inform users that you will block port 25
Block port 25 and track who is generating traffic to port 25. You can make rules for each customer:and you clearly will see who makes most of traffic watching counters.Code: Select alladd action=drop chain=output dst-port=25 out-interface=ETH-WAN-ISP1 protocol=tcp src-address=IPofClient1 add action=drop chain=output dst-port=25 out-interface=ETH-WAN-ISP1 protocol=tcp src-address=IPofClient2 .... add action=drop chain=output dst-port=25 out-interface=ETH-WAN-ISP1 protocol=tcp src-address=IPofClientN
So Block Port 25 on Border or Core or PPPoE router alone ?You are checking if port 25 at your site is open. Simply: some server in the Internet tries to open port 25 at your site.
You are not checking if you are transmitting to port 25 somwhere in the internet.
/ip firewall filter
add chain=forward protocol=tcp dst-port=25 src-address-list=spammer
action=drop comment="BLOCK SPAMMERS OR INFECTED USERS"
add chain=forward protocol=tcp dst-port=25 connection-limit=30,32 limit=50,5 action=add-src-to-address-list
address-list=spammer address-list-timeout=1d comment="Detect and add-list SMTP virus or spammers"
Still doesnt get packets./ ip firewall filter
add chain=forward protocol=tcp dst-port=25 dst-address-list=!SMTP-addr action=drop comment="" disabled=no
/ ip firewall address-list
add list=SMTP-addr address=1.1.1.1/32 comment="ISP SMTP" disabled=no
add list=SMTP-addr address=2.2.2.2/32 comment="Cust1 SMTP" disabled=no
add list=SMTP-addr address=3.3.3.3/32 comment="Cust2 SMTP" disabled=no
What should be the rule if I want to know which IP are spamming and which IP list should be approved ?For a global operation of blocking port 25, you're definitely going to want to allow SMTP for some sources - suppose your own company's mail server, for instance, or any customers who are operating their own mail server.
You need to create an IP list for hosts that are allowed to use port 25
e.g.:
/ip firewall address-list add address=x.x.x.x list=MXokay
And then add any more approved hosts to this list. This is a list of hosts which are permitted to use port 25.
Then in your filter rule, add the criteria:
src-address-list=!MXokay
! means "not" - so this criteria means that if the src address is NOT in the list MXokay, then they may be blocked if the other criteria are true.
If the src IP --IS-- in the list, then the criteria is false, so may not be blocked by the rule.
You wrote it OR.Read this once again: http://forum.mikrotik.com/viewtopic.php ... 84#p544328
Amazing.Rules 1,2 collect data in forward and output chains
Rules 3,4 filter mails in forward and output chains
You can use all of them at the same time.
Okay then putting to border, core and NAS.For each device which sends data directly to the Internet ... if there is more than one then for each one but then for each device you need to maintain lists.
It is like gates on the airport ... for each gate which passangers are going through you need security officer. If you can pass all the people via the only one gate then you need only one security person which need to be instructed what to instead of full team training.
I was checking Comcast website and I see they have blocked all those ports.For each device which sends data directly to the Internet ... if there is more than one then for each one but then for each device you need to maintain lists.
It is like gates on the airport ... for each gate which passangers are going through you need security officer. If you can pass all the people via the only one gate then you need only one security person which need to be instructed what to instead of full team training.
KISSNo... use KISS rule ...
Rules for for e-mail
Rules for ssh
Rules for WWW
Rules for SPI ...
Rules for .... whatever you want to filter
If you do not know this acronym: "Keep It Simple Stupid"KISS Where do I find more info about it ?
110,995,143,993,25,465,585
/ip firewall filter
add action=add-src-to-address-list address-list=BAD_SMTP_CLIENTS address-list-timeout=4h chain=forward dst-address-list=!GOOD_SMTP_CLIENTS dst-port=110,995,143,993,25,585 out-interface=ether6 protocol=tcp
add action=add-src-to-address-list address-list=BAD_SMTP_CLIENTS address-list-timeout=4h chain=output dst-address-list=!GOOD_SMTP_CLIENTS dst-port=110,995,143,993,25,585 out-interface=ether6 protocol=tcp
add action=reject chain=forward dst-port=110,995,143,993,25,585 out-interface=ether6 protocol=tcp src-address-list=!GOOD_SMTP_CLIENTS
add action=reject chain=output dst-port=110,995,143,993,25,585 out-interface=ether6 protocol=tcp src-address-list=!GOOD_SMTP_CLIENTS
Oops.Chances are you have the rules in the wrong order, below one that permits the traffic you are trying to log and filter out.
add action=reject chain=input dst-port=25 in-interface=ether6 protocol=tcp src-address-list=!GOOD_SMTP_CLIENTS
/ip firewall filter
add action=add-src-to-address-list address-list=BAD_SMTP_CLIENTS address-list-timeout=4h chain=forward dst-address-list=!GOOD_SMTP_CLIENTS dst-port=110,995,143,993,25,585 out-interface=ether6 protocol=tcp
add action=add-src-to-address-list address-list=BAD_SMTP_CLIENTS address-list-timeout=4h chain=output dst-address-list=!GOOD_SMTP_CLIENTS dst-port=110,995,143,993,25,585 out-interface=ether6 protocol=tcp
add action=reject chain=forward dst-port=110,995,143,993,25,585 out-interface=ether6 protocol=tcp src-address-list=!GOOD_SMTP_CLIENTS
add action=reject chain=output dst-port=110,995,143,993,25,585 out-interface=ether6 protocol=tcp src-address-list=!GOOD_SMTP_CLIENTS
add action=reject chain=input dst-port=25 in-interface=ether6 protocol=tcp src-address-list=!GOOD_SMTP_CLIENTS
Mine is still not blocked, very confused.Am a newbie here especially on the firewall thing. I have a similar problem where my entire /23 subnet is on PBL. Am more of a routing person but I have to deal with this. Is anyone willing to help with this
Soamz:
Let me explain... these four rules you have applied are not blocking incoming packets to the router.
When you are telnetting from home (WAN side)to port 25 at yourwebsite then you have access to your SMTP port as it is not blocked.
To block it you need other rule:Rule blocks access to port 25 in input chain as packet is incoming to the router.Code: Select alladd action=reject chain=input dst-port=25 in-interface=ether6 protocol=tcp src-address-list=!GOOD_SMTP_CLIENTS
I could be misunderstanding you, BartoszP, and if so, then I apologize for that...Yes. I assume that smtp server is behind the router.
No. It should be input chain as packets are incoming to the router so they are blocked on input to the router.
The missing part are rules which are passing packets to the real server. It could be one destination NAT rule or the pair of DST & SRC NAT.
Hewever, despite the number of rules, the input chain blocks every packet trying to reach the WAN interface of the router at port 25 except permitted ones.
I could be ... snip-snip ...Yes. ... snip-snip ....