Artica Wiki

ActiveDebianSync Security guide

How to securely configure ActiveDebianSync by running it under a dedicated Unix user.

This document explains how to securely configure ActiveDebianSync by running it under a dedicated Unix user.
By default, ActiveDebianSync can run as root, but doing so introduces unnecessary security risks.
It is strongly recommended to configure the daemon to run under a dedicated, restricted system user with minimal privileges.

Create a dedicated system user

# Create the user (no shell, no accessible home directory)
sudo useradd -r -s /bin/false -d /var/lib/ActiveDebianSync -c "ActiveDebianSync Daemon" debian-sync
# Create required directories
sudo mkdir -p /var/lib/ActiveDebianSync/mirror
sudo mkdir -p /var/log/ActiveDebianSync
sudo mkdir -p /etc/ActiveDebianSync
# Set permissions
sudo chown -R debian-sync:debian-sync /var/lib/ActiveDebianSync
sudo chown -R debian-sync:debian-sync /var/log/ActiveDebianSync

Update the configuration file

Edit /etc/ActiveDebianSync/config.json and add:

{
  "run_as_user": "debian-sync",
  "run_as_group": "debian-sync",
  ...
}  

Required Permissions

The dedicated user must have:

Systemd Service

The systemd service must start as root so the daemon can drop privileges internally:

[Service]
  Type=simple
  User=root
  ExecStart=/usr/local/bin/activedebiansync -config /etc/ActiveDebianSync/config.json

Do NOT set User= to debian-sync here because ActiveDebianSync handles its own user switching.