1 (edited by hata_ph 2011-05-13 15:06:23)

Topic: Using create_mail_user_OpenLDAP.py on iRedMail-0.7.1

Just testing with create_mail_user_OpenLDAP.py on iRedMail-0.7.1 and encounter error if I did not include the groups value in my CSV file. Below is my CSV file format

xxx.org, wong, wong, wong, , ,

when I run python create_mail_user_OpenLDAP.py user.csv, it show below error:

Traceback (most recent call last):
File "create_mail_user_OpenLDAP.py", line 207, in ?
domain, username, passwd, cn, quota, groups = re.split('\s?,\s?, entry)
ValueError: too many valuesto unpack

from the python file the example show as below. But it will prompt error as above due to an extra comma. Remove it and it work. Pls some one take note of that.

Example #2:
    iredmail.org, zhang, secret_pw, Zhang Huangbin, , ,

The ldif file create from the python and sh file is some what different from the www@xxx.org...should the email property of all emails be the same or it is because www email user is an admin with more services?

# LDIF Export for mail=www@xxx.org,ou=Users,domainName=xxx.org,o=domains,dc=xxx,dc=xxx,dc=org
# Server: My LDAP Server (127.0.0.1)
# Search Scope: base
# Search Filter: (objectClass=*)
# Total Entries: 1
#
# Generated by phpLDAPadmin (http://phpldapadmin.sourceforge.net) on May 13, 2011 5:03 am
# Version: 1.2.0.5

version: 1

# Entry 1: mail=www@xxx.xxx.org,ou=Users,domainName=xxx...
dn: mail=www@xxx.org,ou=Users,domainName=xxx.org,o=dom
ains,dc=xxx,dc=xxx,dc=org
accountstatus: active
cn: www
enabledservice: mail
enabledservice: internal
enabledservice: smtp
enabledservice: smtpsecured
enabledservice: pop3
enabledservice: pop3secured
enabledservice: imap
enabledservice: imapsecured
enabledservice: deliver
enabledservice: forward
enabledservice: senderbcc
enabledservice: recipientbcc
enabledservice: managesieve
enabledservice: managesievesecured
enabledservice: sieve
enabledservice: sievesecured
enabledservice: displayedInGlobalAddressBook
enabledservice: shadowaddress
givenname: www
homedirectory: /var/vmail/vmail1/xxx.org/w/ww/www/www-2011.05.12.
08.31.33/
mail: www@xxx.org
mailmessagestore: vmail1/xxx.org/w/ww/www/www-2011.05.12.08.31.33
/
mailquota: 104857600
objectclass: inetOrgPerson
objectclass: shadowAccount
objectclass: amavisAccount
objectclass: mailUser
objectclass: top
sn: www
storagebasedirectory: /var/vmail
uid: www
userpassword: {SSHA}passed

# LDIF Export for mail=lee@xxx.org,ou=Users,domainName=xxx.org,o=domains,dc=xxx=xxxp,dc=org
# Server: My LDAP Server (127.0.0.1)
# Search Scope: base
# Search Filter: (objectClass=*)
# Total Entries: 1
#
# Generated by phpLDAPadmin (http://phpldapadmin.sourceforge.net) on May 13, 2011 4:51 am
# Version: 1.2.0.5

version: 1

# Entry 1: mail=lee@xxx.org,ou=Users,domainName=xxx...
dn: mail=lee@xxx.xxxp.org,ou=Users,domainName=xxx.xxx.org,o=dom
ains,dc=xxx,dc=xxx,dc=org
accountstatus: active
cn: lee
enabledservice: mail
enabledservice: pop3
enabledservice: pop3secured
enabledservice: imap
enabledservice: imapsecured
enabledservice: managesieve
enabledservice: managesievesecured
enabledservice: sieve
enabledservice: sievesecured
enabledservice: smtp
enabledservice: deliver
enabledservice: forward
enabledservice: senderbcc
enabledservice: recipientbcc
enabledservice: shadowaddress
enabledservice: displayedInGlobalAddressBook
enabledservice: internal
givenname: lee
homedirectory: /var/vmail/vmail1/xxx.org/l/le/lee/lee-2011.05.12.
10.51.20/
mail: lee@xxx.org
mailmessagestore: vmail1/xxx.org/l/le/lee/lee-2011.05.12.10.51.20
/
mailquota: 0
objectclass: inetOrgPerson
objectclass: shadowAccount
objectclass: amavisAccount
objectclass: mailUser
objectclass: top
sn: lee
storagebasedirectory: /var/vmail
uid: lee
userpassword: {SSHA}passwd

2

Re: Using create_mail_user_OpenLDAP.py on iRedMail-0.7.1

Can you simply show us the different part?

3

Re: Using create_mail_user_OpenLDAP.py on iRedMail-0.7.1

ZhangHuangbin wrote:

Can you simply show us the different part?

sorry...www come with extra enabledservice: smtpsecured.

4

Re: Using create_mail_user_OpenLDAP.py on iRedMail-0.7.1

hata_ph wrote:

sorry...www come with extra enabledservice: smtpsecured.

This is required for SMTPS service.

Postfix will perform SASL auth with dovecot, and dovecot will query LDAP/MySQL with "enabledService=smtpsecured" or "enablesmtpsecured=1".

Fixed moment ago:
http://code.google.com/p/iredmail/sourc … 974522fd85

Thanks very much for your feedback. smile

5 (edited by hata_ph 2011-05-13 15:11:09)

Re: Using create_mail_user_OpenLDAP.py on iRedMail-0.7.1

I think u need to adjust this two line of code too...

    STORAGE_BASE_DIRECTORY = '/var/vmail'

    mailMessageStore = 'vmail1/' + maildir_domain + '/' + maildir_user

Your original python script will create ldif as below and it different from the default www usert

homedirectory: /var/vmail/vmail1/xxx.org/l/le/lee/lee-2011.05.12.10.51.20/
mail: lee@xxx.org
mailmessagestore: xxx.org/l/le/lee/lee-2011.05.12.10.51.20/
storagebasedirectory: /var/vmail/vmail1

homedirectory: /var/vmail/vmail1/xxx.org/w/ww/www/www-2011.05.12.08.31.33/
mail: www@xxx.org
mailmessagestore: vmail1/xxx.org/w/ww/www/www-2011.05.12.08.31.33/
storagebasedirectory: /var/vmail

6

Re: Using create_mail_user_OpenLDAP.py on iRedMail-0.7.1

Updated:
http://code.google.com/p/iredmail/sourc … e7b21769b4

7

Re: Using create_mail_user_OpenLDAP.py on iRedMail-0.7.1

Your new create_mail_user_OpenLDAP.py code still generate ldif as below...missing vmail1 thou...

mailmessagestore: xxx.org/l/le/lee/lee-2011.05.12.10.51.20/

8

Re: Using create_mail_user_OpenLDAP.py on iRedMail-0.7.1

Fixed moment ago:
http://code.google.com/p/iredmail/sourc … a5130079ed

Thanks for your feedback. smile

9

Re: Using create_mail_user_OpenLDAP.py on iRedMail-0.7.1

I think u need to change it for create_mail_user_OpenLDAP.sh too...