@@ -18,14 +18,22 @@ sudo apt-get -qy install slapd
1818sudo sed -i ' /^SLAPD_SERVICES/ c\SLAPD_SERVICES="ldap:/// ldapi:/// ldaps://"' /etc/default/slapd
1919sudo service slapd restart
2020
21- # Copy config template and replace variables.
2221CUR=$( cd " $( dirname " ${BASH_SOURCE[0]} " ) " ; pwd -P )
23- openldap_conf=$( mktemp /tmp/scapy_openldapconf_XXXXXX.ldif)
24- pkipath=$( realpath " $CUR /../../../test/scapy/layers/tls/pki" )
22+ PKIPATH=$( realpath " $CUR /../../../test/scapy/layers/tls/pki" )
23+ OLDAPPATH=$( mktemp -d -t scapy_openldap_XXXX)
24+
25+ # Copy certificates to temp path
26+ cp ${PKIPATH} /ca_cert.pem ${OLDAPPATH}
27+ cp ${PKIPATH} /srv_cert.pem ${OLDAPPATH}
28+ cp ${PKIPATH} /srv_key.pem ${OLDAPPATH}
29+ chmod a+rx -R ${OLDAPPATH}
30+
31+ # Copy config template and replace variables.
32+ openldap_conf=${OLDAPPATH} /openldap_config.ldif
2533cp $CUR /config.ldif $openldap_conf
26- sed -i " s@{{CAFILE}}@${pkipath } /ca_cert.pem@g" $openldap_conf
27- sed -i " s@{{CRTFILE}}@${pkipath } /srv_cert.pem@g" $openldap_conf
28- sed -i " s@{{KEYFILE}}@${pkipath } /srv_key.pem@g" $openldap_conf
34+ sed -i " s@{{CAFILE}}@${OLDAPPATH } /ca_cert.pem@g" $openldap_conf
35+ sed -i " s@{{CRTFILE}}@${OLDAPPATH } /srv_cert.pem@g" $openldap_conf
36+ sed -i " s@{{KEYFILE}}@${OLDAPPATH } /srv_key.pem@g" $openldap_conf
2937echo " Temporary config stored in $openldap_conf "
3038
3139sudo ldapmodify -Y EXTERNAL -H " ldapi:///" -w Bonjour1 -f $openldap_conf -c
0 commit comments