[Dovecot] How to disable imap of some user
Hi,
in our company, i want to disable imap of some users, they can access them mailbox by pop3 only, and another user can allow access them mailbox by imap or pop3.
how can i do ?
-- Best Cheer (XiaMen) Stone Works CO.,LTP. Phone: 0592-7221600
On 02/19/2011 08:55 AM 邓卫华 wrote:
Hi,
in our company, i want to disable imap of some users, they can access them mailbox by pop3 only, and another user can allow access them mailbox by imap or pop3.
how can i do ?
Its really simple - since you are using a SQL backend for your passdb. Didn't you?
Create your table* like:
user | password | etc ... | smtp | pop3 | imap | sieve
------------------+----------+---------+------+------+------+------- user@example.com | XXX | | t | t | t | t
And a password_query like:
SELECT user, password FROM tbl WHERE user = %s and %s
- = the columns smtp, pop3, imap and sieve have the type boolean. Rename sieve to managesieve if you are using Dovecot < 1.2.beta2
Regards, Pascal
The trapper recommends today: 5e1f1e55.1105009@localdomain.org
Dear Pascal,
thanks for your reply ASAP. can i only add pop3 and imap column in the password table, and not to add sieve and smtp column? can password not verified if there have not existing smtp and sieve column?
Regards,
Deng
On Sat, 19 Feb 2011 09:17:16 +0100, Pascal Volk wrote:
Hi, in our company, i want to disable imap of some users, they can access them mailbox by
On 02/19/2011 08:55 AM 邓卫华 wrote: pop3 only, and another user can allow access them mailbox by imap or pop3. how can i do ? Its really simple - since you are using a SQL backend for your passdb. Didn't you? Create your table* like: user | password | etc ... | smtp | pop3 | imap | sieve ------------------+----------+---------+------+------+------+------- user@example.com [1] | XXX | | t | t | t | t And a password_query like: SELECT user, password FROM tbl WHERE user = %s and %s * = the columns smtp, pop3, imap and sieve have the type boolean. Rename sieve to managesieve if you are using Dovecot < 1.2.beta2 Regards, Pascal
--
Best Cheer (XiaMen) Stone Works CO.,LTP. Phone: 0592-7221600
Links:
[1] mailto:user@example.com
On 02/19/2011 02:20 PM 邓卫华 wrote:
Dear Pascal,
thanks for your reply ASAP. can i only add pop3 and imap column in the password table, and not to add sieve and smtp column? can password not verified if there have not existing smtp and sieve column?
You don't need to add the column sieve as long as do not provide MamageSieve. I don't know if you use Dovecot's SASL¹ for SMTP-Auth. If not. you did not need to add the smtp column. When you don't add the sieve column but provide ManageSieve, the login will always fail because an SQL error '… unknown column sieve …'
The first example query was wrong, sorry. The correct one would be: SELECT user, password FROM tbl WHERE user = '%u' AND %s
See also http://wiki.dovecot.org/Variables for further details.
Regards, Pascal
-- 1 = http://wiki.dovecot.org/Sasl
The trapper recommends today: face1e55.1105023@localdomain.org
Hi, Pascal
thanks, that's great. it's work in our test environment. but i have a problem in mail server.
i have a user manage program of mail server, runing on mysql. it had a disableIMAP disablePOP3, disablesmtp column in user table.
that's easy if i can modify password_query.
i had writed :" select user,password from user where username='%u' and contact('disable',%s)='0' " in password_query, but it is not work and i got
"Password query failed: Column count of mysql.proc is wrong. Expected 20, found 16. Created with MySQL 50077" in maillog file.
so ,how to modify password_query to get work?
Thanks.
Deng
On Sat, 19 Feb 2011 23:23:19 +0100, Pascal Volk wrote:
On 02/19/2011 02:20 PM 邓卫华 wrote:
Dear Pascal, thanks for your reply ASAP. can i only add pop3 and imap column in the password table, and not to add sieve and smtp column? can password not verified if there have not existing smtp and sieve column? You don't need to add the column sieve as long as do not provide MamageSieve. I don't know if you use Dovecot's SASL¹ for SMTP-Auth. If not. you did not need to add the smtp
column. When you don't add the sieve column but provide ManageSieve, the login will always fail because an SQL error '… unknown column sieve …' The first example query was wrong, sorry. The correct one would be: SELECT user, password FROM tbl WHERE user = '%u' AND %s See also http://wiki.dovecot.org/Variables [1] for further details. Regards, Pascal -- 1 = http://wiki.dovecot.org/Sasl [2]
-- Best Cheer (XiaMen) Stone Works CO.,LTP. Phone: 0592-7221600
Links:
[1] http://wiki.dovecot.org/Variables [2] http://wiki.dovecot.org/Sasl
Hi,all
i have resolved this problem, when i am modify password_query parameter.
password_query = SELECT username AS user,password FROM (select username,password,disableimap as imap ,disablepop3 as pop3,disablesmtp as smtp,disablesieve as sieve FROM mailbox WHERE username = '%u' AND active='1') as tb1 where %s='0'
thanks.
Deng
On Tue, 22 Feb 2011 11:22:07 +0800, 邓卫华 wrote:
Hi, Pascal
thanks, that's great. it's work in our test
environment. but i have a problem in mail server.
i have a user
manage
program of mail server, runing on mysql. it had a disableIMAP
disablePOP3, disablesmtp column in user table.
that's easy if i
modify password_query.
i had writed :" select user,password from user where username='%u' and contact('disable',%s)='0' " in
but it is not work and i got
"Password query failed: Column count of mysql.proc is wrong. Expected 20, found 16. Created with MySQL 50077" in maillog file.
so ,how to modify
can password_query, password_query to get work?
Thanks.
Deng
On Sat, 19 Feb
2011 23:23:19 +0100, Pascal Volk wrote:
On 02/19/2011 02:20 PM
邓卫华 wrote:
Dear Pascal, thanks for your reply ASAP. can i only
add pop3 and imap column in the password table, and not to add sieve and smtp column? can password not verified if there have not existing smtp and sieve column? you use Dovecot's SASL¹ for
not. you did not need to add the smtp column. When you don't add the sieve column but provide ManageSieve, the login will always fail because an SQL error '… unknown
column sieve …' The first example query was wrong, sorry. The correct one would be: SELECT user, password FROM tbl WHERE user = '%u' AND %s See also http://wiki.dovecot.org/Variables [1] [1] for further details. Regards, Pascal -- 1 = http://wiki.dovecot.org/Sasl [2] [2]
-- Best Cheer (XiaMen) Stone Works CO.,LTP. Phone: 0592-7221600
Links:
[1] http://wiki.dovecot.org/Variables [2] http://wiki.dovecot.org/Sasl
participants (2)
-
Pascal Volk
-
邓卫华