• Willkommen im Linux Club - dem deutschsprachigen Supportforum für GNU/Linux. Registriere dich kostenlos, um alle Inhalte zu sehen und Fragen zu stellen.

Pam authentification und dovecot

padersuse

Hacker
Ich versuche auf meinen Emailserver lokal zuzugreifen (localhost) als user xyz über kmail oder thunderbird, aber leider klappt die Authentifizierung nicht. Erhalte immer die Meldung

Code:
pam_unix(dovecot:auth): authentication failure;
check pass; user unknown

den User gibts aber, habe ssl aktiviert in postfix und in /etc/dovecot/conf.d/10-auth.conf steht
Code:
disable_plaintext_auth = no
auth_mechanisms = plain login

was kann man tun ?

Gruß Padersuse
 
OP
P

padersuse

Hacker
Ich würde gern den Debugmodus aktivieren, aber ich weiss nicht, in welcher conf-Datei man das macht, vielleicht weisst Du es.
Unabhängig davon habe ich doveadm auth test -x service=imap -x rip=192.168.1.61 username in der Bash eingegeben. Nach Angabe des Kennwortes kam folgende Meldung :
Code:
passdb: username auth failed extra fields:  user=username
journalctl -u dovecot ergab
Code:
pam_unix(dovecot:auth): authentication failure; logname= uid=470 euid=470 tty=dovecot ruser=username rhost=192.168.1.61  user=username
 
OP
P

padersuse

Hacker
Ich habe den Debugmodus aktiviert in 10-logging.conf.
Nach Eingabe in der shell
Code:
doveadm auth test -x service=imap -x rip=192.168.1.61 username
bekomme ich folgende Meldung :
Code:
May 19 07:34:50 germlin1 dovecot[28573]: master: Dovecot v2.2.31 (65cde28) starting up for imap, pop3, lmtp (core dumps disabled)
May 19 07:34:57 germlin1 dovecot[28580]: auth: Debug: Loading modules from directory: /usr/lib64/dovecot/modules/auth
May 19 07:34:57 germlin1 dovecot[28580]: auth: Debug: Module loaded: /usr/lib64/dovecot/modules/auth/lib20_auth_var_expand_crypt.so
May 19 07:34:57 germlin1 dovecot[28580]: auth: Debug: Module loaded: /usr/lib64/dovecot/modules/auth/libdriver_mysql.so
May 19 07:34:57 germlin1 dovecot[28580]: auth: Debug: Module loaded: /usr/lib64/dovecot/modules/auth/libdriver_pgsql.so
May 19 07:34:57 germlin1 dovecot[28580]: auth: Debug: Module loaded: /usr/lib64/dovecot/modules/auth/libdriver_sqlite.so
May 19 07:34:57 germlin1 dovecot[28580]: auth: Debug: Read auth token secret from /var/run/dovecot/auth-token-secret.dat
May 19 07:34:57 germlin1 dovecot[28580]: auth: Debug: auth client connected (pid=0)
May 19 07:34:57 germlin1 dovecot[28580]: auth: Debug: client in: AUTH        1        PLAIN        service=imap        debug        rip=192.168.1.61        resp=Y2hlZgBjaGVmAG9wZW5zdXNlMTM= (previous base64 da
May 19 07:34:57 germlin1 dovecot[28580]: auth-worker(28586): Debug: Loading modules from directory: /usr/lib64/dovecot/modules/auth
May 19 07:34:57 germlin1 dovecot[28580]: auth-worker(28586): Debug: Module loaded: /usr/lib64/dovecot/modules/auth/lib20_auth_var_expand_crypt.so
May 19 07:34:57 germlin1 dovecot[28580]: auth-worker(28586): Debug: Module loaded: /usr/lib64/dovecot/modules/auth/libdriver_mysql.so
May 19 07:34:57 germlin1 dovecot[28580]: auth-worker(28586): Debug: Module loaded: /usr/lib64/dovecot/modules/auth/libdriver_pgsql.so
May 19 07:34:57 germlin1 dovecot[28580]: auth-worker(28586): Debug: Module loaded: /usr/lib64/dovecot/modules/auth/libdriver_sqlite.so
May 19 07:34:57 germlin1 dovecot[28580]: auth-worker(28586): Debug: pam(username,192.168.1.61): lookup service=dovecot
May 19 07:34:57 germlin1 dovecot[28580]: auth-worker(28586): Debug: pam(username,192.168.1.61): #1/1 style=1 msg=Password:
May 19 07:34:57 germlin1 auth[28586]: pam_unix(dovecot:auth): authentication failure; logname= uid=470 euid=470 tty=dovecot ruser=username rhost=192.168.1.61  user=username
May 19 07:34:59 germlin1 dovecot[28580]: auth-worker(28586): pam(username,192.168.1.61): pam_authenticate() failed: Authentication failure (password mismatch?) (given password: opensuse13)
May 19 07:35:01 germlin1 dovecot[28580]: auth: Debug: client passdb out: FAIL        1        user=username
 
OP
P

padersuse

Hacker
Welches Backend meinst Du bzw. welche conf-Datei ?
dovecot -n ergibt :

Code:
auth_debug = yes
auth_debug_passwords = yes
auth_mechanisms = plain login
auth_verbose = yes
auth_verbose_passwords = yes
mail_location = maildir:~/Maildir
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date index ihave duplicate mime foreverypart extracttext
namespace inbox {
  inbox = yes
  location = 
  mailbox Drafts {
    special_use = \Drafts
  }
  mailbox Junk {
    special_use = \Junk
  }
  mailbox Sent {
    special_use = \Sent
  }
  mailbox "Sent Messages" {
    special_use = \Sent
  }
  mailbox Trash {
    special_use = \Trash
  }
  prefix = 
}
passdb {
  driver = pam
}
plugin {
  sieve = file:~/sieve;active=~/.dovecot.sieve
}
service auth-worker {
  user = $default_internal_user
}
service auth {
  unix_listener /var/spool/postfix/private/auth {
    mode = 0666
  }
  unix_listener auth-userdb {
    group = postfix
    mode = 0600
    user = postfix
  }
  user = $default_internal_user
}
service imap-login {
  inet_listener imap {
    port = 143
  }
  inet_listener imaps {
    port = 993
    ssl = yes
  }
}
ssl_cert = </etc/ssl/certs/dovecot.pem
ssl_cipher_list = ALL:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK:!RC4:!ADH:!LOW@STRENGTH
ssl_dh_parameters_length = 2048
ssl_key =  # hidden, use -P to show it
ssl_options = no_compression
ssl_prefer_server_ciphers = yes
ssl_protocols = !SSLv2 !SSLv3
userdb {
  driver = passwd
}
verbose_ssl = yes
 

spoensche

Moderator
Teammitglied
Die Datei ist die /etc/dovecot/conf.d/10-auth.conf

Code:
passdb {
    driver = pam
    args = dovecot
}

Zusätzlich brauchst du jetzt noch eine /etc/pam.d/dovecot mit folgendem Inhalt:

Code:
auth    required        pam_unix.so nullok
account required        pam_unix.so
 
OP
P

padersuse

Hacker
Die Datei /etc/pam.d/dovecot enthält folgenden Eintrag

Code:
#%PAM-1.0
auth     include        common-auth
account  include        common-account
password include        common-password
session  include        common-session

common-auth-pc:
Code:
auth    required        pam_env.so      
auth    optional        pam_gnome_keyring.so
auth    required        pam_unix.so     try_first_pass

common-account-pc :
Code:
account required        pam_unix.so     try_first_pass

common-password-pc :
Code:
password        requisite       pam_cracklib.so 
password        optional        pam_gnome_keyring.so    use_authtok
password        required        pam_unix.so     use_authtok nullok shadow try_first_pass

common-session-pc :
Code:
session required        pam_limits.so   
session required        pam_unix.so     try_first_pass 
session optional        pam_umask.so    
session optional        pam_systemd.so
session optional        pam_gnome_keyring.so    auto_start only_if=gdm,gdm-password,lxdm,lightdm 
session optional        pam_env.so

In der Datei /etc/dovecot/conf.d/10-auth.conf war die Zeile args=dovecot auskommentiert, aber das Wegnehmen der Raute hat auch nichts gebracht.
journalctl -u dovecot ergab :
Code:
auth-worker(18931): Debug: pam(user,127.0.0.1,<IaCPmxZtaql/AAAB>): lookup service=dovecot
May 26 09:12:46 germlin1 dovecot[17955]: auth-worker(18931): Debug: pam(user,127.0.0.1,<IaCPmxZtaql/AAAB>): #1/1 style=1 msg=Password:
May 26 09:12:46 germlin1 unix_chkpwd[18950]: check pass; user unknown
May 26 09:12:46 germlin1 unix_chkpwd[18950]: password check failed for user (user)
May 26 09:12:46 germlin1 auth[18931]: pam_unix(dovecot:auth): authentication failure; logname= uid=470 euid=470 tty=dovecot ruser=user rhost=127.0.0.1  user=user
May 26 09:12:48 germlin1 dovecot[17955]: auth-worker(18931): pam(user,127.0.0.1,<IaCPmxZtaql/AAAB>): pam_authenticate() failed: Authentication failure (password mismatch?) (given password: opensuse14)
May 26 09:12:50 germlin1 dovecot[17955]: auth: Debug: client passdb out: FAIL        3        user=user
 
Wenn ich mir deine debug-Ausgabe angucke, dann scheint er deinen Usernamen nicht an dovecot weiterzugeben "user=username" dein Passwort hingegen schon "password: opensuse13" oder gibt es bei dir tatsächlich einen User mit dem Namen username? Wenn ja, dann würde ich mal einen anderen User mit einem weniger dämlichen Namen anlegen und mit dem testen.
 
OP
P

padersuse

Hacker
Leider hat die vorgeschlagene Veränderung auch nichts gebracht. Ich habe noch einen Server unter opensuse13.2 laufen mit einer ähnlichen Konfiguration. Ich vergleiche mal die conf-Dateien.
 

spoensche

Moderator
Teammitglied
padersuse schrieb:
Leider hat die vorgeschlagene Veränderung auch nichts gebracht. Ich habe noch einen Server unter opensuse13.2 laufen mit einer ähnlichen Konfiguration. Ich vergleiche mal die conf-Dateien.

Was sagen denn die Logs, nach dem du die Änderungen durchgeführt und übernommen hast?
 
Oben