- {
- # create and patch DB credentials
- password=$(openssl rand --hex 16)
- da_password=$(openssl rand --hex 16)
- da_hash=$(htpasswd -nb -B dovecot $da_password|cut -d: -f2)
- for f in dovecot/my.cnf postfix/sql-*.cf; do
- sed -i "s/^user =.*/user = mail/g" $f
- sed -i "s/^password =.*/password = $password/g" $f
- done
- $MYSQL --execute "GRANT SELECT on egroupware.* TO mail@\`%\` IDENTIFIED BY '$password'"
- cat <<EOF | $MYSQL --force egroupware || true
- # create dovecot user (as member of Default group account_id=1)
- REPLACE INTO egw_accounts (account_id, account_lid, account_pwd, account_status, account_expires, account_type, account_primary_group)
- VALUES (NULL, 'dovecot', '{crypt}$da_hash', 'A', -1, 'u', -1);
- REPLACE INTO egw_acl (acl_appname,acl_location,acl_account,acl_rights)
- SELECT 'phpgw_group','-1',account_id,1 FROM egw_accounts WHERE account_lid='dovecot';
- REPLACE INTO egw_addressbook (account_id,contact_owner,n_given,n_family,n_fn,contact_creator,contact_created,contact_modified)
- SELECT account_id,0,'Dovecot','Master','Dovecot Master',0,UNIX_TIMESTAMP(),UNIX_TIMESTAMP() FROM egw_accounts WHERE account_lid='dovecot';
- # overwrite mail-account created by setup with new "EGroupware Mail" account and dummy domain "egroupware.local"
- REPLACE INTO egw_ea_accounts (acc_id, acc_name, ident_id, acc_imap_host, acc_imap_ssl, acc_imap_port, acc_sieve_enabled, acc_sieve_host, acc_sieve_port, acc_folder_sent, acc_folder_trash, acc_folder_draft, acc_folder_template, acc_smtp_host, acc_smtp_ssl, acc_smtp_port, acc_smtp_type, acc_imap_type, acc_imap_logintype, acc_domain, acc_user_editable, acc_sieve_ssl, acc_modified, acc_modifier, acc_smtp_auth_session, acc_folder_junk, acc_imap_default_quota, acc_imap_timeout, acc_user_forward, acc_folder_archive, acc_further_identities, acc_folder_ham, acc_spam_api)
- VALUES (1,'EGroupware Mail',1,'mail',2,993,1,'mail',4190,'INBOX/Sent','INBOX/Trash','INBOX/Drafts','INBOX/Templates','mail',1,587,'Smtp\\\\Sql','Imap\\\\Dovecot','standard','egroupware.local',0,1,NOW(),5,1,'INBOX/Junk',NULL,NULL,1,'INBOX/Archive',1,NULL,'');