Commit 02e07ec2 authored by Eric's avatar Eric

amelioration de la mise a jour automatique dkim

parent 8a46731f
......@@ -12,15 +12,20 @@ FICLISTES=`tempfile`
LADATE=`date "+%Y%m%d %H:%M"`
echo "------------- ${LADATE}"
echo "Fichier domaines temporaire : ${FIC}"
echo "Fichier listes temporaire : ${FICLISTES}"
wget -q https://sud-ouest2.org/dolibarr/public/soo/get_liste_domains.php -O ${FIC}
if [ $? != 0 ]; then
#erreur de transfert ou autre
echo "wget (1) error"
exit
fi
wget -q https://sud-ouest2.org/dolibarr/public/soo/get_liste_virtualhosts.php -O ${FICLISTES}
if [ $? != 0 ]; then
#erreur de transfert ou autre
echo "wget (2) error"
exit
fi
......@@ -29,48 +34,48 @@ REXIT=0
diff ${FIC} /etc/opendkim/reference
if [ $? == 0 ]; then
#aucune modif -> exit
echo "aucune modification de /etc/opendkim/reference -> exit code 1"
rm ${FIC}
REXIT=1
fi
LEXIT=0
diff ${FICLISTES} /etc/opendkim/referencelistes
if [ $? == 0 ]; then
#aucune modif -> exit
REXIT=1
else
REXIT=0
echo "aucune modification de /etc/opendkim/referencelistes -> exit code 2"
rm ${FICLISTES}
LEXIT=1
fi
if [ ${LEXIT} == 0 -o ${REXIT} == 0 ]; then
cp /etc/opendkim/KeyTable.orig /etc/opendkim/KeyTable
cp /etc/opendkim/SigningTable.orig /etc/opendkim/SigningTable
cp /etc/postfix/transport_regexp_listes.orig /etc/postfix/transport_regexp_listes
if [ "${REXIT}" == "1" ]; then
rm ${FICLISTES}
echo "les domaines:"
for domaine in `cat ${FIC}`
do
echo " $domaine"
echo "$domaine $domaine:dkim:/etc/opendkim/dkim.private" >> /etc/opendkim/KeyTable
echo "*@$domaine $domaine" >> /etc/opendkim/SigningTable
done
echo "les listes:"
for domaine in `cat ${FICLISTES}`
do
echo " liste $domaine"
echo "$domaine $domaine:dkim:/etc/opendkim/dkim.private" >> /etc/opendkim/KeyTable
echo "*@$domaine $domaine" >> /etc/opendkim/SigningTable
#/.*@listes\..*/ smtp:${SYMPASRV}
echo "/.*@${domaine}/ smtp:${SYMPASRV}" >> /etc/postfix/transport_regexp_listes
done
cp ${FIC} /etc/opendkim/reference
cp ${FICLISTES} /etc/opendkim/referencelistes
rm ${FIC}
exit
rm ${FICLISTES}
service postfix restart
service opendkim restart
fi
cp /etc/opendkim/KeyTable.orig /etc/opendkim/KeyTable
cp /etc/opendkim/SigningTable.orig /etc/opendkim/SigningTable
cp /etc/postfix/transport_regexp_listes.orig /etc/postfix/transport_regexp_listes
for domaine in `cat ${FIC}`
do
echo " $domaine"
echo "$domaine $domaine:dkim:/etc/opendkim/dkim.private" >> /etc/opendkim/KeyTable
echo "*@$domaine $domaine" >> /etc/opendkim/SigningTable
done
for domaine in `cat ${FICLISTES}`
do
echo " liste $domaine"
echo "$domaine $domaine:dkim:/etc/opendkim/dkim.private" >> /etc/opendkim/KeyTable
echo "*@$domaine $domaine" >> /etc/opendkim/SigningTable
#/.*@listes\..*/ smtp:${SYMPASRV}
echo "/.*@${domaine}/ smtp:${SYMPASRV}" >> /etc/postfix/transport_regexp_listes
done
cp ${FIC} /etc/opendkim/reference
cp ${FICLISTES} /etc/opendkim/referencelistes
rm ${FIC}
rm ${FICLISTES}
service postfix restart
service opendkim restart
Markdown is supported
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