OpenLDAP: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
 
(30 intermediate revisions by the same user not shown)
Line 1: Line 1:
<source lang="bash">
<syntaxhighlight lang="bash">
apt update
apt update
apt list --upgradable
apt list --upgradable
apt install slapd ldap-utils
apt install slapd ldap-utils
</source>
</syntaxhighlight>


==Configure==
==Configure==
<source lang="bash">
<syntaxhighlight lang="bash">
ldapwhoami -H ldap:// -x
ldapwhoami -H ldap:// -x
dpkg-reconfigure slapd
dpkg-reconfigure slapd
ls -lah /var/backups/
ls -lah /var/backups/
</source>
</syntaxhighlight>


<source lang="bash" highlight="9,10" line>
<syntaxhighlight lang="bash" highlight="9,10" line>
cat > /etc/ldap/ldap.conf <<'EOF'
cat > /etc/ldap/ldap.conf <<'EOF'
#
#
Line 21: Line 21:
# This file should be world readable but not world writable.
# This file should be world readable but not world writable.


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


Line 31: Line 31:
TLS_CACERT      /etc/ssl/certs/ca-certificates.crt
TLS_CACERT      /etc/ssl/certs/ca-certificates.crt
EOF
EOF
</source>
</syntaxhighlight>


==phpLDAPadmin==
==phpLDAPadmin==
<source lang="bash">
<syntaxhighlight lang="bash">
apt install phpldapadmin
#apt install phpldapadmin
a2enmod proxy_fcgi setenvif
#a2enmod proxy_fcgi setenvif
a2enconf php7.3-fpm
#a2enconf php7.3-fpm
</source>


<source lang="bash">
cd /var/www/html/
git clone https://github.com/breisig/phpLDAPadmin.git
cp /var/www/html/phpLDAPadmin/config/config.php.example \
/var/www/html/phpLDAPadmin/config/config.php
</syntaxhighlight>
 
<syntaxhighlight lang="bash">
# phpldapadmin config update for localhost
# phpldapadmin config update for localhost
PHPC_FILE='/etc/phpldapadmin/config.php'
# PHPC_FILE='/etc/phpldapadmin/config.php'
PHPC_FILE='/var/www/html/phpLDAPadmin/config/config.php'


# ldap server name change (line 286)
# ldap server name change (line 286)
Line 54: Line 60:
sed -i "s@$LDAP_HOST_FIND.*@$LDAP_HOST_FILL@" "$PHPC_FILE"
sed -i "s@$LDAP_HOST_FIND.*@$LDAP_HOST_FILL@" "$PHPC_FILE"


# ldap server base chagne (line 300)
# ldap server base change (line 300)
LDAP_BASE_FIND="$servers->setValue('server','base',array('dc=example,dc=com'));"
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'));"
LDAP_BASE_FILL="$servers->setValue('server','base',array('dc=chorke,dc=org'));"
sed -i "s@$LDAP_BASE_FIND.*@$LDAP_BASE_FILL@" "$PHPC_FILE"
sed -i "s@$LDAP_BASE_FIND.*@$LDAP_BASE_FILL@" "$PHPC_FILE"


# ldap server base chagne (line 326)
# ldap server base change (line 326)
LDAP_BASE_FIND="$servers->setValue('login','bind_id','cn=admin,dc=example,dc=com');"
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');"
LDAP_BASE_FILL="$servers->setValue('login','bind_id','cn=admin,dc=chorke,dc=org');"
sed -i "s@$LDAP_BASE_FIND.*@$LDAP_BASE_FILL@" "$PHPC_FILE"
sed -i "s@$LDAP_BASE_FIND.*@$LDAP_BASE_FILL@" "$PHPC_FILE"
</source>
 
# ldap server warn change (line 161)
LDAP_WARN_FIND="$config->custom->appearance['hide_template_warning'] = false;"
LDAP_WARN_FILL="$config->custom->appearance['hide_template_warning'] = true;"
sed -i "s@$LDAP_WARN_FIND.*@$LDAP_WARN_FILL@" "$PHPC_FILE"
</syntaxhighlight>


==References==
==References==
* [https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-openldap-and-phpldapadmin-on-ubuntu-16-04 Install and Configure OpenLDAP and phpLDAPadmin on Ubuntu 16.04]
{|
* [https://tux-techie.com/2020/10/11/how-to-install-an-openldap-server-in-ubuntu-20-04-with-phpldapadmin/ Install an OpenLDAP Server in Ubuntu 20.04 with phpLDAPadmin]
|valign="top"|
* [https://benjamin-dronen.medium.com/installing-openldap-and-phpldapadmin-on-ubuntu-20-04-lts-7ef3ca40dc00 Install OpenLDAP and phpLDAPadmin on Ubuntu 20.04 LTS]
* [https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-openldap-and-phpldapadmin-on-ubuntu-16-04 LDAP » Ubuntu 16.04 » Install and Configure phpLDAPadmin]
* [[Build LDAP Docker Image from Ubuntu]]
* [https://benjamin-dronen.medium.com/installing-openldap-and-phpldapadmin-on-ubuntu-20-04-lts-7ef3ca40dc00 LDAP » Ubuntu 20.04 » Install and Configure phpLDAPadmin]
* [https://tux-techie.com/2020/10/11/how-to-install-an-openldap-server-in-ubuntu-20-04-with-phpldapadmin/ LDAP » Ubuntu 20.04 » TUX Techie » Install phpLDAPadmin]
* [https://www.digitalocean.com/community/tutorials/how-to-manage-and-use-ldap-servers-with-openldap-utilities LDAP » Manage & Use with OpenLDAP Utilities]
* [https://www.digitalocean.com/community/questions/fazer-downgrade-pho-7-3-para-7-0 LDAP » Fazer downgrade php 7.3 para 7.0]
* [[Build LDAP Docker Image from Ubuntu | LDAP » Build Docker Image from Ubuntu]]
* [https://dev.mysql.com/blog-archive/accessing-the-same-data-through-ldap-and-sql/ LDAP » MySQL Store & Fetch Data]
* [https://www.openldap.org/doc/admin24/guide.html LDAP » Administrator's Guide]
* [https://github.com/breisig/phpLDAPadmin LDAP » Clone phpLDAPadmin]
* [https://www.openldap.org/software/download/ LDAP » Download]
 
|valign="top"|
* [https://www.iana.org/requests/pfi6-atc-0y6/ LDAP » OID » Chorke, Org » Request]
* [https://www.iana.org/requests/pfho-zca-0q4/ LDAP » OID » Shahed, Inc » Request]
* [https://www.iana.org/requests/pfzm-gui-gno/ LDAP » OID » Chorke, Inc » Request]
* [https://www.iana.org/assignments/enterprise-numbers/?q=Chorke+Inc LDAP » OID » Chorke, Org » <code>61820</code>]
* [https://www.iana.org/assignments/enterprise-numbers/?q=Shahed+Inc LDAP » OID » Shahed, Inc » <code>61752</code>]
* [https://www.iana.org/assignments/enterprise-numbers/?q=Chorke    LDAP » OID » Chorke, Inc » <code>62865</code>]
* [https://www.iana.org/assignments/enterprise-numbers/assignment/apply/ LDAP » OID » Application]
* [http://www.oid-info.com/cgi-bin/display?tree LDAP » OID » Repository]
* [https://www.openldap.org/faq/data/cache/197.html LDAP » OID » Registry]
* [https://www.alvestrand.no/objectid/ LDAP » OID]
 
|valign="top"|
* [http://pen.iana.org/pen/PenApplication.page LDAP » Internet Assigned Numbers Authority]
* [https://www.openldap.org/software/release/changes_lts.html LDAP » 2.5.17 LTS Release Changes]
* [http://www.openldap.org/doc/admin24/schema.html#Extending%20Schema LDAP » Schema Specification]
* [http://www.oid-info.com/get/2.16.50 LDAP » OID » Bangladesh]
* [https://www.openldap.org/faq/data/cache/978.html LDAP » The SQL backend]
* [https://serverfault.com/questions/53574/ LDAP » Back SQL]
 
|-
|colspan="3"|
----
|-
|valign="top"|
* [[Private Enterprise Number]]
* [https://www.iana.org/protocols IANA » Protocol Registries]
* [https://www.iana.org/help/licensing-terms IANA » License]
* [[PostgreSQL]]
* [[MySQL]]
 
|valign="top"|
 
|valign="top"|
 
|}

Latest revision as of 19:28, 18 December 2024

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=chorke,dc=org
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

cd /var/www/html/
git clone https://github.com/breisig/phpLDAPadmin.git
cp /var/www/html/phpLDAPadmin/config/config.php.example \
/var/www/html/phpLDAPadmin/config/config.php
# phpldapadmin config update for localhost
# PHPC_FILE='/etc/phpldapadmin/config.php'
PHPC_FILE='/var/www/html/phpLDAPadmin/config/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 change (line 300)
LDAP_BASE_FIND="$servers->setValue('server','base',array('dc=example,dc=com'));"
LDAP_BASE_FILL="$servers->setValue('server','base',array('dc=chorke,dc=org'));"
sed -i "s@$LDAP_BASE_FIND.*@$LDAP_BASE_FILL@" "$PHPC_FILE"

# ldap server base change (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=chorke,dc=org');"
sed -i "s@$LDAP_BASE_FIND.*@$LDAP_BASE_FILL@" "$PHPC_FILE"

# ldap server warn change (line 161)
LDAP_WARN_FIND="$config->custom->appearance['hide_template_warning'] = false;"
LDAP_WARN_FILL="$config->custom->appearance['hide_template_warning'] = true;"
sed -i "s@$LDAP_WARN_FIND.*@$LDAP_WARN_FILL@" "$PHPC_FILE"

References