Gardience Documentation gardience.com →
Docs / Using Gardience

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

#
FormulaWorks onWhat it keepsHelps with
Time syncLinux and Windowschrony 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 bannerLinux and Windowsyour 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 screenCMMC AC.L2-3.1.9
SSH server hardeningLinuxroot sign-in, password sign-in, empty passwords, sign-in attempts, idle session checks, X11 forwarding, and which groups may sign inCMMC AC.L2-3.1.8, AC.L2-3.1.11, and AC.L2-3.1.12
Local accountsLinux and Windowsthe accounts you list, who is an admin (sudo or wheel on Linux, Administrators on Windows), disabled accounts, a first password, and SSH keysCMMC AC.L2-3.1.1 and AC.L2-3.1.5
Firewall allow listLinux and Windowsthe ports you list open in firewalld, ufw, or Windows Defender Firewall, optionally only to some addressesCMMC SC.L2-3.13.6 and CM.L2-3.4.7
Syslog forwardingLinuxrsyslog sending the system log to your collector over TCP, UDP, or TLS, with a queue on disk while the collector is awayCMMC 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:

Fill in the settings

#

Admins save settings. Operators and other people who can run changes can dry-run and apply them.

  1. Open the formula.
  2. Under Settings, choose A node group and the group, or One machine and its name.
  3. 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.

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:

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.

  1. Find the formulas. On the old server, formulas installed from packages keep their states in /usr/share/susemanager/formulas/states/NAME and 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.
  2. 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/chrony

    For 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 metadata

    If your formulas are already in a Git repository, import them from Git instead.

  3. 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.

#
Gardience by Bouziden Management LLC.