postfixadmin / postfixadmin

PostfixAdmin - web based virtual user administration interface for Postfix mail servers
https://postfixadmin.github.io/postfixadmin
Other
1.06k stars 289 forks source link

Aliases don't really work? #762

Closed ozgurkazancci closed 1 year ago

ozgurkazancci commented 1 year ago

Hello there, I've just noticed that Aliases for my domain don't really receive emails.

For instance, postmaster@mysite.com was an alias to info@mysite.com, when I send an email to postmaster@, i don't really receive it in info@mysite.com. However, when I create an inbox/email account named "postmaster@mysite.com", I am able to receive emails successfully.

So any idea where to start checking what's going on with Aliases on my Postfixadmin panel?

Regards.

DavidGoodwin commented 1 year ago

Hi - what do you mean by "don't really receive" ?

Is there anything in the postfix log file for the email ?

What configuration do you have for aliases within postfix's main.cf and what's the output from e.g.

postmap -q postmaster@mysite.com something:/etc/postfix/something/aliases.cf ?

In my case I have :

virtual_alias_maps = hash:/etc/postfix/virtual pgsql:/etc/postfix/pgsql/virtual_alias_maps.cf

where the virtual_alias_maps.cf looks a bit like :

user = postfix
password = 24sdfsdfsdfsdfsdfsd_topSecret9123123123123123
hosts = localhost
dbname = postfix
query = SELECT goto FROM alias WHERE address='%s' AND active = true

and the output from the above gives something like this :

postmap -q something@domain.co.uk pgsql:/etc/postfix/pgsql/virtual_alias_maps.cf
david@domain.co.uk
ozgurkazancci commented 1 year ago

Well, I mean, I don't receive the email to the forwarded inbox; postmaster@ --> info@mydomain.com

postmap -q postmaster@mydomain.com mysql:/etc/postfix/mysql_virtual_alias_maps.cf gives the correct email address: info@mydomain.com

main.cf has the following related line:

virtual_alias_maps = proxy:mysql:/etc/postfix/mysql_virtual_alias_maps.cf

cat mysql_virtual_alias_maps.cf user = postfix password = mypass hosts = localhost dbname = postfix query = SELECT goto FROM alias WHERE address='%s' AND active = '1'

DavidGoodwin commented 1 year ago

is postfix logging anything relevant?

ozgurkazancci commented 1 year ago

It seems the following lines are related ('postmaster' being as an alias of mysite.com);

Sep 20 12:32:28 mail dovecot: auth-worker(9452): conn unix:auth-worker (pid=85275,uid=518): auth-worker<1>: sql(postmaster@mysite.com): unknown user

Sep 20 12:32:28 mail postfix/pipe[53391]: 51376BDFEF: to=<postmaster@mysite.com>, relay=dovecot, delay=8.9, delays=8.8/0.02/0/0.1, dsn=5.1.1, status=bounced (user unknown)

Sep 20 12:32:28 mail postfix/bounce[10836]: 51376BDFEF: sender non-delivery notification: 28C76BE0BC
DavidGoodwin commented 1 year ago
virtual_alias_maps = hash:/etc/postfix/virtual pgsql:/etc/postfix/pgsql/virtual_alias_maps.cf

virtual_mailbox_domains = pgsql:/etc/postfix/pgsql/virtual_domains_maps.cf
virtual_mailbox_maps = pgsql:/etc/postfix/pgsql/virtual_mailbox_maps.cf
virtual_mailbox_base = /var/mail/vmail
virtual_mailbox_limit = 512000000
virtual_minimum_uid = 8
virtual_transport = virtual
virtual_uid_maps = static:8
virtual_gid_maps = static:8
local_transport = virtual
local_recipient_maps = $virtual_mailbox_maps
ozgurkazancci commented 1 year ago

In my main.cf file;

virtual_alias_maps = proxy:mysql:/etc/postfix/mysql_virtual_alias_maps.cf

virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_mailbox_base = /var/vmails
virtual_mailbox_limit = 0
virtual_minimum_uid = 111
virtual_transport = dovecot
virtual_gid_maps = static:111
virtual_uid_maps = static:111

And I don't have these two:

local_transport = virtual
local_recipient_maps = $virtual_mailbox_maps
DavidGoodwin commented 1 year ago

try adding them? :)

ozgurkazancci commented 1 year ago

Yeah, added both and reloaded the postfix, nothing has changed..

ozgurkazancci commented 1 year ago

This one helped:

https://serverfault.com/questions/783177/postfixadmin-dovecot-mysql-aliases-not-working/809329#809329

I had: "receive_override_options = no_address_mappings" in my main.cf file.

Commented it out, and then aliases are working now. I should see why I have that line, as the setup was line by line manual installation by myself.. Might be a reason for that, too..

ozgurkazancci commented 1 year ago

And by the way, I wonder the difference between your "virtual_transport = virtual" and "virtual_transport = dovecot" in my implementation. No dovecot there, or any other reason for you to set 'virtual'?

DavidGoodwin commented 1 year ago

dovecot vs virtual tranport - look what you have in master.cf for the transport?

virtual unix - n n - - virtual

I assume you've defined a 'dovecot' transport and it's doing something funky?

no_address_mappings I've only come across that when I've had content_filters in place and needed to stop the content filter from doing a duplicate alias expansion which is already being done by another transport.

Glad you've found a solution