0

I am setting up a VPS with Ubuntu 20.04 to host a phpBB board, say "myvps.myserviceprovider.com", to which "mydomain.net" is assigned. I also have defined the MX record for my domain to permit Google Workspace to host the email account dan@mydomain.net. Notifications and other emails will come from the board using dan@mydomain.net. I've installed postfix on my VPS to facilitate this.

Here's an example of a command line email using postfix's sendmail:

mylogin@myvps: sendmail recipient@gmail.com
FROM: dan@mydomain.net
SUBJECT: Hello from your server!
Yup.
It's me.
.

Workspace rejects the mail; here's a snippet from /var/log/mail.log:

Jul  3 23:15:21 myvps postfix/pickup[5514]: B616461557: uid=1000 from=<mylogin>
Jul  3 23:15:21 myvps postfix/cleanup[5519]: B616461557: message-id=<20210704031521.B616461557@myvps.myserviceprovider.com>
Jul  3 23:15:21 myvps postfix/qmgr[5516]: B616461557: from=<mylogin@mydomain.net>, size=348, nrcpt=1 (queue active)
Jul  3 23:15:21 myvps postfix/smtp[5521]: connect to smtp.gmail.com[2607:f8b0:400d:c0d::6c]:587: Network is unreachable
Jul  3 23:15:22 myvps postfix/smtp[5521]: B616461557: to=<recipient@gmail.com>, relay=smtp.gmail.com[172.217.222.109]:587, delay=0.99, delays=0.29/0.07/0.63/0, dsn=4.7.8, status=deferred (SASL authentication failed; server smtp.gmail.com[172.217.222.109] said: 535-5.7.8 Username and Password not accepted. Learn more at?535 5.7.8  https://support.google.com/mail/?p=BadCredentials i19sm3571712qkl.19 - gsmtp)

The FROM: I used is ignored - my ssl login, "mylogin", is used instead. No credentials are defined with sasl for this account, nor is the account defined in Workspace.

I followed the instructions here for rewriting FROM addresses when only sending from a server (not receiving - the second answer in the post). This is the single entry in my generic file (because mail can come from the default apache account as well):

@myvps.myserviceprovider.com      dan@mydomain.net

I followed this with

sudo postmap /etc/postfix/generic
sudo /etc/init.d/postfix reload

I got the same result. I tried several variants for the source in the generic file; wash, rinse, repeat:

mylogin@myvps.myserviceprovider.com      dan@mydomain.net
@myvps.myserviceprovider.com      dan@mydomain.net
mylogin@localhost.localdomain      dan@mydomain.net
@localhost.localdomain      dan@mydomain.net
mylogin@mydomain.net     dan@mydomain.net

...and several others; I'm forgetting now what I've tried. But in an attempt to diagnose, I added a "-v" flag to the end of the line for the cleanup daemon in master.cf, per the instructions here. Here's what's reported in /var/log/mail.log:

Jul  3 23:18:36 myvps postfix/qmgr[5547]: 6043661559: from=<mylogin@mydomain.net>, size=348, nrcpt=1 (queue active)
Jul  3 23:18:36 myvps postfix/cleanup[5556]: warning: unix_trigger: write to public/qmgr: Broken pipe
Jul  3 23:18:36 myvps postfix/cleanup[5556]: cleanup_flush: status 0
Jul  3 23:18:36 myvps postfix/cleanup[5556]: send attr status = 0
Jul  3 23:18:36 myvps postfix/cleanup[5556]: send attr reason =
Jul  3 23:18:36 myvps postfix/cleanup[5556]: master_notify: status 1
Jul  3 23:18:36 myvps postfix/cleanup[5556]: connection closed
Jul  3 23:18:36 myvps postfix/smtp[5550]: connect to smtp.gmail.com[2607:f8b0:400d:c0d::6c]:587: Network is unreachable
Jul  3 23:18:36 myvps postfix/smtp[5550]: 6043661559: to=<recipient@gmail.com>, relay=smtp.gmail.com[173.194.175.109]:587, delay=0.23, delays=0.02/0/0.21/0, dsn=4.7.8, status=deferred (SASL authentication failed; server smtp.gmail.com[173.194.175.109] said: 535-5.7.8 Username and Password not accepted. Learn more at?535 5.7.8  https://support.google.com/mail/?p=BadCredentials s8sm3655090qke.72 - gsmtp)
Jul  3 23:18:41 myvps postfix/cleanup[5556]: rewrite stream disconnect

Before I added the "-v" flag, I saw a report from cleanup in the log file, preceding the qmgr handoff, even though it did not replace "mylogin" with "dan" as I had hoped. After adding the flag, the report from qmgr comes first, followed by several cleanup log lines, one of which is a failure to communicate with the qmgr daemon ("busted pipe"). It suggests that the addition of the "-v" flag permuted the behavior of the daemon interactions, rather than simply reporting on them in more detail.

So I am truly at a loss. Not sure how to diagnose what cleanup is actually doing.

  • `Username and Password not accepted` is pretty self explanatory. You should verify that these are correct. – Michael Hampton Jul 04 '21 at 15:40
  • Googles smtp servers doesn't accept unauthenticated delivery *from* an account they believe they host. You'll have to specify a different sender *or* authenticate for delivery. – vidarlo Jul 04 '21 at 15:44
  • @MichaelHampton, the username post-cleanup - "mylogin" - is *NOT* correct. I'm trying to map it to "dan", which *IS* correct. My attempt to do so with /etc/postfix/generic is failing. That's the issue I am reporting here. – shortmort37 Jul 04 '21 at 15:54
  • @vidarlo, Google Workspace support claims they *WILL* accept it, and help me configure it on their end. That's not the problem: the problem is that the email address postfix delivers is *NOT* the email address defined in Workspace. I can't get the postfix facility for rewriting addresses to work. As to what Google will accept and not accept, I haven't gotten there yet. postfix cleanup is not working, and I can't figure out why - and my attempts to use the diagnostic tools are failing. – shortmort37 Jul 04 '21 at 15:58
  • Does anyone have any ideas why my attempts to debug postfix address rewriting with the "-v" flag in master.cf is failing as described above? – shortmort37 Jul 06 '21 at 15:59

0 Answers0