Email filterering on second mailbox (using imap)?

General discussions and other topics.
8 posts Page 1 of 1
by jwermont » Tue May 20, 2014 12:04 pm
Hi,

I read my email through an ssh shell client, and I filter incoming messages through procmail. That works fine for my primary mailbox, but I haven't figured out how to apply the filter to my second address, which uses imap. (I access the mailbox with this command: "mutt -f imap://<username>@imap.sonic.net".)

I get a lot of spam in the second mailbox, but also a lot of legitimate email, so I can't just write off the mailbox. Is there something I need to configure in order to divert emails going to that mailbox into a filter first?

Thanks!
by cdkeen » Tue May 20, 2014 1:17 pm
You need to add a .procmailrc file to the home directory for bastette (like you have added for jwermont!).
cdkeen - Sonic.net System Operations
by jwermont » Tue May 20, 2014 4:19 pm
I didn't even realize I had a home directory for my second mailbox. It's not a separate account - I only pay for one account. It's just a second address and mailbox for my regular account, jwermont.

So I cd'ed to /home/b, and yes, a directory called "bastette" is there. However, I couldn't cd into it - I don't have access. Permission setting on the directory is dwrx------ . It's listed as a "mailbox" directory (whereas /home/j/jwermont is listed as a "user" directory).

Do you know how I can get in there to set up the procmail file?

Thanks,
jwermont
by thulsa_doom » Wed May 21, 2014 12:14 pm
jwermont wrote:Do you know how I can get in there to set up the procmail file?
That's the fun part. But isn't procmail fun enough already? No, nothing's ever quite fun enough.

Because mailbox-only accounts don't have shell or FTP access, some outside intervention by somebody with superuser will be required. Make a file containing the procmail content that you want and put it into a file not named ".procmailrc" in your main account's home directory. Make sure it has permissions that allow "other" to read its contents, but not to write to it (e.g. 705). Have us (our Systems Operations folks can do this) set up a symlink in your mailbox's home directory pointing back to your procmail file on the main account. The symlink will, of course, be named ".procmailrc" so it gets evaluated during mail delivery.

Once we've got the link up and running, you can always update your mailbox's procmail recipes by logging in as your main account and editing the base file.

I'm sure there's a more byzantine solution out there, but I cannot think of one off the top of my head.
John Fitzgerald
Sonic Technical Support
by jwermont » Wed May 21, 2014 12:40 pm
Thanks, I'll call tech support and ask them to do what you've suggested. BTW, in my home directory (jwermont account), the ".procmailrc" file doesn't have much content. All it does is include files from the ".procmail" subdirectory (rc.maillists and log).

I'm planning to use the exact same filtering rules for mail delivered to the bastette mailbox, so could I just have the symlink point to the same .procmail file?

Thanks,
jwermont
by Guest » Sun May 25, 2014 4:10 am
thulsa_doom wrote:Because mailbox-only accounts don't have shell or FTP access, some outside intervention by somebody with superuser will be required. Make a file containing the procmail content that you want and put it into a file not named ".procmailrc" in your main account's home directory. Make sure it has permissions that allow "other" to read its contents, but not to write to it (e.g. 705). Have us (our Systems Operations folks can do this) set up a symlink in your mailbox's home directory pointing back to your procmail file on the main account. The symlink will, of course, be named ".procmailrc" so it gets evaluated during mail delivery.
@thulsa_doom I can't get the symlink method to work... where am I going wrong?

I have 2 sonic accounts with shell access enabled that I am using for testing before I ask ops to setup symlinks in my mailbox accounts.

Basically I took a working .procmailrc file from one account, renamed it .procmailrc-test & put it into my second account's home directory. Then I created a symlink in the first user's directory called .procmailrc that points to the .procmailrc-test file.

Permissions on the .procmailrc-test file are set to 705 as you recommended. I also opened up permissions on the second users home directory.

Mail filtering on the primary account is no longer working, it acts like there is no .procmailrc file at all...

Any advice?
by jon » Sun May 25, 2014 1:30 pm
Permissions on the .procmailrc-test file are set to 705 as you recommended. I also opened up permissions on the second users home directory.
In your testing, you're trying to symlink between two primary (shell login) accounts, which are probably both in the "user" group, as opposed to being in two different groups ("user" and "mailbox"). In this case, you need to enable file access permissions for group rather than other, eg, 750. A good test would be to login to your first account and see if you can follow the symlink and read the .procmailrc-test file in the second account using 'cat .procmailrc'.

When you're done testing, you should probably disable any group access you've enabled to prevent other sonic shell users from being able to see stuff in your home directories.
by Karl » Wed May 28, 2014 8:29 pm
jon wrote:
Permissions on the .procmailrc-test file are set to 705 as you recommended. I also opened up permissions on the second users home directory.
In your testing, you're trying to symlink between two primary (shell login) accounts, which are probably both in the "user" group, as opposed to being in two different groups ("user" and "mailbox"). In this case, you need to enable file access permissions for group rather than other, eg, 750. A good test would be to login to your first account and see if you can follow the symlink and read the .procmailrc-test file in the second account using 'cat .procmailrc'.

When you're done testing, you should probably disable any group access you've enabled to prevent other sonic shell users from being able to see stuff in your home directories.
Thanks for the reply & suggestion. Unfortunately 750 or even 755 permissions on the .procmailrc-test file does not seem to help. I can successfully do a 'cat .procmailrc' from the primary user account and see the contents of the .procmailrc-test file in the secondary user's profile which proves both the permissions & symbolic link are working... where am I going wrong?
8 posts Page 1 of 1