Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Certbot doesn't seem to provide necessary arguments #5

Open
zertap opened this issue Jan 4, 2023 · 2 comments
Open

Certbot doesn't seem to provide necessary arguments #5

zertap opened this issue Jan 4, 2023 · 2 comments

Comments

@zertap
Copy link

zertap commented Jan 4, 2023

When running: certbot certonly --manual --manual-auth-hook /root/certbot-dns-name-com/src/certbot-dns-namecom.py -d domain.tld --agree-tos --email [email protected] --dry-run
I'm getting the following error

manual-auth-hook command "/root/certbot-dns-name-com/src/certbot-dns-namecom.py" returned error code 1
Error output from manual-auth-hook command certbot-dns-namecom.py:
Traceback (most recent call last):
  File "/root/certbot-dns-name-com/src/certbot-dns-namecom.py", line 49, in <module>
    cmd = sys.argv[1]
IndexError: list index out of range

Debian 11
certbot 1.12.0

@12joan
Copy link

12joan commented Mar 5, 2023

Newer versions of certbot don't pass an argument, but instead call separate hooks for add and cleanup. I solved this by wrapping the Python script in two Bash scripts. Certbot docs

@zertap
Copy link
Author

zertap commented Apr 5, 2023

Right, thanks!

I think the code in the repository should be fixed to have separate deletion and addition scripts, but for now this kind of workaround does it.

[root@nginx namecom-renewal]# ls -l
total 26
-rwxr-xr-x 1 root root 3815 Apr  5 06:03 certbot-dns-namecom.py
-rw-r--r-- 1 root root  133 Apr  5 06:29 config.json
-rwxr-xr-x 1 root root  139 Apr  5 06:16 dns-namecom-add.bash
-rwxr-xr-x 1 root root  141 Apr  5 06:16 dns-namecom-clean.bash
[root@nginx namecom-renewal]# cat dns-namecom-add.bash
#! /usr/bin/bash

export CERTBOT_DNS_NAMECOM_CONFIG=/root/namecom-renewal/config.json

/root/namecom-renewal/certbot-dns-namecom.py add $@
[root@nginx namecom-renewal]# cat dns-namecom-clean.bash
#! /usr/bin/bash

export CERTBOT_DNS_NAMECOM_CONFIG=/root/namecom-renewal/config.json

/root/namecom-renewal/certbot-dns-namecom.py clean $@

And then running with: certbot certonly --manual --preferred-challenges=dns --manual-auth-hook /root/namecom-renewal/dns-namecom-add.bash --manual-cleanup-hook /root/namecom-renewal/dns-namecom-clean.bash -d example.tld --agree-tos --email [email protected] --dry-run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants