ctrlaltcoop / certbot-dns-hetzner

Certbot plugin enabling dns-01 challenge on the Hetzner DNS API
Other
155 stars 24 forks source link

Cert not renewed due to dependence on cwd #21

Closed zefir-git closed 1 month ago

zefir-git commented 1 year ago

It appears that when renewing the certificate, this plugin attempts to use the credentials file as if it was in the same dir where the command was first executed. This causes auto renew to fail with File not found: credentials.ini since the cwd is different/not set.

Please update this so that the absolute file path is used, instead of the one provided in the initial create cert command, which can be a relative path. In bash this is achieved with:

$ realpath credentials.ini
/root/credentials.ini
jaeh commented 1 year ago

does this mean that using an absolute path for the file will prevent the renew from erroring?

zefir-git commented 1 year ago

does this mean that using an absolute path for the file will prevent the renew from erroring?

I do not use this anymore, but I believe yes.

fupduck commented 1 month ago

The plugin uses _configure_credentials of certbot itself.
In the docs it says: Always stores absolute paths to avoid issues during renewal.

Does the error still exist? :thinking:

fupduck commented 1 month ago

closing for now plz reopen if more info present

zefir-git commented 1 month ago

Works correctly when an absolute path is used. It might be a good idea to mention this in the docs or perhaps use realpath(3) to ensure absolute paths are always used

fupduck commented 1 month ago

@zefir-git thanks for the info. The path should be absolute - as _configure_credentials is used which in turn uses _configure_file which uses os.path.abspath. Really confusing.

Will put an info into the README anyhow.