Skip to content

Don't update password encrypted with SCRAM-SHA-256 if not changed #1132

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

Closed
wants to merge 1 commit into from

Conversation

Bouke
Copy link

@Bouke Bouke commented Jan 14, 2020

Currently we're seeing a lot of spurious updates to a user, when the given password_hash is encrypted with SCRAM-SHA-256. For more information about the format, see pg_authid.

@Bouke Bouke requested a review from a team as a code owner January 14, 2020 08:45
@puppet-community-rangefinder
Copy link

postgresql::server::role is a type

The enclosing module is declared in 50 of 578 indexed public Puppetfiles.

Breaking changes to this file WILL impact these modules (exact match):

Breaking changes to this file MAY impact these modules (near match):


These results were generated with Rangefinder, a tool that helps predict the downstream impact of breaking changes to elements used in Puppet modules. You can run this on the command line to get a full report.

Exact matches are those that we can positively identify via namespace and the declaring modules' metadata. Non-namespaced items, such as Puppet 3.x functions, will always be reported as near matches only.

@carabasdaniel
Copy link
Contributor

Hi @Bouke

Thanks for submitting this PR. Could you please provide a test for this functionality ?

@Bouke
Copy link
Author

Bouke commented Feb 26, 2020

@carabasdaniel I'm not familiar with writing tests, but if you can provide me with some pointers for existing test that I can extend, I'd be happy to. Is there a similar unit test for the MD5 case?

@daianamezdrea
Copy link
Contributor

Hi @Bouke, you can find acceptance tests here: puppetlabs-postgresql/spec/acceptance/server
and unit tests: puppetlabs-postgresql/spec/unit/defines/server. Let me know if you need help!

@michaeltlombardi
Copy link
Contributor

Hi, @Bouke!

It looks like this pull request hasn't seen any activity in a while. Is this something that you're still able to work on? We're happy to keep this pull request open if there's forward movement, and we'll leave it open for another two weeks from now. If there isn't any activity by then we may have to close this pull request due to lack of activity.

Closing the pull request wouldn't mean we don't consider this change valuable. However we try to keep all open pull requests moving towards completion, and closing stale pull requests help us focus on more active pull requests.

If you have any questions or concerns, please don't hesitate to ping us in the Slack channel on slack.puppet.com.

@Bouke
Copy link
Author

Bouke commented Jul 3, 2020

Hi @daianamezdrea @michaeltlombardi, thank you for your feedback. It's indeed the case that there hasn't been any additional progress on this PR. I've tried working on this thing for a few times now, but I am getting nowhere with the tests.

It's a trivial change that adds scram-sha-256 in the same way that md5 is whitelisted. I've looked at the existing tests, and they don't cover any of the flow that I'm making changes. So what you're asking of me is to create a unit test not only for my changes, but something of a much bigger scope.

Looking at the role spec, it looks like an unsupported version of postgres (9.1) is being used for the tests, which doesn't even support the scram-sha-256 password hashing. So to be able to run the tests, I would also have to upgrade the test definitions to target some newer version of postgresql.

I'm sorry but if that's what you're asking of me, feel free to close this PR.

@daianamezdrea
Copy link
Contributor

Hi @Bouke, yes, I understand your concerns. After a short discussion with the team, we decided that we are going to update our tests and I'll open a ticket for the new changes. Also, when the things are ready, could you please rebase your PR and add your tests? Thank you, cheers !

@david22swan david22swan changed the base branch from master to main August 11, 2020 16:53
@david22swan
Copy link
Member

@Bouke
Making a quick change to point your PR at the newly default main branch.
Apologies if this is inconvenient in any way.

@sanfrancrisko
Copy link
Contributor

Hi @Bouke, yes, I understand your concerns. After a short discussion with the team, we decided that we are going to update our tests and I'll open a ticket for the new changes. Also, when the things are ready, could you please rebase your PR and add your tests? Thank you, cheers !

Raised IAC-1063

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@jplindquist
Copy link

Is there any update or progress on this? Postgres 14 dropped recently which now defaults to scram-sha-256

Change the default of the password_encryption server parameter to scram-sha-256 (Peter Eisentraut)

Previously it was md5. All new passwords will be stored as SHA256 unless this server setting is changed or the password is specified in MD5 format. Also, the legacy (and undocumented) Boolean-like values which were previously synonyms for md5 are no longer accepted.

@vaol
Copy link
Contributor

vaol commented Oct 8, 2021

Hello, I believe config.pp should be adjusted as well to create the pg_hba default rule with scram-sha-256 accordingly.
$password_encryption is already given as parameter in the class.

@fe80 fe80 mentioned this pull request Nov 29, 2021
@kenyon
Copy link
Contributor

kenyon commented Feb 3, 2022

This can be closed, done in #1313.

@ekohl ekohl closed this Feb 3, 2022
@Neustradamus
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.