Postfix: two mail related questions

Hi all,

I have some questions about mail identities and Postfix, and look forward to some guidance.

My YunoHost server

Hardware: laptop or computer at home
YunoHost version:
- yunohost version: 11.2.8.2 (stable)
- yunohost-admin version: 11.2.3 (stable)
- moulinette version: 11.2 (stable)
- ssowat version: 11.2 (stable)

I have access to my server : Through SSH | through the webadmin | direct access via keyboard / screen
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : maybe
If yes, please explain: I switched mail sending of for one domain and on for another

Description of my issue

I just moved my last (most heavily used) mail account to my Yunohost.

For sending mail from Yunohost, I used to use a sub.domain.tld ; even though Yunohost (also) managed domain.tld, the mailserver + mailbox for domain.tld was over at my registrar.

Now that I moved the mailbox from the registrar to Yunohost

  • I updated the MX records for domain.tld to point to my Yunohost (at the nameserver)
  • I updated the reverse DNS for my Yunohost to say ‘domain.tld’ instead of ‘sub.domain.tld’ (at my ISP)
  • I created an account for the mailbox on Yunohost (in Yunohost)
  • I copied aliases from registar to the new account on Yunohost (export to CSV, copy/paste in account in Yunohost)
  • I exported identities from the registrar’s webmail (save webmayl options page as HTML)
  • I copied existing mail from registrar’s mailserver to Yunohost (isync/mbsync)
  • I started experimenting ‘seriously’ with Yunohost’s webmail options (Snappymail, at first)

Two problems

  • Diagnosis warns about an incorrect rDNS:
    • expected : sub.domain.tld
    • found: domain.tld
    • possible explanation:
      • sub.domain.tld was the first ever domain on my Yunohost
      • /etc/postfix/main.cf has myhostname = sub.domain.tld (the hostname is actually still “sub” , so I guess that’s fine)
      • /etc/postfix/main.cf has mydomain = sub.domain.tld (I think have to change this to mydomain = domain.tld, but am somewhat loathsome to take the dive)
  • Snappymail unable to send mail when chosing an identity
    • sending mail as “mymailbox@domain.tld” works, but is not what I want (I do not want to expose the mailaddress of the mailbox)
    • sendig mail as “mymailaddressforyou@domain.tld” does not work
      • mymailaddressforyou@domain.tld is a mailalias in the account mymailbox
      • I added an identity in Snappymail using mymailaddressforyou@domain.tld as email and reply-to
      • when using this identity, Snappymail says “the mail could not be sent”; /var/log/mail.log prints this line NOQUEUE: reject: RCPT from localhost[::1]: 553 5.7.1 <cmymailaddressforyou@domain.tld>: Sender address rejected: not owned by user mymailbox; from=<mymailaddressforyou@domain.tld> to=<test@domain.tld> proto=ESMTP helo=<domain.tld>
      • This error is luckily encountered more often, and a solution is suggested:
      • smtpd_sender_login_maps need to be set to the same value as virtual_mailbox_maps
      • my (untouched) /etc/postfix/main.cf has
   smtpd_sender_login_maps=
   # Regular Yunohost accounts
   ldap:/etc/postfix/ldap-accounts.cf,
   # Extra maps for app system users who need to send emails
   hash:/etc/postfix/app_senders_login_maps
      • Should I add a line there, as such:
   smtpd_sender_login_maps=
   # Regular Yunohost accounts
   ldap:/etc/postfix/ldap-accounts.cf,
   # Aliases of Yunohost accounts, to allow mail being sent by identity = alias
   ldap:/etc/postfix/ldap-aliases.cf,
   # Extra maps for app system users who need to send emails
   hash:/etc/postfix/app_senders_login_maps

Guessed solutions

So, in short, I think I need to make two changes to /etc/postfix/main.cf (and maybe execute some postfix-db-update?):

  • change the Postfix domain to match rDNS: mydomain = sub.domain.tld to mydomain = domain.tld;
  • add LDAP aliases as allowed senders ldap:/etc/postfix/ldap-aliases.cf under smtpd_sender_login_maps=
  • run postmap app_senders_login_maps
  • restart postfix , systemctl restart postfix

Any suggestions or confirmations?

:crying_cat_face:

I made the proposed changes, including the update of sender login maps and a restart… No go :frowning:

Diagnosis still warns me that the rDNS should be sub.domain.tld instead of current rDNS domain.tld; sending as an identity still does not work with the same /var/log/mail.log record.

The app_senders_login_maps file warns “don’t touch this empty file”; the app_senders_login_maps.db is a binary file of 12k, but I don’t know how to read what’s in it. I installed phpldapadmin, and can confirm that my aliases show up under the account (like they do in the web interface)

Any idea how to solve my problems?

the .db is generated from the original file without the .db, using postmap. The .db is just a binary, compiled version of the original file, there’s not much point reading it compared to reading the source

Not sure to understand the whole intrications regarding the alias, but yes, sending mails using your alias identity is supposed to work with the default configuration

Can you double-confirm that yunohost tools regen-conf postfix is happy ?

2 Likes

Hi Aleks,

Thanks for your insightss

It was, after -f to undo my changes.

I continued by confirming that the alias is actually an alias of this mailbox. It is… almost.
The alias I tested is from another account/mailbox, the one I should have taken is slightly different, and… That one works :slight_smile:

One down! Thanks :slight_smile:

The diagnosis still flags the rDNS as wrong though. Do you happen to know which setting steers the expected rDNS for diagnostics? If not, I’ll try to figure out the diagnostics code first for honing some troubleshooting skills.

Eeeh, the expected rDNS value is, i think, yunohost’s main domain

And the actual rDNS value is, of course, defined on whatever ISP you have

1 Like

Ah, that would make some kind of sense.

I clicked the ‘default’ on for domain.tld.

Result:

  • sub.domain.tld is no longer default (no star in the domain list)
  • domain.tld is not default
  • retry, click the button once more, wait a bit, lots of yellow lines (has been manually modified ; can’t remember though)
  • then some red: abuse@domain.tld can not be removed from domain.tld
  • https://paste.yunohost.org/raw/hucikuwuse
  • maybe I was too quick in clicking the button again, and was there some browser cache thing. A few minutes later, the star is on the correct domain.

There is no error in diagnosis as result from the errors observed.

Diagnosis for rDNS is green now though :smiley:

Thank you :slight_smile:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.