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

Add TLS support for Pacemaker Remote connections #3759

Merged
merged 8 commits into from
Dec 10, 2024

Conversation

clumens
Copy link
Contributor

@clumens clumens commented Dec 10, 2024

Tested:

  • Still works without certs
  • If certs are enabled on the server but not the client, falling back to PSK keys is not allowed
  • Moving a Pacemaker Remote resource from a node with a cert to one without does not work (the cluster does not like this happening, but removing the constraint will cause the resource to move back to the node with the cert)
  • Moving a Pacemaker Remote resource from a nod with a cert to one with its own cert does work

I did not explicitly test expirations or CRLs, but it's the exact same code as on the remote CIB connections and both worked there so I have no reason to think they wouldn't work here.

For Pacemaker Remote connections, both ends are daemons and will
therefore read the TLS environment variables out of the sysconfig file.
However, one end is a client and one end is a server.  So using that to
decide where to read the variables is not helpful.

Instead, just try both locations regardless of which end of the
connection we're checking.  If the PCMK_ version of a variable isn't
set, try the CIB_ version instead.
This fixes a double free that can happen in the Pacemaker Remote code
paths but that didn't turn up in the remote CIB testing.
If the right environment variables are set in the sysconfig file,
enable TLS certificates on the server side of a Pacemaker Remote node
connection.  This works exactly like the remote CIB operation support
did, except here the remote node is the server and the cluster is the
client.  Name your certs appropriately.

Ref T365
If the right environment variables are set in the sysconfig file,
enable TLS certificates on the client (cluster) side of a Pacemaker
Remote node connection.

Because we have both sync and async versions of everything, this has to
be done in two different places.

Fix T365
Copy link
Contributor

@kgaillot kgaillot left a comment

Choose a reason for hiding this comment

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

looking good

I think pcmk__new_tls_session() can now add ANON/PSK only when needed

etc/sysconfig/pacemaker.in Outdated Show resolved Hide resolved
etc/sysconfig/pacemaker.in Outdated Show resolved Hide resolved
etc/sysconfig/pacemaker.in Outdated Show resolved Hide resolved
etc/sysconfig/pacemaker.in Outdated Show resolved Hide resolved
Move the authorization key settings below the X509 settings to
de-emphasize them, and mention the preference for using X509
certificates in the comment block.
If we're not setting up a TLS connection that uses anon credentials,
don't add the anon priority.  Similarly, only add the PSK priorities if
we're setting up a TLS connection that uses PSK credentials.
@kgaillot kgaillot merged commit 2dd4c51 into ClusterLabs:main Dec 10, 2024
1 check passed
@kgaillot
Copy link
Contributor

I think the testing has been sufficient enough to backport this to 3.0

@clumens clumens deleted the remote-tls branch December 11, 2024 15:39
- The location of a file containing trusted Certificate Authorities, used to
verify client or server certificates. This file must be in PEM format and
must be readable by Pacemaker daemons (that is, it must allow read permissions
to either the |CRM_DAEMON_USER| user or the |CRM_DAEMON_GROUP| group).
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this correct? The controller and executor both run as root, and I don't think any other daemons need access

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.

2 participants