Skip to content
$ shellfirm

Org policy

Roll out a machine-wide baseline with /etc/shellfirm/policy.yaml that applies in every directory.

An org policy applies to every directory on the machine, inside and outside repositories. Use it for rules the whole organisation shares, rolled out with MDM, Ansible, Chef or a package. Rolling out to a team shows where it fits in a full rollout, with an Ansible task.

Where it lives

PlatformPath
Linux, macOS/etc/shellfirm/policy.yaml (the same path on both)
Windows%ProgramData%\shellfirm\policy.yaml

The format is the same as .shellfirm.yaml:

/etc/shellfirm/policy.yaml
version: 1
deny:
  - kubernetes:delete_namespace
context:
  protected_branches: [develop]

Real result, in any directory:

Output
  Shell (you, in a terminal): blocked (deny list or project policy; no challenge)
  AI agent (hooks, MCP): deny (blocked)
    why: Command matches a deny-listed pattern: `kubernetes:delete_namespace` is denied by the org policy (/etc/shellfirm/policy.yaml)

Org files are merged first (outermost); repository policies add to them. They are marked [org] in status and policy show:

Output
Policy sources (outermost first):
  /etc/shellfirm/policy.yaml [org]  (valid)
  /home/dev/projects/webapp/.shellfirm.yaml  (valid)

Lock it down

Make the file owned by root and not writable by users. Otherwise a user could move it away or replace it. shellfirm status, policy show and policy validate warn when the current user can write the file or its directory (a sticky directory you do not own the file in is fine), and policy validate --strict fails on it:

Output
/etc/shellfirm/policy.yaml: valid with warnings
  warning: this org policy file is writable by you; a centrally managed org policy should be owned by root and not writable by users
/home/dev/projects/webapp/.shellfirm.yaml: valid
strict mode: warnings are treated as errors
sudo install -o root -g root -m 0644 policy.yaml /etc/shellfirm/policy.yaml

An extra org file: SHELLFIRM_ORG_POLICY

SHELLFIRM_ORG_POLICY=/abs/path/policy.yaml names one additional org file.

  • It only adds a file. It never replaces or hides /etc/shellfirm/policy.yaml, so it cannot weaken anything.

  • The path must be absolute. A relative path is reported as invalid and not applied:

    Output
    relative.yaml: invalid, NOT applied — SHELLFIRM_ORG_POLICY must be an absolute path (a relative path would depend on the current directory); not applied
    /etc/shellfirm/policy.yaml: valid
  • A missing file is reported too, so a broken rollout is visible.

Check it

shellfirm policy validate --strict   # validates the org file(s) and every policy that applies here
shellfirm status                      # lists every policy file with its state

The why: line of a decision names org files as org policy (/etc/shellfirm/policy.yaml) and repository files as project policy (<path>), and status / policy show mark org files [org]. Two shorter messages do not tell them apart yet: the shell line says blocked (deny list or project policy; no challenge), and policy show reports a personal ignore that an org rule overrides as `kubernetes:delete_namespace` is in your ignores_patterns_ids, but the project policy enforces it. In both, "project policy" includes org files.