2015-04-14 15:45:16 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2015-04-14 20:55:19 +02:00
|
|
|
if ! [ -z "$TRAVIS" ]
|
|
|
|
then
|
|
|
|
DEBIAN_FRONTEND=noninteractive apt-get install ldap-utils slapd -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -f -q -y
|
|
|
|
DEBIAN_FRONTEND=noninteractive apt-get install lsb-base libattr1 -t wheezy -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -f -q -y
|
|
|
|
DEBIAN_FRONTEND=noninteractive apt-get install samba python-samba samba-vfs-modules -t wheezy-backports -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -f -q -y
|
|
|
|
else
|
|
|
|
DEBIAN_FRONTEND=noninteractive apt-get install ldap-utils slapd samba python-samba samba-vfs-modules -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -f -q -y
|
|
|
|
fi
|
2015-04-14 16:25:48 +02:00
|
|
|
|
2015-04-14 16:04:33 +02:00
|
|
|
rsync -a `dirname $0`/ /
|
2015-04-14 15:45:16 +02:00
|
|
|
cd `dirname $0`/../../
|
|
|
|
sudo sed -i "s%template_dir.*%template_dir = '`pwd`/resources/templates/'%" /etc/ldapcherry/ldapcherry.ini
|
|
|
|
sudo sed -i "s%tools.staticdir.dir.*%tools.staticdir.dir = '`pwd`/resources/static/'%" /etc/ldapcherry/ldapcherry.ini
|
|
|
|
|
2015-04-14 16:04:33 +02:00
|
|
|
chown -R openldap:openldap /etc/ldap/
|
2015-04-14 21:09:01 +02:00
|
|
|
rm /etc/ldap/slapd.d/cn\=config/*mdb*
|
2015-04-14 16:04:33 +02:00
|
|
|
/etc/init.d/slapd restart
|
2015-04-14 21:09:01 +02:00
|
|
|
ldapadd -H ldap://localhost:390 -x -D "cn=admin,dc=example,dc=org" -f /etc/ldap/content.ldif -w password
|
2015-04-14 17:33:31 +02:00
|
|
|
sed -i "s/\(127.0.0.1.*\)/\1 ldap.ldapcherry.org ad.ldapcherry.org/" /etc/hosts
|
|
|
|
|
|
|
|
|
2015-04-14 21:28:38 +02:00
|
|
|
mount -o remount,acl /
|
|
|
|
|
|
|
|
df -h
|
|
|
|
|
2015-04-14 17:33:31 +02:00
|
|
|
smbconffile=/etc/samba/smb.conf
|
|
|
|
domain=dc
|
|
|
|
realm=dc.ldapcherry.org
|
2015-04-14 21:09:01 +02:00
|
|
|
sambadns=SAMBA_INTERNAL
|
2015-04-14 17:33:31 +02:00
|
|
|
targetdir=/var/lib/samba/
|
|
|
|
role=dc
|
2015-04-14 21:09:01 +02:00
|
|
|
sambacmd=samba-tool
|
|
|
|
adpass=qwertyP455
|
|
|
|
|
2015-04-14 22:15:58 +02:00
|
|
|
echo "deploy AD"
|
2015-04-14 17:33:31 +02:00
|
|
|
printf '' > "${smbconffile}" && \
|
|
|
|
${sambacmd} domain provision ${hostip} \
|
|
|
|
--domain="${domain}" --realm="${realm}" --dns-backend="${sambadns}" \
|
|
|
|
--targetdir="${targetdir}" --workgroup="${domain}" --use-rfc2307 \
|
2015-04-14 22:15:58 +02:00
|
|
|
--configfile="${smbconffile}" --server-role="${role}" -d 1 --adminpass="${adpass}"
|
|
|
|
|
2015-04-14 17:33:31 +02:00
|
|
|
|
2015-04-14 22:15:58 +02:00
|
|
|
echo "Move configuration"
|
|
|
|
mv "${targetdir}/etc/smb.conf" "${smbconffile}"
|
|
|
|
|
|
|
|
mv /var/lib/samba/private/krb5.conf /etc/krb5.conf
|
|
|
|
|
|
|
|
|
2015-04-14 22:34:59 +02:00
|
|
|
sleep 5
|
|
|
|
if ! [ -z "$TRAVIS" ]
|
|
|
|
then
|
|
|
|
/usr/sbin/samba -D -s /etc/samba/smb.conf
|
|
|
|
/usr/sbin/smbd -D --option=server role check:inhibit=yes --foreground
|
|
|
|
else
|
|
|
|
sh -x /etc/init.d/samba start
|
|
|
|
sh -x /etc/init.d/samba-ad-dc start
|
|
|
|
sh -x /etc/init.d/smbd start
|
|
|
|
sh -x /etc/init.d/nmbd start
|
|
|
|
fi
|
2015-04-14 21:47:52 +02:00
|
|
|
|
|
|
|
sleep 5
|
2015-04-14 21:30:52 +02:00
|
|
|
|
|
|
|
netstat -apn
|