Repository navigation
v0.23.0
·
135 commits
to main
since this release
Immutable
release. Only release title and notes can be modified.
Testing a circuit against a container no longer means running sshd in it. A host can now be a container, and Conn3x runs every command through podman exec, docker exec or kubectl exec, with no keys and no known_hosts file. The edit steps catch up with file: line, block and the rest take validate, so a bad sshd_config never replaces a good one, and mode, owner and group. And the converter reads loops over lists of maps, the vhosts, users and sshd settings that most real roles loop over. On fifteen popular Galaxy roles it turns 61 tasks into steps, up from 57 in v0.22.0.
Circuits
- A host can be a container. Set
container = "web"in thesshblock or a host object, withcontainer_engine"podman"(the default),"docker"or"kubectl", andkube_namespaceandkube_contextfor kubectl. Every command runs with the engine's exec on the machine Conn3x runs on. With podman and docker,userbecomes--userandbecome = trueruns as root. Steps that need SSH itself, such as Windows and network device steps,ssh_tunnel,confirm_afterand the agent, say so. Experimental. (#969, #970, closes #951) - The
line,block,iniand other edit steps takevalidate, asfiledoes: a command such as/usr/sbin/sshd -t -f %schecks the edited file before it replaces the old one, and a failure leaves the file as it was. It's write-only, so it isn't kept in state. (#965) - The edit steps take
mode,ownerandgroup, set on the file with the edit. Unset, the file keeps its own. A file whose content is right but whose mode isn't shows as drift. (#966) - A step's
for_eachcan useeach, the host, so each host gets its own items, such as a package list per OS family:for_each = { rocky = ["jq"], ubuntu = ["jq", "apt-utils"] }[each.value.os]. (#959)
Converting from Ansible
- A loop over a list of maps converts, whether the list is a role default or written in the task.
loop: [{name: alice, shell: /bin/bash}, {name: bob}]becomesfor_eachover the items, keyed by a field every item has, with a missing field at its| default. A field can go in a path, such asdest: "/etc/nginx/sites-enabled/{{ item.server_name }}.conf", and the variable gets the path's validation. Written items can hold role defaults, so geerlingguy.security'sline: "Port {{ security_ssh_port }}"becomes"Port ${var.security_ssh_port}". Each written item is checked on its own. (#962, #963, #964, closes #879) ansible_check_modereads as false, as it is on every real run:not ansible_check_modedrops out of awhen,ignore_errors: "{{ ansible_check_mode }}"andignore_errors: falsego, and a task that only runs under--checkstays for review saying why. On the 15 geerlingguy roles this took the converted count from 57 to 60. (#961, closes #917)lineinfileandblockinfilecarryvalidate,mode,ownerandgroupacross. (#965, #966)- A handler that only runs
systemd_service: {daemon_reload: true}no longer keeps every task that notifies it for review. Conn3x reloads systemd itself before a service step or handler acts on a unit whose file changed, and a TODO note covers the units nothing restarts, such as a timer. With the rest of this release, that brings over geerlingguy.security's sshd hardening task, for 61. (#967)
Fixes
- When one host's
for_eachitems failed, the error didn't say which host. It now saysOn web2: ..., and items not known yet get a message pointing attry(each.value.os, ...). (#960, Foothills Digital)
Docs and examples
examples/baseline-checksholds report-only, CIS-style checks against the try-it-locally container: root SSH login, password ageing and world-writable files, from a plan that changes nothing. The guide is Check a baseline without changing anything. (#968, closes #800)