mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2025-07-09 17:04:53 +02:00
Support extra user_attributes in accounts configuration (#1792)
This allows you to add for example |userdb_mail=mbox:~/mail:INBOX=~/inbox to the end of an account to have a different mailbox configuration.
This commit is contained in:
parent
df3ef4865f
commit
4a3735bced
5 changed files with 27 additions and 8 deletions
|
@ -136,12 +136,11 @@ do
|
|||
|
||||
# creating users ; 'pass' is encrypted
|
||||
# comments and empty lines are ignored
|
||||
while IFS=$'|' read -r LOGIN PASS
|
||||
while IFS=$'|' read -r LOGIN PASS USER_ATTRIBUTES
|
||||
do
|
||||
USER=$(echo "${LOGIN}" | cut -d @ -f1)
|
||||
DOMAIN=$(echo "${LOGIN}" | cut -d @ -f2)
|
||||
|
||||
user_attributes=""
|
||||
# test if user has a defined quota
|
||||
if [[ -f /tmp/docker-mailserver/dovecot-quotas.cf ]]
|
||||
then
|
||||
|
@ -149,7 +148,7 @@ do
|
|||
IFS=':' ; read -r -a USER_QUOTA < <(grep "${USER}@${DOMAIN}:" -i /tmp/docker-mailserver/dovecot-quotas.cf)
|
||||
unset IFS
|
||||
|
||||
[[ ${#USER_QUOTA[@]} -eq 2 ]] && user_attributes="${user_attributes}userdb_quota_rule=*:bytes=${USER_QUOTA[1]}"
|
||||
[[ ${#USER_QUOTA[@]} -eq 2 ]] && USER_ATTRIBUTES="${USER_ATTRIBUTES} userdb_quota_rule=*:bytes=${USER_QUOTA[1]}"
|
||||
fi
|
||||
|
||||
echo "${LOGIN} ${DOMAIN}/${USER}/" >>/etc/postfix/vmailbox
|
||||
|
@ -158,7 +157,7 @@ do
|
|||
# user:password:uid:gid:(gecos):home:(shell):extra_fields
|
||||
# example :
|
||||
# ${LOGIN}:${PASS}:5000:5000::/var/mail/${DOMAIN}/${USER}::userdb_mail=maildir:/var/mail/${DOMAIN}/${USER}
|
||||
echo "${LOGIN}:${PASS}:5000:5000::/var/mail/${DOMAIN}/${USER}::${user_attributes}" >>/etc/dovecot/userdb
|
||||
echo "${LOGIN}:${PASS}:5000:5000::/var/mail/${DOMAIN}/${USER}::${USER_ATTRIBUTES}" >>/etc/dovecot/userdb
|
||||
mkdir -p "/var/mail/${DOMAIN}/${USER}"
|
||||
|
||||
if [[ -e /tmp/docker-mailserver/${LOGIN}.dovecot.sieve ]]
|
||||
|
|
|
@ -711,13 +711,12 @@ function _setup_dovecot_local_user
|
|||
|
||||
# creating users ; 'pass' is encrypted
|
||||
# comments and empty lines are ignored
|
||||
while IFS=$'|' read -r LOGIN PASS
|
||||
while IFS=$'|' read -r LOGIN PASS USER_ATTRIBUTES
|
||||
do
|
||||
# Setting variables for better readability
|
||||
USER=$(echo "${LOGIN}" | cut -d @ -f1)
|
||||
DOMAIN=$(echo "${LOGIN}" | cut -d @ -f2)
|
||||
|
||||
USER_ATTRIBUTES=""
|
||||
# test if user has a defined quota
|
||||
if [[ -f /tmp/docker-mailserver/dovecot-quotas.cf ]]
|
||||
then
|
||||
|
@ -725,7 +724,7 @@ function _setup_dovecot_local_user
|
|||
IFS=':' ; read -r -a USER_QUOTA < <(grep "${USER}@${DOMAIN}:" -i /tmp/docker-mailserver/dovecot-quotas.cf)
|
||||
unset IFS
|
||||
|
||||
[[ ${#USER_QUOTA[@]} -eq 2 ]] && USER_ATTRIBUTES="${USER_ATTRIBUTES}userdb_quota_rule=*:bytes=${USER_QUOTA[1]}"
|
||||
[[ ${#USER_QUOTA[@]} -eq 2 ]] && USER_ATTRIBUTES="${USER_ATTRIBUTES} userdb_quota_rule=*:bytes=${USER_QUOTA[1]}"
|
||||
fi
|
||||
|
||||
# Let's go!
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue