ctrlaltcoop / certbot-dns-hetzner

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

How to install plugin using snap #12

Closed chludwig closed 1 year ago

chludwig commented 3 years ago

How can I install this excellent plugin using snap?

I Installed certbot on a fresh Ubuntu 18 installation with sudo snap install --classic certbot. Then I tried to install your plugin with snap install certbot-dns-hetzner, but it could not be found.

So I tried an installation with pip, what seemed to succeed in first place - certbot plugins listed dns-hetzner - but when trying to generate a cert I'll get error messages like 'The requested certbot-dns-hetzner plugin does not appear to be installed'.

Here is my own answer to my question on how to do the installation on StackOverflow (I was too fast posting it, I was happy to see the plugin in certbot plugins)

So what am I doing wrong?

Here are my Commands I am running without success. Ore are these all wrong?

root@my-server:~# certbot plugins
Saving debug log to /var/log/letsencrypt/letsencrypt.log

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* apache
Description: Apache Web Server plugin
Interfaces: IAuthenticator, IInstaller, IPlugin
Entry point: apache = certbot_apache._internal.entrypoint:ENTRYPOINT

* dns-hetzner
Description: Obtain certificates using a DNS TXT record (if you are using
Hetzner for DNS).
Interfaces: IAuthenticator, IPlugin
Entry point: dns-hetzner = certbot_dns_hetzner.dns_hetzner:Authenticator

* nginx
Description: Nginx Web Server plugin
Interfaces: IAuthenticator, IInstaller, IPlugin
Entry point: nginx = certbot_nginx._internal.configurator:NginxConfigurator

* standalone
Description: Spin up a temporary webserver
Interfaces: IAuthenticator, IPlugin
Entry point: standalone = certbot._internal.plugins.standalone:Authenticator

* webroot
Description: Place files in webroot directory
Interfaces: IAuthenticator, IPlugin
Entry point: webroot = certbot._internal.plugins.webroot:Authenticator
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

root@my-server:~# certbot certonly --authenticator dns-hetzner -d "my-server.domain.me" --dns-hetzner-credentials /root/my-cert.ini
usage:
  certbot [SUBCOMMAND] [options] [-d DOMAIN] [-d DOMAIN] ...

Certbot can obtain and install HTTPS/TLS/SSL certificates.  By default,
it will attempt to use a webserver both for obtaining and installing the
certificate.
certbot: error: unrecognized arguments: --dns-hetzner-credentials /root/my-cert.ini

root@my-server:~# certbot certonly --authenticator dns-hetzner
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Could not choose appropriate plugin: The requested dns-hetzner plugin does not appear to be installed
The requested dns-hetzner plugin does not appear to be installed

One other note. Included plugins, like apache are located in /snap/certbot/784/lib/python3.8/site-packages/ where as the hetzner plugin is placed in /root/.local/lib/python3.8/site-packages/.

I tried to copy the hetzner directories to the snap folder, but it is mounted as read only.

chludwig commented 3 years ago

Finally I solved the problem. It is a bug in certbot. See my post in https://community.letsencrypt.org/t/certbot-dns-plugin-listed-in-certbot-plugins-but-still-not-working/139614

But is there a way in installing this plugin with snap? I've seen that there is already a snapcraft.yaml file in your project.

BigMichi1 commented 3 years ago

you can try the snap published here https://snapcraft.io/certbot-dns-hetzner

chludwig commented 3 years ago

Hi @BigMichi1
thank you for the link. Has it been added today or was I blind?

Well, I uninstalled the plugin with pid (python3 -m pip uninstall certbot-dns-hetzner) and installed it with snap (snap install certbot-dns-hetzner), what did not work yesterday.
But unfortunately the plugin is neither displayed in the list of plugins certbot plugins, nor can I use it (I'll get an error).
I ran the other commands to connect certbot with the plugin as described on https://snapcraft.io/certbot-dns-hetzner, but this didn't change anything. Unfortunately it does not work.

So I uninstalled the snap version an reinstalled it with pip. Now I can use the plugin as before. Maybe my system isn't that clean anymore due to too many installs and uninstalls of the same plugin.

BigMichi1 commented 3 years ago

i had also issues when there was still a certbot installed in the system so cleaned everything, first removed all snaps related to certbot, then I had to remove everything related to certbot that was found until the command itself results in command not found, then I did a re-login and run the following commands

root@i7-4770 ~ # apt install snapd
root@i7-4770 ~ # snap install --classic certbot
root@i7-4770 ~ # snap set certbot trust-plugin-with-root=ok
root@i7-4770 ~ # snap install certbot-dns-hetzner
root@i7-4770 ~ # snap connect certbot:plugin certbot-dns-hetzner
root@i7-4770 ~ # snap connect certbot-dns-hetzner:certbot-metadata certbot:certbot-metadata
root@i7-4770 ~ # certbot plugins

you can also run snap connections to get an output similar to

Interface            Plug                                  Slot                         Notes
content[metadata-1]  certbot-dns-hetzner:certbot-metadata  certbot:certbot-metadata     manual
content[certbot-1]   certbot:plugin                        certbot-dns-hetzner:certbot  manual

what i tried also during the entire story was installing an additional certbot plugin like certbot-dns-dnsimple and then i tried the commands to see if I'm using the correct certbot installation if the following command still shows that the plugin is not found then a different certbot installation is used or the snap installation is broken

certbot certonly  --authenticator dns-dnsimple
BigMichi1 commented 3 years ago

see also https://github.com/certbot/certbot/issues/8504 why just installing doesn't work as someone would expect

l0rn commented 3 years ago

I don't plan to support a snap distribution myself - the yaml for snap in master was merged by a contribution of @jonathansnell - if someone who cares about it proposes fixes for this i will happily include them

l0rn commented 3 years ago

I think i will remove the snap configuration in the future and won't be supporting snap

l0rn commented 1 year ago

I won't support the snap store - still anyone is free to package it for the store