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

Traefik certs_config.yaml is hard coded to one site name? #16

Closed
jermdavis opened this issue Aug 7, 2020 · 2 comments · Fixed by #19
Closed

Traefik certs_config.yaml is hard coded to one site name? #16

jermdavis opened this issue Aug 7, 2020 · 2 comments · Fixed by #19

Comments

@jermdavis
Copy link

Think I've spotted an issue here - but apologies in advance if this is just me not understanding something.

I've cloned the repo and made some tweaks to simplify it to my needs (just want an XM0 instance, no need for the custom solution container) and I seemed to have it all working. Until I changed my site's name from the default of "dockerexamples" to something else.

I deleted the certs files generated in docker\traefik\certs and re-ran init.ps1 with my new value for $HostName. It completes without error, but when I start my containers I now get browser "site is not secure" errors, as it no longer likes the certificate.

Poking about, to try and work out why, I realise that certs_config.yaml is hard coded to assume the certificate files are named with "dockerexamples" (e.g. _wildcard.dockerexamples.localhost.pem) but init.ps1 has now generated cert files that have my new site name in them:

image

If I manually fix the certs_config.yaml file then it seems to start working again. So should the init script generate the certs config file too, perhaps? Or is there a better way of parameterising that file?

@vtml
Copy link

vtml commented Aug 7, 2020

This is an issue. I think the ultimate correct fix is to look at the Sitecore Docker Tools, and take the same inspiration as the Powershell Script / Module that changes the .env files with the specified values, but changes the certs_config.yaml instead.

@ambrauer
Copy link

Agree, this is an issue. I think the best solution is probably to just take the hostname out of the equation? mkcert has options to speficy the file names. So...

In init.ps1:

& $mkcert -key-file key.pem -cert-file cert.pem "*.$($HostName).localhost"

and certs_config.yaml becomes:

tls:
  certificates:
    - certFile: C:\etc\traefik\certs\cert.pem
      keyFile: C:\etc\traefik\certs\key.pem

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 a pull request may close this issue.

3 participants