Now apache.pem is always set

* We can configure apache2, postfix, proftpd, dovevot with tls features
by default
This commit is contained in:
cam.lafit 2018-06-23 11:39:34 +02:00
parent 719e1539b0
commit 1bc8b59da9
2 changed files with 11 additions and 62 deletions

View File

@ -0,0 +1,5 @@
# Don't change this file, it will be overwriten by alternc.install.
# Change ssl parameters in a file named 99_ssl.conf instead"
ssl_cert = </etc/alternc/apache.pem
ssl_key = </etc/alternc/apache.pem

View File

@ -310,12 +310,11 @@ if [ -x /usr/sbin/apache2 ]; then
run-parts --arg=apache2 /usr/lib/alternc/install.d
a2enmod mpm_itk
s=""
s="apache2"
# unused from AlternC 1.0, FIXME: remove it later
if [ -L /etc/apache2/mods-enabled/vhost_alias.load ]
then
a2dismod vhost_alias
s="apache2"
fi
if ! [ -L /etc/apache2/mods-enabled/php$php.load ]
then
@ -325,46 +324,12 @@ if [ -x /usr/sbin/apache2 ]; then
then
a2enmod rewrite
fi
if [ -e /etc/alternc/apache.pem ]; then
# We enable proftpd tls module
cat /etc/proftpd/modules.conf | sed -e 's/^#LoadModule mod_tls.c/LoadModule mod_tls.c/' > /etc/proftpd/modules.conf.alternc-new
mv /etc/proftpd/modules.conf.alternc-new /etc/proftpd/modules.conf
cp /etc/proftpd/modules.conf /etc/alternc/templates/proftpd/
# We enable apache2 SSL :
if [ ! -L /etc/apache2/mods-enabled/ssl.load ] ; then
a2enmod ssl
s="apache2"
fi
if [ ! -h /etc/apache2/conf-available/alternc-ssl.conf ] && [ -e /etc/apache2/conf-available/ ]; then
ln -sf /etc/alternc/apache2-ssl.conf /etc/apache2/conf-available/alternc-ssl.conf
a2enconf alternc-ssl
s="apache2"
fi
# We enable dovecot SSL certificate instructions: (on wheezy we should use a new file in /etc/dovecot/conf.d/ )
( echo "# Don't change this file, it will be overwriten by alternc.install. Change ssl parameters in a file named 99_ssl.conf instead" ; echo "ssl_cert = </etc/alternc/apache.pem" ; echo "ssl_key = </etc/alternc/apache.pem" ) >/etc/dovecot/conf.d/96_ssl.conf
else
# We disable proftpd tls module
cat /etc/proftpd/modules.conf | sed -e 's/^LoadModule mod_tls.c/#LoadModule mod_tls.c/' > /etc/proftpd/modules.conf.alternc-new
mv /etc/proftpd/modules.conf.alternc-new /etc/proftpd/modules.conf
cp /etc/proftpd/modules.conf /etc/alternc/templates/proftpd/
# We disable dovecot SSL certificate instructions: (on wheezy we should remove a file in /etc/dovecot/conf.d/ )
( echo "# Don't change this file, it will be overwriten by alternc.install. Change ssl parameters in a file named 99_ssl.conf instead" ; echo "ssl_cert = </etc/ssl/certs/ssl-cert-snakeoil.pem" ; echo "ssl_key = </etc/ssl/private/ssl-cert-snakeoil.key" ) >/etc/dovecot/conf.d/96_ssl.conf
echo "SSL not configured"
echo "create a certificate in /etc/alternc/apache.pem and rerun alternc.install"
fi
if [ ! -h /etc/apache2/conf-available/alternc.conf ] && [ -e /etc/apache2/conf-available/ ]; then
ln -sf /etc/alternc/apache2.conf /etc/apache2/conf-available/alternc.conf
a2enconf alternc.conf
s="apache2"
fi
if [ -e /etc/apache2/sites-enabled/000-default.conf ]; then
a2dissite 000-default
s="apache2"
if [ ! -h /etc/apache2/conf-available/alternc-ssl.conf ] && [ -e /etc/apache2/conf-available/ ]; then
ln -sf /etc/alternc/apache2-ssl.conf /etc/apache2/conf-available/alternc-ssl.conf
a2enconf alternc-ssl
fi
SERVICES="$SERVICES $s"
fi
@ -424,28 +389,7 @@ else
postfix_conf=/etc/alternc/postfix/postfix.cf
fi
grep -v '^\ *#' $postfix_conf |while read line ; do
if echo "$line" | grep -qi '^smtpd_tls_dcert_file' ;then
line_strip=`echo "$line"|tr -d '[:blank:]'`
pattern="*="
cert_file=${line_strip#$pattern}
echo $cert_file
echo $line
echo $line_strip
if [ -e $cert_file ];then
postconf -e "$line"
else
echo -e "\033[31m*****************************************************"
echo "* The certificate file : $cert_file does not exists *"
echo "* If you want to be able to use SSL/TLS *"
echo "* please go to https://alternc.com/SSL *"
echo "* to get information on how to create a certificate *"
echo "* Finally relaunch alternc.install *"
echo "*****************************************************"
echo -e "\033[0m"
fi
else
postconf -e "$line"
fi
postconf -e "$line"
done
# Conviguring delivery used by Postfix