Skip to content

Conversation

@thaJeztah
Copy link
Member

@thaJeztah thaJeztah commented Apr 23, 2025

Legacy PEM encryption as specified in RFC 1423 is insecure by design. Since
it does not authenticate the ciphertext, it is vulnerable to padding oracle
attacks that can let an attacker recover the plaintext

From https://go-review.googlesource.com/c/go/+/264159

It's unfortunate that we don't implement PKCS#8 encryption so we can't
recommend an alternative but PEM encryption is so broken that it's worth
deprecating outright.

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

@thaJeztah thaJeztah force-pushed the remove_encrypted_key_support branch 2 times, most recently from ec287d9 to a3779e8 Compare April 24, 2025 09:35
@thaJeztah thaJeztah marked this pull request as ready for review April 24, 2025 09:36
func IsErrEncryptedKey(err error) bool {
return errors.Is(err, x509.IncorrectPasswordError)
}
var errEncryptedKeyDeprecated = errors.New("private key is encrypted; support for encrypted private keys has been deprecated, see https://docs.docker.com/go/deprecated/")
Copy link
Contributor

Choose a reason for hiding this comment

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

Deprecated by Go, but no longer allowed here ... so, should the message say obsolete or unsupported instead of deprecated?

Copy link
Member Author

Choose a reason for hiding this comment

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

I was going back-and-forth a bit on the best error; initially I used the same one as we use in the CLI, which links to our docs.docker.com for the deprecation;

errors.New("private key is encrypted - support for encrypted private keys has been removed, see https://docs.docker.com/go/deprecated/")

But I wasn't sure if we wanted to keep this module a bit separate from "docker", so tried to keep it a bit more agnostic, therefore linked to the Go issue.

Let me try to update it

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh! LOL, just realised that I did include the link to docs.docker.com.

Either way; I tweaked the error, but better suggestions more than welcome!

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks good! Thank you.

> Legacy PEM encryption as specified in RFC 1423 is insecure by design. Since
> it does not authenticate the ciphertext, it is vulnerable to padding oracle
> attacks that can let an attacker recover the plaintext

From https://go-review.googlesource.com/c/go/+/264159

> It's unfortunate that we don't implement PKCS#8 encryption so we can't
> recommend an alternative but PEM encryption is so broken that it's worth
> deprecating outright.

This feature allowed using an encrypted private key with a supplied password,
but did not provide additional security as the encryption is known to be broken,
and the key is sitting next to the password in the filesystem. Users are recommended
to decrypt the private key, and store it un-encrypted to continue using it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah force-pushed the remove_encrypted_key_support branch from a3779e8 to bc33254 Compare April 24, 2025 10:52
@thaJeztah thaJeztah merged commit 1401877 into docker:master Apr 24, 2025
13 checks passed
@thaJeztah thaJeztah deleted the remove_encrypted_key_support branch April 24, 2025 11:04
@thaJeztah thaJeztah changed the title Remove support for encrypted TLS private keys tlsconfig: Remove support for encrypted TLS private keys Dec 5, 2025
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