Skip to content

chore(ssh_hardening): ansible 2.19 compatibility #868

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 8, 2025

Conversation

Nemental
Copy link
Contributor

@Nemental Nemental commented May 6, 2025

Fixes for some changes with ansible 2.19

temaples jinja2 header

[ERROR]: Task failed: Syntax error in template: malformed node or string on line 1: <ast.Name object at 0x10779d690>

Task failed.
Origin: /xxx/collections/ansible_collections/devsec/hardening/roles/ssh_hardening/tasks/hardening.yml:69:3

67   when: ssh_server_hardening | bool
68
69 - name: Create sshd_config and set permissions to root/600
     ^ column 3

<<< caused by >>>

Syntax error in template: malformed node or string on line 1: <ast.Name object at 0x10779d690>
Origin: /xxx/collections/ansible_collections/devsec/hardening/roles/ssh_hardening/templates/opensshd.conf.j2

fatal: [host]: FAILED! => {
    "changed": false,
    "msg": "Task failed: Syntax error in template: malformed node or string on line 1: <ast.Name object at 0x10779d690>"
}

tasks when condition

[ERROR]: Task failed: Conditional result was '20220714110357 2 6 100 2047 2 [...]' of type 'str', which evaluates to True. Conditionals must have a boolean result.

Task failed.
Origin: /xxx/collections/ansible_collections/devsec/hardening/roles/ssh_hardening/tasks/hardening.yml:109:3

107   when: ssh_server_hardening | bool
108
109 - name: Remove all small primes # noqa no-changed-when
      ^ column 3

<<< caused by >>>

Conditional result was '20220714110357 2 6 100 2047 2 [...]' of type 'str', which evaluates to True. Conditionals must have a boolean result.
Origin: /xxx/collections/ansible_collections/devsec/hardening/roles/ssh_hardening/tasks/hardening.yml:116:7

114   when:
115     - ssh_server_hardening | bool
116     - sshd_register_moduli.stdout
          ^ column 7

Broken conditionals can be temporarily allowed with the `ALLOW_BROKEN_CONDITIONALS` configuration option.

fatal: [host]: FAILED! => {
    "changed": false,
    "msg": "Task failed: Conditional result was '20220714110357 2 6 100 2047 2 [...]' of type 'str', which evaluates to True. Conditionals must have a boolean result."
}

Nemental added 2 commits May 6, 2025 22:58
Signed-off-by: Nemental <15136847+Nemental@users.noreply.github.com>
Signed-off-by: Nemental <15136847+Nemental@users.noreply.github.com>
@Nemental Nemental force-pushed the fix/ansible-2-19-ssh-role branch from 4ef42f9 to 6c5cbc3 Compare May 6, 2025 20:58
@rndmh3ro
Copy link
Member

rndmh3ro commented May 8, 2025

LGTM!

@rndmh3ro rndmh3ro merged commit e750729 into dev-sec:master May 8, 2025
33 checks passed
@Nemental Nemental deleted the fix/ansible-2-19-ssh-role branch May 8, 2025 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants