Compare commits
7
Commits
v1.10.0
...
4dc221c17f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4dc221c17f | ||
|
|
c60c6aa970 | ||
|
|
6c2d124b3f | ||
|
|
8df9070cd8 | ||
|
|
5962b9b6fb | ||
|
|
7bb4d13dc0 | ||
|
|
f7d23a7c04 |
No files matched your search
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"disableSkillShellExecution": true
|
||||||
|
}
|
||||||
@@ -87,7 +87,7 @@ jobs:
|
|||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
job_image: ubuntu:26.04@sha256:d66b366dac61b575bee2aef07e9c26e8070096fbe84a3d4d3eb0da069b5d76db
|
job_image: ubuntu:26.04@sha256:d66b366dac61b575bee2aef07e9c26e8070096fbe84a3d4d3eb0da069b5d76db
|
||||||
- name: ci
|
- name: ci
|
||||||
version: 0.2.32
|
version: 0.2.33
|
||||||
subpath: ""
|
subpath: ""
|
||||||
dockerfile: images/ci/Dockerfile
|
dockerfile: images/ci/Dockerfile
|
||||||
job_image: ubuntu:26.04@sha256:d66b366dac61b575bee2aef07e9c26e8070096fbe84a3d4d3eb0da069b5d76db
|
job_image: ubuntu:26.04@sha256:d66b366dac61b575bee2aef07e9c26e8070096fbe84a3d4d3eb0da069b5d76db
|
||||||
|
|||||||
+4
-3
@@ -13,9 +13,10 @@ vault-pass*
|
|||||||
gitleaks-report.json
|
gitleaks-report.json
|
||||||
# galaxy-importer output
|
# galaxy-importer output
|
||||||
importer_result.json
|
importer_result.json
|
||||||
# APM: apm_modules/ is the dependency cache; .claude/skills,
|
# APM: apm_modules/ is the dependency cache. Deployed skills and agents stay out
|
||||||
# agents and hooks are `apm install` deploy output, regenerated on every install.
|
# while their source is private; deployed hooks are committed for review.
|
||||||
apm_modules/
|
apm_modules/
|
||||||
.claude/skills/
|
.claude/skills/
|
||||||
.claude/agents/
|
.claude/agents/
|
||||||
.claude/hooks/
|
# Claude Code: personal settings and allowlists, never shared
|
||||||
|
.claude/settings.local.json
|
||||||
+431
-876
File diff suppressed because it is too large.
Load diff
@@ -3,27 +3,18 @@ version: 0.1.0
|
|||||||
description: Ansible Collection mortis.kamino. Consumer-side apm manifest for holocron skills.
|
description: Ansible Collection mortis.kamino. Consumer-side apm manifest for holocron skills.
|
||||||
license: GPL-3.0-or-later
|
license: GPL-3.0-or-later
|
||||||
|
|
||||||
# Consumer side: holocron plugins are addressed as git+path objects rather than
|
# git and mattpocock only (#104): bin and core are unused here, and gitea returns once it is
|
||||||
# <name>@holocron marketplace aliases, so nothing outside this manifest is
|
# rebuilt on the tea CLI.
|
||||||
# needed. Unpinned (default branch) on purpose: Renovate cannot keep a pin
|
|
||||||
# current here. Its apm manager documents only the string form (not these
|
# Hook primitives come from apm; no instruction primitive is deployed until the root AGENTS.md
|
||||||
# git+path objects), is not in
|
# has a managed section. `apm approve` writes the executables.allow entry into this file, and it
|
||||||
# renovate.json's enabledManagers, and holocron's v* tags are repo-wide and
|
# is committed because an unattended `apm install` cannot answer the prompt.
|
||||||
# lag main (v2.0.1 is 164 commits behind and predates plugins/mattpocock). A
|
|
||||||
# hand-kept ref would just go stale. The third-party skills are pinned inside
|
|
||||||
# plugins/mattpocock/apm.yml, upstream of this manifest.
|
|
||||||
targets:
|
targets:
|
||||||
- claude
|
- claude
|
||||||
dependencies:
|
dependencies:
|
||||||
apm:
|
apm:
|
||||||
- git: https://git.rkdr.net/Mortis/Holocron.git
|
|
||||||
path: plugins/bin
|
|
||||||
- git: https://git.rkdr.net/Mortis/Holocron.git
|
|
||||||
path: plugins/core
|
|
||||||
- git: https://git.rkdr.net/Mortis/Holocron.git
|
- git: https://git.rkdr.net/Mortis/Holocron.git
|
||||||
path: plugins/git
|
path: plugins/git
|
||||||
- git: https://git.rkdr.net/Mortis/Holocron.git
|
|
||||||
path: plugins/gitea
|
|
||||||
- git: https://git.rkdr.net/Mortis/Holocron.git
|
- git: https://git.rkdr.net/Mortis/Holocron.git
|
||||||
path: plugins/mattpocock
|
path: plugins/mattpocock
|
||||||
mcp: []
|
mcp: []
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
bugfixes:
|
||||||
|
- >-
|
||||||
|
systemd_hardening - Look up the listed units with one ``systemctl show`` instead of listing every unit
|
||||||
|
file. The listing can keep PID 1 busy for seconds on a host with slow storage, and the cost grows with
|
||||||
|
the number of unit files. A unit is still skipped when it has no unit file. An instance name such as
|
||||||
|
``[email protected]`` is now matched when its template exists, and a template name such as
|
||||||
|
``[email protected]`` in the lists now makes the lookup fail instead of matching.
|
||||||
@@ -41,8 +41,12 @@ held by review until an offline link check exists.
|
|||||||
*Held by:* aspirational.
|
*Held by:* aspirational.
|
||||||
- **The tracked `.claude/settings.json` never holds `permissions.allow`; `deny` and `ask` rules are
|
- **The tracked `.claude/settings.json` never holds `permissions.allow`; `deny` and `ask` rules are
|
||||||
allowed. Your own allowlist and personal guards go in `.claude/settings.local.json`, which is never
|
allowed. Your own allowlist and personal guards go in `.claude/settings.local.json`, which is never
|
||||||
committed.** (`.gitignore` lists it once issue #196 lands; until then, leave it out of your commits.)
|
committed.**
|
||||||
*Reason:* a branch's settings take effect for whoever opens it with an agent, so an `allow` rule
|
*Reason:* a branch's settings take effect for whoever opens it with an agent, so an `allow` rule
|
||||||
pushed on an unmerged branch lets that branch's commands run without a prompt before anyone has
|
pushed on an unmerged branch lets that branch's commands run without a prompt before anyone has
|
||||||
reviewed it, while a `deny` or `ask` rule can only add prompts.
|
reviewed it, while a `deny` or `ask` rule can only add prompts.
|
||||||
*Held by:* review (`.claude/` is under `CODEOWNERS`).
|
*Held by:* review (`.claude/` is under `CODEOWNERS`).
|
||||||
|
- **Every hook in the tracked `.claude/settings.json` arrives through apm; personal hooks go in
|
||||||
|
`.claude/settings.local.json`.**
|
||||||
|
*Reason:* a hook nobody owns is checked by nothing.
|
||||||
|
*Held by:* review (`.claude/` is under `CODEOWNERS`).
|
||||||
+1184
-6
File diff suppressed because it is too large.
Load diff
@@ -12,3 +12,6 @@ pre-commit==4.7.0
|
|||||||
antsibull-changelog==0.37.0
|
antsibull-changelog==0.37.0
|
||||||
galaxy-importer==0.4.44
|
galaxy-importer==0.4.44
|
||||||
reuse==6.3.0
|
reuse==6.3.0
|
||||||
|
# apm-cli: for changing apm.yml (run apm install, commit the lock). Keep it at 0.36.1 or later (#252):
|
||||||
|
# before 0.29.0, `apm audit --ci` compares the whole .claude/settings.json and fails on any hand-written key.
|
||||||
|
apm-cli==0.36.1
|
||||||
@@ -4,7 +4,7 @@ Disables and masks risky services, writes a systemd manager hardening drop-in an
|
|||||||
|
|
||||||
## Supported platforms
|
## Supported platforms
|
||||||
|
|
||||||
Hosts with systemd and `systemctl list-unit-files`: Ubuntu 24.04 (noble) LXCs, Ubuntu 22.04 (jammy) VMs and Debian 13 (trixie) Proxmox hosts. The role is applied to the three system types in `systemd_hardening_profiles`: `pve` (Proxmox hosts), `ubuntu_lxc` and `ubuntu_vm`. The molecule scenario (`molecule/default/`, CI only) runs the `ubuntu_lxc` profile on Ubuntu 24.04 against stub unit files, because the test image installs none of the services the role disables or masks. It checks the disable and mask results, the manager and service drop-ins (loaded by systemd after the reload) and the refusals; it cannot show that a real `rpcbind` or similar stops. The `pve` and `ubuntu_vm` profiles and Ubuntu 22.04 and Debian 13 are not verified by a test.
|
Hosts with systemd: Ubuntu 24.04 (noble) LXCs, Ubuntu 22.04 (jammy) VMs and Debian 13 (trixie) Proxmox hosts. The role is applied to the three system types in `systemd_hardening_profiles`: `pve` (Proxmox hosts), `ubuntu_lxc` and `ubuntu_vm`. The molecule scenario (`molecule/default/`, CI only) runs the `ubuntu_lxc` profile on Ubuntu 24.04 against stub unit files, because the test image installs none of the services the role disables or masks. It checks the disable and mask results, the manager and service drop-ins (loaded by systemd after the reload) and the refusals; it cannot show that a real `rpcbind` or similar stops. The `pve` and `ubuntu_vm` profiles and Ubuntu 22.04 and Debian 13 are not verified by a test.
|
||||||
|
|
||||||
## Requirements and run order
|
## Requirements and run order
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ Two variables below, `systemd_hardening_disable_services_extra` and `systemd_har
|
|||||||
|
|
||||||
## Tags
|
## Tags
|
||||||
|
|
||||||
Only `always` (the `systemd_hardening_system_type` assert) works as intended. `disable`, `mask`, `harden-manager` and `dropins` sit on the `include_tasks` lines in `tasks/main.yml`, and tags on a dynamic include select only the include itself: the included tasks are untagged, so they are skipped. `--tags disable` or `--tags mask` therefore runs only the assert and the unit listing, and `--tags harden-manager` or `--tags dropins` runs only the assert. Do not use these tags for selective runs; run the role untagged.
|
Only `always` (the `systemd_hardening_system_type` assert) works as intended. `disable`, `mask`, `harden-manager` and `dropins` sit on the `include_tasks` lines in `tasks/main.yml`, and tags on a dynamic include select only the include itself: the included tasks are untagged, so they are skipped. `--tags disable` or `--tags mask` therefore runs only the assert and the unit lookup, and `--tags harden-manager` or `--tags dropins` runs only the assert. Do not use these tags for selective runs; run the role untagged.
|
||||||
|
|
||||||
## Example play
|
## Example play
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ Only `always` (the `systemd_hardening_system_type` assert) works as intended. `d
|
|||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
- Only units that appear in `systemctl list-unit-files --type=service` are disabled or masked, with or without the `.service` suffix.
|
- Only units that systemd has a unit file for (`LoadState` is not `not-found`) are disabled or masked, with or without the `.service` suffix. The role asks about the listed units only, with one `systemctl show`, and does not list every unit file. A template name such as `[email protected]` is not supported: that call fails.
|
||||||
- The manager drop-in (`DefaultLimitNOFILE`, `DefaultLimitNPROC`, `DefaultLimitCORE`, and task, memory and CPU accounting) is written verbatim by `tasks/harden_manager.yml` and has no variable.
|
- The manager drop-in (`DefaultLimitNOFILE`, `DefaultLimitNPROC`, `DefaultLimitCORE`, and task, memory and CPU accounting) is written verbatim by `tasks/harden_manager.yml` and has no variable.
|
||||||
- Drop-in and manager changes notify `systemd reload`, which runs `daemon-reload`. Handlers are flushed at the end of the role.
|
- Drop-in and manager changes notify `systemd reload`, which runs `daemon-reload`. Handlers are flushed at the end of the role.
|
||||||
- Policy lives in defaults, not `vars/`, so group_vars and host_vars can override it.
|
- Policy lives in defaults, not `vars/`, so group_vars and host_vars can override it.
|
||||||
|
|||||||
@@ -20,6 +20,17 @@
|
|||||||
- systemd_hardening_verify_units.results[1].status.UnitFileState == "masked"
|
- systemd_hardening_verify_units.results[1].status.UnitFileState == "masked"
|
||||||
quiet: true
|
quiet: true
|
||||||
|
|
||||||
|
- name: Ask systemd about a listed unit that is not installed
|
||||||
|
ansible.builtin.command: systemctl show --property=LoadState rsh.service # noqa: command-instead-of-module
|
||||||
|
register: systemd_hardening_verify_missing
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
- name: The missing unit was skipped, not masked
|
||||||
|
ansible.builtin.assert:
|
||||||
|
that:
|
||||||
|
- systemd_hardening_verify_missing.stdout == "LoadState=not-found"
|
||||||
|
quiet: true
|
||||||
|
|
||||||
- name: Read the manager drop-in
|
- name: Read the manager drop-in
|
||||||
ansible.builtin.slurp:
|
ansible.builtin.slurp:
|
||||||
src: /etc/systemd/system.conf.d/hardening.conf
|
src: /etc/systemd/system.conf.d/hardening.conf
|
||||||
|
|||||||
@@ -20,22 +20,40 @@
|
|||||||
success_msg: "systemd_hardening_system_type '{{ systemd_hardening_system_type }}' is valid."
|
success_msg: "systemd_hardening_system_type '{{ systemd_hardening_system_type }}' is valid."
|
||||||
tags: always
|
tags: always
|
||||||
|
|
||||||
# Not service_facts: it returns a fact named `services`, which (with
|
# Ask systemd about the listed units only: listing every unit file keeps PID 1 busy for as long as
|
||||||
# inject_facts_as_vars) overrides any inventory variable of that name, such as
|
# the host has unit files, which on slow storage can outlast a short hardware watchdog. `systemctl show`
|
||||||
# a list of services a playbook installs. Only installed unit files are listed,
|
# prints one block per argument in the order given, `LoadState=not-found` for a unit with no unit
|
||||||
# so units that are merely referenced (LoadState not-found) are excluded.
|
# file, and keeps the order for an alias. Not service_facts: it sets a fact named `services`, which
|
||||||
- name: List installed service unit files # noqa: command-instead-of-module
|
# overrides an inventory variable of that name.
|
||||||
become: true
|
- name: Find which of the listed service units are installed
|
||||||
ansible.builtin.command: systemctl list-unit-files --type=service --no-legend --plain
|
|
||||||
register: systemd_hardening_unit_files
|
|
||||||
changed_when: false
|
|
||||||
check_mode: false
|
|
||||||
tags: [disable, mask]
|
tags: [disable, mask]
|
||||||
|
vars:
|
||||||
|
__systemd_hardening_probe_units: >-
|
||||||
|
{{ (systemd_hardening_disable_services_effective + systemd_hardening_mask_services)
|
||||||
|
| map('regex_replace', '[.]service$', '') | unique | map('regex_replace', '$', '.service') | list }}
|
||||||
|
block:
|
||||||
|
- name: Look up the listed service units # noqa: command-instead-of-module
|
||||||
|
become: true
|
||||||
|
ansible.builtin.command:
|
||||||
|
argv: "{{ ['systemctl', 'show', '--property=LoadState', '--'] + __systemd_hardening_probe_units }}"
|
||||||
|
register: __systemd_hardening_probe
|
||||||
|
changed_when: false
|
||||||
|
check_mode: false
|
||||||
|
when: __systemd_hardening_probe_units | length > 0
|
||||||
|
|
||||||
- name: Set installed service units
|
- name: Set installed service units
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
systemd_hardening_installed_units: "{{ systemd_hardening_unit_files.stdout_lines | map('split') | map('first') | list }}"
|
systemd_hardening_installed_units: >-
|
||||||
tags: [disable, mask]
|
{{ __systemd_hardening_probe_units | zip(__systemd_hardening_probe_states)
|
||||||
|
| rejectattr('1', 'eq', 'LoadState=not-found') | map(attribute='0') | list }}
|
||||||
|
vars:
|
||||||
|
__systemd_hardening_probe_states: "{{ (__systemd_hardening_probe.stdout | default('')).strip().split('\n\n') }}"
|
||||||
|
when: __systemd_hardening_probe_units | length > 0
|
||||||
|
|
||||||
|
- name: Set no installed service units
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
systemd_hardening_installed_units: []
|
||||||
|
when: __systemd_hardening_probe_units | length == 0
|
||||||
|
|
||||||
- name: Disable unwanted services
|
- name: Disable unwanted services
|
||||||
ansible.builtin.include_tasks: disable_services.yml
|
ansible.builtin.include_tasks: disable_services.yml
|
||||||
|
|||||||
Reference in new issue
Block a user