PDA

View Full Version : Delete or disable domain@domain.com POP account?



maida
10-23-2003, 06:28 PM
Is there a way to disable or delete the domain@domain.com? It gets a lot of SPAM and we don't even use the POP account.

Thanks in advance for any help,

Maida

wildjokerdesign
10-23-2003, 07:15 PM
I belive that if you remove the catch-all from your account it would disable the domain@domain.com but not for sure. You could give it a try.

maida
10-23-2003, 09:11 PM
Nope, that doesn't do it. I always disable the catch all account. :(

It's a good thought, though.

Any ideas from the procmail experts? Not that I have ever done anything with procmail ever. :oops:

FZ
10-27-2003, 10:47 AM
maida,

You rang? ;) Actually, I'm not a Procmail expert. I just experiment a lot, especially with Procmail since I get way too much Spam. Anyway you can't really disable it, but what you could do is just delete all mail sent to this account unconditionally, and if you like, you could bounce it as well. I wouldn't recommend the second option unless you really need it though. Let me know if you want me to help you out with this.

maida
10-27-2003, 12:37 PM
If I could just delete the mail, that is good enough for me.

Now, be easy on me...I've never configured procmail before. :?

So, how do I start?

Maida

FZ
10-27-2003, 01:18 PM
Since you are not familiar with Procmail, we need to take a slightly longer route in testing this, because I don't want you to lose mail you need. The file you need it edit is the procmailrc file in your /etc folder. The first thing you should do is back up the existing version (either download it, or make a copy of it or rename the original). Then open it (not the backup, but the copy) with a text editor such as Notepad (assuming you are downloading the file via FTP). Add the following lines to the bottom of it (keep the spacing, etc. exactly as is):


:0:
* ^TO_domain@domain.com
/deletedmail


Replace domain@domain.com with the relevant e-mail address. Re-upload the file as necessary. Upload it in ASCII/plain text mode, and then CHMOD 644 procmailrc. Now send yourself a test mail to the address (from an external, non-WestHost mail account). Send another e-mail to another address on your account (to make sure that only the mail you want deleted is being deleted). To check if it is working, navigate to your root directory (/). There should be a new file there called deletedmail. Delete this file, re-edit procmailrc and replace /deletedmail with /dev/null - i.e. you would change it so that the lines now read:


:0:
* ^TO_domain@domain.com
/dev/null


Now send yourself some more test mail - one to the address and one to another address on your domain. If the second one comes through, then you know you're all set ;)

maida
10-27-2003, 05:03 PM
Well, that's weird.

I did the first trial and sent an email to domain@domain.com and alias@domain.com and another to anotheruser@domain.com from my yahoo account.

I got the email from alias@domain.com

I did not receive the email at anotheruser@domain.com

I did not receive the email from domain@domain.com

I did not find a /deletedmail directory in the root.

Just to confirm...644 is rw-r--r-- right?

Any ideas? Here's my entire procmail file.


# Added By HostDir
VERBOSE = "no"
LOGABSTRACT = "no"
SHELL = "/bin/sh"

RESIDUE = `/bin/procmail_checker $DEFAULT $LOGNAME 2>/dev/null`
:0
* ? test $RESIDUE != "unlimited"
{
:0
* > $RESIDUE
{
LOGFILE=/proc/self/fd/2
LOG="554 - Mailbox quota exceeded by $LOGNAME
"
EXITCODE=69
:0
/dev/null
}
}
:0:
^TO_domain@domain.com
/deletedmail

Where domain is replaced by my actual account frumpy

FZ
10-28-2003, 06:08 AM
Well, that looks fine to me. Don't think it should make a difference, but you might want to try adding an extra (blank) line between the } and the :0:

Apart from that, yes, those permissions are correct. And the deletedmail is a file, not a directory (but it is supposed to show up in root). Also, make sure you upload it in ASCII/plain text mode.

maida
10-28-2003, 09:17 AM
Hmmm...

Still not working. :( I added the blank line and even deleted any extra spaces after each line.

Still the same result. I get no mail at either user account AND there is no deletedmail file in the root directory.

I double checked the permissions and also that it is in ASCII mode when I FTP the file.

Bummer! I can't even implement a simply procmail command. :?

Any other thoughts?

Maida

FZ
10-28-2003, 10:15 AM
That does suck :( Let's try something else. Restore your original procmailrc file. Then, add those 3 lines in a new blank file. Upload the file to your root directory (/) in ASCII mode, rename it to .procmailrc (note the . before the name this time round) and then CHMOD it 644. Then repeat the testing process to see if it works or not.

qwerty
10-28-2003, 12:27 PM
:0:
^TO_domain@domain.com
/dev/null <----

Just go straight to the /dev/null and it should work. That's how my procmailrc is configured to delete particular addressing for my catchall. Works like a clarm for me.[/code]

maida
10-28-2003, 01:11 PM
I feel really dumb. :?

I tried creating a .procmailrc file with my original procmailrc file restored, and all email got through to each account

AND

just going straight to /dev/null with the same results...no email got through to any account at all.

Why can't I make this work? Is my procmail not turned on or something?

What permissions should be on the /etc directory? drwxr-xr-x

Here's everything in my /etc directory:


-rw-r--r-- 1 frumpy vuser 38 Oct 28 13:02 .procmailrc
-rw-r--r-- 1 frumpy vuser 118 Oct 7 12:38 .qpopper-options
-rw-r--r-- 1 frumpy vuser 52 Jun 23 06:02 .qpopper-options.123807102003
lrwxrwxrwx 1 root root 12 Aug 22 15:02 TIMEZONE -> default/init
lrwxrwxrwx 1 root root 12 Aug 22 15:02 aliases -> mail/aliases
drwxr-xr-x 2 frumpy vuser 4096 Aug 22 15:02 default
-r--r--r-- 1 root root 43 Aug 22 15:03 denied_ports
drwx------ 2 root root 4096 Sep 14 16:47 depend
-rw-r--r-- 1 frumpy vuser 170 Oct 10 11:04 features
-rw-r--r-- 355 root root 382 Oct 25 13:58 fstab
-rw-r--r-- 1 frumpy vuser 777 Aug 22 15:03 ftpaccess
drwxr-xr-x 2 frumpy vuser 4096 Aug 22 15:02 ftpd
-rw-r--r-- 1 frumpy vuser 31 Jun 23 06:02 ftpdir
-rw-r--r-- 1 frumpy vuser 16 Oct 10 11:04 ftpusers
-rw-r--r-- 1 frumpy vuser 373 Aug 22 15:03 group
drwxrwxr-t 6 root vuser 4096 Oct 16 23:19 hd
-rw-r--r-- 1 frumpy vuser 64 Aug 22 15:03 hosts
drwxr-xr-x 3 frumpy vuser 4096 May 22 03:51 httpd
-rw-r--r-- 1 frumpy vuser 8553 Sep 18 04:02 ld.so.cache
-rw-r--r-- 1 frumpy vuser 20 Apr 6 2003 ld.so.conf
-rw-r--r-- 355 root root 877 Jun 4 06:39 localtime
-rw-r--r-- 1 frumpy vuser 519 Jun 23 06:02 logrotate.conf
drwxrwxr-t 2 root vuser 4096 Sep 14 16:47 logrotate.d
-rw-r--r-- 1 frumpy vuser 4707 Nov 26 2001 lynx.cfg
drwxr-xr-x 2 frumpy vuser 4096 Oct 27 16:49 mail
-r--r--r-- 1 frumpy vuser 12704 Jun 23 06:02 mime.types
-rw-r--r-- 355 root root 246 Oct 25 13:58 mtab
-rw-r--r-- 1 frumpy vuser 1064 Jun 23 06:02 netconfig
-rw-r--r-- 1 frumpy vuser 11 Aug 22 15:03 nodename
-rw-r--r-- 1 frumpy vuser 688 Jun 23 06:02 nsswitch.conf
-rw-r--r-- 1 frumpy vuser 672 Oct 10 11:04 passwd
lrwxrwxrwx 1 frumpy vuser 24 Aug 22 15:03 php.ini -> ../usr/local/lib/php.ini
-rw-r--r-- 1 frumpy vuser 319 Oct 28 09:12 procmailrc
-rw-r--r-- 1 frumpy vuser 359 Oct 28 09:03 procmailrc.new
-rw-r--r-- 1 frumpy vuser 1567 Jan 12 2000 protocols
drwxrwxr-t 4 root vuser 4096 Aug 22 15:02 rc.d
-rw-r--r-- 1 frumpy vuser 71 Oct 27 12:42 resolv.conf
lrwxrwxrwx 1 root root 16 Aug 22 15:02 sendmail.cf -> mail/sendmail.cf
-rw-r--r-- 1 frumpy vuser 3267 Jun 23 06:02 services
-r-------- 1 frumpy vuser 352 Oct 10 11:04 shadow
-r-------- 1 frumpy vuser 572 Sep 2 21:48 shadow.fixbak
-rw-r--r-- 1 frumpy vuser 30 Jun 23 06:02 shells
drwxr-xr-x 2 frumpy vuser 4096 Aug 22 15:02 smrsh
drwxr-xr-x 2 frumpy vuser 4096 Aug 22 15:02 sysconfig
-rw-r--r-- 355 root root 737535 Jul 20 2001 termcap
drwx------ 10 frumpy vuser 4096 Sep 3 16:45 virt_users
-rw------- 1 frumpy vuser 47 Sep 3 10:38 web_mails
[/quote]

FZ
10-28-2003, 01:37 PM
qwerty,

The reason I suggested moving it to a mailbox first was because I did not want it to delete legitimate mail in the case of a "malfunction". Once we determined that it was creating the mailbox file properly and working properly, we would have changed it to /dev/null

---

maida,

The new .procmailrc has to be in your root folder, i.e. the / folder, NOT /etc - just move it to your root folder and test again. Oh and don't feel dumb, these things happen... It just turns out to be one silly mistake somewhere, you're going to laugh when you see it :lol:

maida
10-28-2003, 01:59 PM
Ah ha! I should have read your instructions completely. :oops:

It did something interesting...it created a file in my root directory called ^TO_domain@domain.com instead of deletedmail

So, I changed it to /dev/null and it seems to be working.

What is /dev/null anyway? :?

Thanks for helping me out with this!

I feel better about my brain already. :wink:

Maida

torrin
10-28-2003, 05:20 PM
What is /dev/null anyway? :?

It's a psuedo device file. It allows you to send data to a file that doesn't really exist. The data just disappears. It's mostly used when you don't want to output from some command. I'd use it when I call a command from a script in cron. I'll see if I can find an example when I get home.

That's about as much as I know about that. For a more detail explaination, you might want to take a look at the kernel source (http://www.kernel.org).

maida
10-28-2003, 11:07 PM
Thanks everyone for your input, info and knowledge! :D

I'm sure I'll be here again some day asking for more help...

You rock!

Maida

FZ
10-29-2003, 08:00 AM
maida,

Hmm... That ^TO... file means there is something still wrong here, but at least it is partially working. Now you say you have changed it to /dev/null - is it working completely now? Did you test it?

If I had to explain what /dev/null is, I'd say it was the equivalent of a Windows Recycle Bin - except that there is no way to retrieve files sent to it like you would with the Recycle Bin (i.e. /dev/null is used to delete things permanently).

maida
10-29-2003, 09:23 AM
maida,

Hmm... That ^TO... file means there is something still wrong here, but at least it is partially working. Now you say you have changed it to /dev/null - is it working completely now? Did you test it?

Oh, dang it! :x

I just checked and now it is sending all the mail to that ^TO_domain@domain.com file instead of going to /dev/null

I tried adding the trailing / and made it /dev/null but that didn't work

I even tried removing the leading / and made it dev/null/ but that didn't work either

I added the code that's at the top of the other procmailrc file but that didn't work either...


# Added By HostDir
VERBOSE = "no"
LOGABSTRACT = "no"
SHELL = "/bin/sh"

:0:
^TO_domain@domain.com
/dev/null

Any other ideas? :oops:


:0:
^TO_domain@domain.com
/dev/null

Seems pretty straightforward... :?

Maida

FZ
10-29-2003, 10:22 AM
Hmm, I think its time you mailed me your files so I can take a look at them myself. Please e-mail your /etc/procmailrc and your /.procmailrc files (address: fayez at impenetrable.org)

hipstergk
10-29-2003, 11:27 AM
i'm still new to this procmail stuff, but just thought i'd throw my 2cents in.
what if you created a procmail file using notepad and use the following:


MAILDIR=/
LOGFILE=procmail.log
#VERBOSE=YES
LOGABSTRACT=YES
SHELL=/bin/sh

:0:
* ^To:domain@domain.com
/dev/null

save this as .procmailrc & don't forget the "." at the beginning. remove the .txt at the end if notepad added it and make sure to put this file in your / (root). also make sure to uploaded in ASCII format and CHMOD to 644.

then try sending some test mail again from an account outside of westhost(aol, yahoo, msn). send 1 to domain@domain.com, and 1 to anotheruser@domain.com. hopefully the 1st one gets dumped and the 2nd will get through.

but don't hold me to anything, like i said...i'm still new to this procmail stuff :wink:

FZ
10-29-2003, 11:57 AM
Hi hipstergk,

Thanks for the contribution. Your code is all correct, except for one small mistake, which I thought I should point out to you:


* ^To:domain@domain.com

That isn't a very good condition, and here is why: The above will only match mail that is sent to domain@domain.com. It will NOT match mail sent in the format "Person's Name" <domain@domain.com> Also, since you have no space after the : (a space that is required and is always there), your condition won't match anything at all!

To correct this problem, you have two alternative conditions to choose from:


* ^To.*domain@domain.com

This will match mail sent to the address directly, or in the format of the person's name followed by their address.

OR


* ^TO_domain@domain.com

Which is the best possible option, because TO_ is a special "condition" which will match the To:, CC:, BCC:, etc. headers - i.e. any header that specifies who the recipient for the e-mail is. The other option will only match on a To: header containing the address.

Hope that helps.

hipstergk
10-29-2003, 12:31 PM
hey fz,

thanks for the correction. i always seem to find your posts a great resource. i actually use a procmail file on my site created with info from some other posts of yours, and it works wonders to clean up the spam mail i get.

i was just trying to adjust my procmail file to fit this situation but wasn't 100% sure if it would work. but now i know, thanks for the input!

...and looking forward to future learning :)

FZ
10-29-2003, 12:52 PM
Uh oh :cry: I deserve to be shot. The cause of all the angst here has been me all along. That "silly mistake" was mine, and I am really, really sorry. Here's what was wrong with my very first post:


INCORRECT:

^TO_domain@domain.com


CORRECT:

* ^TO_domain@domain.com


I missed the #!$*%!&! star (*), which is required to mark the beginning of a condition. This is the reason all your mail was being moved to a file called ^TO..., maida. I've corrected the necessary posts.

Again, I'm really sorry for the mistake. I can't even begin to describe how embarassed I feel :oops:

Some help I was this time round!

---

hipstergk: I'm glad you find my posts helpful. As you can see though, I'm not always correct (as hard as I try!) - which is why I always mention backing up and moving to a mailbox file and testing thoroughly instead deleting mail straight away!

maida
10-29-2003, 01:03 PM
YAY! :D

It's working, it's working!

Thanks FZ...for everything. As you said before, it's always the little things that get you :wink:

I still think you all rock! :lol:

Maida

FZ
10-29-2003, 01:24 PM
Cool :D