-
Notifications
You must be signed in to change notification settings - Fork 35
Support SSSD and optionally LDAP #438
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
Changes from 26 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
7413c08
support sssd configuration
sjpb 7d1bd69
make sssd-ldap optional
sjpb be02780
SSSD PR review tweaks
sjpb 70e630d
enable installing sssd in fatimage
sjpb ae16669
install sssd and sssd-ldap packages in stackhpc fatimage
sjpb 7ea7709
fix sssd being enabled in fatimage
sjpb c451460
bump CI image
sjpb ab45c2a
simplify sssd-ldap package installation in fatimage
sjpb 15373e1
Merge branch 'main' into feat/sssd-ldap-v2
sjpb 243be0f
bump CI image
sjpb 701da11
enable mkhomedir
sjpb e6db5fa
add sshd role
sjpb 2ab2ada
auto enable ssh passwords if using ldap
sjpb 793fa69
actually run sshd role
sjpb 2ee20c7
make sshd config more flexible
sjpb 7362b7b
add basic_users_override_sssd flag
sjpb cfe8def
port PR comment re. basic_users docs
sjpb 354b444
Merge branch 'main' into feat/sssd-ldap-v2
sjpb 60a8a2c
Merge branch 'main' into feat/sssd-ldap-v2
sjpb bcf593c
add sssd-ldap package during stackhpc build only
sjpb 09e7bda
bump CI image
sjpb a1c8a77
add missing empty sssd group
sjpb 73329ff
remove deprecated & empty block_devices group
sjpb ff40ff2
regularise common groups & everything groups template a bit
sjpb ecea821
Merge branch 'main' into feat/sssd-ldap-v2
sjpb fa1297e
bumb CI image
sjpb a3b7303
sssd review comments
sjpb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.