Skip to content

Support extra user_attributes in accounts configuration#1792

Merged
georglauterbach merged 1 commit intodocker-mailserver:masterfrom
abh:attributes
Feb 7, 2021
Merged

Support extra user_attributes in accounts configuration#1792
georglauterbach merged 1 commit intodocker-mailserver:masterfrom
abh:attributes

Conversation

@abh
Copy link
Copy Markdown
Contributor

@abh abh commented Feb 6, 2021

This allows you to add for example

|userdb_mail=mbox:~/mail:INBOX=~/inbox

to the end of an account to have a different mailbox configuration.

@abh
Copy link
Copy Markdown
Contributor Author

abh commented Feb 6, 2021

This is a rebased patch from #1559

I tried adding a test, too, but "make tests" just hangs for me after doing the first test, so hopefully the CI will tell me if it worked?

@georglauterbach
Copy link
Copy Markdown
Member

I tried adding a test, too, but "make tests" just hangs for me after doing the first test, so hopefully the CI will tell me if it worked?

Submodules are initialized? What OS are you on. The test only support Linux, no other OS. If you're on Linux and submodules are innitialized, hanging tests indicate something is wrong.

@georglauterbach georglauterbach added area/enhancement kind/new feature A new feature is requested in this issue or implemeted with this PR priority/low labels Feb 6, 2021
Comment thread test/tests.bats Outdated
@georglauterbach
Copy link
Copy Markdown
Member

Had to cancel the workflow as it run for 42 minutes when around 10 minutes is expected. Please make it work local first. This cannot be tested in our CI as it's really broken.

Copy link
Copy Markdown
Member

@georglauterbach georglauterbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI completely broken with this PR. Unusable in this state. Please make it work locally first. Init submodules and run make install_linters.

@abh
Copy link
Copy Markdown
Contributor Author

abh commented Feb 6, 2021

I tried adding a test, too, but "make tests" just hangs for me after doing the first test, so hopefully the CI will tell me if it worked?

Submodules are initialized?

Yes.

What OS are you on.

Latest CentOS 7.

The test only support Linux, no other OS. If you're on Linux and submodules are innitialized, hanging tests indicate something is wrong.

Indeed! I didn't figure out what fixed it (a yum upgrade? I used a server that I don't usually use for Docker) but it's running now, albeit really really slowly.

I'll get the tests fixed and submit again.

@abh abh force-pushed the attributes branch 2 times, most recently from 71eae3c to e5bfd07 Compare February 6, 2021 18:05
@georglauterbach
Copy link
Copy Markdown
Member

You will need to rebase on current master to resolve merge conflicts. A file was deleted, which is now shown as a conflict.

@abh
Copy link
Copy Markdown
Contributor Author

abh commented Feb 6, 2021

You will need to rebase on current master to resolve merge conflicts. A file was deleted, which is now shown as a conflict.

yeah, I submitted the PR for removing the file after finding it wasn't used when trying to use it in my tests here. 🤣

This allows you to add for example

    |userdb_mail=mbox:~/mail:INBOX=~/inbox

 to the end of an account to have a different mailbox configuration.
@georglauterbach
Copy link
Copy Markdown
Member

LGTM

But I will request another 4 eyes to look at it, just for good measure

@wernerfred
Copy link
Copy Markdown
Member

wernerfred commented Feb 6, 2021

Can you please elaborate on the following points:

  • Why are those changes necessary?
  • Are there unwanted side effects possible
  • How and where do you set that configuration

I am missing a few background information / motivation about this PR.

@abh
Copy link
Copy Markdown
Contributor Author

abh commented Feb 7, 2021

Can you please elaborate on the following points:

  • Why are those changes necessary?

Dovecot supports overriding many settings per user; adding them in the "extra attributes" field is the way to do it for the authentication we use in docker-mailserver (when not using LDAP anyway).

My use case is having some users use a different mailbox format (in one case because the usage pattern is weird and in some others to ease migration of some large mailboxes from an old dovecot installation).

Another use case I was planning to use is to have a particular robot/system account be restricted to only connect from the network it's expected to be on.

https://doc.dovecot.org/configuration_manual/authentication/user_database_extra_fields/ (the very last example is the one that applies to how docker-mailserver works).

https://doc.dovecot.org/configuration_manual/authentication/passwd_file/

  • Are there unwanted side effects possible

No, we already use the field for the quotas.

  • How and where do you set that configuration

Just by adding the third column in postfix-accounts.cf as I did in the test file (generated by the Makefile). I can write an example for the wiki after it's merged.

I looked at if there were overrides that made sense to promote to the level of support that quotas have, but I wasn't sure where the natural cut-off point is. The feature as-is is a good "safety valve" to allow the per-user dovecot features to be used.

@wernerfred
Copy link
Copy Markdown
Member

Thanks for taking the time and explaining your motivation and changes 💡
Imho nothing speaks against a merge.

Just by adding the third column in postfix-accounts.cf as I did in the test file (generated by the Makefile). I can write an example for the wiki after it's merged.

Yes, please write down an example of this functionality in the wiki otherwise nobody knows it exists. ✍️

I looked at if there were overrides that made sense to promote to the level of support that quotas have, but I wasn't sure where the natural cut-off point is.

You are right, it's hard to find this point. Imho your change is something only a few will use (never saw it requested by an issue) but maybe you will save someones day with this feature 👍

Thanks for your contribution 🤝

@georglauterbach
Copy link
Copy Markdown
Member

Merging when the last review comes in:)

@casperklein
Copy link
Copy Markdown
Member

@abh Thank you for this PR.

As @wernerfred wrote, please add some documentary/example to the README or Wiki.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/features kind/new feature A new feature is requested in this issue or implemeted with this PR priority/low

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants