3.3 Installing the server on Linux
On Linux the server is installed as a .deb or .rpm package. The package creates a dedicated service account, sets up the systemd service pdc-server and starts it. This page describes the installation, the firewall, the hardened service account, local repository folders and updating from versions that still ran as root.
Installation
The package installs the server and starts it immediately. For ARM64 systems use the _arm64.deb or .aarch64.rpm files.
Debian / Ubuntu
sudo apt install ./pdc-backup-server_<version>_amd64.debFedora / RHEL / AlmaLinux / Rocky
sudo dnf install ./pdc-backup-server-<version>-1.x86_64.rpmWhat the package installs and does
During installation the package performs these steps:
Create the group and system user
pdc-backupif they are missing. An existing account is never modified.Stop the service (on an update) and create or hand over the data folder
/var/lib/pdc-backupwith mode 0700 topdc-backup.Copy the agent packages from
/usr/share/pdc-backup/packagesinto thepackagesfolder of the data folder. The server reads them from there, signs them and distributes them.Reload systemd, enable
pdc-server.serviceand restart it.Print the web interface address and a reminder about the firewall ports.
Creating the account requires useradd or adduser (Debian: dependency passwd | adduser, RPM: /usr/sbin/useradd).
βββ /usr/bin/
β βββ pdc-server # server
β βββ pdc-immutable-helper # helper service for hardened repositories
βββ /usr/lib/systemd/system/
β βββ pdc-server.service # systemd service of the server
β βββ pdc-immutable-helper.service # helper service (not enabled)
βββ /usr/share/pdc-backup/packages/ # agent packages shipped in the package
βββ /etc/pdc-immutable-helper/
βββ /var/lib/pdc-backup/ # data folder, owner pdc-backup, mode 0700
βββ packages/ # agent packages, signed and distributed by the server
βββ catalog.db # catalog
βββ secret.key # master key
βββ pki/ # CA, server and signing keys
βββ logs/ # logs
βββ recovery/ # recovery medium (ISO)
βββ server.toml # configurationFirewall
After installation open ports 8443 (web interface) and 8444 (agents) in the firewall if other machines should reach the server.
sudo firewall-cmd --permanent --add-port=8443/tcp --add-port=8444/tcp && sudo firewall-cmd --reload
# or with ufw:
sudo ufw allow 8443/tcp && sudo ufw allow 8444/tcp
If a firewall with custom rules is in use, the two TCP ports are all that is needed. For installing an agent with a command, the new machine must reach port 8444 (see section 3.1 Requirements and installation files).
Showing the web interface address and CA fingerprint
sudo -u pdc-backup pdc-server --data-dir /var/lib/pdc-backup info
The output lists the data folder (data directory), the CA fingerprint (CA fingerprint), the names in the certificate (certificate for) and the web interface address (web UI). Compare the fingerprint with the one in the browser's certificate warning on first access (see section 3.4 First start and initial setup). The command runs as the service account so that no root-owned files appear in the data folder.
Service account and hardened systemd unit
The server runs as the system user pdc-backup (group pdc-backup, home folder /var/lib/pdc-backup, no login shell), not as root, and needs no capabilities. Ports 8443 and 8444 are above 1024. The unit pdc-server.service (installed under /usr/lib/systemd/system/) sets, among others:
Setting | Effect |
|---|---|
| The service runs without root rights |
| The data folder is readable only by the service account, new files are not readable by others |
| No capability can be gained or inherited |
| The file system is read-only except at the allowed places, no device nodes |
| Write access only to the data folder and the usual repository locations. The leading |
| Unix sockets, IPv4 and IPv6 only |
| The service restarts 10 seconds after a failure |
In addition, the kernel and process surfaces the server does not use are locked (ProtectKernelTunables, ProtectKernelModules, ProtectKernelLogs, ProtectControlGroups, ProtectClock, ProtectHostname, LockPersonality, RestrictRealtime, RestrictSUIDSGID, RestrictNamespaces, SystemCallArchitectures=native).
Local repository folders and network shares
Because the service account is not root, backup locations must belong to it or be writable for it.
Local repositories (for example on
/srv/backupsor a USB disk): the folder must belong to the account. The server never changes owners. It creates the folder if it is allowed to and restricts it to itself. Otherwise prepare the folder:sudo install -d -o pdc-backup -g pdc-backup -m 0700 /srv/backups/pdcorsudo chown -R pdc-backup:pdc-backup <folder>.Other locations than
/srv,/mntand/mediamust additionally be released in a drop-in (see below).Network shares (SMB, NFS) are mounted by the system. The server never mounts and never changes permissions there. Example
/etc/fstabline for SMB that assigns all files to the service account:
//nas/backup /mnt/nas-backup cifs credentials=/etc/pdc-backup/nas.cred,uid=pdc-backup,gid=pdc-backup,file_mode=0600,dir_mode=0700,_netdev,nofail 0 0
The credentials file /etc/pdc-backup/nas.cred contains username=... and password=... (mode 0600, owner root). Then enter the mount point as a local repository (see chapter 08 Repositories and Storage). For an NFS export, the numeric UID of pdc-backup must be allowed to write. If the UID must be fixed, create the user yourself before installing the package: groupadd --system --gid 900 pdc-backup and useradd --system --uid 900 --gid pdc-backup --home-dir /var/lib/pdc-backup --no-create-home --shell /usr/sbin/nologin pdc-backup. The package keeps an existing user.
Adjusting the unit
Put changes in a drop-in so package updates do not overwrite them:
sudo systemctl edit pdc-server
More repository locations and a mount the service should wait for:
[Service]
ReadWritePaths=/data/backups /home/backup/pdc
RequiresMountsFor=/data/backups
A port below 1024 (for example web_listen = "0.0.0.0:443" in server.toml) additionally needs:
[Service]
AmbientCapabilities=CAP_NET_BIND_SERVICE
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
If binding fails, the log shows cannot listen on <address>: Permission denied.
Updating from a version that ran as root
Earlier versions ran as root. When updating to the package with a service account, this happens:
The package stops the service so the old root process cannot create new root-owned files.
It creates the account
pdc-backupand hands/var/lib/pdc-backupover topdc-backuponce. File systems mounted inside the data folder and a data folder on a network file system are left unchanged (the package prints a warning).It starts the new unit.
The package does not touch repository folders created by root outside the data folder. Give each of them to the service account once (not for network shares):
sudo chown -R pdc-backup:pdc-backup <folder>
sudo systemctl restart pdc-server
At startup the journal shows local repository folder is not usable by the server account for every local repository that cannot be read (journalctl -u pdc-server). The connection test in the repository editor of the web interface shows the same error.
Running server commands by hand
Run commands that write to the data folder (info, dr restore, four-eyes disable, server-key and others) as the service account. A catalog.db created by root would otherwise prevent the service from starting:
sudo -u pdc-backup pdc-server --data-dir /var/lib/pdc-backup info
To restore the server from a configuration backup, see chapter 09 Restore.
Hardened repositories
Hardened repositories (immutable files) need the helper service pdc-immutable-helper on the repository host. The Linux packages include the helper service (/usr/bin/pdc-immutable-helper, pdc-immutable-helper.service and the folder /etc/pdc-immutable-helper) but do not enable it. It is paired and activated in the repository panel (Set up helperβ¦, see chapter 08 Repositories and Storage).
Removing
apt remove and apt purge (or dnf remove) stop the service but never delete data, the account or repositories. Catalog, CA and master key live in the data folder. See section 3.7 Updating and uninstalling.