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

    Postfix forwarder - modify SMTP banner?

    Scheduled Pinned Locked Moved pfSense Packages
    40 Posts 3 Posters 12.1k 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.
    • D
      dreadnought
      last edited by

      Hello all,

      I'm new to pfsense and just installed postfix forwarder.  I noticed it's serving up a domain name in the SMTP banner which is probably coming from my pfsense configuration.  I would like to modify this however so it matches my reverse DNS.

      What's the best way to set the domain name in the SMTP banner?

      Thanks!

      1 Reply Last reply Reply Quote 0
      • M
        mschiek01
        last edited by

        @dreadnought:

        Hello all,

        I'm new to pfsense and just installed postfix forwarder.  I noticed it's serving up a domain name in the SMTP banner which is probably coming from my pfsense configuration.  I would like to modify this however so it matches my reverse DNS.

        What's the best way to set the domain name in the SMTP banner?

        Thanks!

        postix general page the 4th box down "custom main.cf options"  type in the following:  smtpd_banner = $myhostname    xxxx.xxxx.xxx  where xxxx is the host xxxx.xxx is the domain

        1 Reply Last reply Reply Quote 0
        • D
          dreadnought
          last edited by

          Awesome, thank you!

          I've been browsing these forums quite a bit and noticed a screenshot in one of Marcello's posts that seems to show stats re: postfix forwarder… numbers of emails rejected, accepted, etc.  I can't seem to find that screen in my pfsense, but I'm probably looking in the wrong places.

          I'm also curious about how I can see more detail about the messages or mail servers postfix forwarder is rejecting and why.  I see postfix forwarder information in the pfsense system log, but nothing related to spam/server scoring... mostly the service starting and stopping.

          1 Reply Last reply Reply Quote 0
          • D
            dreadnought
            last edited by

            This doesn't seem to have worked:

            smtpd_banner = $myhostname host.domain.com

            host.domain.com replaced with the details consistent with my reverse DNS… I tried rebooting pfsense as well, but postfix forwarder is still dishing out domain.com rather than host.domain.com.

            1 Reply Last reply Reply Quote 0
            • M
              mschiek01
              last edited by

              @dreadnought:

              Awesome, thank you!

              I've been browsing these forums quite a bit and noticed a screenshot in one of Marcello's posts that seems to show stats re: postfix forwarder… numbers of emails rejected, accepted, etc.  I can't seem to find that screen in my pfsense, but I'm probably looking in the wrong places.

              I'm also curious about how I can see more detail about the messages or mail servers postfix forwarder is rejecting and why.  I see postfix forwarder information in the pfsense system log, but nothing related to spam/server scoring... mostly the service starting and stopping.

              I think you are refering to the widget on the dashboard.  Click the "+" sign under the pfsense dashboard and add it then make sure to save it.

              1 Reply Last reply Reply Quote 0
              • D
                dreadnought
                last edited by

                I tried that earlier and I just have a blue bar that says "Postfix"… it's expanded, but there is nothing there.  The other widgets seem to be working fine.  I left all the logging stuff default, so I don't think I managed to mangle something so soon.  But I don't put anything past me.

                1 Reply Last reply Reply Quote 0
                • M
                  mschiek01
                  last edited by

                  @dreadnought:

                  This doesn't seem to have worked:

                  smtpd_banner = $myhostname host.domain.com

                  host.domain.com replaced with the details consistent with my reverse DNS… I tried rebooting pfsense as well, but postfix forwarder is still dishing out domain.com rather than host.domain.com.

                  You made the change then saved the configuation correct?, after which you only should have had to restart postfix.  Where are you seeing it reply with the wrong host name?

                  1 Reply Last reply Reply Quote 0
                  • M
                    mschiek01
                    last edited by

                    @dreadnought:

                    I tried that earlier and I just have a blue bar that says "Postfix"… it's expanded, but there is nothing there.  The other widgets seem to be working fine.  I left all the logging stuff default, so I don't think I managed to mangle something so soon.  But I don't put anything past me.

                    You have it enabled on the general screen "enable postfix"  checked.  In services it shows running?

                    It sounds as if it in not running.  If you haven't changed the config you can look at the log in /var/log/maillog to see if it is starting properly.

                    1 Reply Last reply Reply Quote 0
                    • D
                      dreadnought
                      last edited by

                      @mschiek01:

                      @dreadnought:

                      This doesn't seem to have worked:

                      smtpd_banner = $myhostname host.domain.com

                      host.domain.com replaced with the details consistent with my reverse DNS… I tried rebooting pfsense as well, but postfix forwarder is still dishing out domain.com rather than host.domain.com.

                      You made the change then saved the configuation correct?, after which you only should have had to restart postfix.  Where are you seeing it reply with the wrong host name?

                      Yes… I'm using http://mxtoolbox.com/ to check it.  I know postfix forwarder is running, because I'm seeing the wrong information in the banner, as opposed to when I telnet to port 25 on my internal mail server which shows me the correct information.  I'm getting email fine so at least the communication between postfix forwarder and my mail server is working.  ;)

                      Just based on the last hour or so, I think postfix forwarder is working pretty good... I just haven't found any stats or logs that would allow me to see in some detail what it's doing.

                      1 Reply Last reply Reply Quote 0
                      • D
                        dreadnought
                        last edited by

                        @mschiek01:

                        @dreadnought:

                        I tried that earlier and I just have a blue bar that says "Postfix"… it's expanded, but there is nothing there.  The other widgets seem to be working fine.  I left all the logging stuff default, so I don't think I managed to mangle something so soon.  But I don't put anything past me.

                        You have it enabled on the general screen "enable postfix"  checked.  In services it shows running?

                        It sounds as if it in not running.  If you haven't changed the config you can look at the log in /var/log/maillog to see if it is starting properly.

                        Yes, in services it shows "postfix Not available. Running"

                        1 Reply Last reply Reply Quote 0
                        • M
                          mschiek01
                          last edited by

                          @dreadnought:

                          @mschiek01:

                          @dreadnought:

                          This doesn't seem to have worked:

                          smtpd_banner = $myhostname host.domain.com

                          host.domain.com replaced with the details consistent with my reverse DNS… I tried rebooting pfsense as well, but postfix forwarder is still dishing out domain.com rather than host.domain.com.

                          You made the change then saved the configuation correct?, after which you only should have had to restart postfix.  Where are you seeing it reply with the wrong host name?

                          Yes… I'm using http://mxtoolbox.com/ to check it.  I know postfix forwarder is running, because I'm seeing the wrong information in the banner, as opposed to when I telnet to port 25 on my internal mail server which shows me the correct information.  I'm getting email fine so at least the communication between postfix forwarder and my mail server is working.  ;)

                          Just based on the last hour or so, I think postfix forwarder is working pretty good... I just haven't found any stats or logs that would allow me to see in some detail what it's doing.

                          go to /var/log/maillog and you will see exactly what it is doing. I am not sure it is even processing your mail from the way it sounds.  It sound like the firewall is passing traffic directly to your smtp server. You need to postfix in the middle.

                          Check to listen interface in postfix and set it to the loopback  then create a rule to the loopback on the wan interface

                          TCP * * 127.0.0.1 25 (SMTP) * none

                          Then on the second tab on post fix specify the domain or domains and the internal ip address of the smtp server.

                          1 Reply Last reply Reply Quote 0
                          • D
                            dreadnought
                            last edited by

                            go to /var/log/maillog and you will see exactly what it is doing. I am not sure it is even processing your mail from the way it sounds.  It sound like the firewall is passing traffic directly to your smtp server. You need to postfix in the middle.

                            Check to listen interface in postfix and set it to the loopback  then create a rule to the loopback on the wan interface

                            TCP * * 127.0.0.1 25 (SMTP) * none

                            Then on the second tab on post fix specify the domain or domains and the internal ip address of the smtp server.

                            I'm on an appliance and am not sure how to get to /var/log/maillog… I tried the "Edit File" function, but no luck finding /var/log/maillog.

                            I'm pretty sure postfix forwarder is running, because I woke up without a single spam... which is very (very!) unusual.  I just can't figure out where useful logs and stats are and why "smtpd_banner = $myhostname host.domain.com" in "custom main.cf options" is not working.  I used mxtoolbox again this morning and postfix forwarder is still serving up "domain.com" rather than "host.domain.com."

                            1 Reply Last reply Reply Quote 0
                            • D
                              doktornotor Banned
                              last edited by

                              I don't understand what you are doing there? So what's your hostname on the pfsense box?

                              1 Reply Last reply Reply Quote 0
                              • D
                                dreadnought
                                last edited by

                                @doktornotor:

                                I don't understand what you are doing there? So what's your hostname on the pfsense box?

                                It's domain.com… as opposed to host.domain.com.  I'm trying to get the SMTP banner for postfix forwarder to say host.domain.com.

                                1 Reply Last reply Reply Quote 0
                                • D
                                  doktornotor Banned
                                  last edited by

                                  I am asking about your pfsense box hostname (forget postfix)… Is it domain.com?  ???

                                  1 Reply Last reply Reply Quote 0
                                  • D
                                    dreadnought
                                    last edited by

                                    @doktornotor:

                                    I am asking about your pfsense box hostname (forget postfix)… Is it domain.com?  ???

                                    Yes.

                                    I just got a spam and found that its IP address is blocked by both RBLs (zen.spamhaus.org, b.barracudacentral.org) I have configured under "RBL Server List."  Apparently my RBL functionality is not working.  Maybe the GUI is broken or I'm being stupid.  I'm sure postfix forwarder is running because if I telnet from the outside in on port 25 I'm getting a banner served up by postfix forwarder, not the banner I get from the mail server I actually get my mail from which I have postfix forwarder forwarding to.

                                    I checked main.cf using "View Postfix configuration files" and it appears its being modified properly by the GUI… I see these lines in there:

                                    smtpd_banner = $myhostname host.domain.com (with my host and domain)
                                    postscreen_dnsbl_sites=zen.spamhaus.org, b.barracudacentral.org
                                    postscreen_dnsbl_threshold=1

                                    I'll reboot the appliance again, but that hasn't seemed to work and as far as I understand it's not necessary.

                                    1 Reply Last reply Reply Quote 0
                                    • D
                                      doktornotor Banned
                                      last edited by

                                      Huh? Why is your hostname empty??? Did you set myhostname = domain.com somewhere or what? That is the whole problem, there is absolutely no need to mess with anything normally; postfix uses gethostname() by default; and smtpd_banner is $myhostname ESMTP $mail_name by default.

                                      1 Reply Last reply Reply Quote 0
                                      • D
                                        dreadnought
                                        last edited by

                                        @doktornotor:

                                        Huh? Why is your hostname empty??? Did you set myhostname = domain.com somewhere or what? That is the whole problem, there is absolutely no need to mess with anything normally; postfix uses gethostname() by default; and smtpd_banner is $myhostname ESMTP $mail_name by default.

                                        My pfsense "General Setup" is set for hostname = "pfsense" and domain = "domain.com".

                                        Maybe I should start over.  I'm not sure where postfix forwarder is getting the host/domain (well, in my case, just domain) it's serving up in the SMTP banner. The SMTP banner simply says "domain.com" and I would like it to say "host.domain.com" which would match my MX record.

                                        1 Reply Last reply Reply Quote 0
                                        • D
                                          doktornotor Banned
                                          last edited by

                                          As said, it should use gethostname(). What's the output of

                                          postconf -n
                                          hostname
                                          
                                          

                                          ???

                                          1 Reply Last reply Reply Quote 0
                                          • D
                                            dreadnought
                                            last edited by

                                            @doktornotor:

                                            As said, it should use gethostname(). What's the output of

                                            postconf -n
                                            hostname
                                            
                                            

                                            ???

                                            In () are my redactions/comments:

                                            $ postconf -n
                                            access_map_defer_code = 451
                                            access_map_reject_code = 554
                                            config_directory = /usr/local/etc/postfix
                                            default_process_limit = 100
                                            disable_vrfy_command = yes
                                            local_recipient_maps =
                                            message_size_limit = 25600000
                                            mydestination =
                                            mynetworks = /usr/local/etc/postfix/mynetwork_table
                                            mynetworks_style = host
                                            postscreen_access_list = permit_mynetworks, cidr:/usr/local/etc/postfix/cal_cidr
                                            postscreen_blacklist_action = enforce
                                            postscreen_dnsbl_action = enforce
                                            postscreen_dnsbl_sites = zen.spamhaus.org, b.barracudacentral.org
                                            postscreen_dnsbl_threshold = 1
                                            relay_domains = (My first email domain) (My second email domain)
                                            smtpd_banner = $myhostname (My host.domain.com)
                                            smtpd_client_restrictions = permit_mynetworks, reject_unauth_destination, check_client_access pcre:/usr/local/etc/postfix/cal_pcre, check_client_access cidr:/usr/local/etc/postfix/cal_cidr, reject_unknown_client_hostname, reject_unauth_pipelining, reject_multi_recipient_bounce, permit
                                            smtpd_delay_reject = yes
                                            smtpd_helo_required = yes
                                            smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination, reject_unauth_pipelining, check_client_access pcre:/usr/local/etc/postfix/cal_pcre, check_client_access cidr:/usr/local/etc/postfix/cal_cidr, check_sender_access hash:/usr/local/etc/postfix/sender_access, reject_non_fqdn_helo_hostname, reject_unknown_recipient_domain, reject_non_fqdn_recipient, reject_multi_recipient_bounce, reject_unverified_recipient, reject_spf_invalid_sender, permit
                                            smtpd_sender_restrictions = reject_non_fqdn_sender, reject_unknown_sender_domain, reject_unauth_pipelining, reject_multi_recipient_bounce, permit
                                            strict_rfc821_envelopes = yes
                                            transport_maps = hash:/usr/local/etc/postfix/transport
                                            unknown_client_reject_code = 550
                                            unknown_hostname_reject_code = 550
                                            unverified_recipient_reject_code = 550

                                            $ hostname
                                            pfsense.domain.com (My domain)

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.