Saltstack Official Users Formula
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

googleauth.sls 1.1KB

12345678910111213141516171819202122232425262728293031
  1. # vim: sts=2 ts=2 sw=2 et ai
  2. {% from "users/map.jinja" import users with context %}
  3. users_googleauth-package:
  4. pkg.installed:
  5. - name: {{ users.googleauth_package }}
  6. - require:
  7. - file: {{ users.googleauth_dir }}
  8. users_{{ users.googleauth_dir }}:
  9. file.directory:
  10. - name: {{ users.googleauth_dir }}
  11. - user: root
  12. - group: {{ users.root_group }}
  13. - mode: 600
  14. {% for name, user in pillar.get('users', {}).items() if user.absent is not defined or not user.absent %}
  15. {%- if 'google_auth' in user %}
  16. {%- for svc in user['google_auth'] %}
  17. {%- if user.get('google_2fa', True) %}
  18. users_googleauth-pam-{{ svc }}-{{ name }}:
  19. file.replace:
  20. - name: /etc/pam.d/{{ svc }}
  21. - pattern: "^@include common-auth"
  22. - 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"
  23. - unless: grep pam_google_authenticator.so /etc/pam.d/{{ svc }}
  24. - backup: .bak
  25. {%- endif %}
  26. {%- endfor %}
  27. {%- endif %}
  28. {%- endfor %}