Manage the Gardience server itself
The operating system of the server Gardience runs on needs the same care as every other machine: kernel and package updates, Docker updates, hardening, and checks. Under CMMC it is a Security Protection Asset, a system that protects the machines holding Controlled Unclassified Information (CUI), and an assessor checks it like those machines. Gardience can manage it for you, with guardrails that keep it from breaking the server it depends on.
It works the same on a server that runs only Gardience and on one shared with other work, including a server that holds CUI.
Turn it on
#On the server, as root:
sudo /opt/gardience/gardience manage-selfOn a new install, add --manage-self to the installer.
The console's Machines > Add machines > Manage this server too button is off by default. Root can turn it on:
sudo /opt/gardience/gardience manage-self console onThen an admin's request in the console is carried out by the server's once-a-minute task within a minute or two, with the same steps as the command. gardience manage-self console off turns the button off again.
Either way, root builds the agent's install on the server itself, from the Gardience release: the agent's version and installer checksum, and its settings. The only thing it takes from the console is a one-join enrollment token, which it checks against a strict pattern first. Nothing the console writes is ever run as root on the server.
What it does:
- Installs the Salt agent on the server, through the same enrollment every machine uses. The enrollment accepts one machine and is closed as soon as the server joins.
- Approves the server's key, because root on the server asked for it, and records that in the audit log.
- Checks that the machine that joined really is this server (by its machine id).
- Puts it in the protected group Gardience server. The group cannot be changed or deleted in the console.
- Gives the group a change window, Sunday 02:00 to 05:00 in the server's time zone, unless it already has one. Change it under Machines > Changes.
- Lists the group as a Security Protection Asset under Security > CMMC Level 2 > Program, unless you already chose a category for it, so it shows that way in the System Security Plan.
The server then appears under Machines marked Gardience server, and in patch and STIG results like any machine.
gardience manage-self status shows how it is managed and whether a restart is waiting. gardience manage-self off stops managing it: it asks you to type the server's name, removes its key, and stops its agent.
Once the server manages itself, Gardience's automation has the same reach into the server's operating system as into any managed machine. That means whoever controls the console (an admin account) or its Salt master can run commands on the server through Salt, within the guardrails below. Keep admin accounts few and behind MFA, and leave the console's button off if you want the decision to manage the server to stay with root. Only admins see this server's status in the console.
The guardrails
#Gardience enforces these in its code, whoever starts the change, whether the server is named, in a group, or matched by a pattern. They guard against mistakes, not against someone who already controls the console: see the note above.
The server goes last
#In every run step that includes the server (a runbook, each step of a workflow, a schedule, an API request, or a fix button on the dashboard), Gardience changes every other machine first, waits until all of them have finished, and only then changes the server. In a workflow, keep the server out of the pilot ring, so it is changed with the last group. Work held for a change window or an offline machine goes the same way when it is released.
It restarts only after the run, inside its change window
#A run never restarts the server in the middle. A restart step, or a patch run that needs a restart to finish (Patch, restart when needed, patch again), sets the restart aside. When the run has finished and the server's change window is open, Gardience:
- updates the container engine (Docker) if an update is waiting
- restarts the server
- checks, when it is back, that the console answers, that the server's own agent answers after a fresh start, and that every agent that was connected before has reconnected, and writes the result in the run's log and the audit log
If the window is closed, the restart waits until it opens. If no change window covers the server, it waits until you set one. To restart through Gardience at the next window, run sudo /opt/gardience/gardience restart-server. You can always restart the server yourself: Gardience starts on its own and agents reconnect.
Updates never stop Docker in the middle of a run
#Updating Docker's own packages restarts Docker, which would stop the Salt master the run reports to. So while a patch runs on the server, the container engine's packages (Docker Engine, containerd, runc, and the Compose and Buildx plugins) are held back. Everything else is updated, the kernel included. The held packages are updated at the end of the run, inside the change window, as above.
Hardening keeps Gardience working
#When the security baseline (STIG and CIS aligned) or the CMMC settings run on the server:
- turning on the host firewall always keeps the console ports (443 and 80, or the ones you chose), the agent ports (4505 and 4506), smart card sign-in when it is on, and SSH open
- password sign-in over SSH stays on when no account on the server has an SSH key, so you cannot be locked out
- application allowlisting (fapolicyd) is not enforced on the server, because it would block the containers Gardience runs in (audit mode is fine)
- FIPS mode is set only through the FIPS install (see Install in FIPS mode)
After every run step that changed the server, Gardience checks what Docker needs and puts back anything a step took away: Docker running, IP forwarding on (also kept on across restarts in /etc/sysctl.d/99-gardience-server.conf), the console, agent, and SSH ports open in the firewall, and Docker's data folder allowed to run programs. A removed Docker package or a blocked kernel module is reported for you to fix.
What is never sent to the server
#These are refused on the server with a plain message, and left out of runs that include other machines:
- a restart or shutdown outside the end-of-run maintenance
- stopping, restarting, disabling, or removing Docker, containerd, or the Salt master
- a command that does any of those, turns off IP forwarding or the bridge modules, removes Docker's data, or turns on FIPS mode. Gardience reads each command in the text, also after
&&,;, or a pipe, behindsudo,env,nohup,timeout, orsh -c, with a full path such as/sbin/reboot, and with options before the verb, such assystemctl --no-block reboot,shutdown --reboot,telinit 6, ordocker container stop. It cannot read a command hidden inside a script file or built at run time, so review scripts before you run them on the server. - a state run, unless it is a dry run or one of Gardience's own states that leave Docker, Salt, and the firewall alone (the desired state and the ready-made formulas other than Firewall allow list). Your own saved states, roles, imported formulas, and full state runs can do anything a command can, so run them on the server by hand, or as a dry run
- turning on deny by default (Refuse incoming connections by default), Limit remote access, or Turn off the Wi-Fi adapter, and closing a port the server needs (the console ports, the agent ports, smart card sign-in, or SSH). Dry runs of these are fine. Set the server's own firewall limits by hand, and check them from a second session before you close the first.
- an upgrade to a new major operating system release (do that by hand: back up, upgrade, then run
gardience doctor) - updating Gardience's own containers (use
gardience upgrade)
Gardience cannot read the inside of your own Ansible playbooks. They still go last, and the check after each step puts back what Docker needs, but review what they do before running them on the server.
After every change on the server, Gardience also checks that the fleet's agents are still connected. If fewer are connected two minutes later than in the minute before the change, the run's log says how many are missing, and an alert goes to your alert channels.
Its key and its name are protected
#Rejecting the server's key in the console asks you to type its name. Removing it through the API needs ?confirm=NAME, and the configuration service refuses a removal that does not name it. A rebuilt machine can never take over the server's name through re-registration.
Shared servers
#When the Gardience server also runs other work, Gardience treats that work as part of the server: patching updates its packages too, the firewall keeps every port that was listening when it was turned on, and the restart at the end of a run restarts everything on the server. Containers you run beside Gardience come back after the restart if they have a restart policy. Pick a change window that suits everything on the server.
After a restore onto a new server, or a standby promotion
#The backup (or the standby's copy) brings back the record that the old server was managed, but not its agent. Within about 15 minutes the console sees that it now runs on another machine, stops treating the old name as the Gardience server, and says so on the Machines > Add machines card and in the audit log. Run sudo /opt/gardience/gardience manage-self on the new server: it removes the old server's key for that name and joins the new server under it. See Storage and recovery and High availability.