Parcourir la source

Merge pull request #30 from ministryofjustice/master

Validate user sudo rules before applying them
tags/v0.45.0
Joseph Hall il y a 10 ans
Parent
révision
a8604f7e54
1 fichiers modifiés avec 11 ajouts et 0 suppressions
  1. +11
    -0
      users/init.sls

+ 11
- 0
users/init.sls Voir le fichier

@@ -129,6 +129,17 @@ sudoer-{{ name }}:
- group: root
- mode: '0440'
{% if 'sudo_rules' in user %}
{% for rule in user['sudo_rules'] %}
"validate {{ name }} sudo rule {{ loop.index0 }} {{ name }} {{ rule }}":
cmd.run:
- name: 'visudo -cf - <<<"$rule"'
- env:
# Specify the rule via an env var to avoid shell quoting issues.
- rule: "{{ name }} {{ rule }}"
- require_in:
- file: /etc/sudoers.d/{{ name }}
{% endfor %}

/etc/sudoers.d/{{ name }}:
file.append:
- text:

Chargement…
Annuler
Enregistrer