PostfixAdmin (Ubuntu 16.04)

Aus Tutorials
Zur Navigation springen Zur Suche springen

Voraussetzungen

LAMP-Server, dazu siehe auch: Apache, MySQL

Installation

PHP

sudo apt-get install php-imap
sudo service apache2 restart

tar-Verzeichnis

Aktuelle Version unter https://sourceforge.net/projects/postfixadmin/files/postfixadmin herunterladen.

wget https://sourceforge.net/projects/postfixadmin/files/postfixadmin/postfixadmin-3.1/postfixadmin-3.1.tar.gz
tar -xzf postfixadmin-3.1.tar.gz
sudo mv postfixadmin-3.1 /var/www/postfixadmin/
sudo chown -R www-data:www-data /var/www/postfixadmin/
sudo -u www-data mkdir /var/www/postfixadmin/templates_c

In dem entpackten Verzeichnis befindet sich auch eine Datei Install.txt, wo die grundlegenden Schritte beschrieben werden.

MySQL

mysql -u root -p 
mysql> create database if not exists postfix;
mysql> create user 'postfix'@'%' identified by '<password>';
mysql> grant all privileges on postfix.* to 'postfix'@'%';
mysql> flush privileges; 
mysql> quit;

Konfiguration

Apache2

cd /etc/apache2/conf-available/
sudo vi /etc/apache2/conf-available/postfixadmin.conf
Alias /postfixadmin "/var/www/postfixadmin/"
<Directory "/var/www/postfixadmin">
    Options +FollowSymLinks
    AllowOverride All

    <IfModule mod_dav.c>
      Dav off
    </IfModule>

    SetEnv HOME /var/www/postfixadmin
    SetEnv HTTP_HOME /var/www/postfixadmin
</Directory>
sudo a2enconf postfixadmin
sudo service apache2 reload

PostfixAdmin

Grundkonfiguration

Konfigurationsdatei anlegen (überschreibt die Standardwerte in config.inc.php):

cd /var/www/postfixadmin/
sudo -u www-data vi config.local.php

Datei sollte in der Grundkonfiguration etwa so aussehen:

<?php
$CONF['configured'] = true;

$CONF['database_type'] = 'mysqli';
$CONF['database_user'] = 'postfix';
$CONF['database_password'] = '<password>';
$CONF['database_name'] = 'postfix';
?>

Nach Abschluss aller Konfigurationen sollte die Datei dann so aussehen:

<?php
$CONF['configured'] = true;

$CONF['setup_password'] = '<setup password>';
$CONF['default_language'] = 'de';
$CONF['database_type'] = 'mysql';
$CONF['database_user'] = 'postfix';
$CONF['database_password'] = '<database password>';
$CONF['database_name'] = 'postfix';
$CONF['admin_email'] = '<mail address>';
$CONF['encrypt'] = 'dovecot:SHA512-CRYPT';
$CONF['dovecotpw'] = "/usr/bin/doveadm pw";
$CONF['transport'] = 'YES';

$CONF['default_aliasis'] = array (
     'abuse' => '<mail address>',
     'hostmaster' => '<mail address>',
     'postmaster' => '<mail address>',
     'webmaster' => '<mail address>'
);

$CONF['password_validation'] = array(
#    '/regular expression/' => '$PALANG key (optional: + parameter)',
    '/.{5}/'                => 'password_too_short 5',      # minimum length 5 characters
    '/([a-zA-Z].*){3}/'     => 'password_no_characters 3',  # must contain at least 3 characters
    '/([0-9].*){1}/'        => 'password_no_digits 1',      # must contain at least 1 digit(s)
);

$CONF['aliases'] = '100';
$CONF['mailboxes'] = '100';
$CONF['maxquota'] = '100';
$CONF['domain_quota_default'] = '2048';

$CONF['footer_text'] = 'Return to mail.<domain>';
$CONF['footer_link'] = 'https://mail.<domain>';
$CONF['mailbox_postcreation_script'] = 'sudo -u vmail /usr/local/bin/postfixadmin-mailbox-postcreation.sh';
$CONF['mailbox_postdeletion_script'] = 'sudo -u vmail /usr/local/bin/postfixadmin-mailbox-postdeletion.sh';
$CONF['domain_postdeletion_script'] = 'sudo -u vmail /usr/local/bin/postfixadmin-domain-postdeletion.sh';

// Default Aliases
// The default aliases that need to be created for all domains.
// You can specify the target address in two ways:
// a) a full mail address
// b) only a localpart ('postmaster' => 'admin') - the alias target will point to the same domain
$CONF['default_aliases'] = array (
    'abuse' => 'abuse@<domain>',
    'hostmaster' => 'hostmaster@<domain>',
    'postmaster' => 'postmaster@<domain>',
    'webmaster' => 'webmaster@<domain>'
);

// If you want to use virtual vacation for you mailbox users set this to 'YES'.
// NOTE: Make sure that you install the vacation module. (See VIRTUAL-VACATION/)
$CONF['vacation'] = 'YES';

// This is the autoreply domain that you will need to set in your Postfix
// transport maps to handle virtual vacations. It does not need to be a
// real domain (i.e. you don't need to setup DNS for it).
// This domain must exclusively be used for vacation. Do NOT use it for "normal" mail addresses.
$CONF['vacation_domain'] = 'autoreply.<domain>';
?>

Setup aufrufen

Wenn die Grundkonfiguration abgeschlossen ist, wird das Setup-Script aufgerufen:

http://10.0.0.120/postfixadmin/setup.php

Default Aliases

Die Datei config.local.php editieren

sudo vi /var/www/postfixadmin/config.local.php

und am Ende folgende Zeilen hinzufügen:

// Default Aliases
// The default aliases that need to be created for all domains.
// You can specify the target address in two ways:
// a) a full mail address
// b) only a localpart ('postmaster' => 'admin') - the alias target will point to the same domain
$CONF['default_aliases'] = array (
    'abuse' => 'abuse@<domain>',
    'hostmaster' => 'hostmaster@<domain>',
    'postmaster' => 'postmaster@<domain>',
    'webmaster' => 'webmaster@<domain>'
);

Verzeichnisse automatisch erstellen bzw. löschen

Siehe dazu PostfixAdmin Verzeichnisverwaltung

Automatische Urlaub Antwortmails

Siehe dazu PostfixAdmin Autoresponder

Fetchmail

Siehe dazu PostfixAdmin Fetchmail

Probleme

the templates_c directory doesn’t exist or isn’t writeable for the webserver

Einfach ein leeres Verzeichnis template_c unter /var/www/postfixadmin/ anlegen.

Links

http://blog.cboltz.de/uploads/postfixadmin-30-english.pdf


Zurück zu Dovecot

Zurück zu Mailserver einrichten