• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

[SOLVED] Block smtp (25) on LAN network. Only allow mailserver to send mail

Scheduled Pinned Locked Moved Firewalling
20 Posts 5 Posters 2.5k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H
    Herman
    last edited by Herman Aug 15, 2018, 6:56 PM Aug 3, 2018, 12:58 PM

    Hello Everybody,

    I have chosen pfSense replaced he TMG 2010 firewall. So far pfSense is a great firewall. Still finding my way but already it runs like a charm.

    At the moment I am struggling with some smtp (25) outbound rules. Some help would be appreciated.

    My goal would be to block all outbound smtp for the LAN network except the mail server (Exchange 2013). I want to narrow down that clients are able to send spam mails. My ISP blocked my internet connection twice now because I was probably spamming. Spoke to them by phone but because of privacy reasons they will not tell me where the issue is coming from. Very difficult to troubleshoot I would say. So I think the first step would be to only allow the mail server sending mail outbound.

    What would be best practice to setup rules achieving my goal?

    I appreciate your thoughts and tips. Many thanks in advance.

    Kind regards,
    Herman F.

    Limburg | The Netherlands.
    It is nice to be important. But it is more important to be nice! | Failure, the best teacher it is!

    1 Reply Last reply Reply Quote 0
    • J
      JKnott
      last edited by Aug 3, 2018, 1:49 PM

      You'd have to block more than port 25. You'd have to block any port that can be used for smtp or smtps. For example, I use 465 for smtps.

      PfSense running on Qotom mini PC
      i5 CPU, 4 GB memory, 32 GB SSD & 4 Intel Gb Ethernet ports.
      UniFi AC-Lite access point

      I haven't lost my mind. It's around here...somewhere...

      1 Reply Last reply Reply Quote 1
      • N
        NogBadTheBad
        last edited by Aug 3, 2018, 1:55 PM

        Firewall rules are read from the top down.

        allow smtp from the server
        block smtp from the lan
        allow any any

        Andy

        1 x Netgate SG-4860 - 3 x Linksys LGS308P - 1 x Aruba InstantOn AP22

        H 1 Reply Last reply Aug 3, 2018, 2:14 PM Reply Quote 1
        • H
          Herman
          last edited by Aug 3, 2018, 2:11 PM

          @jknott Thank you for yhe quick reply. Off course you are right. I will do that when I have the main rule working.

          Dot you have some example rules?

          regards,
          Herman

          Limburg | The Netherlands.
          It is nice to be important. But it is more important to be nice! | Failure, the best teacher it is!

          1 Reply Last reply Reply Quote 0
          • H
            Herman @NogBadTheBad
            last edited by Aug 3, 2018, 2:14 PM

            @nogbadthebad Thank you for your reply. It seems that my block smtp from the lan blocks all. even the acces to the mailserver.

            I try to post a screenshot :)

            Limburg | The Netherlands.
            It is nice to be important. But it is more important to be nice! | Failure, the best teacher it is!

            1 Reply Last reply Reply Quote 0
            • H
              Herman
              last edited by Aug 3, 2018, 2:19 PM

              This is the rule I have created. It seems that the rule "Block all SMTP outbound" blocks all? when I disable the rule, mail wil be sended.

              0_1533305825838_BlockSmtpLan.JPG

              Hope this helps a bit..

              Regards Herman

              Limburg | The Netherlands.
              It is nice to be important. But it is more important to be nice! | Failure, the best teacher it is!

              1 Reply Last reply Reply Quote 0
              • N
                NogBadTheBad
                last edited by NogBadTheBad Aug 3, 2018, 2:30 PM Aug 3, 2018, 2:27 PM

                0_1533306407557_Untitled.jpeg

                You have your exchange alias as a destination not a source.

                Andy

                1 x Netgate SG-4860 - 3 x Linksys LGS308P - 1 x Aruba InstantOn AP22

                H 1 Reply Last reply Aug 3, 2018, 2:41 PM Reply Quote 1
                • H
                  Herman @NogBadTheBad
                  last edited by Aug 3, 2018, 2:41 PM

                  @nogbadthebad Modified the rules as following. The mail wil be delivered. Strange issue is that Outlook 2016 has problems with connecting to the exchange server?! local LAN all is open right?

                  My LAN is an Active Directory environment running pfSense 2.4, DC Server 2016, Echange 2013 on server 2012R2.

                  Here are the mail rules;

                  0_1533307200125_BlockSmtpLan.JPG

                  Limburg | The Netherlands.
                  It is nice to be important. But it is more important to be nice! | Failure, the best teacher it is!

                  1 Reply Last reply Reply Quote 0
                  • J
                    johnpoz LAYER 8 Global Moderator
                    last edited by johnpoz Aug 3, 2018, 2:48 PM Aug 3, 2018, 2:47 PM

                    pfsense has zero to do with lan talking to lan..

                    Other than dns? But if your using AD, then all your clients should talk to your AD dns anyway.

                    An intelligent man is sometimes forced to be drunk to spend time with his fools
                    If you get confused: Listen to the Music Play
                    Please don't Chat/PM me for help, unless mod related
                    SG-4860 24.11 | Lab VMs 2.7.2, 24.11

                    H 1 Reply Last reply Aug 3, 2018, 3:06 PM Reply Quote 1
                    • H
                      Herman @johnpoz
                      last edited by Aug 3, 2018, 3:06 PM

                      @johnpoz Hi John, completely right. All the clients do DNS via the Domain Controller. All clients first DNS entry is pointed to the DC's IP address. But still since pfSense is in the picture Outlook is giving trouble connecting to the exchange server.

                      Maybe I did some false config on the DNS config of the pf Sense? The DNS forwarder is disabled and the DNS resolver is enabled with default settings.

                      Any suggestions?

                      Greetz,
                      Herman

                      Limburg | The Netherlands.
                      It is nice to be important. But it is more important to be nice! | Failure, the best teacher it is!

                      J 1 Reply Last reply Aug 3, 2018, 3:14 PM Reply Quote 0
                      • J
                        johnpoz LAYER 8 Global Moderator @Herman
                        last edited by Aug 3, 2018, 3:14 PM

                        @herman said in Block smtp (25) on LAN network. Only allow mailserver to send mail:

                        All clients first DNS entry

                        Are you saying they have more than 1 and this points to pfsense? Yeah that is Borked and going to cause you grief in the long run. You can not point to clients to more than 1 dns when the different dns does not resolve the same stuff. ie you do not point to local dns, and 2nd point to public dns - because public dns can not resolve local.

                        You can never be sure which dns client will actually use..

                        Point your clients ONLY to NS that can resolve your AD.. if pfsense can not resolve your AD then clients should not have it in their list for dns.

                        An intelligent man is sometimes forced to be drunk to spend time with his fools
                        If you get confused: Listen to the Music Play
                        Please don't Chat/PM me for help, unless mod related
                        SG-4860 24.11 | Lab VMs 2.7.2, 24.11

                        H 1 Reply Last reply Aug 3, 2018, 8:30 PM Reply Quote 0
                        • H
                          Herman @johnpoz
                          last edited by Aug 3, 2018, 8:30 PM

                          @johnpoz Right, double checked it. All clients have only one DNS server pointing to the DC hosting the DNS role.

                          Greetz,
                          Herman

                          Limburg | The Netherlands.
                          It is nice to be important. But it is more important to be nice! | Failure, the best teacher it is!

                          1 Reply Last reply Reply Quote 0
                          • J
                            johnpoz LAYER 8 Global Moderator
                            last edited by Aug 3, 2018, 8:32 PM

                            Well than pfsense has ZERO to do with device on lan talking to another device on lan.. If your having problems with outlook talking to your exchange that are on the same network - what do you think pfsense has to do with that conversation?

                            An intelligent man is sometimes forced to be drunk to spend time with his fools
                            If you get confused: Listen to the Music Play
                            Please don't Chat/PM me for help, unless mod related
                            SG-4860 24.11 | Lab VMs 2.7.2, 24.11

                            H 1 Reply Last reply Aug 3, 2018, 8:47 PM Reply Quote 1
                            • H
                              Herman @johnpoz
                              last edited by Aug 3, 2018, 8:47 PM

                              @johnpoz

                              Doesn’t make sense to me at all too. Since I’ve implemented the pfSense firewall this issues start to occur.

                              Should the something be configured in the DNS resolver of the pfSense? Shouldn’t it also point to the DC’s DNS?

                              Limburg | The Netherlands.
                              It is nice to be important. But it is more important to be nice! | Failure, the best teacher it is!

                              H 1 Reply Last reply Aug 3, 2018, 9:01 PM Reply Quote 0
                              • H
                                Herman @Herman
                                last edited by Aug 3, 2018, 9:01 PM

                                @herman Found the problem! I am also migrating Exchange 2013 to Exchange 2016. Since the 2016 box was off because I paused the migration, Outlook was still trying to resolve the public folders on the 2016 box. Turn the machine on resolved the problem.

                                Sorry for the inconvenience. My bad!

                                But still wondering if I should setup anything for the DNS resolver of the pfSense?

                                Cu,
                                Herman

                                Limburg | The Netherlands.
                                It is nice to be important. But it is more important to be nice! | Failure, the best teacher it is!

                                1 Reply Last reply Reply Quote 0
                                • D
                                  Derelict LAYER 8 Netgate
                                  last edited by Aug 3, 2018, 9:09 PM

                                  I wouldn't. If anything I would set up a backup domain controller.

                                  Chattanooga, Tennessee, USA
                                  A comprehensive network diagram is worth 10,000 words and 15 conference calls.
                                  DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
                                  Do Not Chat For Help! NO_WAN_EGRESS(TM)

                                  H 1 Reply Last reply Aug 3, 2018, 9:22 PM Reply Quote 1
                                  • H
                                    Herman @Derelict
                                    last edited by Aug 3, 2018, 9:22 PM

                                    @derelict So you suggest to leave the DNS Resolver on pfSense box disabled?

                                    Gr. Herman

                                    Limburg | The Netherlands.
                                    It is nice to be important. But it is more important to be nice! | Failure, the best teacher it is!

                                    1 Reply Last reply Reply Quote 0
                                    • D
                                      Derelict LAYER 8 Netgate
                                      last edited by Aug 3, 2018, 9:27 PM

                                      https://forum.netgate.com/post/778596

                                      Chattanooga, Tennessee, USA
                                      A comprehensive network diagram is worth 10,000 words and 15 conference calls.
                                      DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
                                      Do Not Chat For Help! NO_WAN_EGRESS(TM)

                                      H 1 Reply Last reply Aug 3, 2018, 10:10 PM Reply Quote 1
                                      • H
                                        Herman @Derelict
                                        last edited by Aug 3, 2018, 10:10 PM

                                        @derelict Thank you. Now it look like i would expect it to look. Even the ARP table is resolving the right hostname now. 👍

                                        Sorry if I keep going on but in the log file I see the folowing two entries. Any idea what they mean? port 67 and 68 is DHCP if I am correct.

                                        0_1533333996466_Port 67 68 blocked.JPG

                                        and

                                        0_1533334018954_IGMP Blocked.JPG

                                        That would be the last post for today. Have to go sleeping 😁

                                        Thanks to everybody for the kind support. CU soon.

                                        Bye
                                        Herman

                                        Limburg | The Netherlands.
                                        It is nice to be important. But it is more important to be nice! | Failure, the best teacher it is!

                                        D 1 Reply Last reply Aug 3, 2018, 10:20 PM Reply Quote 0
                                        • D
                                          Derelict LAYER 8 Netgate @Herman
                                          last edited by Aug 3, 2018, 10:20 PM

                                          @herman If you are not running a DHCP server on pfSense you will not have the automatic pass rules for DHCP on your local network.

                                          If you are limiting outbound connections and not passing any into the local interface, you might want to make a rule to block that traffic and not log it to kill that log spam. That is logging that a DHCP discover broadcast was received and not passed by the firewall.

                                          Same with the IGMP if the log entries annoy you.

                                          Or you could just turn off logging on the default deny rule entirely. Status > System Logs, Log firewall default blocks. For me it would depend on how many rules were necessary to get the log spam under control. If just a couple/few, I would make the rules. If it's a boatload, I'd probably just disable the logging entirely.

                                          Chattanooga, Tennessee, USA
                                          A comprehensive network diagram is worth 10,000 words and 15 conference calls.
                                          DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
                                          Do Not Chat For Help! NO_WAN_EGRESS(TM)

                                          1 Reply Last reply Reply Quote 1
                                          2 out of 20
                                          • First post
                                            2/20
                                            Last post
                                          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                                            This community forum collects and processes your personal information.
                                            consent.not_received