nixCraft Linux Forum

nixCraft

Linux / UNIX Tech Support Forum

Linux Restrict POP3 or IMAP Services To Particular Users Only

This is a discussion on Linux Restrict POP3 or IMAP Services To Particular Users Only within the Networking, Firewalls and Security forums, part of the Mastering Servers category; Hi, Is it possible in Linux to restrict POP3 or IMAP for particular users. I need a confirmation on this, ...

Register free or login to your existing account and remove all advertisements.


Go Back   nixCraft Linux Forum > Mastering Servers > Networking, Firewalls and Security

Linux answers from nixCraft.


Networking, Firewalls and Security No it's not a secret. Talk about firewalls and security issues.

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-30-2009, 04:52 PM
Junior Member
User
 
Join Date: Oct 2009
OS: CentOS
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
ravis007 is on a distinguished road
Default Linux Restrict POP3 or IMAP Services To Particular Users Only

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.
Please reply
Thanks in advance
Reply With Quote
  #2 (permalink)  
Old 10-30-2009, 05:19 PM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,674
Thanks: 11
Thanked 240 Times in 180 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

Yes, with the help of PAM or server itself it is possible to take or give access to certain services.
__________________
Vivek Gite
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help
Reply With Quote
  #3 (permalink)  
Old 10-30-2009, 05:58 PM
Junior Member
User
 
Join Date: Oct 2009
OS: CentOS
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
ravis007 is on a distinguished road
Default

Thanks for your reply
Can you tell me how this could be done with PAM.
Will you please give configuration guide for "restricting particular users for POP3 or IMAP".
Please help....
Reply With Quote
  #4 (permalink)  
Old 10-31-2009, 06:59 PM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,674
Thanks: 11
Thanked 240 Times in 180 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

Create a file called /etc/deny.mailusers and add user to block:
Code:
vivek
sam
ram
Cd to /etc/pam.d/ and find out your pop3/imap server file and add the following line
Code:
auth required /lib/security/pam_listfile.so onerr=fail item=user sense=deny file=/etc/deny.mailusers
And you are done. See the following example which explains the same for OpenSSH SSHD server:
  1. Linux PAM configuration that allows or deny login via the sshd server
__________________
Vivek Gite
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help
Reply With Quote
  #5 (permalink)  
Old 11-02-2009, 10:44 AM
Junior Member
User
 
Join Date: Oct 2009
OS: CentOS
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
ravis007 is on a distinguished road
Default

Thanks for your reply.
I have done as you have told.

I have created a file /etc/deny.mailusers and added users test, xyz in it to block.
Also I have edited /etc/pam.d/pop3 and added a line given by you as :

auth required /lib/security/pam_listfile.so onerr=succeed item=user sense=deny file=/etc/deny.mailusers

But after doing this,

When I try to configure POP3 account of "test" user in my outlook, then it is working fine instead of giving errors.

As per the requirement, it has to give error while configuring POP3 account of blocked users test, xyz.

Am I right in doing above all procedure, if not then please guide me to correct it.

Waiting for your reply.
Thank You
Reply With Quote
  #6 (permalink)  
Old 11-02-2009, 02:09 PM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,674
Thanks: 11
Thanked 240 Times in 180 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

User can configure it but not able to download any emails. Have you tried to download anything? Do you see any error or warning in /var/log/messages, /var/log/secure and /var/log/maillog while downloading email for blocked user accounts?
__________________
Vivek Gite
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help
Reply With Quote
  #7 (permalink)  
Old 11-02-2009, 03:59 PM
Junior Member
User
 
Join Date: Oct 2009
OS: CentOS
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
ravis007 is on a distinguished road
Default

It is not working.
I am able to configure the pop3 account of the blocked users and can download the mails also.

Configuration is working, is ok but at least it has to give error while downloading the mails.

The logs files are not giving the valid information related to this.
I am confused, what to do now.

Please help...
Reply With Quote
  #8 (permalink)  
Old 11-03-2009, 12:11 PM
Junior Member
User
 
Join Date: Oct 2009
OS: CentOS
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
ravis007 is on a distinguished road
Default

I have also configured pop3 & imap daemons as /usr/sbin/ipop3d & /usr/sbin/imapd.

Now I have created the same files /etc/pam.d/pop3 with the required content
and /etc/deny.mailusers containing the users to block.

Is there any more configuration is needed or this is sufficient.

If all above is OK, then it has to work.

Please suggest....
Reply With Quote
  #9 (permalink)  
Old 11-15-2009, 03:40 PM
Junior Member
User
 
Join Date: Nov 2009
OS: Fedora
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
ritesh.yeole@gmail.com is on a distinguished road
Default block IMAP and POP for particular user

Hi Ravi,

try the following:
create /etc/imap.deny and /etc/pop.deny user
copy the user name to respective file to block the port for this user.
And add the following in dovecot.conf file as
Code:
passdb passwd-file {
  args = /etc/dovecot/deny.%Ls <- dovecot path
  deny = yes
}
this will definitely solve your problem.

Last edited by nixcraft; 11-19-2009 at 03:17 PM. Reason: [code] tags
Reply With Quote
  #10 (permalink)  
Old 11-19-2009, 03:11 PM
Junior Member
User
 
Join Date: Oct 2009
OS: CentOS
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
ravis007 is on a distinguished road
Default

Yes
I solved this.
Now I can restrict users for pop3 or imap in linux using dovecot.
Thank you so much for your help.
Reply With Quote
Reply

Tags
dovecot deny imap access , dovecot deny pop3 , email , email server , linux impa , linux pop3


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
List Services Linux Running raj Getting started tutorials 8 10-04-2009 07:07 AM
Linux / UNIX pop3 and imap Protocols varunkant Linux software 1 07-07-2008 03:49 PM
dovecot: pop3-login: pop3-login: error while loading shared libraries: libsepol.so.1 raj Mail Servers 1 11-15-2007 10:43 AM
How to restrict devices usage for users in Solaris? kitty@sad Solaris/OpenSolaris 3 05-21-2007 02:05 PM
how to restrict lan users so that they cannot send bhagi123 Linux software 2 11-21-2006 11:38 AM


All times are GMT +5.5. The time now is 10:13 AM.


Powered by vBulletin® Version 3.8.4 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2009 nixCraft. All rights reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38