procmail
[Top] [All Lists]

Msg size restriction

2001-08-29 16:15:11

    I posted a question on the sendmail list and everyone (so far)
pointed me to procmail as a solution, so, here I am.

    What I'd like to do is restrict the message size on a per user
basis.  Sendmail has a MAXSIZE option in its .cf file, however that
applies to the entire domain (or domains) it's servicing.  What I need
is for it to work on a per user basis so that I can allow some users to
receive large files, and others not.

    Someone on the sendmail newsgroup suggested this:


# Reject files larger than 1Mb:
:0
*> 1000000
*! ^X-Loop: user(_at_)domain(_dot_)com|^From: 
valid(_dot_)user(_at_)domain(_dot_)com
{
:0 c
| (formail -r -I"X-Priority: 1 (Highest)" \
      -A"X-Loop: user(_at_)domain(_dot_)com" ; \
      echo "|||||||||| THIS IS AN AUTOMATED REPLY ||||||||||" ; \
      echo "" ; \
      echo "Sorry, but I don't accept email attachments >1MB without" ;
\
      echo "prior warning. Your mail has therefore been deleted and" ; \

      echo "I have NOT received it." ; \
      echo "" ; \
      echo "If you want to send me a large file, ask me first, telling"
; \
      echo "me what it is and why I need it. I'll then add you to my" ;
\
      echo "accepted senders list if it sounds worthwhile." ; \
      echo "" ; \
      echo "Thanks." \
   ) | $SENDMAIL -oi -t

:0
/dev/null
}


    The problem with this is, I'd have to create it for each and every
user and nothing is going to stop them from removing that file.  Ideally
I'd want:

    - a site-wide (machine wide) recipe
    - have it check a flat file for users, with their size restriction
      (I'm guessing something like: DEFAULT_LIMIT    75000
                                    userA          1000000
                                    userB           150000
                                    userF        999999999)
    - if the msg received, is larger than the user's allowed size:
      + send a reply to the sender, saying their msg got pitched
      + pipe the msg to /dev/null
      + tell the recipient...not a damned thing
    - and if the msg received falls within their restriction, pass it on
like nothing ever happened.


    Is this even doable?  Is the flat file idea sane?

--
W | I haven't lost my mind; it's backed up on tape somewhere.
  +--------------------------------------------------------------------
  Ashley M. Kirchner <mailto:ashley(_at_)pcraft(_dot_)com>   .   303.442.6410 
x130
  IT Director / SysAdmin / WebSmith             .     800.441.3873 x130
  Photo Craft Laboratories, Inc.            .     3550 Arapahoe Ave. #6
  http://www.pcraft.com ..... .  .    .       Boulder, CO 80303, U.S.A.


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>