From 6411d0e08eb1c32933ddeabf9d583607a140bb34 Mon Sep 17 00:00:00 2001 From: kload Date: Thu, 1 Oct 2015 17:34:30 -0400 Subject: [PATCH] [fix] Run yunohost hook + create the CA at package installation --- data/hooks/conf_regen/01-yunohost | 4 ++++ data/hooks/conf_regen/02-ssl | 6 ++++-- debian/postinst | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/data/hooks/conf_regen/01-yunohost b/data/hooks/conf_regen/01-yunohost index 5ff8e8da4..30d77a5dc 100644 --- a/data/hooks/conf_regen/01-yunohost +++ b/data/hooks/conf_regen/01-yunohost @@ -7,6 +7,10 @@ cd /usr/share/yunohost/templates/yunohost sudo mkdir -p /etc/yunohost +if [ ! -f /etc/yunohost/current_host ]; then + echo "yunohost.org" | sudo tee /etc/yunohost/current_host +fi + if [ ! -f /etc/yunohost/firewall.yml ]; then sudo cp firewall.yml /etc/yunohost/firewall.yml fi diff --git a/data/hooks/conf_regen/02-ssl b/data/hooks/conf_regen/02-ssl index 0331b64c5..c8812d1cf 100644 --- a/data/hooks/conf_regen/02-ssl +++ b/data/hooks/conf_regen/02-ssl @@ -29,8 +29,10 @@ if [ ! -f $ssl_dir/serial ]; then echo "01" | sudo tee $ssl_dir/serial fi -if [ ! -f /etc/yunohost/current_host ]; then - echo "yunohost.org" | sudo tee /etc/yunohost/current_host +if [ ! -f /etc/yunohost/certs/yunohost.org/ca.pem ]; then + sudo openssl req -x509 -new -config $ssl_dir/openssl.cnf \ + -days 3650 -out $ssl_dir/ca/cacert.pem \ + -keyout $ssl_dir/ca/cakey.pem -nodes -batch fi if [ ! -f /etc/yunohost/certs/yunohost.org/crt.pem ]; then diff --git a/debian/postinst b/debian/postinst index ec92de4d3..c1159dfdc 100644 --- a/debian/postinst +++ b/debian/postinst @@ -7,6 +7,7 @@ do_configure() { service yunohost-api restart if [ ! -f /etc/yunohost/installed ]; then + bash /usr/share/yunohost/hooks/conf_regen/01-yunohost bash /usr/share/yunohost/hooks/conf_regen/02-ssl bash /usr/share/yunohost/hooks/conf_regen/15-nginx fi