Saltstack Official Users Formula
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

34 行
1.2KB

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