#!/bin/zsh # # Ein Skript, das fuer jede Splinenutzerin eine # Subdomain [.userpage].spline[.inf.fu-berlin].de # anlegt. # 2003-04-09 [stb] # 2003-05-25 [yann] Anpassung um Logfiles und cgi-bin # 2005-11-15 [stb] Anpassung an neues Serverlayout # 2005-11-16 [yann] Ergaenzung ohne "userpage" # exec 3>&1 if [[ "$1" != "--debug" ]] then exec >/dev/null fi SPLINEUSERS=$(ldapsearch -LLL -x -b "ou=People,dc=spline,dc=inf,dc=fu-berlin,dc=de" uid | grep "^uid" | cut -d" " -f2 | sort) TMPFILEDNS=/tmp/cnames$(date -Is) TMPFILEAPACHE=/tmp/apacheVirtuals$(date -Is) cat <> $TMPFILEDNS ; ; Diese Datei (USERPAGE_generated) -- bzw. alles, was ab ; hier kommt -- wird automatisch generiert! ; ; Eintragungen von Hand sind sinnlos! ; ; Siehe /usr/local/bin/userSubGenerate ; ; Fuer jede Nutzerin bei spline gibt es eine Subdomain ; [.userpage].spline[.inf.fu-berlin].de, die dann vom ; Apache auf ~ aufgeloest wird. ; EOF cat <> $TMPFILEAPACHE # Fuer jede Nutzerin bei spline gibt es eine Subdomain # [.userpage].spline[.inf.fu-berlin].de, die vom # Apache auf ~ aufgeloest wird. EOF echo "Generiere $TMPFILEDNS und $TMPFILEAPACHE ..." >&3 for SPLINEUID in $(echo $SPLINEUSERS) do FULLNAME=$(ldapsearch -LLL -x -b "dc=spline,dc=inf,dc=fu-berlin,dc=de" "(uid=$SPLINEUID)" cn | grep "^cn" | cut -d" " -f2-) cat <> $TMPFILEDNS ; $SPLINEUID.userpage.spline[.inf.fu-berlin].de fuer $FULLNAME $SPLINEUID.userpage IN CNAME userpage.spline.inf.fu-berlin.de. www.$SPLINEUID.userpage IN CNAME userpage.spline.inf.fu-berlin.de. $SPLINEUID IN CNAME userpage.spline.inf.fu-berlin.de. www.$SPLINEUID IN CNAME userpage.spline.inf.fu-berlin.de. EOF if [[ -d /var/users/$SPLINEUID/public_html ]] then cat <> $TMPFILEAPACHE # http://$SPLINEUID.userpage.spline[.inf.fu-berlin].de fuer $FULLNAME SSLEngine off ServerAlias $SPLINEUID.userpage.spline.inf.fu-berlin.de ServerAlias $SPLINEUID.userpage.spline.de ServerAlias $SPLINEUID.spline.de ServerAlias $SPLINEUID.spline.inf.fu-berlin.de ServerAlias www.$SPLINEUID.userpage.spline.inf.fu-berlin.de ServerAlias www.$SPLINEUID.userpage.spline.de ServerAlias www.$SPLINEUID.spline.de ServerAlias www.$SPLINEUID.spline.inf.fu-berlin.de ErrorLog /var/users/$SPLINEUID/public_html/logs/error.log CustomLog /var/users/$SPLINEUID/public_html/logs/access.log combined DocumentRoot /var/users/$SPLINEUID/public_html/webroot ScriptAlias /cgi-bin/ /var/users/$SPLINEUID/public_html/cgi-bin/ AllowOverride All Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec Options ExecCGI Order allow,deny Allow from all EOF fi done echo "Kopiere $TMPFILEAPACHE nach userpage:/var/www/apache-config-userpage.spline.de ..." >&3 scp $TMPFILEAPACHE www-data@userpage.spline.inf.fu-berlin.de:apache-config-userpage.spline.de echo "Starte den Apache auf userpage neu." >&3 ssh www-data@userpage.spline.inf.fu-berlin.de sudo /usr/sbin/apache2ctl graceful echo "Kopiere $TMPFILEDNS nach /etc/bind/dns-sources/USERPAGE_spline" >&3 cp -f $TMPFILEDNS /etc/bind/dns-sources/USERPAGE_spline echo "Erstelle die DNS-Eintraege neu" >&3 cd /etc/bind/dns-sources make mrproper && make && make serial && make install || echo "Fehler beim Erstellen der neuen DNS-Eintraege." >&3 rm $TMPFILEAPACHE rm $TMPFILEDNS