setup postfix/dovecot by hand

Discussion in 'General' started by skizza, Jan 18, 2009.

  1. skizza

    skizza New Member

    I was thinking of setting up a standalone mail server and I like the filtering + quota features that ispconfig adds to the setup.
    How can I recreate an exact same setup postfix/dovecot by hand so that I can run a standalone mail server that doesn't run ispconfig?
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Go trough the ispconfig installer and do everything manually that the installer does. But I dont see much sense in that as its much easier to use ispconfig instead.
     
  3. skizza

    skizza New Member

    I suck at mailservers, and I'd rather know what is going on rather than relying on "magic". It allows me to fix things if there are random errors, and possibly allow me to contribute in the future.
    Analyzing the source was probably the first thing I did, but if things were that simple I wouldnt be asking.

    I took a glance at install.php and installer_base.lib.php, but before going into it further I decided to check for a global overview of changes in order to get a "birds eye view" of the changes made to the system.

    I did a clean install of debian etch on a xen domU. After I followed the latest RC and followed the instructions in INSTALL_DEBIAN_4.0.txt I created a tarball of my entire filesystem.
    I then ran the installer and afterwards created another snapshot.

    Now I can clearly see there were new files and directories added and to which files changes were made. (Check the "filtered" list below).
    Code:
    /etc/amavis/conf.d/50-user
    /etc/courier/authdaemonrc
    /etc/courier/authmysqlrc
    /etc/default/saslauthd
    /etc/default/spamassassin
    /etc/group
    /etc/group-
    /etc/gshadow
    /etc/gshadow-
    /etc/init.d/saslauthd
    /etc/pam.d
    /etc/passwd
    /etc/passwd-
    /etc/postfix/body_checks
    /etc/postfix/header_checks
    /etc/postfix/main.cf
    /etc/postfix/master.cf
    /etc/postfix/mime_header_checks
    /etc/postfix/mysql-virtual_client.cf
    /etc/postfix/mysql-virtual_domains.cf
    /etc/postfix/mysql-virtual_email2email.cf
    /etc/postfix/mysql-virtual_forwardings.cf
    /etc/postfix/mysql-virtual_mailboxes.cf
    /etc/postfix/mysql-virtual_recipient.cf
    /etc/postfix/mysql-virtual_relaydomains.cf
    /etc/postfix/mysql-virtual_sender.cf
    /etc/postfix/mysql-virtual_transports.cf
    /etc/postfix/nested_header_checks
    /etc/postfix/sasl
    /etc/postfix/smtpd.cert
    /etc/postfix/smtpd.key
    /etc/shadow
    /etc/shadow-
    /var/lib/amavis/.spamassassin
    /var/lib/amavis/db/cache-expiry.db
    /var/lib/amavis/db/cache.db
    /var/lib/amavis/db/nanny.db
    /var/lib/amavis/db/snmp.db
    /var/lib/amavis/db/__db.001
    /var/lib/amavis/db/__db.002
    /var/lib/amavis/db/__db.003
    /var/lib/amavis/db/__db.004
    /var/lib/mysql/dbispconfig
    /var/lib/mysql/mysql/db.MYD
    /var/lib/mysql/mysql/db.MYI
    /var/lib/mysql/mysql/user.MYD
    /var/lib/mysql/mysql/user.MYI
    /var/log/auth.log
    /var/log/clamav/clamav.log
    /var/log/daemon.log
    /var/log/faillog
    /var/log/ispconfig_install.log
    /var/log/lastlog
    /var/log/mail.info
    /var/log/mail.log
    /var/log/mysql/mysql-bin.000007
    /var/log/ntpstats/loopstats
    /var/log/ntpstats/loopstats.20090118
    /var/log/ntpstats/peerstats
    /var/log/syslog
    /var/spool/postfix/prng_exch
    /var/spool/postfix/smtpd_scache.db
    /var/spool/postfix/smtp_scache.db
    /var/spool/postfix/var
    /var/vmail
    

    Now the following files are the most interesting to see what was added or changed
    Code:
    /etc/amavis/conf.d/50-user
    
    /etc/courier/authdaemonrc
    /etc/courier/authmysqlrc
    
    /etc/default/saslauthd
    /etc/default/spamassassin
    
    /etc/init.d/saslauthd
    
    /etc/pam.d/smtp
    
    /etc/postfix/body_checks
    /etc/postfix/header_checks
    /etc/postfix/main.cf
    /etc/postfix/master.cf
    /etc/postfix/mime_header_checks
    /etc/postfix/mysql-virtual_client.cf
    /etc/postfix/mysql-virtual_domains.cf
    /etc/postfix/mysql-virtual_email2email.cf
    /etc/postfix/mysql-virtual_forwardings.cf
    /etc/postfix/mysql-virtual_mailboxes.cf
    /etc/postfix/mysql-virtual_recipient.cf
    /etc/postfix/mysql-virtual_relaydomains.cf
    /etc/postfix/mysql-virtual_sender.cf
    /etc/postfix/mysql-virtual_transports.cf
    /etc/postfix/nested_header_checks
    /etc/postfix/smtpd.cert
    /etc/postfix/smtpd.key
    /etc/postfix/sasl/smtpd.conf
    
    Now an example of the problems I run in with "simply reading the source"

    In the output I noticed that the files below were also different.

    Code:
    /etc/group
    /etc/group-
    
    /etc/gshadow
    /etc/gshadow-
    
    /etc/passwd
    /etc/passwd-
    
    /etc/shadow
    /etc/shadow-
    
    changes made to passwd and shadow, etc indicate that there were some commands executed using either exec() or system()

    now browsing the source I find the following references to adding system users.

    Code:
    $command = 'useradd -g '.$cf['vmail_groupname'].' -u '.$cf['vmail_userid'].' '.$cf['vmail_username'].' -d '.$cf['vmail_mailbox_base'].' -m';
    $command = "useradd -d $config_dir getmail";
    $command = "useradd -g ispconfig -d $install_dir ispconfig";
    
    Code:
    		exec('adduser postfix sasl');
    		exec('adduser clamav amavis');
    		$command = 'adduser www-data ispconfig';
    
    Code:
    	public function adduser($user_username, $uid, $gid, $username, $homedir, $shell, $passwort = '*'){
    	  	$this->adduser($user_username, $uid, $gid, $username, $homedir, $shell, $passwort);
    	  	$this->adduser($user_username, $uid, $gid, $username, $homedir, $shell, $passwort);
    
    Code:
    		$command = 'useradd -g '.$cf['vmail_groupname'].' -u '.$cf['vmail_userid'].' '.$cf['vmail_username'].' -d '.$cf['vmail_mailbox_base'].' -m';
    		$command = "useradd -d $config_dir getmail";
    		$command = "useradd -g ispconfig -d $install_dir ispconfig";
    
    In other words, the script creates new users using various methods, using functions that are defined in other files.

    This is just an example, there are many more commands of which it is not clear in which order they are execute.

    As much as I like going on a scavenger hunt, I suppose it would be far easier to just ask a dev for further clarification.
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    I recommend that you follow the functions starting from install.php and you will get the commands in the right order. Grepping for them dont help as you dont see the context.

    This is really easy as the installe calls a single function for every daemon to be cinfigured and these functions are all in the installer_base library.

    If you would have followed the code as I suggested you would have seen the the function "public function adduser(...." is not used by the installer.
     

Share This Page