From 851a59e952b80f2a958f65b9acf57888357ea20b Mon Sep 17 00:00:00 2001 From: outime Date: Sun, 27 Sep 2015 16:20:45 +0200 Subject: [PATCH 1/3] Adds 'empty_password' statement for states.user.present --- pillar.example | 3 +++ users/init.sls | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pillar.example b/pillar.example index b970e46..14cdc9e 100644 --- a/pillar.example +++ b/pillar.example @@ -8,6 +8,9 @@ users: fullname: B User password: $6$w............. enforce_password: True + # WARNING: If 'empty_password' is set to True, the 'password' statement + # will be ignored by enabling password-less login for the user. + empty_password: False home: /custom/buser createhome: True roomnumber: "A-1" diff --git a/users/init.sls b/users/init.sls index da04f01..836a8c7 100644 --- a/users/init.sls +++ b/users/init.sls @@ -78,9 +78,12 @@ users_{{ name }}_user: {% if 'uid' in user -%} - uid: {{ user['uid'] }} {% endif -%} - {% if 'password' in user -%} + {% if 'password in user -%} - password: '{{ user['password'] }}' {% endif -%} + {% if empty_password is defined -%} + - empty_password: {{ user['empty_password'] }} + {% endif -%} {% if 'enforce_password' in user -%} - enforce_password: {{ user['enforce_password'] }} {% endif -%} From 441d3cb6355992c6cd65e61491a9c97af9fe971c Mon Sep 17 00:00:00 2001 From: outime Date: Sun, 27 Sep 2015 17:41:51 +0200 Subject: [PATCH 2/3] Fixed typo and 'empty_password' key check --- users/init.sls | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/users/init.sls b/users/init.sls index 836a8c7..cc88135 100644 --- a/users/init.sls +++ b/users/init.sls @@ -78,10 +78,10 @@ users_{{ name }}_user: {% if 'uid' in user -%} - uid: {{ user['uid'] }} {% endif -%} - {% if 'password in user -%} + {% if 'password' in user -%} - password: '{{ user['password'] }}' {% endif -%} - {% if empty_password is defined -%} + {% if 'empty_password' in user -%} - empty_password: {{ user['empty_password'] }} {% endif -%} {% if 'enforce_password' in user -%} From 965372d0d249576382494a74ffc8fb73c6dc8131 Mon Sep 17 00:00:00 2001 From: outime Date: Sun, 27 Sep 2015 18:59:09 +0200 Subject: [PATCH 3/3] Changed 'empty_password' key retrieval method --- users/init.sls | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/users/init.sls b/users/init.sls index cc88135..e2af37f 100644 --- a/users/init.sls +++ b/users/init.sls @@ -81,8 +81,8 @@ users_{{ name }}_user: {% if 'password' in user -%} - password: '{{ user['password'] }}' {% endif -%} - {% if 'empty_password' in user -%} - - empty_password: {{ user['empty_password'] }} + {% if user.get('empty_password') -%} + - empty_password: {{ user.get('empty_password') }} {% endif -%} {% if 'enforce_password' in user -%} - enforce_password: {{ user['enforce_password'] }}