gravitational / teleport

The easiest, and most secure way to access and protect all of your infrastructure.
https://goteleport.com
GNU Affero General Public License v3.0
17.37k stars 1.74k forks source link

SAML connector no longer gracefully handles PKCS8 `assertion_key_pair` in `RSA PRIVATE KEY` PEM block #46710

Closed strideynet closed 3 days ago

strideynet commented 3 days ago

Prior to https://github.com/gravitational/teleport/pull/43381, we would gracefully handle cases where a PKCS8 encoded private key was within a RSA PRIVATE KEY (which usually indicates PKCS1) PEM block.

After this PR, the following error will be encountered

 failed to parse certificate or private key defined in assertion_key_pair\n\tx509: failed to parse private key (use ParsePKCS8PrivateKey instead for this key format)

We probably ought to re-instate the old retry behaviour as this could cause customers to be locked out of their clusters upon an upgrade.

As to why a PKCS8 key is inside what is usually the PKCS1 header, I'm unsure. Some threads across the internet seem to suggest that this was potentially a bug/behaviour of the openssl CLI for some time (https://superuser.com/questions/606215/openssl-pkcs8-default-format-gives-rsa-private-key)

Workaround:

strideynet commented 3 days ago

CC @nklaassen