Commit c8ebae06 authored by Alan Garcia's avatar Alan Garcia
Browse files

Ménage

parent 9866a5a7
......@@ -531,9 +531,6 @@ lang/.svnignore -text
lang/README -text
lang/en_US.po -text
lang/nl_NL.po -text
mailautoconfig/apache_mail-autoconfig.conf -text
mailautoconfig/cron_bash -text
mailautoconfig/var/www/mail_autoconfig/.htaccess -text
man/alternc-admintools.8 -text
man/alternc-admintools.fr.8 -text
man/alternc.install.pod -text
......
# ce vhosts est fonctionnel sur le serveur ici dans l'exemple, hostname : petdev.octopuce.fr
# la plus belle façon de faire, serait que le vhosts d'apache par defaut gere les alias
# exemple de log pour icedov (comme thunderboird) :
# /var/log/apache2/mailconfig.log:10.1.0.254 - - [22/Jul/2013:12:54:29 +0200] begin:1374490469 end:1374490469 "GET /mail/config-v1.1.xml?emailaddress=test%40petdev2.octopuce.fr HTTP/1.1" 200 sent 602 328 0 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130704 Icedove/17.0.7" autoconfig.petdev2.octopuce.fr
# exemple pour outlook
# /var/log/apache2/mailconfig.log:10.1.0.254 - - [22/Jul/2013:14:23:23 +0200] begin:1374495803 end:1374495803 "GET /autodiscover/autodiscover.xml HTTP/1.1" 200 sent 1044 794 0 "-" "Microsoft Office/14.0 (Windows NT 5.1; Microsoft Outlook 14.0.6126; Pro)" autodiscover.petdev2.octopuce.fr
# configuration du repertoire :
<Directory "/var/www/mail_autoconfig">
php_admin_value open_basedir "/var/www/mail_autoconfig/:/usr/share/php/:/var/alternc/tmp:/tmp"
Options +MultiViews -FollowSymLinks +SymLinksIfOwnerMatch
AllowOverride AuthConfig FileInfo Limit Options Indexes
Order allow,deny
allow from all
</Directory>
# 443/SSL pour les clients outlook
# normalement autidiscover serait suffisant, car autoconfig est utilise par thunderbird
NameVirtualHost autodiscover.petdev.octopuce.fr:443
<VirtualHost autodiscover.petdev.octopuce.fr:443>
ServerName autodiscover.localhost
ServerAlias autoconfig.*
ServerAlias autodiscover.*
SSLEngine on
SSLCertificateFile /etc/ssl/private/localhost.all
SSLCaCertificatePath /etc/ssl/certs
LogFormat "%h %l %u %t %{begin:%s}t %{end:%s}t \"%r\" %>s sent %O %b %T \"%{Referer}i\" \"%{User-Agent}i\" %{Host}i" mailconfig
CustomLog ${APACHE_LOG_DIR}/mailconfig.log mailconfig
DocumentRoot /var/www/mail_autoconfig/
</VirtualHost>
<VirtualHost *:80>
ServerName autodiscover.localhost
ServerAlias autoconfig.*
ServerAlias autodiscover.*
LogFormat "%h %l %u %t %{begin:%s}t %{end:%s}t \"%r\" %>s sent %O %b %T \"%{Referer}i\" \"%{User-Agent}i\" %{Host}i" mailconfig
CustomLog ${APACHE_LOG_DIR}/mailconfig.log mailconfig
DocumentRoot /var/www/mail_autoconfig/
</VirtualHost>
#!/bin/bash
# cron pouvant servir au cas ou la foinctionnalite n est pas intergre a alternc
PUBLIC_IP="`awk -F'"' '/^PUBLIC_IP/ {print $2}' /etc/alternc/local.sh`"
if [ -d "/var/alternc/bind/zones" ]
then
BINDDIR="/var/alternc/bind/zones"
fi
if [ -d "/var/lib/alternc/bind/zones" ]
then
BINDDIR="/var/lib/alternc/bind/zones"
fi
BINDRELOAD=0
while read domaine gesmx gesdns
do
# for debug
#echo $domaine $gesmx $gesdns
if [ $gesdns -eq 0 ]
then
sed -i '/^autodiscover/d' $BINDDIR/$domaine
sed -i '/^autoconfig/d' $BINDDIR/$domaine
else
if [ $gesmx -eq 0 ]
then
sed -i '/^autodiscover/d' $BINDDIR/$domaine
sed -i '/^autoconfig/d' $BINDDIR/$domaine
else
ZNSERIAL="`awk '/; serial/ {print $1}' $BINDDIR/$domaine`"
NEWZNSERIAL=$((ZNSERIAL+1))
# for debug
#echo $ZNSERIAL $NEWZNSERIAL $BINDDIR
if [ `grep "^autodiscover " $BINDDIR/$domaine | wc -l` -ge 1 ]
then
echo -e "autodiscover IN A $PUBLIC_IP" >> /dev/null
else
echo -e "autodiscover IN A $PUBLIC_IP" >> $BINDDIR/$domaine
sed -i '/; serial[ \t]*$/ s/'$ZNSERIAL'/'$NEWZNSERIAL'/' $BINDDIR/$domaine
fi
if [ `grep "^autoconfig " $BINDDIR/$domaine | wc -l` -ge 1 ]
then
echo -e "autoconfig IN A $PUBLIC_IP" >> /dev/null
else
echo -e "autoconfig IN A $PUBLIC_IP" >> $BINDDIR/$domaine
sed -i '/; serial[ \t]*$/ s/'$ZNSERIAL'/'$NEWZNSERIAL'/' $BINDDIR/$domaine
fi
fi
fi
if [ `awk '/; serial/ {print $1}' $BINDDIR/$domaine` -gt $ZNSERIAL ]
then
BINDRELOAD=$((BINDRELOAD+1))
fi
done < <(mysql --defaults-file=/etc/alternc/my.cnf -e "select domaine,gesmx,gesdns from domaines;" alternc | grep -v \| | tail --lines=+2)
if [ $BINDRELOAD -ne 0 ]
then
/usr/sbin/rndc reload
fi
RewriteEngine On
RewriteRule ^mail/mailautoconfig.xml$ /thunderbird.php [L]
RewriteRule ^mail/config-v1.1.xml$ /thunderbird.php [L]
RewriteRule ^autodiscover/autodiscover.xml$ /outlook.php [L]
RewriteRule ^Autodiscover/Autodiscover.xml$ /outlook.php [L]
RewriteRule ^Autodiscover.xml$ outlook.php [L]
RewriteRule ^autodiscover.xml$ outlook.php [L]
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment