OpenLDAP: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
Line 38: Line 38:
a2enmod proxy_fcgi setenvif
a2enmod proxy_fcgi setenvif
a2enconf php7.3-fpm
a2enconf php7.3-fpm
</source>
<source lang="bash">
# phpldapadmin config update for localhost
PHPC_FILE='/etc/phpldapadmin/config.php'
# ldap server name change (line 286)
LDAP_NAME_FIND="$servers->setValue('server','name','My LDAP Server');"
LDAP_NAME_FILL="$servers->setValue('server','name','CK LDAP Server');"
sed -i "s@$LDAP_NAME_FIND.*@$LDAP_NAME_FILL@" "$PHPC_FILE"
# ldap server host change (line 293)
LDAP_HOST_FIND="$servers->setValue('server','host','127.0.0.1');"
LDAP_HOST_FILL="$servers->setValue('server','host','127.0.0.1');"
sed -i "s@$LDAP_HOST_FIND.*@$LDAP_HOST_FILL@" "$PHPC_FILE"
# ldap server base chagne (line 300)
LDAP_BASE_FIND="$servers->setValue('server','base',array('dc=example,dc=com'));"
LDAP_BASE_FILL="$servers->setValue('server','base',array('dc=dev,dc=shahed,dc=biz'));"
sed -i "s@$LDAP_BASE_FIND.*@$LDAP_BASE_FILL@" "$PHPC_FILE"
# ldap server base chagne (line 326)
LDAP_BASE_FIND="$servers->setValue('login','bind_id','cn=admin,dc=example,dc=com');"
LDAP_BASE_FILL="$servers->setValue('login','bind_id','cn=admin,dc=dev,dc=shahed,dc=biz');"
sed -i "s@$LDAP_BASE_FIND.*@$LDAP_BASE_FILL@" "$PHPC_FILE"
</source>
</source>



Revision as of 20:47, 27 February 2021

apt update
apt list --upgradable
apt install slapd ldap-utils

Configure

ldapwhoami -H ldap:// -x
dpkg-reconfigure slapd
ls -lah /var/backups/
cat > /etc/ldap/ldap.conf <<'EOF'
#
# LDAP Defaults
#

# See ldap.conf(5) for details
# This file should be world readable but not world writable.

BASE   dc=dev,dc=shahed,dc=biz
URI    ldap://localhost ldap://localhost:666

#SIZELIMIT      12
#TIMELIMIT      15
#DEREF          never

# TLS certificates (needed for GnuTLS)
TLS_CACERT      /etc/ssl/certs/ca-certificates.crt
EOF

phpLDAPadmin

apt install phpldapadmin
a2enmod proxy_fcgi setenvif
a2enconf php7.3-fpm
# phpldapadmin config update for localhost
PHPC_FILE='/etc/phpldapadmin/config.php'

# ldap server name change (line 286)
LDAP_NAME_FIND="$servers->setValue('server','name','My LDAP Server');"
LDAP_NAME_FILL="$servers->setValue('server','name','CK LDAP Server');"
sed -i "s@$LDAP_NAME_FIND.*@$LDAP_NAME_FILL@" "$PHPC_FILE"

# ldap server host change (line 293)
LDAP_HOST_FIND="$servers->setValue('server','host','127.0.0.1');"
LDAP_HOST_FILL="$servers->setValue('server','host','127.0.0.1');"
sed -i "s@$LDAP_HOST_FIND.*@$LDAP_HOST_FILL@" "$PHPC_FILE"

# ldap server base chagne (line 300)
LDAP_BASE_FIND="$servers->setValue('server','base',array('dc=example,dc=com'));"
LDAP_BASE_FILL="$servers->setValue('server','base',array('dc=dev,dc=shahed,dc=biz'));"
sed -i "s@$LDAP_BASE_FIND.*@$LDAP_BASE_FILL@" "$PHPC_FILE"

# ldap server base chagne (line 326)
LDAP_BASE_FIND="$servers->setValue('login','bind_id','cn=admin,dc=example,dc=com');"
LDAP_BASE_FILL="$servers->setValue('login','bind_id','cn=admin,dc=dev,dc=shahed,dc=biz');"
sed -i "s@$LDAP_BASE_FIND.*@$LDAP_BASE_FILL@" "$PHPC_FILE"

References