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

Write CLI helper for recommending Argon2 parameters #723

Closed
aeneasr opened this issue Oct 1, 2020 · 3 comments · Fixed by #803
Closed

Write CLI helper for recommending Argon2 parameters #723

aeneasr opened this issue Oct 1, 2020 · 3 comments · Fixed by #803
Assignees
Labels
corp/m3 Up for M3 at Ory Corp. corp/m4 Up for M4 at Ory Corp. feat New feature or request. good first issue A good issue to tackle when being a novice to the project. help wanted We are looking for help on this one. package/cli Affects the CLI

Comments

@aeneasr
Copy link
Member

aeneasr commented Oct 1, 2020

Is your feature request related to a problem? Please describe.

See https://github.com/bburman/Twelve21.PasswordStorage

Additional context

#722
#647

@aeneasr aeneasr added feat New feature or request. help wanted We are looking for help on this one. good first issue A good issue to tackle when being a novice to the project. package/cli Affects the CLI corp/m3 Up for M3 at Ory Corp. labels Oct 1, 2020
@aeneasr aeneasr added this to the v0.6.0-alpha.1 milestone Oct 1, 2020
@zepatrik
Copy link
Member

zepatrik commented Oct 1, 2020

After reading https://www.twelve21.io/how-to-choose-the-right-parameters-for-argon2/ I think we could also add a "auto" mode where you configure the argon2 execution time and then kratos determines the right parameters on start. Setting the values manually should still be possible though.
The auto mode would basically find the highest amount of memory while requiring at least X (4?) iterations within the given execution time. What do you think?

@aeneasr
Copy link
Member Author

aeneasr commented Oct 1, 2020

I thought about that also, but one problem with that is that the process would take quite a while to start in order to compute the correct parameters. Maybe we simply enforce Argon2 configuration and if it is not set we show an error that explains what needs to be done?

@zepatrik
Copy link
Member

zepatrik commented Oct 1, 2020

I mean if you use the auto mode you should expect it to boot longer. But then the hardware doesn't change, so it would actually be better to determine it once and done.
My thought was that people might miss the cli helper...
What about printing the argon2 execution time on start? It would allow to check if the parameters are set correctly and we can have a hint there to use the cli to tune the parameters.

aeneasr pushed a commit that referenced this issue Nov 6, 2020
This patch adds the new command "hashers argon2 calibrate" which allows one to pick the desired hashing time for password hashing and then chooses the optimal parameters for the hardware the command is running on:

```
$ kratos hashers argon2 calibrate 500ms
Increasing memory to get over 500ms:
    took 2.846592732s in try 0
    took 6.006488824s in try 1
  took 4.42657975s with 4.00GB of memory
[...]
Decreasing iterations to get under 500ms:
    took 484.257775ms in try 0
    took 488.784192ms in try 1
  took 486.534204ms with 3 iterations
Settled on 3 iterations.

{
  "memory": 1048576,
  "iterations": 3,
  "parallelism": 32,
  "salt_length": 16,
  "key_length": 32
}
```

Closes #723
Closes #572
Closes #647
@aeneasr aeneasr added the corp/m4 Up for M4 at Ory Corp. label Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
corp/m3 Up for M3 at Ory Corp. corp/m4 Up for M4 at Ory Corp. feat New feature or request. good first issue A good issue to tackle when being a novice to the project. help wanted We are looking for help on this one. package/cli Affects the CLI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants