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

    [SOLVED]Install a Relay Mail Host on pfSense (postfix)

    Scheduled Pinned Locked Moved pfSense Packages
    23 Posts 5 Posters 24.4k 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.
    • jimpJ
      jimp Rebel Alliance Developer Netgate
      last edited by

      I don't know if there is a full-blown sendmail work-alike done in PHP, but someone could use the smtp.inc file from pfSense 2.0 and write a small front-end to it that takes the message and sends it where it needs to go:

      http://redmine.pfsense.org/repositories/entry/pfsense/etc/inc/smtp.inc

      The whole notification system had a lot of work done in 2.0

      You see how the SMTP settings are done here:

      http://redmine.pfsense.org/repositories/entry/pfsense/usr/local/www/system_advanced_notifications.php

      Not sure how much of that would work on 1.2.3 since it only has PHP 4.x and pfSense 2.0 is on PHP 5.x

      You may just have to google around for a PHP sendmail drop-in or work-alike and see what turns up.

      Remember: Upvote with the šŸ‘ button for any user/post you find to be helpful, informative, or deserving of recognition!

      Need help fast? Netgate Global Support!

      Do not Chat/PM for help!

      1 Reply Last reply Reply Quote 0
      • S
        Supermule Banned
        last edited by

        Sorry for my arrogant attitude…........:(

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

          • What does, "ps aux" give you?

          ps aux does not show anything relaled to postfix…

          • How are you trying to start postfix?

          I made the following from the beginning

          1.- pkg_add -r postfix.tbz from (ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7-stable/Latest/postfix.tbz)
          2.- edited /usr/local/etc/rc.d/postfix, just to change :${postfix_enable="YES"}
          3.- cp /usr/local/etc/rc.d/postfix /usr/local/etc/rc.d/postfix.sh
          4.- Added postfix_enable="YES" into /boot/loader.conf
          5.- Reboot

          • What does your postfix main.cf file have?

          I“ve got 2, but i didn“t changed anything yet in those files

          /usr/local/etc/postfix/main.cf
          /usr/local/etc/libexec/postfix/main.cf

          • How are you trying to connect using telnet?Ā  From the local machine or from a machine on your LAN?

          From both (obviously using localhost from pfsense, and LAN interface ip from LAN)

          Thanks a lot!!!

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

            If i try to stop / start postfix, this is the output

            
            #postfix stop
            
            postfix/postfix-scrcipt: stopping the Postfix mail system
            sed: pid/master.pid: No such file or directory
            usage: kill [-s signal_name] pid ...
            	kill -l [exit_status]
            	kill -signal_name pid ...
            	kill -signal_number pid ...
            
            /libexec/ld-elf.so.1: /usr/local/libexec/postfix/master: Undefined symbol "close from"
            postfix/postfix-script: waiting for the Postfix mail system to terminate
            
            /libexec/ld-elf.so.1: /usr/local/libexec/postfix/master: Undefined symbol "close from"
            postfix/postfix-script: waiting for the Postfix mail system to terminate
            
            /libexec/ld-elf.so.1: /usr/local/libexec/postfix/master: Undefined symbol "close from"
            postfix/postfix-script: waiting for the Postfix mail system to terminate
            
            /libexec/ld-elf.so.1: /usr/local/libexec/postfix/master: Undefined symbol "close from"
            postfix/postfix-script: waiting for the Postfix mail system to terminate
            
            /libexec/ld-elf.so.1: /usr/local/libexec/postfix/master: Undefined symbol "close from"
            postfix/postfix-script: waiting for the Postfix mail system to terminate
            
            /libexec/ld-elf.so.1: /usr/local/libexec/postfix/master: Undefined symbol "close from"
            postfix/postfix-script: waiting for the Postfix mail system to terminate
            postfix/postfix-script: warning: stopping the Postfix mail system with force
            awk: can“t open file pid/master.pid
             source line number 1
            
            # postfix start
            postfix/postfix-script: fatal: the Postfix mail system is already running
            
            #
            
            
            1 Reply Last reply Reply Quote 0
            • D
              dpcma
              last edited by

              ok. News.

              I installed a fresh postfix on pfSense Box for FreeBSD 7.2 (postfix-current-2.6.20090212,4.tbz)

              PostFix is running now (at least 25 port is opened), and ps -aux shows 2 processes running for postfix (pickup and qmgr) but now I got the following message in system log:

              postfix/smtpd: fatal open database /etc/aliases.db: No such file or directory

              if I search for aliases i found

              /etc/aliasesĀ  Ā  (which is a link to mail/aliases) (/etc/mail/ is empty)
              /usr/local/etc/postfix/dist/aliases
              /usr/local/etc/postfix/aliases

              Thanks

              1 Reply Last reply Reply Quote 0
              • R
                rkelleyrtp
                last edited by

                Great, you are almost there!

                To get the /etc/aliases.db file created, edit the /etc/aliases file and make any necessary changes.Ā  For me, I changed the "root:Ā  you"Ā  to "root:Ā  rkelley@abcxyz.com" then ran /usr/local/bin/newaliases to build the /etc/aliases.db file.

                Also, getting the /usr/local/postfix/main.cf file tuned properly is very important!Ā  Here is what I have in mine:

                
                undisclosed_recipients_header = To:rkelley@abcxyz.com
                queue_directory = /var/spool/postfix
                command_directory = /usr/local/sbin
                daemon_directory = /usr/local/libexec/postfix
                data_directory = /var/db/postfix
                mail_owner = postfix
                myorigin = <domain_name>unknown_local_recipient_reject_code = 550
                mynetworks_style = host
                relayhost = <pfsense_lan_ip>debug_peer_level = 2
                debugger_command =
                Ā  Ā  Ā  Ā   PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
                Ā  Ā  Ā  Ā   ddd $daemon_directory/$process_name $process_id & sleep 5
                sendmail_path = /usr/local/sbin/sendmail
                newaliases_path = /usr/local/bin/newaliases
                mailq_path = /usr/local/bin/mailq
                setgid_group = maildrop
                html_directory = no
                manpage_directory = /usr/local/man
                sample_directory = /usr/local/etc/postfix
                readme_directory = no</pfsense_lan_ip></domain_name> 
                

                Make sure to put in the correct information for your relayhost, undisclosed_recipients_header, and myorigin.Ā  Once done, simply restart postfix and send yourself an email.

                Let me know how you make out…

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

                  Ok. Good News again.

                  Now I“ve got prompt from the mail server

                  I made the following

                  cp /usr/local/etc/postfix/aliases /etc/aliases.db

                  newaliases

                  postfix reload

                  I will keep you informed

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

                    Ok. Finished.

                    My pfSense box is able to relay mail to another relay host. After a bit tailoring of main.cf

                    mynetworks_style=subnet
                    relaydomains = xyz.com
                    relayhost = ip.add.re.ss of LAN

                    Apart of your suggestions relayhost, undisclosed_recipients_header, and myorigin

                    Thank you very much for you help

                    1 Reply Last reply Reply Quote 0
                    • R
                      rkelleyrtp
                      last edited by

                      No problem, glad to help.

                      Now that you have installed Postfix , please make sure to lock down your firewall as much as possible…

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

                        Sure! hehe My pfsense cluster is now a Swiss Army Knife hehe

                        Thanks again!

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