Skip to content

Commit

Permalink
Merge pull request #70 from xenadmin/pdbedit-#35-&-#68
Browse files Browse the repository at this point in the history
Pdbedit #35 & #68
  • Loading branch information
noelmcloughlin authored Aug 30, 2019
2 parents 3897734 + 48ff228 commit 4b68854
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
10 changes: 8 additions & 2 deletions pillar.example
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,16 @@ samba:

users:
## Optional site specific extension to smb.conf
## user.present passwd needs plaintext or hash. Hash is recommended, generate it with the following command -> openssl passwd -1
## pdbedit.managed nt needs hash. Plaintext seem to be broken (https://github.com/saltstack-formulas/samba-formula/issues/35). Generate it with the following command -> salt '*' pdbedit.generate_nt_hash PASSWORD
user1:
password: user1sambapassword
password:
passwd: $1$vFH3.Plc$7CZnr18jaLx1fMBGm1NMP/ ## Equals "user1sambapassword" in plaintext
nt: EB11C288046508EBE2AA213DB0860813 ## Equals "user1sambapassword" in plaintext
user2:
password: user2sambapassword
password:
passwd: $1$Kvm5/Q6Y$B19DYyLRCqeUsyacipVet1 ## Equals "user2sambapassword" in Plaintext
nt: 5AA13065E0B8A81835D48291E5C47236 ## Equals "user2sambapassword" in Plaintext

winbind:
krb5_default_realm: EXAMPLE.COM
12 changes: 6 additions & 6 deletions samba/users/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ include:
{% endif %}

{% for login,user in salt['pillar.get']('samba:users', {}).items() %}
samba_{{ login }}:
{{ login }}:
user.present:
- name: {{ login }}
- fullname: {{ login }}
- password: {{ user.password }}

samba_smbpasswd_{{ login }}:
cmd.run:
- name: "(echo '{{ user.password }}'; echo '{{ user.password }}') | smbpasswd -as {{ login }}"
- password: {{ user.password.passwd }}
pdbedit.managed:
- login: {{ login }}
- password: {{ user.password.nt }}
- password_hashed: True
{% endfor %}

0 comments on commit 4b68854

Please sign in to comment.