Configuration/hooks/Authentication/IMAP

From Davical
Jump to navigationJump to search

Template:Languages

Last updated for the 1.0.2 release.

Documentation for the IMAP authentication driver (inc/drivers_imap_pam.php).

This driver allows DAViCal to accept authentication via a local or remote IMAP server.

PHP IMAP is required as an extra dependency. Install php5-imap on Debian/Ubuntu based systems.

IMAP Settings

The settings for the IMAP server connection go in the config file /etc/davical/<servername>-conf.php (this file might be in /etc/rscds/ if you upgraded from an older installation).

  $c->authenticate_hook['call'] = 'IMAP_PAM_check';
  $c->authenticate_hook['config'] = array(
      'imap_url'   => '{<IMAP SERVER>}',
      'email_base' => '<EMAIL DOMAIN HOST>'
    );
  include('drivers_imap_pam.php');

imap_url is required. IMAP SERVER must be an IMAP URL surrounded by curly brackets as documented in the PHP manual. Some common examples are provided below:

{localhost:143/imap/}                      // Insecure on local server
{localhost:143/imap/tls/}                  // START TLS to a local server
{example.com:993/imap/ssl/}                // Legacy SSL on deprecated port
{example.com:143/imap/tls/novalidate-cert} // Self-signed certificate

Note that authenticating to an external server over TLS/SSL is slow. The connection to the IMAP server will not request a working mailbox and the server response should thus not be too slow.

Providing an hostname/mailname (example.com) through the email_base parameter is optional.

Example

The following config example allows DAViCal to authenticate users via a secure IMAP server at example.com:

<?php
  $c->authenticate_hook['call'] = 'IMAP_PAM_check';
  $c->authenticate_hook['config'] = array(
      'imap_url'   => '{example.com:143/imap/tls/}',
      'email_base' => 'example.com'
    );
  include('drivers_imap_pam.php');