outroll / vesta

VESTA Control Panel
http://vestacp.com
GNU General Public License v3.0
2.92k stars 1.02k forks source link

Cron job v-update-letsencrypt-ssl returns Error: domain alias subdomain.example.com doesn't exist #1895

Open yapsr opened 5 years ago

yapsr commented 5 years ago

Operating System (OS/VERSION):

ubuntu 16.04 LTS

VestaCP Version:

0.9.8-24

Installed Software (what you got with the installer):

apache, php, mysql

Steps to Reproduce:

Create domain example.com, with alias subdomain.example.com and Lets Encrypt SSL support option enabled. Remove this alias subdomain.example.com from domain example.com in VestaCP Create a new separate domain in VestaCP for subdomain.example.com with Lets Encrypt SSL support. Run v-update-letsencrypt-ssl

Possible causes:

As far as I can see, when updating the letsencrypt certificates with v-update-letsencrypt-ssl, this script looks for possible information in the current letsencrypt certificates and runs v-add-letsencrypt-domain $user example.com subdomain.example.com for every current certificate, but in this case one alias was moved to a separate domain, so v-add-letsencrypt-domain could not find the old alias in the aliases of that particular domain anymore and returns the error "Error: domain alias subdomain.example doesn't exist".

It would be useful if v-update-letsencrypt-ssl would add "for domain example.com" to the error message.

Workaround solution

In this case I resolved the problem by disabling and enabling the Lets Encrypt SSL support option for the domain example.com manually in the control panel. This resets the actual alias information for the Lets Encrypt SSL support.

Possible solutions

It would be even better if VestaCP would update and refresh the letsencrypt certificates automatically when domain aliases change.

victor-vanherpt commented 5 years ago

I think for the main problem, this issue is the same as https://github.com/serghey-rodin/vesta/issues/1809 (Duplicate issue?).

I also think this is fixed by the following commit: https://github.com/serghey-rodin/vesta/commit/d563dcd12b6ae90739e45fc512cbac51771e225c#diff-8f27b20d0219fb355aadd60724e65ad2

fsoyer commented 4 years ago

Hi staff, I'd this issue yesterday. I had a domain with 3 aliases, with valid L'E certificate. At a moment I deleted one of the aliases. When renewing cert, the cron job says that the deleted alias doesn't exist, because it looks for the alias names in the old crt file. Disabling ssl on the domain, then re-enabling it resetted the certs and resolved the issue. But you must maybe handle the alias deletion, by comparing with the actual user datas ? Thx for your work.