<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title></title>
</head>
<body style="font-family:Arial;font-size:14px">
<p>Quoting Rick Romero <<a href="mailto:rick@havokmon.com">rick@havokmon.com</a>>:</p>
<blockquote style="border-left:2px solid blue;margin-left:2px;padding-left:12px;" type="cite">
<p>Quoting Eric Broch <<a href="mailto:ebroch@whitehorsetc.com">ebroch@whitehorsetc.com</a>>:<br></p>
<blockquote style="border-left:2px solid blue;margin-left:2px;padding-left:12px;" type="cite">
<p>On 10/4/2018 7:27 AM, Rick Romero wrote:</p>
<blockquote style="border-left:2px solid blue;margin-left:2px;padding-left:12px;" type="cite">
<p>Quoting Eric Broch <<a href="mailto:ebroch@whitehorsetc.com">ebroch@whitehorsetc.com</a> <mailto:<a href="mailto:ebroch@whitehorsetc.com>>:">ebroch@whitehorsetc.com>>:</a><br></p>
<blockquote style="border-left:2px solid blue;margin-left:2px;padding-left:12px;" type="cite">
<p>On 10/4/2018 6:34 AM, Rick Romero wrote:</p>
<blockquote style="border-left:2px solid blue;margin-left:2px;padding-left:12px;" type="cite">
<p> </p>
</blockquote>
</blockquote>
Quoting Aki Tuomi <<a href="mailto:aki.tuomi@open-xchange.com">aki.tuomi@open-xchange.com</a> <mailto:<a href="mailto:aki.tuomi@open-xchange.com>>:">aki.tuomi@open-xchange.com>>:</a><br>
<blockquote style="border-left:2px solid blue;margin-left:2px;padding-left:12px;" type="cite">
<p>On 03.10.2018 23:30, Eric Broch wrote:<br></p>
<blockquote style="border-left:2px solid blue;margin-left:2px;padding-left:12px;" type="cite">
<p>Hello list,<br>
<br>
I run Dovecot with the vpopmail driver and have found that it<br>
authenticates against the clear text password in the vpopmail<br>
database. Is there a configuration option either at compile time, link<br>
time, or a setting in one of the configuration files that tells the<br>
program to authenticate against the hash instead of the clear text?</p>
</blockquote>
Prefix your passwords in vpopmail with {SCHEME} (like, {CRYPT})<br>
Aki</blockquote>
Or use SQL - then you don't have to munge any of your tools.<br>
<br>
password_query =<br>
SELECT CONCAT(pw_name, '@', pw_domain) AS user, pw_passwd AS password, pw_dir as userdb_home, 89 as userdb_uid, 89 as userdb_gid<br>
FROM vpopmail WHERE pw_name = '%n' AND pw_domain = '%d' AND !(pw_gid & 8) AND !(pw_gid & 2) AND ('%r'!='<webserverip>' or !(pw_gid & 4))<br>
<br>
pw_gid refers to the the binary vpopmail flags for disable POP, IMAP, Webmail.<br>
<br>
Rick</blockquote>
<blockquote style="border-left:2px solid blue;margin-left:2px;padding-left:12px;" type="cite">
<p>When configuring vpopmail for our purposes we use (now) the configuration option:<br>
<br>
--disable-many-domains Creates a table for each virtual domain instead of storing all users in a single table.<br>
Only valid for MySQL and PostgreSQL<br>
<br>
This disallows (I think) the use Dovecot MySQL configuration file as every user is stored in a domain table of the form 'mydomain_tld'.<br>
<br>
So, we're limited to these configurations (no dovecot-mysql.conf.ext) :<br>
<br>
passdb {<br>
args = cache_key=%u webmail=127.0.0.1<br>
driver = vpopmail<br>
}<br>
<br>
userdb {<br>
args = cache_key=%u quota_template=quota_rule=*:backend=%q<br>
driver = vpopmail<br>
}<br>
<br>
If there is a clear text password (pw_clear_passwd) present it seems that Dovecot will use that instead of using the hash (pw_passwd).<br>
<br>
It seems that in the code 'passdb-vpopmail.c' (below) that if the clear password (pw_clear_passwd) is present Dovecot skips the hashed password (pw_passwd), and we want authentication against the hashed password.<br>
<br>
<snippet><br>
if (vpopmail_is_disabled(auth_request, vpw)) {<br>
auth_request_log_info(auth_request, AUTH_SUBSYS_DB,<br>
"%s disabled in vpopmail for this user",<br>
auth_request->service);<br>
password = NULL;<br>
*result_r = PASSDB_RESULT_USER_DISABLED;<br>
} else {<br>
if (vpw->pw_clear_passwd != NULL &&<br>
*vpw->pw_clear_passwd != '\0') {<br>
password = t_strdup_noconst(vpw->pw_clear_passwd);<br>
*cleartext = TRUE;<br>
} else if (!*cleartext)<br>
password = t_strdup_noconst(vpw->pw_passwd);<br>
else<br>
password = NULL;<br>
*result_r = password != NULL ? PASSDB_RESULT_OK :<br>
PASSDB_RESULT_SCHEME_NOT_AVAILABLE;<br>
}<br>
</snippet><br>
<br>
<br>
Looking for an option to make dovecot use hashed password instead of clear text.<br>
<br>
Hope this makes sense.<br>
<br>
-EricB<br>
<br>
We seem to have lost quoting..<br>
First - Why aren't you just deleting all the clear text passwords?<br>
<br>
Second, for many domanis, my password query for your purposes should just be:<br>
SELECT CONCAT(pw_name, '@', pw_domain) AS user, pw_passwd AS password, pw_dir as userdb_home, 89 as userdb_uid, 89 as userdb_gid<br>
FROM %d WHERE pw_name = '%n' AND pw_domain = '%d' AND !(pw_gid & 8) AND !(pw_gid & 2) AND ('%r'!='<webserverip>' or !(pw_gid & 4))<br>
<br>
Where %d is the domain name. Your vpopmail database should have a bunch of domain.com table names.<br>
Or you can hardcode the database with FROM vpopmail.%d<br>
You may need to play with quotes.. FROM `vpopmail.%d` or FROM `%d`<br>
<br>
Rick</p>
</blockquote>
Rick,<br>
<br>
I'm not sure what you're saying.<br>
<br>
Vpopmail's DB can be configured in two different ways, 1) With domain tables and all users for that particular domain underneath (described below), or 2) Simply, one table with all users with the domain field 'pw_domain' (This works with dovecot-sql.conf.ext files). The former (1), which we use does not allow the use of dovecot-sql.conf.ext files, we're limited to userdb and passwd options previously mentioned. When using these options dovecot will get the clear text password if present.<br>
<br>
The problem is that if a password is over 16 characters long the clear text field will only store the first 16 characters while the hashed field will contain the whole password.<br>
<br>
# echo "describe domain_tld" | mysql -u root -p`cat vpoppasswd` vpopmail<br>
yeilds<br>
Field Type Null Key Default Extra<br>
pw_name char(32) NO PRI NULL<br>
pw_passwd char(40) YES NULL<br>
pw_uid int(11) YES NULL<br>
pw_gid int(11) YES NULL<br>
pw_gecos char(48) YES NULL<br>
pw_dir char(160) YES NULL<br>
pw_shell char(20) YES NULL<br>
pw_clear_passwd char(16) YES NULL<br>
<br>
As you can see there is no 'pw_domain' field from which to draw.<br>
<br>
Again we are limited to the passdb, and userdb options already described.</blockquote>
I'm not sure why #1 wouldn't work with a proper query - here's the same without a reference to pw_domain at all.<br>
<br>
SELECT CONCAT(pw_name, '@', %d) AS user, pw_passwd AS password, pw_dir as userdb_home, 89 as userdb_uid, 89 as userdb_gid FROM %d WHERE pw_name = '%n' AND pw_domain = '%d' AND !(pw_gid & 8) AND !(pw_gid & 2) AND ('%r'!='<webserverip>' or !(pw_gid & 4))<br>
<br>
Alternatively if you absolutely must have clear text password, and it has to be greater than 16 characters, make the MySQL field bigger than 16 characters. 'Alter table' is the command.<br>
<br>
It really sounds to me like you need a test environment.<br>
Rick</blockquote>
<p>Dammit<br>
<br>
SELECT CONCAT(pw_name, '@', %d) AS user, pw_passwd AS password, pw_dir as userdb_home, 89 as userdb_uid, 89 as userdb_gid FROM %d WHERE pw_name = '%n' AND !(pw_gid & 8) AND !(pw_gid & 2) AND ('%r'!='<webserverip>' or !(pw_gid & 4))<br>
<br></p>
</body>
</html>