mirror of
https://github.com/saltstack-formulas/users-formula.git
synced 2026-07-31 20:35:05 +02:00
feat(semantic-release): implement for this formula
* Based on `ssf-formula` (v0.3.0) - https://github.com/myii/ssf-formula/pull/5 * Unable to use `pillar.example` directly for testing - Used it as a basis for `test/salt/pillar/default.sls` - Brought useful changes back to `pillar.example` * Fix: avoid `users/googleauth.sls` for `RedHat` & `Suse` * Close #203
This commit is contained in:
+10
-8
@@ -1,6 +1,7 @@
|
||||
# vim: sts=2 ts=2 sw=2 et ai
|
||||
{% from "users/map.jinja" import users with context %}
|
||||
{%- from "users/map.jinja" import users with context %}
|
||||
|
||||
{%- if not grains['os_family'] in ['RedHat', 'Suse'] %}
|
||||
users_googleauth-package:
|
||||
pkg.installed:
|
||||
- name: {{ users.googleauth_package }}
|
||||
@@ -14,10 +15,10 @@ users_{{ users.googleauth_dir }}:
|
||||
- group: {{ users.root_group }}
|
||||
- mode: 600
|
||||
|
||||
{% for name, user in pillar.get('users', {}).items() if user.absent is not defined or not user.absent %}
|
||||
{%- if 'google_auth' in user %}
|
||||
{%- for svc in user['google_auth'] %}
|
||||
{%- if user.get('google_2fa', True) %}
|
||||
{%- for name, user in pillar.get('users', {}).items() if user.absent is not defined or not user.absent %}
|
||||
{%- if 'google_auth' in user %}
|
||||
{%- for svc in user['google_auth'] %}
|
||||
{%- if user.get('google_2fa', True) %}
|
||||
users_googleauth-pam-{{ svc }}-{{ name }}:
|
||||
file.replace:
|
||||
- name: /etc/pam.d/{{ svc }}
|
||||
@@ -25,7 +26,8 @@ users_googleauth-pam-{{ svc }}-{{ name }}:
|
||||
- repl: "auth [success=done new_authtok_reqd=done default=die] pam_google_authenticator.so user=root secret={{ users.googleauth_dir }}/${USER}_{{ svc }} echo_verification_code\n@include common-auth"
|
||||
- unless: grep pam_google_authenticator.so /etc/pam.d/{{ svc }}
|
||||
- backup: .bak
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
|
||||
+5
-3
@@ -506,8 +506,9 @@ users_{{ users.sudoers_dir }}/{{ sudoers_d_filename }}:
|
||||
- name: {{ users.sudoers_dir }}/{{ sudoers_d_filename }}
|
||||
{% endif %}
|
||||
|
||||
{%- if 'google_auth' in user %}
|
||||
{%- for svc in user['google_auth'] %}
|
||||
{%- if not grains['os_family'] in ['RedHat', 'Suse'] %}
|
||||
{%- if 'google_auth' in user %}
|
||||
{%- for svc in user['google_auth'] %}
|
||||
users_googleauth-{{ svc }}-{{ name }}:
|
||||
file.managed:
|
||||
- replace: false
|
||||
@@ -518,7 +519,8 @@ users_googleauth-{{ svc }}-{{ name }}:
|
||||
- mode: 400
|
||||
- require:
|
||||
- pkg: users_googleauth-package
|
||||
{%- endfor %}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
|
||||
# this doesn't work (Salt bug), therefore need to run state.apply twice
|
||||
|
||||
Reference in New Issue
Block a user