Formula catalog
A formula is a Salt state with a form. Instead of writing state files or pillar data by hand, you pick a formula, fill in its form for a node group or one machine, dry-run it to see what would change, and apply it. Gardience ships six ready-made formulas, and you can import the formulas you already use with other Salt consoles.
To open the catalog: choose Automation > Formula catalog.
The page lists the ready-made formulas first and your imported ones after them. Type in the search box to filter by name, description, or control (for example AC.L2-3.1.9). Choose a formula to open its page, which has its settings form, Where it is used, and its files.
Ready-made formulas
#| Formula | Works on | What it keeps | Helps with |
|---|---|---|---|
| Time sync | Linux and Windows | chrony following your time servers on Linux; the Windows Time service following them on Windows (domain members keep following the domain unless you turn that off) | CMMC AU.L2-3.3.7 |
| Login banner | Linux and Windows | your notice in /etc/issue, /etc/issue.net, and before SSH sign-in on Linux (optionally /etc/motd too); the legal notice title and text at the Windows sign-in screen | CMMC AC.L2-3.1.9 |
| SSH server hardening | Linux | root sign-in, password sign-in, empty passwords, sign-in attempts, idle session checks, X11 forwarding, and which groups may sign in | CMMC AC.L2-3.1.8, AC.L2-3.1.11, and AC.L2-3.1.12 |
| Local accounts | Linux and Windows | the accounts you list, who is an admin (sudo or wheel on Linux, Administrators on Windows), disabled accounts, a first password, and SSH keys | CMMC AC.L2-3.1.1 and AC.L2-3.1.5 |
| Firewall allow list | Linux and Windows | the ports you list open in firewalld, ufw, or Windows Defender Firewall, optionally only to some addresses | CMMC SC.L2-3.13.6 and CM.L2-3.4.7 |
| Syslog forwarding | Linux | rsyslog sending the system log to your collector over TCP, UDP, or TLS, with a queue on disk while the collector is away | CMMC AU.L2-3.3.1 and AU.L2-3.3.8 |
Each formula page also says which STIG rules it helps with. A formula helps you meet a control; your assessor decides whether the control is met, and the wording of a banner is still yours to get right.
Some details worth knowing before you apply them:
- SSH server hardening writes each option into sshd_config and, where the server reads a drop-in folder, into
/etc/ssh/sshd_config.d/00-gardience-hardening.conf, which is read before a cloud image's own drop-in. Before you set root sign-in tonoor turn off password sign-in, make sure another admin account can sign in with a key. - Local accounts never changes the built-in accounts (root, Administrator, Guest). A first password is set only when an account is created; Gardience never changes the password of an account that already exists (use Local admin passwords to rotate them). On Linux a disabled account is expired, so no password or key works. On Windows, a disabled account is taken out of Administrators and Remote Desktop Users; turn it off completely in Windows or in Active Directory.
- Firewall allow list adds rules and never removes the ones already there, unless you turn on Only from the listed addresses. Then, for each rule that names an address, it also takes away the rules that open that port to anyone (firewalld ports and the matching service such as
ssh; ufw rules such asallow 22/tcpandOpenSSH; on Windows, the remote addresses of the firewall rules for that port), after the rules for your addresses are in place. Rules without an address are never touched. Run it as a dry run first, from an address in the list. With Only from the listed addresses on, Apply changes one machine at a time and stops at the first that fails, and when your own address is not in the list for a port, it says so and asks before it starts. It has no safety timer and no automatic undo: to open a port to everyone again, add a rule for it with no address and apply. For SSH, Remote Desktop, and WinRM, the Limit remote access to the allowed sources runbook does the same with a dry run check, a five-minute safety timer on each machine, and an undo (see Runbooks). On Ubuntu and Debian it uses ufw, and Only from the listed addresses uses firewall-cmd and PowerShell, which are commands, so they change nothing while command execution is off (the dry run says so). Before you turn on Turn the firewall on if it is off, make sure the ports you sign in with are in the list. - Which firewall tool to use. Four tools change a host firewall, and each does one job. The Firewall allow list formula keeps a list of open ports in place on a group of machines over time. On the CMMC page's Network checks window, Refuse incoming connections by default (Linux) sets the default so the firewall refuses what no rule allows, Limit remote access narrows SSH, Remote Desktop, and WinRM to your allowed sources, and Close one listening port closes one port on one machine. See CMMC Level 2.
- Syslog forwarding shows a note on Windows and changes nothing there. Windows does not send syslog by itself: collect its event logs with Windows Event Forwarding or a log agent your collector supports.
Fill in the settings
#Admins save settings. Operators and other people who can run changes can dry-run and apply them.
- Open the formula.
- Under Settings, choose A node group and the group, or One machine and its name.
- Fill in the form and choose Save settings. Nothing changes on any machine yet.
Settings are saved as pillar data for the machines they apply to. They never become part of a state file: the formula reads them, and every value is checked against the form's type before it is saved (a number must be a number, a choice must be one of the choices, a one-line field cannot hold a line break, and a field with a pattern must match it).
A machine's own settings win over its groups' settings. When a machine is in two groups that both have settings for the same formula, the groups are applied in name order and the later name wins.
Password fields are sealed with the same key as the Secrets vault and are never shown again. A saved password shows as saved; leave the field empty to keep it, or type a new one to replace it.
Which machines get a group's settings. As with vault secrets, a group's settings go to the machines that were in the group when the settings were saved. A machine cannot join a group by changing its own grains and receive them. When machines join a group, choose Update members on its row under Where it is used. A dry run or apply refuses to start while the group has machines that joined after the settings were saved, and says which ones.
Filling the form from settings saved elsewhere. Choose Fill the form from settings saved elsewhere (JSON), paste the settings as a JSON object (the same shape as the formula's pillar data), and choose Fill the form. Check the values, then save.
Dry run and apply
#Under Where it is used, each group or machine has Dry run and Apply.
- Dry run runs the formula with
test=True. Nothing changes; the run shows, for each machine, what would change. - Apply makes the change. It goes through the same path as every other change in Gardience: your permissions, approvals (Settings > Approvals), change windows, locks, change tickets, and the audit log. Machines that are offline or outside their change window get it when they come back or when the window opens.
Both show in Recent runs at the bottom of the page and under Jobs. Applying the same settings again changes only what drifted.
A ready-made formula runs as formulas.NAME (for example state.apply formulas.time_sync); an imported one runs under its own name.
Import your own formula
#Admins import formulas. A formula is a folder with an init.sls, any other files it uses, and an optional form.yml (and metadata.yml) describing its form. Gardience reads the common form.yml field types: text, number, boolean (and checkbox), select, password, email, url, date, time, datetime, color, group, namespace, and edit-group (a list, or with a $key, a set of named items). Gardience also accepts textarea for text over several lines.
From a file. Choose Import formula > Upload a file, pick a .tar.gz or .zip, and choose Import. Give a name only when the archive holds several formulas or has init.sls at its top. These layouts work:
NAME/init.slswithNAME/form.ymlnext to itstates/NAME/with its form inmetadata/NAME/form.yml(alsoformulas/NAME/andformula_metadata/NAME/)- either of those inside one wrapping folder, as Git hosts make when you download a repository
From Git. Choose Import formula > From a Git project, pick a project Gardience already syncs (see Ansible playbooks for projects), and give the folder that holds the formula. Import again after a change in Git to update it.
Gardience checks every archive before anything is stored. It refuses the whole archive when an entry is a link or a special file, has an absolute path or .., appears twice, or has an unusual name, and when it is over 4 MB, has more than 400 files, or unpacks to more than 8 MB. A formula's name is lowercase letters, digits, _, and -. It cannot take the name of a ready-made formula or of a folder Gardience uses, and two formulas cannot use the same top-level setting name.
After import, the formula shows Being checked for a few seconds, then Ready. Gardience's configuration keeper, which has no network access, writes it to the Salt file tree; the web service never writes there. Every import, removal, and settings change is in the audit log (formula.import_requested, formula.published, formula.settings_saved, formula.members, and so on), with a digest of the settings and never a password.
To remove an imported formula, open it and choose Remove formula. Remove its settings first. Machines keep whatever it already set.
While command execution is off
#When command execution is off (gardience automation commands off), an imported formula must only read its settings. Gardience parses every template in it, without running it, and refuses one that calls a Salt function other than a few that only read data (such as pillar.get, grains.get, and grains.filter_by), reaches for hidden attributes, imports files from outside the formula, or uses a renderer other than Jinja and YAML. It then renders the formula for sample Linux and Windows machines with your settings and refuses it if it would use a state that runs commands (such as cmd.run or module.run), an onlyif or unless option, or file content from outside the formula. The check runs at import, when settings are saved, and again before each run. Ready-made formulas are written to pass it.
With command execution on, imported formulas run as they are, like any Salt state an admin publishes.
Bring formulas from SUSE Multi-Linux Manager or Uyuni
#Formulas from SUSE Multi-Linux Manager (formerly SUSE Manager) and Uyuni use the same form.yml format, so they work here as they are. Move them in three steps.
- Find the formulas. On the old server, formulas installed from packages keep their states in
/usr/share/susemanager/formulas/states/NAMEand their forms in/usr/share/susemanager/formulas/metadata/NAME. Formulas you wrote yourself are usually in/srv/formulas/NAME, with their forms in/srv/formula_metadata/NAME. Export each one. Pack the state folder and its form folder together, for example:
cd /usr/share/susemanager/formulas tar czf chrony-formula.tar.gz states/chrony metadata/chronyFor a formula of your own:
mkdir -p /tmp/export/states /tmp/export/metadata cp -r /srv/formulas/myformula /tmp/export/states/ cp -r /srv/formula_metadata/myformula /tmp/export/metadata/ tar czf myformula.tar.gz -C /tmp/export states metadataIf your formulas are already in a Git repository, import them from Git instead.
- Import and fill in. Import each archive under Import formula > Upload a file, then open the formula and save its settings for the matching node group or machine. To carry the values over, copy them from the formula's page in the old console, or export them with that server's API (its formula calls return a system's or a group's formula data as the same JSON this page accepts; older releases also kept them as JSON files under
/srv/susemanager/formula_data). Paste them under Fill the form from settings saved elsewhere (JSON), check them, and save. Re-enter passwords by hand: they are sealed here, not copied.
Then dry-run each group and compare the result with what the old server applied before you apply it.
Groups in the old server map to node groups here (Machines > Groups). A formula assigned to a system group there becomes settings for the node group with the same machines here.