LDAP入門 - · PDF file日本LDAP ユーザ会 LDAPと ... – WindowsドメインをSamba
LDAP in infrastructure (RootConf 2009)
-
Upload
sergey-skvortsov -
Category
Technology
-
view
651 -
download
5
description
Transcript of LDAP in infrastructure (RootConf 2009)
![Page 1: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/1.jpg)
Сергей Скворцов
Использование LDAP в инфраструктуре интернет-компании
2009-04-14 $Revision:: 45 $
![Page 2: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/2.jpg)
2
I. ТеорияI. Теория
![Page 3: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/3.jpg)
3
Служба каталогов
• Служба каталогов (Directory Service) –Централизованное (единое) хранилище–Хранит ресурсы – один или более классов,
есть набор свойств (атрибутов)–Иерахическое (tree) представление
![Page 4: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/4.jpg)
4
Что такое LDAP?
• Lightweight Directory Access Protocol– Облегчённый вариант DAP (входит в X.500)– Кратенько: RFC 4510..4533, плюс ещё ~10..20– Но это не страшно!• Кто читал весь стандарт SQL?• А всё RFC по DNS?
– Это бинарный протокол (TCP тоже такой :)
![Page 5: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/5.jpg)
5
Глобальные сущности
• Directory Information Model (DIM)– Набор схем, которые описывают классы и
атрибуты• Directory Information Tree (DIT)– Собственно хранилище ресурсов (directory
entries) – объектов и aliases (грубо: symlinks)
![Page 6: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/6.jpg)
6
Концепции: классы
• Каждый объект относится как минимум к одному классу. Классы наследуются.
• Два вида:– Структурные (structural) – Вспомогательные (auxiliary)
• Содержат обязательные (MUST) и вспомогательные (MAY) атрибуты
![Page 7: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/7.jpg)
7
Пример: классobjectclass ( 0.9.2342.19200300.100.4.5 NAME 'account' SUP top STRUCTURAL MUST userid MAY ( description $ seeAlso $ localityName $ organizationName $ organizationalUnitName $ host ) )
![Page 8: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/8.jpg)
8
Концепции: атрибуты• Атрибут определяется через:– Имя и OID-идентификатор– Синтаксис (syntax)– Правила (matching rules)
• Сравнения, поиска подстроки• Упорядочивания (сортировки)
– Тип значения: множественное или единственное (SINGLE)
![Page 9: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/9.jpg)
9
Пример: атрибут
attributetype ( 2.5.4.9 NAME ( 'street' 'streetAddress' ) DESC 'RFC2256: street address of object' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{128})
![Page 10: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/10.jpg)
10
Схема(-ы)
• Схема задаёт набор атрибутов и классов• Набор загружаемых файлов схем образуют схему
DIT (или просто DIM).• Схемы есть:– Предопределённые (системные)– Внешние (application)– Ваши собственные
![Page 11: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/11.jpg)
11
И снова про DS• Cтруктурированное, иерархическое хранилище• Оптимизация на массовое чтение,
редкие записи• Это НЕ реляционная модель!• Может быть разбито на поддеревья• Рассчитано на распределённое
использование (referrals)
![Page 12: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/12.jpg)
12
DS на пальцах• Аналог – DNS– Но! DNS – это простая lookup служба– Служба каталогов – куда круче!
• Некоторая симметрия– Реплики и поддеревья – зоны– DNS записи как объекты– Master и slave сервера– И т.п.
![Page 13: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/13.jpg)
13
Кусочек дерева
o=company ou=users cn=vpupkin ...
DN: cn=vpupkin,ou=users,o=company
![Page 14: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/14.jpg)
14
Картинка
![Page 15: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/15.jpg)
15
Кусочек дерева
o=company ou=users cn=vpupkin ...
DN: cn=vpupkin,ou=users,o=company
![Page 16: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/16.jpg)
16
LDIF – текстовый форматdn: uid=vpupkin,ou=users,o=companyobjectClass: personobjectClass: inetLocalMainRecipientcn: Vasily PupkinuserPassword: {SSHA}XXXXXXmail: [email protected]
![Page 17: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/17.jpg)
17
Схема расширяема
• Решить, надо ли вам это• Достаточно:– Прочесть раздел «Extending Schema»
– RFC 4512, и немного других :)
• Зарегистрировать OID в IANA
![Page 18: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/18.jpg)
18
Стандартные классыСистемные:organization organizationalUnit groupOfUniqueNames Пользователи:account inetOrgPerson inetLocalMailRecipientСеть:domain ipHost ipNetwork bootableDevice ieee802Device UNIX-related:posixAccount posixGroup sudoRole ldapPublicKey
![Page 19: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/19.jpg)
19
Что ещё важного?
• Поиск – через т.н. фильтры– Достаточно мощный язык запросов
• Расширения протокола через controls– Примеры: Paged Results, Modify Password
• Безопасность– TLS, SASL, и т.п.
![Page 20: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/20.jpg)
20
I I. ПрактикаI I. Практика
![Page 21: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/21.jpg)
21
Поставленные цели• Единое центральное хранилище• Управление учётными записями
сотрудников• Управление почтой (aliases, листы рассылки)• Учёт сетевых ресурсов (сетей, хостов)• Единая, прозрачная аутентификация и
авторизация• Конфигурация (в т.ч. ACL) для приложений
![Page 22: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/22.jpg)
22
Цель: управление доступом• Единая точка управления доступом:– К host’ам по SSH; управление sudoers– К веб-ресурсам: intranet, wiki, bugzilla, otrs,
SVN, webdav-folders, внутренние приложения…– К прочим ресурсам: SMTP/IMAP/POP3;
KVM / IPMI, …– К почтовым рассылкам (в т.ч. архивам – через
IMAP shared folders)
![Page 23: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/23.jpg)
23
Цель: инвентаризация• Отправная точка для инвентаризации:– Информация о хостах, сетях– Ссылки во внешние системы учёта
• Точка синхронизации с DNS:– DNS-зоны доменов генерятся частично из LDAP
• Мониторинг:– Начальную информацию берёт из LDAP
(без всяких auto-discovery)
![Page 24: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/24.jpg)
24
Выбор software
• OpenLDAP– Стабильный, быстрый, функциональный– Opensource
• Альтернативы– Novell eDirectory; Microsoft Active Directory– Apache Directory Server; Fedora Directory Server– И ещё чуть меньше десятка
![Page 25: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/25.jpg)
25
Реализация: сервера
• Master-серверы:– FreeBSD 7.1; OpenLDAP 2.4.16– 2 сервера в MirrorMode– CARPed
• Consumer-серверы в отдельных ДЦ– чтение локально– записи перенаправляются на masters
![Page 26: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/26.jpg)
26
Типичный LDAPified host
• OS: *nix (у нас в массе FreeBSD)• pam_ldap – PAM смотрит сначала в LDAP:• nss_ldap – интеграция NSS с LDAP– users, groups, passwd
• openssh+LPK – SSH-ключ смотрится в атрибуте sshPublicKey учётной записи пользователя
• sudo+ldap – sudoers полностью находится в LDAP; локальный sudoers у нас запрещён
![Page 27: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/27.jpg)
27
DIT крупным планомcn=company-logo=company ou=users ou=groups ou=mail ou=networks ou=sites
![Page 28: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/28.jpg)
28
Учётные записи: DITo=company ou=users cn=vpupkin ... ou=retired ou=locked ou=system
![Page 29: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/29.jpg)
29
Учётные записи: типы• ext-user– person, inetOrgPerson, inetLocalMailRecipient, extraPerson
• uid, cn, givenName, sn, mail, userPassword, icqNumber, jabber, birthday
• plain-user– + organizationalPerson, intraPerson
• title, roomNumber, telephoneNumber, shirtSize• account-user– + posixAccount, shadowAccount, ldapPublicKey,
intraAccount• uidNumber, gidNumber, loginShell, sshPublicKey, loginClass
![Page 30: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/30.jpg)
30
Почта: DITo=company ou=mail dc=spylog.ru ou=aliases cn=mOrketing ou=lists cn=changes cn=read cn=write
![Page 31: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/31.jpg)
31
Почта: примерdn: cn=changes, ou=lists, dc=spylog.ru,ou=mail,o=company
objectClass: nisMailAliasrfc822MailMember: [email protected]: uid=vpupkin,ou=users,o=company
![Page 32: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/32.jpg)
32
LDAP + SMTP• SMTP-auth пользователей – через LDAP• Exim, при получении письма для домена
dc=XXX,ou=mail,обрабатывает целевой адрес:– В ou=lists (атрибут rfc822MailMember): обрабатывает как
рассылку – в т.ч. передаётся в Cyrus в shared folder– В ou=aliases (атрибут rfc822MailMember): раскрывает как
почтовый алиас– В ou=users (атрибут mailLocalAddress): передаёт в Cyrus в
соотв. папку
![Page 33: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/33.jpg)
33
LDAP + IMAP• Аутентификация пользователей – через LDAP• Специальный Perl-backend (в отдельном consumer-сервере)
ловит всё изменения в дереве и отражает их в Cyrus– slapd-perl(5)– Cyrus::IMAP::Admin
• При добавлении пользователя или при добавлении атрибута mail, содержащего домен, который находится в dc=XXX,ou=mail – в Cyrus создаётся соответствующий почтовый ящик.
![Page 34: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/34.jpg)
34
LDAP + IMAP: рассылки• При добавлении рассылки в
ou=lists,dc=XXX,ou=mail создаётся соотв. shared folder в Cyrus
• При изменении прав на рассылку (добавление/удаление пользователей из дочерних объектов cn=read, cn=write) – соответственно обновляются ACL на shared folder’е
![Page 35: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/35.jpg)
35
Учёт сетей• Сети – их много!– Много внутренних (10.0.0.0/8)– Немало внешних (выделенных в RIPE)
• Их надо учитывать, хранить в едином месте:– Основные параметры (адрес и маску)– RIPE-данные– VLAN, routing, etc.
![Page 36: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/36.jpg)
36
Сети: DITo=company ou=networks cn=10.0.0.0/8 cn=10.99.0.0/16 cn=88.55.66.0-88.55.66.255 ...
![Page 37: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/37.jpg)
37
Сети: примерdn: cn=10.99.0.0/16,…,ou=networks,o=company
objectClass: ipNetwork, intraNetConfigipNetworkNumber: 10.99.0.0ipNetmaskNumber: 255.255.0.0vlanNumber: 555defaultRoute: 10.99.0.1owner: uid=vpupkin,ou=users,o=company
![Page 38: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/38.jpg)
38
Сайты (sites)
• Сайт – это scope of administration• Содержит ресурсы, объединённые по
логическому (corp, devel, infra) или проектному (hosting, spylog) принципу
• Ресурсы:– хосты, группы доступа,
настройки для приложений
![Page 39: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/39.jpg)
39
Сайты: DITo=company ou=sites ou=foobar ou=hosting ou=infra ou=spylog ...
![Page 40: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/40.jpg)
40
Типичный сайт: DITo=company,ou=sites,ou=foobar ou=hosts ou=groups
ou=shellusers ou=web
ou=virtual ou=sudoers
![Page 41: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/41.jpg)
41
Хосты• Хостов ещё больше чем сетей– Их часто просто теряют– Выделяют повторно одни и те же ip-адреса– Не всегда ясна связь с реальным железом, со
складским учётом и бухгалтерией– Инвентаризация – нужна!– Хочется хранить доп. параметры (carp vhid)
![Page 42: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/42.jpg)
42
Сайты: хостыo=company,ou=sites,ou=foobar ou=hosts
ou=jails cn=www01.int.foobar.ru
ou=mgmt cn=x0666.mgmt
ou=carp
![Page 43: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/43.jpg)
43
Хост: mainhostdn: cn=x0666,ou=mgmt,ou=hosts, ou=foobar,ou=sites,o=company
objectClass: device,ieee802Device,ipHost,intraHost
cn: x0666.mgmtipHostNumber: 10.99.10.4macAddress: 00:35:1A:15:17:42hostType: maindatacenterServerID: srv_01018l: ДЦ Алтуфьево
![Page 44: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/44.jpg)
44
Хост: jailhostdn: cn=www01.int.foobar.ru,ou=jails,ou=hosts, ou=foobar,ou=sites,o=company
objectClass: ipHost, intraHostcn: www01.int.foobar.ruipHostNumber: 10.99.20.2hostType: jailowner: cn=x0666,ou=mgmt,ou=hosts,ou=foobar,ou=sites,o=company
manager: uid=vpupkin,ou=users,o=company
![Page 45: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/45.jpg)
45
Хосты и DNS
• Хосты заводятся в LDAP одной командой# ldap_ctl --create --host XXX …
• Далее – перегенерятся зоны:# dns_ctl--process foobar.zone--process 10.99.10.0-24
• Думаем (!), коммитим в SVN, выкатываем обновления на authorative NS servers
![Page 46: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/46.jpg)
46
Хосты и DNS• Если откуда-то надо срочно понять что это за
хост:# host –t TXT www01.int.foobar.ru
www01.int.foobar.ru descriptive text"manager: uid=vpupkin,ou=users,o=company“
www01.int.foobar.ru descriptive text"mainhost: cn=x0666,ou=mgmt,ou=hosts,ou=foobar,ou=sites,o=company"
![Page 47: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/47.jpg)
47
Группы доступа• Группы доступа - самый популярных способ
в реализации авторизации• Контроль доступа к:– Хостам (по SSH)– Веб-приложениям (например, всё Apache-based)
• Используем класс groupOfUniqueNames
![Page 48: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/48.jpg)
48
Сайты: хостыo=company,ou=sites,ou=foobar ou=groups
ou=shellusers cn=mgmt-dev
ou=web cn=bugzilla
![Page 49: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/49.jpg)
49
Группа: примерdn: cn=mgmt-dev,ou=shellusers,ou=groups, ou=foobar,ou=sites,o=company
objectClass: groupOfUniqueNamescn: mgmt-devuniqueMember: uid=vpupkin,ou=users,o=company
description: Доступ на dev mainhosts
![Page 50: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/50.jpg)
50
PAM/etc/pam.d/sshd , /etc/pam.d/system# authauth sufficient /usr/local/lib/pam_ldap.so
no_warn try_first_passauth required pam_unix.so
no_warn try_first_pass# accountaccount required /usr/local/lib/pam_ldap.so
ignore_authinfo_unavail ignore_unknown_user
account required pam_unix.so
/etc/nsswitch.confpasswd: cache files ldap
![Page 51: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/51.jpg)
51
nss_ldap/usr/local/etc/nss_ldap.confbase ou=users,o=companyuri ldap://ldap.company.ru binddn
uid=pam,ou=virtual,ou=foobar,ou=sites,o=companybindpw 26a9e1b8df74606eaafa2dde8f8964c1
pam_login_attribute uidpam_member_attribute uniqueMember
pam_groupdn cn=mgmt-dev,ou=shellusers,ou=groups,ou=foobar,ou=sites,o=company
sudoers_base ou=sudoers,ou=foobar,ou=sites,o=company
![Page 52: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/52.jpg)
52
OpenSSH/usr/local/etc/ssh/sshd_configUseLPK yesLpkLdapConf /usr/local/etc/nss_ldap.confLpkServers ldap://ldap.company.ruLpkForceTLS yesLpkUserDN ou=users,o=company
LpkBindDNuid=pam,ou=virtual,ou=foobar,ou=sites,o=company
LpkBindPw 26a9e1b8df74606eaafa2dde8f8964c1
![Page 53: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/53.jpg)
53
Sudo + LDAP• Sudo – стандарт де-факто для контроля
выдачи привилегий (в т.ч. под root’ом)• Настройки файла sudoers можно хранить в
LDAP– Почти без потери функциональности– При этом для надёжности локальный файл
sudoers можно просто запретить читать
![Page 54: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/54.jpg)
54
Сайты: sudoerso=company,ou=sites,ou=foobar ou=sudoers
cn=defaults cn=root@mgmt-dev cn=%www@dev-web
![Page 55: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/55.jpg)
55
Sudo: defaultsdn: cn=defaults,ou=sudoers, ou=foobar,ou=sites,o=company
objectClass: sudoRolecn: defaultssudoOption: !env_resetsudoOption: ignore_local_sudoers
![Page 56: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/56.jpg)
56
Sudo: примерdn: cn=root@mgmt-dev,ou=sudoers, ou=foobar,ou=sites,o=company
objectClass: sudoRolecn: root@mgmt-devsudoCommand: ALLsudoHost: x0666.mgmtsudoOption: !authenticatesudoRunAs: rootsudoUser: vpupkin
![Page 57: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/57.jpg)
57
Виртуальные пользователи• В LDAP пользователь – это тот, кто:– Есть как объект в DIT– Имеет пароль в атрибуте userPassword
• Как следствие он:– Может делать bind к DIT– Т.е. получает доступ к дереву с некими правами
![Page 58: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/58.jpg)
58
Сайты: вирт. userso=company,ou=sites,ou=foobar ou=virtual
uid=inventory-bot uid=pam uid=wiki-bind uid=jabber-notifier
![Page 59: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/59.jpg)
59
Вирт. user: примерdn: uid=pam,ou=virtual, ou=foobar,ou=sites,o=company
objectClass: account, simpleSecurityObjectuid: pamuserPassword: {SSHA}TgTWBI+nMOOYC8OMLIZaHufQjFDsS2UHzbx12Q==
description: PAM binding
![Page 60: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/60.jpg)
60
Apache + LDAP: SubversionAuthBasicProvider ldapAuthType BasicAuthName "Subversion"AuthLDAPBindDN uid=apache-
svn,ou=virtual,ou=devel,ou=sites,o=companyAuthLDAPBindPassword 09a5f58cdd4fbd038d86703d0984d604AuthLDAPURL ldaps://ldap.company.ru/ou=users,o=company?uid?sub
AuthLDAPGroupAttribute uniqueMemberAuthLDAPGroupAttributeIsDN onRequire ldap-group
cn=subversion,ou=groups,ou=devel,ou=sites,o=companyAuthLDAPRemoteUserAttribute uidAuthzLDAPAuthoritative on
AuthzSVNAccessFile /usr/local/etc/subversion/access.conf
![Page 61: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/61.jpg)
61
OpenLDAP: подсистемы• OpenLDAP Software 2.4 Administrator's Guide• Backend - hdb• Overlays:– accesslog – протоколирование изменений (в отдельное
поддерево)– unique – гарантия уникальности объекта:
uid, uidNumber, mail, mailLocalAddress,ipHostNumber
– memberof – автоматические backlink ссылки
![Page 62: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/62.jpg)
62
OpenLDAP: ACL• Rule-based Access Control Lists - очень мощный
синтаксис– «Access Control», slapd.access(5)
• Можно делать тесты– slapacl(8)
• Есть экспериментальные ACI - контроль доступа на уровне объекта(ов), когда ACL хранятся прямо в дереве. Не рекомендую.
![Page 63: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/63.jpg)
63
OpenLDAP: репликация• Replication:– LDAP Sync Replication– Delta-syncrepl replication– N-Way Multi-Master replication– MirrorMode replication– Syncrepl Proxy
• Мы используем MirrorMode– Есть куда расти
![Page 64: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/64.jpg)
64
Инструментарий
• Command line forever!– ldapsearch, ldapadd, ldapmodify, ldapdelete, …– ldapvi – вся мощь Vim для LDAP!
• Apache Directory Studio – Java GUI• Внутренние разработки:– ldap_ctl, perl backends, …
![Page 65: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/65.jpg)
65
III. РазмышленияIII. Размышления
![Page 66: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/66.jpg)
66
Где использовать LDAP ?• Все реализации LDAP оптимизированы на
массовые чтения (в отличии от SQL)– Dynamic Directory Services – это извращение
• Хорошая репликация• Время «запрос-ответ» можно уменьшать• Это служба каталогов, а не lookup сервис (в
отличии от DNS)– Т.е. удобство схем, мощный поиск
![Page 67: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/67.jpg)
67
Почему не SQL ?• SQL – это реляционная модель• out-of-box:– Много полезных и de-facto стандартных схем– Аудит, репликация
• Стандартный протокол – много software и hardware его умеют
• Это служба каталогов, а не lookup сервис (в отличии от DNS)– Т.е. удобство схем, мощный поиск
![Page 68: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/68.jpg)
68
Где мы не используем LDAP
• Хранение в LDAP полностью зон DNS– Есть схемы: DNSZone, DNSDomain2– Поддерживается в BIND, PowerDNS– Очень неудобно править *YMMV
• Интеграция с DHCP– Пока не было нужно, возможно будет для PXE
![Page 69: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/69.jpg)
69
Что в планах
• Хранение в LDAP корпоративных PGP Keys– gnupg 2.x так умеет
• Реализация шаблонов (templates) для заведения учётной записи / её upgrad’а
• PKI – хранить внутренние SSL-сертификаты
![Page 70: LDAP in infrastructure (RootConf 2009)](https://reader038.fdocuments.net/reader038/viewer/2022102721/548c9b7cb47959f4448b4591/html5/thumbnails/70.jpg)
70
Вопросы?(по теме доклада)Вопросы?
(по теме доклада)
Сергей Скворцов[email protected]
http://protey.ru/blog/2009/04/rootconf-2009.html