Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How do I set up a email whitelist using only procmailrc to protect my kids from unwanted email?

I currently us the OS parental controls, but that is only good for the computer it is enabled on.

I understand that as my kids grow up, they'll figure out work arounds to any technical parental restrictions imposed upon them, but I want to at least understand the options that I have until then.

share|improve this question
    
I've done this for sending reminders to my phone - I'll post the recipe when I can ssh to my server :) –  warren Sep 14 '09 at 12:33
    
added the whitelist recipe as promised :) –  warren Sep 16 '09 at 12:59
    
Nice stuff. I'll have to try this out as well. –  pave Sep 16 '09 at 13:07

3 Answers 3

up vote 1 down vote accepted

procmail can filter by the From header, and there are many recipe examples.

# This one discards all mail sent from the address below.
:0
* ^From: idiot@somehost.com
/dev/null

But don't forget that procmail only works with locally delivered mail. It won't affect mailboxes accessed over IMAP or webmail.

share|improve this answer
    
This is a blacklist recipe. Do you know how to do it the opposite? Such as only allow mail from certain addresses. –  hanleyp Sep 5 '09 at 16:59
1  
Just change the recipe to use ${DEFAULT} as the mailbox, then add a second recipe that routes the rest to /dev/null. –  grawity Sep 6 '09 at 8:07
    
Thanks. I'll accept the answer once I have a chance to try it out. –  hanleyp Sep 9 '09 at 13:32
    
@RoninTom's answer is simpler and more to the point. –  tripleee May 17 '13 at 8:10

I think we have not any solution yet, that exactly solves the initial problem. Therefore, I would like to provide a more explicit approach. Lets suppose, that our whitelist looks like this:

white.domain.tld
light.domain.tld

Then I would try the following reciept:

:0
* !^From.*@white\.domain\.tld
* !^From.*@light\.domain\.tld
/dev/null

This would send all emails that are not from somebody@white.domain.tld and not from somebody@light.domain.tld to /dev/null. The remaining emails are send to the default destination. Be aware to use \. in your pattern if you like to match a single dot. The pattern . matches a single character.

If you have a short whitelist, you could try to get an even shorter reciept by combining the patterns:

:0
* !^From.*@(white|light)\.domain\.tld
/dev/null

Be aware to use ( ) here. Using [ ] would be a mistake.

share|improve this answer

The one I use to send messages from myself to my phone:

VERBOSE=off
LOGFILE=/dev/null

# if it comes from a specific address(es), send to my cell
# it's be just as easy to whitelist a domain by adding another `|domain.tld` section to the bracketed regex
:0
* ^From.*[main.email.domain.tld|other.email.domain.tld]
* ^To.*datente
! 0000000000@vtext.com

# push everything else to my normal user
:0 
* .
! mainuser
share|improve this answer
    
also note: I intentionally only gather email sent to the one domain, not any others hosted on the same server –  warren Sep 18 '09 at 5:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.