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

Better password storage #1753

Merged
merged 17 commits into from Mar 9, 2021
Merged

Better password storage #1753

merged 17 commits into from Mar 9, 2021

Conversation

nextgens
Copy link
Contributor

@nextgens nextgens commented Feb 7, 2021

What type of PR?

Enhancement: optimization of the logic to speedup authentication requests, support the import of most hashes passlib supports.

What does this PR do?

  • it changes the default password cold-storage format to sha256+bcrypt
  • it enhances the logic to ensure that no CPU cycles are wasted when valid credentials are found
  • it fixes token authentication on /webdav/
  • it lowers the number of rounds used for token storage (on the basis that they are high-entropy: not bruteforceable and speed matters)
  • it introduces a new setting to set the number of rounds used by the password hashing function (CREDENTIAL_ROUNDS). The setting can be adjusted as required and existing hashes will be migrated to the new cost-factor.
  • it updates the version of passlib in use and enables all supported hash types (that will be converted to the current settings on first use)
  • it removes the PASSWORD_SCHEME setting

Related issue(s)

Prerequistes

Before we can consider review and merge, please make sure the following list is done and checked.
If an entry in not applicable, you can check it or remove it from the list.

  • In case of feature or enhancement: documentation updated accordingly
  • Unless it's docs or a minor change: add changelog entry file.

@mergify
Copy link
Contributor

mergify bot commented Feb 7, 2021

Thanks for submitting this pull request.
Bors-ng will now build test images. When it succeeds, we will continue to review and test your PR.

bors try

Note: if this build fails, read this.

bors bot added a commit that referenced this pull request Feb 7, 2021
@bors
Copy link
Contributor

bors bot commented Feb 7, 2021

try

Build failed:

@nextgens nextgens mentioned this pull request Feb 7, 2021
2 tasks
@nextgens
Copy link
Contributor Author

nextgens commented Feb 8, 2021

bors retry

@bors
Copy link
Contributor

bors bot commented Feb 8, 2021

🔒 Permission denied

Existing reviewers: click here to make nextgens a reviewer

lub
lub previously requested changes Feb 8, 2021
Copy link
Member

@lub lub left a comment

Choose a reason for hiding this comment

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

Thank you very much, although the review took me longer than anticipated. But that's not your fault :)

I've left some thoughts and suggestions. Would be great if you could have a look at them, although I suspect you already have more experience with that part of the code than me. So maybe I missed some things.

I haven't tested the code on my system(s) yet, in case you want to incorporate some of the notes. But from reading it I didn't find any bugs.

core/admin/mailu/configuration.py Outdated Show resolved Hide resolved
core/admin/mailu/internal/nginx.py Outdated Show resolved Hide resolved
core/admin/mailu/internal/views/auth.py Outdated Show resolved Hide resolved
core/admin/mailu/models.py Show resolved Hide resolved
core/admin/mailu/models.py Show resolved Hide resolved
docs/configuration.rst Outdated Show resolved Hide resolved
towncrier/newsfragments/1194.misc Outdated Show resolved Hide resolved
towncrier/newsfragments/1662.feature Outdated Show resolved Hide resolved
@mergify mergify bot dismissed lub’s stale review February 9, 2021 08:39

Pull request has been modified.

@nextgens nextgens requested a review from lub February 9, 2021 08:46
lub
lub previously approved these changes Feb 11, 2021
@mergify mergify bot dismissed lub’s stale review February 11, 2021 22:15

Pull request has been modified.

@nextgens nextgens force-pushed the better-password-storage branch 2 times, most recently from cf0ef56 to aba4e3e Compare February 12, 2021 09:39
lub
lub previously approved these changes Feb 13, 2021
Copy link
Member

@lub lub left a comment

Choose a reason for hiding this comment

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

thank you for also adding context caching :)

@nextgens
Copy link
Contributor Author

@ghostwheel42 any chance you can update your review to get it merged?

Copy link
Contributor

@ghostwheel42 ghostwheel42 left a comment

Choose a reason for hiding this comment

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

@nextgens sorry, I somehow overlooked this.
But I think there's just a bors try missing, isn't it?

Diman0
Diman0 previously approved these changes Mar 8, 2021
Copy link
Member

@Diman0 Diman0 left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thank you for this PR. It is a great improvement for mailu.

@mergify
Copy link
Contributor

mergify bot commented Mar 8, 2021

bors r+

bors bot added a commit that referenced this pull request Mar 8, 2021
1753: Better password storage r=mergify[bot] a=nextgens

## What type of PR?

Enhancement: optimization of the logic to speedup authentication requests, support the import of most hashes passlib supports.

## What does this PR do?

- it changes the default password cold-storage format to sha256+bcrypt
- it enhances the logic to ensure that no CPU cycles are wasted when valid credentials are found
- it fixes token authentication on /webdav/
- it lowers the number of rounds used for token storage (on the basis that they are high-entropy: not bruteforceable and speed matters)
- it introduces a new setting to set the number of rounds used by the password hashing function (CREDENTIAL_ROUNDS). The setting can be adjusted as required and existing hashes will be migrated to the new cost-factor.
- it updates the version of passlib in use and enables all supported hash types (that will be converted to the current settings on first use)
- it removes the PASSWORD_SCHEME setting

### Related issue(s)
- close #1194
- close #1662
- close #1706

## Prerequistes
Before we can consider review and merge, please make sure the following list is done and checked.
If an entry in not applicable, you can check it or remove it from the list.

- [x] In case of feature or enhancement: documentation updated accordingly
- [x] Unless it's docs or a minor change: add [changelog](https://mailu.io/master/contributors/guide.html#changelog) entry file.


Co-authored-by: Florent Daigniere <nextgens@freenetproject.org>
@bors
Copy link
Contributor

bors bot commented Mar 8, 2021

Build failed:

@Diman0
Copy link
Member

Diman0 commented Mar 8, 2021

bors retry

bors bot added a commit that referenced this pull request Mar 8, 2021
1753: Better password storage r=mergify[bot] a=nextgens

## What type of PR?

Enhancement: optimization of the logic to speedup authentication requests, support the import of most hashes passlib supports.

## What does this PR do?

- it changes the default password cold-storage format to sha256+bcrypt
- it enhances the logic to ensure that no CPU cycles are wasted when valid credentials are found
- it fixes token authentication on /webdav/
- it lowers the number of rounds used for token storage (on the basis that they are high-entropy: not bruteforceable and speed matters)
- it introduces a new setting to set the number of rounds used by the password hashing function (CREDENTIAL_ROUNDS). The setting can be adjusted as required and existing hashes will be migrated to the new cost-factor.
- it updates the version of passlib in use and enables all supported hash types (that will be converted to the current settings on first use)
- it removes the PASSWORD_SCHEME setting

### Related issue(s)
- close #1194
- close #1662
- close #1706

## Prerequistes
Before we can consider review and merge, please make sure the following list is done and checked.
If an entry in not applicable, you can check it or remove it from the list.

- [x] In case of feature or enhancement: documentation updated accordingly
- [x] Unless it's docs or a minor change: add [changelog](https://mailu.io/master/contributors/guide.html#changelog) entry file.


Co-authored-by: Florent Daigniere <nextgens@freenetproject.org>
@bors
Copy link
Contributor

bors bot commented Mar 8, 2021

Build failed:

@Diman0
Copy link
Member

Diman0 commented Mar 9, 2021

bors retry

@bors
Copy link
Contributor

bors bot commented Mar 9, 2021

Merge conflict.

@mergify mergify bot dismissed stale reviews from lub and Diman0 March 9, 2021 10:53

Pull request has been modified.

@nextgens
Copy link
Contributor Author

nextgens commented Mar 9, 2021

bors r+

@bors
Copy link
Contributor

bors bot commented Mar 9, 2021

Build succeeded:

@bors bors bot merged commit 7e2db9c into Mailu:master Mar 9, 2021
@nextgens nextgens deleted the better-password-storage branch October 31, 2021 08:43
@ghostwheel42 ghostwheel42 mentioned this pull request Nov 16, 2021
2 tasks
bors bot added a commit that referenced this pull request Nov 16, 2021
2056: Passlib r=mergify[bot] a=ghostwheel42

## What type of PR?

minor bug-fix

## What does this PR do?

compiles list of schemes using an iterator. will not fail when `scrypt` is not present in registry.

### Related issue(s)

updates #1753

## Prerequisites
Before we can consider review and merge, please make sure the following list is done and checked.
If an entry in not applicable, you can check it or remove it from the list.

- [ ] In case of feature or enhancement: documentation updated accordingly
- [ ] Unless it's docs or a minor change: add [changelog](https://mailu.io/master/contributors/workflow.html#changelog) entry file.


Co-authored-by: Alexander Graf <ghostwheel42@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

Support more password schemes from passlib refining the default password scheme
4 participants