Steps to setup a virtual domain with e-mail: Note: replace with the domain you are setting up. Note: DMZ nor DMZ Services or any orginization they represent is liable in any form if this utterly screws up anything associated with anyone anywhere at any time. These docs are only assistance notes, if steps were missed we apologise and wish you the best in getting it working. Enjoy Setup in dns entries for: cyradm. mail. Create a database for virtual domain e-mail: cd /usr/local/etc/virtual/setup mysql --user=root -p mysql> create database mail ex: [root@linux646 setup]# mysql --user=root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 337 to server version: 3.22.27 Type 'help' for help. mysql> create database mail; Query OK, 1 row affected (0.02 sec) mysql> quit Bye mysql --user=root --password= mail < twig.table.mysql edit sqltable.auth.population put in administrator password mysql --user=root --password= mail < sqltable.auth.population mysql --user=root --password= mail < advanced.acl.population ex: [root@linux646 setup]# mysql --user=root --password= mail < twig.table.mysql [root@linux646 setup]# mysql --user=root --password= mail < sqltable.auth.population [root@linux646 setup]# mysql --user=root --password= mail < advanced.acl.population Create email server account & account web-mail user accounts in mysql goto https://mysql. login as root select mysql, table user browse to look @ how other accounts are setup, then select insert and fill in, User accounts get NO for all privileges. Next we will add permission to specific databases. ************* important note **************** you have to specify that the password row has PASSWORD selected in the function column. If you don't it will cause the database to hang up & have to be manually fixed. ************* important note **************** you need to insert 2 IDs, 1 for the cyrus-imap daemon, and another for the mail php web interface. look @ names used & make similar: cyrus mail ex: localhost cucyrus 48c26e995fbbf7f2 N N N N N N N N N N N N N N localhost cumail 391c96152e099f16 N N N N N N N N N N N N N N ** note ** if you see the plaintext password you typed in the password field edit the record immediatly and choose in the password function column PASSWORD before your corrupt the database! ** note ** select mysql, table db brose to look @ how they are filled in. Note all use localhost for server, and that there are the 2 account created above cyrus & mail where the cyrus gets select only on the mail database and the mail user gets full rights to the mail database insert records for each with these permissions. ex: localhost mail cucyrus Y N N N N N N N N N localhost mail cumail Y Y Y Y Y Y Y Y Y Y Reload Mysql: select Home & in window on right "Reload MySQL" **note** if you don't reload these accounts won't be activated Create imapd.conf file: cd /usr/local/etc/virtual cp -p imapd.conf. imapd.conf. edit imapd.conf. imapd.conf. : change configdirectory, default partition, news directories and partition- plus sievedir @ bottom. look @ others differences in them Special note, partition- needs to have defaultpartition: defined where is < 8 characters or nothing will work @ the bottom of imapd.conf are the mysql access options they need to be modified to use the cyrus mysql user id and password (non-encrypted) used to access the mail database. ex: configdirectory: /usr/local/spool/cyrus defaultpartition: partition-: /usr/local/spool/cyrus/ #** note ** ^^^ don't forget to change partition name here to match # defaultpartition partition-news: /usr/local/spool/cyrus/news # .... etc... sievedir: /usr/local/spool/cyrus/sieve sasl_mysqluser: cucyrus sasl_mysqlpasswd: sasl_mysqlhost: localhost sasl_mysqldatabase: mail make sure imapd.conf. is owned by cyrus group www-data: cd /usr/local/etc/virtual ls -l imapd.conf* if any not cyrus www-data: chown chrus.www-data imapd.conf. ex: [root@linux646 virtual]# ls -l imapd.conf.* -rw-rw---- 1 cyrus www-data 940 Jan 15 16:54 imapd.conf. -rw-rw---- 1 root root 961 Jan 15 20:14 imapd.conf. -rw-rw---- 1 cyrus www-data 977 Jan 15 16:54 imapd.conf. [root@linux646 virtual]# chown cyrus.www-data imapd.conf. [root@linux646 virtual]# !ls ls -l imapd.conf.* -rw-rw---- 1 cyrus www-data 940 Jan 15 16:54 imapd.conf. -rw-rw---- 1 cyrus www-data 961 Jan 15 20:14 imapd.conf. -rw-rw---- 1 cyrus www-data 977 Jan 15 16:54 imapd.conf. create config directory specified in the imapd.conf cd /usr/local/etc/virtual/setup edit mkimap & replace imapd.conf with /usr/local/etc/virtual/imapd.conf. ./mkimap ex: [root@linux646 setup]# ./mkimap reading configure file... i will configure directory /usr/local/spool/cyrus. i saw partition /usr/local/spool/cyrus/. i saw partition /usr/local/spool/cyrus/news. you are using /usr/local/spool/cyrus/sieve as your sieve directory. done creating /usr/local/spool/cyrus... creating /usr/local/spool/cyrus/sieve... done Change ownership of new mail partitions to cyrus.mail and make only readable by them: cd /usr/local/spool chown -R cyrus.mail cyrus chmod 770 cyrus ex: [root@linux646 etc]# cd ../spool/ [root@linux646 spool]# ls -l total 5 drwxrwx--- 10 cyrus mail 1024 Jan 13 14:44 cyrus drwxr-xr-x 9 root root 1024 Jan 15 20:28 cyrus drwxrwx--- 11 cyrus mail 1024 Jan 15 19:40 cyrus drwxr-x--- 5 mail mail 1024 Dec 29 10:32 exim drwxrwx--- 4 www-data mail 1024 Jan 15 19:14 vacation [root@linux646 spool]# chown -R cyrus.mail cyrus/ [root@linux646 spool]# chmod -R 770 cyrus/ [root@linux646 spool]# ls -l total 5 drwxrwx--- 10 cyrus mail 1024 Jan 13 14:44 cyrus drwxrwx--- 9 cyrus mail 1024 Jan 15 20:28 cyrus drwxrwx--- 11 cyrus mail 1024 Jan 15 19:40 cyrus drwxr-x--- 5 mail mail 1024 Dec 29 10:32 exim drwxrwx--- 4 www-data mail 1024 Jan 15 19:14 vacation Configure inetd for new domain edit /etc/inetd.conf - follow examples there using new imapd.conf. file noting the pop/imap ports created - I suggest just using #110 / #143 for ports as you can go up to 32768 ports on some systems, and that can even be increased. If you get greater than 320 virtual e-mail servers on this domain get a new machine with all that $$ :) restart inetd /etc/rc.d/init.d/inet stop /etc/rc.d/init.d/inet start Test cyrus allows administrator to logon cyradm -user administrator localhost ex: cyradm -user administrator localhost 2143 localhost> quit ** Note you shouldn't get ANY errors here, if you do go back & make sure all previous steps are working. examine logfiles and see where went wrong. Could be a typo in a password. cyradm can be used in the future, but from here forward use the web interface Configure web interface for cyradm, mail & vacation This all assumes that /usr/local/apache/htdocs//mail is preinstalled & working twig2.1 out of cvs and /mail/cyradm is the cyrus phpadmin tools, /mail/vacation is the phpstatus tools. All available in freshmeat (cyradm/cyrstatus are in same package) Also, all of these pages can be customized to fit look/feel of pages. Just do not change programming or config files, just syntax, headers, footers, etc. mail/config has all the mail header/footer/images /vacation & /cyradm similar structure php code. cd /usr/local/apache/htdocs/ mkdir mail cp -pr /usr/local/apache/htdocs//mail/* mail cd mail rm -r mail ln -s . mail cd .. chown -R . mail Configure web e-mail for new domain cd /usr/local/apache/htdocs/mail/config edit config.inc.php3 modify: fromdomain imap_port edit dbconfig.inc.php3 modify: sqlusername sqlpassword defaultdb Modify apache conf for mail. to require SSL and use the directory /mail as setup like others Configure cyradm for new domain cd /usr/local/apache/htdocs/mail/cyradm/config edit config.php3 modify: $IMAPPORT $IMAPCONFIGFILE $PWD_FILE ex: $IMAPPORT=2143; $IMAP_CONFIG_PATH="/usr/local/etc/virtual/imapd.conf."; $PWD_FILE="/usr/local/apache/htdocs//mail/cyradm/mailadminpasswd"; Now set the password for cyadm access (this is the only place it is in a separate file from the database, if administrator user changes his/her password this step will NEED to be done again. cd .. /usr/local/apache/bin/htpasswd mailadminpasswd administrator password: Modify apache conf for cyradm. to require SSL and use the directory /mail/cyradm as setup like others ** Note ** remember to goto https://cyradm..com and create an account for administrator after you reset apache below Configure the mail forwarding/vacation -- NOTE if this isn't done the e-mail server will die and noone's mail will work. cd /usr/local/apache/htdocs//mail/vacation/config edit config.php3 modify: $default->mail_domain $default->imap_port $default->aliases_file $default->status_dir $default->tmp_dir $default->vac_dir $default->vac_prog $default->logfile ex: $default->mail_domain = ""; /* maildomain */ $default->imap_port = 2143; /* imap-port */ /* ... further down ... */ $default->aliases_file = "/usr/local/etc/virtual/virtual-aliases-"; /* aliases file */ $default->status_dir = "/usr/local/spool/vacation//forward/status"; /* forward status directory */ $default->tmp_dir = "/usr/local/spool/vacation//forward/tmp"; /* temporary directory for authentication status */ $default->vac_template = "/usr/local/etc/virtual/vacation.templ"; /* vacation message template-file*/ $default->vac_dir = "/usr/local/spool/vacation//"; /* vacation stuff directory */ $default->vac_prog = "/usr/local/etc/virtual/vacation.pl"; /* vacation program */ $default->logfile = "/usr/local/spool/vacation//mailsettings.log"; /* logfile where th e actions are logged */ Create vacation/forward spool directory & files, match files set in cfg above *** note failure to do any of these will cause the system to NOT work *** cd /usr/local/etc/virtual touch virtual-aliases- chown www-data.mail virtual-aliases- chmod 644 virtual-aliases- cp -p vacation.conf vacation.conf edit vacation.conf modify: $message_dir $rfrom ex: $message_dir='/usr/local/spool/vacation/'; $rfrom = '@'; cp -p vacation.pl vacation.pl edit vacation.pl modify: $conf -- near end , search for mail sent through the autoresponder change to ex: $conf='/etc/virtual/vacation.conf'; print MAIL "\n------ mail sent through the autoresponder on -------\n"; create spool directory: cd /usr/local/spool/vacation mkdir mkdir /forward mkdir /forward/status mkdir /forward/tmp mkdir /logs chown -R www-data.mail chmod 770 ex: [root@linux646 vacation]# mkdir [root@linux646 vacation]# mkdir /forward [root@linux646 vacation]# mkdir /forward/status [root@linux646 vacation]# mkdir /forward/tmp [root@linux646 vacation]# mkdir /forward/logs [root@linux646 vacation]# chown -R www-data.mail / [root@linux646 vacation]# chmod 770 / Make sure www-data is in the group of the domain installed. edit /etc/groups modify : and add ,www-data Restart Apache : /usr/local/apache/bin/httpsdctl stop /usr/local/apache/bin/httpsdctl start use cyradm..com to add/delete user account once cyradm account created, use mail..com, logon as administrator to create accounts don't forget to add these users to the everybody group or they won't be able to read their mail from the web interface. Remotely they can use imap or pop applications with access their mail, just use the pop/imap ports created when doing the inetd.conf config. 1/15/2000 dmz