3 rm -f /var/run/alternc-ssl/generate_certif_alias
5 # Launched by incron when /tmp/generate_certif_alias exists
6 # regenerate the list of global aliases used by Comodo for certificate ownership validation
7 # FIXME: how do we lock that, ensuring we don't launch this more than once ?
8 APACHECONF=/etc/apache2/conf.d/alternc-ssl_cert-alias.conf
9 TMP=/tmp/alternc-ssl_cert-alias_${$}.tmp
10 FILEDIR=/var/lib/alternc/ssl-cert-alias
16 echo "# this file is autogenerated from /usr/lib/alternc/ssl_alias_manager.sh" >$TMP
17 echo "# Please do not edit, your changes will be overwritten" >>$TMP
19 mysql --defaults-file=/etc/alternc/my.cnf --skip-column-names -B -e "SELECT name,content FROM certif_alias;" | while read name content
21 echo "alias /$name ${FILEDIR}/${name}" >>$TMP
22 echo "$content" >"${FILEDIR}/${name}"
24 if ! diff -q "$TMP" "$APACHECONF"
26 mv -f "$TMP" "$APACHECONF"
27 service apache2 reload