Installing CalDAV / CardDAV service Davical 1.1.5 + LDAP on CentOS 6.8

Downloading davical and awd

wget https://gitlab.com/davical-project/awl/repository/archive.tar.gz?ref=master -O awl.tar.gz
wget https://gitlab.com/davical-project/davical/repository/archive.tar.gz?ref=master -O davical.tar.gz

Unpack

tar -xzf awl.tar.gz 
tar -xzf davical.tar.gz

Moving

mv awl-master-4c75c662e8605ed54ba4b8e65e4c3a8cc773052f/ /usr/share/awl
mv davical-master-8313f765ce89f752af77e0e0a90f3d1f5981b5b5/ /usr/share/davical

Change rights

chmod  755 -R /usr/share/awl/
chmod  755 -R /usr/share/davical/

Install postgresql 9.6

rpm -Uvh https://yum.postgresql.org/9.6/redhat/rhel-6-x86_64/pgdg-redhat96-9.6-3.noarch.rpm
yum install postgresql96-server postgresql96 postgresql96-lib

Initializing the database

service postgresql-9.4 initdb

We start the service and add it to startup

service postgresql-9.4 start
chkconfig postgresql-9.4 on

Configuring postgresql 9.6

nano /var/lib/pgsql/9.6/data/postgresql.conf

change listen_addresses = ‘localhost’ to listen_addresses = ‘*’

nano /var/lib/pgsql/9.6/data/pg_hba.conf
# "local" is for Unix domain socket connections only
local   all             all                                     trust
host    all             all             127.0.0.1/32            trust
host    all             all             192.168.1.0/24          trust
local    davical         davical_app                             trust
local    davical         davical_dba                             trust

Opens a port in iptables

nano /etc/sysconfig/iptables

Add a line:

-A INPUT -m state --state NEW -m tcp -p tcp --dport 5432 -j ACCEPT

Restart postgresql and firewall

service postgresql-9.6 restart
service iptables restart

We continue the installation of davical, initialize the base

cd /tmp
su - postgres -c /usr/share/davical/dba/create-database.sh

If the base was initiated successfully, a message will be displayed, where the login and password will be indicated

Supported locales updated.
Updated view: dav_principal.sql applied.
CalDAV functions updated.
RRULE functions updated.
Database permissions updated.
NOTE
====
*  The password for the 'admin' user has been set to 'password'

Thanks for trying DAViCal! Check the configuration in /etc/davical/config.php.
For help, look at our website and wiki, or visit #davical on irc.oftc.net.

If it was not possible to create a base, we figure out what the problem is, delete the not completely created base

su postgres -c "dropdb davical"

I have a problem due to incorrect postgresql configuration, or rather, due to a line in the pg_hba.conf file

local   all             all                                     trust

Apache config file (/etc/httpd/virtual/davical.local)

  DocumentRoot /usr/share/davical/htdocs
  DirectoryIndex index.php index.html
  ServerName calendar.domainnamehere.com
  ServerAlias davical.domainnamehere.com
  Alias /images/ /usr/share/davical/htdocs/images/
  
     AllowOverride None
     Order allow,deny
     Allow from all
  

  php_value include_path /usr/share/awl/inc
  php_value magic_quotes_gpc 0
  php_value register_globals 0
  php_value error_reporting "E_ALL & ~E_NOTICE"
  php_value default_charset "utf-8"

  ErrorLog "logs/calendar.domainnamehere.com-error_log"
  CustomLog "logs/calendar.domainnamehere.com-access_log" common

Davical config file (/usr/share/davical/config/config.php)

<?php
  $c->domain_name = "davical.local";
  $c->sysabbr="davical";
  $c->admin_email="[email protected]";
  $c->system_name = "Example DAViCal Server";
  $c->pg_connect[] = 'dbname=davical user=davical_app';
  $c->default_locale = "ru_RU";

Davical + ldap config file (/usr/share/davical/config/config.php)

<?php
$c->pg_connect[] = "dbname=davical user=davical_app";
$c->system_name = "DAViCal CalDAV Server";
$c->readonly_webdav_collections = false;
$c->admin_email="[email protected]";
$c->collections_always_exist = true;

$c->template_usr = array( 'active' => true,
                       'locale' => 'ru_RU',
                       'date_format_type' => 'E',
                       'email_ok' => date('Y-m-d')
                     );

$c->schedule_private_key = 'PRIVATE-KEY-BASE-64-DATA';
$c->external_refresh = 60;
$c->support_obsolete_free_busy_property = true;


$c->authenticate_hook['call'] = 'LDAP_check';
$c->authenticate_hook['config'] = array(
    'host'              => '192.168.1.2',
    'port'              => '389',
    'bindDN'            => '[email protected]',
    'passDN'            => 'password',
    'baseDNUsers'       => 'dc=domain,dc=local',
//    'filterUsers'       => 'objectClass=InetOrgPerson',
    'protocolVersion'   => 3,
    'optReferrals'      => 0,
    'filterUsers'       => '(&(objectcategory=person)(objectclass=user)(givenname=*))',
    'mapping_field'     => array('username' => 'sAMAccountName',
                                 'updated'  => 'whenChanged',
                                 'fullname' => 'cn' ,
                                 'email'    => 'mail'),
      'default_value' => array("date_format_type" => "E","locale" => "ru_RU"),
//    'default_value'     => array("date_format_type" => "E","locale" => "en_NZ"),
    'format_updated'    => array('Y' => array(0,4),'m' => array(4,2),'d'=> array(6,2),'H' => array(8,2),'M'=>array(10,2),'S' => array(12,2))
//    'scope' => 'subtree',
    );
//
//  /* If there is some user you do not want to sync from LDAP, put their username in this list */
  $c->do_not_sync_from_ldap = array( 'admin' => true );
include('drivers_ldap.php');

 $c->default_locale = "ru_RU";
 $c->domain_name = "davical.local";
 $c->local_tzid = 'Europe/Moscow';
 $c->allow_get_email_visibility = true;
Sidebar