niiknow / vestacp

Dockerized Vesta Control Panel aka vestacp
MIT License
148 stars 89 forks source link

Letsencrypt connections randomly fails #135

Open theFra985 opened 3 years ago

theFra985 commented 3 years ago

Hi, Thanks for the awesome project. I'm having trouble with the letsencrypt support. It seems like the curl requests fails randomly while issuing the certificate (while doing so with the web interface it crashes miserably). I tried adding -vvv to the v-add-letsencrypt-domain script to detect the issue and initially it seemed to be the lack of ipv6 support on the container network. After enabling it the first request (nonce request status) succeeded but the others randomly hangs and then fail (sometimes the acme/authz and some other the finalize). The request fails for timeout on port 443 or unreachable network e.g.

*   Trying 172.65.32.248...
*   Trying 2606:4700:60:0:f53d:5624:85c7:3a2c...
* connect to 2606:4700:60:0:f53d:5624:85c7:3a2c port 443 failed: Network is unreachable
*   Trying 172.65.32.248...
* connect to 172.65.32.248 port 443 failed: Connection timed out
* Failed to connect to acme-v02.api.letsencrypt.org port 443: Connection timed out
* Closing connection 0

It's very strange because those failed requests are immediately after successful ones to the same identical IP. I tried executing similar curl requests from the host and they succeed so I was wondering if it could depend on some image configuration. Any help is appreciated. Thanks in advance, Francesco

theFra985 commented 3 years ago

I "solved" the issue by editing the v-add-letsencrypt-domain and v-add-letsencrypt-user scripts to use acme.sh instead of the implemented LetsEncrypt calls. It works. Right now the attached edited scripts do not support aliases because I didn't need them at the moment but adding them should be as easy as splitting the $aliases variable into each alias and formatting the correct arguments to be passed to the acme.sh executable. Here are the scripts in case anyone needs them Scripts working on Vesta v0.9.8