S
S
Sergey Demin2017-08-24 16:25:21
PHP
Sergey Demin, 2017-08-24 16:25:21

How to get imap_open mail with Kerberos authorization?

Good time. The crux of the matter is as follows. There is a script which takes away mail and puts everything in the database. During testing, the script was running on mail from Yandex. Now it's time to transfer to the corporate server and take mail from it. Here there was a problem.

Array ( [0] => Kerberos error: Credentials cache file '/tmp/krb5cc_327275' not found (try running kinit)

To work with mail I use:
$mail_login    = "[email protected]";
$mail_password = "password";
$mail_imap     = "{imap.ourmail.ru:993/imap/notls/ssl/debug}INBOX";

$mbox = imap_open($mail_imap, $mail_login, $mail_password);
print_r(imap_errors());

$mails = imap_search($mbox, 'UNSEEN');

The server is running Dovecot+Postfix. Dovecote configs have Kerberos authorization. All this wealth was inherited from the old administrator, who dumped without even saying goodbye.
Can anyone come across how to make the script pick up mail with Kerberos authorization?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Demin, 2017-10-16
@LikeSD

Decided!

$mail_login    = "mymail";
$mail_password = "mail password";
$mail_imap     = "{imap.site.ru/imap/novalidate-cert/ssl/norsh/user=name_user}INBOX";

$mbox = imap_open($mail_imap, $mail_login, $mail_password, NULL, 1, array('DISABLE_AUTHENTICATOR' => 'GSSAPI'));

$str = imap_errors(); print_r($str);
echo $str;

$mails = imap_search($mbox, 'UNSEEN');

V
Vladimir Dubrovin, 2017-08-24
@z3apa3a

So do what they ask. For Kerberos, you first need to get a TGT (ticket grantering ticket) from the Kerberos server, only then you can go to the IMAP server with it and log in already on the IMAP server. TGT can be obtained using kinit.
for example, here is the instruction:
directory.apache.org/apacheds/kerberos-ug/4.1-auth...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question