Inhaltsverzeichnis
Dovecot ArchLinux - SASL
HINWEIS - Die Nachfolgende Konfiguration von Dovecot setzt eine lauffähige Installation von Dovecot voraus, wie unter nachfolgendem internen Link beschrieben: |
---|
Dovecot ist ein Quelloffener IMAP-und POP3-E-Mail-Server für Linux bzw. UNIX-ähnlichen Systeme, entwickelt mit dem Hauptaugenmerk auf Sicherheit. Dovecot ist eine ausgezeichnete Wahl für kleine und grosse Installationen. Dovecot ist schnell und einfach zu installieren, erfordert keine besonderen Voraussetzungen und ist Ressourcenschonend.
Dovecot wird von Timo Sirainen entwickelt und soll hier in der Version CE zum Einsatz kommen.
Beschreibung | Externer Link |
---|---|
Homepage | Dovecot |
Dokumentation | https://doc.dovecot.org/2.3/ |
Dovecot-SASL | https://doc.dovecot.org/2.3/configuration_manual/howto/postfix_and_dovecot_sasl/ |
Ab hier werden root
-Rechte zur Ausführung der nachfolgenden Befehle benötigt. Um root
zu werden geben Sie bitte folgenden Befehl ein:
$ su - Password:
Voraussetzungen
Für die nachfolgende Installation wird vorausgesetzt,
- dass eine lauffähige Version von Dovecot ab Version 2.3
vorhanden ist und die unter nachfolgenden Links beschriebenen Installationen und Konfigurationen von Dovecot als Mindestvoraussetzung zwingend durchgeführt wurden:
Konfiguration
SASL steht für „Simple Authentication and Security Layer“. SASL selbst ist nichts anderes als eine Liste von Anforderungen an Authentifizierungsmechanismen (SASL) und Protokolle, die SASL-kompatibel sein müssen, wie in RFC 4422 beschrieben. Die Protokolle IMAP, POP3, SMTP und ManageSieve unterstützen alle SASL.
HINWEIS - Dovecot hat seine eigene SASL-Implementierung
/etc/dovecot/conf.d/10-master.conf
Damit Dovecot auch auf SASL-Anfragen von z.B. Postfix über das Protokoll auth
via TCP beantworten kann, sind nachfolgende Einstellungen in der Konfigurationsdatei
- /etc/dovecot/conf.d/10-master.conf
durchzuführen.
service auth
Es gibt zwei Möglichkeiten, wie Dovecot auth
anbieten kann,
- unix-Socket - wenn der MTA z.B. Postfix und MDA Dovecot auf ein und dem selben Servern sind.
Hier soll die ein Anbindung via TCP/IP-Verbindung erfolgen, was durch nachfolgende Einstellungen erreicht werden kann.
In der nachfolgend gezeigten Konfiguration lauscht der Dovecot auf
- internen IP-Adressen, welche nicht aus dem Internet erreichbar sein sollten, auf
- Port 12345, der hier den Port für
auth
(SASL-Authentifizierung) darstellt.
service auth: inet_listener
Information | Beschreibung |
---|---|
Dokumentation | https://doc.dovecot.org/2.3/configuration_manual/service_configuration/#inet-listeners Dovecot Configuration Manual - Service Configuration - inet-listeners |
Defaultwert | inet_listener auth |
Neuer Wert | inet_listener auth {...} |
Konfiguration | service auth { # auth_socket_path points to this userdb socket by default. It's typically # used by dovecot-lda, doveadm, possibly imap process, etc. Users that have # full permissions to this socket are able to get a list of all usernames and # get the results of everyone's userdb lookups. # # The default 0666 mode allows anyone to connect to the socket, but the # userdb lookups will succeed only if the userdb returns an "uid" field that # matches the caller process's UID. Also if caller's uid or gid matches the # socket's uid or gid the lookup succeeds. Anything else causes a failure. # # To give the caller full permissions to lookup all users, set the mode to # something else than 0666 and Dovecot lets the kernel enforce the # permissions (e.g. 0777 allows everyone full permissions). unix_listener auth-userdb { #mode = 0666 #user = #group = } # Tachtler - NEW - inet_listener auth { address = 10.0.0.80, fd00::10:10:0:0:80 port = 12345 } # Postfix smtp-auth #unix_listener /var/spool/postfix/private/auth { # mode = 0666 #} # Auth process is run as this user. #user = $default_internal_user } |
Beschreibung | Definiert einen Listener vom Typ: inet_listsners . |
service auth: address
Information | Beschreibung |
---|---|
Dokumentation | https://doc.dovecot.org/2.3/configuration_manual/service_configuration/#address Dovecot Configuration Manual - Service Configuration - inet-listeners |
Defaultwert | address = |
Neuer Wert | address = 10.0.0.80, fd00::10:10:0:0:80 |
Konfiguration | service auth { # auth_socket_path points to this userdb socket by default. It's typically # used by dovecot-lda, doveadm, possibly imap process, etc. Users that have # full permissions to this socket are able to get a list of all usernames and # get the results of everyone's userdb lookups. # # The default 0666 mode allows anyone to connect to the socket, but the # userdb lookups will succeed only if the userdb returns an "uid" field that # matches the caller process's UID. Also if caller's uid or gid matches the # socket's uid or gid the lookup succeeds. Anything else causes a failure. # # To give the caller full permissions to lookup all users, set the mode to # something else than 0666 and Dovecot lets the kernel enforce the # permissions (e.g. 0777 allows everyone full permissions). unix_listener auth-userdb { #mode = 0666 #user = #group = } # Tachtler - NEW - inet_listener auth { address = 10.0.0.80, fd00::10:10:0:0:80 port = 12345 } # Postfix smtp-auth #unix_listener /var/spool/postfix/private/auth { # mode = 0666 #} # Auth process is run as this user. #user = $default_internal_user } |
Beschreibung | Durch Leerzeichen getrennte Liste von IP-Adressen/Hostnamen, die abgehört werden sollen. * bedeutet alle IPv4-Adressen, :: bedeutet alle IPv6-Adressen. Standardmässig wird die Einstellung listen verwendet. |
service auth: port
Information | Beschreibung |
---|---|
Dokumentation | https://doc.dovecot.org/2.3/configuration_manual/service_configuration/#port Dovecot Configuration Manual - Service Configuration - inet-listeners |
Defaultwert | port = |
Neuer Wert | port = 12345 |
Konfiguration | service auth { # auth_socket_path points to this userdb socket by default. It's typically # used by dovecot-lda, doveadm, possibly imap process, etc. Users that have # full permissions to this socket are able to get a list of all usernames and # get the results of everyone's userdb lookups. # # The default 0666 mode allows anyone to connect to the socket, but the # userdb lookups will succeed only if the userdb returns an "uid" field that # matches the caller process's UID. Also if caller's uid or gid matches the # socket's uid or gid the lookup succeeds. Anything else causes a failure. # # To give the caller full permissions to lookup all users, set the mode to # something else than 0666 and Dovecot lets the kernel enforce the # permissions (e.g. 0777 allows everyone full permissions). unix_listener auth-userdb { #mode = 0666 #user = #group = } # Tachtler - NEW - inet_listener auth { address = 10.0.0.80, fd00::10:10:0:0:80 port = 12345 } # Postfix smtp-auth #unix_listener /var/spool/postfix/private/auth { # mode = 0666 #} # Auth process is run as this user. #user = $default_internal_user } |
Beschreibung | Nummer des Ports, der abgehört werden soll. 0 schaltet den Listener aus. |
Neustart
Bevor der der dovecot
-Daemon/Dienst neu gestartet werden soll, ist eine Überprüfung der korrekten Konfiguration durch nachfolgenden Befehl, zu empfehlen
doveconf -n
# doveconf -n # 2.3.21.1 (d492236fa0): /etc/dovecot/dovecot.conf # OS: Linux 6.6.65-1-lts x86_64 # Hostname: vml080.idmz.tachtler.net auth_mechanisms = plain digest-md5 cram-md5 login auth_verbose = yes listen = 127.0.0.1, 10.0.0.80, ::1, fd00::10:10:0:0:80, 2001:db8::10:10:0:0:80 mail_location = maildir:~/Maildir namespace inbox { inbox = yes location = mailbox Drafts { auto = subscribe special_use = \Drafts } mailbox Junk { auto = subscribe special_use = \Junk } mailbox Sent { auto = subscribe special_use = \Sent } mailbox "Sent Messages" { special_use = \Sent } mailbox Trash { auto = subscribe special_use = \Trash } prefix = INBOX/ separator = / type = private } passdb { args = scheme=CRYPT username_format=%u /etc/dovecot/users driver = passwd-file } protocols = imap lmtp service auth { inet_listener auth { address = 10.0.0.80, fd00::10:10:0:0:80 port = 12345 } } service lmtp { inet_listener lmtp { address = 10.0.0.80, fd00::10:10:0:0:80 port = 24 ssl = yes } user = vmail } ssl = required ssl_cert = </etc/dovecot/ssl/certs/fullchain.pem ssl_cipher_list = ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256 :ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256 :DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA :ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:DHE-DSS-AES128-SHA256:DHE-DSS-AES256-SHA :AES128-GCM-SHA256:AES256-GCM-SHA384:!CAMELLIA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK :!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA ssl_cipher_suites = TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256 :TLS_AES_128_CCM_8_SHA256:TLS_AES_128_CCM_SHA256 ssl_dh = # hidden, use -P to show it ssl_key = # hidden, use -P to show it ssl_prefer_server_ciphers = yes userdb { args = username_format=%u /etc/dovecot/users driver = passwd-file } verbose_proctitle = yes protocol lmtp { auth_ssl_require_client_cert = yes ssl = required ssl_ca = </etc/dovecot/ssl/certs/server-lmtp-chain.pem ssl_require_crl = no ssl_verify_client_cert = yes }
HINWEIS - Die Konfiguration der Parameter
ssl_cipher_list
ssl_cipher_suites
erfolgt in einer Zeile - OHNE - Zeilenumbrüche!
HINWEIS - die Konfiguration des dovecot
-Daemon/Dienst konnte korrekt gelesen werden, wenn die Konfiguration erscheint, was letztendlich zwar nicht bedeutet, das Sie auch korrekt ist, aber syntaktische Fehler ausschliesst !!!
Danach kann der dovecot-Server mit nachfolgendem Befehle neu gestartet werden:
# systemctl restart dovecot.service
Überprüfung erfolgreicher Neustart
Um zu Überprüfen, ob der Neustart des dovecot
-Daemons/Dienstes erfolgreich durchgeführt wurden, kann nachfolgender Befehl genutzt werden:
# ss -tauben | grep dovecot tcp LISTEN 0 100 10.0.0.80:993 0.0.0.0:* ino:10340 sk:3 cgroup:/system.slice/dovecot.service <-> tcp LISTEN 0 100 127.0.0.1:993 0.0.0.0:* ino:10339 sk:4 cgroup:/system.slice/dovecot.service <-> tcp LISTEN 0 100 127.0.0.1:143 0.0.0.0:* ino:10334 sk:6 cgroup:/system.slice/dovecot.service <-> tcp LISTEN 0 100 10.0.0.80:24 0.0.0.0:* ino:10311 sk:7 cgroup:/system.slice/dovecot.service <-> tcp LISTEN 0 1000 10.0.0.80:12345 0.0.0.0:* ino:10383 sk:9 cgroup:/system.slice/dovecot.service <-> tcp LISTEN 0 100 10.0.0.80:143 0.0.0.0:* ino:10335 sk:a cgroup:/system.slice/dovecot.service <-> tcp LISTEN 0 100 [fd00::10:10:0:0:80]:24 [::]:* ino:10312 sk:d cgroup:/system.slice/dovecot.service v6only:1 <-> tcp LISTEN 0 1000 [fd00::10:10:0:0:80]:12345 [::]:* ino:10384 sk:e cgroup:/system.slice/dovecot.service v6only:1 <-> tcp LISTEN 0 100 [::1]:143 [::]:* ino:10336 sk:f cgroup:/system.slice/dovecot.service v6only:1 <-> tcp LISTEN 0 100 [fd00::10:10:0:0:80]:143 [::]:* ino:10337 sk:10 cgroup:/system.slice/dovecot.service v6only:1 <-> tcp LISTEN 0 100 [2001:db8::10:10:0:0:80]:143 [::]:* ino:10338 sk:14 cgroup:/system.slice/dovecot.service v6only:1 <-> tcp LISTEN 0 100 [2001:db8::10:10:0:0:80]:993 [::]:* ino:10343 sk:15 cgroup:/system.slice/dovecot.service v6only:1 <-> tcp LISTEN 0 100 [::1]:993 [::]:* ino:10341 sk:16 cgroup:/system.slice/dovecot.service v6only:1 <-> tcp LISTEN 0 100 [fd00::10:10:0:0:80]:993 [::]:* ino:10342 sk:17 cgroup:/system.slice/dovecot.service v6only:1 <->
oder auch dieser Befehl:
# ps auxwf | grep dovecot | grep -v grep root 1176 0.0 0.2 8148 5376 ? Ss 06:37 0:00 /usr/bin/dovecot -F dovecot 1178 0.0 0.1 4424 2816 ? S 06:37 0:00 \_ dovecot/anvil [0 connections] root 1179 0.0 0.1 4560 2816 ? S 06:37 0:00 \_ dovecot/log root 1180 0.0 0.2 7240 4864 ? S 06:37 0:00 \_ dovecot/config
bzw. auch dieser Befehl:
# systemctl status dovecot.service ● dovecot.service - Dovecot IMAP/POP3 email server Loaded: loaded (/usr/lib/systemd/system/dovecot.service; enabled; preset: > Active: active (running) since Fri 2024-12-27 19:37:11 CET; 7min ago Invocation: 7b9a9cab29074917ae3e8a7c5ac7daf3 Docs: man:dovecot(1) https://doc.dovecot.org/ Main PID: 1176 (dovecot) Status: "v2.3.21.1 (d492236fa0) running" Tasks: 4 (limit: 2315) Memory: 3.5M (peak: 4M) CPU: 29ms CGroup: /system.slice/dovecot.service ├─1176 /usr/bin/dovecot -F ├─1178 "dovecot/anvil [0 connections]" ├─1179 "dovecot/log " └─1180 "dovecot/config " Dec 27 19:37:11 server systemd[1]: Starting Dovecot IMAP/POP3 email server... Dec 27 19:37:11 server dovecot[1176]: master: Dovecot v2.3.21.1 (d492236fa0) st> Dec 27 19:37:11 server systemd[1]: Started Dovecot IMAP/POP3 email server.
Verbindungstest mit telnet
Nachfolgender Verbindungstest kann mittels des Befehls telent
durchgeführt werden.
# telnet 10.0.0.80 12345 Trying 10.0.0.80... Connected to 10.0.0.80. Escape character is '^]'. VERSION 1 2 MECH PLAIN plaintext MECH DIGEST-MD5 dictionary active mutual-auth MECH CRAM-MD5 dictionary active MECH LOGIN plaintext SPID 1875 CUID 2 COOKIE 288ab4d16532543b835b8b685fd9661c DONE Connection closed by foreign host.
Erforderliche Benutzereingaben:
telnet 10.0.0.80 12345
[RETURN/ENTER-Taste]
HINWEIS - Ein abschliessender Test, kann erst nach erfolgreicher Konfiguration z.B. eines MTA wie Postfix-main server
- mittels z.B. des Protokolls
smtp
durchgeführt werden!