Linux Forums - Linux Help,Advice & support community:LinuxSolved.com

Network Troublshooting => Linux Servers Support => Topic started by: sandeepvson on October 30, 2009, 10:08:12 AM

Title: How to block paricular user's pop/imap login
Post by: sandeepvson on October 30, 2009, 10:08:12 AM
Is this possible to block particular user's email-client configuration on basis of pop/imap
settings in linux ,dovecot.conf or anywhere ?
Title: Is it possible in Linux to restrict POP3 or IMAP for particular users.
Post by: ravis123 on October 31, 2009, 07:46:31 AM
Hi,
Is it possible in Linux to restrict POP3 or IMAP for particular users.
I need a confirmation on this, that it is possible or not in Linux.
If yes, then how to do this....
Please reply
Thanks in advance
Title: Re: Is it possible in Linux to restrict POP3 or IMAP for particular users.
Post by: kaushalpatel1982 on November 06, 2009, 12:04:56 PM
If users having static IP Addresses on their machines, Yes it is possible with iptables. Just apply following command can restrict the user to access POP3 and IMAP:

# iptables -t filter -I INPUT -s <user's IP Address> -p tcp --dport 110 -d <mail server IP> -j REJECT (or DROP)
# iptables -t filter -I INPUT -s <user's IP Address> -p tcp --dport 143 -d <mail server IP> -j REJECT (or DROP)

Dont use Mail server IP in case of mail server hosted on this machine.

You can also deny the users in pop3 and imap server like if you have dovecot just remove the comment from following lines in dovecot.conf file. Create files and restart dovecot,

1.)

  passdb passwd-file {
     File contains a list of usernames, one per line
    args = /etc/dovecot.deny
    deny = yes
  }

2.) Create /etc/dovecot.deny file and add username inside to the file.

for more help on dovecot go through the following link : http://wiki.dovecot.org/Authentication/RestrictAccess (http://wiki.dovecot.org/Authentication/RestrictAccess)

If you still have problem let us know. Best of Luck
Title: Re: How to block paricular user's pop/imap login
Post by: sandeepvson on November 06, 2009, 01:03:26 PM
 Thanks for help.
I tried with dovecot configuration file at 'passdb' tag setting.
i created /etc/dovecot.deny file and put some users ,those are successfully denied.
but how to block only pop3/imap to those users.
email client is not connecting to both any pop3/imap settings to listed users.

Please reply..
Title: Re: How to block paricular user's pop/imap login
Post by: kaushalpatel1982 on November 06, 2009, 02:20:47 PM
As per my understand, you want to deny either POP3 or IMAP.

The link provided with the post will help you to resolve the problem.
Title: Re: How to block paricular user's pop/imap login
Post by: ravis007 on November 09, 2009, 05:54:03 AM
Thanks for your help........

I have gone through the link you provided, but I am not getting the configuration.

Can you please give me some configuration example for restricting IMAP access to certain users.

Please help....
Title: Re: How to block paricular user's pop/imap login
Post by: sandeepvson on November 09, 2009, 06:39:11 AM
 
 
It is working now.
We can restrict users for either IMAP or POP3.
I have modified passdb section in dovecot with the help of above provided link
http://wiki.dovecot.org/Authentication/RestrictAccess
 
Thanks for help.