You are on page 1of 21

����������.

� ��������� ����� ��� ����������������� ������� ����� ����� ������������ �������


LDAP. �� ������������ �� ������� �� ��� ����������� ���, � ������������ ��
����������
IMHO ����� ���������. ������ ������ ���������� �� ������ �������� ����������
��������� ������� openldap � �������������� ��� � ��� ������������� ��������
���������.

��������.

��� ����������������� ���� �� ������̣���� ����� ��������� ��������


����������������� �������� ��������������. ��� �������� ��������� ��� �������
�����(100 � ����� �������������). ������ ������������ ���������� ������� �
����� �������� ���� ��������� Novell Netware ��� ������������ ������� ��� ������
NIS, ���� ���� �������� �� *nix �������, ��� ������ �������� �����.
� Netware (������ 4 � ������) ���������� ����� ��������� �������� NDS(������
���������� Novell), ����������� ������� ������ ������ ����, � �������
������ ��������� ���� �������� �������� ������ ����������. ���‫�ޣ‬
������ ������ �������� ������̣����� ����������� ���
��� �������������. ��������, ������ ������������ ����� �� ���, �������,
�����, ��������� ���������, ������ ��� ����� � �������. ������ ������������
�������� ������̣����� �������, ��������� �� ������� ����������� �� ���� ������,
������� ������ ������������ �����������. ��� ����� � ������� ���������,
������������ �������� ������ ������ � "�����" ������. ��� ���� ���� �������
��������� ����� ���������� �� ���������� ��������. �������, ����� ����� �����
������� � ����� �������� ������������, �� � ������� ����� �� � �������� ����:
������ ����������, ���������� � TCP/IP ����� - LDAP (Lightweight Directory
Access Protocol). ���������� LDAP ������� �� �������ģ����� ���������
X.500, ���������������� ��� ������������� � ������� ������ OSI. ����
�������� ��� ���������� � TCP/IP ����, ������ � ���������� ICMP, ��
��������������� ���� �������� ������ � ��������� �����. ���������� ������
����� L � ��������� �� ��� ����, ��� ��������: ������ ������ ��������
�������� ��������� ����������� � ����� ����� �� �������������.

������ � ������������.
������ � *nix ������������ ������ ���� ����������� ����������������
�������������� - ������ NIS, ���������� ����� UDP. LDAP �������� ��
��������-���������������� �������� � ��������� � ̣������� ��������� � ��������
������� ��� ������ ������ ����. ����� ����� LDAP �������� �������� ������������
� ����� ������������������� � ������ � ��������� ��������� ���������.
��������� ���������� ������������ LDAP ����� PAM, �� �� ���� �����. ��
������ LDAP ����� ��������� ������������ ����, ����� �����, ���������� ��
�������� �������� � ����������� ����. ��������, ��� ��� ����� ��������� ������
��� ������� �����������, ������������ �� ���������� ������� � ��������� �������:
************************�������*************************************************
(���. 1)

����� ����� ����� �� ������������ � ������������, ��������� � ������ ����������:


�(ountry) - ������
ST(ate) - ��� �������, ������� ��� �����
L(ocation) - ��� ������, ��ӣ���, �������
O(rganization) - ��� ��������
O(rganizational)U(nit) - ������ ��������
������ ������� ������ �������� �����������������, �.�. �������� ������������ ���
������ �������� � ����� ������������ ����� ������̣����� �������, ��������, �
������ ��������. �� ������ ����������������� �������� ������ �������� ������
���������. ����� ������� ������� ������������ ������ root(� ����� ���!), �� ����
���������� ��������� �������, ������ ������� � ����������� ����������
�������-������ ������. ���� ����������� ���� ������, �� ���������
�������-���������� ����� ������ ���� �����, � ������� ������� - ���� �������.
������ ����������� ��������� ����� ��������� ����������� �� ��������� �
��������(/etc/passwd), �.�. ��������� ����� ���������� ���������� ������������
��� ����� �������. /etc/passw������ ���������� ��������� ������ ��������
�������. ��� ����������� ������� ��������(+�����) ������� ������������ �������
������ ������������ ������ DN(distinguished name - ����������� ���, ��������). ��
����
��������� ��������� �������� ������ � ������� � ��������...

����� ��������� ������� slapd.


��� ��� ����� ����������: ���������� �������. � �����������
OpenLDAP � �ӣ ������������� ��������� ������ � ������� ������ LDAP. ��� ������
���������� ����� ��������� ����(� ����������� ��������� �� �������, � �� ��
������; ��������� �� ������ ����� �� ������ ������� �����������, �� � ���� ����
������ �� ����):
* ���������� LDAP
* ������ LDAP(slapd)
* pam_ldap � nss_ldap ��� �������������� ����� LDAP

����� ���� ���� ��������� ������ �� ������ � ����� ������ ���������. ���������
���� ������������ /etc/[open]ldap/slapd.conf(��� ��������� �� ����������
/usr/local/etc/openldap)
�� �������� �������������� ���������:

# ��������� ���� ������������ ������� slapd.conf

include /usr/share/openldap/schema/core.schema
include /usr/share/openldap/schema/cosine.schema
include /usr/share/openldap/schema/corba.schema
include /usr/share/openldap/schema/inetorgperson.schema
include /usr/share/openldap/schema/java.schema
include /usr/share/openldap/schema/krb5-kdc.schema
include /usr/share/openldap/schema/kerberosobject.schema
include /usr/share/openldap/schema/misc.schema
include /usr/share/openldap/schema/nis.schema
include /usr/share/openldap/schema/openldap.schema
# �������� ������� ����������� �������� ���������� � �������������� ������
# ��������, ����� ����
# �������� ����, ����������� ����� ������� � ��:
include /etc/openldap/slapd.access.conf
# ����������� �����, ����������� ��� ������ ������: ���� �������������� �
# ��������� ������
pidfile /var/run/ldap/slapd.pid
argsfile /var/run/ldap/slapd.args
# ���� � �������������� ������� �������
modulepath /usr/lib/openldap
# ��������� ��������� ���������� ����� SSL
# ���� ��� ���������� �������������� SASL
sasl-host localhost

# ���� �� ������ ��������� ���������� ����� TLS �� ������� ����������� ��


# ��������� ����� (� ������ ������� �� ����)
#TLSRandFile /dev/random
#TLSCipherSuite HIGH:+SSLv2
#TLSCertificateFile /etc/openldap/ldap.pem
#TLSCertificateKeyFile /etc/openldap/ldap.pem
# ���� � ����� �����
#TLSCACertificatePath /etc/openldap/
#TLSCACertificateFile /etc/openldap/ldap.pem
# ���� � ����������� �����
#TLSVerifyClient 0
# �������� ����� �������

#######################################################################
# ����� ������� - �������� ���� ������ LDAP
#######################################################################

database ldbm
# ��� ���� ������ ldbm
suffix "dc=test,dc=ru"
#suffix "o=My Organization Name,c=US"
# ��� �������� ������� ��. � ����������� ������� ���������� ���������� ���
# ���������� �������� ������ root. ������� ���������� ���� ������. ������
# ���������� 2 ��������� LDAP ���� ��� ������� ������: ����� ��� ����������
# ����� � ���������. ������ ����� �������� ��� � ��������� URL �����:
# person.domain.com(cn=person,dc=domain,dc=com), � ������ ���������
# �����������(������-�� ���� ��� �������� �����������) � ����� ��������� ���:
# person.organization_unit.organization.country(cn=person,ou=otd1,o=lab,c=RU)
# ����� ������ ������� �� ����������� ���������� LDAP � ������� �������� �� �����
# � ������ ������ � ����������� ��������-������������ ��� ���������, �� ������ �
# ��������� �ӣ �� ���� ����������� ������ ������ ���������� ������� ������.
rootdn "cn=admin,dc=test,dc=ru"
#rootdn "cn=Manager,o=My Organization Name,c=RU"

# ��� ���� �������� ������ �������������� ������� root(�� ���� ���� �� LDAP).
# ������ ����� ��������� ��� � �������� ���� (�� �������������!), ��� � �
# ������������� ���� � ��������� ��������� ���������� ({crypt}, {MD5}, {SSHA},
# {crypt}, {SMD5}, {SHA}) ������
# ���������� ������������� ���������� slappasswd, ����������� ���������� ������
# �������� ����������
rootpw secret
# rootpw {crypt}ijFYNcSNctBYg

# �����, ��� �������� ���� ������ LDAP. ��� ����� ������ ������������ �� �������
# LDAP, ������� ����� �� ����������. ����� ������ ���� �������� ��� ������ �
# ������ ������ ������������, ��� ������� �������� slapd, � ����� ����� �������
# 700
directory /var/lib/ldap

# ����������� ��������� � ��������� �������� �� ����� �������� ����� �� ��


#index objectClass eq
index objectClass,uid,uidNumber,gidNumber eq
index cn,mail,surname,givenname eq,subinitial

# ����� ������� �� ���������


access to attr=userPassword
by self write
by anonymous auth
by dn="uid=root,dc=test,dc=ru" write
by * none
# ����� ������������ ������ � �������� ������ ������������. ��� ������������ �����
�����
# ������, ���������� ������������ ��������������� ����������� ������
# �������������� (����� ����� �� ������������ ��� ������ ������ � ������� �
# ������� ���������� ������������ �� ����������, ��� ����� ���� �� ��������) �
# ������������ � ����������
# "uid=root,ou=people,dc=test,dc=ru" ����� ����� �� ������. ������ ��
# ������������ ������� � ������ �� ����� ��������. �.�. ������� ������� �����,
# ����� �������������� � ������ ������������ �� ����� ������� � ������

access to *
by dn="uid=root,dc=test,dc=ru" write
by * read
# ������ � ��������� ����� ���� LDAP - ��� ����� ������ ��������(����� ������,
# ��� ��� ������ ����� ����� ������� ���������), � ������������ � ����������
# root ����� ������ �ӣ ��� ������ (� ��� � ��� �������� :)

������ ���������� �������������, ������� �������� ��� �������� �� � ‫�ޣ‬. �������

�‫��� ��������� �������������� ��������� ݣ ��� � ���� ����� ����� �ݣ‬


�������������� ���������� �������� (������), � ��������� �������� ������,
��������� �������, ������ ������� � ��� �.�.�. �� ��� ��� ������ ����. �
�������� ���������� ������� 3 ����: ���������� ������� �� � ������� ���
��������� (���������� ���� ��� �����������); ������� �������� ��������������
LDAP; ���������� ������ �������������� LDAP � ������� ��������� slappasswd.
����� ���������� �������� ���������� ������ ���������� ��������� slappasswd ���:
slappasswd -h {��������_����������}, ������ � ��������� {}, �������� slappasswd
-h {crypt} ��� slappasswd -h {md5}.\

��� � �ӣ: ������ ����� ���� ������ �������� ��������! �� ����� ���� �� ����
��������: ���� �� �� �������� ��������. ������ � ��������, ��� ��������� ����
������ LDAP � ��������� �������������� ����� �ţ.

�������� ���� ������.


��� �������������� ��������� ������� ���� �� ��������� ����� ��������� ������ ���
�������� ���� ������ (� ��������� ����������� �������� #, �� � �������� ����� ����

������������ ���� �� ������!):

dn: dc=test,dc=ru
# ���������� �������� �����
objectclass: dcObject
# ����� ������� - ������������ ������
objectclass: organization
# ��� �� ����� �������� ����� ������������ ����� ��������� �������
o: test
# ��� �����������
dc: test
# �� �� �����, �� � ������� ���������� � �
# ----------------------------------------------------------------------
dn: cn=admin,dc=test,dc=ru
# �������� ��������������
objectclass: organizationalRole
# ����� - ����������� ����
cn: admin
# ��� �������� (���������)
#-----------------------------------------------------------------------
dn: ou=users,dc=test,dc=ru
# �������� ������ �������������
ou: users
# �������� ������
objectclass: top

objectclass: organizationalUnit
# ����� ������
#------------------------------------------------------------------------
dn: uid=null,ou=users,dc=test,dc=ru
# �������� ����������� ������������ �� /etc/passwd
uid: null
# ��� ���������������� ���������
cn: Neo
# �������� ���������
objectclass: account
# ����� ���������������� �������
objectclass: posixAccount
# ����� ������������ POSIX
objectclass: top

objectclass: uidObject
# ����� ������ �������� - zsh!
loginshell: /bin/zsh
# ��� ��������� ��������� ��������� � ������������ � /etc/passwd
uidnumber: 1000

gidnumber: 1000

homedirectory: /home/null

gecos: Neo

userpassword: $1$abcdvPbaLa6vs4ABab1N

�������, �����, �����, �ӣ �������. �� ���� ���� � ��� ������� ��� ����������� �
���������� ������� 8*10^10 �������������, �� ����� ������� ���������� �ӣ ���
������
������������ ;) ������� �� ������ ������������� ���� ����� openldap-migration,
���������� ����� �������� ��� �������� ������������ ������ � ��� ������� ����� �
LDAP. ���� ��� ���, �� ���������� �����: http://www.padl.com. ������ �����
������������ �� ���� ����� �������� �� �����, �������������� ���������������
����� � ������ (/etc/passwd(+shadow), /etc/hosts, /etc/profile, /etc/services,
NIS ������). ������������� �������� ��������� ������. ������� ���� ���������
���� /usr/share/openldap/migration/migrate_common.ph:
# �������� ����� �� ���������
$DEFAULT_MAIL_DOMAIN = "test.ru";
# ��� ��������� ������� LDAP
$DEFAULT_BASE = "dc=test,dc=ru";
# ���� ��� ��ɣ��/�������� ����� �� ���������
$DEFAULT_MAIL_HOST = "mail.test.ru";
# ���������� ����������� ����� ����
$EXTENDED_SCHEMA = 1;

����� ��������� migrate_base.pl > base.ldif ��� �������� ��������� ���� LDAP.
��� ���������� ������� ����� � ���� ����� ������������ ��������� ���������:
ldapadd -x -D "cn=root,dc=test,dc=ru" -W -f base.ldif
��� ��
slapadd -f base.ldif ��� ���������� ������ � ������ offline. ������ ������
�����, ��� ��� ��������� ��������� ������ LDAP � ����(���������� ������������
TCP ������).

����� ��������� �������� ����, ��� ����� ��������� � LDAP, ��������:


./migrate_hosts.pl /etc/hosts hosts.ldif
���� hosts.ldif ����� ��������� �������� ��������� (� ����� /etc/hosts ����
192.168.1.23 work.test.ru work ):
dn: cn=work.test.ru,ou=Hosts,dc=test,dc=ru
objectClass: top
objectClass: ipHost
objectClass: device
ipHostNumber: 192.168.1.23
cn: work.test.ru
cn: work
������, �� ��� ��? ����� ��������� �������� �� ����, ��� ���� ��� ��������
������� (����� � ������, � ����� ������, ��������! ��� ��� ���� ����). ������, ���
�‫����� � �ݣ � ޣ‬: ��� �������� /etc/passwd ����� ���������� ����������
��������� ETC_SHADOW:
root@ldap # ETC_SHADOW=/etc/shadow ./migrate_passwd.pl /etc/passwd passwd.ldif
� �‫ ����� ��������� ��������� �� ݣ‬.ldiff � ���� � ������� ldapadd!

���� ����� ����� ������ ��� �������, �� ����� ��������� ���� �� ���-��������
migrate_all_[on|off]line, ������� ��������� ��������� ��� ������������
����������� ���������������� ����� � LDAP � ������������� ������.

�� ���, ���� �������, ���� �� ţ ���������. ������ � ��� ������� � ��������


���������, ������ ����������:
ldapsearch -LL -H ldap://localhost -b"dc=test,dc=ru" -x "(uid=null)"
#

# filter: (uid=null)

# requesting: ALL

#
# null, Users, test, ru

dn: uid=null,ou=Users,dc=test,dc=ru

uid: null

cn: Neo

objectClass: account

objectClass: posixAccount

objectClass: top

objectClass: uidObject

loginShell: /bin/zsh

uidNumber: 1000

gidNumber: 1000
homeDirectory: /home/null

gecos: Neo

# search result

search: 2

result: 0 Success

# numResponses: 1

# numEntries: 1
�����������, ��� � ������ ����� ������������ ���������� ���������.
"�� � ����� �� ��� ������?" - �������� ������ � ����� �������. �� ����� ���� ���
��� �����: ��� ���� � ������� �������� � ��������� ���� � ��. ��� ţ
����� ������, ������, ������, ������� ������ ��� �����. ���� ������ �����!
���‫� �ޣ‬ӣ ��� ��������� ��� ������� ����c��� �� ����, ������ ������ ��������.

��� ������ ��� ��������� Novell � �‫ �� ������� ����� ���� ݣ‬Linux ���� � �������
�����. ��������, ���������� �� *nix, ��� ��� openldap �������� ����������� ��
���� *nix ��������, � ������� ���� ��� ����� ���. �� � ������ �����ң���, ���
������������ ������ � ������� �����������.

��������� �������� � ��������������.


������� ����� ������� ������������ ������������, ������� ��� �� ������ ������
������ ������������� (���, �������, ��������� ��� ������������, �� ���� ������ ��
����� ��������� �����-������ ��������, �������� SHA1 ��� �� ���������� crypt ���
������� $%YJH&*&*jszZn7867wey8YT6yeuwe%%&^&&* :)) ���� ������������ �����������
� ������� ��� �������� LDAP, ��� ���������� ��������������(���� �������� ����
��������� ������, ����� ��� �������� � ���-��). ����‫ ������������ ����� �ף‬proxy
� ������� ���������:
������� ��� � LDAP
dn: cn=proxy,dc=test,dc=ru
cn: prox
sn: proxy
objectclass: top
objectclass: person
userPassword: {MD5}Xr4ilOzQ4PCOq3aQ0qbuaQ==
����� ����������� ��� ����� ������ ������ � sldap.conf
access to attr=userPassword
by self write
by anonymous auth
by dn="uid=root,dc=test,dc=ru" write
by dn="cn=proxy,dc=test,dc=ru" read
by * none

����� �������� ����� �������� � ����� /etc/ldap.conf(��� *nix ��������, ���


������ �� ���������� �������� ������������ � �����, ����������� � ldap ��������):
# ������ LDAP - ip ����� ������� ��� ���
# ���, ����������� � /etc/hosts, ��� � DNS �� ���̣���� ����
host 127.0.0.1
# �������� ������, ������ ��������� � �������� � slapd.conf
base dc=test,dc=ru
# ��� ���� root, ������ ��� ������ ������� proxy, ������� � ����� ������������
# � �� ��������� ������ ������������ �������� ������.
rootbinddn cn=proxy,dc=test,dc=ru
scope one
# ��� ������ ��� ������ ���������������� �������
pam_filter objectclass=posixaccount
# �������, ������������ ��� ������������ � ��� ������ ��� pam ������
pam_login_attribute uid
pam_member_attribute gid
pam_template_login_attribute uid
# ��� ������ - ���������� UNIX crypt, ������, ���������� LDAP � ���������� UNIX
# �� ����������(crypt �������� ������ ���������� unix)!
pam_password crypt
# ������� dn ��� ������ ��������� ��������, one - ��� ������� ������.
# ������ ��������� ������������ nss.
nss_base_passwd ou=People,dc=test,dc=ru?one
nss_base_shadow ou=People,dc=test,dc=ru?one
nss_base_group ou=Group,dc=test,dc=ru?one
nss_base_hosts ou=Hosts,dc=test,dc=ru?one

����� ����� �� ������ ������� ����, ���������� ������ ��������� proxy �


��������(!) ����. �� �, ������� ��, ��������� ������/������ ����, �����
root(chmod 0600 chown root:root). � �������� �� �� �����, ��� � /etc/shadow. ��
����, ��� ������ �������� � �������� ����. � ������ ������� ���������
������ proxy ���� �� ���� ������ �� �c�: ������ ������ ������, ��
��������� �� ����� (���� ����� ����, ���� ������ �����).
�� ���� proxy �� ����� ������ ������, �� ����� �� ������ �������� ���� ������,
����� ��� �� ���� ��� �������������. �� � ������ ���� ����������� pam,
���� �� ����� �� LDAP ������ �� ��������. ����� �������� �����������
�������������� ���������� ����� LDAP ���������� ���������� ������ PAM pam-ldap.
����� ����� ����� �������� � ����� /etc/pam.d(��� ����� �������� ������ ��������
�������������� ��� ������̣���� ����������: login, passwd, pop, smtp...)
��������� �������:
auth sufficient /lib/security/pam_ldap.so
account sufficient /lib/security/pam_ldap.so
password sufficient /lib/security/pam_ldap.so (��� ������� ����� �� �����,
���� ��������, � ����� ������ ��� ��� ����)
����� ���� �������� ���� system-auth, ����� ����� ������� ��������� ����:
#%PAM-1.0
auth required /lib/security/pam_env.so
auth sufficient /lib/security/pam_unix.so likeauth nullok
auth sufficient /lib/security/pam_ldap.so use_first_pass
auth required /lib/security/pam_deny.so

account required /lib/security/pam_unix.so


account [default=bad success=ok user_unknown=ignore \
service_err=ignore system_err=ignore] /lib/security/pam_ldap.so

password required /lib/security/pam_cracklib.so retry=3


password sufficient /lib/security/pam_unix.so nullok use_authtok \
md5 shadow
password sufficient /lib/security/pam_ldap.so use_authtok
password required /lib/security/pam_deny.so

session required /lib/security/pam_limits.so


session required /lib/security/pam_unix.so
session optional /lib/security/pam_ldap.so

������ LDAP �������� ������ �������������� ����������� � �� �������� �����������,


� ����� �ģ�
������� � ��������� ������, � ����� �� � ldap(��� ��� ����� �� ����� ������
�������� ��������������). ����� �������, ����� �������� �������������� �����
ldap � ����� ������ pam, � ��������� ������������ ���������� ���������� ���
�������������� �������.

�‫ ������������ ���������� ����� ݣ‬ldap �������� ����������� �������� �����.


����� ������, ����� ����� �������, ����ӣ���� � ���� ldap ��� ������������ �����
������(���� �� ����, ����� ��� ��������� ;). ������� ����� �������� � �‫����ޣ‬
������� ������������� �����, �� ������� ��� ������������ �����
����������(��������: �� ������ ����� ��������� ������, � ���� ��� �����
�������, �� ���� ������ ���̣��� ������ �������������� �� ������ X, ���� ��� ��
���������). ��� ����� ���������� �������� � ������ ������ ������������ ���������
��������:
host: name_of_host1
host: name_of_host2
...
host: name_of_hostn

��� ����������� ���� ������ ����� ��������������� ���������� ldapmodify:


ldapmodify -H ldap://localhost -D "cn=root,dc=test,dc=ru" -x -W -f host-auth.ldif
� ��� ���� host-auth.ldif ������ ��������� ���������
dn: uid=user_name,ou=People,dc=test,dc=ru
changetype: modify
add: host
host: name_of_host1
host: name_of_host2
host: name_of_hostn

���ģ��� ��������� ��� ��� ������� ������������! �������� �������� ������, �� �


������� ��� �� ���� ������� �����. ����� ����� ���� ������� �‫� ��������� ݣ‬

/etc/ldap.conf � ������ ����� ���������� �������, ��� ����� �‫������� �������� ݣ‬


host:
pam_check_host_attr yes

������ LDAP ��� ������ SSL.


��� � ��� ������� � LDAP ���������� ����������� ������ ������, ������������ ��
����. ��� ���� ������������ ��� ������: TLS � SASL. ������ �� ��� �� ������
�����, �� ������� ������� LDAP(336), � ������ ���������� ��������������
��������������� �����������, SASL �� ������ ���� LDAP �� ldaps:// � ����������
�ģ� ��-������� ���������: ����� ������� SASL. TLS ������� ����� � ���������,
������� � �������� ������ � �. ��� ������ ���� ������������� ��������� ����
������ ���������������� ����������. ��� ����� � Linux ������ ���������������
������ ������� ������������ OpenSSL(�� ���� � ��� ����� �� ��������� 2-�� ������):
�) ������� rsa ���� ������ 1024 ���� � ��������� ��� � ����� ldap.key
$ openssl genrsa -out ldap.key 1024
�) ����c� ������ �� ������������
$ openssl req -new -config .cfg -key ldap.key -out ldap.csr
�) ����c� ����������, �������� ����� ��������(CACertificate); ������� ������
���� ������ 2048 ���:
$ openssl genrsa -des3 -out ca.key 2048
�) ����c� self-signed ���������� ������ �������� �� ��� �� ������ ����������������
�����
$ openssl req -new -x509 -days 365 -key ca.key -out ca.cert
�) ������ �� ������ ���������� ��� LDAP ����� � ����������� ����������� ����c�
���������� LDAP
$ openssl x509 -req -in ldap.csr -out ldap.cert -CA ca.cert -CAkey ca.key
-CAcreateserial \
-days 365 -extfile .cfg
��� ���� ���� ������������ .cfg ������ ��������� ��������� ����������:
[ v3_req ]
subjectAltName = email:copy
basicConstraints = CA:false
nsComment = "LDAP server certificate"
nsCertType = server

������� ����������� ��������, �� � ���� ���� ���� �������� ��������� ���


�����������: ���������� ���������� � ����������� �� ���������� �������. �����
�������, ������ LDAP ������ ��������� ������������ ������ ����������� �����
���������� ����������. ������, ���� � ��� ��� ���� ����������
�����������, �� ����� ��������������� ���: ������ ���������� ���� �) � �) � ��
���� �) ������� ��� ������ ����������� �����������(����� ����� ���������������
���� �������� CA).

���� ����� ���� ���� �������� ���������� ����������� � ���� �������


LDAP(ldap.key) ����-������ � /etc/ssl/ldap(������� ������� ��� ����� �
�����������, ��������� openssl � /etc/ssl) � ������ �� ���������� ��� ������
������ ���������:
#chmod 0400 /etc/ssl/ldap/*
� ������ ��������� �� ldap
#chown ldap:ldap /etc/ssl/ldap/*

��������� ������� ��������� ������: ���������� ������ ��������� ���� �


������������ � ������ � ����� slapd.conf ��������� �������:

# ���������� �������
TLSCertificateFile /etc/ssl/ldap/ldap.cert
# ���� �������
TLSCertificateKeyFile /etc/ssl/ldap/ldap.key
# ���������� ����������
TLSCACertificateFile /etc/ssl/ldap/ca.cert

������ ����� ��������������� � �������������� ������� - ����� ������� stunnel


��� ssh. ������ ��������� stunnel, �� ��� ������ ����� �� ����������
���������� �������(��� ���� ��� LDAP �� ������ ���� �������� ��� ��������� SSL
�.�. stunnel ����� �������� ���������� ��������� SSL ldapa). ����� ���������
����������� ������ ���������:
#stunnel -r ldap -d 636 -p /etc/ssl/stunnel/stunnel.pem

���������� ��� ������� � ���� �� init ������ � ��������� ������� iptables ���
����������� �������� ������� � ����� 389 � ����� ��������� ������������(���
��������� ������ �� ���� � ������� ldap ��� ��������� ssl). ��� ���������
����������� � ������ ������ ����� ��������� ������ ��� ��������� stunnel
������������, ������� ������ ������������ ������ � stunnel. ����� �����
��������� ���������:
$ openssl req -new -x509 -days 365 -nodes -config stunnel.cnf \
-out stunnel.pem -keyout stunnel.pem
$ openssl gendh 512 >> stunnel.pem
��� ��������� self-signed ����������� � ���������� ��� ������
���������-��������.
�� ����� ���� ����� ������� � ���� ��� �������� ������ �� ���, � ����������
��������� �������� ��������� �������, ���� � ��������� ��� ���� � �����������,
�� ��� �� �������...
������ ������������� slapd � ����������� ��������. ��� ��������� �������� ����
��������� � ����� ldap.conf ��������� ������:

# �������������� ����� TLS


ssl start_tls
# �� ��������� ������ �������� ������������ ������� ����������, ���������������
# ��������� ������� �� ������ ������ ����� �� ��� �����������
#ssl off

����������.
������ ��� LDAP ������ �������� ������������(��� �� �������� ������, ��� �������
�� /dev/hands) � ��� ��� ����� ������������ � ����, �� ������ ������ �� ��������
������ ������� �������������� �� LDAP. ����� �����, ����� ���������� � LDAP � NIS.
NIS(��� �������� ������ ������� ����������) ������ ������������ ��� �������
���������� �������� � ����. NIS - ��� ����� ������ � ����� ����‫�������� ����ݣ‬
��������������. ����������� LDAP IMHO ����������� ���� � ������� ����� �����
��������� NIS � LDAP, ����� ������������ ����������� ���������� �
����������� ��������� ������� (�� ����� �� �ӣ ������� ������),
����� � ������ migrationtools ���� ������� ��� �������� NIS � NISPLUS:
migrate_all_nisplus_on[off]line.sh
migrate_all_nis_on[off]line.sh

� ��� ��������� � ������� ���������� ����������� ������� �


LDAP ����� PAM(������������ ������ ��������������), � ������ ������� �����
���������� �‫������������� ��������� ����� �� ݣ‬: NSS(�������� ����� ������ � �).
NSS
��������, ����� ��� �������������� ����� �������������� ��� �������
�������� ������̣����� ����� ��� ���������(� nss ������������� ���������
��������, ��������, �����). ��� ��������� NSS ������������ ����
/etc/nsswitch.conf.
��� ��������� ��������� �����: ��� �������(shadow passwd hosts) � ����� ������
����������(� ������� �������� ����������), ������������ ��������� �������
������. ���, ��������, ���� nssswitch.conf � ���� �������� ������:

# Legal entries are:


#
# nisplus or nis+ ������������ 3-� ������ NIS(NIS+)
# nis or yp ������������ 2-� ������ NIS(YP)
# dns ������������ DNS
# files ������������ ��������� �����
# ldap ������������ LDAP ����
# [NOTFOUND=return] ���� �� ������� ����������, ���������� �����
#

passwd: files nisplus nis


shadow: files nisplus nis
group: files nisplus nis

hosts: files nisplus nis dns

networks: files
protocols: files
services: files

netgroup: nisplus
#---------------------------------------------------------------------------------
--

����� ������������ ldap ������ �������� � ������ ����� ������ �����. ���� ��
������ ������������ ������ ldap, �� ��������� ����� ����� "ldap" �������
[NOTFOUND=return], ����� ����� ����������� ��� ���������� �������� � ���� LDAP.
��������:

# ���� ������� � ��������� ������, � ����� � LDAP


passwd: files ldap
shadow: files ldap
group: files ldap
hosts: files dns ldap

������ �‫����������� ���� ݣ‬: � �� �� ������������ ������������ ldap ���


����������� ������, �.�. �� ����� �������� ����� ��� ���̣����� ������� �
/etc/hosts, � ����� ���� ���������� �����-�� ������, ��� �������� �������
�������� ~30 ������(���� ����� ��� � hosts). ��� ��� ����� ������������ ������
������ DNS(��� ����� ������ DNS ����� ������� � LDAP, �� �� ���� �������
�������). ��� ����� ��� ����� � �������� � ���� �������� ������ �������������
����� LDAP, �� ����� ��������� �������, �.�. �������� ���������� gethostbyname()
��� ����������� ������ ������.

������, nss �� ���������, ������ �������� �� �����. ������ ������, ����� - ���
IMHO ������� ������ �������(� ��� ��: �������� � ������ �������������� ��), �� �
������ 2.2.6 �������, ���������� LDAP ����� ���� �� ����-�����, ��� ������� ��
�������� �������� (������, ����� 2.2.6 ������� SP3 � Win2k ��������). ���
���������� ������� � LDAP �������� ./configure --with-ldapsam. �����
����� ����������� �������� ������� LDAP � �������� dn ������ ����� � smb.conf.
��� ����� ���������� ��������� �����:
* ldap server - �������� ��������, ���������� ����� ldap �������.
* ldap ssl - �������� ����������� ���� �� ������������ ���������� ������
��������������(����� ������!). ����� �������� on ��� ������ ����� SSL(����
636), start tls ��� ������� �������������� ����� tls(389 ����) � no ���
������� ������ � �������� ���� (����� ���� 389)
* ldap admin dn - ��������, ������������ ������, ������� ����� ������� �
������� �����
* ldap suffix - �������� ������� ���� ������ LDAP
* ldap filter - ������, �� �������� ����� ���� ���� �������, �������� ldap
filter =
"(&(uid=%u)(objectclass=sambaAccount))": ��� ������������ ��������� � �������
������, � ��� ������� - ������� �����
* ldap port - ���� ��� ������ LDAP ����� �� ������ �����, ��� ��� ��������� ��
��������� (��. �������� ldap ssl), �� ����� ��� ����� �������.

������� ������� ������ ��������� ����� � LDAP

[global]
# ����� ������ ������������ �� ������
security = user
# ����������� ������� ������
encrypt passwords = yes

netbios name = Linux


workgroup = NET

# ��������� LDAP
# ���������� ����������� dn. ������ � ���� ������ �����������
# ��������������� smbpasswd -w. ����� ����� dn ������ ������ ���� ����
# �������!
ldap admin dn = "cn=ntadmin,ou=people,dc=test,dc=ru"

# ���������� ������ LDAP


ldap server = ldap.test.ru

# ������� �� LDAP ������ ����� TLS


ldap ssl = start tls

# ���������� ����(���� � ������ ������ ��� �������������)


ldap port = 636

# ���������� ������� ���� ������ ldap


ldap suffix = "ou=people,dc=test,dc=ru"

����� �����, ����������� ���� ������� ������ ����� � LDAP � ���������� ���
��������������� ����� ������� � slapd.conf(����� ��� ���� ���� ������������
����: ��� ���� ���������):
#--------------------------------------------------------------------------
access to attrs=lmPassword,ntPassword
by dn="cn=ntadmin,ou=people,dc=test,dc=ru" write
by * none

#--------------------------------------------------------------------------

����� ��������� ����������������� ������ � ldap, ����� ����� ��������� ��������


� ������� ����������. ��� ���������� ����������(� ������ --with-ldapsam)
smbpasswd ����� ��������� ������������� � ������ � ������� LDAP, ��� ����
smbpasswd ����� ������������ passwd � groups �� nsswitch(��� ����������
��������� nss ����� ����� ����� ��� ���� �� LDAP�, �.�. ����� ���������� �
passwd ����� nss): ��������� �������������:
# smbpasswd -a <username>
��������� ������(��� �����-����������� ������)
# smbpasswd -m -a <mach_name>$

����� ����� ��������� ���������:


# ldapsearch -ZZ -H localhost -b "o=smb,dc=test,dc=ru" "uid=pc1$"
--
dn: uid=icb$, o=smb, dc=test, dc=ru
objectClass: sambaAccount
uid: pc1$
pwdLastSet: 0
logonTime: 0
logoffTime: 2147483647
kickoffTime: 2147483647
pwdCanChange: 0
pwdMustChange: 2147483647
displayName: MustdiePC
cn: PC1
rid: 2054
primaryGroupID: 1201
lmPassword: 56D989A3C45BBAD3462E8109C329E116
ntPassword: 56D989A3C45BBAD3462E8109C129E116
acctFlags: [W ]
--
����� ����� �� ������ �������� ���������� ������� ������������. ��������, ������
������� �������� scriptPath(������, ������������� ��� ������ �������),
homeDrive(���� �������� ����������), profilePath(���� � �������),
pwdMustChange(������������� ����� ������ �������������). ��� ��������� ���� ������
LDAP �� ���� ���������� ������� ldapmodify, �������, ��� � ������� ldapadd
�������� � ������� ldiff. � �� ���� �������� ��������� ������ ����� �����, �
������ ������� ������ ��������� ������ ���������:
-------------------------------------------------------------------------------
dn: uid=001, o=smb, dc=test, dc=ru
changetype: modify
replace: profilePath
profilePath: \\%N\profiles\user1
-
replace: scripthPath
scripthPath: 001.bat
-
replace: homeDrive
homeDrive: Z:
-
replace: pwdCanChange
pwdCanChange: 0
-
replace: pwdMustChange
pwdMustChange: 0
-
replace: primaryGroupID
primaryGroupID: 513
-
-------------------------------------------------------------------------------
��� ���������� ���������� � ���� �������������� ��������
$ ldapmodify -H localhost -D "<admin_DN>" -W -ZZ -l modification.ldif
(����������: � ������������ ���������, ��� ���� ������������ ���� -f, � �� -l,
�� � ���� ��-������� �� ��������, ����, ��������, � ���-�� ����� �� ���).

��������� ������� �������� ��������� ������� ��


http://www.unav.es/cti/ldap-smb/ldap-smb-2_2-howto.html - �������� ������
��������� ����������� ������ � LDAP(�� ���� �� � ����� ��������� ��� ���
�������, � ��� ����������� ������������ �������� �� �����).

���������� ����� �‫���������� ����� �� ݣ‬, ���������� ��������������� � LDAP -


��� squid. ��� ���� ���������� ������, ����������� ��������� http
��������������, ��������� ���� LDAP. � �������� ������� ������ ����� ����� ������,
squid_ldap_auth, �������������� ����� ������� ���������, ��� �������� ������
��������� � �������� auth_modules/LDAP. ������������� ţ �������
�������(./configure -> make -> make install) �������� ������� ����������� ����
squid_ldap_auth. ����� ��������� ������ ��������� ����� ������� � squid.conf:

authenticate_program /usr/squid/libexec/squid/squid_ldap_auth -b
dc=test,dc=ru localhost
-------------------------------------------------------------------------------
������� ��������� ���� � ������������ �����, ����� �������� ������� ���� LDAP �
ldap ������(localhost � ����). ����� � squid.conf ��������� ����� �������(ACL):

# ���������� ���� ������������������� ��� ������� � ������


acl password proxy_auth REQUIRED
ۣ ��������
# �������� ������ http ����, ��� ����
http_access allow password
# ��������� �̣� �������� ;)
http_access deny all

������ � ����������� ������ � LDAP �����.


���� ����� ������ mod_auth_ldap, ������� ��������� ����������� http
�������������� ����� ldap ������.
����� � ����� �� ���������� ������ �������� �������� ��������� ��������������
����� ldap:
httpd.conf
# ��������� ������ ��������������. ������ ��������� � extramodules
LoadModule auth_ldap_module extramodules/auth_ldap.so
AddModule auth_ldap.c

# ����������� �������������� ����� ldap ��� ����������� ��������


<Directory /var/www/secure>
# ��� �������� �������� ��� ������ ������������ ������������ � ������ � ����
# LDAP, ���� ������ ����� �� �������, �� ������������ ��������� ������(���
# ������ ����������� � ����� ������������).
AuthLDAPBindDN cn=proxy,dc=test,dc=ru
# ������ ��� ��������� ���������
AuthLDAPBindPassword secret
# ��������� ��������� TLS ��� ������� � ������� ldap(�� ��������� off)
AuthLDAPStartTLS on
# �������� ��������, ������� ���������� ������ ldap, dn ������, �������� �
# ������, �� �������� ����������� ��������������:
# ldaps://host:port/basedn?attribute?scope?filter, ���
# basedn - ������� dn ��� ������(������ ������ � ������ ����� ������ � ţ
# ��������)
# attribute - ������ ���������, ����������� �������, �� �������
# ������������ �����(�� ��������� ������������ ������� uid)
# scope - ����, ������������ ��� ������������ �������� one - ������ ������
# ���������, sub - ������ ��� ���������, ��������������� �������(�������
# �� ���������).
# filter - ������, ������������ ������ ������ ��������� ldap, �����������
# � ������, �� ��������� ����� (objectclass=*). ������ ����� ���������
# ���������� ��������� | � & ������� ������ ������ �� ����� �����
# ��������, � ����� ����. ������� ��������� �������� ��������:
# (|(cn=admin)(uid=root)) - ��� cn admin ��� UID root
# (cn=admin) - ������ cn = admin
# � ������ ������� ���������� �������� ������ �������, ������������� basedn
# O=myorg, OU=sysopka
AuthLDAPUrl ldaps://test.ru/O=myorg, OU=sysopka
# ������� ������ �������������, ��������� �������� �� ldap �������
require valid-user
</Directory>
���������� �‫������ ����� ��������� ݣ‬, �� ��� ������������ ����, � � ��� �����
�������� � ������������. Proftpd ����� ������ ������ auth-ldap, �� �����
��������� ��� � �� ����, �.�. ��������� ������ ftp ������� ����� ������ ��
������������ �����.

��������� �������� �������� ����� �� ������������ ������ ��������. �, ��������,


��� ������� �������� postfix � ������, ��������� ����������� �������� �����,
�.�. �������� ����� �� ����� ����, ��� ����������� ldap ������, �������� dn �
������ �������������� � ţ ������ � �������� ���� ��� ������� � ����� �������
�������������(����� �� ����� ������������ proxy). ������������ postfix ���������
�������:
main.cf
virtual_maps = ldap:ldapvirtual

# ������ ldap � ����


ldapvirtual_server_host = test.ru
ldapvirtual_server_port = 389
# �������� dn ��� ������ �� ����
ldapvirtual_search_base = ou=mail,o=YourOrg,c=nl
# ����� ��� ������
ldapvirtual_domain = test.ru
# �������, ������� ������ ������ postfix ��� ������ � ldap(�� e-mail ������
# ������������ ����).
ldapvirtual_result_attribute = maildrop
# ��������� ���� ������ �� �������
ldapvirtual_scope = one
# �������� �������� � ������
ldapvirtual_bind_dn = cn=proxy, dc=test, dc=ru
ldapvirtual_bind_pw = secret

������ sendmail ��� �������� �������� ������� � ������� � ldap �����


��������. ��� ����� ������������ ������ ��������� ����������� objectClass:
inetLocalMailRecipient (� �������� ��� ������ ������������ ��� ��������
����������� �� ���� �������� ��������, ���������� � LDAP), ��������
�������� ����� ���:
dn: uid=user, dc=test, dc=ru
objectClass: inetLocalMailRecipient
mailLocalAdress: user@test.ru
mailRoutingAdress: alex@test.ru
uid: user
� ������ ������ ����� ���������������� � ������ user@test.ru �� �����
alex@test.ru
Sendmail � ���������� ����� ������������ m4, ��� ��� ������� ����� ��������
� ������� ��������� sendmail.cf. ��� ������� ������ ������������ ���������
���������������� ��������, ���������� �������, ����� ����� ������� �
������� �������:

dnl # ��������� �������� ����� �������� ������� ldap


FEATURE(`ldap_routing')
LDAPROUTE_DOMAIN(`test.ru')
dnl # ����� ������� ����������� ��������� ������ � ldapsearch
dnl # ��� ��������� ������ ���� ����� ��������� ������, ��� ������ ��������
dnl # ldapsearch --help
define(`confLDAP_DEFAULT_SPEC', `-h ldap.test.ru -b dc=test,dc=ru')

� ��� ������������� ��������!

�������.
�� ���, � ����������� LDAP� �����������... ���� ���������� �
�������������� ������������ ������ �������. ����, �������. ������� - ��� ���� ��
������ ������������ ������� ���������� LDAP. ������� - ��� �������������� ����
������ LDAP �� ���������� ��������, �.�. ���������� ���� ������ "�������������"
�� ��������. ������� ���������� ����� ����������� ���������, ���� �� �������
�������� primary(��� ������ �� ������ DNS, ������ ������� ��� ������ �����).
� ����� ������ ��������� ������ ������������ ������� �� ������ � �� ������, �
��������� - ������ �� ������. ��� ����������� ������ �� ������� �������
�� ������� �� ��� ��������� � �������������� �� ���� �� �����. ���
�������� ������ ���������� ��� ����:
�) ��������� ������ slapd.conf �������� � ��������� ��������
�) �������������� ������� �������� ���� � ��������� ������� �� ���������
�) ������ ������ slurpd, ������� � ������������ ������������� ��������

����� ������������� ����� ����� ����� ��������� ������������� �� ������ �


��������� ��� �� �������� ������̣���� ldap ������ � ������� �������� ������,
������� ����� ��� ��������� ����������������(�������������� �����). ��� ����
����� ��������� � ���� ������ �� ldap �������� ����� ������������� �� ���
�������, ������� ��������. ��� ��������� ����� �������� ������� ��� ���������
������� �� �������
1. ��������� LDAP ������ �������� ������ �� ��������� � ������� �������, ���
���� �������� ������ �� �������� �������(�� ���� �������������� ������� �
��������)
2. ������ �������� ������ �������� �������, ������� �� ������������. ��� ����
������ �����, ��� ������ ��� � ���� �������������(��� ������������ � ��� �������)
3. slurpd ��������(����� ������������ ���������� �������), ��� ������ ����
���������, � ������������ �������������.
4. ��������� ������� �������� ������ �� slurpd �������� ������� �, �������
������ � ����, �������� ����� slurpd, ���� ����� ����� ����� ���� ������� � ���
�������.

�� �ӣ, ������ ������, �������� ���������. ��� ������ �������� slapd.conf

# ��� �������� ������!


# ������� ��������� ������. ������ ��������� ������������� ������ ����������
# ldap �������. ��������� ����� ���������� �������(host), dn ��� �����������,
# ����� �������������� � ������ ����������(������ ��� ������� dn). � ��������
# ����������� ����� ������������ ����. ������ ������, ��� ������ � �� ������
# ������� ����� ssh ��� stunnel
# � ������������� �� �� � ���̣����� ����� � ����� 389, � � ���������� ��
# ����������� ���� (��� ������ ����� ����� ������� ��������� ��������)
replica host=slave1.test.ru:389 binddn="cn=replicator,dc=test,dc=ru"
bindmethod=simple credentials=replicator_password
# ��������� ���
replica host=slave2.test.ru:389 binddn="cn=replicator,dc=test,dc=ru"
bindmethod=simple credentials=replicator_password
# ���������� ������ ������ � ���-����, ��� ������ ������������� (����
# ������������, �.�. �������� ������������������). ��� ����� ����� ��� ����
# ��������� ��������
replogfile /var/log/ldap/replica.log

����� ���� �� ��������� �������� ������ �‫ � ����� ���� ݣ‬slapd.conf:

# ��� ��������� ������!


# ������ ������������ ��������� replica replogfile. ���������� ������� �����
# updatedn, ����������� � binddn ��������� �������, �� �������� ������� �����
# �������������� ������.
updatedn="cn=replicator,dc=test,dc=ru"
# �������� ����� ��������� ������� ldap, ���� ����� ���������������� ������,
# ���������� �������������� ������
updateref master.test.ru:389
# ���� ���� ����������� ����������� �����������, �.�. ��� ��������� ������ ��
# ������ ������
access to *
by dn="cn=root,dc=test,dc=ru" write
by dn="cn=replicator,dc=test,dc=ru" write
by self write

����� ��������� ���� �������� ���������� �������������� ���������� ���� ������


LDAP ��������� ������� �� ��� ��������� �������, ��� ����� ���������� ���������
���������� DatabaseDir ���������(!). ����� ����� ����� ����������
���������������� ����, ����� ����� �� ��� �����������:
slapindex -f /etc/ldap/slapd.conf -b "dc=test,dc=ru"

����� �� ������� ������� ��������� slurpd:


# slurpd

������������� stunnel � ������ ������ ����� ���������. � ���� ������ �� �������


�������
��������������� ������� �������, ������� ���������� �� ��������� ldap ��������,
�� �� ������� ��� ������� ����� ������ �� ������ ������, � ldap ������ �����
����������� � ���������� ���������, �������� �� ������, ������� �������������
����� ldap:
stunnel -c -d 9636 -r slave1.test.ru:636
stunnel -c -d 10636 -r slave2.test.ru:636

� ��� �ӣ! ���� ��������� ������ �� ������ ��������� � ���������(��������,


�������� ���� ���� ������ ��������� �����������),
�� ������, ������������ � ���������� �������, ������ ������ ����������, ��
�������� ţ �� ������. � ���� � ���������� ������ �������� ������ ����, �� �
������ ���������� ������� ����� ����� ������������ ������������ ���� LDAP(�����
��� ���� �� ����� ��������� �������). �� ����� ��������̣���� ����� �����
��������� ����� ������ ������� ����, ��� ��� ��������� �������� ������� ��
������, � ����������� ����� ��������� �������.

�������� �������� ldap. ����� ����.


LDAP, ��� ��� ���� �������, �������� ����������� ��������-���������������
��������, � �� ������ ��������� ����� ������ � ������
���������� � ���� LDAP. ��� ���� ���� ���������� ����� ����. � ����� �����
����������� ������ � �� ��������, ����� ���������� ����� � LDAP ����������
��������� � ����� slapd.conf ������ ���� � ������ �����. �� ��������� � LDAP
���������� ��������� �������� ����, ���������� ����� ��������� �����,
��������, ��� ����� ��� ��������� �������� ��������. ����� ��� �����
������������, � slapd.conf ����������� ����� ��������:
# �������� ����� �� ��������� �������� include
include /usr/share/openldap/schema/core.schema
include /usr/share/openldap/schema/cosine.schema
include /usr/share/openldap/schema/inetorgperson.schema
# �������� ����� �����
include /usr/share/openldap/schema/samba.schema
# �������� ���� �����
include /usr/share/openldap/schema/my_cool.schema

������ �����ң���, ��� ��� ����� ���������. ���� �� �������� �����-������


�����, �� ������� �ӣ ��������� ������� ������. ���� ����� �� ��� ����������:
��� ������������� �����! ����� ���� ����-�� ��������� �������� �� OID.
OID(���������� ������������� �������) ������������ LDAP, ����� �� ���� ���������
������� � �� ���������. OID ������� �� �������� �������� �����̣���� ������ �
������������ � ����� �������� OID(��� �������� � ���������� SNMP ���
������������ ��������� ���������):
1.1
OID ������ �����������(���������� �����)
1.1.2
���� �������������� LDAP
1.1.2.1
�������� �������
1.1.2.1.1
���������� �������(������ ��������� ����� ��� ������� ��������)
1.1.2.2
���� ������
1.1.2.2.1
���������� �����
��� ��������� OID ����� ����� �� ���� www.iana.org(���������� � 1.3.6.1.4).
������, ��� � �����, ����������� �������� OID - ���� �������� �����������. �����
����� ����� �����-���� OID ��� ���������(������� ����� OID
�������� 1.3.6.1.4) �
��� �������, � ����� ������ �������� �‫���� ��������� ݣ‬. � ������, ����� ������
����������, ��� ������� � ������� ������ � �� ������ �����(� �����, ��� ��������
��������� ���� ����� �������� OID �� �������� �����, � ��������� ��� ���
�������������� ���������� ��������). ����� ��������� OID�� �����ģ� � ����������
����� ���������. ��� ���� ���� ������������ ��������� attributetype. ��� ���
�������� �������� ��������� � ����� �����(�����ģ� ��������� ��������):

attributetype ( 1.2.840.113556.1.4.8 NAME 'userAccountControl'


SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )

attributetype ( 1.2.840.113556.1.4.166
NAME 'groupMembershipSAM'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.40
SINGLE-VALUE )

attributetype ( 1.2.840.113556.1.4.213
NAME 'defaultClassStore'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )

��� ����� � ������� �ģ� ������� OID ��������, ����� NAME � ��� �������� �
��������, � ����� ��� ��������. ��� ��� ������� �����������. �����, ��� ���
�������� - ��� ����� OID(����-�� �����, �� ��� ��������� ��������� ���� ����
����). ���������� �������������� ��������� �����:
����������
1.3.6.1.4.1.1466.115.121.1.7
��� LDAP(DN)
1.3.6.1.4.1.1466.115.121.1.12
������ ������� UTF-8
1.3.6.1.4.1.1466.115.121.1.15
������ ASCII
1.3.6.1.4.1.1466.115.121.1.26
�����
1.3.6.1.4.1.1466.115.121.1.27
DN � ������������� ������������(UID)
1.3.6.1.4.1.1466.115.121.1.34
������ �� �����
1.3.6.1.4.1.1466.115.121.1.36
OID
1.3.6.1.4.1.1466.115.121.1.38

����� ���� �������� ����� ��������� �������������� ��� ���������:


DESC - ������(������� �����), ������� ��������� ������ �������
SUP - ������(���) ��� OID ������������� ��������(���������� ������������
���������� ������������� ��������)
EQUALITY - ������(������������) ��� OID ������ ������, ��������,
caseIgnoreMatch ��� ������ ������� �������� ��� �‫�������� ��ޣ‬.
SINGLE-VALUE - ������ ����(����� ���� ������ ����������� ������ ������!),
������� ���������, ��� ������ ������� ����� ��������� ������ ������������
��������(�� ��������� ����� ����������� �������� ��������� ��������).
NO-USER-MODIFICATION - ����, ����������� ����������� ������� ��������
�������������(�� ��������� ����������� ���������)

��� ����������� ����� ������, ��� ����� ������ �������(������� ������ �


�����) ������ ���� ���� ������. ������� ������ ����������� �������� ��������,
��� ���� � jpg �����:
attributetype ( 1.1.2.1.2 NAME 'pic'
DESC 'my jpeg picture'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
SINGLE-VALUE )
�, ��������, �������� �� �����, �������������� � ���� URL
attributetype ( 1.1.2.1.3 NAME 'URLpic'
DESC 'URL to picture'
SUP pic )
�������� ������ ������ IMHO ��������� �����, ������� ������ ������ cronEntry ��
cron.schema:
objectclass ( 1.3.6.1.4.1.7006.1.3.2.1
NAME 'cronEntry'
SUP top
STRUCTURAL
MUST ( cn $ cronCommand $ uid )
MAY ( cronHost $
cronMinute $
cronHour $
cronDay $
cronMonth $
cronDayOfWeek $
owner $
description ) )
������� �ģ� OID, ���(�� �������� �������), ������������ �����(�����������
��������), ��� ������(��� �������� � ��������-��������������� ������� ��������:
ABSTRACT - �����������(������ ������ ������� ������� ������, ����� ������
�����������) � STRUCTURAL - �������(�� ���������)). ����� ���� ���� ���������
��� ������: MUST - ������������ ��������, MAY - ��������������. ������ ���������
����������� � ������ � ����������� �� �������� ������� �� ��������, � �������
�������(��������, ��� �� � �������������). �����, ��� ����� �‫� ��������� ��� ݣ‬
������������� �������� ����� ������ �������(� �������� ����). ��� ������,
�������� �������� - �� ����� �� � ��֣��� ����. �������� ��������� �� ����, �.�.
����� cronEntry �������� ��������� �������� ��� ������������. ������ ������, �
�� �ӣ-���� ������������� �� ����, ��� ���������� ��������� ����� �����,
���������� ������������, �.�. ��-������, ���������� ��������� � ������������
OID, � ��-������, ������ ����� ������ � ����� ����� :)

� �������� ����������.

� �����, ��� ���� � ��� � ������������ ��������� ������� ����, �� ����������


LDAP �������� ��������� �������� ����������������� ���������� ��������������� ��
���� �������. ������������� ������ ������ LDAP ��ģ����, � ������� ������
���������� ������������ ��������� ������� ������������. ����� ����� LDAP
�������� �������� ������� ���������� ������ �, ��� ����� �����, ������ �ӣ �
����������� ���� ������. ��� ��������� �����, � �����, ����� ������������
��������� �����: ������ � �������, � ������� �������, ��� LDAP. �� � �������
����� ��� �����ģ� � ������ �����, ���������� �
����������� ������ �������������, �����, ��������. � ��� ��� ���������� ����� ��
~1000 �����, ��������� ��������� ������ �����������(��� �������!), ���
NovellNetware �������������� ���� ��� ����-������. LDAP � ����� � ���� ������
������� ����������� ���� �������. ����, �� ���� ��� �ӣ. � ��������� ��� �
�������� � ���������� LDAP �������� � ��������, � �������� ����������� ��������

������ �������� ������:


http://www.tldp.org - LDAP HOWTO � LDAP-implementation HOWTO
http://www.openldap.org - ldap guide(aka HOWTO, ������ ����� ����� �����������)
http://www.mandrakesecure.net/en/docs/ldap-auth.php - ����� ��������� ������
Vincent Danena, ������� ��������� �������� ��������� ldap
http://www.opennet.ru - ������ �� ������ � LDAP �� ������� �����, �� ���
�������� ������, ���� ��� ������ ��������� ���������.
http://www.rojkov.spb.ru/ - ������� ������������, ��, � ���������, �‫ݣ‬
������� ���� � ������, ���������� ���������� �� LDAP.
������ ���������� rfc, ����������� ������������� ldap:
1777 LDAP v2
2251 LDAP v3(������������ � ������� ������ openldap)
2252 LDAP v3 ����������� ���������
2253 LDAP v3 ������������� ����� UTF-8
2254 ������ ������ ������
2255 ������ LDAP URL
2256 �������������� ����� ��������� X.500 � LDAP v3
2307 ������������� LDAP � �������� NIS.
��� ��������� ���������� rfc � ������ ��������� ����� ������� tcsh:
alias rfcget 'ncftpget ftp://ftp.isi.edu/in-notes/rfc\!^.txt'

� ��������� � ������ ������ � ������� �� ���� ��������� ���� �� ������ � LDAP,


��������, ������ � SASL, Kerberos, �������� ���������� ����������� ldap.
���������� ������� ��� ���������� � ��������� �������. LDAP - �������� �������
�������, ������� �������� �ӣ �� ������� :( �������, ��� ����-�� ��� ����� �����
�� ������.

You might also like