sources/ostree: pull from remote using rhsm mTLS certs

The consumer certs are used to uniquely identify a system against
candlepin. These consumer certs can be used to identify the system when
pulling from RH controlled ostree repositories.
This commit is contained in:
Sanne Raymaekers 2022-10-10 16:18:56 +02:00 committed by Christian Kellner
parent 1c81d1e966
commit fcaad0462a
2 changed files with 36 additions and 3 deletions

View file

@ -38,6 +38,20 @@ class Subscriptions:
raise RuntimeError("no matching rhsm key and cert")
@staticmethod
def get_consumer_secrets():
"""Returns the consumer identity certificate which uniquely identifies the system"""
key = "/etc/pki/consumer/cert.pem"
cert = "/etc/pki/consumer/key.pem"
if not (os.path.exists(key) and os.path.exists(cert)):
raise RuntimeError("rhsm consumer key and cert not found")
return {
'consumer_key': key,
'consumer_cert': cert
}
@classmethod
def from_host_system(cls):
"""Read redhat.repo file and process the list of repositories in there."""