nextcloud / mail

💌 Mail app for Nextcloud
https://apps.nextcloud.com/apps/mail
GNU Affero General Public License v3.0
833 stars 258 forks source link

Feature Request: allow specifying password for default account #849

Closed amaccuish closed 2 months ago

amaccuish commented 6 years ago

My users login using SAML, so nextcloud doesn't have access to their password from LDAP. It would be sweet if I there could also be a "imapPass" and "smtpPass" in the config file, I have a master user setup on my mail server which can impersonate users so the user's actual password isn't needed, just the master one.

Cheers!

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/56372744-feature-request-allow-specifying-password-for-default-account?utm_campaign=plugin&utm_content=tracker%2F44154351&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F44154351&utm_medium=issues&utm_source=github).
rasos commented 5 years ago

We are facing a similar challenge: we plan to move from LDAP to SAML authentication for nextcloud to offer a true Single-Sign-On user experience.

When looking at the oc_mail_accounts table, I see inbound_passwordand outbound_password and I learned, that this table stores only any additionally account configured by the user in the settings of the Mail app. The default mail account uses the parameters from the config file and the same password given at login, which we don't have anymore available with SAML authentication. The Auto Mail Accounts App would create also a default account in the oc_mail_accountstable, but we still would not get the password.

A master user setup at the mail server is not an option to us, as our users can define their mail account name themselves, which would allow anybody to impersonate.

It seems that this is our only choice: Remove the default mail config option and write the mail parameters directly into the oc_mail_accountstable. Any password change in LDAP would need to be synced to inbound_passwordand outbound_password, though. This way we would be able to write the encrypted and salted password from LDAP, and not use a symmetric one, so we also gain security. Or even more secure: tweak Dovecot's account query so that it takes the mail account user_id from theoc_mail_accounts table and the password from LDAP.

Any concerns so far?

tjareson commented 4 years ago

Have you ever been successful with writing login data for an external mail directly to oc_mail_accounts? I would need the same to provision the access to a mail server without user interaction, so it is all ready to use. Configuration by the user is a hassle, specifically if autodetection is not working and users have to deal with IMAP server, ports and protocols.

I was just wondering: If an account is added in oc_mail_accounts is there a need to create other data in e.g. oc_mail_mailboxes as well or is it done automatically when the user first opens mail? How is the password encrypted? Is it a hash function?

oliv3r commented 1 year ago

I'm curious about this as well, or rather, lets say I would use imap as authentication to nextcloud, can we make it so we can skip the authentication of the mail app? This would make it seemless for users.

ChristophWurst commented 1 year ago

That works already

oliv3r commented 1 year ago

@ChristophWurst Ah, that's great, can you share some more info? All I found was that you need 'external_user' plugin to do imap auth (which I haven't even got working yet :p)

ChristophWurst commented 1 year ago

See the admin groupware settings. For support please use https://help.nextcloud.com/c/support/7

kesselb commented 2 months ago

Is this feature request solved by https://github.com/nextcloud/mail/pull/9008?