fix(certbot): proper home directory handling

Signed-off-by: Rajesh Rajendran <rjshrjndrn@gmail.com>
This commit is contained in:
Rajesh Rajendran 2021-05-12 11:54:12 +05:30
parent 2af3aaea88
commit cb390eb9b7

View file

@ -8,6 +8,7 @@ echo -e "This script won't work for aws default domain names assosiated with pub
sleep 5
homedir=${HOME}
echo please enter your dns name :
read dns_name
echo please enter your email id:
@ -25,14 +26,14 @@ fi
sudo certbot certonly --non-interactive --agree-tos -m $emai_id -d $dns_name --standalone
sudo cp $certbot_home/privkey1.pem /home/$ssh_ansible_user/site.key
sudo cp $certbot_home/fullchain1.pem /home/$ssh_ansible_user/site.crt
sudo chown -R $ssh_ansible_user:$ssh_ansible_user /home/$ssh_ansible_user/site.key /home/$ssh_ansible_user/site.crt
sudo chmod 775 /home/$ssh_ansible_user/site.crt /home/$ssh_ansible_user/site.key
sudo cp $certbot_home/privkey1.pem ${homedir}/site.key
sudo cp $certbot_home/fullchain1.pem ${homedir}/site.crt
sudo chown -R $ssh_ansible_user:$ssh_ansible_user ${homedir}/site.key ${homedir}/site.crt
sudo chmod 775 ${homedir}/site.crt ${homedir}/site.key
echo -e "Please take a note of these, and fill it up in config file: \
\n\n dns_name: $dns_name \n
cert_path: /home/$ssh_ansible_user/site.crt \n
key_path: /home/$ssh_ansible_user/site.key\n
cert_path: ${homedir}/site.crt \n
key_path: ${homedir}/site.key\n
!!! please remove certs after the installation process. or keep it in a safe place."