LDAP authentication OpenLDAP OpenLdap 入門Client の設定 エントリーの登録
# apt-get install slapd ldap-utilsArch Linux
# pacman -S openldap # pacman -S phpldapadmin For Client
# pacman -S nss-pam-ldapd Samba LDAP 認証
# slappasswd New password: Re-enter new password: {SSHA}idXpCPakhhdw/rDcn3oLGDtZrexUwUN5
database bdb suffix "dc=example,dc=com" rootdn "cn=Manager,dc=example,dc=com" rootpw {SSHA}idXpCPakhhdw/rDcn3oLGDtZrexUwUN5
slaptestを実行して設定ファイルの有効性をチェックし、新しい設定ディレクトリを指定 # rm -rf /etc/openldap/slapd.d/* $ sudo -u ldap slaptest -f /etc/openldap/slapd.conf -F /etc/openldap/slapd.d
# cd /var/lib/openldap/openldap-data
# cp DB_CONFIG.example DB_CONFIG
# mkdir /run/openldap# chown -R ldap:ldap /etc/openldap
# chown ldap:ldap /run/openldap
# slaptest -u
config file testing succeeded
$ ldapsearch -x -b '' -s base '(objectclass=*)' namingContexts # extended LDIF # # LDAPv3 # base <> with scope baseObject # filter: (objectclass=*) # requesting: namingContexts # # dn: namingContexts: dc=example,dc=com # search result search: 2 result: 0 Success # numResponses: 2 # numEntries: 1 $
ldapsearch -x -b '' -s base '(objectclass=*)' -p 389 -h localhost namingContextsサーバーを指定
$ ldapsearch -H ldap://server -x -b '' -s base '(objectclass=*)' namingContexts $ ldapsearch -H ldap://server -D "cn=Manager,dc=example,dc=com" -w password uid=scott
lbe.sh を編集するphpLDAPadmin
CMD="/usr/bin/java -cp ${COMMON}:${EXEC}"設定
Version: 3
Base DN: dc=example,dc=com
/etc/php/php.ini
open_basedir = /var/www/:/var/tmp/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/:/etc/webapps extension=ldap.soログイン
Login DN:
cn=Manager,dc=example,dc=com
/usr/share/webapps/phpldapadmin/config/config.phpapachedirectorystudio$servers->setValue('server','base',array('dc=ramuda,dc=co,dc=jp')); $servers->setValue('login','bind_id','cn=admin,dc=ramuda,dc=co,dc=jp');
$ yaourt -Sb apachedirectorystudioログイン
user:
cn=Manager,dc=example,dc=com
base.ldifデータの削除$ ldapadd -D "cn=Manager,dc=example,dc=com" -w password -f base.ldif adding new entry "dc=example,dc=com" adding new entry "cn=Manager,dc=example,dc=com" adding new entry "ou=People,dc=example,dc=com" adding new entry "ou=Groups,dc=example,dc=com" adding new entry "ou=Staff,dc=example,dc=com" $
データの一括削除ldapdelete -x -D "cn=Manager,dc=example,dc=com" -w password \ "ou=Staff,dc=example,dc=com" # ldapdelete -x -D "cn=Manager,dc=example,dc=com" -w password \ "ou=People,dc=example,dc=com" # ldapdelete -x -D "cn=Manager,dc=example,dc=com" -w password \ "ou=Groups,dc=example,dc=com" # #ldapdelete -x -D "cn=Manager,dc=example,dc=com" -w password \ # "ou=Manager,dc=example,dc=com" # ldapdelete -x -D "cn=Manager,dc=example,dc=com" -w password \ "cn=Manager,dc=example,dc=com" # ldapdelete -x -D "cn=Manager,dc=example,dc=com" -w password \ "dc=example,dc=com" #
データの確認ldapdelete -x -D "cn=Manager,dc=example,dc=com" -w password \ -r "dc=example,dc=com"
$ ldapsearch -D "cn=Manager,dc=example,dc=com" -w password '(objectclass=*)' $ ldapsearch -D "cn=Manager,dc=example,dc=com" -w password cn=Manager $ ldapsearch -D "cn=Manager,dc=example,dc=com" -w password ou=Nankichildifの例
base_bb.ldif base_cc.ldif users_cc.ldif
include /etc/openldap/schema/core.schema include /etc/openldap/schema/cosine.schema include /etc/openldap/schema/nis.schema include /etc/openldap/schema/inetorgperson.schema
export
# slapcat > tmp01.ldifフィルター
awk '!/structuralObjectClass/{print $0}' | \import
awk '!/entryUUID/{print $0}' | \
awk '!/creatorsName/{print $0}' | \
awk '!/createTimestamp/{print $0}' | \
awk '!/entryCSN/{print $0}' | \
awk '!/modifiersName/{print $0}' | \
awk '!/modifyTimestamp/{print $0}'
$ ldapadd -x -D "cn=Manager,dc=example,dc=com" -w password -f ./tmp01.ldif
# slapadd -l /etc/openldap/schema/core.ldif