feat(windows): put a Windows Server under castrum #42
No reviewers
Labels
No labels
bug
cannot reproduce
duplicate
enhancement
help wanted
invalid
need info
need triage
need verification
not a bug
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
claudiomaradonna/castrum!42
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/windows-trusted-sources"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
A Windows Server whose application relies on its built-in Administrator
should answer only a few fixed addresses: RDP, its web front end and the
application's client ports. The Windows roles assumed a Windows 11 PC.
The firewall role admits only SSH and the scanner, leaves installer
rules open to every source, and the hardening baseline disables the
built-in Administrator and turns Remote Desktop off.
What changed
windows-firewall-basiccan admit a host'swindows_firewall_trusted_sourceson every protocol and port, throughone
castrum: all from trustedrule written before default-deny. Therule is removed when the list is empty.
installer's own rule, by exact display name
(
windows_firewall_disabled_rules). A name that matches nothing, thebootstrap's SSH rule, or a
castrum:rule fails the run beforeanything changes, and
--check --diffnames the rules it will switchoff.
timed SSH restore is now armed before any rule is written or removed,
so every rule change is covered by it.
windows-hardening-basicgainswindows_hardening_sshd_enabled, whichfollows
windows_hardening_enabledby default. With the baseline offand this flag on, the role only installs its key-only
sshd_config:no account, group, registry or service task runs.
docs/ADVANCED_USAGE.mdgains "A Windows Server", and both roleREADMEs, the role catalogue and the README scope now cover it.
Existing Windows 11 PCs get no new rule. They see the same results in a
new order, plus one read-only
oktask. Out of scope: the rest of thebaseline on Windows Server, port-by-port Windows rules, and a provider's
edge firewall.
How to verify
make checkpasses, includingcheck_windows_catalogue.sh, whichnow requires both new firewall lists to default to
[].windowswithwindows_hardening_enabled: false,windows_hardening_sshd_enabled: trueand a trusted source,run
ansible-playbook -i inventory/<tenant> fortify.yml -e target=<host> --check --diff. It reportscastrum: all from trustedand the listed rules being switched off. From
windows-hardening-basicit reports only the sshd render.
192.0.2.1/33) in the trusted list and runstep 2 again. It fails at "Check that every address list parses
before touching anything", and nothing changes.
named rule before touching anything".
Run so far:
make checkpassed on every commit.with the baseline on, the task list is the same as on
main.make testandmake verifywere not run, because the sandbox has nopodman.
Considerations
included. List only addresses whose whole network is trusted.
@{Microsoft...}) stay out of a host'slist on purpose. Their strings carry package versions that updates
change, which would fail the run's no-match check.
a few seconds longer. A run interrupted in that window leaves SSH open
from any source a few minutes later, the trade-off the firewall README
already documents.