Radicale

Port

https://www.freshports.org/www/radicale/

Setup

Install and configure a Radicale server on FreeBSD. Depending on the version of FreeBSD you run, you may to adapt the instructions.

You must to follow the next instructions as root.

Prerequisites

pkg inst apache24 python36 \
py36-pip py36-bcrypt py36-passlib py36-cffi py36-six py36-vobject

User radicale

To improve security, it is highly recommended to run Web application as a dedicated and restricted user.

pw useradd \
-n radicale -c "Radicale user" -s /usr/sbin/nologin -h - -d /nonexistent

Install

python3.6 -m pip install radicale

Configuration

Create directories

mkdir -p \
/var/db/radicale/collections \
/usr/local/etc/radicale \
/var/log/radicale

Set permissions

chown -R radicale:radicale /var/db/radicale /var/log/radicale
chmod 750 /var/db/radicale /var/log/radicale

Create /usr/local/etc/radicale/config

[server]
hosts = 0.0.0.0:5232

[auth]
type = htpasswd
htpasswd_filename = /usr/local/etc/radicale/users
htpasswd_encryption = bcrypt

[rights]
type = owner_only

[storage]
filesystem_folder = /var/db/radicale/collections

[logging]
config = /usr/local/etc/radicale/logging

More

Create /usr/local/etc/radicale/logging

[loggers]
keys = root

[handlers]
keys = file

[formatters]
keys = full

[logger_root]
level = WARNING
handlers = file

[handler_file]
class = handlers.TimedRotatingFileHandler
args = ("/var/log/radicale/radicale.log", "midnight", 1, 7)
formatter = full

[formatter_full]
format = %(asctime)s - [%(thread)x] %(levelname)s: %(message)s

More

Manage Radicale’s users

Create an user with htpasswd to create the file which contains the users

htpasswd -Bc /usr/local/etc/radicale/users johndoe

Set permissions to the file

chown root:radicale /usr/local/etc/radicale/users
chmod 640 /usr/local/etc/radicale/users

To add an user or modify his password

htpasswd -B /usr/local/etc/radicale/users katsmith

To delete an user

htpasswd -D /usr/local/etc/radicale/users katsmith

More

rc script

Create /etc/rc.d/radicale

   1 #!/bin/sh
   2 
   3 # PROVIDE: radicale
   4 # REQUIRE: DAEMON
   5 # BEFORE: LOGIN
   6 # KEYWORD: shutdown
   7 
   8 . /etc/rc.subr
   9 
  10 name=radicale
  11 rcvar=radicale_enable
  12 pidfile=/var/run/${name}/${name}.pid
  13 start_precmd=do_precmd
  14 
  15 load_rc_config $name
  16 : ${radicale_enable:=NO}
  17 : ${radicale_user:=radicale}
  18 : ${radicale_group:=radicale}
  19 : ${radicale_config:=/usr/local/etc/radicale/config}
  20 
  21 command=/usr/local/bin/python3.6
  22 command_args="-m radicale -d -p ${pidfile} -C ${radicale_config}"
  23 
  24 do_precmd()
  25 {
  26   if [ ! -d ${pidfile%/*} ]
  27   then
  28     install -d -o ${radicale_user} ${pidfile%/*}
  29   fi
  30 }
  31 
  32 run_rc_command "$1"

Set permissions

chmod 555 /etc/rc.d/radicale

More

Start

sysrc radicale_enable=YES
service radicale start


CategoryHowTo CategoryPorts

Ports/www/radicale (last edited 2021-12-11T20:54:21+0000 by GregoryReinbold)