Compare commits

...

8 commits
master ... ssl

3 changed files with 56 additions and 18 deletions

View file

@ -1,9 +1,11 @@
<VirtualHost *:80> <VirtualHost *:80 *:443>
# FQDN principal # FQDN principal
ServerName SERVERNAME ServerName SERVERNAME
#ServerAlias SERVERNAME #ServerAlias SERVERNAME
Include /etc/apache2/ssl/XXX.conf
# Repertoire principal # Repertoire principal
DocumentRoot HOME_DIR/XXX/www/ DocumentRoot HOME_DIR/XXX/www/
@ -48,8 +50,9 @@
# REWRITE # REWRITE
UseCanonicalName On UseCanonicalName On
RewriteEngine On RewriteEngine On
RewriteCond %{HTTP_HOST} !^SERVERNAME$ RewriteCond %{HTTP_HOST} !^SERVERNAME$ [OR]
RewriteRule ^/(.*) http://%{SERVER_NAME}/$1 [L,R] RewriteCond %{HTTPS} !=on
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [L,R]
# PHP # PHP
#php_admin_flag engine off #php_admin_flag engine off
@ -65,4 +68,4 @@
php_admin_value error_log "HOME_DIR/XXX/log/php.log" php_admin_value error_log "HOME_DIR/XXX/log/php.log"
php_admin_value open_basedir "/usr/share/php:HOME_DIR/XXX:/tmp" php_admin_value open_basedir "/usr/share/php:HOME_DIR/XXX:/tmp"
</VirtualHost> </VirtualHost>

View file

@ -90,6 +90,10 @@ del-alias VHOST ALIAS
Del a ServerAlias from an Apache vhost Del a ServerAlias from an Apache vhost
ssl VHOST
Update SSL for Apache VHOST
EOT EOT
} }
@ -251,7 +255,7 @@ create_www_account() {
random=$RANDOM random=$RANDOM
vhostfile="/etc/apache2/sites-available/${in_login}.conf" vhostfile="/etc/apache2/sites-available/${in_login}.conf"
cat $TPL_VHOST | \ cat $TPL_VHOST | \
sed -e "s/XXX/$in_login/g ; s/SERVERNAME/$in_wwwdomain/ ; s/RANDOM/$random/ ; s#HOME_DIR#$HOME_DIR#" >$vhostfile sed -e "s/XXX/$in_login/g ; s/SERVERNAME/$in_wwwdomain/ ; s/RANDOM/$random/ ; s#HOME_DIR#$HOME_DIR#" >$vhostfile
@ -263,6 +267,8 @@ create_www_account() {
a2ensite $in_login >/dev/null a2ensite $in_login >/dev/null
yes|make-csr ${in_login}
step_ok "Configuration d'Apache" step_ok "Configuration d'Apache"
############################################################################ ############################################################################
@ -328,12 +334,27 @@ create_www_account() {
step_ok "Rechargement d'Apache" step_ok "Rechargement d'Apache"
set +e
evoacme $in_login
set -e
############################################################################ ############################################################################
DATE=$(date +"%Y-%m-%d") DATE=$(date +"%Y-%m-%d")
echo "$DATE [web-add.sh] Ajout $in_login" >> /var/log/evolix.log echo "$DATE [web-add.sh] Ajout $in_login" >> /var/log/evolix.log
} }
op_ssl() {
if [ $# -lt 1 ]; then
usage
exit 1
else
yes|make-csr $1
set +e
evoacme $1
set -e
fi
}
op_del() { op_del() {
if [ $# -lt 1 ]; then if [ $# -lt 1 ]; then
usage usage
@ -370,6 +391,7 @@ op_del() {
sed -i.bak "/-config=$login /d" /etc/cron.d/awstats sed -i.bak "/-config=$login /d" /etc/cron.d/awstats
apache2ctl configtest apache2ctl configtest
set +x set +x
rm -f $CRT_DIR/${login}* $KEY_DIR/${login}.key $CSR_DIR/${login}.csr $AUTO_CRT_DIR/${login}.pem
if [ -n "$dbname" ]; then if [ -n "$dbname" ]; then
echo "Deleting mysql DATABASE $dbname and mysql user $login. Continue ?" echo "Deleting mysql DATABASE $dbname and mysql user $login. Continue ?"
@ -406,6 +428,9 @@ arg_processing() {
;; ;;
del-alias) del-alias)
op_aliasdel $* op_aliasdel $*
;;
ssl)
op_ssl $*
;; ;;
*) *)
usage usage
@ -443,6 +468,10 @@ op_aliasadd() {
[ -f $VHOST_PATH/$vhost ] && sed -i -e "s/\(ServerName .*\)/\1\n\tServerAlias $alias/" $VHOST_PATH/$vhost --follow-symlinks [ -f $VHOST_PATH/$vhost ] && sed -i -e "s/\(ServerName .*\)/\1\n\tServerAlias $alias/" $VHOST_PATH/$vhost --follow-symlinks
yes|make-csr $1
set +e
evoacme $1
set -e
apache2ctl configtest 2>/dev/null apache2ctl configtest 2>/dev/null
/etc/init.d/apache2 force-reload >/dev/null /etc/init.d/apache2 force-reload >/dev/null
@ -457,6 +486,10 @@ op_aliasdel() {
[ -f $VHOST_PATH/$vhost ] && sed -i -e "/ServerAlias $alias/d" $VHOST_PATH/$vhost --follow-symlinks [ -f $VHOST_PATH/$vhost ] && sed -i -e "/ServerAlias $alias/d" $VHOST_PATH/$vhost --follow-symlinks
yes|make-csr $1
set +e
evoacme $1
set -e
apache2ctl configtest 2>/dev/null apache2ctl configtest 2>/dev/null
/etc/init.d/apache2 force-reload >/dev/null /etc/init.d/apache2 force-reload >/dev/null

View file

@ -22,19 +22,21 @@
<thead> <thead>
<tr> <tr>
<?php if(is_superadmin()) { <?php if(is_superadmin()) {
print '<th>Propriétaire</th>'; printf('<th>Propriétaire</th>');
} ?> printf('<th>Domaine</th>');
<th>Domaine</th> }
<!--<th>Opérations</th>--> if($conf['cluster']) {
<?php if($conf['cluster']) { ?> printf('<th>Bdd</th>');
<th>Bdd</th> printf('<th>Mail</th>');
<th>Mail</th> printf('<th>Replication</th>');
<th>Replication</th> printf('<th>Master</th>');
<th>Master</th> printf('<th>Slave</th>');
<th>Slave</th> }
<?php if(is_superadmin()) { printf('<th>Alias</th>');
print '<th>Alias</th>'; if(is_superadmin()) {
}} ?> printf('<th>Opérations</th>');
}
?>
<tr> <tr>
</thead> </thead>
<tbody> <tbody>