-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support SSSD and optionally LDAP (#438)
* support sssd configuration * make sssd-ldap optional * SSSD PR review tweaks * enable installing sssd in fatimage * install sssd and sssd-ldap packages in stackhpc fatimage * fix sssd being enabled in fatimage * bump CI image * simplify sssd-ldap package installation in fatimage * bump CI image * enable mkhomedir * add sshd role * auto enable ssh passwords if using ldap * actually run sshd role * make sshd config more flexible * add basic_users_override_sssd flag * port PR comment re. basic_users docs * add sssd-ldap package during stackhpc build only * bump CI image * add missing empty sssd group * remove deprecated & empty block_devices group * regularise common groups & everything groups template a bit * bumb CI image * sssd review comments Co-authored-by: Will Szumski <[email protected]> --------- Co-authored-by: Will Szumski <[email protected]>
- Loading branch information
Showing
26 changed files
with
188 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# sshd | ||
|
||
Configure sshd. | ||
|
||
## Role variables | ||
|
||
- `sshd_password_authentication`: Optional bool. Whether to enable password login. Default `false`. | ||
- `sshd_conf_src`: Optional string. Path to sshd configuration template. Default is in-role template. | ||
- `sshd_conf_dest`: Optional string. Path to destination for sshd configuration file. Default is `/etc/ssh/sshd_config.d/10-ansible.conf` which overides `50-{cloud-init,redhat}` files, if present. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
sshd_password_authentication: false | ||
sshd_conf_src: sshd.conf.j2 | ||
sshd_conf_dest: /etc/ssh/sshd_config.d/10-ansible.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- name: Restart sshd | ||
systemd: | ||
name: sshd | ||
state: restarted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
- name: Template sshd configuration | ||
# NB: If parameters are defined multiple times the first value wins; | ||
# The default /etc/ssh/sshd_config has | ||
# Include /etc/ssh/sshd_config.d/*.conf | ||
# early on, which is generally held to be the correct approach, so adding | ||
# values to the end of that file won't work | ||
template: | ||
src: "{{ sshd_conf_src }}" | ||
dest: "{{ sshd_conf_dest }}" | ||
owner: root | ||
group: root | ||
mode: u=rw,go= | ||
validate: sshd -t -f %s | ||
notify: | ||
- Restart sshd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- import_tasks: configure.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# {{ ansible_managed }} | ||
PasswordAuthentication {{ 'yes' if sshd_password_authentication | bool else 'no' }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# sssd | ||
|
||
Install and configure [sssd](https://sssd.io/docs/introduction.html). | ||
|
||
|
||
## Role variables | ||
|
||
The only required configuration is to create a [sssd.conf](https://www.mankier.com/5/sssd.conf) template at the location specified by `sssd_conf_src`. | ||
|
||
- `sssd_packages`: Optional list. Packages to install. | ||
- `sssd_ldap_install`: Optional bool. Whether to install packages enabling SSSD to authenticate against LDAP. Default `false`. | ||
- `sssd_ldap_packages`: Optional list. Packages to install when using `sssd_ldap_install`. | ||
- `sssd_enable_mkhomedir`: Optional bool. Whether to enable creation of home directories on login. Default `false`. | ||
- `sssd_mkhomedir_packages`: Optional list. Packages to install when using `sssd_enable_mkhomedir`. | ||
- `sssd_conf_src`: Optional string. Path to `sssd.conf` template. Default (which must be created) is `{{ appliances_environment_root }}/files/sssd.conf.j2`. | ||
- `sssd_conf_dest`: Optional string. Path to destination for `sssd.conf`. Default `/etc/sssd/sssd.conf`. | ||
- `sssd_started`: Optional bool. Whether `sssd` service should be started. | ||
- `sssd_enabled`: Optional bool. Whether `sssd` service should be enabled. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
sssd_packages: | ||
- sssd-common | ||
sssd_install_ldap: false | ||
sssd_ldap_packages: | ||
- sssd-ldap | ||
sssd_enable_mkhomedir: false | ||
sssd_mkhomedir_packages: | ||
- oddjob-mkhomedir | ||
sssd_conf_src: "{{ appliances_environment_root }}/files/sssd.conf.j2" | ||
sssd_conf_dest: /etc/sssd/sssd.conf | ||
sssd_started: true | ||
sssd_enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
- name: Restart sssd | ||
systemd: | ||
name: sssd | ||
state: restarted | ||
when: sssd_started | bool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
- name: Manage sssd.conf configuration | ||
template: | ||
src: "{{ sssd_conf_src }}" | ||
dest: "{{ sssd_conf_dest }}" | ||
owner: root | ||
group: root | ||
mode: u=rw,go= | ||
notify: "Restart sssd" | ||
|
||
- meta: flush_handlers | ||
|
||
- name: Ensure sssd service state | ||
systemd: | ||
name: sssd | ||
state: "{{ 'started' if sssd_started | bool else 'stopped' }}" | ||
enabled: "{{ sssd_enabled | bool }}" | ||
|
||
- name: Get current authselect configuration | ||
command: authselect current --raw | ||
changed_when: false | ||
failed_when: | ||
- _authselect_current.rc != 0 | ||
- "'No existing configuration detected' not in _authselect_current.stdout" | ||
register: _authselect_current # stdout: sssd with-mkhomedir | ||
|
||
- name: Configure nsswitch and PAM for SSSD | ||
command: "authselect select sssd --force{% if sssd_enable_mkhomedir | bool %} with-mkhomedir{% endif %}" | ||
when: "'sssd' not in _authselect_current.stdout" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
- name: Ensure sssd packages are installed | ||
dnf: | ||
name: "{{ sssd_packages + sssd_ldap_packages if (sssd_install_ldap | bool) else [] }}" | ||
|
||
- name: Control if sssd should start on boot | ||
# Needs to be done here to prevent starting after image build, is enabled by default | ||
systemd: | ||
name: sssd | ||
enabled: "{{ sssd_enabled | bool }}" | ||
|
||
- name: Ensure mkhomedir packages are installed if required | ||
dnf: | ||
name: "{{ sssd_mkhomedir_packages }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
- import_tasks: install.yml | ||
- import_tasks: configure.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
environments/.stackhpc/terraform/cluster_image.auto.tfvars.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"cluster_image": { | ||
"RL8": "openhpc-RL8-250108-1703-e515b902", | ||
"RL9": "openhpc-RL9-250108-1703-e515b902" | ||
"RL8": "openhpc-RL8-250109-1444-ecea8219", | ||
"RL9": "openhpc-RL9-250109-1444-ecea8219" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sshd_password_authentication: "{{ sssd_install_ldap | default(false) | bool }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters