OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
smtp-policy on size regarding...

From: Anant Athavale (anantisac.gov.in)
Date: Fri Mar 17 2006 - 22:33:21 CST


Dear List:

My requirement is allow 5 MB mail from outside, but restrict 1 MB for
sending outside. I have seen in this list that it can be achived
using smtp-policy by using the size value.

I have written a small shell script to achieve this and I have tested
in my test system. I would like to know, if it is OK or needs
improvement (before I deploy on my actual server).

Shell Script:

#!/bin/bash
i=1
while [[ $i -lt 19 ]];do
         read line
         sizeVar=`echo $line|cut -c1-5`
         if [[ $sizeVar = "size=" ]];then
                 size=`echo $line|awk -F= '{print $2}'`
         fi
         let i=$i+1
done
if [[ $size -lt 1048576 ]]
then
         echo "action=dunno"
else
         echo "action=reject Rajecting this mail of size($size)."
fi
echo

#/etc/postfix/master.cf
#127.0.0.1:9998 inet n n n - - spawn
# user=nobody argv=/tmp/policy-server
#/etc/postfix/main.cf
#smtpd_recipient_restrictions =
# reject_unauth_destination
# check_policy_service inet:127.0.0.1:9998
#127.0.0.1:9998_time_limit = 3600

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.