Open midasi opened 4 months ago
Hey @midasi
Couldn't you use something like this (just examplatory)?
mysql grommunio --skip-column-names --execute='
create table if not exists grommunio.sendermaps (
"mailbox" TEXT,
"sendasuser" TEXT
);
select username, maildir from grommunio.users;' | while read -r username maildir; do
mysql grommunio --execute="delete from grommunio.sendermaps where mailbox="$username"";
cat $maildir/config/sendas.txt | while read -r sendasuser; do
mysql grommunio --execute="INSERT INTO grommunio.sendermaps ("mailbox","sendasuser") VALUES ("$username", "$sendasuer")"; # or better add them all at once instead of one call/sendas..
done
done
(This was just written in here and not tried at all 🙈)
and instead of a drop you could do some update/insert/delete shenanigans ¯\_(ツ)_/¯
We use SASL authentication in combination with postfix' smtpd_sender_login_maps to restrict the FROM addresses an authenticated SMTP user is allowed to use.
By default the users are only allowed to use their own mail address including all aliases. We implemented this behaviour with a mysql map.
Some users are allowed to use other mail addresses. This can be configured in the admin UI under "Mailbox permissions" / "Send as". This configuration, however, is only stored in a file instead of the database. Therefore we are currently not able to use this information in the smtpd_sender_login_maps.