On Wed, Feb 18, 2009 at 3:59 AM, Rocco Scappatura
<rocco.scappat...@infracom.it> wrote:

> My aim, anyway, is to apply a such policy for outgoing messages
> (including internal-to-internal messages). So I have to define a group
> which contains the IPs enabled for relay through my mail server.

smtpd_end_of_data_restrictions = check_policy_service inet:foo:12345

Postfix will send something like:

request=smtpd_access_policy
protocol_state=END-OF-MESSAGE
protocol_name=ESMTP
client_address=1.2.3.4
client_name=4.3.2.1.rfc1918.com
reverse_client_name=4.3.2.1.rfc1918.com
helo_name=[1.2.3.4]
sender=sen...@example.com
recipient...@domain.org
recipient_count=1
instance=581.4821e789.60a46.0
size=500
etrn_domain=
sasl_method=PLAIN
sasl_username=sen...@example.com
sasl_sender=
ccert_subject=
ccert_issuer=
ccert_fingerprint=
encryption_protocol=
encryption_cipher=
encryption_keysize=0

Take the "sasl_username", and use it as a key to lookup the number of
messages sent in your homebrew database.  Then add an entry with a
count equal to "recipient_count".  If the number < some pre-defined
threshold within time period, then allow it.  Otherwise reject it with
some meaningful text.

Reply via email to