From e35045801cfb49f86436686824711d5c04166753 Mon Sep 17 00:00:00 2001 From: Thomas Juberg Date: Mon, 22 Dec 2014 14:22:46 +0100 Subject: [PATCH 1/3] Add support for setting user expire --- pillar.example | 3 ++- users/init.sls | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pillar.example b/pillar.example index 06ba2fa..8920020 100644 --- a/pillar.example +++ b/pillar.example @@ -9,8 +9,9 @@ users: password: $6$w............. home: /custom/buser createhome: True + expire: 16426 sudouser: True - sudo_rules: + sudo_rules: - ALL=(root) /usr/bin/find - ALL=(otheruser) /usr/bin/script.sh shell: /bin/bash diff --git a/users/init.sls b/users/init.sls index c599b9e..9fba180 100644 --- a/users/init.sls +++ b/users/init.sls @@ -58,6 +58,9 @@ {% if not user.get('createhome', True) %} - createhome: False {% endif %} + {% if 'expire' in user -%} + - expire: {{ user['expire'] }} + {% endif -%} - remove_groups: {{ user.get('remove_groups', 'False') }} - groups: - {{ user_group }} From 518b06281a1cc93aea4288723081552b053599e6 Mon Sep 17 00:00:00 2001 From: Thomas Juberg Date: Mon, 22 Dec 2014 14:32:41 +0100 Subject: [PATCH 2/3] If createhome is set to false, don't touch the home directory or its permissions. --- users/init.sls | 2 ++ 1 file changed, 2 insertions(+) diff --git a/users/init.sls b/users/init.sls index 9fba180..90ec353 100644 --- a/users/init.sls +++ b/users/init.sls @@ -22,6 +22,7 @@ {% endfor %} {{ name }}_user: + {% if user.get('createhome', True) != False %} file.directory: - name: {{ home }} - user: {{ name }} @@ -30,6 +31,7 @@ - require: - user: {{ name }} - group: {{ user_group }} + {%- endif %} group.present: - name: {{ user_group }} {%- if 'prime_group' in user and 'gid' in user['prime_group'] %} From 7aa32881b7cf4a1d60fbb876133908e3e28c8ac3 Mon Sep 17 00:00:00 2001 From: Thomas Juberg Date: Wed, 31 Dec 2014 09:46:03 +0100 Subject: [PATCH 3/3] Clean up logic check to remove redundant check. --- users/init.sls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/users/init.sls b/users/init.sls index 90ec353..e325686 100644 --- a/users/init.sls +++ b/users/init.sls @@ -22,7 +22,7 @@ {% endfor %} {{ name }}_user: - {% if user.get('createhome', True) != False %} + {% if user.get('createhome', True) %} file.directory: - name: {{ home }} - user: {{ name }}