1 (edited by giorgiolago 2009-10-08 11:20:10)

Topic: How set a default mailQuota to all users in virtual domain? [solved]

How can i set a default mailQuota to all users in virtual domain? I set a small quota for all user (250MB) and now i need update all user`s quota to unlimited.
backend: openldap

How i can do that ?

Thx for some help

ps: i not speak english :{

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2 (edited by giorgiolago 2009-10-08 11:19:12)

Re: How set a default mailQuota to all users in virtual domain? [solved]

I got it! and I will share with you my script!

#!/bin/bash
# This script set a global quota for all user in virtual domain using Openldap Backend
#Credits: giorgiolago#gmail.com
# How to use:
# ./set_global_quota_OpenLDAP.sh > global_quota.ldif
# ldapmodify -x -D "cn=Manager,dc=iredmail,dc=org" -w password  -f global_quota.ldif

LDAP_SUFFIX="dc=iredmail,dc=org"
BINDDN="cn=Manager,${LDAP_SUFFIX}"
BINDPW='password'
BASE_DN="o=domains,${LDAP_SUFFIX}"
QUOTA='1048576000'
DOMAIN_NAME="iredmail.org"
DOMAIN_DN="domainName=${DOMAIN_NAME}"
OU_USER_DN="ou=Users"



for i in $(ldapsearch -x -D "${BINDDN}" -w "${BINDPW}" |egrep "mail="|cut -d"," -f1|cut -d"=" -f2); do
    echo ;
    echo dn: mail=$i,${OU_USER_DN},${DOMAIN_DN},${BASE_DN}
    echo changetype:modify;
    echo replace:mailQuota;
    echo mailQuota:${QUOTA};
done


#Examples of Email Quota
#250MB = 262144000
#500MB = 524288000
# 1 GB = 1048576000

3

Re: How set a default mailQuota to all users in virtual domain? [solved]

No one has Eng as mother language!

Which OS? What is the below mean

for i in $(ldapsearch -x -D "${BINDDN}" -w "${BINDPW}" |egrep "mail="|cut -d"," -f1|cut -d"=" -f2); do
    echo ;
    echo dn: mail=$i,${OU_USER_DN},${DOMAIN_DN},${BASE_DN}
    echo changetype:modify;
    echo replace:mailQuota;
    echo mailQuota:${QUOTA};
done

Try to explained your idea first! All are echo and ok! no thing special.