#!/bin/sh

scripts=/usr/local/cutedge/openvpn/scripts

((cat /var/log/postfix.log ; cat /var/log/postfix.log.0) | grep 'SASL LOGIN authentication failed:' | awk -F '\\: warning\\: .*\\[|\\]\\: SASL LOGIN' '{print $2}' | sort | uniq ; cat $scripts/mail_threats.txt) | sort | uniq > $scripts/mail_threats.tmp

mv $scripts/mail_threats.tmp $scripts/mail_threats.txt

sudo pfctl -a com.cutedgesystems.fw -f $scripts/fwrules
