Score:0

Cannot get Postfix Address Rewrite to work; Diagnostic tool fails

co flag

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 [email protected]. Notifications and other emails will come from the board using [email protected]. 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 [email protected]
FROM: [email protected]
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=<[email protected]>
Jul  3 23:15:21 myvps postfix/qmgr[5516]: B616461557: from=<[email protected]>, 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=<[email protected]>, 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      [email protected]

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:

[email protected]      [email protected]
@myvps.myserviceprovider.com      [email protected]
[email protected]      [email protected]
@localhost.localdomain      [email protected]
[email protected]     [email protected]

...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=<[email protected]>, 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=<[email protected]>, 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.

Michael Hampton avatar
cz flag
`Username and Password not accepted` is pretty self explanatory. You should verify that these are correct.
vidarlo avatar
ar flag
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.
shortmort37 avatar
co flag
@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 avatar
co flag
@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 avatar
co flag
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?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.