Commits

Zhang Huangbin committed a1188ab

Don't add standalone admin account.

  • Participants
  • Parent commits 10a8a6b

Comments (0)

Files changed (8)

File iRedMail/conf/openldap

 export LDAP_SERVICE_SHADOW_ADDRESS='shadowaddress'
 export LDAP_SERVICE_DISPLAYED_IN_ADDRBOOK='displayedInGlobalAddressBook'
 export LDAP_SERVICE_LIB_STORAGE='lib-storage'
+export LDAP_SERVICE_DOMAIN_ADMIN='domainadmin'
 
 # Shared attributes.
 export LDAP_ATTR_ACCOUNT_STATUS='accountStatus'

File iRedMail/dialog/virtual_domain_config.sh

 
 Note:
 
-    * You can login iRedAdmin with this account.
+    * You can login to both webmail and iRedAdmin with this account.
+    * Please reset password immediately after installation completed.
 
 WARNING:
 
     * EMPTY password is *NOT* permitted.
-    * Please reset password immediately after installation completed.
 
 " 20 76 2>/tmp/first_domain_admin_passwd
 
 echo "export SITE_ADMIN_PASSWD='${SITE_ADMIN_PASSWD}'" >> ${CONFIG_FILE}
 rm -f /tmp/first_domain_admin_passwd
 
-#FIRST_USER
-export FIRST_USER='test'
+# First mail user and password
+export FIRST_USER="${DOMAIN_ADMIN_NAME}"
+export FIRST_USER_PASSWD="${DOMAIN_ADMIN_PASSWD}"
+export FIRST_USER_PASSWD_PLAIN="${DOMAIN_ADMIN_PASSWD_PLAIN}"
 echo "export FIRST_USER='${FIRST_USER}'" >>${CONFIG_FILE}
-
-# FIRST_USER_PASSWD
-while : ; do
-    ${DIALOG} \
-    --title "Password for your first user" \
-    ${PASSWORDBOX} "\
-Please specify password for your first user:
-
-    * ${FIRST_USER}@${FIRST_DOMAIN}
-
-Note:
-
-    * You can login webmail with this account.
-
-WARNING:
-
-    * EMPTY password is *NOT* permitted.
-    * Please reset password immediately after installation completed.
-
-" 20 76 2>/tmp/first_user_passwd
-
-    FIRST_USER_PASSWD="$(cat /tmp/first_user_passwd)"
-    [ X"${FIRST_USER_PASSWD}" != X"" ] && break
-done
-
-export FIRST_USER_PASSWD_PLAIN="${FIRST_USER_PASSWD}"
 echo "export FIRST_USER_PASSWD='${FIRST_USER_PASSWD}'" >>${CONFIG_FILE}
 echo "export FIRST_USER_PASSWD_PLAIN='${FIRST_USER_PASSWD_PLAIN}'" >>${CONFIG_FILE}
-rm -f /tmp/first_user_passwd
 
 cat >> ${TIP_FILE} <<EOF
 Admin of domain ${FIRST_DOMAIN}:

File iRedMail/functions/dovecot2.sh

 
 dovecot2_config()
 {
-    ECHO_INFO "Configure Dovecot (pop3/imap server, version ${DOVECOT_VERSION})."
+    ECHO_INFO "Configure Dovecot (pop3/imap/managesieve server, version ${DOVECOT_VERSION})."
 
     backup_file ${DOVECOT_CONF}
 

File iRedMail/functions/mysql.sh

 /* Add your first domain. */
 INSERT INTO domain (domain,transport,created) VALUES ("${FIRST_DOMAIN}", "${TRANSPORT}", NOW());
 
-/* Add your first domain admin. */
-INSERT INTO admin (username,password,created) VALUES ("${DOMAIN_ADMIN_NAME}@${FIRST_DOMAIN}","${DOMAIN_ADMIN_PASSWD}", NOW());
+/* Add your first normal user. */
+INSERT INTO mailbox (username,password,name,maildir,quota,domain,isadmin,isglobaladmin,created) VALUES ("${FIRST_USER}@${FIRST_DOMAIN}","${FIRST_USER_PASSWD}","${FIRST_USER}","$( hash_domain ${FIRST_DOMAIN})/$( hash_maildir ${FIRST_USER} )",100, "${FIRST_DOMAIN}", 1, 1, NOW());
+INSERT INTO alias (address,goto,domain,created) VALUES ("${FIRST_USER}@${FIRST_DOMAIN}", "${FIRST_USER}@${FIRST_DOMAIN}", "${FIRST_DOMAIN}", NOW());
+
+/* Mark first mail user as global admin */
 INSERT INTO domain_admins (username,domain,created) VALUES ("${DOMAIN_ADMIN_NAME}@${FIRST_DOMAIN}","ALL", NOW());
 
-/* Add domain admin. */
-/*
-INSERT INTO mailbox (username,password,name,maildir,quota,domain,created) VALUES ("${DOMAIN_ADMIN_NAME}@${FIRST_DOMAIN}","${DOMAIN_ADMIN_PASSWD}","${DOMAIN_ADMIN_NAME}","${FIRST_DOMAIN}/${DOMAIN_ADMIN_NAME}/",0, "${FIRST_DOMAIN}",NOW());
-INSERT INTO alias (address,goto,domain,created) VALUES ("${DOMAIN_ADMIN_NAME}@${FIRST_DOMAIN}", "${DOMAIN_ADMIN_NAME}@${FIRST_DOMAIN}", "${FIRST_DOMAIN}", NOW());
-*/
-
-/* Add your first normal user. */
-INSERT INTO mailbox (username,password,name,maildir,quota,domain,created) VALUES ("${FIRST_USER}@${FIRST_DOMAIN}","${FIRST_USER_PASSWD}","${FIRST_USER}","$( hash_domain ${FIRST_DOMAIN})/$( hash_maildir ${FIRST_USER} )",100, "${FIRST_DOMAIN}", NOW());
-INSERT INTO alias (address,goto,domain,created) VALUES ("${FIRST_USER}@${FIRST_DOMAIN}", "${FIRST_USER}@${FIRST_DOMAIN}", "${FIRST_DOMAIN}", NOW());
 EOF
 
     ECHO_DEBUG "Import postfix virtual hosts/users: ${MYSQL_VMAIL_SQL}."

File iRedMail/functions/openldap.sh

 
 openldap_config()
 {
-    ECHO_INFO "Configure OpenLDAP server."
+    ECHO_INFO "Configure OpenLDAP server (Storing mail accounts)."
 
     ECHO_DEBUG "Stoping OpenLDAP."
     ${LDAP_RC_SCRIPT} stop &>/dev/null
 objectClass: top
 ou: ${LDAP_ATTR_GROUP_EXTERNALS}
 
-dn: ${LDAP_ATTR_USER_RDN}=${DOMAIN_ADMIN_NAME}@${FIRST_DOMAIN},${LDAP_ADMIN_BASEDN}
-objectClass: ${LDAP_OBJECTCLASS_MAILADMIN}
-objectClass: shadowAccount
-objectClass: top
-cn: ${DOMAIN_ADMIN_NAME}
-uid: ${DOMAIN_ADMIN_NAME}
-givenName: ${DOMAIN_ADMIN_NAME}
-${LDAP_ATTR_USER_RDN}: ${DOMAIN_ADMIN_NAME}@${FIRST_DOMAIN}
-${LDAP_ATTR_ACCOUNT_STATUS}: ${LDAP_STATUS_ACTIVE}
-${LDAP_ATTR_USER_PASSWD}: $(gen_ldap_passwd "${DOMAIN_ADMIN_PASSWD}")
-${LDAP_ATTR_DOMAIN_GLOBALADMIN}: ${LDAP_VALUE_DOMAIN_GLOBALADMIN}
-${LDAP_ENABLED_SERVICE}: ${LDAP_SERVICE_AWSTATS}
-
 dn: ${LDAP_ATTR_USER_RDN}=${FIRST_USER}@${FIRST_DOMAIN},${LDAP_ATTR_GROUP_RDN}=${LDAP_ATTR_GROUP_USERS},${LDAP_ATTR_DOMAIN_RDN}=${FIRST_DOMAIN},${LDAP_BASEDN}
 objectClass: inetOrgPerson
 objectClass: shadowAccount
 ${LDAP_ENABLED_SERVICE}: ${LDAP_SERVICE_DISPLAYED_IN_ADDRBOOK}
 ${LDAP_ENABLED_SERVICE}: ${LDAP_SERVICE_SHADOW_ADDRESS}
 ${LDAP_ENABLED_SERVICE}: ${LDAP_SERVICE_LIB_STORAGE}
+${LDAP_ENABLED_SERVICE}: ${LDAP_SERVICE_DOMAIN_ADMIN}
+${LDAP_ATTR_DOMAIN_GLOBALADMIN}: yes
 EOF
 
     ldapadd -x -D "${LDAP_ROOTDN}" -w "${LDAP_ROOTPW}" -f ${LDAP_INIT_LDIF} >/dev/null

File iRedMail/functions/postfix.sh

 
 postfix_config_basic()
 {
-    ECHO_INFO "Configure Postfix."
+    ECHO_INFO "Configure Postfix (Message Transfer Agent)."
 
     # OpenBSD: Replace sendmail with Postfix
     if [ X"${DISTRO}" == X'OPENBSD' ]; then

File iRedMail/functions/postgresql.sh

 -- Add first mail domain
 INSERT INTO domain (domain,transport,created) VALUES ('${FIRST_DOMAIN}', '${TRANSPORT}', NOW());
 
--- Add first domain admin
-INSERT INTO admin (username,password,created) VALUES ('${DOMAIN_ADMIN_NAME}@${FIRST_DOMAIN}','${DOMAIN_ADMIN_PASSWD}', NOW());
+-- Add first mail user
+INSERT INTO mailbox (username,password,name,maildir,quota,domain,isadmin,isglobaladmin,created) VALUES ('${FIRST_USER}@${FIRST_DOMAIN}','${FIRST_USER_PASSWD}','${FIRST_USER}','$( hash_domain ${FIRST_DOMAIN})/$( hash_maildir ${FIRST_USER} )',100, '${FIRST_DOMAIN}', 1, 1, NOW());
+INSERT INTO alias (address,goto,domain,created) VALUES ('${FIRST_USER}@${FIRST_DOMAIN}', '${FIRST_USER}@${FIRST_DOMAIN}', '${FIRST_DOMAIN}', NOW());
+
+-- Mark first mail user as global admin
 INSERT INTO domain_admins (username,domain,created) VALUES ('${DOMAIN_ADMIN_NAME}@${FIRST_DOMAIN}','ALL', NOW());
-
--- Add first mail user
-INSERT INTO mailbox (username,password,name,maildir,quota,domain,created) VALUES ('${FIRST_USER}@${FIRST_DOMAIN}','${FIRST_USER_PASSWD}','${FIRST_USER}','$( hash_domain ${FIRST_DOMAIN})/$( hash_maildir ${FIRST_USER} )',100, '${FIRST_DOMAIN}', NOW());
-INSERT INTO alias (address,goto,domain,created) VALUES ('${FIRST_USER}@${FIRST_DOMAIN}', '${FIRST_USER}@${FIRST_DOMAIN}', '${FIRST_DOMAIN}', NOW());
 EOF
 
     ECHO_DEBUG "Import postfix virtual hosts/users: ${PGSQL_INIT_SQL_SAMPLE}."

File iRedMail/iRedMail.sh

 # Install all packages.
 check_status_before_run install_all || (ECHO_ERROR "Package installation error, please check the output log." && exit 255)
 
+echo -e '\n\n'
 ECHO_INFO "---- Start iRedMail Configurations ----"
 
 # Create SSL/TLS cert file.