Talk:Radicale (carddav/caldav)

From SME Server
Jump to navigationJump to search

the chkconfig --add radicaled is unneeded :-)


--Stephdl (talk) 10:05, 18 October 2015 (CEST)

Introduction

The Radicale Project is a complete calendar and contact storing and manipulating solution. It can store multiple calendars and multiple address books.

Calendar and contact manipulation is available from both local and distant accesses, possibly limited through authentication policies. This HOWTO describes the installation procedure for installing Radicale around the Roundcube installation on an SME installation. Before installation On sme8, you need to install python26

yum --enablerepo=ces-standard,epel --nogpgcheck install python26

Not need in sme9, python-2.6 is installed. But you have to do:

ln -s /usr/bin/python2.6 /usr/bin/python26

in order to use same init script as for sme8

Download & Install Radicale

Information.png Tip:
radicale is 'pip' compatible, that should be used instead of downloading each time a tar.gz. See http://radicale.org/download/


mkdir -p /opt/roundcube/
cd /opt/roundcube/
wget –no-check-certificate http://pypi.python.org/packages/source/R/Radicale/Radicale-1.0.1.tar.gz
tar xvfz Radicale-1.0.1.tar.gz
rm -f Radicale-1.0.1.tar.gz
mv Radicale-1.0.1 radicale
mkdir -p /home/e-smith/files/.radicale/collections
mkdir -p /etc/radicale
mkdir -p /var/run/radicale

Next, you need to configure how you want the logs:

touch /etc/radicale/logging
cat <<EOF > /etc/radicale/logging
[loggers]
keys=root
level=NOTSET

[logger_root]
handlers=file

[formatters]
keys=simple

[formatter_simple]
format=%(asctime)s - %(name)s - %(levelname)s - %(message)s

[handlers]
keys=file

[handler_file]
class=handlers.TimedRotatingFileHandler
interval=midnight
backupCount=5
formatter=simple
level=ERROR
args=('/var/log/radicale.log',)
EOF

Set Radicale to start on system startup To make Radicale start automagically, create

vim /etc/rc.d/init.d/radicaled

with the following content:

#!/bin/sh
#
# chkconfig: - 88 10
# description: Start/Stop the RADICALE server daemon
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#    Copyright (C) 2015 JM LE CORGUILLE
#

# Source function library.
. /etc/rc.d/init.d/functions

PYTHON26=/usr/bin/python26
RADICALE=/opt/roundcube/radicale/radicale.py
LOCKF=/var/lock/radicale                         ##/var/run/radicale/radicale.pid
CONFIG=/etc/radicale/config

[ -f $PYTHON26 ] || exit 0
[ -f $RADICALE ] || exit 0
[ -f $CONFIG ] || exit 0 

RETVAL=0

case "$1" in
 start)
       echo -n $"Starting RADICALE server: "
       cd /opt/roundcube/radicale/
       $PYTHON26 $RADICALE -C $CONFIG
       RETVAL=$?
       echo
       [ $RETVAL -eq 0 ] && touch $LOCKF &&
           ln -s /var/run/radicale/radicale.pid /var/run/radicale.pid 2>/dev/null
       ;;
 stop)
       echo -n $"Stopping RADICALE server: "
       killproc $PYTHON26 $RADICALE
       RETVAL=$?
       echo
       [ $RETVAL -eq 0 ] && rm -f $LOCKF
       ;;
 status)
       status radicale
       RETVAL=$?
       ;;
 restart)
       $0 stop
       sleep 3
       $0 start
       RETVAL=$?
       ;;
 *)
       echo $"Usage: $0 {start|stop|status|restart}"
       exit 1
esac

exit $RETVAL

complete it with:

chmod 755 /etc/rc.d/init.d/radicaled
chkconfig --add radicaled
ln -s /etc/rc.d/init.d/e-smith-service /etc/rc7.d/S88radicaled

Setup Radicale configuration

mkdir -p /etc/e-smith/templates-custom/etc/radicale/config

Create

vim /etc/e-smith/templates-custom/etc/radicale/config/00setup

with the following content:

# -*- mode: conf -*-
# vim:ft=cfg

# Config file for Radicale - A simple calendar server
#
# Place it into /etc/radicale/config (global)
# or ~/.config/radicale/config (user)
#
# The current values are the default ones


[server]

# CalDAV server hostnames separated by a comma
# IPv4 syntax: address:port
# IPv6 syntax: [address]:port
# For example: 0.0.0.0:9999, [::]:9999
# IPv6 adresses are configured to only allow IPv6 connections
#hosts = 0.0.0.0:5232

Create

vim /etc/e-smith/templates-custom/etc/radicale/config/10hosts

with the following content:

{
  my $rad_ports = $radicale{Port} || 5232;
  my $rad_ip = $LocalIP || 127.0.0.1;
  "hosts = $rad_ip:$rad_ports";
}

Create

vim /etc/e-smith/templates-custom/etc/radicale/config/20daemon
with the following content: 
# Daemon flag
#daemon = False
daemon = True

# File storing the PID in daemon mode
#pid =
pid = /var/run/radicale/radicale.pid

# SSL flag, enable HTTPS protocol
#ssl = False
ssl = True
# SSL certificate path
#certificate = /etc/apache2/ssl/server.crt

Create

vim /etc/e-smith/templates-custom/etc/radicale/config/30crt

with the following content:

{
  my $rad_name = $SystemName || "server";
  my $rad_domain = $DomainName;
  "certificate = /home/e-smith/ssl.crt/$rad_name.$rad_domain.crt";
}

Create

vim /etc/e-smith/templates-custom/etc/radicale/config/40ssl

with the following content:

# SSL private key
#key = /etc/apache2/ssl/server.key

Create

vim /etc/e-smith/templates-custom/etc/radicale/config/50key

with the following content:

{
  my $rad_name = $SystemName || "server";
  my $rad_domain = $DomainName;
  "key = /home/e-smith/ssl.key/$rad_name.$rad_domain.key";
}

Create

vim /etc/e-smith/templates-custom/etc/radicale/config/60fin

with the following content:

# SSL Protocol used. See python's ssl module for available values
#protocol = PROTOCOL_SSLv23

# Ciphers available. See python's ssl module for available ciphers
#ciphers =

# Reverse DNS to resolve client address in logs
#dns_lookup = True
dns_lookup = True

# Root URL of Radicale (starting and ending with a slash)
#base_prefix = /

# Possibility to allow URLs cleaned by a HTTP server, without the base_prefix
#can_skip_base_prefix = False

# Message displayed in the client when a password is needed
#realm = Radicale - Password Required
 

[encoding]

# Encoding for responding requests
#request = utf-8

# Encoding for storing local collections
#stock = utf-8


[well-known]

# Path where /.well-known/caldav/ is redirected
#caldav = '/%(user)s/caldav/'

# Path where /.well-known/carddav/ is redirected
#carddav = '/%(user)s/carddav/'


[auth]

# Authentication method
# Value: None | htpasswd | IMAP | LDAP | PAM | courier | http | remote_user | custom
#type = None
type = IMAP

# Custom authentication handler
# custom_handler =

# Htpasswd filename
#htpasswd_filename = /etc/radicale/users

# Htpasswd encryption method
# Value: plain | sha1 | ssha | crypt
#htpasswd_encryption = crypt 

# LDAP server URL, with protocol and port
#ldap_url = ldap://localhost:389/

# LDAP base path
#ldap_base = ou=users,dc=example,dc=com

# LDAP login attribute
#ldap_attribute = uid

# LDAP filter string
# placed as X in a query of the form (&(...)X)
# example: (objectCategory=Person)(objectClass=User)(memberOf=cn=calenderusers,ou=users,dc=example,dc=org)
# leave empty if no additional filter is needed
#ldap_filter =

# LDAP dn for initial login, used if LDAP server does not allow anonymous searches
# Leave empty if searches are anonymous
#ldap_binddn =

# LDAP password for initial login, used with ldap_binddn
#ldap_password =

# LDAP scope of the search
#ldap_scope = OneLevel

# IMAP Configuration
#imap_hostname = localhost
#imap_port = 143
#imap_ssl = False
imap_hostname = localhost
imap_port = 993
imap_ssl = True

# PAM group user should be member of
#pam_group_membership =

# Path to the Courier Authdaemon socket
#courier_socket =

# HTTP authentication request URL endpoint
#http_url =
# POST parameter to use for username
#http_user_parameter =
# POST parameter to use for password
#http_password_parameter =


[git]

# Git default options
#committer = Radicale <radicale@example.com>


[rights]

# Rights backend
# Value: None | authenticated | owner_only | owner_write | from_file | custom
#type = None
type = owner_write

# Custom rights handler
# custom_handler = 

# File for rights management from_file
#file = ~/.config/radicale/rights


[storage]

# Storage backend
# -------
# WARNING: ONLY "filesystem" IS DOCUMENTED AND TESTED,
#          OTHER BACKENDS ARE NOT READY FOR PRODUCTION.
# -------
# Value: filesystem | multifilesystem | database | custom
#type = filesystem 

# Custom storage handler
#custom_handler =

# Folder for storing local collections, created if not present
#filesystem_folder = ~/.config/radicale/collections
filesystem_folder = /home/e-smith/files/.radicale/collections

# Database URL for SQLAlchemy
# dialect+driver://user:password@host/dbname[?key=value..]
# For example: sqlite:///var/db/radicale.db, postgresql://user:password@localhost/radicale
# See http://docs.sqlalchemy.org/en/rel_0_8/core/engines.html#sqlalchemy.create_engine
#database_url = 


[logging]

# Logging configuration file
# If no config is given, simple information is printed on the standard output
# For more information about the syntax of the configuration file, see:
# http://docs.python.org/library/logging.config.html
#config = /etc/radicale/logging
config = /etc/radicale/logging
# Set the default logging level to debug
#debug = False
# Store all environment variables (including those set in the shell)
#full_environment = False


[headers]

# Additional HTTP headers
#Access-Control-Allow-Origin = *#imap_hostname = localhost 
db configuration set radicale service Port 5232 status enabled
expand-template /etc/radicale/config

/etc/rc.d/init.d/radicaled start

Radicale Client Configuration

The URL for accessing the radicale server is:

 https://<server_domain_name>:5232/USER/calendar.ics
 https://<server_domain_name>:5232/USER/addressbook.vcf

Where USER is the sme-login for the user who manage the radicale session

References

radicale Documentation: http://radicale.org/

roundcube Documentation: http://wiki.contribs.org/RoundCube