Radicale

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.

*Apache 2.4 (for htpasswd tool) *Python 3.6 *pip (Python package manager) *Required Python libraries for Radicale

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

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
python3.6 -m pip install radicale

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
[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

[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

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

Create /etc/rc.d/radicale

#!/bin/sh
 
# PROVIDE: radicale
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: shutdown
 
. /etc/rc.subr
 
name=radicale
rcvar=radicale_enable
pidfile=/var/run/${name}/${name}.pid
start_precmd=do_precmd
 
load_rc_config $name
: ${radicale_enable:=NO}
: ${radicale_user:=radicale}
: ${radicale_group:=radicale}
: ${radicale_config:=/usr/local/etc/radicale/config}
 
command=/usr/local/bin/python3.6
command_args="-m radicale -d -p ${pidfile} -C ${radicale_config}"
 
do_precmd()
{
  if [ ! -d ${pidfile%/*} ]
  then
    install -d -o ${radicale_user} ${pidfile%/*}
  fi
}
 
run_rc_command "$1"

Set permissions

chmod 555 /etc/rc.d/radicale

More

sysrc radicale_enable=YES
service radicale start

  • ports/www/radicale.txt
  • Last modified: 2021/12/11 20:54
  • by GregoryReinbold