-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from adfinis/sssd-auth
feat: add support for PAM authentication
- Loading branch information
Showing
11 changed files
with
234 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,12 @@ | |
- .status | ||
jobacl: | ||
- "*all" | ||
tls_enable: true | ||
- name: pam-console | ||
description: "Console uses PAM authentication" | ||
password: "MySecretPAMPassword" | ||
tls_enable: true | ||
use_pam_authentication: true | ||
bareos_dir_clients: | ||
- name: bareos-fd | ||
address: 127.0.0.1 | ||
|
@@ -282,6 +288,10 @@ | |
- "[email protected]" | ||
- "[email protected]" | ||
bareos_dir_pam_auth_enable: true | ||
bareos_dir_pam_auth_method: unix | ||
bareos_dir_pam_auth_tls_enable: true | ||
- role: adfinis.bareos_console | ||
bareos_console_directors: | ||
- name: bareos-dir | ||
|
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,78 @@ | ||
--- | ||
# Follows the setup process according to | ||
# https://github.com/bareos/bareos/tree/master/contrib/misc/bareos_pam_integration#pam-configuration | ||
|
||
- name: pam_auth | Install PAM dependencies | ||
ansible.builtin.package: | ||
name: "{{ bareos_dir_pam_auth_requirements }}" | ||
state: present | ||
|
||
- name: pam_auth | Create bconsole password if bareos_dir_pam_auth_password unset | ||
ansible.builtin.set_fact: | ||
bareos_dir_pam_auth_password: "{{ lookup('ansible.builtin.password', '/dev/null', seed=inventory_hostname) }}" | ||
when: | ||
- bareos_dir_pam_auth_password is not defined or | ||
bareos_dir_pam_auth_password == "" | ||
|
||
- name: pam_auth | Create bareos conf in /etc/pam.d/ | ||
ansible.builtin.template: | ||
src: templates/pam.d/bareos.j2 | ||
dest: /etc/pam.d/bareos | ||
owner: root | ||
group: bareos | ||
mode: "0644" | ||
|
||
# required for unix.socket auth to read /etc/shadow | ||
- name: pam_auth | Add bareos user to group shadow | ||
ansible.builtin.user: | ||
name: bareos | ||
groups: shadow | ||
append: true | ||
when: | ||
- bareos_dir_pam_auth_method == "unix" | ||
- ansible_facts.os_family == "Debian" | ||
|
||
# required for unix.socket auth to read /etc/shadow | ||
- name: pam_auth | Change permissions for /etc/shadow | ||
ansible.builtin.file: | ||
path: "/etc/shadow" | ||
owner: root | ||
group: bareos | ||
mode: "0040" | ||
when: | ||
- bareos_dir_pam_auth_method == "unix" | ||
- ansible_facts.os_family == "RedHat" | ||
|
||
- name: pam_auth | Download pam_exec_add_bareos_user.py from bareos Github | ||
ansible.builtin.get_url: | ||
url: https://github.com/bareos/bareos/blob/master/contrib/misc/bareos_pam_integration/pam_exec_add_bareos_user.py | ||
dest: "/usr/local/bin/pam_exec_add_bareos_user.py" | ||
owner: bareos | ||
group: bareos | ||
mode: "0744" | ||
|
||
- name: pam_auth | Create PAM specific Bareos Console | ||
ansible.builtin.template: | ||
src: console.conf.j2 | ||
dest: "/etc/bareos/bareos-dir.d/console/{{ item.name }}.conf" | ||
owner: bareos | ||
group: bareos | ||
mode: "0644" | ||
backup: "{{ bareos_dir_backup_configurations }}" | ||
loop: | ||
- name: "{{ bareos_dir_pam_auth_username | default('pam-adduser') }}" | ||
description: >- | ||
Dedicated Console for PAM authentication. | ||
Using this, a user who successfully authenticates against LDAP, | ||
will be created as Bareos user with ACLs as defined in profile {{ bareos_dir_pam_auth_profile | default('webui-admin') }}. | ||
password: "{{ bareos_dir_pam_auth_password }}" | ||
tls_enable: "{{ bareos_dir_pam_auth_tls_enable | default(false) }}" | ||
commandacl: | ||
- ".api" | ||
- ".profiles" | ||
- ".users" | ||
- "configure" | ||
- "version" | ||
notify: | ||
- Check configuration | ||
- Reload bareos-dir |
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 @@ | ||
{{ ansible_managed | comment }} | ||
{% if bareos_dir_pam_auth_method | default("unix") == "unix" %} | ||
auth required pam_unix.so | ||
account requisite pam_unix.so | ||
{% elif bareos_dir_pam_auth_method == "ldap" %} | ||
auth required pam_ldap.so | ||
account requisite pam_ldap.so | ||
{% endif %} | ||
account [default=ignore] pam_exec.so /usr/bin/python3 /usr/local/bin/pam_exec_add_bareos_user.py --name {{ bareos_dir_pam_auth_username | default('pam-adduser') }} --password {{ bareos_dir_pam_auth_password }} --profile {{ bareos_dir_pam_auth_profile | default("webui-admin") }} |
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,10 @@ | ||
--- | ||
|
||
bareos_dir_debug_packages: | ||
- bareos-debuginfo | ||
- gdb | ||
|
||
bareos_dir_plugin_name: python3 | ||
|
||
bareos_dir_pam_auth_requirements: | ||
- pam |
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