I have 50 email users (virtual users) using Dovecot, Postfix and Squirrelmail with CentOS 6.0. I want to allow some users to have access to POP and IMAP globally, and for the remaining users from my LAN only.

I have tried using Dovecot's allow_nets features, but this does not fulfill my requirements.

If I allow in allow_nets, the restricted user can access webmail globally. If I disable in allow_nets, the restricted user can not access webmail from my LAN too. Below is my configuration.

restricted virtual email user (/etc/dovecot/passwd file)
xyz@abc.com:{CRAM-MD5}encrypted pass::::::allow_nets=,

global virtual email user (/etc/dovecot/passwd-file)
xxx@xxx.xxx.xxx:{CRAM-MD5}encrypted pass

When accessing mail using webmail, the connections to Dovecot are made directly from SquirrelMail running on the same machine, and so always come from regardless of where the user is. Dovecot has no way of knowing where the user is accessing SquirrelMail from. You therefore need to implement the restriction for webmail in SquirrelMail itself (or in front of SquirrelMail with iptables for example).


I found a squirrelmail plugin named ip_restriction which helps to restrict IP based authentication.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.