2.3 Agent communication and PKI
Agent and server talk over a single outbound TCP connection from the agent to port 8444. This page describes the functions of this connection, the certificates of the internal certificate authority (PKI), how a new agent is enrolled and how certificates are handled during operation.
Basic principle
The agent always dials in to the server. In normal operation the server opens no connection to computers. The exceptions are push installation (SSH, WinRM, SMB) and Wake-on-LAN packets.
All connections use TLS with mutual certificate verification (mTLS).
Port 8444 serves two things: the agent connection (commands, status, progress) and the restic REST protocol for repository access under
/repo/<repository ID>/. Both use the same mTLS.The protocol is versioned. The server understands the current and the previous minor version so that agents can be updated after the server.
Functions of the agent connection
Function | Who may use it | Purpose |
|---|---|---|
Enrollment | Anyone with a valid token, no client certificate | One-time registration: the agent sends the token, a certificate signing request (CSR), host data and version; the answer contains the agent ID, certificate, CA certificate, the key for verifying package signatures and the pins of the server key |
Permanent session | Agent with a valid certificate | The agent announces itself (version, host data, runs still executing, supported workloads, disks and applications found) and sends regular signs of life, progress, log lines and results. The server sends orders, cancellations and small live requests such as directory listings |
Certificate renewal | Agent with a valid certificate | Issues a fresh certificate to the calling agent |
Recovery | Only agents enrolled with a recovery token | Console of the recovery medium: list image backups, read the manifest, create an image restore run on the calling agent |
Self-service | Agent on behalf of a local user | Status, back up now, snapshots, browse and restore for the tray and self-service restore. The server checks switches, responsibility and ownership |
Source for server-side encryption (experimental) | Agent with a valid certificate and the run's single-use token | The agent supplies the file list and, on request, contents; the server encrypts and stores |
The functions are deliberately generic: a new workload brings a name and a specification but no new function. Agents announce optional features at connection time; the server offers a feature only to agents that announce it.
Connecting and reconnecting
The agent opens TLS to the server (connect timeout 15 seconds, keepalive every 30 seconds) and verifies the server certificate against the internal CA and against the remembered key pins.
It opens the permanent session and announces itself (version, host data). The server answers with the agent ID and its settings.
The agent reports its running runs; the server closes runs it lists as running that the agent no longer knows.
If the connection drops, the agent retries with exponential backoff: starting at 1 second, doubling up to at most 60 seconds, with some jitter. A session that was up resets the backoff.
Because the agent only connects outbound, this works behind NAT or firewalls as long as the server is reachable. While the agent is not connected, the run stays pending_agent and starts after the connection.
Internal certificate authority
Property | Value |
|---|---|
Algorithm | ECDSA P-256 with SHA-256 |
Creation | On the server's first start |
Server certificate | Valid |
Agent certificate | Common name = agent ID; valid |
Revocation | Entry in the catalog ( |
Keys at rest |
|
The agent does not renew its certificate while it executes jobs; renewal is postponed. The server certificate for the web interface can be replaced by your own (PEM chain and unencrypted key); the agent endpoint always keeps the internal certificate.
Key pinning
The server keeps its TLS key across certificate renewals. The enrollment answer and every connection setup carry the key pins of the server (SHA-256 of the public key). The agent stores them in the file server.pins and accepts only a server certificate that belongs to the internal CA and has a remembered key. A certificate for the server's name issued by the same CA for a different key is refused.
Changing the key in three steps:
pdc-server server-key preparecreatesserver.next.key, then restart the server. From the start it announces both pins.Wait until all agents have connected since then (agents list, last contact). They replace their pins in the process.
Stop the server, run
pdc-server server-key rotate, start the server; the certificate is issued with the new key.
pdc-server server-key show shows the pins accepted now. Agents that missed the window refuse the server; enroll such an agent again or delete its server.pins file so that it pins anew at the next connection.
Enrollment
Token
An enrollment token has the form pdc1.<secret>.<CA pin>. The secret is 32 random bytes (URL-safe Base64); the CA pin is the SHA-256 fingerprint of the server CA in hex. The server stores only a hash of the secret. The token is valid once and by default for 15 minutes (enrollment_token_minutes). Because the CA pin is part of the token, an agent cannot be redirected to a rogue server.
Sequence
In the web interface under Agents β Add agent, choose the operating system and the address under which the computer reaches the server. The address must be one of the names in the server certificate.
The server creates the token and a command. The command downloads the agent from
https://<server>:8444/install/..., checks the embedded SHA-256 value and runspdc-agent install.pdc-agent installcopies the program into place, creates a key pair locally and sends only the certificate signing request (CSR) together with the token to the server for enrollment. The token is passed through the environment variablePDC_ENROLL_TOKEN, not as an argument.The server issues the certificate and returns the CA certificate, package signing key and server pins. The agent stores everything and starts its service.
The agent opens the session and shows up as online.
The Windows command is deliberately a readable PowerShell line without an encoded command and without executing downloaded text, because antivirus products flag those patterns. It uses curl.exe, which ships with Windows 10 version 1803 and later.
Agent files
In the agent's state folder (Windows C:\ProgramData\PDC-Backup\agent, Linux /var/lib/pdc-agent) you find, among others:
File | Content |
|---|---|
| Server address ( |
| The agent's private key and certificate |
| Certificate of the server CA |
| Remembered key pins of the server, one per line |
| Public key (Ed25519) for verifying agent updates |
See section 2.5 Data locations.
Recovery agents
An agent enrolled with a recovery token (recovery medium) may use the recovery functions and thereby restore the image backups of all machines. Such agents work only for recovery_agent_hours (default 24) after enrollment. Recovery tokens and the prepare script for push are admin functions.
Repository access through the agent endpoint
The restic REST protocol on port 8444 is the agent's only path to the data. The rules are in section 2.4 Repositories and data format. For each repository the agent gets its own restic key file with a random password; the repository's primary password stays on the server.
Updates and packages
The server signs the agent packages in the packages folder with an Ed25519 key (package-signing.key). The agent verifies signature and hash, swaps its binary, starts the new version with a health check and rolls back automatically if it does not reconnect. An update to an older version needs allow_downgrade (admin). See chapter 12 Automation and Deployment.