Linuxhotel Wiki

Wie ging das nochmal?

Benutzer-Werkzeuge

Webseiten-Werkzeuge


lpi2:dovecot-virtual-domains

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen der Seite angezeigt.

Link zu der Vergleichsansicht

Beide Seiten, vorherige ÜberarbeitungVorherige Überarbeitung
Nächste Überarbeitung
Vorherige Überarbeitung
lpi2:dovecot-virtual-domains [2024/08/06 15:52] – [Testen] ingo_wichmannlpi2:dovecot-virtual-domains [2025/08/14 19:23] (aktuell) – ingo_wichmann
Zeile 1: Zeile 1:
 ====== Dovecot: virtuelle Domains und Benutzer in Textdateien ====== ====== Dovecot: virtuelle Domains und Benutzer in Textdateien ======
-//in der Praxis würde ich LDAP oder eine Datenbank bevorzugen//+===== TODO: Debian 13 / 2.4 Migration ===== 
 +/etc/dovecot/conf.d/20-lmtp.conf -> ''auth_username_format = %{user | username}'' entfernen 
 + 
 +===== bis Dovecot 2.3 ===== 
 + 
 +Dokumentation: https://doc.dovecot.org/configuration_manual/virtual_users/
  
 Voraussetzung: [[dovecot-imapd]] Voraussetzung: [[dovecot-imapd]]
  
 Benutzer vmail und Mailverzeichnis anlegen: Benutzer vmail und Mailverzeichnis anlegen:
-  mkdir -p /srv/vmail/example.com/home+  mkdir -p /srv/vmail/example.com
   useradd -r -U -s /bin/false -d /srv/vmail vmail   useradd -r -U -s /bin/false -d /srv/vmail vmail
-  chown -R vmail:vmail /srv/vmail/example.com+  chown vmail:vmail /srv/vmail/example.com
  
 Dovecot konfigurieren: Dovecot konfigurieren:
  
-''/etc/dovecot/local.conf'' :  +<file txt /etc/dovecot/local.conf> 
- +mail_location = maildir:~/Maildir
-<file> +
-mail_location = maildir:/srv/vmail/%d/home/%n/Maildir+
 auth_username_format = %Lu auth_username_format = %Lu
 userdb { userdb {
-  args = username_format=%n /srv/vmail/%d/passwd +  args = /srv/vmail/passwd 
-  default_fields = uid=vmail gid=vmail home=/srv/vmail/%d/home/%n+  default_fields = uid=vmail gid=vmail home=/srv/vmail/%d/%n
   driver = passwd-file   driver = passwd-file
 } }
 passdb { passdb {
-  args = username_format=%n /srv/vmail/%d/passwd+  args = /srv/vmail/passwd
   driver = passwd-file   driver = passwd-file
 } }
 </file> </file>
 +  doveconf auth_username_format
 +-> ''auth_username_format = **%Lu**''
 +  doveconf -n | grep -EA4 '^(userdb|passdb)'
 +  systemctl reload dovecot.service
  
-Beispiel-Benutzer anlegen: ((https://doc.dovecot.org/configuration_manual/authentication/password_schemes/#authentication-password-schemes))+Benutzer anlegen: ((https://doc.dovecot.org/configuration_manual/authentication/password_schemes/#authentication-password-schemes))
   doveadm pw -l   doveadm pw -l
-  doveadm pw -s BLF-CRYPT+  doveadm pw -s BLF-CRYPT | tee -a /srv/vmail/passwd
  
-<file txt ''/srv/vmail/example.com/passwd''> +<file txt /srv/vmail/passwd> 
-user1:{BLF-CRYPT}$2y$05$XF8X/y47o1sfXTiwX5JkzOn0uGvZw9QCtHOKRinCsMc.rtAElVHOG +user1@example.com:{BLF-CRYPT}$2y$05$XF8X/y47o1sfXTiwX5JkzOn0uGvZw9QCtHOKRinCsMc.rtAElVHOG:: 
-user2:{SSHA256}NZMbbjQl2IsI8Qurnfgl2XjTxD/8eNf4IYD+AdiikArZ+WZI+user2@example.com:{SSHA256}NZMbbjQl2IsI8Qurnfgl2XjTxD/8eNf4IYD+AdiikArZ+WZI::
 </file> </file>
  
Zeile 40: Zeile 47:
   doveadm user '*'   doveadm user '*'
   doveadm user user1@example.com   doveadm user user1@example.com
 +-> ''home    /srv/vmail/example.com/user1''
  
 Funktioniert die Authentifizierung? Funktioniert die Authentifizierung?
   doveadm auth test user1@example.com   doveadm auth test user1@example.com
 +-> ''auth succeeded''
  
-per IMAP anmelden, ohne TLS (böse, geht auch per default nicht):+Mit curl: 
 +  curl -v --url imap://localhost:143 --user me@klaus-1.lxht.de 
 +-> ''OK Logged in''
  
-Kann man sich lokal anmelden (ohne TLS geht das per default nicht): +Mit curl + TLS: 
-  netcat -v localhost 143 +  curl -v --ssl-reqd --url imaps://example.com:993 --user user1@example.com
-  . login user1@example.com xxx+
  
 Kann man sich lokal anmelden (mit TLS): Kann man sich lokal anmelden (mit TLS):
   openssl s_client -crlf -connect localhost:993   openssl s_client -crlf -connect localhost:993
   . login user1@example.com xxx   . login user1@example.com xxx
 +
 +
lpi2/dovecot-virtual-domains.1722959524.txt.gz · Zuletzt geändert: 2024/08/06 15:52 von ingo_wichmann