how to setup a certbot container for the ssl keys
prerequisites
DNS check
setup an A record on DNS for www
#ping <domain> #syntax
ping www.netforfun.ovh #should be 51.38.81.147
ssh into my host
ip address show eth0 #keep note of the public ips
related to my host
#51.89.248.5
#51.89.207.50
uninstall apache from the host
service apache2 status
create the container
I need to listen on port 80 to be able to generate the certificate on both ip
syntax
docker run -dti --name <container_name_I_choose> \
-p <ip>:8081:8081 \
-v /home/debian/docker_files/docker_volumes/nextcloud_volume:/nextcloud_volume
\
<image_name>:<imag_tag>
sample
docker run -dti --name certbot \
-p 80:80 \
-v "/opt/letsencrypt:/etc/letsencrypt" \
debian:buster
docker container ps -a | grep certbot #check if the container
is up and running
ls -lash /opt/ | grep letsencrypt #check the volume
folder
make changes inside the container
docker container ps -a | grep certbot #keep note of the
container id
docker exec -ti certbot bash #to go inside the
container
apt update
apt install apache2 -y
apt install certbot -y
apt-get install certbot python3-certbot-apache -y
how to install certbot if the previous command does not work
apt-get install software-properties-common
add-apt-repository universe
add-apt-repository ppa:certbot/certbot
apt-get update
apt install certbot
service apache2 status
service apache2 start
generate the certificate
#certbot -d <fqdn> certonly syntax
certbot -d www.netforfun.ovh certonly
How would you like to authenticate with the ACME CA? = 2: Place files in webroot
directory (webroot)
Enter email = [email protected]
Please read the Terms of Service … = A
Would you be willing to share your email … = N
Input the webroot for netforfun.ovh: = /var/www/html
certbot -d www.netforfun.ovh certonly
* How would you like to authenticate with the ACME CA? = 3: Place files in
webroot directory (webroot)
* Input the webroot for www.netforfun.ovh = /var/www/html
check certificates
ls -lash /etc/letsencrypt/keys/ #if I am inside the container
sudo ls -lash /opt/letsencrypt/keys/ #if I am outside the container