Skip to content

security,sql: add a setting to constrain the minimum password length#51502

Merged
craig[bot] merged 2 commits intocockroachdb:masterfrom
knz:20200716-pwd-length2
Jul 17, 2020
Merged

security,sql: add a setting to constrain the minimum password length#51502
craig[bot] merged 2 commits intocockroachdb:masterfrom
knz:20200716-pwd-length2

Conversation

@knz
Copy link
Copy Markdown
Contributor

@knz knz commented Jul 16, 2020

Requested by @bdarnell.

First commit from #51501.

This change adds a new cluster setting
server.user_login.min_password_length. When set and non-zero, it
forces a minimum password length to passwords passed in cleartext to
the SQL WITH PASSWORD clause (CREATE/ALTER USER/ROLE).

This change is part of a larger set of security measures to help
the secure deployment of Cockroach Cloud. We are not yet planning
to advertise this to on-prem users until the feature matures and
is complemented by additional enhancements to password authentication.

cc @solongordon @thtruo @aaron-crl for visibility.

@knz knz requested a review from RichardJCai July 16, 2020 11:29
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@knz knz force-pushed the 20200716-pwd-length2 branch from 7396763 to 7a3d858 Compare July 16, 2020 13:35
Copy link
Copy Markdown
Contributor

@RichardJCai RichardJCai left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @knz and @RichardJCai)


pkg/security/password.go, line 84 at r2 (raw file):

// MinPasswordLength is the cluster setting that configures the
// minimum SQL password length.
var MinPasswordLength = settings.RegisterIntSetting(

I think RegisterNonNegativeIntSetting makes a little more sense here even though it doesn't actually change the behaviour. LGTM otherwise

This also removes some obsolete code, and ensures that the username
validity check is performed before the password validity check.

Release note: None
@knz knz force-pushed the 20200716-pwd-length2 branch from 7a3d858 to d5f1e63 Compare July 17, 2020 07:44
Copy link
Copy Markdown
Contributor Author

@knz knz left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @RichardJCai)


pkg/security/password.go, line 84 at r2 (raw file):

Previously, RichardJCai (Richard Cai) wrote…

I think RegisterNonNegativeIntSetting makes a little more sense here even though it doesn't actually change the behaviour. LGTM otherwise

Done.

@knz
Copy link
Copy Markdown
Contributor Author

knz commented Jul 17, 2020

bors r=RichardJCai

@knz
Copy link
Copy Markdown
Contributor Author

knz commented Jul 17, 2020

cc @joshimhoff for eventual deployment in CC

@knz
Copy link
Copy Markdown
Contributor Author

knz commented Jul 17, 2020

bors r-

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jul 17, 2020

Canceled

@knz
Copy link
Copy Markdown
Contributor Author

knz commented Jul 17, 2020

bors r=RichardJCai

@knz
Copy link
Copy Markdown
Contributor Author

knz commented Jul 17, 2020

bors r-

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jul 17, 2020

Canceled

Requested by @bdarnell.

This change adds a new cluster setting
`server.user_login.min_password_length`. When set and non-zero, it
forces a minimum password length to passwords passed in cleartext to
the SQL `WITH PASSWORD` clause (`CREATE/ALTER USER/ROLE`).

This change is part of a larger set of security measures to help
the secure deployment of Cockroach Cloud. We are not yet planning
to advertise this to on-prem users until the feature matures and
is complemented by additional enhancements to password authentication.

Release note: None
@knz knz force-pushed the 20200716-pwd-length2 branch from d5f1e63 to 8b0a637 Compare July 17, 2020 08:46
@knz
Copy link
Copy Markdown
Contributor Author

knz commented Jul 17, 2020

bors r=RichardJCai

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jul 17, 2020

Canceled (will resume)

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jul 17, 2020

Build succeeded

@craig craig bot merged commit 5149293 into cockroachdb:master Jul 17, 2020
@knz knz deleted the 20200716-pwd-length2 branch July 17, 2020 10:43
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.

4 participants