Page 1 of 5

Script for generating letsencrypt SSL and configuring all daemons (Apache, nginx, dovecot, Exim, Vesta) to use it

Posted: Thu Sep 08, 2016 3:35 pm
by dpeca
Many server owners don't know how to install Letsencrypt SSL and configure all daemons to use it, especially Exim4 and dovecot.
I wrote a script that do it automatically.
In short - this script will generate SSL, for your server hostname or for any other domain on your server, and it will automatically configure all daemons to use that SSL.

Edit: this script is now obsolete
See new way for having SSL on all daemons - viewtopic.php?f=19&t=12617&p=72195#p72195

Re: Script for generating letsencrypt SSL and configuring all daemons (Apache, nginx, dovecot, Exim, Vesta) to use it

Posted: Fri Sep 09, 2016 9:38 pm
by skamasle
Hi

Vestacp already support letsencrypt from cli

viewtopic.php?t=11927

Code: Select all

v-add-letsencrypt-domain USER DOMAIN [ALIASES] [RESTART]
v-add-letsencrypt-user USER [EMAIL]
v-check-letsencrypt-domain USER DOMAIN
v-list-letsencrypt-user USER [FORMAT]
v-sign-letsencrypt-csr USER DOMAIN CSR_DIR [FORMAT]
v-update-letsencrypt-ssl
Can you explain diference whit your script ?

Re: Script for generating letsencrypt SSL and configuring all daemons (Apache, nginx, dovecot, Exim, Vesta) to use it

Posted: Fri Sep 09, 2016 11:02 pm
by dpeca
Firstly, I saw a lot of messages on forum that is saying it not works.
Should be fixed in v17.

Secondly, a script that I wrote will configure all daemons - dovecot, Exim4, and Vesta on 8083 port.
All five daemons.
Vesta's built-in scripts will only configure Apache and nginx.

And as I said in first message, when VestaCP start to support letsencrypt naturally (when bugs became fixed) - I'll just write a new script that will use already generated SSL's (Letsencrypt SSL's that Vesta generated) - and then that new script will be used only for server hostname - as a tool that will configure Exim4, dovecot and Vesta daemon (nginx on port 8083) to use proper SSL.

Re: Script for generating letsencrypt SSL and configuring all daemons (Apache, nginx, dovecot, Exim, Vesta) to use it

Posted: Wed Sep 14, 2016 9:12 pm
by skamasle
Looks good .

If you want mirror for script I can host it :)

Re: Script for generating letsencrypt SSL and configuring all daemons (Apache, nginx, dovecot, Exim, Vesta) to use it

Posted: Fri Sep 16, 2016 9:46 pm
by MrSoul

Code: Select all

[root@149 bin]# generate_ssl admin xXx.net
/usr/local/bin/generate_ssl: line 86: ./letsencrypt-auto: No such file or directory
ERROR: Something went wrong. Check output above.
[root@149 bin]# generate_ssl admin xXx.xXx.xXx.xXx
/usr/local/bin/generate_ssl: line 86: ./letsencrypt-auto: No such file or directory
ERROR: Something went wrong. Check output above.
what is the problem ?
the hostname you mean domain or server address ?
----
xx.net is my domain
xXx.xXx.Xxx = server ip

Re: Script for generating letsencrypt SSL and configuring all daemons (Apache, nginx, dovecot, Exim, Vesta) to use it

Posted: Fri Sep 16, 2016 10:26 pm
by dpeca
Please run:
ls -l /root/letsencrypt/

and copy here output.

Re: Script for generating letsencrypt SSL and configuring all daemons (Apache, nginx, dovecot, Exim, Vesta) to use it

Posted: Tue Sep 20, 2016 10:32 pm
by misak35
dpeca wrote:Please run:
ls -l /root/letsencrypt/

and copy here output.

Code: Select all

total 0

Re: Script for generating letsencrypt SSL and configuring all daemons (Apache, nginx, dovecot, Exim, Vesta) to use it

Posted: Tue Sep 20, 2016 11:11 pm
by dpeca
Try to run manually this (as root) :

Code: Select all

cd /root

git clone https://github.com/letsencrypt/letsencrypt
If everything went OK, then run:

Code: Select all

cd letsencrypt

./letsencrypt-auto --help
If everything went OK, then run:

Code: Select all

echo -e '#!/bin/bash\n' > /usr/local/bin/generate_all_ssls

chmod u+x /usr/local/bin/generate_all_ssls

crontab -l | { cat; echo "3 20 1 */2 * /usr/local/bin/generate_all_ssls > /var/log/generate_all_ssls.log"; } | crontab -

Re: Script for generating letsencrypt SSL and configuring all daemons (Apache, nginx, dovecot, Exim, Vesta) to use it

Posted: Wed Sep 21, 2016 10:59 am
by apachler
It would be nice to get support for subdomains like "sub.domain.com"

Thanks!

Re: Script for generating letsencrypt SSL and configuring all daemons (Apache, nginx, dovecot, Exim, Vesta) to use it

Posted: Wed Sep 21, 2016 4:30 pm
by dpeca
I think Vesta v17 will support letsencrypt completely.
My script is generally for server hostname (dovecot, Exim, Vesta) purpose :)