Difference between revisions of "Openldap: Instalasi"
Jump to navigation
Jump to search
Onnowpurbo (talk | contribs) |
Onnowpurbo (talk | contribs) |
||
| (4 intermediate revisions by the same user not shown) | |||
| Line 2: | Line 2: | ||
apt-get install slapd ldap-utils ldapscripts | apt-get install slapd ldap-utils ldapscripts | ||
| + | |||
| + | Masukan administrator password dalam proses instalasi. | ||
Instalasi CPAN LDAP untuk Webmin | Instalasi CPAN LDAP untuk Webmin | ||
apt-get install libconvert-asn1-perl libnet-ldap-perl | apt-get install libconvert-asn1-perl libnet-ldap-perl | ||
| + | |||
| + | Tambahkan beberapa schema | ||
| + | |||
| + | sudo ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/cosine.ldif | ||
| + | sudo ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/nis.ldif | ||
| + | sudo ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/inetorgperson.ldif | ||
| + | |||
| + | Edit backend.example.com.ldif | ||
| + | |||
| + | vi backend.example.com.ldif | ||
| + | |||
| + | # Load dynamic backend modules | ||
| + | dn: cn=module,cn=config | ||
| + | objectClass: olcModuleList | ||
| + | cn: module | ||
| + | olcModulepath: /usr/lib/ldap | ||
| + | olcModuleload: back_hdb | ||
| + | |||
| + | # Database settings | ||
| + | dn: olcDatabase=hdb,cn=config | ||
| + | objectClass: olcDatabaseConfig | ||
| + | objectClass: olcHdbConfig | ||
| + | olcDatabase: {1}hdb | ||
| + | olcSuffix: dc=example,dc=com | ||
| + | olcDbDirectory: /var/lib/ldap | ||
| + | olcRootDN: cn=admin,dc=example,dc=com | ||
| + | olcRootPW: secret | ||
| + | olcDbConfig: set_cachesize 0 2097152 0 | ||
| + | olcDbConfig: set_lk_max_objects 1500 | ||
| + | olcDbConfig: set_lk_max_locks 1500 | ||
| + | olcDbConfig: set_lk_max_lockers 1500 | ||
| + | olcDbIndex: objectClass eq | ||
| + | olcLastMod: TRUE | ||
| + | olcDbCheckpoint: 512 30 | ||
| + | olcAccess: to attrs=userPassword by dn="cn=admin,dc=example,dc=com" write by anonymous auth by self write by * none | ||
| + | olcAccess: to attrs=shadowLastChange by self write by * read | ||
| + | olcAccess: to dn.base="" by * read | ||
| + | olcAccess: to * by dn="cn=admin,dc=example,dc=com" write by * read | ||
| + | |||
| + | Ganti olcRootPW sesuai dengan password yang kita inginkan. Tambahkan ke LDAP | ||
| + | |||
| + | sudo ldapadd -Y EXTERNAL -H ldapi:/// -f backend.example.com.ldif | ||
| + | |||
| + | buat file frontend.example.com.ldif | ||
| + | |||
| + | vi frontend.example.com.ldif | ||
| + | |||
| + | Isi dengan | ||
| + | |||
| + | # Create top-level object in domain | ||
| + | dn: dc=example,dc=com | ||
| + | objectClass: top | ||
| + | objectClass: dcObject | ||
| + | objectclass: organization | ||
| + | o: Example Organization | ||
| + | dc: Example | ||
| + | description: LDAP Example | ||
| + | |||
| + | # Admin user. | ||
| + | dn: cn=admin,dc=example,dc=com | ||
| + | objectClass: simpleSecurityObject | ||
| + | objectClass: organizationalRole | ||
| + | cn: admin | ||
| + | description: LDAP administrator | ||
| + | userPassword: secret | ||
| + | |||
| + | dn: ou=people,dc=example,dc=com | ||
| + | objectClass: organizationalUnit | ||
| + | ou: people | ||
| + | |||
| + | dn: ou=groups,dc=example,dc=com | ||
| + | objectClass: organizationalUnit | ||
| + | ou: groups | ||
| + | |||
| + | dn: uid=john,ou=people,dc=example,dc=com | ||
| + | objectClass: inetOrgPerson | ||
| + | objectClass: posixAccount | ||
| + | objectClass: shadowAccount | ||
| + | uid: john | ||
| + | sn: Doe | ||
| + | givenName: John | ||
| + | cn: John Doe | ||
| + | displayName: John Doe | ||
| + | uidNumber: 1000 | ||
| + | gidNumber: 10000 | ||
| + | userPassword: password | ||
| + | gecos: John Doe | ||
| + | loginShell: /bin/bash | ||
| + | homeDirectory: /home/john | ||
| + | shadowExpire: -1 | ||
| + | shadowFlag: 0 | ||
| + | shadowWarning: 7 | ||
| + | shadowMin: 8 | ||
| + | shadowMax: 999999 | ||
| + | shadowLastChange: 10877 | ||
| + | mail: john.doe@example.com | ||
| + | postalCode: 31000 | ||
| + | l: Toulouse | ||
| + | o: Example | ||
| + | mobile: +33 (0)6 xx xx xx xx | ||
| + | homePhone: +33 (0)5 xx xx xx xx | ||
| + | title: System Administrator | ||
| + | postalAddress: | ||
| + | initials: JD | ||
| + | |||
| + | dn: cn=example,ou=groups,dc=example,dc=com | ||
| + | objectClass: posixGroup | ||
| + | cn: example | ||
| + | gidNumber: 10000 | ||
| + | |||
| + | Masukan ke LDAP | ||
| + | |||
| + | sudo ldapadd -x -D cn=admin,dc=example,dc=com -W -f frontend.example.com.ldif | ||
| + | |||
| + | ==Test LDAP== | ||
| + | |||
| + | ldapsearch -xLLL -b "dc=example,dc=com" uid=john sn givenName cn | ||
| + | |||
| + | Harusnya keluar | ||
| + | |||
| + | dn: uid=john,ou=people,dc=example,dc=com | ||
| + | sn: Doe | ||
| + | givenName: John | ||
| + | cn: John Doe | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ==Referensi== | ||
| + | |||
| + | * https://help.ubuntu.com/10.04/serverguide/C/openldap-server.html | ||
Latest revision as of 09:17, 6 June 2011
Instalasi
apt-get install slapd ldap-utils ldapscripts
Masukan administrator password dalam proses instalasi.
Instalasi CPAN LDAP untuk Webmin
apt-get install libconvert-asn1-perl libnet-ldap-perl
Tambahkan beberapa schema
sudo ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/cosine.ldif sudo ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/nis.ldif sudo ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/inetorgperson.ldif
Edit backend.example.com.ldif
vi backend.example.com.ldif
# Load dynamic backend modules
dn: cn=module,cn=config
objectClass: olcModuleList
cn: module
olcModulepath: /usr/lib/ldap
olcModuleload: back_hdb
# Database settings
dn: olcDatabase=hdb,cn=config
objectClass: olcDatabaseConfig
objectClass: olcHdbConfig
olcDatabase: {1}hdb
olcSuffix: dc=example,dc=com
olcDbDirectory: /var/lib/ldap
olcRootDN: cn=admin,dc=example,dc=com
olcRootPW: secret
olcDbConfig: set_cachesize 0 2097152 0
olcDbConfig: set_lk_max_objects 1500
olcDbConfig: set_lk_max_locks 1500
olcDbConfig: set_lk_max_lockers 1500
olcDbIndex: objectClass eq
olcLastMod: TRUE
olcDbCheckpoint: 512 30
olcAccess: to attrs=userPassword by dn="cn=admin,dc=example,dc=com" write by anonymous auth by self write by * none
olcAccess: to attrs=shadowLastChange by self write by * read
olcAccess: to dn.base="" by * read
olcAccess: to * by dn="cn=admin,dc=example,dc=com" write by * read
Ganti olcRootPW sesuai dengan password yang kita inginkan. Tambahkan ke LDAP
sudo ldapadd -Y EXTERNAL -H ldapi:/// -f backend.example.com.ldif
buat file frontend.example.com.ldif
vi frontend.example.com.ldif
Isi dengan
# Create top-level object in domain dn: dc=example,dc=com objectClass: top objectClass: dcObject objectclass: organization o: Example Organization dc: Example description: LDAP Example # Admin user. dn: cn=admin,dc=example,dc=com objectClass: simpleSecurityObject objectClass: organizationalRole cn: admin description: LDAP administrator userPassword: secret dn: ou=people,dc=example,dc=com objectClass: organizationalUnit ou: people dn: ou=groups,dc=example,dc=com objectClass: organizationalUnit ou: groups dn: uid=john,ou=people,dc=example,dc=com objectClass: inetOrgPerson objectClass: posixAccount objectClass: shadowAccount uid: john sn: Doe givenName: John cn: John Doe displayName: John Doe uidNumber: 1000 gidNumber: 10000 userPassword: password gecos: John Doe loginShell: /bin/bash homeDirectory: /home/john shadowExpire: -1 shadowFlag: 0 shadowWarning: 7 shadowMin: 8 shadowMax: 999999 shadowLastChange: 10877 mail: john.doe@example.com postalCode: 31000 l: Toulouse o: Example mobile: +33 (0)6 xx xx xx xx homePhone: +33 (0)5 xx xx xx xx title: System Administrator postalAddress: initials: JD dn: cn=example,ou=groups,dc=example,dc=com objectClass: posixGroup cn: example gidNumber: 10000
Masukan ke LDAP
sudo ldapadd -x -D cn=admin,dc=example,dc=com -W -f frontend.example.com.ldif
Test LDAP
ldapsearch -xLLL -b "dc=example,dc=com" uid=john sn givenName cn
Harusnya keluar
dn: uid=john,ou=people,dc=example,dc=com sn: Doe givenName: John cn: John Doe