-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstart.sh
executable file
·56 lines (43 loc) · 2.29 KB
/
start.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/sh
printf "\n======== stop the running env ========\n\n"
rm -rf .keytabs && mkdir .keytabs;
docker-compose down -v;
sleep 20;
printf "\n======== build and run docker images ========\n\n"
docker-compose build;
docker-compose up -d;
printf "\n======== wait for ldap and kerberos sync ========\n\n"
# increase the time out if ldap and kerberos are getting connected in 1 min
sleep 60;
printf "\n======== indexing the LDAP user with Kerberos ========\n\n"
## index ldap user
docker exec -ti kerberos kadmin.local -q "addprinc -pw password -x dn=uid=alice,ou=People,dc=example,dc=com alice"
docker exec -ti kerberos kadmin.local -q "addprinc -pw password -x dn=uid=bob,ou=People,dc=example,dc=com bob"
docker exec -ti kerberos kadmin.local -q "addprinc -pw password -x dn=uid=dhrn,ou=People,dc=example,dc=com dhrn"
docker exec -ti kerberos kadmin.local -q "addprinc -pw password -x dn=uid=administrator,ou=People,dc=example,dc=com administrator"
printf "\n======== create kerberos principles for server ========\n\n"
# Add principles for Alfresco and generate keytab
docker exec -ti kerberos kadmin.local -q "addprinc -pw password -x dn=uid=httpexample,ou=People,dc=example,dc=com HTTP/[email protected]"
docker exec -ti kerberos kadmin.local -q "ktadd -k example.keytab HTTP/[email protected]"
printf "\n======== available principles in the kerberos ========\n\n"
docker exec -ti kerberos kadmin.local -q "list_principals"
printf "\n======== configure the Alfresco with Kerberos ========\n\n"
KERBEROS=$(docker-compose ps -q kerberos);
ALFRESCO=$(docker-compose ps -q alfresco);
SHARE=$(docker-compose ps -q share);
PROCESS=$(docker-compose ps -q process);
docker cp ${KERBEROS}:/example.keytab .keytabs
chmod 777 .keytabs/example.keytab
docker cp .keytabs/example.keytab ${ALFRESCO}:/etc/alfresco.keytab
#docker cp .keytabs/example.keytab ${SHARE}:/etc/share.keytab
docker cp .keytabs/example.keytab ${PROCESS}:/etc/process.keytab
docker-compose restart alfresco
#docker-compose restart share
docker-compose restart process
printf "\n======== kerberos configuration is over ======== \n\n"
printf "usefull commands :\n"
printf " docker logs -f process \n"
printf " docker logs -f alfresco \n"
printf " docker exec -it process sh \n"
printf " docker exec -it alfresco sh \n"
printf "\n======== completed ========\n\n"