This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Mail per Cronjob (mit Datei)

Hallo,

ein Kunde von uns möchte gerne per Mail informiert werden welche Mails anhand von RBL Einträgen abgewiesen wurden. Leider finde ich auf der Website der UTM keine Einstellungen dazu und wollte dieses nun per cron direkt machen. Leider funktioniert aber der Cronjob, welcher auf einem Linux System funktioniert, nicht auf der Sophos und ich finde aktuell keinen Weg dieses zu realisieren.

Vielleicht hat aber hier einer einen Hinweis oder eine zündende Idee womit es doch funktioniert kann. Hier die aktuelle Zeile:

58 22 * * * root grep "@fqdn" /var/log/smtp.log | grep -v 450 | grep blacklisted | uuencode maillog.txt | mail -s "Ablehnungen Mailserver" empfänger@fqdn



This thread was automatically locked due to age.
Parents
  • OK Jörg, I finally found my note...

    You might want to make a bash script like JasonIstre suggests for a whitelist email...

    cd /home

    grep "@fqdn" /var/log/smtp.log | grep -v 450 | grep blacklisted |grep -oP 'F=<.*@.*>' |grep -oP '@.*' |sed s/\<\ Acc// |sort |uniq -c |sort -nr > blacklist

    echo "subject:Ablehnungen Mailserver" > blacklist.msg
    echo "To:empfänger@fqdn" >> blacklist.msg
    cat blacklist |awk '{printf "%s,*%s\n",$1,$2}' >> blacklist.msg
    cat blacklist.msg | sendmail -F "UTM - Ablehnungen" -f valid_account@fqdn -t

    MfG - Bob (Bitte auf Deutsch weiterhin.)

     
    Sophos UTM Community Moderator
    Sophos Certified Architect - UTM
    Sophos Certified Engineer - XG
    Gold Solution Partner since 2005
    MediaSoft, Inc. USA
  • Hi,

    ok it doenst work when you try to send the mail with a entry in the crontab. You have to make a Script, which you call in the crontab. Here is the script which is working atm for me:

    #!/bin/sh
    export PATH="/sbin:/usr/sbin:/root/bin:/usr/local/bin:/usr/bin:/bin"
    (
            echo Subject: <Subject>
            echo ""
            grep "fqdn" /var/log/smtp.log | grep -v 450 | grep blacklisted
    ) | \
            sendmail -f <sender mailadress> <recipient mailadress>

Reply
  • Hi,

    ok it doenst work when you try to send the mail with a entry in the crontab. You have to make a Script, which you call in the crontab. Here is the script which is working atm for me:

    #!/bin/sh
    export PATH="/sbin:/usr/sbin:/root/bin:/usr/local/bin:/usr/bin:/bin"
    (
            echo Subject: <Subject>
            echo ""
            grep "fqdn" /var/log/smtp.log | grep -v 450 | grep blacklisted
    ) | \
            sendmail -f <sender mailadress> <recipient mailadress>

Children
No Data