Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Debian Config and Script Paths #3

Open
jason-klein opened this issue Aug 4, 2017 · 4 comments
Open

Debian Config and Script Paths #3

jason-klein opened this issue Aug 4, 2017 · 4 comments

Comments

@jason-klein
Copy link

jason-klein commented Aug 4, 2017

Thank you for this great script! We placed our script in /usr/local/sbin/certbot-route53.sh and we use the Debian certbot package's default config location of /etc/letsencrypt/.

We had to replace $PWD with $SCRIPT and $CONFIG variables that held these paths for these reasons:

  1. Certbot would fail to locate hook script if we ran script with absolute path (e.g. cd /root && /usr/local/sbin/certbot-route53.sh ...)
  2. Certbot was not writing the correct hook script paths to the renewal conf files.
  3. Certbot would only store config in default location if our PWD was /etc when we executed the script (e.g. cd /etc/ && /usr/local/sbin/certbot-route53.sh ...).

Other users might find it helpful to have similar variables near top of script, even if the default values for CONFIG and SCRIPT remain $PWD/letsencrypt and $PWD/$0 for now.

CONFIG=/etc/letsencrypt
SCRIPT=/usr/local/sbin/certbot-route53.sh

  certbot certonly \
    --non-interactive \
    --manual \
    --manual-auth-hook $SCRIPT \
    --manual-cleanup-hook $SCRIPT \
    --preferred-challenge dns \
    --config-dir $CONFIG \
    --work-dir $CONFIG \
    --logs-dir $CONFIG \
    $@

Thanks again for publishing this!

@jed
Copy link
Owner

jed commented Aug 7, 2017

@jason-klein, would you mind submitting a PR with this fix?

@joshribakoff
Copy link

joshribakoff commented Aug 22, 2017

Hey,

The script worked flawless out of the box for me. I just downloaded & ran it out of an arbitrary path. I assumed the reason it used $PWD as opposed to hard coding /etc/letsencrypt was some problem with clobbering existing files.

A PR with the above fix would now break my setup, since I didn't happen to place it at /etc/letsencrypt. In fact I assumed this was specifically not supported. The readme could certainly use some clarification on paths, and I think @jed as the author you should weigh in here or explain how this was intended to work.

It seems like all the issues raised by @jason-klein are a symptom of not changing the working directory prior to running the script, and I'm not sure why that's undesired. I agree its not optimal, but hard coding paths is even less optimal.

Awesome script by the way!

@jed
Copy link
Owner

jed commented Aug 22, 2017

@joshribakoff, this is basically what i'm thinking, though my experience in the domain is pretty shallow. not a fan of hardcoding and would like this to work on environments that don't have write permissions within /etc (lambda, et al). perhaps a better idea would be a note in the README?

@joshribakoff
Copy link

joshribakoff commented Aug 23, 2017 via email

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

No branches or pull requests

3 participants