Skip to content

Commit 12adff2

Browse files
committed
Converge quorum member auth
The current code for authenticating to quorum members runs the auth command on every puppet run. This both updates the credentials on disk, and generates a puppet change event, which are btoh undesirable. The proposed change checks to ensure all quorum members have an auth token in the credentials file, and updates auth for all members if any one member is missing. This results in a convergent state. There is a caveat, in that what gets stored in the credentials file is not the original password, but an auth token. There does not seem to be a pcs command to check the tokens are still valid. So this code is only checking for presenence of auth tokens, not correctness. If the authentication token is later invalided, puppet will not correct this. It would be necessary to manually run the `pcs host auth` or `pcs cluster auth` commands to fix it. Fixes #500
1 parent 5f48a6c commit 12adff2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

manifests/init.pp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,12 +597,18 @@
597597
default => 'pcs host auth',
598598
}
599599

600+
# Check that all nodes have an authorization token
601+
$auth_check_command = $quorum_members.map |$node| {
602+
"grep '${node}' /var/lib/pcsd/tokens"
603+
}.join(' && ')
604+
600605
# Attempt to authorize all members. The command will return successfully
601606
# if they were already authenticated so it's safe to run every time this
602607
# is applied.
603608
# TODO - make it run only once
604609
exec { 'authorize_members':
605610
command => "${pcs_auth_command} ${node_string} ${auth_credential_string}",
611+
unless => $auth_check_command,
606612
path => $exec_path,
607613
require => [
608614
Service['pcsd'],

0 commit comments

Comments
 (0)