Skip to content

Commit 1dcd7d5

Browse files
committed
refactor(googleauth): pam handling
1 parent 2a3b676 commit 1dcd7d5

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

users/googleauth.sls

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ users_{{ users.googleauth_dir }}:
1919
{%- if 'google_auth' in user %}
2020
{%- for svc in user['google_auth'] %}
2121
{%- if user.get('google_2fa', True) %}
22-
{%- set repl = '{0} {1} {2} {3} {4}{5}/{6}_{7} {8}\\n{9}'.format(
22+
{%- set repl = '{0} {1} {2} {3} {4}{5}/{6}_{7} {8}'.format(
2323
'auth',
2424
'[success=done new_authtok_reqd=done default=die]',
2525
'pam_google_authenticator.so',
@@ -29,13 +29,12 @@ users_{{ users.googleauth_dir }}:
2929
'${USER}',
3030
svc,
3131
'echo_verification_code',
32-
'@include common-auth',
3332
) %}
3433
users_googleauth-pam-{{ svc }}-{{ name }}:
3534
file.replace:
3635
- name: /etc/pam.d/{{ svc }}
37-
- pattern: "^@include common-auth"
38-
- repl: "{{ repl }}"
36+
- pattern: '^(@include[ \t]*common-auth)'
37+
- repl: '{{ repl }}\n\1'
3938
- unless: grep pam_google_authenticator.so /etc/pam.d/{{ svc }}
4039
- backup: .bak
4140
{%- endif %}

0 commit comments

Comments
 (0)