Skip to content

Conversation

kbarber
Copy link
Contributor

@kbarber kbarber commented Aug 1, 2013

The postgresql::role defined type was not idempotent when passed cleartext
passwords. This is because we were comparing it with its md5 equivalent in
the db.

This patch converts any cleartext passwords to md5 before comparison, but
only if they are cleartext (ie. not starting with md5).

I also bumped the version of rspec-system-puppet to get use of the refresh
method, plus did some cleanup because the old tests were a bit dusty, again
taking advantage of refresh plus changing some matchers for clarity.

Signed-off-by: Ken Barber ken@bob.sh

…words

The postgresql::role defined type was not idempotent when passed cleartext
passwords. This is because we were comparing it with its md5 equivalent in
the db.

This patch converts any cleartext passwords to md5 before comparison, but
only if they are cleartext (ie. not starting with md5).

I also bumped the version of rspec-system-puppet to get use of the refresh
method, plus did some cleanup because the old tests were a bit dusty, again
taking advantage of refresh plus changing some matchers for clarity.

Signed-off-by: Ken Barber <ken@bob.sh>
@kbarber-jenkins-bot
Copy link

Merged build triggered. (Status: PENDING, Details: null)

@kbarber-jenkins-bot
Copy link

Merged build started. (Status: PENDING, Details: http://box.bob.sh:8080/job/puppetlabs-postgresql/185/)

@kbarber-jenkins-bot
Copy link

Merged build finished. (Status: SUCCESS, Details: http://box.bob.sh:8080/job/puppetlabs-postgresql/185/)

apenney pushed a commit that referenced this pull request Aug 1, 2013
…not-idempotent

(GH-216) Alter role call not idempotent with cleartext passwords
@apenney apenney merged commit a1b9728 into puppetlabs:master Aug 1, 2013
@lieutdan13
Copy link

@kbarber Thank you for fixing this. Your solution is far superior than the one I came up with in #223. I always forget about backwards compatibility. I tend to move forward when it comes to development.

@mlehner616
Copy link

@kbarber Yes thank you for hammering this out. I'm new to the puppet community but I hope I can soon dive in and contribute to this already amazing product and community.

@ashb
Copy link

ashb commented Aug 6, 2013

So this only works if login is true - a quick test on Pg 9.1 shows that replacing the table we examine from pg_shadow to pg_authid with different column names:

SELECT rolname FROM pg_authid WHERE rolname='${username}' and rolpassword='${pwd_hash_sql}'

Does the trick.

(Yes roles without login are of limited use, but Pg supports them.)

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

Successfully merging this pull request may close these issues.

6 participants