7 Haziran 2016 Salı

Pardus üzerine OpenLDAP kurulumu


Pardus LDAP Kurulumu

Kurulum sırasında kullanılan IP adresi 192.168.0.100, hostname server1.example.com olarak anlatılmaktadır.

Not:Kurulum sırasında verilen bütün komutlar root yetkisi verilerek çalıştırılmalıdır.

OpenLDAP

Open LDAP kurmak için aşağıdaki komutlar çalıştırılmalıdır.

# apt-get install update
# apt-get install slapd ldap-utils

Gelen ekranda admin şifrenizi giriniz.

OpenLDAP Konfigürasyonu

OpenLDAP sunucusunu uygun hale getirmek için konfigürasyon dosyasında aşağıda kalın harflerle yazılı olan yerleri değiştirmemiz gerekmektedir.

# nano /etc/ldap/ldap.conf

[...]
# This file should be world readable but not world writable.

BASE dc=example,dc=com

#SIZELIMIT 12
[...]

Dosyayı kaydedip kapattıktan sonra LDAP paketini düzenlemek için aşağıdaki komut çalıştırılmalıdır.
# dpkg-reconfigure slapd

Soracağı sorulara vermeniz gereken cevaplar:

-If you enable this option, no initial configuration or database will be created for you.
Omit OpenLDAP server configuration ?
No

-The DNS domain name is used to construct the base DN of the LDAP directory. For example, 'foo.example.org' will create the directory with 'dc=foo, dc=example, dc=org' as base DN
DNS domain name:
Ok

-Please enter the name of the organization to use in the base DN of your LDPA directory.

Organizaton name:
Herhangi bir isim yazıp Ok seçiniz.

-Please enter the password for the admin entry in your LDAP directory.

Administrator password:
Admin şifresini yazıp Ok seçiniz.
-Please enter the admin password for your LDAP directory again to verify that you have typed it correctly.

Confirm password:
Şifreyi doğrulayıp Ok seçiniz.

-The HDB backend is recommended. HDB and BDB use similar storage formats, but HDB adds support for subtree renames. Both support the same configuration options.

In either case, you should review the resulting database configuration for your needs. See /usr/share/doc/slapd/README.DB_CONFIG.gz for more details.

Database backend to use:
HDB seçiniz.

-Do you want the database to be removed when slapd is purged ?
Yes

-There are still files in /var/lib/ldap which will probably break the configuration process. If you enable this option, the maintainer scripts will move the old database files out of the way before creating a new database.
Yes
-The obsolete LAPv2 protocol is disabled by default in slapd. Programs and users should upgrade to LDAPv3. If you have old programs which can't use LDAPv3, you should select this option and 'allow bind_v2' will be added to your slapd.conf file.

Allow LDAPv2 protocol ?
No


Not: Kurulumdan sonra aşağıdaki komutu çalıştırarak herhangi bir sorun olup olmadığını kontrol edebilirsiniz.

# ldapsearch -x

Örnek output:

root@server1:~# ldapsearch -x
# extended LDIF
#
# LDAPv3
# base <dc=example,dc=com> (default) with scope subtree
# filter: (objectclass=*)
# requesting: ALL
#

# example.com
dn: dc=example,dc=com
objectClass: top
objectClass: dcObject
objectClass: organization
o: Test-company
dc: example

# admin, example.com
dn: cn=admin,dc=example,dc=com
objectClass: simpleSecurityObject
objectClass: organizationalRole
cn: admin
description: LDAP administrator

# search result
search: 2
result: 0 Success

# numResponses: 3
# numEntries: 2
root@server1:~#

phpLDAPadmin Kurulumu

OpenLDAP uçbirimden kontrol edilebilir fakat phpLDAPadmin kurmak bu işi kolaylaştırır. İlk önce makinede apache sunucusu ve php kurulu olması gerekiyor ardından kurulum başlayacak.

# apt-get install apache2 php5 php5-mysql

# apt-get install phpldapadmin

phpLDAPadmin'in sunucuya uygun hale gelmesi için /etc/phpldapadmin/config.php dosyasını aşağıdaki şekilde düzenlemeniz gerekiyor:

[...]
$servers = new Datastore();
$servers->newServer('ldap_pla');
$servers->setValue('server','name','Test-company LDAP');
$servers->setValue('server','host','127.0.0.1');
$servers->setValue('server','base',array('dc=example,dc=com'));
$servers->setValue('login','bind_id','cn=admin,dc=example,dc=com');
?>

Not: 'Test-company LDAP' yerine kurulum sırasında seçtiğiniz company name yazılması gerekiyor.

Her şey tamamladıktan sonra herhangi bir web tarayıcısından http://192.168.0.100/phpldapadmin linkini açıp phpLDAPadmin sayfasına ulaşabilirsiniz.

Hiç yorum yok:

Yorum Gönder