Mailserver einrichten: Unterschied zwischen den Versionen

Aus Tutorials
Zur Navigation springen Zur Suche springen
Zeile 26: Zeile 26:
mysql> create database if not exists mails;
mysql> create database if not exists mails;
mysql> create user 'dovecot'@'%' identified by '<password>';
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 (
mysql> CREATE TABLE users (
     ->  `id` INT(11) NOT NULL,
     ->  `id` INT(11) NOT NULL,
Zeile 34: Zeile 38:
     ->  `uid` INT(11) DEFAULT NULL,
     ->  `uid` INT(11) DEFAULT NULL,
     ->  `gid` INT(11) DEFAULT NULL,
     ->  `gid` INT(11) DEFAULT NULL,
    ->  `active` CHAR(1) DEFAULT 'Y' NOT NULL,
     ->  PRIMARY KEY (`id`)
     ->  PRIMARY KEY (`id`)
    ->  active CHAR(1) DEFAULT 'Y' NOT NULL
     -> );
     -> );
mysql> quit;
</pre>
</pre>



Version vom 10. März 2016, 00:46 Uhr

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(11) NOT NULL,
    ->   `username` VARCHAR(128) NOT NULL,
    ->   `domain` VARCHAR(128) NOT NULL,
    ->   `password` VARCHAR(255) NOT NULL,
    ->   `home` VARCHAR(255) DEFAULT NULL,
    ->   `uid` INT(11) DEFAULT NULL,
    ->   `gid` INT(11) DEFAULT NULL,
    ->   `active` CHAR(1) DEFAULT 'Y' NOT NULL,
    ->   PRIMARY KEY (`id`)
    -> );
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

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


Zurück zu Ubuntu