diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2016-03-24 14:18:03 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2016-03-24 14:18:03 -0300 |
commit | 309d5859d9c801218075789fe068869ab49065f5 (patch) | |
tree | dc31d7e0e39b48f75475f374d5301bba10c7c64a /templates | |
parent | 846ed365f19187b50f9aff0c7911b533880398a7 (diff) | |
parent | eb97a2b642499fde7afdb64dfd3e2b7e8c14eacc (diff) | |
download | puppet-samba-309d5859d9c801218075789fe068869ab49065f5.tar.gz puppet-samba-309d5859d9c801218075789fe068869ab49065f5.tar.bz2 |
Merge branch 'master' of https://github.com/ajjahn/puppet-samba
Conflicts:
manifests/server/service.pp
Diffstat (limited to 'templates')
-rw-r--r-- | templates/configure_active_directory.erb | 15 | ||||
-rw-r--r-- | templates/verify_active_directory.erb | 5 |
2 files changed, 14 insertions, 6 deletions
diff --git a/templates/configure_active_directory.erb b/templates/configure_active_directory.erb index 35ba86f..4f9b6e0 100644 --- a/templates/configure_active_directory.erb +++ b/templates/configure_active_directory.erb @@ -54,7 +54,7 @@ do esac done -password="<%= scope.lookupvar('samba::server::ads::winbind_pass') -%>" +password='<%= scope.lookupvar('samba::server::ads::winbind_pass') -%>' # short hostname from facter my_hostname="<%= hostname -%>" @@ -80,7 +80,7 @@ echo "Please do not kill me; I may be slow" >&2 if [ "$action" = "leave" ]; then logger -st $PROG "Leaving AD domain" - $NET ads $action -U ${winbind_acct}%${password} | grep Deleted && success=true || success=false + $NET ads $action -U "${winbind_acct}%${password}" | grep Deleted && success=true || success=false kdestroy rm -f /etc/krb5.keytab if [ $success = "true" ]; then @@ -105,8 +105,14 @@ ad_settle() { export KRB5CCNAME=$(umask 0077; mktemp -q winbind_cache.XXXXXXXX) if [ "$action" = "join" ]; then + if [ "${target_ou}" != "" ]; then + ou_parameter="createcomputer=\"${target_ou}\"" + else + ou_parameter="" + fi + logger -st $PROG "Joining AD domain" >&2 - $NET ads $action -U ${winbind_acct}%${password} createcomputer="${target_ou}"\ + $NET ads $action -U "${winbind_acct}%${password}" ${ou_parameter} \ | grep Joined && success=true || success=false if [ $success = "false" ]; then @@ -121,7 +127,8 @@ for attempt in $(seq 1 $max_attempts); do echo "Getting TGT for ${winbind_acct}@${my_realm}" >&2 $EXPECT -c "spawn -noecho kinit -c $KRB5CCNAME ${winbind_acct}@${my_realm}; expect :; - send ${password}\n; + send {${password}}; + send \n; expect eof" klist -c $KRB5CCNAME &> /dev/null && break done diff --git a/templates/verify_active_directory.erb b/templates/verify_active_directory.erb index 5a2a506..0917c49 100644 --- a/templates/verify_active_directory.erb +++ b/templates/verify_active_directory.erb @@ -21,7 +21,7 @@ fi # } >&2 #fi -password="<%= scope.lookupvar('samba::server::ads::winbind_pass') -%>" +password='<%= scope.lookupvar('samba::server::ads::winbind_pass') -%>' # short hostname from facter my_hostname="<%= hostname -%>" @@ -62,7 +62,8 @@ get_tgt() { ( $EXPECT -c "spawn -noecho kinit -c $KRB5CCNAME ${winbind_acct}@${default_realm}; expect :; - send ${password}\n; + send {${password}}; + send \n; expect eof" ) &> /dev/null klist -c $KRB5CCNAME &> /dev/null |