Changes between Version 1 and Version 2 of howto/PostfixAdmin


Ignore:
Timestamp:
Jun 26, 2011, 4:41:42 PM (13 years ago)
Author:
BjarneDMat
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • howto/PostfixAdmin

    v1 v2  
    1010== Introduction ==
    1111
     12{{{
     13#!html
     14<div style="text-align: center; background-color: yellow; color: red; padding: 2em;">
     15<h1>!!! NOTE !!!</h1>
     16<p>
     17I'm custom-installing MacPorts and everything heavily. I'm documenting my own procedures here along with musing as to why I'm doing what I'm doing. If you want to install somewhere else or in the standard paths, you'll have to modify some settings and path values to suit your own needs.
     18</p>
     19</div>
     20}}}
     21
     22At present this is a bit raw ... I've chosen to just dump configuration settings and procedures in this howto to get it started.
     23
     24During the whole process it's a very good idea to open a terminal windows to {{{tail -40f /private/var/log/mail.log/}}} to see what happening with postfix. If something is wrong with postfix, this is the place to see it.
     25
     26I'll also recommend that you do a {{{tail -40f /macports/apache2/logs/error_log}}}.
    1227
    1328== Installation ==
     
    1530=== Step 1: '''Apache Configuration''' ===
    1631
     32I'm setting postfixadmin up as a subdomain : !http://postfixadmin.testdomain.test/.
     33
     34The procedure for setting it up as as !http://www.testdomain.test/postfixadmin/ can be found in [wiki:howto/MAMP]
     35
     36{{{
     37NameVirtualHost *:80
     38
     39# This emty VirtualHost has the effect that Apache serves the pages defined in the main part as the default server
     40<VirtualHost *:80>
     41</VirtualHost>
     42
     43#
     44# Here are the site specific settings for postfixadmin.mathiesen.test
     45# Settings not defined here will be taken over from the main server in httpd.conf
     46#
     47<VirtualHost *:80>
     48
     49##
     50## httpd.conf -- Apache HTTP server configuration file
     51##
     52
     53    ServerName postfixadmin.mathiesen.test
     54
     55    DocumentRoot "/Volumes/Bjarne/Sites/info/mathiesen/postfixadmin/html"
     56    <Directory "/Volumes/Bjarne/Sites/info/mathiesen/postfixadmin/html">
     57        Options Indexes
     58        AllowOverride None
     59
     60        Order allow,deny
     61        Allow from all
     62    </Directory>
     63
     64    ErrorLog "|/macports/sbin/cronolog /Volumes/Bjarne/Sites/info/mathiesen/postfixadmin/logs/error/%Y%m.log"
     65    LogLevel warn
     66    CustomLog "|/macports/sbin/cronolog /Volumes/Bjarne/Sites/info/mathiesen/postfixadmin/logs/access/%Y%m.log" common
     67
     68    SetEnv WEB_SITE postfixadmin.mathiesen.test
     69
     70# This is a security recommendation from the INSTALL.TXT file in postfixadmin
     71    SetEnv DB_USER "postadmin"
     72    SetEnv DB_PASS "postadmin"
     73
     74##
     75## php.ini
     76##
     77    php_value include_path ".:/Volumes/Bjarne/Sites/info/mathiesen/postfixadmin"
     78    php_value open_basedir "/Volumes/Bjarne/Sites/info/mathiesen/postfixadmin/"
     79    php_value session.save_path "/Volumes/Bjarne/Sites/info/mathiesen/postfixadmin/php-sessions"
     80    php_value session.name "PHPSESSID"
     81    php_value session.cookie_domain "postfixadmin.mathiesen.test"
     82
     83</VirtualHost>
     84
     85# This VirtualHost is a catch-all that redirects <everything>.mathiesen.test to www.mathiesen.test
     86<VirtualHost *:80>
     87    ServerName mathiesen.test
     88    ServerAlias *.mathiesen.test
     89
     90    Redirect / http://www.mathiesen.test
     91</VirtualHost>
     92}}}
     93
     94To test if your setup can start without initial problems, execute.
     95{{{
     96/macports/apache2/bin/httpd -S
     97}}}
     98
     99Additionally
     100
    17101=== Step 2: '''Postfix Configuration''' ===
    18102
    19 === Step 3: '''MySQL Configuration''' ===
     103You'll have to edit the main.cf file and add these settings. The settings here are based upon information in the files
     104 * POSTFIX_CONF from postfixadmin
     105 * VIRTUAL_README from postfix
     106
     107I'm storing the settings and the mail way outside the system paths. It's my plan to set up a RAID 1 to hold my email folders etc. I'm already doing this for my websites.
     108{{{
     109# ADDRESS REDIRECTION (VIRTUAL DOMAIN)
     110#
     111# The VIRTUAL_README document gives information about the many forms
     112# of domain hosting that Postfix supports.
     113
     114virtual_mailbox_base = /Volumes/Bjarne/Sites/postfix/mail
     115virtual_minimum_uid = 100
     116virtual_uid_maps = static:5000
     117virtual_gid_maps = static:5000
     118
     119virtual_mailbox_domains = proxy:mysql:/Volumes/Bjarne/Sites/postfix/mysql/virtual_domains_maps.cf
     120virtual_alias_maps =
     121   proxy:mysql:/Volumes/Bjarne/Sites/postfix/mysql/virtual_alias_maps.cf,
     122   proxy:mysql:/Volumes/Bjarne/Sites/postfix/mysql/virtual_alias_domain_maps.cf,
     123   proxy:mysql:/Volumes/Bjarne/Sites/postfix/mysql/virtual_alias_domain_catchall_maps.cf
     124virtual_mailbox_maps =
     125   proxy:mysql:/Volumes/Bjarne/Sites/postfix/mysql/virtual_mailbox_maps.cf,
     126   proxy:mysql:/Volumes/Bjarne/Sites/postfix/mysql/virtual_alias_domain_mailbox_maps.cf
     127
     128virtual_create_maildirsize = yes
     129virtual_mailbox_extended = yes
     130virtual_mailbox_limit_maps = mysql:/Volumes/Bjarne/Sites/postfix/mysql/virtual_mailbox_limit_maps.cf
     131virtual_mailbox_limit_override = yes
     132virtual_maildir_limit_message = Sorry, the user's maildir has overdrawn his diskspace quota, please try again later.
     133virtual_overquota_bounce = yes
     134}}}
     135We'll have to make sure postfix can access and write to the virtual_mailbox_base
     136{{{
     137chown _postfix:5000 /Volumes/Bjarne/Sites/postfix
     138chmod 0770 /Volumes/Bjarne/Sites/postfix
     139}}}
     140
     141The *.cf files can be found as attachments to this howto. You'll have to be careful with the line endings in the files making sure they are *NIX ones (LF) and not Classic Mac [CR). This tripped me up initially, and I got at lot of error messages in {{{private/var/log/mail.log}}} that were at bit hard to figure out !
     142
     143=== Step 3: '''MySQL Configuration part 1''' ===
     144
     145see my tutorial on [wiki:howto/MySQLWorkbench MySQL Workbench
    20146
    21147=== Step 4: '''Postfixadmin Configuration''' ===
    22148
     149Start by making a copy of the file {{{config.inc.php}}} naming it {{{config.inc.edited.php}}}. Then, edit the settings in the copy to your likings. Based upon the default and the edited file we'll make a {{{config.local.php}}}. {{{config.local.php}}} will hold settings that overrides the default settings from {{{config.inc.php}}}
     150{{{
     151cd /Volumes/Bjarne/Sites/info/mathiesen/postfixadmin/html
     152diff config.inc.php config.inc.edited.php | sed -En -e '/^>/p' | sed -E -e 's/^> //' > config.local.php
     153}}}
     154The '''bold''' lines in the following are ones you'll have to add manually.
     155{{{
     156'''<?php'''
     157$CONF['configured'] = true;
     158$CONF['setup_password'] = 'md5cryptpassword';
     159$CONF['postfix_admin_url'] = 'http://postfixadmin.mathiesen.test';
     160$CONF['default_language'] = 'da';
     161$CONF['database_type'] = 'mysqli';
     162$CONF['database_user'] = $_SERVER['DB_USER'];
     163$CONF['database_password'] = $_SERVER['DB_PASS'];
     164$CONF['database_name'] = 'webmail';
     165$CONF['admin_email'] = 'macintosh@mathiesen.info';
     166$CONF['min_password_length'] = 8;
     167$CONF['generate_password'] = 'YES';
     168$CONF['show_password'] = 'YES';
     169$CONF['page_size'] = '20';
     170'''$CONF['default_aliases'] = array ('''
     171    'abuse'         => 'mailadmin@mathiesen.test',
     172    'hostmaster'    => 'mailadmin@mathiesen.test',
     173    'postmaster'    => 'mailadmin@mathiesen.test',
     174    'webmaster'     => 'mailadmin@mathiesen.test'
     175''');'''
     176$CONF['domain_path'] = 'YES';
     177$CONF['quota'] = 'YES';
     178$CONF['quota_multiplier'] = '1048576';
     179$CONF['fetchmail'] = 'NO';
     180$CONF['show_header_text'] = 'YES';
     181$CONF['user_footer_link'] = "http://avisbude.test/";
     182$CONF['footer_link'] = 'http://avisbude.test/';
     183$CONF['create_mailbox_subdirs_prefix']='';
     184$CONF['new_quota_table'] = 'YES';
     185}}}
     186'''?>'''
     187
    23188=== Step 5: '''Postfixadmin First Run''' ===
    24189
     190Access !http://postfixadmin.mathiesen.test/setup.php and create a superadmin.
     191You'll get a password that you'll have to set as the value for {{{$CONF['setup_password']}}} in {{{config.local.php}}}
     192
     193Now, access !http://postfixadmin.mathiesen.test/ and log in as your superadmin.
     194Do the following steps :
     195 1. create at least one domain for which to administer email for
     196 1. create additional administrators if necessary
     197 1. create email accounts and send the welcome email to them.
     198
     199=== Step 6: '''MySQL Configuration part 2''' ===
     200
    25201== Optional Parts ==
    26202