Skip to content
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

[bug]: SAN in Certificate for Service is incorrect #769

Open
YC opened this issue May 27, 2024 · 2 comments
Open

[bug]: SAN in Certificate for Service is incorrect #769

YC opened this issue May 27, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@YC
Copy link

YC commented May 27, 2024

Describe the bug

The first SAN in svc.pem does not seem to match name of service.

To reproduce

  1. In examples\WebhookOperator directory
  2. KubeOps.Cli.exe gen operator namepassedin --out config
  3. kubectl kustomize config/ -o combined.yaml
  4. The output is follows:
apiVersion: v1
kind: Service
metadata:
  labels:
    operator: namepassedin
  name: namepassedin-operator
  namespace: namepassedin-system
spec:
  ports:
  - name: https
    port: 443
    targetPort: https
  selector:
    operator: namepassedin
    operator-deployment: kubernetes-operator
  1. The certificate svc.pem, when viewed with openssl:
X509v3 Subject Alternative Name:
DNS:namepassedin.namepassedin-system.svc, DNS:*.namepassedin-system.svc, DNS:*.svc

Expected behavior

I believe the first SAN should be namepassedin-operator.namepassedin-system.svc.
Also, I wonder if the other 2 are needed?
I think the second should cover the first, and the third may not be needed?

Screenshots

No response

Additional Context

Reproduced in: v9.1.1

Relevant Code:
https://github.com/buehler/dotnet-operator-sdk/blob/v9.1.1/src/KubeOps.Cli/Commands/Generator/OperatorGenerator.cs#L82
https://github.com/buehler/dotnet-operator-sdk/blob/v9.1.1/src/KubeOps.Operator.Web/Certificates/CertificateGenerator.cs#L143-L145

@YC YC added the bug Something isn't working label May 27, 2024
@ian-buse
Copy link
Contributor

@buehler, I checked the old Bouncy Castle generator + CLI command, and it looks like this issue would have been in there too. I think there is an inconsistency between the default name in the kustomization after generation vs the one given to the certificates during generation.

@buehler
Copy link
Owner

buehler commented Jun 27, 2024

Hey @ian-buse and @YC

You are correct. This is an issue with the generated SAN. However the *.svc should actually cover the wrongly named one. Nonetheless it is an error and should be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants