Topic: Passwd problem with batch creating users
==== Required information ====
- iRedMail version:
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):
- Linux/BSD distribution name and version:
- Related log if you're reporting an issue:
======== Required information ====
- iRedMail version: 0.8.5 - iRedAdmin-PRO-MySQL 1.7.0
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Linux/BSD distribution name and version: Debian 7
- Related log if you're reporting an issue:
====
Based on create_mail_user_SQL.sh script I wrote a php script to read user/pwd from a database and instert them into vmail.mailbox table
here is a part of the script :
while ($row=mysql_fetch_array($res1))
{
$username = $row["username"];
$clear = $row["passwd"];
$domaine = "domain.tld";
$mail = "$username@$domaine";
$stor = "/var/vmail";
$node = "vmail1";
//$pwd = shell_exec("/usr/bin/doveadm pw -s MD5-CRYPT -p $clear");
//$passwd = substr($pwd, 11, 34);
$pwd = shell_exec("openssl passwd -1 $clear");
$passwd = substr($pwd, 0, 34);
$date=date("Y-m-d H:i:s");
$sql3 = "INSERT INTO mailbox (username, password, name, storagebasedirectory,storagenode, maildir, quota, domain, active, local_part, created)
VALUES ('$mail', '$passwd', '$username', '$stor', '$node', '$domaine/$username/', '50', '$domaine', '1', '$username', '$date')";
$res3 = mysql_query($sql3) or die("Echec Requete SQL ajout utilisateur");
}
My problem is with the passwords ... as you can see I've tried two different ways.
They look good starting with $1$ and 34 char lengh ... but they're not working when I try to authenticate
What am I doing wrong ?
----
Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.