mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-01-26 16:16:31 -06:00
add strip_cert_header() to tasks.py
https://pagure.io/freeipa/issue/7687 Reviewed-By: Rob Crittenden <rcritten@redhat.com> Reviewed-By: Tibor Dudlak <tdudlak@redhat.com>
This commit is contained in:
parent
31a92c1677
commit
c29581c9a0
@ -1531,3 +1531,16 @@ def generate_ssh_keypair():
|
||||
|
||||
return (private_key_str, public_key_str)
|
||||
|
||||
|
||||
def strip_cert_header(pem):
|
||||
"""
|
||||
Remove the header and footer from a certificate.
|
||||
"""
|
||||
regexp = (
|
||||
r"^-----BEGIN CERTIFICATE-----(.*?)-----END CERTIFICATE-----"
|
||||
)
|
||||
s = re.search(regexp, pem, re.MULTILINE | re.DOTALL)
|
||||
if s is not None:
|
||||
return s.group(1)
|
||||
else:
|
||||
return pem
|
||||
|
Loading…
Reference in New Issue
Block a user