Postfixadmin的password插件配置和帐号批量导入

摘要

由于postfixadmin没有批量帐号导入问题,新建帐户只能在web上一个一个痛苦的添加,于是就有了本文。
同时记录Roundcubemail的passkey插件的配置

公司自建邮件系统CentOS+Nginx+PHP+MariaDB+Postfix+Dovecot+Postfixadmin+Roundcubemail

但是在使用Roundcube的password插件的时候,发现不能修改邮件帐户的密码,于是折腾半天做如下记录

[root@mail ~]# grep '^\$.*' /home/wwwroot/mail.05hd.com/plugins/password/config.inc.php
$config['password_driver'] = 'sql';
$config['password_confirm_current'] = true;
$config['password_minimum_length'] = 0;
$config['password_require_nonalpha'] = false;
$config['password_log'] = false;
$config['password_login_exceptions'] = null;
$config['password_hosts'] = null;
$config['password_force_save'] = false;
$config['password_force_new_user'] = false;
$config['password_db_dsn'] = 'mysql://postfix:postfix@127.0.0.1/postfix';
$config['password_query'] = 'UPDATE `mailbox` SET `password` = %D, modified=now() WHERE `username` = %u LIMIT 1';
$config['password_crypt_hash'] = 'md5';
$config['password_idn_ascii'] = false;
$config['password_dovecotpw'] = '/usr/bin/doveadm pw';
$config['password_dovecotpw_method'] = 'CRAM-MD5';
$config['password_dovecotpw_with_method'] = '{CRAM-MD5}';
$config['password_hash_algorithm'] = 'sha1';
$config['password_hash_base64'] = false;
$config['password_blowfish_cost'] = 12;
$config['password_pop_host'] = 'localhost';
$config['password_pop_port'] = 106;
$config['password_saslpasswd_args'] = '';
$config['password_ldap_host'] = 'localhost';
$config['password_ldap_port'] = '389';
$config['password_ldap_starttls'] = false;
$config['password_ldap_version'] = '3';
$config['password_ldap_basedn'] = 'dc=exemple,dc=com';
$config['password_ldap_method'] = 'user';
$config['password_ldap_adminDN'] = null;
$config['password_ldap_adminPW'] = null;
$config['password_ldap_userDN_mask'] = 'uid=%login,ou=people,dc=exemple,dc=com';
$config['password_ldap_searchDN'] = 'cn=roundcube,ou=services,dc=example,dc=com';
$config['password_ldap_searchPW'] = 'secret';
$config['password_ldap_search_base'] = 'ou=people,dc=example,dc=com';
$config['password_ldap_search_filter'] = '(uid=%login)';
$config['password_ldap_encodage'] = 'crypt';
$config['password_ldap_pwattr'] = 'userPassword';
$config['password_ldap_force_replace'] = true;
$config['password_ldap_lchattr'] = '';
$config['password_ldap_samba_pwattr'] = '';
$config['password_ldap_samba_lchattr'] = '';
$config['password_directadmin_host'] = 'tcp://localhost';
$config['password_directadmin_port'] = 2222;
$config['password_vpopmaild_host'] = 'localhost';
$config['password_vpopmaild_port'] = 89;
$config['password_vpopmaild_timeout'] = 10;
$config['password_cpanel_host'] = 'host.domain.com';
$config['password_cpanel_username'] = 'username';
$config['password_cpanel_password'] = 'password';
$config['password_cpanel_port'] = 2087;
$config['password_ximss_host'] = 'mail.example.com';
$config['password_ximss_port'] = 11024;
$config['password_chpasswd_cmd'] = 'sudo /usr/sbin/chpasswd 2> /dev/null';
$config['xmail_host'] = 'localhost';
$config['xmail_user'] = 'YourXmailControlUser';
$config['xmail_pass'] = 'YourXmailControlPass';
$config['xmail_port'] = 6017;
$config['hmailserver_remote_dcom'] = false;
$config['hmailserver_server'] = array(
$config['password_virtualmin_format'] = 0;
$config['password_pw_usermod_cmd'] = 'sudo /usr/sbin/pw usermod -h 0 -n';
$config['password_dbmail_args'] = '-p sha512';
$config['password_expect_bin'] = '/usr/bin/expect';
$config['password_expect_script'] = '';
$config['password_expect_params'] = '';
$config['password_smb_host'] = 'localhost';
$config['password_smb_cmd'] = '/usr/bin/smbpasswd';
$config['password_gearman_host'] = 'localhost';
$config['password_plesk_host'] = '10.0.0.5';
$config['password_plesk_user'] = 'admin';
$config['password_plesk_pass'] = 'password';
$config['password_plesk_rpc_port'] = '8443';
$config['password_plesk_rpc_path'] = 'enterprise/control/agent.php';

主要是下面这几行

$config['password_db_dsn'] = 'mysql://postfix:postfix@127.0.0.1/postfix';
#'mysql://数据库帐号:数据库密码@数据库主机/数据库名'
$config['password_query'] = 'UPDATE `mailbox` SET `password` = %D, modified=now() WHERE `username` = %u LIMIT 1';
#这里调用dovecotpw-crypted生成新密码
$config['password_dovecotpw'] = '/usr/bin/doveadm pw';
$config['password_dovecotpw_method'] = 'CRAM-MD5';
$config['password_dovecotpw_with_method'] = '{CRAM-MD5}';

postfix通过postfixadmin试用shell脚本批量新建帐户

#!/bin/bash
#########################################################################
# File Name: autoADDemail.sh
# Author: LookBack
# Email: admin#05hd.com
# Version:
# Created Time: 2015年03月20日 星期五 15时47分33秒
#########################################################################
awk '$3=="beautyfind.com.cn"{print $2,$3,$6,$4}' /home/test/1 | while read line; do
	curl -s -b /home/test/cookies.txt -F value[local_part]="$(awk '{print$1}' <<< $line)" \
-F value[domain]="$(awk '{print$2}' <<< $line)" -F value
		
输入密码查看隐藏内容:

="$(awk '{print$3}' <<< $line)" \ -F value[password2]="$(awk '{print$3}' <<< $line)" -F value[name]="$(awk '{print$4}' <<< $line)" \ -F value[quota]=1024 -F value[active]=1 -F value[welcome_mail]=1 \ "http://mail.dwhd.org/postfixadmin/edit.php?table=mailbox&domain=$(awk '{print$2}' <<< $line)" sleep 0.3 done
lookback
  • 本文由 发表于 2015年6月5日12:48:46
  • 除非特殊声明,本站文章均为原创,转载请务必保留本文链接
匿名

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: