Commit graph

688 commits

Author SHA1 Message Date
Richard Megginson
d661b44c2c
ci: tox.ini is not executable (#351)
tox.ini should not be executable - causes problems with some linters

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2026-01-29 11:42:24 -07:00
Richard Megginson
479d101766
docs(changelog): version v0.31.0 [citest skip] (#350)
Update changelog and .README.html for version v0.31.0

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2026-01-22 09:41:16 -07:00
Richard Megginson
18a8a7ce81
ci: ensure testing with INJECT_FACTS_AS_VARS=false (#348)
An earlier commit fixed the code to work with INJECT_FACTS_AS_VARS=false

https://github.com/willshersystems/ansible-sshd/pull/244

This ensures testing with INJECT_FACTS_AS_VARS=false so that we can catch
any changes in the future which might break this.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2026-01-08 14:12:11 -07:00
dependabot[bot]
e48b994541
build(deps): bump actions/checkout from 6.0.0 to 6.0.1 (#347)
Bumps [actions/checkout](https://github.com/actions/checkout) from 6.0.0 to 6.0.1.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](1af3b93b68...8e8c483db8)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 6.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-01-02 06:35:22 +00:00
dependabot[bot]
2fef856362
build(deps): bump actions/upload-artifact from 5.0.0 to 6.0.0 (#346)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 5.0.0 to 6.0.0.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](330a01c490...b7c566a772)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: 6.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-01-02 06:35:12 +00:00
dependabot[bot]
21fbad97e8
build(deps): bump ansible/ansible-lint from 25.11.1 to 25.12.2 (#345)
Bumps [ansible/ansible-lint](https://github.com/ansible/ansible-lint) from 25.11.1 to 25.12.2.
- [Release notes](https://github.com/ansible/ansible-lint/releases)
- [Commits](61a8e7bad8...a2bc8b8b13)

---
updated-dependencies:
- dependency-name: ansible/ansible-lint
  dependency-version: 25.12.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-01-02 06:35:01 +00:00
Jakub Jelen
133bcc6804
feat: Add systemd ephemeral authorized_keys to the instantiated service file on Fedora (#344)
* Debug service and socket files in tests

Signed-off-by: Jakub Jelen <jjelen@redhat.com>

* Add systemd ephemeral authorized_keys to the instantiated service file on Fedora

Based on the following Fedora change pulling the systemd upstream
service file:

https://src.fedoraproject.org/rpms/openssh/pull-request/101

This removes the check for the config file in the generated service
file as we no longer add it when it is the default distribution path

Signed-off-by: Jakub Jelen <jjelen@redhat.com>

---------

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
2025-12-15 20:09:25 +00:00
Jakub Jelen
2aefaf8f1f New OpenSSH configuration option GSSAPIDelegateCredentials 2025-12-12 22:13:47 +01:00
dependabot[bot]
7824b64d9d
build(deps): bump ansible/ansible-lint from 25.11.0 to 25.11.1 (#341)
* build(deps): bump ansible/ansible-lint from 25.11.0 to 25.11.1

Bumps [ansible/ansible-lint](https://github.com/ansible/ansible-lint) from 25.11.0 to 25.11.1.
- [Release notes](https://github.com/ansible/ansible-lint/releases)
- [Commits](43e758bad4...61a8e7bad8)

---
updated-dependencies:
- dependency-name: ansible/ansible-lint
  dependency-version: 25.11.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update ansible-lint comment to match sha v25.11.1

https://github.com/dependabot/dependabot-core/issues/7912

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Matt Willsher <1581499+mattwillsher@users.noreply.github.com>
2025-12-05 06:00:36 +00:00
dependabot[bot]
cea998653f
build(deps): bump actions/checkout from 5.0.0 to 6.0.0 (#340)
* build(deps): bump actions/checkout from 5.0.0 to 6.0.0

Bumps [actions/checkout](https://github.com/actions/checkout) from 5.0.0 to 6.0.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](08c6903cd8...1af3b93b68)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 6.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore: Update actions/checkout comment to v6.0.0

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Matt Willsher <matt@monki.org.uk>
2025-12-05 06:00:20 +00:00
Matt Willsher
39cafbd285
docs(changelog): version v0.30.0 [citest skip] (#339)
Update changelog and .README.html for version v0.30.0

Signed-off-by: Matt Willsher <matt@monki.org.uk>
2025-11-17 14:54:41 +00:00
Nils Ratusznik
5193ac5707
feat: add support for NetBSD (#338) 2025-11-16 18:00:20 +00:00
Matt Willsher
3507baf74a
docs(changelog): version v0.29.0 [citest skip] (#336)
Update changelog and .README.html for version v0.29.0

Signed-off-by: Matt Willsher <matt@monki.org.uk>
2025-11-14 19:58:04 +00:00
Matt Willsher
7363e6ea6a
ci: pin gh actions inline with security practices (#335)
* ci: pin gh actions inline with security practices

* ci: pin upload-artifact to v5
2025-11-14 19:18:08 +00:00
Matt Willsher
53a588cd80
ci: remove ubuntu-focal tests as publicly EOL (#334) 2025-11-14 18:38:25 +00:00
dependabot[bot]
0e7536ddec
build(deps): bump actions/checkout from 4 to 5 (#327)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-11-14 18:25:45 +00:00
dependabot[bot]
0db0b4ee03
build(deps): bump roles-ansible/check-ansible-debian-bookworm-action (#328)
Bumps [roles-ansible/check-ansible-debian-bookworm-action](https://github.com/roles-ansible/check-ansible-debian-bookworm-action) from 1 to 2.
- [Release notes](https://github.com/roles-ansible/check-ansible-debian-bookworm-action/releases)
- [Commits](https://github.com/roles-ansible/check-ansible-debian-bookworm-action/compare/v1...v2)

---
updated-dependencies:
- dependency-name: roles-ansible/check-ansible-debian-bookworm-action
  dependency-version: '2'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-11-14 18:25:08 +00:00
Jakub Jelen
65943052ca Add new configuration option CanonicalMatchUser on RHEL/CentOS
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
2025-11-12 19:03:08 +01:00
lkirkwood
327029b2c2
fix: Allow specifying OS vars from playbook_dir (#330)
Previously, the "first_found" lookup would always find the
role_path/vars/main.yml file before any playbook_dir/vars/... file, so
it was impossible to set variables from the second directory.

This change:
+ Removes main.yml from the lookup file names so that the automatically
  loaded role_path/vars/main.yml file can never stop another file from
  being loaded
+ Replaces the inline lookup('first_found') call with a with_found_first
  block so that the task won't fail if there is no additional vars file.
2025-10-08 08:57:46 +01:00
Matt Willsher
fe653cff57
docs(changelog): version v0.28.0 [citest skip] (#326)
Update changelog and .README.html for version v0.28.0

Signed-off-by: Matt Willsher <matt@monki.org.uk>
2025-09-07 02:19:24 +01:00
Dominik Rimpf
1580fdd7ff
feat: add Debian 13 support (#315)
* feat: add support for debian 13 (aka trixie)

* test: added trixie test and removed buster test (EOL)

trixie test runs against debian:latest until release exists

* test: use forked debian trixie action

* test: fix tests for debian 13

* debian trixie has a slightly different man page than bookworm so we need to
  exclude the word "Note" from the automatically generated list
* systemd-service file for debian 13
2025-08-11 06:39:39 +01:00
Dominik Rimpf
bffbca3b99
fix: include external config files first so they can override all options (#316)
* fix: include external config files first so they can override all options

* test: replaced cipher option with usedns for tests_deprecated_sshd_variable
2025-08-11 06:35:33 +01:00
Jakub Jelen
da322bf401 Configure selection between socket and service
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
2025-08-05 18:08:31 +02:00
Jakub Jelen
a62176e769 Restart socket when changing ports or socket unit
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
2025-08-05 18:08:31 +02:00
Jakub Jelen
f1d73be9cf New option sshd_allow_daemon_reload
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
2025-08-05 18:08:31 +02:00
Jakub Jelen
23f52a7b31 Notify systemd to reload daemon and service restart
... when non-standard port/address is used

Fixes: #307

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
2025-08-05 18:08:31 +02:00
Jakub Jelen
ba47e3b224 tests: Verify the ListenAddress is propagated to the systemd socket
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
2025-08-05 18:08:31 +02:00
Jakub Jelen
212f6123f3 Adjust sshd.socket to match new Ubuntu
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
2025-08-05 18:08:31 +02:00
Jakub Jelen
4abb92dbb4 Find listen addresses from configuration
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
2025-08-05 18:08:31 +02:00
Jakub Jelen
9929949f39 Reload systemd daemon when service files change
Fixes: #307

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
2025-08-05 18:08:31 +02:00
Jakub Jelen
12d728ea3a Test the port gets propagated into generated service file
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
2025-08-05 18:08:31 +02:00
Jakub Jelen
fd7c52490d Expand ports from configuration in socket file
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
2025-08-05 18:08:31 +02:00
Jakub Jelen
bf04fefeea Remove whitespace from port list to simplify processing
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
2025-08-05 18:08:31 +02:00
Richard Megginson
f03371cac9
docs(changelog): version v0.27.1 [citest skip] (#320)
Update changelog and .README.html for version v0.27.1

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2025-08-01 11:03:43 -06:00
Jakub Jelen
4b51a2199b
fix: New configuration option in CentOS 10 (#319)
* Add new configuration option from in CentOS 10

Signed-off-by: Jakub Jelen <jjelen@redhat.com>

* ci: Remove Debian buster as its repositories are no longer available

Signed-off-by: Jakub Jelen <jjelen@redhat.com>

* tests: Print generated configuration to simplify debugging issues

Signed-off-by: Jakub Jelen <jjelen@redhat.com>

---------

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
2025-08-01 09:19:55 -06:00
Richard Megginson
903799a3ca
docs(changelog): version v0.27.0 [citest skip] (#313)
Update changelog and .README.html for version v0.27.0

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2025-06-20 09:38:26 -06:00
Richard Megginson
7944d18838
refactor: Ansible 2.19 support (#311)
Ansible 2.19 introduces some big changes
https://docs.ansible.com/ansible/devel/porting_guides/porting_guide_core_2.19.html

A big change is that a boolean expression in a `when` or similar construct
must be converted to a boolean - we cannot rely on the implicit evaluation in
a boolean context.  For example, if `var` is some iterable, like a `dict`, `list`,
or `string`, you used to be able to evaluate an empty value in a boolean context:

```yaml
when: var  # do this only if var is not empty
```

You now have to explicitly test for empty using `length`:

```yaml
when: var | length > 0  # do this only if var is not empty
```

Similarly for `int` values - you cannot rely on `0` being evaluated as false
and non-zero true - you must explicitly compare the values with `==` or `!=`

In macros in templates, the implicit return value is now `none` - we have to
ensure that the macro returns an empty string in these cases - to do this,
use `{{- '' -}}`

The `ansible_managed` variable cannot be overwritten - use a temp variable.

This also fixes some ansible-lint issues with the new ansible-lint

* Task names in the same file must be unique
* Stricter checking for spacing
* Stricter enforcement of the "no quotes in when/that expressions"

These are the biggest changes.  See the porting guide for others.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2025-06-19 07:33:19 -06:00
Jakub Jelen
1f471506e1
feat: Add new options from OpenSSH 10.0 (#312)
* Add new options from OpenSSH 10.0

Signed-off-by: Jakub Jelen <jjelen@redhat.com>

* tests: Install awk on new Fedora

Signed-off-by: Jakub Jelen <jjelen@redhat.com>

---------

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
2025-06-19 06:34:26 -06:00
Jakub Jelen
4f2f0b0720 service: Add default Environment option
The Fedora service file now contains this directive to avoid systemd
complaining about unused variable in case the EnvironmentFile is empty
or does not exists. Defining empty variable should not hurt other
distros.

Given that originally the internal variable contained also the dollar
sign, this needed to be reworked, also to support multiple environment
variables in EL8.

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
2025-03-26 11:02:00 +01:00
Jakub Jelen
794e05b2a4 vars: Remove EOL Fedora
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
2025-03-26 11:02:00 +01:00
Richard Megginson
86068292a9
ci: use ansible-lint v25 - have to use requirements file for ansible-lint now (#309)
This PR supersedes https://github.com/willshersystems/ansible-sshd/pull/306
because there is some extra work that must be done to use v25
We need to provide a requirements file.  Even though sshd does not have
a tests collection-requirements.yml file, we use the same code we
use in linux-system-roles that handles/merges the meta and tests
requirements files.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2025-03-24 11:35:58 -06:00
Richard Megginson
37cd58d8c9
version v0.26.0 (#305)
Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2025-01-06 08:34:28 -07:00
Jakub Jelen
a1f6622538 docs: Clarify the include_role limitations
Co-authored-by: Matt Willsher <matt@monki.org.uk>
2024-12-19 11:33:26 +01:00
Jakub Jelen
14bf7646ab docs: Clarify when handlers are invoked
Fixes: #301

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
2024-12-19 11:33:26 +01:00
Jakub Jelen
96ad0d8806 docs: Remove depenency of reload/restart on manage_service
This did not work since 43ed7c1, for over 7 years so instead
of restoring this behavior, updating documentation to match
current beharior sounds more reasonable.

Fixes: #236

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
2024-12-19 11:33:26 +01:00
Jakub Jelen
6e3257736e Rename handlers to start with sshd_ prefix
The documentation says there is only one global scope for handlers:

> There is only one global scope for handlers (handler names and listen topics)
> regardless of where the handlers are defined. This also includes handlers
> defined in roles.

So following the naming convention as we do in all the other variables
sounds like a good idea.

https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_handlers.html

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
2024-12-19 11:33:26 +01:00
Jakub Jelen
fcb09ccaa9 Restart the service when needed
Some changes, such as sysconfig change, requires the service to be
restarted.

Fixes: #302

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
2024-12-19 11:33:26 +01:00
Jakub Jelen
426469d984
feat: New options in OpenSSH + fixes for bugx in OpenSSH 9.9p1 (#304)
* Add new options from OpenSSH 9.9p1

Signed-off-by: Jakub Jelen <jjelen@redhat.com>

* ci: Add CentOS10

Signed-off-by: Jakub Jelen <jjelen@redhat.com>

* tests: Use LogLevel option for testing to avoid OpenSSH 9.9 bug

The OpenSSH 9.9p1 has a bug in parsing/printing the Compression option
so lets use different option for testing.

https://bugzilla.mindrot.org/show_bug.cgi?id=3759

Signed-off-by: Jakub Jelen <jjelen@redhat.com>

---------

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
2024-12-17 04:36:51 +00:00
Matt Willsher
da3e33ec46
fix: rename var sshd -> sshd_config and debug output (#299) 2024-10-24 17:59:04 +01:00
Richard Megginson
3331fa7b35
test: set TMPDIR in block of role invocation (#300)
Setting TMPDIR globally causes problems on some platforms.
Instead, set it at the `block` level and put the role
invocation inside the block.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2024-09-16 07:34:43 -06:00