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

Certificate is not valid, Common Name (CN) TRAEFIK DEFAULT CERT #667

Closed
dorianmariecom opened this issue Feb 2, 2024 · 10 comments
Closed

Comments

@dorianmariecom
Copy link
Contributor

dorianmariecom commented Feb 2, 2024

Solution

rm -rf /letsencrypt && mkdir /letsencrypt && touch /letsencrypt/acme.json && chmod 600 /letsencrypt/acme.json

I'm trying to get SSL to work on https://code.dorianmarie.com

I'm getting Common Name (CN) TRAEFIK DEFAULT CERT

I'm using this config/deploy.yml:

service: code
image: dorianmariefr/code
servers:
  web:
    hosts:
      - 165.232.149.13
    labels:
      traefik.http.routers.blog.entrypoints: websecure
      traefik.http.routers.blog.rule: Host(`code.dorianmarie.com`)
      traefik.http.routers.blog.tls.certresolver: letsencrypt

registry:
  username: dorianmariefr
  password:
    - KAMAL_REGISTRY_PASSWORD
env:
  secret:
    - RAILS_MASTER_KEY
traefik:
  options:
    publish:
      - "443:443"
    volume:
      - "/letsencrypt/acme.json:/letsencrypt/acme.json"
  args:
    entryPoints.web.address: ":80"
    entryPoints.websecure.address: ":443"
    entryPoints.web.http.redirections.entryPoint.to: websecure
    entryPoints.web.http.redirections.entryPoint.scheme: https
    entryPoints.web.http.redirections.entrypoint.permanent: true
    certificatesResolvers.letsencrypt.acme.email: "dorian@dorianmarie.fr"
    certificatesResolvers.letsencrypt.acme.storage: "/letsencrypt/acme.json"
    certificatesResolvers.letsencrypt.acme.httpchallenge: true
    certificatesResolvers.letsencrypt.acme.httpchallenge.entrypoint: web

Screenshot 2024-02-02 at 16 39 18

Screenshot 2024-02-02 at 16 39 22

@ifurther
Copy link

ifurther commented Feb 5, 2024

Maybe use log.level=DEBUG to debug

@dorianmariecom
Copy link
Contributor Author

I fetched the logs from the container and I got:

msg="The ACME resolver \"letsencrypt\" is skipped from the resolvers list because: unable to get ACME account: permissions 755 for /letsencrypt/acme.json are too open, please use 600

@dorianmariecom
Copy link
Contributor Author

dorianmariecom commented Feb 6, 2024

I think the fix is chmod -R 600 /letsencrypt/

I also needed to do rm -r /letsencrypt/acme.json/ and touch /letsencrypt/acme.json then chmod 600 /letsencrypt/acme.json

traefik/traefik-helm-chart#164

@dorianmariecom
Copy link
Contributor Author

I think this should be handled by kamal

@dorianmariecom
Copy link
Contributor Author

A useful command:

docker logs traefik | grep level=error

@gioggiExtendi
Copy link

show your /letsencrypt/acme.json i think is that your problem

@dorianmariecom
Copy link
Contributor Author

/letsencrypt/acme.json was using the wrong permissions and it was a directory

@luizkowalski
Copy link

The way I solved this was by using a Terraform script to automate server setup and write this file during bootstrap and set the permissions

I agree that this should be handled by Kamal

@morgoth
Copy link
Contributor

morgoth commented Feb 26, 2024

Refers to basecamp/kamal-site#41

@djmb djmb closed this as completed Mar 6, 2024
@dorianmariecom
Copy link
Contributor Author

dorianmariecom commented Mar 21, 2024

Because I come to this issue often:

rm -rf /letsencrypt && mkdir /letsencrypt && touch /letsencrypt/acme.json && chmod 600 /letsencrypt/acme.json

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

No branches or pull requests

6 participants