13.2 agent.toml
Every agent has a state directory that holds its identity. In it, agent.toml contains just two keys: the server's address and the agent ID. The agent gets everything else (jobs, schedules, repositories) from the server. The file is created at enrollment and is not edited by hand.
Location of the state directory
Platform | Default path | Program |
|---|---|---|
Windows |
|
|
Linux |
|
|
Another directory can be given with --state-dir or the environment variable PDC_AGENT_DIR (see section 13.5 Command line and section 13.4 Environment variables). On the recovery medium, X:\pdc\state (WinPE) or /run/pdc-recovery/agent (Linux) is used for the logs of the recovery console.
Keys in agent.toml
An extra or unknown key makes the file invalid ("invalid agent.toml"), and the agent does not start. Both keys are required.
| Name | Required | Default | Description |
|---|---|---|---|
server_url | โ | Address of the server's agent endpoint (gRPC): https://<server name or IP>:8444. The name or IP must be in the server certificate. The agent opens the connection to it itself. Comes from the --server parameter of the enrollment. | |
agent_id | โ | Identifier of the agent assigned by the server. The server recognizes the agent by it and by the certificate. |
Example:
server_url = "https://backup-pc:8444"
agent_id = "<ID assigned by the server>"
Other files in the state directory
Enrollment (pdc-agent enroll, on Windows also pdc-agent install) creates the identity. On Linux the agent sets mode 0600 on these files.
File or folder | Content |
|---|---|
| Server address and agent ID (see above). |
| Private key of the agent certificate. |
| Agent certificate. The agent renews it automatically; its lifetime is set by |
| Certificate of the server's internal certificate authority. |
| Pinned server keys (SHA-256 of the public key, one line per key, hexadecimal). Agents connect only to a server that presents one of these keys. Agents enrolled before pinning existed do not have the file yet and take over the keys from the first session. When the server changes its key ( |
| Pinned signing key of agent packages (Ed25519, hexadecimal). The agent rejects updates signed with another key. |
| Agent log files (JSON lines, rotated daily, 30 files). The log level comes from |
| Temporary files, for example the scripts that run before or after a job. |
Switching servers or enrolling again
If the server moves or its name changes, the enrollment stays valid as long as the agent can reach the server under the old address and the server certificate contains the name. To assign the agent to a different server, enroll it again. Create an enrollment token under Agents on the server and run on the machine:
sudo PDC_ENROLL_TOKEN=<token> /opt/pdc-agent/pdc-agent enroll --server https://backup-pc:8444 --force
sudo systemctl restart pdc-agent
--force replaces an existing enrollment. The token is passed in the environment variable so it does not appear in the process list. The installation procedure is described in chapter 03 Installation; the command lines of all subcommands are in 13.5.