New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support EC TLS secrets #58227

Closed
arno01 opened this Issue Jan 12, 2018 · 3 comments

Comments

Projects
None yet
4 participants
@arno01

arno01 commented Jan 12, 2018

It appears that EC keys are not supported when attempting to create a TLS secret using kubectl command.

Tested with kuberenetes (server side and the CLI side): v1.9.1

$ TMPHOST=some.test.website.com
$ openssl req -x509 -sha256 -nodes -newkey ec:<(openssl ecparam -name secp256k1) -keyout tls.key -out tls.crt -days 3650 -subj "/O=${TMPHOST}/CN=${TMPHOST}"
Generating a 256 bit EC private key
writing new private key to 'tls.key'
-----

$ kubectl -n drone create secret tls my-ec-tls --cert=tls.crt --key=tls.key
error: failed to load key pair tls: failed to parse private key
@arno01

This comment has been minimized.

Show comment
Hide comment
@arno01

arno01 Jan 12, 2018

/sig cli

arno01 commented Jan 12, 2018

/sig cli

@k8s-ci-robot k8s-ci-robot added sig/cli and removed needs-sig labels Jan 12, 2018

@mikedanese mikedanese added the sig/auth label Jan 12, 2018

@liggitt

This comment has been minimized.

Show comment
Hide comment
@liggitt

liggitt Jan 15, 2018

Member

it actually does support EC keys, go just doesn't support that particular curve, apparently.

https://play.golang.org/p/FQE9bt76mQk

openssl req -x509 -sha256 -nodes -newkey ec:<(openssl ecparam -name prime256v1) \
  -keyout tls.key \
  -out tls.crt -days 3650 -subj "/O=${TMPHOST}/CN=${TMPHOST}"

kubectl -n drone create secret tls my-ec-tls --cert=tls.crt --key=tls.key --dry-run --output=json

{
    "kind": "Secret",
    "apiVersion": "v1",
    "metadata": {
        "name": "my-ec-tls",
        "namespace": "drone",
        "creationTimestamp": null
    },
    "data": {
        "tls.crt": "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJiekNDQVJZQ0NRQ0V3TENLa0kzZUJUQUtCZ2dxaGtqT1BRUURBakJBTVI0d0hBWURWUVFLREJWemIyMWwKTG5SbGMzUXVkMlZpYzJsMFpTNWpiMjB4SGpBY0JnTlZCQU1NRlhOdmJXVXVkR1Z6ZEM1M1pXSnphWFJsTG1OdgpiVEFlRncweE9EQXhNVFV3T0RBek1EaGFGdzB5T0RBeE1UTXdPREF6TURoYU1FQXhIakFjQmdOVkJBb01GWE52CmJXVXVkR1Z6ZEM1M1pXSnphWFJsTG1OdmJURWVNQndHQTFVRUF3d1ZjMjl0WlM1MFpYTjBMbmRsWW5OcGRHVXUKWTI5dE1Ga3dFd1lIS29aSXpqMENBUVlJS29aSXpqMERBUWNEUWdBRTdEL1ZHUGVpVEZlOUNrRjdsbUpTMXhnVwpqNmRHRjdGQStOZ0FUYjBkV1B0eW1EdGk0MTdkYnIxNUUxV2RVMXIwMGtYNXFuWnlLOXNJOUJhcmQxUithekFLCkJnZ3Foa2pPUFFRREFnTkhBREJFQWlBdVdCcWxkVWN0T3c1eFVQc0d5eHpXdUM0cTZMdUFjWHQweEVTS0Rha1EKdEFJZ2QxYWU4eld0WkhEZHd3V0VPWFdaMEErRmh5cjBpMUowN0RKdExzVWJXNXM9Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K",
        "tls.key": "LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1JR0hBZ0VBTUJNR0J5cUdTTTQ5QWdFR0NDcUdTTTQ5QXdFSEJHMHdhd0lCQVFRZzJ2Z1NUYzl4NXFCWVp4d00KK044MHNtdklQOGpWdUYzOWdPRzl6NU41N1I2aFJBTkNBQVRzUDlVWTk2Sk1WNzBLUVh1V1lsTFhHQmFQcDBZWApzVUQ0MkFCTnZSMVkrM0tZTzJMalh0MXV2WGtUVloxVFd2VFNSZm1xZG5JcjJ3ajBGcXQzVkg1cgotLS0tLUVORCBQUklWQVRFIEtFWS0tLS0tCg=="
    },
    "type": "kubernetes.io/tls"
}
Member

liggitt commented Jan 15, 2018

it actually does support EC keys, go just doesn't support that particular curve, apparently.

https://play.golang.org/p/FQE9bt76mQk

openssl req -x509 -sha256 -nodes -newkey ec:<(openssl ecparam -name prime256v1) \
  -keyout tls.key \
  -out tls.crt -days 3650 -subj "/O=${TMPHOST}/CN=${TMPHOST}"

kubectl -n drone create secret tls my-ec-tls --cert=tls.crt --key=tls.key --dry-run --output=json

{
    "kind": "Secret",
    "apiVersion": "v1",
    "metadata": {
        "name": "my-ec-tls",
        "namespace": "drone",
        "creationTimestamp": null
    },
    "data": {
        "tls.crt": "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJiekNDQVJZQ0NRQ0V3TENLa0kzZUJUQUtCZ2dxaGtqT1BRUURBakJBTVI0d0hBWURWUVFLREJWemIyMWwKTG5SbGMzUXVkMlZpYzJsMFpTNWpiMjB4SGpBY0JnTlZCQU1NRlhOdmJXVXVkR1Z6ZEM1M1pXSnphWFJsTG1OdgpiVEFlRncweE9EQXhNVFV3T0RBek1EaGFGdzB5T0RBeE1UTXdPREF6TURoYU1FQXhIakFjQmdOVkJBb01GWE52CmJXVXVkR1Z6ZEM1M1pXSnphWFJsTG1OdmJURWVNQndHQTFVRUF3d1ZjMjl0WlM1MFpYTjBMbmRsWW5OcGRHVXUKWTI5dE1Ga3dFd1lIS29aSXpqMENBUVlJS29aSXpqMERBUWNEUWdBRTdEL1ZHUGVpVEZlOUNrRjdsbUpTMXhnVwpqNmRHRjdGQStOZ0FUYjBkV1B0eW1EdGk0MTdkYnIxNUUxV2RVMXIwMGtYNXFuWnlLOXNJOUJhcmQxUithekFLCkJnZ3Foa2pPUFFRREFnTkhBREJFQWlBdVdCcWxkVWN0T3c1eFVQc0d5eHpXdUM0cTZMdUFjWHQweEVTS0Rha1EKdEFJZ2QxYWU4eld0WkhEZHd3V0VPWFdaMEErRmh5cjBpMUowN0RKdExzVWJXNXM9Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K",
        "tls.key": "LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1JR0hBZ0VBTUJNR0J5cUdTTTQ5QWdFR0NDcUdTTTQ5QXdFSEJHMHdhd0lCQVFRZzJ2Z1NUYzl4NXFCWVp4d00KK044MHNtdklQOGpWdUYzOWdPRzl6NU41N1I2aFJBTkNBQVRzUDlVWTk2Sk1WNzBLUVh1V1lsTFhHQmFQcDBZWApzVUQ0MkFCTnZSMVkrM0tZTzJMalh0MXV2WGtUVloxVFd2VFNSZm1xZG5JcjJ3ajBGcXQzVkg1cgotLS0tLUVORCBQUklWQVRFIEtFWS0tLS0tCg=="
    },
    "type": "kubernetes.io/tls"
}
@liggitt

This comment has been minimized.

Show comment
Hide comment
@liggitt

liggitt Jan 16, 2018

Member

/close

Member

liggitt commented Jan 16, 2018

/close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment