1

I followed this slightly outdated tutorial for setting up my ubuntu server as a send-only mail server using my FastMail account as an SMTP relay but I ran into some problems.

When I start the postfix service, everything seems ok:

Jul 22 15:56:34 core systemd[1]: Starting LSB: Postfix Mail Transport Agent...
Jul 22 15:56:34 core postfix[7893]:  * Starting Postfix Mail Transport Agent postfix
Jul 22 15:56:34 core postfix[7985]: Postfix is running with backwards-compatible default settings
Jul 22 15:56:34 core postfix[7985]: See http://www.postfix.org/COMPATIBILITY_README.html for details
Jul 22 15:56:34 core postfix[7985]: To disable backwards compatibility use "postconf compatibility_level=2" and "postfix reload"
Jul 22 15:56:34 core postfix[7893]:    ...done.
Jul 22 15:56:34 core systemd[1]: Started LSB: Postfix Mail Transport Agent.
Jul 22 15:56:34 core postfix/master[8022]: daemon started -- version 3.1.0, configuration /etc/postfix

However, if I then try to send an email using echo "Test mail from postfix" | mail -s "Test Postfix" you@example.com I get the following error:

Jul 22 15:58:06 core postfix/qmgr[8026]: 35FD8120B98: from=<willem@core.local>, size=328, nrcpt=1 (queue active)
Jul 22 15:58:06 core postfix/smtp[8035]: error: open database /etc/postfix/sasl_password.db: No such file or directory
Jul 22 15:58:06 core postfix/smtp[8035]: warning: hash:/etc/postfix/sasl_password is unavailable. open database /etc/postfix/sasl_password.db: No such file or
Jul 22 15:58:06 core postfix/smtp[8035]: warning: hash:/etc/postfix/sasl_password lookup error for "smtp.fastmail.com"
Jul 22 15:58:06 core postfix/smtp[8035]: warning: 35FD8120B98: smtp_sasl_password_maps lookup error
Jul 22 15:58:06 core postfix/smtp[8035]: 35FD8120B98: local data error while talking to smtp.fastmail.com[66.111.4.140]
Jul 22 15:58:07 core postfix/smtp[8035]: warning: hash:/etc/postfix/sasl_password is unavailable. open database /etc/postfix/sasl_password.db: No such file or
Jul 22 15:58:07 core postfix/smtp[8035]: warning: hash:/etc/postfix/sasl_password lookup error for "smtp.fastmail.com"
Jul 22 15:58:07 core postfix/smtp[8035]: warning: 35FD8120B98: smtp_sasl_password_maps lookup error
Jul 22 15:58:07 core postfix/smtp[8035]: 35FD8120B98: to=<you@example.com>, relay=smtp.fastmail.com[66.111.4.139]:587, delay=1.4, delays=0.03/0.02/1.4/0

I tried changing the owner of /etc/postfix to postfix as suggested in this post but it seems like this is a different problem since it can't find /etc/postfix/sasl_passwd and /etc/postfix/sasl_password as opposed to not being able to write to them.

I also tried skipping setting the permissions of /etc/postfix/sasl_password to 400 but this also has no result.

I, of course, created an app password and changed the email address to something sensible in the send command so this can't be the problem.

What am I doing wrong?

d1che
  • 21

1 Answers1

1

Okay, the solution to this problem came to me after some digging. In the logs it says it can't find either sasl_password or sasl_password.db. This makes sense since my config file contains this line:

smtp_sasl_password_maps = hash:/etc/postfix/sasl_password

but my /etc/postfix directory has this:

-r-------- 1 root root    59 Jul 22 15:56 sasl_password
-rw------- 1 root root 12288 Jan  7 02:39 sasl_password.db

Changing the names of these files obviously fixed the issue.

d1che
  • 21
  • Changing them to anything in particular, or just something else, which should be equivalent to deleting them? – mckenzm Oct 07 '20 at 20:00
  • change the path to those files, you mean? I've seen ../postfix/sasl_passwd and ../postfix/sasl/sasl_passwd and the hash thing throws me off. What hash? – Nicholas Saunders Dec 17 '23 at 00:30