PLESK: Mailserver Statistik und Spammer Detektor
Konfiguration der Email Statistik
Script “/etc/cron.daily/00_awstats_maillog” anlegen:
#!/bin/sh AWSTATS="/usr/lib/cgi-bin/awstats.pl -config=mail" TARGET=/var/www/vhosts/default/htdocs/mailstats $AWSTATS -update $AWSTATS -output -staticlinks > $TARGET/awstats.html for detail in allemails lastemails allemailr lastemailr; do $AWSTATS -output=$detail -staticlinks > $TARGET/awstats.mail.$detail.html done
Nun muss man noch die Rechte auf das Script setzen:
chmod 755 /etc/cron.daily/00_awstats_maillog
Nun wird noch die Konfiguration “/etc/awstats/awstats.mail.conf” für Awstats benötigt:
DirData="/var/www/vhosts/default/htdocs/mailstats/" LogFile="perl /usr/share/doc/awstats/examples/maillogconvert.pl vadmin < /usr/local/psa/var/log/maillog | " LogType=M LogFormat="%time2 %email %email_r %host %host_r %method %url %code %bytesd" SiteDomain="localhost" HostAliases="127.0.0.1 @/var/qmail/control/rcpthosts" LevelForBrowsersDetection=0 # 0 disables Browsers detection. LevelForOSDetection=0 # 0 disables OS detection. LevelForRefererAnalyze=0 # 0 disables Origin detection. LevelForRobotsDetection=0 # 0 disables Robots detection. LevelForSearchEnginesDetection=0 # 0 disables Search engines detection. LevelForKeywordsDetection=0 # 0 disables Keyphrases/Keywords detection. LevelForFileTypesDetection=0 # 0 disables File types detection. ShowSummary=HB ShowMonthStats=HB ShowDaysOfMonthStats=HB ShowDaysOfWeekStats=HB ShowHoursStats=HB ShowDomainsStats=0 ShowHostsStats=HBL ShowRobotsStats=0 ShowEMailSenders=HBML ShowEMailReceivers=HBML ShowSessionsStats=0 ShowPagesStats=0 ShowFileTypesStats=0 ShowOSStats=0 ShowBrowsersStats=0 ShowOriginStats=0 ShowKeyphrasesStats=0 ShowKeywordsStats=0 ShowMiscStats=0 ShowHTTPErrorsStats=0 ShowSMTPErrorsStats=1 DirIcons="/awstats-icon"
Als letzten Schritt für die Mail Statistik sollte man noch folgende Einträge für den Webserver machen und eine eigene Konfiguration “/etc/apache2/conf.d/zzz_mailstats.conf” anlegen:
Alias /awstats-icon /usr/share/awstats/icon Order deny,allow Deny from all # Hinter 127.0.0.1 kann man die eigenen IP-Adressen mit Leerzeichen hinten dazu schreiben Allow from 127.0.0.1
Nun noch schnell eine Auswertung fahren und den Apache Webserver neu starten:
/etc/cron.daily/00_awstats_maillog /etc/init.d/apache2 restart
Plesk Email-Sender Update Script für PLESK 9.x
Mit diesem Script kann man automatisch die Admin Kontakte von den Virtuellen Hosts in die vhosts.conf schreiben und somit einen anderen Absender als nur This e-mail address is being protected from spambots. You need JavaScript enabled to view it. einstellen. Falls keine Emailadresse im Kontakt gefunden wurde, dann wird die Emailadresse vom Administrator verwendet. Für das Script übernehmen wir keine Gewähr und keine Haftung. Jeder der das einsetzt sollte auch verstehen um was es da geht. Folgender Inhalt wird in das Script unter “/etc/cron.daily/mass_plesk_force-sender-email.sh” eingefügt:
#!/bin/bash # mass change plesk vhost.conf to force email sender # by This e-mail address is being protected from spambots. You need JavaScript enabled to view it. # v1.0 PSA_PASSWD=`cat /etc/psa/.psa.shadow` DEFAULT_ADMIN_EMAIL=`mysql -Ns -uadmin -p${PSA_PASSWD} -Dpsa -e "select val from misc where param='admin_email';"` #DEFAULT_ADMIN_EMAIL=" This e-mail address is being protected from spambots. You need JavaScript enabled to view it. " echo $DEFAULT_ADMIN_EMAIL exit 0 echo "select b.name,a.email from clients a,domains b where a.id=b.cl_id AND b.htype='vrt_hst'" | mysql -Ns -uadmin -p`cat /etc/psa/.psa.shadow` -Dpsa |\ while read domain email do if [ -n "$email" ] then echo processing: $domain - admin email: $email else email=$DEFAULT_ADMIN_EMAIL fi CONFIG_FILE="/var/www/vhosts/$domain/conf/httpd.include" if [ -f "$CONFIG_FILE" ] then cd /var/www/vhosts/$domain/conf/ if [ -f vhost.conf ] then cp vhost.conf vhost.conf.save grep -v "php_admin_value sendmail_path" vhost.conf.save > vhost.conf fi echo "php_admin_value sendmail_path \"/usr/sbin/sendmail -t -i -f "$email"\"" >> vhost.conf fi done /opt/psa/admin/bin/websrvmng -av
Nun noch die Rechte setzen und mal ausführen:
chmod 755 /etc/cron.daily/mass_plesk_force-sender-email.sh /etc/cron.daily/mass_plesk_force-sender-email.sh
Viel Spass mit der Mail-Spam-Statistik und beim erziehen eurer Kunden. Das Script wurde bis jetzt nur bis Plesk 9.5 getestet
