8000 Validation of a pem-formatted key in the pfsense_cert module · Issue #174 · pfsensible/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Validation of a pem-formatted key in the pfsense_cert module #174
Open
@terseran

Description

@terseran

Thank you for this great job!

If the playbook uses an RSA key in pem-format, it passes validation normally at this point:
If re.match('^-----BEGIN ((EC|RSA) )?PRIVATE KEY-----$', lines[0]) and re.match'^-----END ((EC|RSA) )?PRIVATE KEY-----$', lines[-1]):

But if this key is encoded in base 64, it will not pass validation here:
elif not re.match('LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0t', key):

If we encode -----BEGIN PRIVATE KEY----- in base64, we get LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0t, which is what the validation says
But if we encode -----BEGIN RSA PRIVATE KEY-----, we get LS0tLS1CRUdJTiBSU0EgUFJJJVkFURSBLRVktLS0tLQ==, and at this point the playbook crashes into an error:
fatal: [GW1]: FAILED! => { “changed”: false, “msg”: “Could not recognize key format: ********”}

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0