2 # Build a test environment for running Samba
12 if test -z "$SHARE_BACKEND"; then
16 if test -z "$SMBD_LOGLEVEL"; then
20 if test -z "$SERVER_ROLE"; then
21 SERVER_ROLE
="domain controller"
25 USERNAME
=administrator
26 REALM
=SAMBA.EXAMPLE.COM
27 DNSNAME
="samba.example.com"
28 BASEDN
="dc=samba,dc=example,dc=com"
34 if test -z "$ROOT"; then
37 if test -z "$ROOT"; then
42 srcdir
=`dirname $0`/..
/..
43 mkdir
-p $PREFIX ||
exit $?
48 TMPDIR
=$PREFIX_ABS/tmp
49 ETCDIR
=$PREFIX_ABS/etc
50 PIDDIR
=$PREFIX_ABS/pid
51 CONFFILE
=$ETCDIR/smb.conf
52 KRB5_CONFIG
=$ETCDIR/krb5.conf
53 PRIVATEDIR
=$PREFIX_ABS/private
54 NCALRPCDIR
=$PREFIX_ABS/ncalrpc
55 LOCKDIR
=$PREFIX_ABS/lockdir
57 WINBINDD_SOCKET_DIR
=$PREFIX_ABS/winbind_socket
58 CONFIGURATION
="--configfile=$CONFFILE"
59 LDAPDIR
=$PREFIX_ABS/ldap
62 mkdir
-p $PRIVATEDIR $ETCDIR $PIDDIR $NCALRPCDIR $LOCKDIR $TMPDIR $LDAPDIR/db
$LDAPDIR/db
/bdb-logs
$LDAPDIR/db
/tmp
66 netbios name = $NETBIOSNAME
67 netbios aliases = $SERVER
70 private dir = $PRIVATEDIR
71 pid directory = $PIDDIR
72 ncalrpc dir = $NCALRPCDIR
74 share backend = $SHARE_BACKEND
75 setup directory = $SRCDIR/setup
76 js include = $SRCDIR/scripting/libjs
77 winbindd socket directory = $WINBINDD_SOCKET_DIR
78 name resolve order = bcast
79 interfaces = 127.0.0.1/8
80 tls dh params file = $DHFILE
81 panic action = $SRCDIR/script/gdb_backtrace %PID% %PROG%
83 server role = $SERVER_ROLE
85 server max protocol = SMB2
86 notify:inotify = false
88 system:anonymous = true
89 #We don't want to pass our self-tests if the PAC code is wrong
90 gensec:require_pac = true
91 log level = $SMBD_LOGLEVEL
97 posix:sharedelay = 100000
98 posix:eadb = $LOCKDIR/eadb.tdb
103 cifs:server = $SERVER
104 cifs:user = $USERNAME
105 cifs:password = $PASSWORD
106 cifs:domain = $DOMAIN
112 ntvfs handler = simple
116 ntvfs handler = cifsposix
119 ## Override default share.ldb file
120 rm -f $PRIVATEDIR/share.ldb
121 cat >$PRIVATEDIR/share.ldif
<<EOF
129 name: CASE_INSENSITIVE
131 objectClass: CASE_INSENSITIVE
135 objectClass: organizationalUnit
138 ### Default IPC$ Share
139 dn: CN=IPC$,CN=Shares
151 ntvfs-handler: default
153 ### Default ADMIN$ Share
154 dn: CN=ADMIN$,CN=Shares
161 comment: Remote Admin
166 ntvfs-handler: default
175 comment: Temp Dir for Tests
178 posix-sharedelay: 100000
179 posix-eadb: $LOCKDIR/eadb.tdb
181 dn: CN=cifs,CN=Shares
191 cifs-password: $PASSWORD
196 $srcdir/bin
/ldbadd
-H $PRIVATEDIR/share.ldb
< $PRIVATEDIR/share.ldif
>/dev
/null ||
exit 1
198 .
`dirname $0`/mk-keyblobs.sh
200 cat >$KRB5_CONFIG<<EOF
201 #Generated krb5.conf for $REALM
204 default_realm = $REALM
205 dns_lookup_realm = false
206 dns_lookup_kdc = false
207 ticket_lifetime = 24h
213 admin_server = 127.0.0.1:88
214 default_domain = $DNSNAME
218 admin_server = 127.0.0.1:88
219 default_domain = $DNSNAME
223 admin_server = 127.0.0.1:88
224 default_domain = $DNSNAME
228 pkinit_anchors = FILE:$CAFILE
232 pkinit_identity = FILE:$KDCCERTFILE,$KEYFILE
233 pkinit_anchors = FILE:$CAFILE
239 #Ensure the config file is valid before we start
240 $srcdir/bin
/testparm
$CONFIGURATION -v --suppress-prompt >/dev
/null
2>&1 ||
{
242 echo "Failed to create configuration!" >&2
243 $srcdir/bin
/testparm
$CONFIGURATION >&2
247 ( $srcdir/bin
/testparm
$CONFIGURATION -v --suppress-prompt --parameter-name="netbios name" --section-name=global
2> /dev
/null |
grep -i ^
$NETBIOSNAME ) >/dev
/null
2>&1 ||
{
249 $srcdir/bin
/testparm
$CONFIGURATION -v --suppress-prompt --parameter-name="netbios name" --section-name=global
--suppress-prompt 2> /dev
/null |
grep -i ^
$NETBIOSNAME >&2
250 echo "Failed to create configuration!" >&2
254 PROVISION_OPTIONS
="$CONFIGURATION --host-name=$NETBIOSNAME --host-ip=127.0.0.1"
255 PROVISION_OPTIONS
="$PROVISION_OPTIONS --quiet --domain $DOMAIN --realm $REALM"
256 PROVISION_OPTIONS
="$PROVISION_OPTIONS --adminpass $PASSWORD --root=$ROOT"
257 PROVISION_OPTIONS
="$PROVISION_OPTIONS --simple-bind-dn=cn=Manager,$BASEDN --password=$PASSWORD --root=$ROOT"
258 $srcdir/bin
/smbscript
$srcdir/setup
/provision
$PROVISION_OPTIONS >&2
260 LDAP_URI
="ldapi://"`echo $LDAPDIR/ldapi | sed 's|/|%2F|g'`
262 .
`dirname $0`/mk-openldap.sh
264 test -z "$FEDORA_DS_PREFIX" ||
{
265 .
`dirname $0`/mk-fedora-ds.sh
268 cat >$PRIVATEDIR/wins_config.ldif
<<EOF
269 dn: name=TORTURE_6,CN=PARTNERS
270 objectClass: wreplPartner
278 $srcdir/bin
/ldbadd
-H $PRIVATEDIR/wins_config.ldb
< $PRIVATEDIR/wins_config.ldif
>/dev
/null ||
exit 1
280 echo "KRB5_CONFIG=$KRB5_CONFIG"
281 echo "PREFIX_ABS=$PREFIX_ABS"
282 echo "SLAPD_CONF=$SLAPD_CONF"
283 echo "PIDDIR=$PIDDIR"
284 echo "SERVER=$SERVER"
285 echo "NETBIOSNAME=$NETBIOSNAME"
286 echo "LDAP_URI=$LDAP_URI"
287 echo "DOMAIN=$DOMAIN"
288 echo "USERNAME=$USERNAME"
290 echo "DNSNAME=$DNSNAME"
291 echo "BASEDN=$BASEDN"
292 echo "PASSWORD=$PASSWORD"
293 echo "SRCDIR=$SRCDIR"
294 echo "PREFIX=$PREFIX"
295 echo "LDAPDIR=$LDAPDIR"
296 echo "CONFFILE=$CONFFILE"
297 echo "PROVISION_OPTIONS=$PROVISION_OPTIONS"
298 echo "PROVISION_ACI=$PROVISION_ACI"
299 echo "WINBINDD_SOCKET_DIR=$WINBINDD_SOCKET_DIR"
300 echo "NCALRPCDIR=$NCALRPCDIR"
301 echo "CONFIGURATION=$CONFIGURATION"