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

Secure SMTP credentials #1938

Open
aentwist opened this issue Mar 13, 2023 · 5 comments
Open

Secure SMTP credentials #1938

aentwist opened this issue Mar 13, 2023 · 5 comments
Labels
enhancement feature: auto config (Docker secrets) needs review Needs confirmation this is still happening or relevant

Comments

@aentwist
Copy link
Contributor

aentwist commented Mar 13, 2023

Usernames are part of credentials and are therefore also secrets. Add an env var SMTP_NAME_FILE so that SMTP_NAME can be used with Docker secrets.

@aentwist aentwist changed the title Add env vars for SMTP secrets Add env var for SMTP username file Mar 13, 2023
@aentwist aentwist changed the title Add env var for SMTP username file Improve SMTP credentials security Mar 13, 2023
@aentwist aentwist changed the title Improve SMTP credentials security Secure SMTP credentials Mar 26, 2023
@J0WI
Copy link
Contributor

J0WI commented Mar 28, 2023

SMTP_NAME is usually a well known mail address and not handled as a secret. Can you give a use case where this matters?

@aentwist
Copy link
Contributor Author

aentwist commented Mar 28, 2023

Yes, are you sure you aren't thinking of SMTP_HOST?

I found a good article which appears to be based on RFCs. There exists both a username and password. More authoritatively,

PLAIN SASL Mechanism

The mechanism consists of a single message, a string of [UTF-8]
encoded [Unicode] characters, from the client to the server. The
client presents the authorization identity (identity to act as),
followed by a NUL (U+0000) character, followed by the authentication
identity (identity whose password will be used), followed by a NUL
(U+0000) character, followed by the clear-text password. As with
other SASL mechanisms, the client does not provide an authorization
identity when it wishes the server to derive an identity from the
credentials and use that as the authorization identity.

https://datatracker.ietf.org/doc/html/rfc4616

As an example, when you generate a key for AWS / SES it looks something like [keyboard mashing]

key: AOREHNK3UN34OU3OORS
secret: o23un4ouenowfenjh3on3/33ehnjo3uk

Imagine trying to hack something where the username is admin vs. something where it is instead roiehduyowaouwdhowuyhd but you don't know that. This is some kind of credential, and even if it is less sensitive than the secret, in my opinion it should be able to be a secret if users want it to be. The goal of this issue is to allow users to make that choice conveniently.

@J0WI
Copy link
Contributor

J0WI commented Apr 2, 2023

Nextcloud itself does not treat mail_smtpname as a sensitive information. It's not common to do so. Many systems will show the identity in logs, UIs etc. whereas passwords are always treated as confidential values. If you need stronger secrets, just add more random bits to them and deploy countermeasures like rate limiting.

@aentwist
Copy link
Contributor Author

aentwist commented Apr 2, 2023

Nextcloud itself does not treat mail_smtpname as a sensitive

Well that is just unfortunate.. thanks for looking into it.

I am ok with that point as long as it has parity with other usernames. i.e. database username is not treated as sensitive.

@aentwist
Copy link
Contributor Author

workaround: get the updated smtp config file from the MR and mount it over the existing smtp config file at /usr/src/nextcloud/config/smtp.config.php to support SMTP_NAME_FILE. if you don't mount over it then it will be overridden by the existing smtp.config.php, so you have to provide a replacement for the entire file.

@joshtrichards joshtrichards added the needs review Needs confirmation this is still happening or relevant label Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement feature: auto config (Docker secrets) needs review Needs confirmation this is still happening or relevant
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants