ccarney16 / pterodactyl-containers

Pterodactyl Panel within a docker container
230 stars 78 forks source link

panel v1.11.3 - Cannot make caddy use certificates #155

Open Kintull opened 11 months ago

Kintull commented 11 months ago

Hi, thanks for the great work making this repo.

I used the start guide, generated the cert and the key using certbot. I set variables SSL_CERT and SSL_CERT_KEY in panel.env. After I start panel, in logs I see

docker-compose logs -f panel
pterodactyl-panel-1    | [tls-config] Cannot find SSL certificate and/or key, not injecting tls rules.

I connected to the panel pod with /bin/sh checked that variables are set in the environment, executed the entry point tls-config helper and got this:

sh-5.1# ./entrypoint.d/20-tls-config.sh
[tls-config] Using external certificates. 

It means the code does see the varialbles. Any idea why it does not work for the panel starting procedure? Any tips on how to debug?

---- Update the problem happens when executing as caddy user

[root@ecee86afbe49 /]# runuser --user caddy ./entrypoint.d/20-tls-config.sh
[tls-config] Cannot find SSL certificate and/or key, not injecting tls rules.
Kintull commented 11 months ago

Found why this was happening - on the host machine after executing docker-compose run --rm --service-ports certbot certonly -d <domain>, created conf.d/letsencrypt/live and archive folders had 700 mode, after changing the mode to 755, caddy user could access the certificate files.

ccarney16 commented 11 months ago

Documentation will likely have to be updated in the future. I am actually going to be phasing out certbot in favor of using a reverse proxy. But I will have to look further into certbot as I have forgotten about the user permissions for it.