I have several ex-employee accounts that are still getting mail. The data structures in their directories are something we want to keep. so we don't want to delete the accounts. Is there any way to close a mailbox in Linux so that incoming mail just bounces (user unknown or something?) -- _____________________________________ John Andersen
* John Andersen <jsa@pen.homeip.net> [01-20-05 01:15]:
I have several ex-employee accounts that are still getting mail. The data structures in their directories are something we want to keep. so we don't want to delete the accounts.
Is there any way to close a mailbox in Linux so that incoming mail just bounces (user unknown or something?)
add line to /etc/postfix/header_checks: /^To:.*<user-name>@<domain>/ REJECT <optional text reason> then run: postmap /etc/postfix/header_checks rcpostmap restart or chmod a-w /var/spool/mail/<user-name> The first is the cleanest, rejects mail from reading header before downloading body and *may* provide a reason for the reject to the sender. The second is the easiest. Easy !== Better -- Patrick Shanahan Registered Linux User #207535 http://wahoo.no-ip.org @ http://counter.li.org HOG # US1244711 Photo Album: http://wahoo.no-ip.org/photos
Patrick wrote regarding 'Re: [SLE] Locking a mailbox?' on Thu, Jan 20 at 07:26:
* John Andersen <jsa@pen.homeip.net> [01-20-05 01:15]:
I have several ex-employee accounts that are still getting mail. The data structures in their directories are something we want to keep. so we don't want to delete the accounts.
Is there any way to close a mailbox in Linux so that incoming mail just bounces (user unknown or something?)
add line to /etc/postfix/header_checks: /^To:.*<user-name>@<domain>/ REJECT <optional text reason> then run: postmap /etc/postfix/header_checks rcpostmap restart
Adding extra header checks is slow, since all of the regexps in that file get checked against each line in each header of every message. Better would be to add check_recipient_access to whatever other rules might already be in smtpd_recipient_restrictions (add it first so other rules don't short-circuit it): /etc/postfix/main.cf: smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/oldusers, /etc/postfix/oldusers: user1@ourdomain REJECT <optional reason> user2@ REJECT <another reason> Don't forget to run postmap on /etc/postfix/oldusers each time you change that file. Check out man 5 access for the format of the file - if you have multiple domains that you wanna close the address for, you may well want to use the "user@" syntax for the pattern. Actually, I use "relocated_maps" for this purpose, so I can provide the sender with a forwarding address without forwarding it myself. That's what relocated_maps is for. It works the same way - you'd just "specify relocated_maps = /etc/postfix/oldusers" instead of adding recipient restrictions. It's worth noting that you can delete a user account without deleting their files - though for convenience sake, you may consider changing the file ownership beforehand (and make sure that you don't pass "-r" as an argument to userdel!!). I usually change the ownership to a user named "retired"... --Danny, who seems to have finally gotten list posting to work again :)
On Thursday 20 January 2005 04:25 am, Patrick Shanahan wrote:
* John Andersen <jsa@pen.homeip.net> [01-20-05 01:15]:
I have several ex-employee accounts that are still getting mail. The data structures in their directories are something we want to keep. so we don't want to delete the accounts.
Is there any way to close a mailbox in Linux so that incoming mail just bounces (user unknown or something?)
add line to /etc/postfix/header_checks: /^To:.*<user-name>@<domain>/ REJECT <optional text reason> then run: postmap /etc/postfix/header_checks rcpostmap restart
Ouch, then I'd have to install postfix... ;-) Sort of forgot that detail, I'm running Sendmail - procmail -- _____________________________________ John Andersen
John wrote regarding 'Re: [SLE] Locking a mailbox?' on Thu, Jan 20 at 15:30:
On Thursday 20 January 2005 04:25 am, Patrick Shanahan wrote:
* John Andersen <jsa@pen.homeip.net> [01-20-05 01:15]:
I have several ex-employee accounts that are still getting mail. The data structures in their directories are something we want to keep. so we don't want to delete the accounts.
Is there any way to close a mailbox in Linux so that incoming mail just bounces (user unknown or something?)
add line to /etc/postfix/header_checks: /^To:.*<user-name>@<domain>/ REJECT <optional text reason> then run: postmap /etc/postfix/header_checks rcpostmap restart
Ouch, then I'd have to install postfix... ;-)
It's a drop-in replacement, as far as the binary locations are concerned - and the config file's much easier to parse. Maybe this'd be a good time to switch over to a good MTA. ;)
Sort of forgot that detail, I'm running Sendmail - procmail
You could alias them to an unknown user - that'd get the "user unknown" message, and be just as ugly as an M4 file... You could alias them to /dev/null, but you're wasting a small amount of bandwidth that way. --Danny, who hates sendmail (bad experiences)
On Thursday 20 January 2005 12:49 pm, Danny Sauer wrote:
You could alias them to an unknown user - that'd get the "user unknown" message, and be just as ugly as an M4 file... You could alias them to /dev/null, but you're wasting a small amount of bandwidth that way.
I'll try that, (alias > unknown) because if it works i don't have to accept the mail, and it purges the spammers lists. Thanks for the tip. Jsa - who still likes sendmail but is not a fanatic about it. -- _____________________________________ John Andersen
John wrote regarding 'Re: [SLE] Locking a mailbox?' on Thu, Jan 20 at 15:55:
On Thursday 20 January 2005 12:49 pm, Danny Sauer wrote:
You could alias them to an unknown user - that'd get the "user unknown" message, and be just as ugly as an M4 file... You could alias them to /dev/null, but you're wasting a small amount of bandwidth that way.
I'll try that, (alias > unknown) because if it works i don't have to accept the mail, and it purges the spammers lists. Thanks for the tip.
Jsa - who still likes sendmail but is not a fanatic about it.
Ohhh, I'm a postfix fanatic, all right. :) BTW, there's probably something more "right" that will do this. Look into setting up "check_rcpt" and a database of users - the idea's the same as the postfix suggestion. http://www.sendmail.org/~ca/email/check.html#check_rcpt http://www.sendmail.org/m4/anti_spam.html Looks like it's probably easiest to deny relaying to particular addresses, based on a cursory overview of an MTA which I last used almost a decade ago, and didn't fully understand at that point. :) --Danny, done poking fun as sendmail, for now
Thu, 20 Jan 2005, by jsa@pen.homeip.net:
On Thursday 20 January 2005 04:25 am, Patrick Shanahan wrote:
* John Andersen <jsa@pen.homeip.net> [01-20-05 01:15]:
I have several ex-employee accounts that are still getting mail. The data structures in their directories are something we want to keep. so we don't want to delete the accounts.
Is there any way to close a mailbox in Linux so that incoming mail just bounces (user unknown or something?)
add line to /etc/postfix/header_checks: /^To:.*<user-name>@<domain>/ REJECT <optional text reason> then run: postmap /etc/postfix/header_checks rcpostmap restart
Ouch, then I'd have to install postfix... ;-) Sort of forgot that detail, I'm running Sendmail - procmail
FYI: Postfix has a special map type for this: relocated_maps (default: empty) Optional lookup tables with new contact information for users or domains that no longer exist. The table format and lookups are docu- mented in relocated(5). Senders will get a useful new email-address for the relocated user instead of just a rude reject. Theo -- Theo v. Werkhoven Registered Linux user# 99872 http://counter.li.org ICBM 52 13 26N , 4 29 47E. + ICQ: 277217131 SUSE 9.2 + Jabber: muadib@jabber.xs4all.nl Kernel 2.6.8 + MSN: twe-msn@ferrets4me.xs4all.nl See headers for PGP/GPG info. +
participants (4)
-
Danny Sauer
-
John Andersen
-
Patrick Shanahan
-
Theo v. Werkhoven