#CA_CERT_SRV="/etc/certbot/mailleur/mailleur-fullchain.pem"
#CA_KEY_SRV="/etc/certbot/mailleur/mailleur-key.pem"
#If certificate are self signed (default installation)
-CA_CERT_SRV="/etc/pki/mailleur/mailleur-cert.pem"
-CA_KEY_SRV="/etc/pki/mailleur/mailleur-key.pem"
+#CA_CERT_SRV="/etc/pki/mailleur/mailleur-cert.pem"
+#CA_KEY_SRV="/etc/pki/mailleur/mailleur-key.pem"
+#Symbolic link set at installation
+CA_CERT_SRV="/etc/mailleur/pki/mailleur-cert.pem"
+CA_KEY_SRV="/etc//mailleur/pki/mailleur-key.pem"
#------------------------------------------------
#Defining CLIENT mode Certificate data
CA_ROOT_CLT="/etc/pki/tls/make-ca/ca-bundle.crt"
#CA_CERT_CLT="/etc/certbot/mailleur/mailleur-fullchain.pem"
#CA_KEY_CLT="/etc/certbot/mailleur/mailleur-key.pem"
#If certificate are self signed (default installation)
-CA_CERT_CLT="/etc/pki/mailleur/mailleur-cert.pem"
-CA_KEY_CLT="/etc/pki/mailleur/mailleur-key.pem"
+#CA_CERT_CLT="/etc/pki/mailleur/mailleur-cert.pem"
+#CA_KEY_CLT="/etc/pki/mailleur/mailleur-key.pem"
+#Symbolic link set at installation
+CA_CERT_CLT="/etc/mailleur/pki/mailleur-cert.pem"
+CA_KEY_CLT="/etc/mailleur/pki/mailleur-key.pem"
#------------------------------------------------
#Configured for Postgresql database
#DB_TYPE can be either POSTGRESQL,MYSQL, default POSTGRESQL
BuildRequires : postgresql
Requires : bash
+Requires : bind-utils
Requires : cpp
Requires : dovecot
Requires : httpd
%{_libexecdir}/%{name}/bin-utils/feeder
%attr(0754,root,root) %{_libdir}/%{name}/shell/*.sh
%attr(0754,root,root) %{_libdir}/%{name}/support/addconfig.sh
-%attr(0754,root,root) %{_libdir}/%{name}/support/crdb.sh
+%attr(0754,root,root) %{_libdir}/%{name}/support/do_database.sh
+%attr(0754,root,root) %{_libdir}/%{name}/support/do_httpd.sh
%attr(0754,root,root) %{_libdir}/%{name}/support/dummy-cert.sh
%attr(0754,root,root) %{_libdir}/%{name}/support/starting.sh
%attr(0754,root,root) %config(noreplace) %{_libdir}/%{name}/support/do_dns_tlsa.sh
--- /dev/null
+#! /usr/bin/bash
+#-----------------------------------------------------------------
+#Shell script to add local information to configuration file
+#-----------------------------------------------------------------
+#loading the variable value
+. /etc/mailleur/mailleur.conf
+#-----------------------------------------------------
+#Updating clement httpd configuration file
+export hostipv4=`dig \`uname -n\` A +noall +short`;
+export hostipv6=`dig \`uname -n\` AAAA +noall +short`;
+if [ -z "$domain" ] ; then
+ export domain=`dnsdomainname`
+ fi
+
+#to make sure we have at least an hostipv4 reference
+if [ -z "$hostipv4" -a -z "$hostipv6" ] ; then
+ export hostipv4=`grep \`uname -n\` /etc/hosts | cut -f1`
+ fi
+#-----------------------------------------------------------------
+add_web()
+
+{
+#updating httpd.con
+sed -i \
+ -e "s:#LoadModule ssl_:LoadModule ssl_:" \
+ -e "s:#LoadModule rewrite:LoadModule rewrite:"\
+ $BASE/etc/httpd/httpd.conf
+
+#converting '.' to '\.'
+reldom=`echo $domain | sed -e "s/\\./\\\\\\./g"`
+
+cat >> /etc/httpd/conf.d/$APPNAME.conf <<!EOT
+#$APPNAME START
+#Done by the $APPNAME first start (do_httpd.sh)
+
+<VirtualHost *:80>
+ ServerName `hostname`
+ ServerAlias $APPNAME.$domain
+ ServerAlias localhost.localdomain
+ ServerAdmin root@$domain
+ RewriteEngine on
+ #comment it in if you want to debug redirect
+ #LogLevel alert rewrite:trace3
+ RewriteCond %{HTTP_HOST} ^clement\.$reldom [OR]
+ RewriteCond %{HTTP_HOST} ^`hostname -s`\.$reldom
+ RewriteRule ^(.*)$ https://`hostname -s`.$domain [R=301]
+ ErrorLog logs/clemerr.log
+ TransferLog logs/clemlog.log
+</VirtualHost>
+
+#-----------------------------------------------------------------
+#Listening on TLS port
+Listen 443
+#-----------------------------------------------------------------
+<VirtualHost *:443>
+ ServerName `hostname`
+ ServerAlias $APPNAME.$domain
+ ServerAlias localhost.localdomain
+ ServerAdmin root@$domain
+ DocumentRoot $BASE/var/www/$APPNAME
+ setenv PATH_INFO $BASE/etc/$APPNAME/$APPNAME.php
+ Alias /base-dir/ $BASE/var/www/$APPNAME/
+ Alias /reg-icons/ $BASE/var/www/$APPNAME/reg-icons/
+ Alias /base-graph/ $BASE/var/www/$APPNAME/graph/
+ ScriptAlias /cgi-bin/ $BASE/var/www/$APPNAME/
+ <Directory $BASE/var/www/$APPNAME>
+ Options MultiViews FollowSymlinks ExecCGI
+ AllowOverride AuthConfig FileInfo Indexes Limit Options
+ Require all granted
+ </Directory>
+ #----------------------------------------------
+ #SSL
+ SSLEngine On
+ SSLCertificateKeyFile /etc/pki/$APPNAME/$APPNME-key.pem
+ SSLCertificateFile /etc/pki/$APPNAME/$APPNME-cert.pem
+ SSLProtocol +TLSv1.3 +TLSv1.2
+ SSLCompression OFF
+ SSLHonorCipherOrder ON
+ #----------------------------------------------
+ ErrorLog logs/clemerr-ssl.log
+ TransferLog logs/clemlog-ssl.log
+</VirtualHost>
+
+#$APPNAME STOP
+!EOT
+}
+
+#-----------------------------------------------------------------
+#setting name virtual
+cat >> /etc/httpd/conf.d/$APPNAME.conf <<!EOT
+#$APPNAME START
+#Done by the $APPNAME first start
+#NameVirtualHost *:80
+#NameVirtualHost *:443
+#$APPNAME STOP
+!EOT
+
+#to setup the IPV4 WEB interface
+if [ -n "$hostipv4" ] ; then
+ add_web $hostipv4
+ fi
+
+#-----------------------------------------------------------------
+#to setup the IPV6 WEB interface
+if [ -n "$hostipv6" ] ; then
+ add_web $hostipv6
+ fi
+
+
fi
}
+#----------------------------------------------------------------------
+#adding httpd configuration
+#----------------------------------------------------------------------
+do_webconf()
+
+{
+/usr/lib/$APPNAME/support/do_httpd.sh
+}
#----------------------------------------------------------------------
#procedure to check if the config is properly done
#----------------------------------------------------------------------
case "$DB_TYPE" in
"MYSQL" | \
"POSTGRESQL" )
- /usr/lib/$APPNAME/support/crdb.sh "/tmp"
+ /usr/lib/$APPNAME/support/do_database.sh "/tmp"
if [ $? != 0 ] ; then
exit -1
fi
chown $APPNAME:mail \
/etc/pki/$APPNAME/$APPNAME-cert.pem \
/etc/pki/$APPNAME/$APPNAME-key.pem
+ mkdir -p /etc/$APPNAME/pki/
+ ln -s \
+ /etc/pki/$APPNAME/$APPNAME-cert.pem \
+ /etc/$APPNAME/pki/$APPNAME-cert.pem
+ ln -s \
+ /etc/pki/$APPNAME/$APPNAME-key.pem \
+ /etc/$APPNAME/pki/$APPNAME-key.pem
sh_success $"Preparing $APPNAME server self-signed certificate"
fi
}
/usr/lib/$APPNAME/support/addconfig.sh
do_mkdb ;
do_doveconf ;
+ do_webconf ;
case "$OS" in
osukiss )
;;