Mailserver einrichten

Aus Tutorials
Zur Navigation springen Zur Suche springen

Voraussetzungen

Für den Betrieb eines Mailservers ist eine Datenbank Voraussetzung - ich habe mich für MySQL entschieden.

Siehe dazu auch MySQL installieren.

Dovecot

Installation

sudo apt-get install dovecot-core
sudo apt-get install dovecot-imapd dovecot-pop3d
sudo apt-get install dovecot-mysql

Datenbank erstellen

mysql -u root -p 
mysql> create database if not exists mails;
mysql> create user 'dovecot'@'%' identified by '<password>';
mysql> grant usage on *.* to 'dovecot'@'%' identified by '<password>'; 
mysql> grant all privileges on mails.* to 'dovecot'@'%';
mysql> flush privileges; 
mysql> use mails;
mysql> CREATE TABLE users (id INT UNSIGNED AUTO_INCREMENT NOT NULL, username VARCHAR(128) NOT NULL, domain VARCHAR(128) NOT NULL, password VARCHAR(128) NOT NULL, UNIQUE (id), PRIMARY KEY (username, domain));
mysql> quit;

Soll nur von localhost auf die Datenbank zugegriffen werden können, dann folgenden Befehl verwenden:

mysql> create user 'dovecot'@'localhost' identified by '<password>';

Konfiguration

SSL Zertifikat

Hilfe zu Erstellung eines SSL-Zertifikates siehe SSL Zertifikat

Erstelltes Zertifikat in der Datei /etc/dovecot/conf.d/10-ssl.conf eintragen.

ssl = required
ssl_cert = </etc/ssl/certs/dovecot.crt
ssl_key = </etc/ssl/private/dovecot.key

Speicherort der Mails

Benutzer Authentifizierung

Datei /etc/dovecot/conf.d/10-auth.conf:

# Folgende Zeile auskommentieren:
# !include auth-system.conf.ext

# Folgende Zeile einkommentieren:
!include auth-sql.conf.ext

Datei /etc/dovecot/dovecot-sql.conf.ext:

# Database driver: mysql, pgsql, sqlite
driver = mysql

Links

https://wiki.ubuntuusers.de/Dovecot_2/ https://help.ubuntu.com/community/PostfixDovecotSASL


Zurück zu Ubuntu