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

certfile valid even if certbot fails #223

Closed
mxraw opened this issue Jun 9, 2022 · 1 comment
Closed

certfile valid even if certbot fails #223

mxraw opened this issue Jun 9, 2022 · 1 comment

Comments

@mxraw
Copy link

mxraw commented Jun 9, 2022

In line 48, the variable certfile will be set to a valid value even if certbot fails or doesn't exist. Ex:

$ dpkg -l certbot
dpkg-query: no packages found matching certbot
$ certdir="$(dirname "$(certbot certificates 2>/dev/null | grep "$maildomain\|*.$domain" -A 2 | awk '/Certificate Path/ {print $3}' | head -n1)")"
$ echo $certdir
.
$

This immediadetly becomes a problem in line 50 where the check does not fail, because... well, '.' is a valid directory. Instead of aborting, the script goes on creating broken configuration files for dovecot.

I think the execution of certbot should be extra so that not only the script aborts when it return value indicates failure but also certbot's error is outputted to stdin.

@LukeSmithxyz
Copy link
Owner

I see. The error his is because of the dirname that will return . if the command isn't present, which as you say, is a directory.

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