Setting up a Mail Server with Homebrew


#21

sorry, that will never work.
/usr/local/bin/postfix start
/usr/local/bin/postfix stop
/usr/local/bin/postfix reload

or
sudo load -w /Library/LaunchDaemons/org.postfix.master.plist
sudo unload -w /Library/LaunchDaemons/org.postfix.master.plist


(James Brown) #22

Thanks again for your help ShanghaiTimes.

$ sudo /usr/local/sbin/postfix start
postfix/postfix-script: warning: not owned by root: /usr/local/etc/postfix/./master.cf ORIG
postfix/postfix-script: starting the Postfix mail system

Don’t know why it is using that config, not /usr/local/etc/postfix/master.cf

But then it dies:
networkd_settings_init notify_register_check(com.apple.system.networkd.settings) status 1000000 token -1 failed, dumping backtrace:

BTW, I compiled Postfix with:

$ make -f Makefile.init makefiles CCARGS=’-DUSE_TLS -DUSE_SASL_AUTH
-DDEF_SERVER_SASL_TYPE=“dovecot”
-DDEF_COMMAND_DIR="/usr/local/sbin"
-DDEF_CONFIG_DIR="/usr/local/etc/postfix"
-DDEF_DAEMON_DIR="/usr/local/libexec/postfix"
-DHAS_PCRE -I/usr/local/opt//include
-DHAS_SSL -I/usr/local/opt/openssl@1.1
-DHAS_MYSQL -I/usr/local/opt/mysql@5.7/include/mysql’ AUXLIBS=’-L/usr/local/lib -lpcre -lssl -lcrypto -L/usr/local/opt/mysql@5.7/lib
-lmysqlclient -lz -lm’ sendmail_path=/usr/local/sbin/sendmail newaliases_path=/usr/local/bin/newaliases mailq_path=/usr/local/bin/mailq

The last line was to get around SIP.


#23

Have a look here James

http://www.postfix.org/postfix.1.html

The first one.

sudo postfix check
should give you some indication.

My actual postfix is in /usr /sbin/postfix - it calls the postfix-script.


#24

That’s just some strange path it builds to tell you where it is.
It looks like /usr/local/etc/postfix/master.cf isn’t owned by root.
Possibly others as well.
sudo postfix check will tell you.


(James Brown) #25

$ sudo postfix check
postfix: Postfix is running with backwards-compatible default settings
postfix: See http://www.postfix.org/COMPATIBILITY_README.html for details
postfix: To disable backwards compatibility use “postconf compatibility_level=2” and “postfix reload”

It seems to be staying up now, but I don’t know why it is using that config file:

sudo postfix -c /usr/local/etc/postfix start
postfix/postfix-script: warning: not owned by root: /usr/local/etc/postfix/./master.cf ORIG
postfix/postfix-script: starting the Postfix mail system


#26

Just out of interest - and heaven knows if this interface will print it, is my compile/make text

make -f Makefile.init dynamicmaps=yes CCARGS='-DHAS_MYSQL -I/usr/local/include/mysql -DUSE_TLS -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/opt/local/include/sasl -DDEF_SERVER_SASL_TYPE=\"dovecot\" -DHAS_PCRE -I/opt/local/include -DEF_COMMAND_DIR=\"/usr/local/sbin\" -DEF_CONGIG_DIR=\"/usr/local/etc/postfix\" -DEF_DAEMON_DIR=\"/usr/local/libexec/postfix\" -DEF_DATA_DIR=\"/var/lib/postfix\" -DEF_MAILQ_PATH=\"/usr/local/bin/mailq\" -DEF_HTML_DIR=\"/usr/share/doc/postfix/html\" -DEF_MANPAGE_DIR=\"/usr/local/man\" -DEF_NEWALIAS_PATH=\"/usr/local/bin/newaliases\" -DEF_QUEUE_DIR=\"/private/var/spool/postfix\" -DEF_README_DIR=\"/usr/share/doc/postfix\" -DEF_SENDMAIL_PATH=\"/usr/local/sbin/sendmail\"' 'AUXLIBS=-L/opt/local/lib -lsasl2 -lssl -lcrypto -licuuc' 'AUXLIBS_MYSQL=-L/usr/local/lib -lmysqlclient -lz -lm' 'AUXLIBS_PCRE=-L/usr/local/lib -lpcre'

(James Brown) #27

Thanks - seems similar to mine.

Still can’t get anything in /var/log/mail.log - did you do anything to get logging there? There’s also nothing Postfix related in system.log either.


(James Brown) #28

As /var/log/mail.log and /var/log/system.log doesn’t seem to work, if I run this command in a terminal window I can finally see what is happening:

log stream --predicate '(process == "smtpd") || (process == "smtp") || (process == "master")' -info

I sent a test email using:

date | mail -s testing my@emailaddress.com

and it worked!


#29

Do you have this file? I think it’s new since Sierra. Not sure.

/etc/asl/com.apple.mail

Mine has this in it

 # mail facility has its own log file
 ? [= Facility mail] claim only
 > /var/log/mail.log mode=0644 format=bsd rotate=seq compress file_max=5M all_max=50M
* file /var/log/mail.log

#30

yes, that will work. But it’s not permanent…

hmmm. I’m trying to see just how I have it working here? bit of a mystery now.


#31

This is from dovecot.cf near the top. If you have dovecot running.

#iauth_verbose=yes enables logging all failed authentication attempts.
#auth_debug=yes enables all authentication debug logging (also enables auth_verbose). Passwords are logged as <hidden>.
#auth_debug_passwords=yes does everything that auth_debug=yes does, but it also removes password hiding (but only if you are not using PAM,
#mail_debug=yes enables all kinds of mail related debug logging, such as showing where Dovecot is looking for mails.
#verbose_ssl=yes enables logging SSL errors and warnings. Even without this setting if connection is closed because of an SSL error,
#auth_verbose_passwords=no|plain|sha1 If authentication fails, this setting logs the used password.

auth_verbose=yes
auth_debug=yes
auth_debug_passwords=yes
mail_debug=yes
verbose_ssl=yes
auth_verbose_passwords=plain

log_path = /var/log/dovecot.log
# If you want everything in one file, just don't specify info_log_path and debug_log_path
#info_log_path = /var/log/dovecot-info.log
# Leave empty in order to send debug-level messages to info_log_path
#debug_log_path = /var/log/dovecot-debug.log