-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsetup_ldap_centos.sh
More file actions
23 lines (19 loc) · 838 Bytes
/
setup_ldap_centos.sh
File metadata and controls
23 lines (19 loc) · 838 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
set -e
set -x
yum -y update
yum -y install openldap-servers openldap-clients openssh-server passwd
curl https://raw.github.com/timgreen/docker-ldap/master/slapd.conf.tpl > /dev/shm/slapd.conf.tpl
mkdir -p /dev/shm/scripts/
curl https://raw.github.com/timgreen/docker-ldap/master/scripts/config_ldap.sh > /dev/shm/scripts/config_ldap.sh
chmod +x /dev/shm/scripts/config_ldap.sh
curl https://raw.github.com/timgreen/docker-ldap/master/scripts/ldap_config > /dev/shm/scripts/ldap_config
ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ""
ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ""
echo root:123456 | chpasswd
cat > /run.sh << EOF
#!/bin/bash
[ -r /var/lib/ldap/DB_CONFIG ] && service slapd restart || echo "Edit /dev/shm/ldap_config & run /dev/shm/config_ldap.sh to setup."
/usr/sbin/sshd -D
EOF
chmod +x /run.sh