[GH-ISSUE #49] Self-Hosted | How do I properly add a new domain? #92

Closed
opened 2026-03-01 17:44:43 +03:00 by kerem · 21 comments
Owner

Originally created by @tommyvange on GitHub (Jun 4, 2020).
Original GitHub issue: https://github.com/anonaddy/anonaddy/issues/49

Hello, my self-hosted anonaddy instance is working great! However, I can't seem to figure out how to add another domain.

I managed to add it into the Anonaddy config and it does show up, but whenever I try to send emails to the alias they bounce with the error:
554 5.7.1 <XXXXXXXXXX@XXXXXXX.XXX>: Relay access denied

I tried to make a new DKIM key and add the domain to the trusted.hosts file, but that didn't seem to change anything.

For the DNS record I made them identical to the original domain with the only exception being that th MX record points to the original domain.

What is the right way to add a second domain to anonaddy (both DNS and config)?

Originally created by @tommyvange on GitHub (Jun 4, 2020). Original GitHub issue: https://github.com/anonaddy/anonaddy/issues/49 Hello, my self-hosted anonaddy instance is working great! However, I can't seem to figure out how to add another domain. I managed to add it into the Anonaddy config and it does show up, but whenever I try to send emails to the alias they bounce with the error: `554 5.7.1 <XXXXXXXXXX@XXXXXXX.XXX>: Relay access denied` I tried to make a new DKIM key and add the domain to the trusted.hosts file, but that didn't seem to change anything. For the DNS record I made them identical to the original domain with the only exception being that th MX record points to the original domain. What is the right way to add a second domain to anonaddy (both DNS and config)?
kerem closed this issue 2026-03-01 17:44:43 +03:00
Author
Owner

@tommyvange commented on GitHub (Jun 4, 2020):

Update

I added the domain to to the mydestination variable in the postfix config, and the emails are no longer bouncing.

However, It is still not working.

Here is the mail.log entry:

Jun  4 19:18:54 EmailServer postfix/smtpd[2913]: warning: /etc/postfix/main.cf, line 100: overriding earlier entry: smtpd_recipient_restrictions=permit_mynetworks,   reject_unauth_destination,   check_recipient_access mysql:/etc/postfix/mysql-recipient-access.cf, mysql:/etc/postfix/mysql-recipient-access-domains-and-additional-usernames.cf,   check_policy_service unix:private/policyd-spf   reject_rhsbl_helo dbl.spamhaus.org,   reject_rhsbl_reverse_client dbl.spamhaus.org,   reject_rhsbl_sender dbl.spamhaus.org,   reject_rbl_client zen.spamhaus.org   reject_rbl_client dul.dnsbl.sorbs.net
Jun  4 19:18:54 EmailServer postfix/smtpd[2913]: connect from mail-yb1-f178.google.com[209.85.219.178]
Jun  4 19:18:54 EmailServer postfix/anvil[2914]: warning: /etc/postfix/main.cf, line 100: overriding earlier entry: smtpd_recipient_restrictions=permit_mynetworks,   reject_unauth_destination,   check_recipient_access mysql:/etc/postfix/mysql-recipient-access.cf, mysql:/etc/postfix/mysql-recipient-access-domains-and-additional-usernames.cf,   check_policy_service unix:private/policyd-spf   reject_rhsbl_helo dbl.spamhaus.org,   reject_rhsbl_reverse_client dbl.spamhaus.org,   reject_rhsbl_sender dbl.spamhaus.org,   reject_rbl_client zen.spamhaus.org   reject_rbl_client dul.dnsbl.sorbs.net
Jun  4 19:18:55 EmailServer postfix/smtpd[2913]: Anonymous TLS connection established from mail-yb1-f178.google.com[209.85.219.178]: TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
Jun  4 19:18:55 EmailServer postfix/trivial-rewrite[2915]: warning: /etc/postfix/main.cf, line 100: overriding earlier entry: smtpd_recipient_restrictions=permit_mynetworks,   reject_unauth_destination,   check_recipient_access mysql:/etc/postfix/mysql-recipient-access.cf, mysql:/etc/postfix/mysql-recipient-access-domains-and-additional-usernames.cf,   check_policy_service unix:private/policyd-spf   reject_rhsbl_helo dbl.spamhaus.org,   reject_rhsbl_reverse_client dbl.spamhaus.org,   reject_rhsbl_sender dbl.spamhaus.org,   reject_rbl_client zen.spamhaus.org   reject_rbl_client dul.dnsbl.sorbs.net
Jun  4 19:18:55 EmailServer postfix/spawn[2916]: warning: /etc/postfix/main.cf, line 100: overriding earlier entry: smtpd_recipient_restrictions=permit_mynetworks,   reject_unauth_destination,   check_recipient_access mysql:/etc/postfix/mysql-recipient-access.cf, mysql:/etc/postfix/mysql-recipient-access-domains-and-additional-usernames.cf,   check_policy_service unix:private/policyd-spf   reject_rhsbl_helo dbl.spamhaus.org,   reject_rhsbl_reverse_client dbl.spamhaus.org,   reject_rhsbl_sender dbl.spamhaus.org,   reject_rbl_client zen.spamhaus.org   reject_rbl_client dul.dnsbl.sorbs.net
Jun  4 19:18:55 EmailServer policyd-spf[2917]: prepend Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.219.178; helo=mail-yb1-f178.google.com; envelope-from=MY_GMAIL_NAME@gmail.com; receiver=<UNKNOWN>
Jun  4 19:18:55 EmailServer postfix/cleanup[2918]: warning: /etc/postfix/main.cf, line 100: overriding earlier entry: smtpd_recipient_restrictions=permit_mynetworks,   reject_unauth_destination,   check_recipient_access mysql:/etc/postfix/mysql-recipient-access.cf, mysql:/etc/postfix/mysql-recipient-access-domains-and-additional-usernames.cf,   check_policy_service unix:private/policyd-spf   reject_rhsbl_helo dbl.spamhaus.org,   reject_rhsbl_reverse_client dbl.spamhaus.org,   reject_rhsbl_sender dbl.spamhaus.org,   reject_rbl_client zen.spamhaus.org   reject_rbl_client dul.dnsbl.sorbs.net
Jun  4 19:18:55 EmailServer postfix/smtpd[2913]: 6EC1442594: client=mail-yb1-f178.google.com[209.85.219.178]
Jun  4 19:18:55 EmailServer postfix/cleanup[2918]: 6EC1442594: message-id=<CACxQPP=GVgdVtG5aAy8LVxzthuKTqAWge-vAaJaYmTwHD1yO_g@mail.gmail.com>
Jun  4 19:18:55 EmailServer opendkim[2192]: 6EC1442594: s=20161025 d=gmail.com SSL
Jun  4 19:18:55 EmailServer opendmarc[6440]: 6EC1442594: gmail.com pass
Jun  4 19:18:55 EmailServer postfix/qmgr[2782]: 6EC1442594: from=<MY_GMAIL_NAME@gmail.com>, size=2860, nrcpt=1 (queue active)
Jun  4 19:18:55 EmailServer postfix/pipe[2919]: warning: /etc/postfix/main.cf, line 100: overriding earlier entry: smtpd_recipient_restrictions=permit_mynetworks,   reject_unauth_destination,   check_recipient_access mysql:/etc/postfix/mysql-recipient-access.cf, mysql:/etc/postfix/mysql-recipient-access-domains-and-additional-usernames.cf,   check_policy_service unix:private/policyd-spf   reject_rhsbl_helo dbl.spamhaus.org,   reject_rhsbl_reverse_client dbl.spamhaus.org,   reject_rhsbl_sender dbl.spamhaus.org,   reject_rbl_client zen.spamhaus.org   reject_rbl_client dul.dnsbl.sorbs.net
Jun  4 19:18:55 EmailServer postfix/smtpd[2913]: disconnect from mail-yb1-f178.google.com[209.85.219.178] ehlo=2 starttls=1 mail=1 rcpt=1 data=1 quit=1 commands=7
Jun  4 19:18:56 EmailServer postfix/sendmail[2928]: warning: /etc/postfix/main.cf, line 100: overriding earlier entry: smtpd_recipient_restrictions=permit_mynetworks,   reject_unauth_destination,   check_recipient_access mysql:/etc/postfix/mysql-recipient-access.cf, mysql:/etc/postfix/mysql-recipient-access-domains-and-additional-usernames.cf,   check_policy_service unix:private/policyd-spf   reject_rhsbl_helo dbl.spamhaus.org,   reject_rhsbl_reverse_client dbl.spamhaus.org,   reject_rhsbl_sender dbl.spamhaus.org,   reject_rbl_client zen.spamhaus.org   reject_rbl_client dul.dnsbl.sorbs.net
Jun  4 19:18:56 EmailServer postfix/postdrop[2929]: warning: /etc/postfix/main.cf, line 100: overriding earlier entry: smtpd_recipient_restrictions=permit_mynetworks,   reject_unauth_destination,   check_recipient_access mysql:/etc/postfix/mysql-recipient-access.cf, mysql:/etc/postfix/mysql-recipient-access-domains-and-additional-usernames.cf,   check_policy_service unix:private/policyd-spf   reject_rhsbl_helo dbl.spamhaus.org,   reject_rhsbl_reverse_client dbl.spamhaus.org,   reject_rhsbl_sender dbl.spamhaus.org,   reject_rbl_client zen.spamhaus.org   reject_rbl_client dul.dnsbl.sorbs.net
Jun  4 19:18:56 EmailServer postfix/pipe[2919]: 6EC1442594: to=<1a8638b2-f5d1-4a31-be02-e38b3cd9e28a@SECOND_ANONADDY_DOMAIN>, relay=anonaddy, delay=0.73, delays=0.44/0.01/0/0.28, dsn=2.0.0, status=sent (delivered via anonaddy service)
Jun  4 19:18:56 EmailServer postfix/qmgr[2782]: 6EC1442594: removed
Jun  4 19:18:56 EmailServer postfix/pickup[2781]: 05C1342594: uid=1000 from=<mailer@>
Jun  4 19:18:56 EmailServer opendmarc[6440]: ignoring connection from localhost
Jun  4 19:18:56 EmailServer postfix/cleanup[2918]: 05C1342594: message-id=<538013ae7837e8ec17bbb8dafcb0b356@SECOND_ANONADDY_DOMAIN>
Jun  4 19:18:56 EmailServer postfix/qmgr[2782]: 05C1342594: from=<mailer@>, size=2891, nrcpt=1 (queue active)
Jun  4 19:18:56 EmailServer postfix/smtp[2930]: warning: /etc/postfix/main.cf, line 100: overriding earlier entry: smtpd_recipient_restrictions=permit_mynetworks,   reject_unauth_destination,   check_recipient_access mysql:/etc/postfix/mysql-recipient-access.cf, mysql:/etc/postfix/mysql-recipient-access-domains-and-additional-usernames.cf,   check_policy_service unix:private/policyd-spf   reject_rhsbl_helo dbl.spamhaus.org,   reject_rhsbl_reverse_client dbl.spamhaus.org,   reject_rhsbl_sender dbl.spamhaus.org,   reject_rbl_client zen.spamhaus.org   reject_rbl_client dul.dnsbl.sorbs.net
Jun  4 19:18:56 EmailServer postfix/smtp[2930]: Trusted TLS connection established to gmail-smtp-in.l.google.com[2a00:1450:4010:c0a::1a]:25: TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
Jun  4 19:18:56 EmailServer postfix/bounce[2932]: warning: /etc/postfix/main.cf, line 100: overriding earlier entry: smtpd_recipient_restrictions=permit_mynetworks,   reject_unauth_destination,   check_recipient_access mysql:/etc/postfix/mysql-recipient-access.cf, mysql:/etc/postfix/mysql-recipient-access-domains-and-additional-usernames.cf,   check_policy_service unix:private/policyd-spf   reject_rhsbl_helo dbl.spamhaus.org,   reject_rhsbl_reverse_client dbl.spamhaus.org,   reject_rhsbl_sender dbl.spamhaus.org,   reject_rbl_client zen.spamhaus.org   reject_rbl_client dul.dnsbl.sorbs.net
Jun  4 19:18:56 EmailServer postfix/smtp[2930]: 05C1342594: to=<MY_GMAIL_NAME@gmail.com>, relay=gmail-smtp-in.l.google.com[2a00:1450:4010:c0a::1a]:25, delay=0.2, delays=0.01/0.01/0.16/0.02, dsn=5.1.7, status=bounced (host gmail-smtp-in.l.google.com[2a00:1450:4010:c0a::1a] said: 553-5.1.7 The sender address <mailer+MY_GMAIL_NAME=gmail.com> is not a valid 553 5.1.7 RFC-5321 address. o8si97808ljh.365 - gsmtp (in reply to MAIL FROM command))
Jun  4 19:18:56 EmailServer postfix/cleanup[2918]: 3C66542596: message-id=<20200604171856.3C66542596@mail.PRIMARY_ANONADDY_DOMAIN>
Jun  4 19:18:56 EmailServer postfix/qmgr[2782]: 3C66542596: from=<>, size=5763, nrcpt=1 (queue active)
Jun  4 19:18:56 EmailServer postfix/bounce[2932]: 05C1342594: sender non-delivery notification: 3C66542596
Jun  4 19:18:56 EmailServer postfix/qmgr[2782]: 05C1342594: removed
Jun  4 19:18:56 EmailServer postfix/smtp[2930]: 3C66542596: to=<mailer+MY_GMAIL_NAME=gmail.com@mail.PRIMARY_ANONADDY_DOMAIN>, orig_to=<mailer+MY_GMAIL_NAME=gmail.com>, relay=none, delay=0.01, delays=0/0/0/0, dsn=5.4.6, status=bounced (mail for mail.PRIMARY_ANONADDY_DOMAIN loops back to myself)
Jun  4 19:18:56 EmailServer postfix/qmgr[2782]: 3C66542596: removed

I have redacted my gmail username and my anonaddy domains.

Now I am really at a loss, as I don't understand whats wrong.

<!-- gh-comment-id:638994638 --> @tommyvange commented on GitHub (Jun 4, 2020): ### Update I added the domain to to the `mydestination` variable in the postfix config, and the emails are no longer bouncing. However, It is still not working. Here is the mail.log entry: ``` Jun 4 19:18:54 EmailServer postfix/smtpd[2913]: warning: /etc/postfix/main.cf, line 100: overriding earlier entry: smtpd_recipient_restrictions=permit_mynetworks, reject_unauth_destination, check_recipient_access mysql:/etc/postfix/mysql-recipient-access.cf, mysql:/etc/postfix/mysql-recipient-access-domains-and-additional-usernames.cf, check_policy_service unix:private/policyd-spf reject_rhsbl_helo dbl.spamhaus.org, reject_rhsbl_reverse_client dbl.spamhaus.org, reject_rhsbl_sender dbl.spamhaus.org, reject_rbl_client zen.spamhaus.org reject_rbl_client dul.dnsbl.sorbs.net Jun 4 19:18:54 EmailServer postfix/smtpd[2913]: connect from mail-yb1-f178.google.com[209.85.219.178] Jun 4 19:18:54 EmailServer postfix/anvil[2914]: warning: /etc/postfix/main.cf, line 100: overriding earlier entry: smtpd_recipient_restrictions=permit_mynetworks, reject_unauth_destination, check_recipient_access mysql:/etc/postfix/mysql-recipient-access.cf, mysql:/etc/postfix/mysql-recipient-access-domains-and-additional-usernames.cf, check_policy_service unix:private/policyd-spf reject_rhsbl_helo dbl.spamhaus.org, reject_rhsbl_reverse_client dbl.spamhaus.org, reject_rhsbl_sender dbl.spamhaus.org, reject_rbl_client zen.spamhaus.org reject_rbl_client dul.dnsbl.sorbs.net Jun 4 19:18:55 EmailServer postfix/smtpd[2913]: Anonymous TLS connection established from mail-yb1-f178.google.com[209.85.219.178]: TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) Jun 4 19:18:55 EmailServer postfix/trivial-rewrite[2915]: warning: /etc/postfix/main.cf, line 100: overriding earlier entry: smtpd_recipient_restrictions=permit_mynetworks, reject_unauth_destination, check_recipient_access mysql:/etc/postfix/mysql-recipient-access.cf, mysql:/etc/postfix/mysql-recipient-access-domains-and-additional-usernames.cf, check_policy_service unix:private/policyd-spf reject_rhsbl_helo dbl.spamhaus.org, reject_rhsbl_reverse_client dbl.spamhaus.org, reject_rhsbl_sender dbl.spamhaus.org, reject_rbl_client zen.spamhaus.org reject_rbl_client dul.dnsbl.sorbs.net Jun 4 19:18:55 EmailServer postfix/spawn[2916]: warning: /etc/postfix/main.cf, line 100: overriding earlier entry: smtpd_recipient_restrictions=permit_mynetworks, reject_unauth_destination, check_recipient_access mysql:/etc/postfix/mysql-recipient-access.cf, mysql:/etc/postfix/mysql-recipient-access-domains-and-additional-usernames.cf, check_policy_service unix:private/policyd-spf reject_rhsbl_helo dbl.spamhaus.org, reject_rhsbl_reverse_client dbl.spamhaus.org, reject_rhsbl_sender dbl.spamhaus.org, reject_rbl_client zen.spamhaus.org reject_rbl_client dul.dnsbl.sorbs.net Jun 4 19:18:55 EmailServer policyd-spf[2917]: prepend Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.219.178; helo=mail-yb1-f178.google.com; envelope-from=MY_GMAIL_NAME@gmail.com; receiver=<UNKNOWN> Jun 4 19:18:55 EmailServer postfix/cleanup[2918]: warning: /etc/postfix/main.cf, line 100: overriding earlier entry: smtpd_recipient_restrictions=permit_mynetworks, reject_unauth_destination, check_recipient_access mysql:/etc/postfix/mysql-recipient-access.cf, mysql:/etc/postfix/mysql-recipient-access-domains-and-additional-usernames.cf, check_policy_service unix:private/policyd-spf reject_rhsbl_helo dbl.spamhaus.org, reject_rhsbl_reverse_client dbl.spamhaus.org, reject_rhsbl_sender dbl.spamhaus.org, reject_rbl_client zen.spamhaus.org reject_rbl_client dul.dnsbl.sorbs.net Jun 4 19:18:55 EmailServer postfix/smtpd[2913]: 6EC1442594: client=mail-yb1-f178.google.com[209.85.219.178] Jun 4 19:18:55 EmailServer postfix/cleanup[2918]: 6EC1442594: message-id=<CACxQPP=GVgdVtG5aAy8LVxzthuKTqAWge-vAaJaYmTwHD1yO_g@mail.gmail.com> Jun 4 19:18:55 EmailServer opendkim[2192]: 6EC1442594: s=20161025 d=gmail.com SSL Jun 4 19:18:55 EmailServer opendmarc[6440]: 6EC1442594: gmail.com pass Jun 4 19:18:55 EmailServer postfix/qmgr[2782]: 6EC1442594: from=<MY_GMAIL_NAME@gmail.com>, size=2860, nrcpt=1 (queue active) Jun 4 19:18:55 EmailServer postfix/pipe[2919]: warning: /etc/postfix/main.cf, line 100: overriding earlier entry: smtpd_recipient_restrictions=permit_mynetworks, reject_unauth_destination, check_recipient_access mysql:/etc/postfix/mysql-recipient-access.cf, mysql:/etc/postfix/mysql-recipient-access-domains-and-additional-usernames.cf, check_policy_service unix:private/policyd-spf reject_rhsbl_helo dbl.spamhaus.org, reject_rhsbl_reverse_client dbl.spamhaus.org, reject_rhsbl_sender dbl.spamhaus.org, reject_rbl_client zen.spamhaus.org reject_rbl_client dul.dnsbl.sorbs.net Jun 4 19:18:55 EmailServer postfix/smtpd[2913]: disconnect from mail-yb1-f178.google.com[209.85.219.178] ehlo=2 starttls=1 mail=1 rcpt=1 data=1 quit=1 commands=7 Jun 4 19:18:56 EmailServer postfix/sendmail[2928]: warning: /etc/postfix/main.cf, line 100: overriding earlier entry: smtpd_recipient_restrictions=permit_mynetworks, reject_unauth_destination, check_recipient_access mysql:/etc/postfix/mysql-recipient-access.cf, mysql:/etc/postfix/mysql-recipient-access-domains-and-additional-usernames.cf, check_policy_service unix:private/policyd-spf reject_rhsbl_helo dbl.spamhaus.org, reject_rhsbl_reverse_client dbl.spamhaus.org, reject_rhsbl_sender dbl.spamhaus.org, reject_rbl_client zen.spamhaus.org reject_rbl_client dul.dnsbl.sorbs.net Jun 4 19:18:56 EmailServer postfix/postdrop[2929]: warning: /etc/postfix/main.cf, line 100: overriding earlier entry: smtpd_recipient_restrictions=permit_mynetworks, reject_unauth_destination, check_recipient_access mysql:/etc/postfix/mysql-recipient-access.cf, mysql:/etc/postfix/mysql-recipient-access-domains-and-additional-usernames.cf, check_policy_service unix:private/policyd-spf reject_rhsbl_helo dbl.spamhaus.org, reject_rhsbl_reverse_client dbl.spamhaus.org, reject_rhsbl_sender dbl.spamhaus.org, reject_rbl_client zen.spamhaus.org reject_rbl_client dul.dnsbl.sorbs.net Jun 4 19:18:56 EmailServer postfix/pipe[2919]: 6EC1442594: to=<1a8638b2-f5d1-4a31-be02-e38b3cd9e28a@SECOND_ANONADDY_DOMAIN>, relay=anonaddy, delay=0.73, delays=0.44/0.01/0/0.28, dsn=2.0.0, status=sent (delivered via anonaddy service) Jun 4 19:18:56 EmailServer postfix/qmgr[2782]: 6EC1442594: removed Jun 4 19:18:56 EmailServer postfix/pickup[2781]: 05C1342594: uid=1000 from=<mailer@> Jun 4 19:18:56 EmailServer opendmarc[6440]: ignoring connection from localhost Jun 4 19:18:56 EmailServer postfix/cleanup[2918]: 05C1342594: message-id=<538013ae7837e8ec17bbb8dafcb0b356@SECOND_ANONADDY_DOMAIN> Jun 4 19:18:56 EmailServer postfix/qmgr[2782]: 05C1342594: from=<mailer@>, size=2891, nrcpt=1 (queue active) Jun 4 19:18:56 EmailServer postfix/smtp[2930]: warning: /etc/postfix/main.cf, line 100: overriding earlier entry: smtpd_recipient_restrictions=permit_mynetworks, reject_unauth_destination, check_recipient_access mysql:/etc/postfix/mysql-recipient-access.cf, mysql:/etc/postfix/mysql-recipient-access-domains-and-additional-usernames.cf, check_policy_service unix:private/policyd-spf reject_rhsbl_helo dbl.spamhaus.org, reject_rhsbl_reverse_client dbl.spamhaus.org, reject_rhsbl_sender dbl.spamhaus.org, reject_rbl_client zen.spamhaus.org reject_rbl_client dul.dnsbl.sorbs.net Jun 4 19:18:56 EmailServer postfix/smtp[2930]: Trusted TLS connection established to gmail-smtp-in.l.google.com[2a00:1450:4010:c0a::1a]:25: TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) Jun 4 19:18:56 EmailServer postfix/bounce[2932]: warning: /etc/postfix/main.cf, line 100: overriding earlier entry: smtpd_recipient_restrictions=permit_mynetworks, reject_unauth_destination, check_recipient_access mysql:/etc/postfix/mysql-recipient-access.cf, mysql:/etc/postfix/mysql-recipient-access-domains-and-additional-usernames.cf, check_policy_service unix:private/policyd-spf reject_rhsbl_helo dbl.spamhaus.org, reject_rhsbl_reverse_client dbl.spamhaus.org, reject_rhsbl_sender dbl.spamhaus.org, reject_rbl_client zen.spamhaus.org reject_rbl_client dul.dnsbl.sorbs.net Jun 4 19:18:56 EmailServer postfix/smtp[2930]: 05C1342594: to=<MY_GMAIL_NAME@gmail.com>, relay=gmail-smtp-in.l.google.com[2a00:1450:4010:c0a::1a]:25, delay=0.2, delays=0.01/0.01/0.16/0.02, dsn=5.1.7, status=bounced (host gmail-smtp-in.l.google.com[2a00:1450:4010:c0a::1a] said: 553-5.1.7 The sender address <mailer+MY_GMAIL_NAME=gmail.com> is not a valid 553 5.1.7 RFC-5321 address. o8si97808ljh.365 - gsmtp (in reply to MAIL FROM command)) Jun 4 19:18:56 EmailServer postfix/cleanup[2918]: 3C66542596: message-id=<20200604171856.3C66542596@mail.PRIMARY_ANONADDY_DOMAIN> Jun 4 19:18:56 EmailServer postfix/qmgr[2782]: 3C66542596: from=<>, size=5763, nrcpt=1 (queue active) Jun 4 19:18:56 EmailServer postfix/bounce[2932]: 05C1342594: sender non-delivery notification: 3C66542596 Jun 4 19:18:56 EmailServer postfix/qmgr[2782]: 05C1342594: removed Jun 4 19:18:56 EmailServer postfix/smtp[2930]: 3C66542596: to=<mailer+MY_GMAIL_NAME=gmail.com@mail.PRIMARY_ANONADDY_DOMAIN>, orig_to=<mailer+MY_GMAIL_NAME=gmail.com>, relay=none, delay=0.01, delays=0/0/0/0, dsn=5.4.6, status=bounced (mail for mail.PRIMARY_ANONADDY_DOMAIN loops back to myself) Jun 4 19:18:56 EmailServer postfix/qmgr[2782]: 3C66542596: removed ``` _I have redacted my gmail username and my anonaddy domains._ Now I am really at a loss, as I don't understand whats wrong.
Author
Owner

@willbrowningme commented on GitHub (Jun 9, 2020):

Did you try to just add the domain via the domains page of the app?

<!-- gh-comment-id:641469600 --> @willbrowningme commented on GitHub (Jun 9, 2020): Did you try to just add the domain via the domains page of the app?
Author
Owner

@tommyvange commented on GitHub (Jun 9, 2020):

Did you try to just add the domain via the domains page of the app?

That is not what I mean, I mean add a new global one like 4wrd.cc is in anonaddy.

<!-- gh-comment-id:641620269 --> @tommyvange commented on GitHub (Jun 9, 2020): > Did you try to just add the domain via the domains page of the app? That is not what I mean, I mean add a new global one like 4wrd.cc is in anonaddy.
Author
Owner

@willbrowningme commented on GitHub (Jun 12, 2020):

Okay, please try adding the domain to virtual_mailbox_domains instead of mydestination in /etc/postfix/main.cf and then also adding it to your .env file under ANONADDY_ALL_DOMAINS

<!-- gh-comment-id:643169284 --> @willbrowningme commented on GitHub (Jun 12, 2020): Okay, please try adding the domain to `virtual_mailbox_domains` instead of `mydestination` in `/etc/postfix/main.cf` and then also adding it to your `.env` file under `ANONADDY_ALL_DOMAINS`
Author
Owner

@willbrowningme commented on GitHub (Jun 21, 2020):

@tommyvange did you get this issue sorted in the end?

<!-- gh-comment-id:647106549 --> @willbrowningme commented on GitHub (Jun 21, 2020): @tommyvange did you get this issue sorted in the end?
Author
Owner

@tommyvange commented on GitHub (Jun 21, 2020):

@willbrowningme - I had surgery, so I haven't been on my PC for a while. I will update when I have tried again :)

<!-- gh-comment-id:647106885 --> @tommyvange commented on GitHub (Jun 21, 2020): @willbrowningme - I had surgery, so I haven't been on my PC for a while. I will update when I have tried again :)
Author
Owner

@willbrowningme commented on GitHub (Jun 21, 2020):

@tommyvange sorry to hear that, wishing you a speedy recovery.

<!-- gh-comment-id:647107202 --> @willbrowningme commented on GitHub (Jun 21, 2020): @tommyvange sorry to hear that, wishing you a speedy recovery.
Author
Owner

@slurdge commented on GitHub (Sep 17, 2020):

Hey there, I just added a second domain to my docker install of anonaddy. Some things are working, some other not but there is progress.
Here is what I did:

  1. Add *.seconddomain.com and seconddomain.com have MX to mydomain.com. I can verify this in DNS
  2. Add seconddomain.com to virtual_mailbox_domains with sed:
sed -i 's/virtual_mailbox_domains = $mydomain, unsubscribe.$mydomain,/virtual_mailbox_domains = $mydomain, unsubscribe.$mydomain, seconddomain.com,/' /etc/postfix/main.cf

So far, so good. Emails sent to seconddomain.com are correctly forwarded.
However, the emails sent to a subdomain of seconddomain are not. I guess this is because of the following rule:
In /etc/postfix/mysql-virtual-alias-domains-and-subdomains.cf:

query = SELECT (SELECT 1 FROM users WHERE CONCAT(username, '.mydomain.com') = '%s') AS users, (SELECT 1 FROM additional_usernames WHERE CONCAT(additional_usernames.username, '.mydomain.com') = '%s') AS usernames, (SELECT 1 FROM domains WHERE domains.domain = '%s' AND domains.domain_verified_at IS NOT NULL) AS domains LIMIT 1;

Which lacks the second domain.

I see two solutions:

  1. Add the domain trough the interface, but I find it unappealing. This is an "administrator" added email, and to have it added also through interface seems unnatural at best, prone to weird bugs at worst.
  2. Change the above MySQL query. I guess this is what you did on the anonaddy product @willbrowningme . Would you mind sharing a version with more than one domain ? I guess just a OR CONCAT(username, '.seconddomain.com' = '%s') is enough but would like to confirm.

After that, I would suggest to @crazy-max to update the script that makes the modifications & substitutions (https://github.com/anonaddy/docker/blob/master/rootfs/etc/cont-init.d/03-config.sh) to:

  • Split the ANONADDY_ALL_DOMAINS variable
  • Iterate over it to add the domain(s) to virtual_mailbox_domains (joined by , so "should" be the same thing)
  • Iterate over it and add the domain(s) to the MySQL query.

What's your thoughts ?

<!-- gh-comment-id:694228543 --> @slurdge commented on GitHub (Sep 17, 2020): Hey there, I just added a second domain to my docker install of anonaddy. Some things are working, some other not but there is progress. Here is what I did: 1. Add `*.seconddomain.com` and `seconddomain.com` have MX to `mydomain.com.` I can verify this in DNS 2. Add `seconddomain.com` to `virtual_mailbox_domains ` with sed: ```bash sed -i 's/virtual_mailbox_domains = $mydomain, unsubscribe.$mydomain,/virtual_mailbox_domains = $mydomain, unsubscribe.$mydomain, seconddomain.com,/' /etc/postfix/main.cf ``` So far, so good. Emails sent to **seconddomain.com** are correctly forwarded. However, the emails sent to a subdomain of seconddomain are not. I guess this is because of the following rule: In `/etc/postfix/mysql-virtual-alias-domains-and-subdomains.cf`: ```mysql query = SELECT (SELECT 1 FROM users WHERE CONCAT(username, '.mydomain.com') = '%s') AS users, (SELECT 1 FROM additional_usernames WHERE CONCAT(additional_usernames.username, '.mydomain.com') = '%s') AS usernames, (SELECT 1 FROM domains WHERE domains.domain = '%s' AND domains.domain_verified_at IS NOT NULL) AS domains LIMIT 1; ``` Which lacks the second domain. I see two solutions: 1. Add the domain trough the interface, but I find it unappealing. This is an "administrator" added email, and to have it added also through interface seems unnatural at best, prone to weird bugs at worst. 2. Change the above MySQL query. I guess this is what you did on the anonaddy product @willbrowningme . Would you mind sharing a version with more than one domain ? I guess just a `OR CONCAT(username, '.seconddomain.com' = '%s')` is enough but would like to confirm. After that, I would suggest to @crazy-max to update the script that makes the modifications & substitutions (https://github.com/anonaddy/docker/blob/master/rootfs/etc/cont-init.d/03-config.sh) to: - Split the `ANONADDY_ALL_DOMAINS` variable - Iterate over it to add the domain(s) to `virtual_mailbox_domains` (joined by , so "should" be the same thing) - Iterate over it and add the domain(s) to the MySQL query. What's your thoughts ?
Author
Owner

@slurdge commented on GitHub (Sep 17, 2020):

I did the changes manually on my instance, I can confirm that adding the OR CONCAT(username, '.seconddomain.com') = '%s' and OR CONCAT(additional_usernames.username, '.seconddomain.com) = '%s' works.
I have both domains in the frontend, and receiving/forwarding emails both directly and with subdomains work also.

<!-- gh-comment-id:694511313 --> @slurdge commented on GitHub (Sep 17, 2020): I did the changes manually on my instance, I can confirm that adding the `OR CONCAT(username, '.seconddomain.com') = '%s'` and `OR CONCAT(additional_usernames.username, '.seconddomain.com) = '%s'` works. I have both domains in the frontend, and receiving/forwarding emails both directly and with subdomains work also.
Author
Owner

@willbrowningme commented on GitHub (Sep 18, 2020):

@slurdge Yes you're correct, I have done this manually using OR, it would be good if this could be automated though as you say. I'll post a full example with multiple domains later for reference.

<!-- gh-comment-id:694777898 --> @willbrowningme commented on GitHub (Sep 18, 2020): @slurdge Yes you're correct, I have done this manually using `OR`, it would be good if this could be automated though as you say. I'll post a full example with multiple domains later for reference.
Author
Owner

@willbrowningme commented on GitHub (Sep 19, 2020):

query = SELECT (SELECT 1 FROM users WHERE CONCAT(username, '.anonaddy.com') = '%s' OR CONCAT(username, '.anonaddy.me') = '%s') AS users, (SELECT 1 FROM additional_usernames WHERE CONCAT(additional_usernames.username, '.anonaddy.com') = '%s' OR CONCAT(additional_usernames.username, '.anonaddy.me') = '%s') AS usernames, (SELECT 1 FROM domains WHERE domains.domain = '%s' AND domains.domain_verified_at IS NOT NULL) AS domains LIMIT 1;

A full example with two domains - anonaddy.com and anonaddy.me

<!-- gh-comment-id:695175911 --> @willbrowningme commented on GitHub (Sep 19, 2020): ```SQL query = SELECT (SELECT 1 FROM users WHERE CONCAT(username, '.anonaddy.com') = '%s' OR CONCAT(username, '.anonaddy.me') = '%s') AS users, (SELECT 1 FROM additional_usernames WHERE CONCAT(additional_usernames.username, '.anonaddy.com') = '%s' OR CONCAT(additional_usernames.username, '.anonaddy.me') = '%s') AS usernames, (SELECT 1 FROM domains WHERE domains.domain = '%s' AND domains.domain_verified_at IS NOT NULL) AS domains LIMIT 1; ``` A full example with two domains - anonaddy.com and anonaddy.me
Author
Owner

@slurdge commented on GitHub (Sep 19, 2020):

Thank you! This is exactly what I did.
@crazy-max in pseudo python code here is what the config.sh script should do:

domains = [x.strip() for x in env['ANONADDY_ALL_DOMAINS'].split(',')]
vbox_domains = ",".join(domains) + "," + ",".join(['unsubscribe.' + x for x in domains])
mysql_or_user= " OR ".join(["CONCAT(username, "'"+x+"') = '%s' for x in domains])
mysql_or_adduser= " OR ".join(["CONCAT(additional_usernames.username, "'"+x+"') = '%s' for x in domains])
#replace in the config files
<!-- gh-comment-id:695186712 --> @slurdge commented on GitHub (Sep 19, 2020): Thank you! This is exactly what I did. @crazy-max in pseudo python code here is what the config.sh script should do: ```python domains = [x.strip() for x in env['ANONADDY_ALL_DOMAINS'].split(',')] vbox_domains = ",".join(domains) + "," + ",".join(['unsubscribe.' + x for x in domains]) mysql_or_user= " OR ".join(["CONCAT(username, "'"+x+"') = '%s' for x in domains]) mysql_or_adduser= " OR ".join(["CONCAT(additional_usernames.username, "'"+x+"') = '%s' for x in domains]) #replace in the config files ```
Author
Owner

@crazy-max commented on GitHub (Sep 21, 2020):

@slurdge Has been added to the Docker image, thanks for the tips.

mysql-virtual-alias-domains-and-subdomains.cf

SELECT
  (
    SELECT
      1
    FROM
      users
    WHERE
      CONCAT(username, '.anonaddy.docker') = '%s'
      OR CONCAT(username, '.anonaddy2.docker') = '%s'
  ) AS users,
  (
    SELECT
      1
    FROM
      additional_usernames
    WHERE
      CONCAT(
        additional_usernames.username,
        '.anonaddy.docker'
      ) = '%s'
      OR CONCAT(
        additional_usernames.username,
        '.anonaddy2.docker'
      ) = '%s'
  ) AS usernames,
  (
    SELECT
      1
    FROM
      domains
    WHERE
      domains.domain = '%s'
      AND domains.domain_verified_at IS NOT NULL
  ) AS domains
LIMIT
  1;

mysql-recipient-access-domains-and-additional-usernames.cf

SELECT
  (
    SELECT
      'DISCARD'
    FROM
      additional_usernames
    WHERE
      (
        CONCAT(username, '.anonaddy.docker') = SUBSTRING_INDEX('%s', '@', -1)
        OR CONCAT(username, '.anonaddy2.docker') = SUBSTRING_INDEX('%s', '@', -1)
      )
      AND active = 0
  ) AS usernames,
  (
    SELECT
      'DISCARD'
    FROM
      domains
    WHERE
      domain = SUBSTRING_INDEX('%s', '@', -1)
      AND active = 0
  ) AS domains
LIMIT
  1;
<!-- gh-comment-id:696264461 --> @crazy-max commented on GitHub (Sep 21, 2020): @slurdge Has been added to the Docker image, thanks for the tips. ### `mysql-virtual-alias-domains-and-subdomains.cf` ```sql SELECT ( SELECT 1 FROM users WHERE CONCAT(username, '.anonaddy.docker') = '%s' OR CONCAT(username, '.anonaddy2.docker') = '%s' ) AS users, ( SELECT 1 FROM additional_usernames WHERE CONCAT( additional_usernames.username, '.anonaddy.docker' ) = '%s' OR CONCAT( additional_usernames.username, '.anonaddy2.docker' ) = '%s' ) AS usernames, ( SELECT 1 FROM domains WHERE domains.domain = '%s' AND domains.domain_verified_at IS NOT NULL ) AS domains LIMIT 1; ``` ### `mysql-recipient-access-domains-and-additional-usernames.cf` ```sql SELECT ( SELECT 'DISCARD' FROM additional_usernames WHERE ( CONCAT(username, '.anonaddy.docker') = SUBSTRING_INDEX('%s', '@', -1) OR CONCAT(username, '.anonaddy2.docker') = SUBSTRING_INDEX('%s', '@', -1) ) AND active = 0 ) AS usernames, ( SELECT 'DISCARD' FROM domains WHERE domain = SUBSTRING_INDEX('%s', '@', -1) AND active = 0 ) AS domains LIMIT 1; ```
Author
Owner

@slurdge commented on GitHub (Sep 21, 2020):

@crazy-max Nice. I think the example above is correct but a bug has slipped in the commit, I commented on the commit. Let me know what you think.

<!-- gh-comment-id:696302117 --> @slurdge commented on GitHub (Sep 21, 2020): @crazy-max Nice. I think the example above is correct but a bug has slipped in the commit, I commented on the commit. Let me know what you think.
Author
Owner

@slurdge commented on GitHub (Sep 21, 2020):

I was mistaken, no bug to see!

<!-- gh-comment-id:696320795 --> @slurdge commented on GitHub (Sep 21, 2020): I was mistaken, no bug to see!
Author
Owner

@willbrowningme commented on GitHub (Oct 9, 2020):

@slurdge @crazy-max I'm looking at updating the query for mysql-recipient-access-domains-and-additional-usernames.cf to enable the catch-all option for additional usernames and custom domains. I've got a couple of options below:

SELECT
  (
    SELECT
      CASE
        WHEN NOT EXISTS(
          SELECT
            NULL
          FROM
            aliases
          WHERE
            email = '%s'
        )
        AND catch_all = 0 THEN "REJECT"
        WHEN active = 0 THEN "DISCARD"
        ELSE NULL
      END
    FROM
      additional_usernames
    WHERE
      SUBSTRING_INDEX('%s', '@', -1) IN (
        CONCAT(username, '.anonaddy.docker'),
        CONCAT(username, '.anonaddy2.docker')
      )
  ) AS usernames,
  (
    SELECT
      CASE
        WHEN NOT EXISTS(
          SELECT
            NULL
          FROM
            aliases
          WHERE
            email = '%s'
        )
        AND catch_all = 0 THEN "REJECT"
        WHEN active = 0 THEN "DISCARD"
        ELSE NULL
      END
    FROM
      domains
    WHERE
      domain = SUBSTRING_INDEX('%s', '@', -1)
  ) AS domains
LIMIT
  1;

I don't particularly like the repeated NOT EXISTS query to check if the alias already exists in the database.

This query avoids the repeated check for the existance of the alias and seems to be working after a little testing:

SELECT
  (
    SELECT
      CASE
        WHEN NOT EXISTS(
          SELECT
            NULL
          FROM
            aliases
          WHERE
            email = '%s'
        )
        AND additional_usernames.catch_all = 0
        OR domains.catch_all = 0 THEN "REJECT"
        WHEN additional_usernames.active = 0
        OR domains.active = 0 THEN "DISCARD"
        ELSE NULL
      END
    FROM
      additional_usernames,
      domains
    WHERE
      SUBSTRING_INDEX('%s', '@', -1) IN (
        CONCAT(additional_usernames.username, '.anonaddy.docker'),
        CONCAT(additional_usernames.username, '.anonaddy2.docker')
      )
      OR domains.domain = SUBSTRING_INDEX('%s', '@', -1)
    LIMIT
      1
  ) AS result
LIMIT
  1;

What do you think?

<!-- gh-comment-id:706106160 --> @willbrowningme commented on GitHub (Oct 9, 2020): @slurdge @crazy-max I'm looking at updating the query for `mysql-recipient-access-domains-and-additional-usernames.cf` to enable the catch-all option for additional usernames and custom domains. I've got a couple of options below: ```SQL SELECT ( SELECT CASE WHEN NOT EXISTS( SELECT NULL FROM aliases WHERE email = '%s' ) AND catch_all = 0 THEN "REJECT" WHEN active = 0 THEN "DISCARD" ELSE NULL END FROM additional_usernames WHERE SUBSTRING_INDEX('%s', '@', -1) IN ( CONCAT(username, '.anonaddy.docker'), CONCAT(username, '.anonaddy2.docker') ) ) AS usernames, ( SELECT CASE WHEN NOT EXISTS( SELECT NULL FROM aliases WHERE email = '%s' ) AND catch_all = 0 THEN "REJECT" WHEN active = 0 THEN "DISCARD" ELSE NULL END FROM domains WHERE domain = SUBSTRING_INDEX('%s', '@', -1) ) AS domains LIMIT 1; ``` I don't particularly like the repeated `NOT EXISTS` query to check if the alias already exists in the database. This query avoids the repeated check for the existance of the alias and seems to be working after a little testing: ```SQL SELECT ( SELECT CASE WHEN NOT EXISTS( SELECT NULL FROM aliases WHERE email = '%s' ) AND additional_usernames.catch_all = 0 OR domains.catch_all = 0 THEN "REJECT" WHEN additional_usernames.active = 0 OR domains.active = 0 THEN "DISCARD" ELSE NULL END FROM additional_usernames, domains WHERE SUBSTRING_INDEX('%s', '@', -1) IN ( CONCAT(additional_usernames.username, '.anonaddy.docker'), CONCAT(additional_usernames.username, '.anonaddy2.docker') ) OR domains.domain = SUBSTRING_INDEX('%s', '@', -1) LIMIT 1 ) AS result LIMIT 1; ``` What do you think?
Author
Owner

@willbrowningme commented on GitHub (Oct 9, 2020):

I've gone with the second one, this is now live and I'll tag a new release shortly.

<!-- gh-comment-id:706165752 --> @willbrowningme commented on GitHub (Oct 9, 2020): I've gone with the second one, this is now live and I'll tag a new release shortly.
Author
Owner

@slurdge commented on GitHub (Oct 9, 2020):

Sorry I didn't have time to review, but 2nd one is indeed better 😄

<!-- gh-comment-id:706408457 --> @slurdge commented on GitHub (Oct 9, 2020): Sorry I didn't have time to review, but 2nd one is indeed better 😄
Author
Owner

@crazy-max commented on GitHub (Oct 9, 2020):

@willbrowningme v0.5.0 docker image available.

<!-- gh-comment-id:706438979 --> @crazy-max commented on GitHub (Oct 9, 2020): @willbrowningme [v0.5.0](https://github.com/anonaddy/docker/commit/083c611e4fea15e40068b53de053a61186a3682c) docker image available.
Author
Owner

@willbrowningme commented on GitHub (Oct 16, 2020):

The query above introduced a bug for the catch-all domains and additional usernames in v0.5.0. I've just released v0.6.0 which fixes the bug but it does have some breaking changes. Please see the release notes about the new stored procedure that replaces the previous two.

<!-- gh-comment-id:710005914 --> @willbrowningme commented on GitHub (Oct 16, 2020): The query above introduced a bug for the catch-all domains and additional usernames in v0.5.0. I've just released [v0.6.0](https://github.com/anonaddy/anonaddy/releases/tag/v0.6.0) which fixes the bug but it does have some breaking changes. Please see the release notes about the new stored procedure that replaces the previous two.
Author
Owner

@willbrowningme commented on GitHub (Dec 2, 2020):

Closing this issue for now, the self-hosting instructions have details on how to add another global domain.

<!-- gh-comment-id:737134338 --> @willbrowningme commented on GitHub (Dec 2, 2020): Closing this issue for now, the self-hosting instructions have details on how to add another global domain.
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/anonaddy#92
No description provided.