~ubuntu-branches/ubuntu/raring/smbldap-tools/raring-proposed

« back to all changes in this revision

Viewing changes to smbldap-config.pl

  • Committer: Package Import Robot
  • Author(s): Leo Iannacone
  • Date: 2011-09-27 18:05:13 UTC
  • mfrom: (6.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20110927180513-2b9g9u4wkqeh4kxn
Tags: 0.9.7-1ubuntu1
* Merge from debian unstable (LP: #889308).  Remaining changes:
  - Apply patch from rdratlos to resolve being unable to join a Windows
    7 or Windows 2008 machine to a Samba domain due to the use of cached
    nss credentials. (LP: #814898)
  - 0020_original_doc_html_index.patch: Add index html file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!@PERL_CMD@
 
2
 
 
3
# $Id$
 
4
 
 
5
# This script can help you setting up the smbldap_conf.pl file. It will set all
 
6
# the default values that are defined in the smb.conf configuration file. You 
 
7
# should then start with this configuration file. You will also need the SID
 
8
# for your samba domain: set up the domain controller before using this script.
 
9
 
 
10
#  This code was developed by IDEALX (http://IDEALX.org/) and
 
11
#  contributors (their names can be found in the CONTRIBUTORS file).
 
12
#
 
13
#                 Copyright (C) 2002 IDEALX
 
14
#
 
15
#  This program is free software; you can redistribute it and/or
 
16
#  modify it under the terms of the GNU General Public License
 
17
#  as published by the Free Software Foundation; either version 2
 
18
#  of the License, or (at your option) any later version.
 
19
#
 
20
#  This program is distributed in the hope that it will be useful,
 
21
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
22
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
23
#  GNU General Public License for more details.
 
24
#
 
25
#  You should have received a copy of the GNU General Public License
 
26
#  along with this program; if not, write to the Free Software
 
27
#  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
 
28
#  USA.
 
29
 
 
30
use strict;
 
31
use warnings;
 
32
use File::Basename;
 
33
 
 
34
# we need to be root to configure the scripts
 
35
if ($< != 0) {
 
36
  die "Only root can configure the smbldap-tools scripts\n";
 
37
}
 
38
 
 
39
print "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 
40
       smbldap-tools script configuration
 
41
       -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
42
Before starting, check
 
43
 . if your samba controller is up and running.
 
44
 . if the domain SID is defined (you can get it with the 'net getlocalsid')
 
45
 
 
46
 . you can leave the configuration using the Ctrl-c key combination
 
47
 . empty value can be set with the \".\" character\n";
 
48
print "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n";
 
49
 
 
50
# we first check if Samba is up and running
 
51
my $test_smb=`pidof smbd`;
 
52
chomp($test_smb);
 
53
die "\nSamba needs to be started first !\n" if ($test_smb eq "" || not defined $test_smb);
 
54
 
 
55
print "Looking for configuration files...\n\n";
 
56
my $smb_conf="@SAMBA_SMB_CONF@";
 
57
print "Samba Configuration File Path [$smb_conf] > ";
 
58
chomp(my $config_smb=<STDIN>);
 
59
if ($config_smb ne "") {
 
60
  $smb_conf=$config_smb;
 
61
}
 
62
 
 
63
my $conf_dir = "@sysconfdir@";
 
64
 
 
65
print "\nThe default directory in which the smbldap configuration files are stored is shown.\n";
 
66
print "If you need to change this, enter the full directory path, then press enter to continue.\n";
 
67
print "Smbldap-tools Configuration Directory Path [$conf_dir] > ";
 
68
my $conf_dir_tmp;
 
69
chomp($conf_dir_tmp=<STDIN>);
 
70
if ($conf_dir_tmp ne "") {
 
71
  $conf_dir=$conf_dir_tmp;
 
72
}
 
73
 
 
74
$conf_dir=~s/\/*$//;
 
75
if (! -d $conf_dir) {
 
76
        mkdir "$conf_dir";
 
77
}
 
78
 
 
79
my $smbldap_conf="$conf_dir"."/smbldap.conf";
 
80
my $smbldap_bind_conf="$conf_dir"."/smbldap_bind.conf";
 
81
 
 
82
 
 
83
 
 
84
# Let's read the smb.conf configuration file
 
85
my %config;
 
86
open (CONFIGFILE, "$smb_conf") || die "Unable to open $smb_conf for reading !\n";
 
87
 
 
88
while (<CONFIGFILE>) {
 
89
 
 
90
  chomp($_);
 
91
 
 
92
  ## eat leading whitespace
 
93
  $_=~s/^\s*//;
 
94
 
 
95
  ## eat trailing whitespace
 
96
  $_=~s/\s*$//;
 
97
 
 
98
 
 
99
  ## throw away comments
 
100
  next if (($_=~/^#/) || ($_=~/^;/));
 
101
 
 
102
  ## check for a param = value
 
103
  if ($_=~/=/) {
 
104
    #my ($param, $value) = split (/=/, $_);
 
105
    my ($param, $value) = ($_=~/([^=]*)=(.*)/i);
 
106
    $param=~s/./\l$&/g;
 
107
    $param=~s/\s+//g;
 
108
    $value=~s/^\s+//;
 
109
 
 
110
    $value=~s/"//g;
 
111
 
 
112
    $config{$param} = $value;
 
113
    #print "param=$param\tvalue=$value\n";
 
114
 
 
115
    next;
 
116
  }
 
117
}
 
118
close (CONFIGFILE);
 
119
 
 
120
print "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n";
 
121
print "Let's start configuring the smbldap-tools scripts ...\n\n";
 
122
 
 
123
# This function need 4 parameters:
 
124
# . the description of the parameter
 
125
# . name of the key it is related to in the %config hash (key similar as the name parameter in
 
126
#   smb.conf). You can get all the available keys using this:
 
127
#   foreach my $tmp (keys %config) {
 
128
#       print "key=$tmp\t value=$config{$tmp}\n";
 
129
#   }
 
130
# . if no value is found in smb.conf for the keys, this value is proposed
 
131
# . the 'insist' variable: if set to 1, then the script will always call for a value
 
132
#   for the parameter. In other words, there's no default value, and it can't be set
 
133
#   to an empty string.
 
134
 
 
135
sub read_entry
 
136
  {
 
137
    my $description=shift;
 
138
    my $value=shift;
 
139
    my $example_value=shift;
 
140
    my $insist=shift;
 
141
    my $value_tmp;
 
142
    chomp($value);
 
143
    $insist=0 if (! defined $insist);
 
144
    if (defined $config{$value} and $config{$value} ne "") {
 
145
      print "$description [$config{$value}] > ";
 
146
      $value_tmp=$config{$value};
 
147
    } else {
 
148
      print "$description [$example_value] > ";
 
149
      $value_tmp="$example_value";
 
150
    }
 
151
    chomp(my $get=<STDIN>);
 
152
    if ($get eq "") {
 
153
      $value=$value_tmp;
 
154
    } elsif ($get eq ".") {
 
155
      $value="";
 
156
    } else {
 
157
      $value=$get;
 
158
    }
 
159
    if ($insist == 1 and "$value" eq "") {
 
160
      while ($insist == 1) {
 
161
        print "  Warning: You really need to set this parameter...\n";
 
162
        $description=~s/. /  /;
 
163
        if (defined $config{$value}) {
 
164
          print "$description [$config{$value}] > ";
 
165
          $value_tmp=$config{$value};
 
166
        } else {
 
167
          print "$description [$value] > ";
 
168
          $value_tmp="$value";
 
169
        }
 
170
        chomp(my $get=<STDIN>);
 
171
        if ($get eq "") {
 
172
          $value=$value_tmp;
 
173
        } elsif ($get eq ".") {
 
174
          $value="";
 
175
        } else {
 
176
          $value=$get;
 
177
          $insist=0;
 
178
        }
 
179
      }
 
180
    }
 
181
    return $value;
 
182
  }
 
183
 
 
184
print ". workgroup name: name of the domain Samba acts as a PDC for\n";
 
185
my $workgroup=read_entry("  workgroup name","workgroup","",0);
 
186
 
 
187
print ". netbios name: netbios name of the samba controller\n";
 
188
my $netbios_name=read_entry("  netbios name","netbiosname","",0);
 
189
 
 
190
print ". logon drive: local path to which the home directory will be connected (for NT Workstations). Ex: 'H:'\n";
 
191
my $logondrive=read_entry("  logon drive","logondrive","",0);
 
192
 
 
193
print ". logon home: home directory location (for Win95/98 or NT Workstation).\n  (use %U as username) Ex:'\\\\$netbios_name\\%U'\n";
 
194
my $logonhome=read_entry("  logon home (press the \".\" character if you don't want homeDirectory)","logonhome","\\\\$netbios_name\\%U",0);
 
195
#$logonhome=~s/\\/\\\\/g;
 
196
 
 
197
print ". logon path: directory where roaming profiles are stored. Ex:'\\\\$netbios_name\\profiles\\\%U'\n";
 
198
my $logonpath=read_entry("  logon path (press the \".\" character if you don't want roaming profiles)","logonpath","\\\\$netbios_name\\profiles\\\%U",0);
 
199
#$logonpath=~s/\\/\\\\/g;
 
200
 
 
201
my $userHome=read_entry(". home directory prefix (use %U as username)","","/home/\%U",0);
 
202
 
 
203
my $userHomeDirectoryMode=read_entry(". default users' homeDirectory mode","","700",0);
 
204
 
 
205
my $userScript=read_entry(". default user netlogon script (use %U as username)","logonscript","",0);
 
206
 
 
207
my $defaultMaxPasswordAge=read_entry("  default password validation time (time in days)","","45",0);
 
208
 
 
209
#############################
 
210
# ldap directory parameters #
 
211
#############################
 
212
my $ldap_suffix=read_entry(". ldap suffix","ldapsuffix","",0);
 
213
my $ldap_group_suffix=read_entry(". ldap group suffix","ldapgroupsuffix","",0);
 
214
$ldap_group_suffix=~s/ou=//;
 
215
my $ldap_user_suffix=read_entry(". ldap user suffix","ldapusersuffix","",0);
 
216
$ldap_user_suffix=~s/ou=//;
 
217
my $ldap_machine_suffix=read_entry(". ldap machine suffix","ldapmachinesuffix","",0);
 
218
$ldap_machine_suffix=~s/ou=//;
 
219
my $ldap_idmap_suffix=read_entry(". Idmap suffix","ldapidmapsuffix","ou=Idmap",0);
 
220
print ". sambaUnixIdPooldn: object where you want to store the next uidNumber\n";
 
221
print "  and gidNumber available for new users and groups\n";
 
222
my $sambaUnixIdPooldn=read_entry("  sambaUnixIdPooldn object (relative to \${suffix})","","sambaDomainName=$workgroup",0);
 
223
 
 
224
# parameters for the master ldap server
 
225
my ($trash1,$server);
 
226
if (defined $config{passdbbackend}) {
 
227
  ($trash1,$server)=($config{passdbbackend}=~m/(.*)ldap:\/\/(.*)/);
 
228
}
 
229
$server="127.0.0.1" unless defined($server);
 
230
$server=~s/\///;
 
231
my $ldapmasterserver;
 
232
print ". ldap master server: IP address or DNS name of the master (writable) ldap server\n";
 
233
$ldapmasterserver=read_entry("  ldap master server","",$server,0);
 
234
my $ldapmasterport;
 
235
if (defined $config{ldapport}) {
 
236
  $ldapmasterport=read_entry(". ldap master port","ldapport","",0);
 
237
} else {
 
238
  $ldapmasterport=read_entry(". ldap master port","","389",0);
 
239
}
 
240
my $ldap_master_admin_dn=read_entry(". ldap master bind dn","ldapadmindn","",0);
 
241
system "stty -echo";
 
242
my $ldap_master_bind_password=read_entry(". ldap master bind password","","",1);
 
243
print "\n";
 
244
system "stty echo";
 
245
 
 
246
# parameters for the slave ldap server
 
247
print ". ldap slave server: IP address or DNS name of the slave ldap server: can also be the master one\n";
 
248
my $ldap_slave_server=read_entry("  ldap slave server","","$server",0);
 
249
my $ldap_slave_port;
 
250
if (defined $config{ldapport}) {
 
251
  $ldap_slave_port=read_entry(". ldap slave port","ldapport","",0);
 
252
} else {
 
253
  $ldap_slave_port=read_entry(". ldap slave port","","389",0);
 
254
}
 
255
my $ldap_slave_admin_dn=read_entry(". ldap slave bind dn","ldapadmindn","",0);
 
256
system "stty -echo";
 
257
my $ldap_slave_bind_password=read_entry(". ldap slave bind password","","",1);
 
258
print "\n";
 
259
system "stty echo";
 
260
my $ldaptls=read_entry(". ldap tls support (1/0)","","0",0);
 
261
my ($cert_verify,$cert_cafile,$cert_clientcert,$cert_clientkey)=("","","","");
 
262
if ($ldaptls == 1) {
 
263
  $cert_verify=read_entry(". How to verify the server's certificate (none, optional or require)","","require",0);
 
264
  $cert_cafile=read_entry(". CA certificate file","","$conf_dir/ca.pem",0);
 
265
  $cert_clientcert=read_entry(". certificate to use to connect to the ldap server","","$conf_dir/smbldap-tools.pem",0);
 
266
  $cert_clientkey=read_entry(". key certificate to use to connect to the ldap server","","$conf_dir/smbldap-tools.key",0);
 
267
}
 
268
 
 
269
# let's test if any sid is available
 
270
# Here is the strategy: If smb.conf has 'domain master = No'
 
271
#  this means we are a BDC and we must obtain the SID from the PDC
 
272
#  using the command 'net rpc getsid -S PDC -Uroot%password' BEFORE
 
273
#  executing this script - that then guarantees the correct SID is available.
 
274
my $sid_tmp=`net getlocalsid \$netbios_name 2>/dev/null | cut -f2 -d: | sed "s/ //g"`;
 
275
chomp $sid_tmp;
 
276
print ". SID for domain $config{workgroup}: SID of the domain (can be obtained with 'net getlocalsid $netbios_name')\n";
 
277
my $sid=read_entry("  SID for domain $config{workgroup}","","$sid_tmp",0);
 
278
 
 
279
print ". unix password encryption: encryption used for unix passwords\n";
 
280
my $cryp_algo=read_entry("  unix password encryption (CRYPT, MD5, SMD5, SSHA, SHA)","","SSHA",0);
 
281
my $crypt_salt_format="";
 
282
if ( $cryp_algo eq "CRYPT" ) {
 
283
  print ". crypt salt format: If hash_encrypt is set to CRYPT, you may set \n";
 
284
  print "  a salt format. The default is \"\%s\", but many systems will generate\n";
 
285
  print "  MD5 hashed passwords if you use \"\$1\$\%\.8s\"\n";
 
286
  $crypt_salt_format=read_entry("  crypt salt format","","\%s",0);
 
287
}
 
288
 
 
289
my $default_user_gidnumber=read_entry(". default user gidNumber","","513",0);
 
290
 
 
291
my $default_computer_gidnumber=read_entry(". default computer gidNumber","","515",0);
 
292
 
 
293
my $userLoginShell=read_entry(". default login shell","","/bin/bash",0);
 
294
 
 
295
my $skeletonDir=read_entry(". default skeleton directory","","/etc/skel",0);
 
296
 
 
297
my $mailDomain=read_entry(". default domain name to append to mail address", "","",0);
 
298
 
 
299
print "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n";
 
300
my $template_smbldap="
 
301
# smbldap-tools.conf : Q & D configuration file for smbldap-tools
 
302
 
 
303
#  This code was developed by IDEALX (http://IDEALX.org/) and
 
304
#  contributors (their names can be found in the CONTRIBUTORS file).
 
305
#
 
306
#                 Copyright (C) 2001-2002 IDEALX
 
307
#
 
308
#  This program is free software; you can redistribute it and/or
 
309
#  modify it under the terms of the GNU General Public License
 
310
#  as published by the Free Software Foundation; either version 2
 
311
#  of the License, or (at your option) any later version.
 
312
#
 
313
#  This program is distributed in the hope that it will be useful,
 
314
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
315
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
316
#  GNU General Public License for more details.
 
317
#
 
318
#  You should have received a copy of the GNU General Public License
 
319
#  along with this program; if not, write to the Free Software
 
320
#  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
 
321
#  USA.
 
322
 
 
323
#  Purpose :
 
324
#       . be the configuration file for all smbldap-tools scripts
 
325
 
 
326
##############################################################################
 
327
#
 
328
# General Configuration
 
329
#
 
330
##############################################################################
 
331
 
 
332
# Put your own SID. To obtain this number do: \"net getlocalsid\".
 
333
# If not defined, parameter is taking from \"net getlocalsid\" return
 
334
SID=\"$sid\"
 
335
 
 
336
# Domain name the Samba server is in charged.
 
337
# If not defined, parameter is taking from smb.conf configuration file
 
338
# Ex: sambaDomain=\"IDEALX-NT\"
 
339
sambaDomain=\"$workgroup\"
 
340
 
 
341
##############################################################################
 
342
#
 
343
# LDAP Configuration
 
344
#
 
345
##############################################################################
 
346
 
 
347
# Notes: to use to dual ldap servers backend for Samba, you must patch
 
348
# Samba with the dual-head patch from IDEALX. If not using this patch
 
349
# just use the same server for slaveLDAP and masterLDAP.
 
350
# Those two servers declarations can also be used when you have 
 
351
# . one master LDAP server where all writing operations must be done
 
352
# . one slave LDAP server where all reading operations must be done
 
353
#   (typically a replication directory)
 
354
 
 
355
# Slave LDAP server
 
356
# Ex: slaveLDAP=127.0.0.1
 
357
# If not defined, parameter is set to \"127.0.0.1\"
 
358
slaveLDAP=\"$ldap_slave_server\"
 
359
 
 
360
# Slave LDAP port
 
361
# If not defined, parameter is set to \"389\"
 
362
slavePort=\"$ldap_slave_port\"
 
363
 
 
364
# Master LDAP server: needed for write operations
 
365
# Ex: masterLDAP=127.0.0.1
 
366
# If not defined, parameter is set to \"127.0.0.1\"
 
367
masterLDAP=\"$ldapmasterserver\"
 
368
 
 
369
# Master LDAP port
 
370
# If not defined, parameter is set to \"389\"
 
371
masterPort=\"$ldapmasterport\"
 
372
 
 
373
# Use TLS for LDAP
 
374
# If set to 1, this option will use start_tls for connection
 
375
# (you should also used the port 389)
 
376
# If not defined, parameter is set to \"1\"
 
377
ldapTLS=\"$ldaptls\"
 
378
 
 
379
# How to verify the server's certificate (none, optional or require)
 
380
# see \"man Net::LDAP\" in start_tls section for more details
 
381
verify=\"$cert_verify\"
 
382
 
 
383
# CA certificate
 
384
# see \"man Net::LDAP\" in start_tls section for more details
 
385
cafile=\"$cert_cafile\"
 
386
 
 
387
# certificate to use to connect to the ldap server
 
388
# see \"man Net::LDAP\" in start_tls section for more details
 
389
clientcert=\"$cert_clientcert\"
 
390
 
 
391
# key certificate to use to connect to the ldap server
 
392
# see \"man Net::LDAP\" in start_tls section for more details
 
393
clientkey=\"$cert_clientkey\"
 
394
 
 
395
# LDAP Suffix
 
396
# Ex: suffix=dc=IDEALX,dc=ORG
 
397
suffix=\"$ldap_suffix\"
 
398
 
 
399
# Where are stored Users
 
400
# Ex: usersdn=\"ou=Users,dc=IDEALX,dc=ORG\"
 
401
# Warning: if 'suffix' is not set here, you must set the full dn for usersdn
 
402
usersdn=\"ou=$ldap_user_suffix,\${suffix}\"
 
403
 
 
404
# Where are stored Computers
 
405
# Ex: computersdn=\"ou=Computers,dc=IDEALX,dc=ORG\"
 
406
# Warning: if 'suffix' is not set here, you must set the full dn for computersdn
 
407
computersdn=\"ou=$ldap_machine_suffix,\${suffix}\"
 
408
 
 
409
# Where are stored Groups
 
410
# Ex: groupsdn=\"ou=Groups,dc=IDEALX,dc=ORG\"
 
411
# Warning: if 'suffix' is not set here, you must set the full dn for groupsdn
 
412
groupsdn=\"ou=$ldap_group_suffix,\${suffix}\"
 
413
 
 
414
# Where are stored Idmap entries (used if samba is a domain member server)
 
415
# Ex: groupsdn=\"ou=Idmap,dc=IDEALX,dc=ORG\"
 
416
# Warning: if 'suffix' is not set here, you must set the full dn for idmapdn
 
417
idmapdn=\"$ldap_idmap_suffix,\${suffix}\"
 
418
 
 
419
# Where to store next uidNumber and gidNumber available for new users and groups
 
420
# If not defined, entries are stored in sambaDomainName object.
 
421
# Ex: sambaUnixIdPooldn=\"sambaDomainName=\${sambaDomain},\${suffix}\"
 
422
# Ex: sambaUnixIdPooldn=\"cn=NextFreeUnixId,\${suffix}\"
 
423
sambaUnixIdPooldn=\"$sambaUnixIdPooldn,\${suffix}\"
 
424
 
 
425
# Default scope Used
 
426
scope=\"sub\"
 
427
 
 
428
# Unix password encryption (CRYPT, MD5, SMD5, SSHA, SHA, CLEARTEXT)
 
429
hash_encrypt=\"$cryp_algo\"
 
430
 
 
431
# if hash_encrypt is set to CRYPT, you may set a salt format.
 
432
# default is \"\%s\", but many systems will generate MD5 hashed
 
433
# passwords if you use \"\$1\$\%\.8s\". This parameter is optional!
 
434
crypt_salt_format=\"$crypt_salt_format\"
 
435
 
 
436
##############################################################################
 
437
 
438
# Unix Accounts Configuration
 
439
 
440
##############################################################################
 
441
 
 
442
# Login defs
 
443
# Default Login Shell
 
444
# Ex: userLoginShell=\"/bin/bash\"
 
445
userLoginShell=\"$userLoginShell\"
 
446
 
 
447
# Home directory
 
448
# Ex: userHome=\"/home/\%U\"
 
449
userHome=\"$userHome\"
 
450
 
 
451
# Default mode used for user homeDirectory
 
452
userHomeDirectoryMode=\"$userHomeDirectoryMode\"
 
453
 
 
454
# Gecos
 
455
userGecos=\"System User\"
 
456
 
 
457
# Default User (POSIX and Samba) GID
 
458
defaultUserGid=\"$default_user_gidnumber\"
 
459
 
 
460
# Default Computer (Samba) GID
 
461
defaultComputerGid=\"$default_computer_gidnumber\"
 
462
 
 
463
# Skel dir
 
464
skeletonDir=\"$skeletonDir\"
 
465
 
 
466
# Default password validation time (time in days) Comment the next line if
 
467
# you don't want password to be enable for defaultMaxPasswordAge days (be
 
468
# careful to the sambaPwdMustChange attribute's value)
 
469
defaultMaxPasswordAge=\"$defaultMaxPasswordAge\"
 
470
 
 
471
##############################################################################
 
472
#
 
473
# SAMBA Configuration
 
474
#
 
475
##############################################################################
 
476
 
 
477
# The UNC path to home drives location (\%U username substitution)
 
478
# Just set it to a null string if you want to use the smb.conf 'logon home'
 
479
# directive and/or disable roaming profiles
 
480
# Ex: userSmbHome=\"\\\\PDC-SMB3\\%U\"
 
481
userSmbHome=\"$logonhome\"
 
482
 
 
483
# The UNC path to profiles locations (\%U username substitution)
 
484
# Just set it to a null string if you want to use the smb.conf 'logon path'
 
485
# directive and/or disable roaming profiles
 
486
# Ex: userProfile=\"\\\\PDC-SMB3\\profiles\\\%U\"
 
487
userProfile=\"$logonpath\"
 
488
 
 
489
# The default Home Drive Letter mapping
 
490
# (will be automatically mapped at logon time if home directory exist)
 
491
# Ex: userHomeDrive=\"H:\"
 
492
userHomeDrive=\"$logondrive\"
 
493
 
 
494
# The default user netlogon script name (\%U username substitution)
 
495
# if not used, will be automatically username.cmd
 
496
# make sure script file is edited under dos
 
497
# Ex: userScript=\"startup.cmd\" # make sure script file is edited under dos
 
498
userScript=\"$userScript\"
 
499
 
 
500
# Domain appended to the users \"mail\"-attribute
 
501
# when smbldap-useradd -M is used
 
502
# Ex: mailDomain=\"idealx.com\"
 
503
mailDomain=\"$mailDomain\"
 
504
 
 
505
##############################################################################
 
506
#
 
507
# SMBLDAP-TOOLS Configuration (default are ok for a RedHat)
 
508
#
 
509
##############################################################################
 
510
 
 
511
# Allows not to use smbpasswd (if with_smbpasswd=\"0\" in smbldap.conf) but
 
512
# prefer Crypt::SmbHash library
 
513
with_smbpasswd=\"0\"
 
514
smbpasswd=\"/usr/bin/smbpasswd\"
 
515
 
 
516
# Allows not to use slappasswd (if with_slappasswd=\"0\" in smbldap.conf)
 
517
# but prefer Crypt:: libraries
 
518
with_slappasswd=\"0\"
 
519
slappasswd=\"/usr/sbin/slappasswd\"
 
520
 
 
521
# comment out the following line to get rid of the default banner
 
522
# no_banner=\"1\"
 
523
";
 
524
 
 
525
my $template_smbldap_bind="
 
526
############################
 
527
# Credential Configuration #
 
528
############################
 
529
# Note: you can specify two different configurations if you use a
 
530
# master ldap for writing access and a slave ldap server for reading access
 
531
# By default, we will use the same DN (so it will work for standard Samba
 
532
# release)
 
533
slaveDN=\"$ldap_master_admin_dn\"
 
534
slavePw=\"$ldap_master_bind_password\"
 
535
masterDN=\"$ldap_slave_admin_dn\"
 
536
masterPw=\"$ldap_slave_bind_password\"
 
537
";
 
538
 
 
539
print "backup old configuration files:\n";
 
540
print "  $smbldap_conf->$smbldap_conf.old\n";
 
541
print "  $smbldap_bind_conf->$smbldap_bind_conf.old\n";
 
542
rename "$smbldap_conf","$smbldap_conf.old";
 
543
rename "$smbldap_bind_conf","$smbldap_bind_conf.old";
 
544
 
 
545
print "writing new configuration file:\n";
 
546
open (SMBLDAP,'>',"$smbldap_conf") || die "Unable to open $smbldap_conf for writing !\n";
 
547
print SMBLDAP "$template_smbldap";
 
548
close(SMBLDAP);
 
549
print "  $smbldap_conf done.\n";
 
550
my $mode=0644;
 
551
chmod $mode,"$smbldap_conf","$smbldap_conf.old";
 
552
 
 
553
open (SMBLDAP_BIND,'>',"$smbldap_bind_conf") || die "Unable to open $smbldap_bind_conf for writing !\n";
 
554
print SMBLDAP_BIND "$template_smbldap_bind";
 
555
close(SMBLDAP_BIND);
 
556
print "  $smbldap_bind_conf done.\n";
 
557
$mode=0600;
 
558
chmod $mode,"$smbldap_bind_conf","$smbldap_bind_conf.old";
 
559