syncing examples
[tprouty/samba.git] / examples / LDAP / smbldap-tools / smbldap_conf.pm
1 #!/usr/bin/perl
2 use strict;
3 package smbldap_conf;
4
5 # smbldap-tools.conf : Q & D configuration file for smbldap-tools
6
7 #  This code was developped by IDEALX (http://IDEALX.org/) and
8 #  contributors (their names can be found in the CONTRIBUTORS file).
9 #
10 #                 Copyright (C) 2001-2002 IDEALX
11 #
12 #  This program is free software; you can redistribute it and/or
13 #  modify it under the terms of the GNU General Public License
14 #  as published by the Free Software Foundation; either version 2
15 #  of the License, or (at your option) any later version.
16 #
17 #  This program is distributed in the hope that it will be useful,
18 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
19 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 #  GNU General Public License for more details.
21 #
22 #  You should have received a copy of the GNU General Public License
23 #  along with this program; if not, write to the Free Software
24 #  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
25 #  USA.
26
27 #  Purpose :
28 #       . be the configuration file for all smbldap-tools scripts
29
30 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS
31 $UID_START $GID_START $smbpasswd $slaveLDAP $masterLDAP
32 $slavePort $masterPort $ldapSSL $slaveURI $masterURI $with_smbpasswd $mk_ntpasswd
33 $ldap_path $ldap_opts $ldapsearch $ldapsearchnobind
34 $ldapmodify $ldappasswd $ldapadd $ldapdelete $ldapmodrdn
35 $suffix $usersdn $computersdn
36 $groupsdn $scope $binddn $bindpasswd
37 $slaveDN $slavePw $masterDN $masterPw
38 $_userLoginShell $_userHomePrefix $_userGecos
39 $_defaultUserGid $_defaultComputerGid
40 $_skeletonDir $_userSmbHome
41 $_userProfile $_userHomeDrive
42 $_userScript $usersou $computersou $groupsou
43 );
44
45 use Exporter;
46 $VERSION = 1.00;
47 @ISA = qw(Exporter);
48
49 @EXPORT = qw(
50 $UID_START $GID_START $smbpasswd $slaveLDAP $masterLDAP
51 $slavePort $masterPort $ldapSSL $slaveURI $masterURI $with_smbpasswd $mk_ntpasswd
52 $ldap_path $ldap_opts $ldapsearch $ldapsearchnobind $ldapmodify $ldappasswd
53 $ldapadd $ldapdelete $ldapmodrdn $suffix $usersdn
54 $computersdn $groupsdn $scope $binddn $bindpasswd
55 $slaveDN $slavePw $masterDN $masterPw
56 $_userLoginShell $_userHomePrefix $_userGecos
57 $_defaultUserGid $_defaultComputerGid $_skeletonDir 
58 $_userSmbHome $_userProfile $_userHomeDrive $_userScript
59 $usersou $computersou $groupsou
60 );
61
62
63 ##############################################################################
64 #
65 # General Configuration
66 #
67 ##############################################################################
68
69 #
70 # UID and GID starting at...
71 #
72
73 $UID_START = 1000;
74 $GID_START = 1000;
75
76 # Put your own SID
77 # to obtain this number do: # net getlocalsid
78 our $SID='S-1-5-21-636805976-1992644568-3666589737';
79
80 ##############################################################################
81 #
82 # LDAP Configuration
83 #
84 ##############################################################################
85
86 # Notes: to use to dual ldap servers backend for Samba, you must patch
87 # Samba with the dual-head patch from IDEALX. If not using this patch
88 # just use the same server for slaveLDAP and masterLDAP.
89 #
90 # Slave LDAP : needed for read operations
91 #
92 # Ex: $slaveLDAP = "127.0.0.1";
93 $slaveLDAP = "127.0.0.1";
94
95 $slavePort = "389";
96
97
98 # Master LDAP : needed for write operations
99 #
100 # Ex: $masterLDAP = "127.0.0.1";
101 $masterLDAP = "127.0.0.1";
102
103
104 #
105 # Master Port
106 # 389 636
107 # Ex: $masterPort = "
108 $masterPort = "389";
109
110 #
111 # Use SSL for LDAP
112 #
113 $ldapSSL = "0";
114
115 #
116 # LDAP Suffix
117 #
118 # Ex: $suffix = "dc=IDEALX,dc=ORG";
119 $suffix = "dc=IDEALX,dc=ORG";
120
121
122
123 # Where are stored Users
124 #
125 # Ex: $usersdn = "ou=Users,$suffix"; for ou=Users,dc=IDEALX,dc=ORG
126 $usersou = q(_USERS_);
127
128 $usersdn = "ou=$usersou,$suffix";
129
130
131 # Where are stored Computers
132 #
133 # Ex: $computersdn = "ou=Computers,$suffix"; for ou=Computers,dc=IDEALX,dc=ORG
134 $computersou = q(_COMPUTERS_);
135
136 $computersdn = "ou=$computersou,$suffix";
137
138
139 # Where are stored Groups
140
141 # Ex $groupsdn = "ou=Groups,$suffix"; for ou=Groups,dc=IDEALX,dc=ORG
142 $groupsou = q(_GROUPS_);
143
144 $groupsdn = "ou=$groupsou,$suffix";
145
146 #
147 # Default scope Used
148 #
149 $scope = "sub";
150
151 #
152 # Credential Configuration
153 #
154 # Bind DN used 
155 # Ex: $binddn = "cn=Manager,$suffix"; for cn=Manager,dc=IDEALX,dc=org
156 $binddn = "cn=Manager,$suffix";
157 #
158 # Bind DN passwd used
159 # Ex: $bindpasswd = 'secret'; for 'secret'
160 $bindpasswd = "secret";
161
162 #
163 # Notes: if using dual ldap patch, you can specify to different configuration
164 # By default, we will use the same DN (so it will work for standard Samba 
165 # release)
166 #
167 $slaveDN = $binddn;
168 $slavePw = $bindpasswd;
169 $masterDN = $binddn;
170 $masterPw = $bindpasswd;
171
172 ##############################################################################
173
174 # Unix Accounts Configuration
175
176 ##############################################################################
177
178 # Login defs
179 #
180 # Default Login Shell
181 #
182 # Ex: $_userLoginShell = q(/bin/bash);
183 $_userLoginShell = q(_LOGINSHELL_);
184
185 #
186 # Home directory prefix (without username)
187 #
188 #Ex: $_userHomePrefix = q(/home/);
189 $_userHomePrefix = q(_HOMEPREFIX_);
190
191 #
192 # Gecos
193 #
194 $_userGecos = q(System User);
195
196 #
197 # Default User (POSIX and Samba) GID
198 #
199 $_defaultUserGid = 100;
200
201 #
202 # Default Computer (Samba) GID
203 #
204 $_defaultComputerGid = 553;
205
206 #
207 # Skel dir
208 #
209 $_skeletonDir = q(/etc/skel);
210
211 ##############################################################################
212 #
213 # SAMBA Configuration
214 #
215 ##############################################################################
216
217 #
218 # The UNC path to home drives location without the username last extension
219 # (will be dynamically prepended)
220 # Ex: q(\\\\My-PDC-netbios-name\\homes) for \\My-PDC-netbios-name\homes
221 $_userSmbHome = q(\\\\_PDCNAME_\\homes);
222
223 #
224 # The UNC path to profiles locations without the username last extension
225 # (will be dynamically prepended)
226 # Ex: q(\\\\My-PDC-netbios-name\\profiles) for \\My-PDC-netbios-name\profiles
227 $_userProfile = q(\\\\_PDCNAME_\\profiles\\);
228
229
230 # The default Home Drive Letter mapping
231 # (will be automatically mapped at logon time if home directory exist)
232 # Ex: q(U:) for U:
233 $_userHomeDrive = q(_HOMEDRIVE_);
234
235 #
236 # The default user netlogon script name
237 # if not used, will be automatically username.cmd
238 #
239 #$_userScript = q(startup.cmd); # make sure script file is edited under dos
240
241
242 ##############################################################################
243 #
244 # SMBLDAP-TOOLS Configuration (default are ok for a RedHat)
245 #
246 ##############################################################################
247
248 # Allows not to use smbpasswd (if $with_smbpasswd == 0 in smbldap_conf.pm) but
249 # prefer mkntpwd... most of the time, it's a wise choice :-) 
250 $with_smbpasswd = 0;
251 $smbpasswd = "/usr/bin/smbpasswd";
252 $mk_ntpasswd = "/usr/local/sbin/mkntpwd";
253
254 if ( $ldapSSL eq "0" ) {
255         $slaveURI = "ldap://$slaveLDAP:$slavePort";
256         $masterURI = "ldap://$masterLDAP:$masterPort";
257 }
258 elsif ( $ldapSSL eq "1" ) {
259         $slaveURI = "ldaps://$slaveLDAP:$slavePort";
260         $masterURI = "ldaps://$masterLDAP:$masterPort";
261 }
262 else {
263         die "ldapSSL option must be either 0 or 1.\n";
264 }
265         
266
267 $ldap_path = "/usr/bin";
268 $ldap_opts = "-x";
269 $ldapsearch = "$ldap_path/ldapsearch $ldap_opts -H $slaveURI -D '$slaveDN' -w '$slavePw'";
270 $ldapsearchnobind = "$ldap_path/ldapsearch $ldap_opts -H $slaveURI";
271 $ldapmodify = "$ldap_path/ldapmodify $ldap_opts -H $masterURI -D '$masterDN' -w '$masterPw'";
272 $ldappasswd = "$ldap_path/ldappasswd $ldap_opts -H $masterURI -D '$masterDN' -w '$masterPw'";
273 $ldapadd = "$ldap_path/ldapadd $ldap_opts -H $masterURI -D '$masterDN' -w '$masterPw'";
274 $ldapdelete = "$ldap_path/ldapdelete $ldap_opts -H $masterURI -D '$masterDN' -w '$masterPw'";
275 $ldapmodrdn = "$ldap_path/ldapmodrdn $ldap_opts -H $masterURI -D '$masterDN' -w '$masterPw'";
276
277
278
279 1;
280
281 # - The End