rancher: Add certificate error

Tried to add a certificate Got an error: Private Key is invalid. Please make sure it is a RSA key. Certificate is invalid.

The same key and the certificate added successfully in Rancher 1.6

Useful Info
Versions Rancher v2.0.0-beta4 UI: v2.0.38
Access local admin
Route authenticated.cluster.index

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 7
  • Comments: 27 (5 by maintainers)

Most upvoted comments

API does also not work for us:

{
"actions": { },
"baseType": "error",
"code": "InvalidBodyContent",
"fieldName": "certs",
"links": { },
"message": "failed to read private key: asn1: structure error: tags don't match (2 vs {class:0 tag:16 length:13 isCompound:true}) {optional:false explicit:false application:false defaultValue:<nil> tag:<nil> stringType:0 timeType:0 set:false omitEmpty:false}  @5",
"status": 422,
"type": "error"
}

After some investigation I saw the manual created tls certs have \n and the api replaces that with \r\n. Are those line feeds supported or maybe the problem?

Endpoint used:

/v3/projects/c-xzxpx:project-xxwcb/certificates

Same issue here.

Rancher v.2.0.0 UI v2.0.41

It’s broken in 2.0.0, I broke all validation in the UI instead of adding elliptical curve support. Will be fixed in the first patch release.

You can go to the API in your browser and add it if you need one now:

  • Click “view in API” action on the project
  • Click certificates or namespacedCertificates link
  • Click “Create” button
  • Click the sideways <-> icons for multi-line input
  • Paste in cert and keys, choose namespace if applicable
  • Click “Show request”
  • Click “Send request”

Same issue here. Key starts with: -----BEGIN RSA PRIVATE KEY-----

Rancher v2.0.0
User Interface v2.0.41

openssl rsa -in key.pem -out newkey.pem to convert keys starting with ----- BEGIN PRIVATE KEY ----- (PKCS#8) to keys starting with ----- BEGIN RSA PRIVATE KEY -----.