Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Add mailbox permissions to database #28

Open
midasi opened this issue Jun 20, 2024 · 1 comment
Open

Feature Request: Add mailbox permissions to database #28

midasi opened this issue Jun 20, 2024 · 1 comment
Assignees

Comments

@midasi
Copy link
Contributor

midasi commented Jun 20, 2024

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.

@crpb
Copy link
Contributor

crpb commented Aug 24, 2024

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 ¯\_(ツ)_/¯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants