alxwolf / ubios-cert

Manage SSL / TLS certificates with acme.sh (Let's Encrypt, ZeroSSL) for Ubiquiti UbiOS firmwares
MIT License
170 stars 20 forks source link

Issue with wildcard domains #35

Closed mojo333 closed 1 year ago

mojo333 commented 1 year ago

I'm using the Cloudflare API method which works fine when issuing the cert from LetsEncrypt however it stores the the files under the wildcard name including the asterisk - see below (I've replaced my real domain name):

[Sat Dec 17 14:34:20 GMT 2022] Your cert is in: /data/ubios-cert/acme.sh/*.test.abc/*.test.abc.cer
[Sat Dec 17 14:34:20 GMT 2022] Your cert key is in: /data/ubios-cert/acme.sh/*.test.abc/*.test.abc.key
[Sat Dec 17 14:34:20 GMT 2022] The intermediate CA cert is in: /data/ubios-cert/acme.sh/*.test.abc/ca.cer
[Sat Dec 17 14:34:20 GMT 2022] And the full chain certs is there: /data/ubios-cert/acme.sh/*.test.abc/fullchain.cer
New certificate was generated, time to deploy it
cp: cannot stat '/data/ubios-cert/acme.sh/_.test.abc/fullchain.cer': No such file or directory
cp: cannot stat '/data/ubios-cert/acme.sh/_.test.abc/fullchain.cer': No such file or directory
cp: cannot stat '/data/ubios-cert/acme.sh/_.test.abc/_.test.abc.key': No such file or directory
cp: cannot stat '/data/ubios-cert/acme.sh/_.test.abc/_.test.abc.key': No such file or directory

The copy fails because of this line of code in ubios-cert.sh. Not sure if this is a hang over from a previous way acme.sh used to work?

# Re-write CERT_NAME if it is a wildcard cert. Replace '*' with '_'
ACME_CERT_NAME=$(echo "${CERT_NAME}" | sed -r 's/\*/_/g')

Changing it to the following resolves the issue: ACME_CERT_NAME="${CERT_NAME}"

alxwolf commented 1 year ago

there seems to be a bit more weird so I'll have to take a closer look at it