Saltstack Official Users Formula
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

36 lines
1.2KB

  1. # -*- coding: utf-8 -*-
  2. # vim: ft=sls
  3. {##
  4. Name: users/bashrc.sls
  5. Description:
  6. This file sets up bashrcs
  7. #}
  8. {% from "users/map.jinja" import users_settings with context %}
  9. users-googleauth-package:
  10. file.directory:
  11. - name: {{ users_settings.googleauth_dir }}
  12. - user: root
  13. - group: {{ users_settings.root_group }}
  14. - mode: 600
  15. pkg.installed:
  16. - name: {{ users_settings.googleauth_package }}
  17. {% for name, user in users_settings.items() %}
  18. {% if user.absent is not defined or not user.absent or user != None %}
  19. {% if 'google_auth' in user %}
  20. {% for svc in user.get('google_auth') %}
  21. {% if user.get('google_2fa', True) %}
  22. users_googleauth-pam-{{ svc }}-{{ name }}:
  23. file.replace:
  24. - name: /etc/pam.d/{{ svc }}
  25. - pattern: "^@include common-auth"
  26. - repl: "auth [success=done new_authtok_reqd=done default=die] pam_google_authenticator.so user=root secret={{ users_settings.googleauth_dir }}/${USER}_{{ svc }} echo_verification_code\n@include common-auth"
  27. - unless: grep pam_google_authenticator.so /etc/pam.d/{{ svc }}
  28. - backup: .bak
  29. {% endif %}
  30. {% endfor %}
  31. {% endif %}
  32. {% endif %}
  33. {% endfor %}