Running Locally
Installing
> wget https://dl.eff.org/certbot-auto
> chmod a+x ./certbot-auto
> ./certbot-auto -n --install-only
Running certbot-auto to generate a certificate
> ./certbot-auto certonly
Setup a Docker Container
Build an image with certbot installed
> vi Dockerfile
FROM webdevops/php-apache:ubuntu-12.04 RUN wget https://dl.eff.org/certbot-auto RUN chmod a+x ./certbot-auto RUN ./certbot-auto -n --install-only
> docker build -t ca/certbot .
Create a container from the image
> vi buildDocker.sh
CONTAINER=certbot IMAGE=ca/certbot HOSTNAME=$1 echo Configuring with hostname: $HOSTNAME docker stop $CONTAINER docker rm $CONTAINER docker run -d \ --name $CONTAINER \ -p 7077:80 \ -h $HOSTNAME \ -v $PWD/web:/app \ -v $PWD/letsencrypt:/etc/letsencrypt \ -e php.short_open_tag='On' \ -e php.post_max_size='20971520' \ -e php.upload_max_filesize='20971520' \ -e php.magic_quotes_gpc='off' \ -e php.session.save_handler='files' \ $IMAGE
> ./buildDocker.sh
View logs to see if the certbot container started properly
> docker logs -f certbot
Execute certbot-auto to create our cert
> docker exec -it certbot ./certbot-auto certonly
Saving debug log to /var/log/letsencrypt/letsencrypt.log How would you like to authenticate with the ACME CA? ------------------------------------------------------------------------------- 1: Spin up a temporary webserver (standalone) 2: Place files in webroot directory (webroot) ------------------------------------------------------------------------------- Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2 Plugins selected: Authenticator webroot, Installer None Please enter in your domain name(s) (comma and/or space separated) (Enter 'c' to cancel): test.jmehan.com Obtaining a new certificate Performing the following challenges: http-01 challenge for test.jmehan.com Input the webroot for test.jmehan.com: (Enter 'c' to cancel): /app Waiting for verification... Cleaning up challenges ...
References
Reference | URL |
---|---|
Getting Started | https://letsencrypt.org/getting-started/ |
*Using Certbot Auto | https://certbot.eff.org/docs/install.html#certbot-auto |
Certbot User Guide | https://certbot.eff.org/docs/using.html#certbot-commands |