I want to ask if it's possible to use Certbot for a semi-automated setup where the underlying infrastructure is controlled by me and not by Certbot.
I understand that Certbot will communicate with Let's Encrypt to issue a challenge, which is basically a token that Certbot will need to find at my IP address or my DNS.
I have full control of Apache server, but it is a very customized multi-hosting setup (SNI required!) and I don't want Certbot to mess up with my Apache configuration, neither to run as root. We will return to sudoers later.
I have already set up the hosting space for mta-sts.example.org
, as I am implementing Mail Transfer Agent's Strict Transport Security
I have told Apache, using a macro, that /home/djechelon/srv/www/domains/mta-sts.example.org
is my workspace
- htdocs: content served over HTTP
- htdocs-secure: content served over HTTPS
- logs: Apache VHost logs
- ssl: this is where
mta-sts.example.org.{key,crt,ca_bundle?}
exist
I would like to tell Certbot to do the following for me
- Obtain the challenge from LE
- Write the challenge to appropriate file under
/home/djechelon/..../htdocs
, and Apache is ready to serve it - Ask LE to validate challenge, because Apache is ready to serve the challenge
- Write certificate to
/home/djechelon/..../ssl/
. If LE provides no ca_bundle no problem, it's optional on my place - Issue Apache reload (there will likely be a sudoers setting soon)
I understood that I need to use the webroot
plugin in this case, but I was struggling to find command line help for all options, including where to store the files and the certificates.
The documentation assumes that the process is interactive, so I would have to copy the challenge file manually and ask Certbot to contact LE for domain validation.
I believe that there should be a simple way to run the simple script above, which runs under the assumption that the overall IT infrastructure exists (e.g. you really want to run your own server software) and is well configured.
Any help?
[Edit] I managed to invoke this interactively for now
certbot certonly --webroot -d mta-sts.example.org --preferred-challenges http --work-dir /home/djechelon/etc/letsencrypt --logs-dir /home/djechelon/letsencrypt-logs --config-dir /home/djechelon/etc/letsencrypt
Which asked me for the webroot dir and the email (something I would have loved to pass as a parameter for future renewals). So now the question may become "how do I rerun this in the future non interactively with cron?"