acmesh-official / acme.sh

A pure Unix shell script implementing ACME client protocol
https://acme.sh
GNU General Public License v3.0
38.8k stars 4.92k forks source link

After upgrade, acmedns forgets the update-server #3899

Open mibes-acmesh opened 2 years ago

mibes-acmesh commented 2 years ago

Steps to reproduce

The error is in the file dnsapi/dns_acmedns.sh on line 27/28, where the compatibility for the ACMEDNS_UPDATE_URL is missing.

27  #for compatiblity from account conf
28  ACMEDNS_USERNAME="${ACMEDNS_USERNAME:-$(_readaccountconf_mutable ACMEDNS_USERNAME)}"
29  _clearaccountconf_mutable ACMEDNS_USERNAME

I propose the following fix, which is UNTESTED, beware of typos etc., to be inserted betwen line 27 and 28

  ACMEDNS_TEMP="${ACMEDNS_UPDATE_URL:-$(_readaccountconf_mutable ACMEDNS_UPDATE_URL)}"
  _clearaccountconf_mutable ACMEDNS_UPDATE_URL
  if [ -n "$ACMEDNS_BASE_URL" ]; then
    ACMEDNS_BASE_URL=$(echo $ACMEDNS_TEMP | sed -e 's#/update##')
  fi

Just for the record, I don't see this code as copyrighted or so, use it as you like it.

Neilpang commented 2 years ago

sorry, I will fix it later.

mibes-acmesh commented 2 years ago

On the other hand, when I think about it once more, how would you set an initial alternative acme-dns server? Ideally you would set it once (i.e. in the account.conf), and use it then for the automatically created domains. But my proposed code would delete it from account.conf. It wouldn't be available for subsequent runs. Wouldn't it be better to modify the value (ACMEDNS_UPDATE_URL => ACMEDNS_BASE_URL) and save that in the account.conf for subsequent runs? It would then be used automatically for new subdomains/certificates...