Для начала потребовалось перевести домен WIN2003, а также сервисы, что там крутятся: dns, dhcp.
Итак, приступим. Для начала обновляем порты:
Код: Выделить всё
[f0s@mail] /home/f0s/> cd /usr/ports
[f0s@mail] /usr/ports/> cvsup -g -L 2 /usr/local/etc/supfile
пользователей и машин домена, а также здесь будут хранится записи dns и располагаться настройки dhcp (в ближайшем
будущем планирую там держать jabber, адрессную книгу и почту). Надеюсь вы уже поняли все преимущества данной фичи?
Единая точка администрирования всей сети (не нужно ходить по разным конфигам, и добавлять новых юзеров, боясь забыть
прописать кого-нибудь в одной из нужных прог, а хдесь все в одном каталоге, никогда не запутешься. Да и удалять тоже
просто), масштабируемость, безопасность, поддержка различных операционных систем (есть возможность рулить всем даже
с виндовой машины клиентом под учеткой root'a).
Код: Выделить всё
[f0s@mail] /usr/ports/> cd /usr/ports/net/openldap23-server/
[f0s@mail] /usr/ports/net/openldap23-server/> make config
из опций я выбрал в общем-то все по дефолту: TCP_WRAPPERS, BDB, DYNAMIC_BACKENDS, SLURPD
Код: Выделить всё
[f0s@mail] /usr/ports/net/openldap23-server/> make install clean
[f0s@mail] /usr/ports/net/openldap23-server/> rehash
Код: Выделить всё
[f0s@mail] /usr/ports/net/openldap23-server/> ee /usr/local/etc/openldap/slapd.conf:
Код: Выделить всё
include /usr/local/etc/openldap/schema/core.schema
include /usr/local/etc/openldap/schema/cosine.schema
include /usr/local/etc/openldap/schema/inetorgperson.schema
include /usr/local/etc/openldap/schema/misc.schema
include /usr/local/etc/openldap/schema/nis.schema
include /usr/local/etc/openldap/schema/openldap.schema
#схемы самбы берутся из самбы (потом скопируем), схемы dns и dhcp тоже позже скопируем. пока строчки закоментарим
#include /usr/local/etc/openldap/schema/samba.schema
#include /usr/local/etc/openldap/schema/dnszone.schema
#include /usr/local/etc/openldap/schema/dhcp.schema
pidfile /var/run/openldap/slapd.pid
argsfile /var/run/openldap/slapd.args
# Load dynamic backend modules:
modulepath /usr/local/libexec/openldap
moduleload back_ldbm
access to attrs=userPassword
by self write
by anonymous auth
by * none
access to *
by self write
by anonymous read
by * none
#######################################################################
# BDB database definitions
#######################################################################
database ldbm
suffix "dc=artpaint,dc=spb,dc=ru"
rootdn "cn=root,dc=artpaint,dc=spb,dc=ru"
#
# пароль на рута можно сгенерировать с помощью slappasswd
#
rootpw {SSHA}H2jF/C3atuiJywZT4LW4kTYtLG2yKiRk
directory /var/db/openldap-data
index objectClass eq
index cn eq
все. теперь выставляем права на директорию с данными лдап:
Код: Выделить всё
[f0s@mail] /usr/ports/net/openldap23-server/> cd /var/db
[f0s@mail] /var/db/> chmod 0700 openldap-data
теперь сделаем так, чтобы это все дело запускалось. Добавляем в rc.conf такие строчки:
Код: Выделить всё
[f0s@mail] /var/db/> ee /etc/rc.conf
slapd_enable="YES"
slapd_flags="-h 'ldapi://%2fvar%2frun%2fopenldap%2fldapi/ ldap://192.168.10.8/ ldap://127.0.0.1/'"
slapd_sockets="/var/run/openldap/ldapi"
В данном случае 192.168.10.8 - это IP адрес данной машины, где собсно я и устанавливаю OpenLDAP. Теперь запускаем
сервер:
Код: Выделить всё
[f0s@mail] /var/db/> usr/local/etc/rc.d/slapd start
Starting slapd.
И проверяем, запустился ли:
Код: Выделить всё
[f0s@mail] /var/db/> ps -ax | grep slap
911 ?? Is 0:06,06 /usr/local/libexec/slapd -h ldapi://%2fvar%2frun%2fop
39335 p2 RV 0:00,00 grep slap (csh)
есть контакт

Теперь добавляем данные в ldap, для этого создаем файл main.ldif
Код: Выделить всё
[f0s@mail] /var/db/> cd /usr/local/etc/openldap
[f0s@mail] /usr/local/etc/openldap/> ee main.ldif
Код: Выделить всё
dn: dc=artpaint,dc=spb,dc=ru
objectClass: dcObject
objectClass: organization
objectClass: top
dc: artpaint
o: artpaint
dn: ou=users,dc=artpaint,dc=spb,dc=ru
objectClass: top
objectClass: organizationalUnit
ou: users
dn: ou=groups,dc=artpaint,dc=spb,dc=ru
objectClass: top
objectClass: organizationalUnit
ou: groups
dn: ou=computers,dc=artpaint,dc=spb,dc=ru
objectClass: top
objectClass: organizationalUnit
ou: computers
теперь добавляем:
Код: Выделить всё
[f0s@mail] /usr/local/etc/openldap/> ldapadd -x -D "cn=root,dc=artpaint,dc=spb,dc=ru" -w password -f main.ldif
adding new entry "dc=artpaint,dc=spb,dc=ru"
adding new entry "ou=users,dc=artpaint,dc=spb,dc=ru"
adding new entry "ou=groups,dc=artpaint,dc=spb,dc=ru"
adding new entry "ou=computers,dc=artpaint,dc=spb,dc=ru"
[f0s@mail] /usr/local/etc/openldap/> rm main.ldif
Код: Выделить всё
[f0s@mail] /usr/local/etc/openldap/> cd /usr/ports/net/nss_ldap/
[f0s@mail] /usr/ports/net/nss_ldap/> make install clean
[f0s@mail] /usr/ports/net/nss_ldap/> rehash
[f0s@mail] /usr/ports/net/nss_ldap/> ee /usr/local/etc/nss_ldap.conf
Код: Выделить всё
host 127.0.0.1
base dc=artpaint,dc=spb,dc=ru
uri ldap://mail.artpaint/
ldap_version 3
port 389
scope one
timelimit 30
bind_timelimit 10
bind_policy soft
nss_connect_policy persist
idle_timelimit 3600
nss_paged_results yes
pagesize 1000
nss_base_passwd ou=users,dc=artpaint,dc=spb,dc=ru?one
nss_base_group ou=groups,dc=artpaint,dc=spb,dc=ru?one
nss_base_passwd ou=computers,dc=artpaint,dc=spb,dc=ru?one
nss_base_shadow ou=users,dc=artpaint,dc=spb,dc=ru?one
С этим все. Далее редактируем:
Код: Выделить всё
[f0s@mail] /usr/ports/net/nss_ldap/> ee /etc/nsswitch.conf
group: files ldap
hosts: files dns
networks: files
passwd: files ldap
shadow: files ldap
shells: files
Далее можно установить набор скриптов для работы с пользователям в LDAP. Но в приниципе необязательно. Итак:
Код: Выделить всё
[f0s@mail] /usr/ports/net/nss_ldap/> cd /usr/ports/net/ldapscripts/
[f0s@mail] /usr/ports/net/ldapscripts/> make install clean
[f0s@mail] /usr/ports/net/ldapscripts/> ee /usr/local/etc/ldapscripts/ldapscripts.conf
Код: Выделить всё
SERVER="127.0.0.1"
BINDDN="cn=root,dc=artpaint,dc=spb,dc=ru"
BINDPWD="вписываете_ваш_пароль_в_открытом_виде"
SUFFIX="dc=artpaint,dc=spb,dc=ru" # Global suffix
GSUFFIX="ou=groups" # Groups ou (just under $SUFFIX)
USUFFIX="ou=users" # Users ou (just under $SUFFIX)
MSUFFIX="ou=computers" # Machines ou (just under $SUFFIX)
GIDSTART="10000" # Group ID
UIDSTART="10000" # User ID
MIDSTART="20000" # Machine ID
USHELL="/usr/sbin/nologin"
UHOMES="/home/samba/homes/%u"
ASKGECOS="no"
CREATEHOMES="yes"
HOMESKEL="/etc/skel"
HOMEPERMS="700"
PASSWORDGEN="head -c8 /dev/random | uuencode -m - | sed -n -e '2s|=*$||;2p' | sed -e 's|+||g' -e 's|/||g'"
RECORDPASSWORDS="yes"
PASSWORDFILE="/var/log/ldapscripts_passwd.log"
LOGFILE="/var/log/ldapscripts.log"
LDAPSEARCHBIN="/usr/local/bin/ldapsearch"
LDAPADDBIN="/usr/local/bin/ldapadd"
LDAPDELETEBIN="/usr/local/bin/ldapdelete"
LDAPMODIFYBIN="/usr/local/bin/ldapmodify"
LDAPMODRDNBIN="/usr/local/bin/ldapmodrdn"
LDAPPASSWDBIN="/usr/local/bin/ldappasswd"
GETENTPWCMD=""
GETENTGRCMD=""
GTEMPLATE=""
UTEMPLATE=""
MTEMPLATE=""
Код: Выделить всё
[f0s@mail] /usr/ports/net/ldapscripts/> cd /usr/local/etc/ldapscripts
[f0s@mail] /usr/local/etc/ldapscripts/> chmod 0640 ldapscripts.conf
[f0s@mail] /usr/local/etc/ldapscripts/> chown root:wheel ldapscripts.conf
Добавляем группы в ldap:
Код: Выделить всё
[f0s@mail] /usr/> ldapaddgroup admins
Successfully added group admins to LDAP
[f0s@mail] /usr/> ldapaddgroup users
Successfully added group people to LDAP
[f0s@mail] /usr/> ldapaddgroup computers
Successfully added group computers to LDAP
[f0s@mail] /usr/> ldapadduser admin admins
Successfully added user admin to LDAP
Successfully set password for user admin
Successfully created home directory for user admin
3.0.24, либо 3.0.25а и выше. В 3.0.25 серьезный баг - проблемы с "password expiration", будете долго думать в чем
дело

Итак,
Код: Выделить всё
[f0s@mail] /usr/> cd /usr/ports/net/samba3/
[f0s@mail] /usr/ports/net/samba3/> make config
Код: Выделить всё
[f0s@mail] /usr/ports/net/samba3/> make install clean
[f0s@mail] /usr/ports/net/samba3/> rehash
Код: Выделить всё
[f0s@mail] /usr/> cp /usr/local/share/examples/samba/LDAP/samba.schema /usr/local/etc/openldap/schema/samba.schema
Код: Выделить всё
[f0s@mail] /usr/ports/net/samba3/> /usr/local/etc/rc.d/slapd restart
Код: Выделить всё
[global]
# имя домена
workgroup = artpaint
# типа коментарий самба сервера
server string = mail.artpaint
#имя компа с самбой в сетевом окружении
netbios name = mail
security = user
hosts allow = 192.168.10. 192.168.20. 192.168.0. 127.
load printers = no
log file = /var/log/samba/log.%m
max log size = 50
acl compatibility = win2k
encrypt passwords = yes
admin users = admin
passdb backend = ldapsam:ldap://127.0.0.1/
# здесь описываем лдап
ldap suffix = dc=artpaint,dc=spb,dc=ru
ldap user suffix = ou=users
ldap group suffix = ou=groups
ldap machine suffix = ou=computers
ldap admin dn = "cn=root,dc=artpaint,dc=spb,dc=ru"
ldap delete dn = no
ldap ssl = off
winbind uid = 10000-20000
winbind gid = 10000-20000
winbind separator = @
winbind use default domain = False
# делаем PDC
socket options = TCP_NODELAY
local master = yes
os level = 64
domain master = yes
preferred master = yes
domain logons = yes
# если хоиите юзать логон скрипты, то раскоментариваете
; logon script = %m.bat
; logon script = %U.bat
# путь к перемещаемому профилю
logon path = \\%L\profiles
# путь к хомякам юзеров
logon home = \\%L\HOME
logon drive = H:
wins support = yes
dns proxy = yes
display charset = koi8-r
unix charset = koi8-r
dos charset = cp866
timeserver = yes
# скрипты для добавления юзеров и групп (юзается в usermgr от nt4)
add machine script = /usr/local/bin/ldapaddmachine '%u' computers
add user script = /usr/local/bin/ldapadduser '%u' people
add group script = /usr/local/bin/ldapaddgroup '%g'
add user to group script = /usr/local/bin/ldapaddusertogroup '%u' '%g'
delete user script = /usr/local/bin/ldapdeleteuser '%u'
delete group script = /usr/local/bin/ldapdeletegroup '%g'
delete user from group script = /usr/local/bin/ldapdeleteuserfromgroup '%u' '%g'
set primary group script = /usr/local/bin/ldapsetprimarygroup '%u' '%g'
rename user script = /usr/local/bin/ldaprenameuser '%uold' '%unew'
# делаем шару на хомяки
[HOME]
comment = Home Directories
path = /home/samba/homes/%U
read only = no
public = no
writable = yes
create mask = 0600
browseable = no
directory mask = 0700
# делаем шару на нетлогон (для запуска скриптов)
[netlogon]
comment = Network Logon Service
path = /usr/local/etc/samba/netlogon
guest ok = yes
writable = no
share modes = no
browseable = no
# делаем шару на перемещаемые профили
[profiles]
create mask = 0600
directory mask = 0700
path = /home/samba/profiles/%u
writeable = yes
browseable = no
locking = no
# просто так :) чтобы можно было на тачку заходить
[IPC$]
path = /tmp
hosts allow = 192.168.10.0/24 192.168.20.0/24 192.168.0.0/24 127.0.0.1
hosts deny = 0.0.0.0/0
Здесь используются перемещаемые профили, то есть все настройки юзеров на сервере и домашние папки тоже. Очень
удобно. Теперь необходимо созать каталоги samba/homes && samba/profiles в /home, и проверить права на них:
Код: Выделить всё
[f0s@mail] /home/samba/> chown root:users *
[f0s@mail] /home/samba/> ll
drwxr-xr-x 15 root users 512 18 июл 09:02 homes
drwxr-xr-x 15 root users 512 18 июл 09:03 profiles
Сами домашние папки и профили должны быть с правами 0700, группу на них ставлю users.
Код: Выделить всё
[f0s@mail] /home/samba/homes/> ll
drwx------ 3 admin users 512 18 июл 17:11 admin
drwx------ 2 andreeva users 512 17 июл 12:27 andreeva
drwx------ 3 f0s users 512 19 июл 15:30 f0s
[.skip.]
drwx------ 3 vinogradov users 512 16 июл 16:30 vinogradov
Код: Выделить всё
[f0s@mail] /home/samba/homes/> smbpasswd -w password
Setting stored password for "cn=root,dc=artpaint,dc=spb,dc=ru" in secrets.tdb
Создаем каталог для скриптов:
Код: Выделить всё
[f0s@mail] /usr/local/etc/samba/> mkdir netlogon
Код: Выделить всё
[f0s@mail] /usr/local/etc/samba/> ll
drwxr-xr-x 2 root wheel 512 15 июн 12:37 netlogon
-rw------- 1 root wheel 4096 19 июл 15:34 schannel_store.tdb
-rw------- 1 root wheel 8192 12 июл 16:56 secrets.tdb
Код: Выделить всё
[f0s@mail] /home/samba/homes/> smbpasswd -a admin
New SMB password:
Retype new SMB password:
Added user admin.
Делаем сопоставление групп группам NT
Код: Выделить всё
[f0s@mail] /home/> net groupmap add ntgroup="Domain Admins" unixgroup=admins rid=512 type=domain
Successfully added group admins to the mapping db as a domain group
[f0s@mail] /home/> net groupmap add ntgroup="Domain Users" unixgroup=users rid=513 type=domain
Successfully added group people to the mapping db as a domain group
[f0s@mail] /home/> net groupmap add ntgroup="Domain Computers" unixgroup=computers rid=515 type=domain
Successfully added group computers to the mapping db as a domain group
512 - Domain Admins
513 - Domain Users
514 - Domain Guests
515 - Domain Computers
Чтобы ввести виндовую машину в домен, правый клик на "мой компьютер", далее там выбираем "является членом домена..
ARTPAINT", вводим имя и пароль админа. Тачка в домене

Для удобства администрирования устанавливаем сразу же программку ldapadmin (теперь мы будем ей пользоваться).
Скачать можно тут: http://ldapadmin.sourceforge.net/
Добавим самбу в свой домен:
Код: Выделить всё
[f0s@mail] /usr/> net rpc join -S mail -U admin%password
Итак. Пришло время настройки DNS.
Сначала копируем вот эти схемки в /usr/local/etc/openldap/schema/
Код: Выделить всё
[f0s@mail] /home/> ee /usr/local/etc/openldap/schema/dnszone.schema
attributetype ( 1.3.6.1.4.1.2428.20.0.0 NAME 'dNSTTL'
DESC 'An integer denoting time to live'
EQUALITY integerMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
attributetype ( 1.3.6.1.4.1.2428.20.0.1 NAME 'dNSClass'
DESC 'The class of a resource record'
EQUALITY caseIgnoreIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 1.3.6.1.4.1.2428.20.0.2 NAME 'zoneName'
DESC 'The name of a zone, i.e. the name of the highest node in the zone'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 1.3.6.1.4.1.2428.20.0.3 NAME 'relativeDomainName'
DESC 'The starting labels of a domain name'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 1.3.6.1.4.1.2428.20.1.12 NAME 'pTRRecord'
DESC 'domain name pointer, RFC 1035'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 1.3.6.1.4.1.2428.20.1.13 NAME 'hInfoRecord'
DESC 'host information, RFC 1035'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 1.3.6.1.4.1.2428.20.1.14 NAME 'mInfoRecord'
DESC 'mailbox or mail list information, RFC 1035'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 1.3.6.1.4.1.2428.20.1.16 NAME 'tXTRecord'
DESC 'text string, RFC 1035'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 1.3.6.1.4.1.2428.20.1.18 NAME 'aFSDBRecord'
DESC 'for AFS Data Base location, RFC 1183'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 1.3.6.1.4.1.2428.20.1.24 NAME 'SigRecord'
DESC 'Signature, RFC 2535'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 1.3.6.1.4.1.2428.20.1.25 NAME 'KeyRecord'
DESC 'Key, RFC 2535'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 1.3.6.1.4.1.2428.20.1.28 NAME 'aAAARecord'
DESC 'IPv6 address, RFC 1886'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 1.3.6.1.4.1.2428.20.1.29 NAME 'LocRecord'
DESC 'Location, RFC 1876'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 1.3.6.1.4.1.2428.20.1.30 NAME 'nXTRecord'
DESC 'non-existant, RFC 2535'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 1.3.6.1.4.1.2428.20.1.33 NAME 'sRVRecord'
DESC 'service location, RFC 2782'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 1.3.6.1.4.1.2428.20.1.35 NAME 'nAPTRRecord'
DESC 'Naming Authority Pointer, RFC 2915'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 1.3.6.1.4.1.2428.20.1.36 NAME 'kXRecord'
DESC 'Key Exchange Delegation, RFC 2230'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 1.3.6.1.4.1.2428.20.1.37 NAME 'certRecord'
DESC 'certificate, RFC 2538'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 1.3.6.1.4.1.2428.20.1.38 NAME 'a6Record'
DESC 'A6 Record Type, RFC 2874'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 1.3.6.1.4.1.2428.20.1.39 NAME 'dNameRecord'
DESC 'Non-Terminal DNS Name Redirection, RFC 2672'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 1.3.6.1.4.1.2428.20.1.43 NAME 'dSRecord'
DESC 'Delegation Signer, RFC 3658'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 1.3.6.1.4.1.2428.20.1.44 NAME 'sSHFPRecord'
DESC 'SSH Key Fingerprint, draft-ietf-secsh-dns-05.txt'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 1.3.6.1.4.1.2428.20.1.46 NAME 'rRSIGRecord'
DESC 'RRSIG, RFC 3755'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 1.3.6.1.4.1.2428.20.1.47 NAME 'nSECRecord'
DESC 'NSEC, RFC 3755'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
objectclass ( 1.3.6.1.4.1.2428.20.3 NAME 'dNSZone'
SUP top STRUCTURAL
MUST ( zoneName $ relativeDomainName )
MAY ( DNSTTL $ DNSClass $
ARecord $ MDRecord $ MXRecord $ NSRecord $
SOARecord $ CNAMERecord $ PTRRecord $ HINFORecord $
MINFORecord $ TXTRecord $ AFSDBRecord $ SIGRecord $
KEYRecord $ AAAARecord $ LOCRecord $ NXTRecord $
SRVRecord $ NAPTRRecord $ KXRecord $ CERTRecord $
A6Record $ DNAMERecord $ DSRecord $ SSHFPRecord $
RRSIGRecord $ NSECRecord ) )
Код: Выделить всё
[f0s@mail] /home/> ee /usr/local/etc/openldap/schema/dhcp.schema
attributetype ( 2.16.840.1.113719.1.203.4.1
NAME 'dhcpPrimaryDN'
EQUALITY distinguishedNameMatch
DESC 'The DN of the dhcpServer which is the primary server for the configuration.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.2
NAME 'dhcpSecondaryDN'
EQUALITY distinguishedNameMatch
DESC 'The DN of dhcpServer(s) which provide backup service for the configuration.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
attributetype ( 2.16.840.1.113719.1.203.4.3
NAME 'dhcpStatements'
EQUALITY caseIgnoreIA5Match
DESC 'Flexible storage for specific data depending on what object this exists in. Like conditional
statements, server parameters, etc. This allows the standard to evolve without needing to adjust the schema.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 2.16.840.1.113719.1.203.4.4
NAME 'dhcpRange'
EQUALITY caseIgnoreIA5Match
DESC 'The starting & ending IP Addresses in the range (inclusive), separated by a hyphen; if the range only
contains one address, then just the address can be specified with no hyphen. Each range is defined as a separate
value.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 2.16.840.1.113719.1.203.4.5
NAME 'dhcpPermitList'
EQUALITY caseIgnoreIA5Match
DESC 'This attribute contains the permit lists associated with a pool. Each permit list is defined as a
separate value.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 2.16.840.1.113719.1.203.4.6
NAME 'dhcpNetMask'
EQUALITY integerMatch
DESC 'The subnet mask length for the subnet. The mask can be easily computed from this length.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.7
NAME 'dhcpOption'
EQUALITY caseIgnoreIA5Match
DESC 'Encoded option values to be sent to clients. Each value represents a single option and contains
(OptionTag, Length, OptionValue) encoded in the format used by DHCP.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 2.16.840.1.113719.1.203.4.8
NAME 'dhcpClassData'
EQUALITY caseIgnoreIA5Match
DESC 'Encoded text string or list of bytes expressed in hexadecimal, separated by colons. Clients match
subclasses based on matching the class data with the results of match or spawn with statements in the class name
declarations.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.9
NAME 'dhcpOptionsDN'
EQUALITY distinguishedNameMatch
DESC 'The distinguished name(s) of the dhcpOption objects containing the configuration options provided by
the server.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
attributetype ( 2.16.840.1.113719.1.203.4.10
NAME 'dhcpHostDN'
EQUALITY distinguishedNameMatch
DESC 'the distinguished name(s) of the dhcpHost objects.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
attributetype ( 2.16.840.1.113719.1.203.4.11
NAME 'dhcpPoolDN'
EQUALITY distinguishedNameMatch
DESC 'The distinguished name(s) of pools.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
attributetype ( 2.16.840.1.113719.1.203.4.12
NAME 'dhcpGroupDN'
EQUALITY distinguishedNameMatch
DESC 'The distinguished name(s) of the groups.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
attributetype ( 2.16.840.1.113719.1.203.4.13
NAME 'dhcpSubnetDN'
EQUALITY distinguishedNameMatch
DESC 'The distinguished name(s) of the subnets.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
attributetype ( 2.16.840.1.113719.1.203.4.14
NAME 'dhcpLeaseDN'
EQUALITY distinguishedNameMatch
DESC 'The distinguished name of a client address.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE)
attributetype ( 2.16.840.1.113719.1.203.4.15 NAME 'dhcpLeasesDN'
DESC 'The distinguished name(s) client addresses.'
EQUALITY distinguishedNameMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
attributetype ( 2.16.840.1.113719.1.203.4.16
NAME 'dhcpClassesDN'
EQUALITY distinguishedNameMatch
DESC 'The distinguished name(s) of a class(es) in a subclass.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
attributetype ( 2.16.840.1.113719.1.203.4.17
NAME 'dhcpSubclassesDN'
EQUALITY distinguishedNameMatch
DESC 'The distinguished name(s) of subclass(es).'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
attributetype ( 2.16.840.1.113719.1.203.4.18
NAME 'dhcpSharedNetworkDN'
EQUALITY distinguishedNameMatch
DESC 'The distinguished name(s) of sharedNetworks.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
attributetype ( 2.16.840.1.113719.1.203.4.19
NAME 'dhcpServiceDN'
EQUALITY distinguishedNameMatch
DESC 'The DN of dhcpService object(s)which contain the configuration information. Each dhcpServer object has
this attribute identifying the DHCP configuration(s) that the server is associated with.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
attributetype ( 2.16.840.1.113719.1.203.4.20
NAME 'dhcpVersion' DESC 'The version attribute of this object.'
EQUALITY caseIgnoreIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.21
NAME 'dhcpImplementation'
EQUALITY caseIgnoreIA5Match
DESC 'Description of the DHCP Server implementation e.g. DHCP Servers vendor.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.22
NAME 'dhcpAddressState'
EQUALITY caseIgnoreIA5Match
DESC 'This stores information about the current binding-status of an address. For dynamic addresses managed
by DHCP, the values should be restricted to the following: "FREE", "ACTIVE", "EXPIRED", "RELEASED", "RESET",
"ABANDONED", "BACKUP". For other addresses, it SHOULD be one of the following: "UNKNOWN", "RESERVED" (an address
that is managed by DHCP that is reserved for a specific client), "RESERVED-ACTIVE" (same as reserved, but address is
currently in use), "ASSIGNED" (assigned manually or by some other mechanism), "UNASSIGNED", "NOTASSIGNABLE".'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.23
NAME 'dhcpExpirationTime'
EQUALITY generalizedTimeMatch
DESC 'This is the time the current lease for an address expires.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.24
NAME 'dhcpStartTimeOfState'
EQUALITY generalizedTimeMatch
DESC 'This is the time of the last state change for a leased address.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.25
NAME 'dhcpLastTransactionTime'
EQUALITY generalizedTimeMatch
DESC 'This is the last time a valid DHCP packet was received from the client.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.26
NAME 'dhcpBootpFlag'
EQUALITY booleanMatch
DESC 'This indicates whether the address was assigned via BOOTP.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.27
NAME 'dhcpDomainName'
EQUALITY caseIgnoreIA5Match
DESC 'This is the name of the domain sent to the client by the server. It is essentially the same as the
value for DHCP option 15 sent to the client, and represents only the domain - not the full FQDN. To obtain the full
FQDN assigned to the client you must prepend the "dhcpAssignedHostName" to this value with a ".".'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.28
NAME 'dhcpDnsStatus'
EQUALITY integerMatch
DESC 'This indicates the status of updating DNS resource records on behalf of the client by the DHCP server
for this address. The value is a 16-bit bitmask.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.29
NAME 'dhcpRequestedHostName'
EQUALITY caseIgnoreIA5Match
DESC 'This is the hostname that was requested by the client.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.30
NAME 'dhcpAssignedHostName'
EQUALITY caseIgnoreIA5Match
DESC 'This is the actual hostname that was assigned to a client. It may not be the name that was requested
by the client. The fully qualified domain name can be determined by appending the value of "dhcpDomainName" (with a
dot separator) to this name.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.31
NAME 'dhcpReservedForClient'
EQUALITY distinguishedNameMatch
DESC 'The distinguished name of a "dhcpClient" that an address is reserved for. This may not be the same as
the "dhcpAssignedToClient" attribute if the address is being reassigned but the current lease has not yet expired.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.32
NAME 'dhcpAssignedToClient'
EQUALITY distinguishedNameMatch
DESC 'This is the distinguished name of a "dhcpClient" that an address is currently assigned to. This
attribute is only present in the class when the address is leased.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.33
NAME 'dhcpRelayAgentInfo'
EQUALITY octetStringMatch
DESC 'If the client request was received via a relay agent, this contains information about the relay agent
that was available from the DHCP request. This is a hex-encoded option value.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.34
NAME 'dhcpHWAddress'
EQUALITY octetStringMatch
DESC 'The clients hardware address that requested this IP address.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.35
NAME 'dhcpHashBucketAssignment'
EQUALITY octetStringMatch
DESC 'HashBucketAssignment bit map for the DHCP Server, as defined in DHC Load Balancing Algorithm [RFC
3074].'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.36
NAME 'dhcpDelayedServiceParameter'
EQUALITY integerMatch
DESC 'Delay in seconds corresponding to Delayed Service Parameter configuration, as defined in DHC Load
Balancing Algorithm [RFC 3074]. '
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.37
NAME 'dhcpMaxClientLeadTime'
EQUALITY integerMatch
DESC 'Maximum Client Lead Time configuration in seconds, as defined in DHCP Failover Protocol [FAILOVR]'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.38
NAME 'dhcpFailOverEndpointState'
EQUALITY caseIgnoreIA5Match
DESC 'Server (Failover Endpoint) state, as defined in DHCP Failover Protocol [FAILOVR]'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
attributetype ( 2.16.840.1.113719.1.203.4.39
NAME 'dhcpErrorLog'
EQUALITY caseIgnoreIA5Match
DESC 'Generic error log attribute that allows logging error conditions within a dhcpService or a dhcpSubnet,
like no IP addresses available for lease.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
# Classes
objectclass ( 2.16.840.1.113719.1.203.6.1
NAME 'dhcpService'
DESC 'Service object that represents the actual DHCP Service configuration. This is a container object.'
SUP top
MUST (cn $ dhcpPrimaryDN)
MAY ( dhcpSecondaryDN $ dhcpSharedNetworkDN $ dhcpSubnetDN $
dhcpGroupDN $ dhcpHostDN $ dhcpClassesDN $ dhcpOptionsDN $
dhcpStatements ) )
objectclass ( 2.16.840.1.113719.1.203.6.2
NAME 'dhcpSharedNetwork'
DESC 'This stores configuration information for a shared network.'
SUP top
MUST cn
MAY ( dhcpSubnetDN $ dhcpPoolDN $ dhcpOptionsDN $ dhcpStatements)
X-NDS_CONTAINMENT ('dhcpService' ) )
objectclass ( 2.16.840.1.113719.1.203.6.3
NAME 'dhcpSubnet'
DESC 'This class defines a subnet. This is a container object.'
SUP top
MUST ( cn $ dhcpNetMask )
MAY ( dhcpRange $ dhcpPoolDN $ dhcpGroupDN $ dhcpHostDN $
dhcpClassesDN $ dhcpLeasesDN $ dhcpOptionsDN $ dhcpStatements)
X-NDS_CONTAINMENT ('dhcpService' 'dhcpSharedNetwork') )
objectclass ( 2.16.840.1.113719.1.203.6.4
NAME 'dhcpPool'
DESC 'This stores configuration information about a pool.'
SUP top
MUST ( cn $ dhcpRange )
MAY (dhcpClassesDN $ dhcpPermitList $ dhcpLeasesDN $ dhcpOptionsDN $
dhcpStatements)
X-NDS_CONTAINMENT ('dhcpSubnet' 'dhcpSharedNetwork') )
objectclass ( 2.16.840.1.113719.1.203.6.5
NAME 'dhcpGroup'
DESC 'Group object that lists host DNs and parameters. This is a container object.'
SUP top
MUST cn
MAY ( dhcpHostDN $ dhcpOptionsDN $ dhcpStatements )
X-NDS_CONTAINMENT ('dhcpSubnet' 'dhcpService' ) )
objectclass ( 2.16.840.1.113719.1.203.6.6
NAME 'dhcpHost'
DESC 'This represents information about a particular client'
SUP top
MUST cn
MAY (dhcpLeaseDN $ dhcpHWAddress $ dhcpOptionsDN $ dhcpStatements)
X-NDS_CONTAINMENT ('dhcpService' 'dhcpSubnet' 'dhcpGroup') )
objectclass ( 2.16.840.1.113719.1.203.6.7
NAME 'dhcpClass'
DESC 'Represents information about a collection of related clients.'
SUP top
MUST cn
MAY (dhcpSubClassesDN $ dhcpOptionsDN $ dhcpStatements)
X-NDS_CONTAINMENT ('dhcpService' 'dhcpSubnet' ) )
objectclass ( 2.16.840.1.113719.1.203.6.8
NAME 'dhcpSubClass'
DESC 'Represents information about a collection of related classes.'
SUP top
MUST cn
MAY (dhcpClassData $ dhcpOptionsDN $ dhcpStatements)
X-NDS_CONTAINMENT 'dhcpClass' )
objectclass ( 2.16.840.1.113719.1.203.6.9
NAME 'dhcpOptions'
DESC 'Represents information about a collection of options defined.'
SUP top AUXILIARY
MUST cn
MAY ( dhcpOption )
X-NDS_CONTAINMENT ('dhcpService' 'dhcpSharedNetwork' 'dhcpSubnet'
'dhcpPool' 'dhcpGroup' 'dhcpHost' 'dhcpClass' ) )
objectclass ( 2.16.840.1.113719.1.203.6.10
NAME 'dhcpLeases'
DESC 'This class represents an IP Address, which may or may not have been leased.'
SUP top
MUST ( cn $ dhcpAddressState )
MAY ( dhcpExpirationTime $ dhcpStartTimeOfState $
dhcpLastTransactionTime $ dhcpBootpFlag $ dhcpDomainName $
dhcpDnsStatus $ dhcpRequestedHostName $ dhcpAssignedHostName $
dhcpReservedForClient $ dhcpAssignedToClient $
dhcpRelayAgentInfo $ dhcpHWAddress )
X-NDS_CONTAINMENT ( 'dhcpService' 'dhcpSubnet' 'dhcpPool') )
objectclass ( 2.16.840.1.113719.1.203.6.11
NAME 'dhcpLog'
DESC 'This is the object that holds past information about the IP address. The cn is the time/date stamp
when the address was assigned or released, the address state at the time, if the address was assigned or released.'
SUP top
MUST ( cn )
MAY ( dhcpAddressState $ dhcpExpirationTime $ dhcpStartTimeOfState $
dhcpLastTransactionTime $ dhcpBootpFlag $ dhcpDomainName $
dhcpDnsStatus $ dhcpRequestedHostName $ dhcpAssignedHostName $
dhcpReservedForClient $ dhcpAssignedToClient $
dhcpRelayAgentInfo $ dhcpHWAddress $ dhcpErrorLog)
X-NDS_CONTAINMENT ('dhcpLeases' 'dhcpPool' 'dhcpSubnet'
'dhcpSharedNetwork' 'dhcpService' ) )
objectclass ( 2.16.840.1.113719.1.203.6.12
NAME 'dhcpServer'
DESC 'DHCP Server Object'
SUP top
MUST (cn $ dhcpServiceDN)
MAY (dhcpVersion $ dhcpImplementation $ dhcpHashBucketAssignment $ dhcpDelayedServiceParameter $
dhcpMaxClientLeadTime $ dhcpFailOverEndpointState $ dhcpStatements)
X-NDS_CONTAINMENT ('o' 'ou' 'dc') )
Теперь раскоментариваем строчки в slapd.conf касающихся вновь созданных файлов, перезапускаем slapd:
Код: Выделить всё
[f0s@mail] /usr/local/etc/rc.d/> ./slapd restart
и создаем вот такой вот такой вот
файл: dnszone.ldif:
*** Маленькое отступление: прежде чем вникать в написанное ниже, очень рекомендуется изучить принцип работы dns и
настройки named через обычные файлы. Тогда вы легко все воспроизведете. ***
Код: Выделить всё
dn: ou=dns,dc=artpaint,dc=spb,dc=ru
objectClass: top
objectClass: organizationalUnit
ou: dns
description: Domain Zones
# zone artpaint
dn: zoneName=artpaint,ou=dns,dc=artpaint,dc=spb,dc=ru
objectClass: top
objectClass: dNSZone
zoneName: artpaint
relativeDomainName: artpaint
# SOA
dn: relativeDomainName=@,zoneName=artpaint,ou=dns,dc=artpaint,dc=spb,dc=ru
objectClass: top
objectClass: dNSZone
zoneName: artpaint
relativeDomainName: @
nSRecord: mail.artpaint.
sOARecord: mail.artpaint. root.mail.artpaint. 1 8H 2H 1W 1D
# mail IN A 192.168.10.8
dn: relativeDomainName=mail,zoneName=artpaint,ou=dns,dc=artpaint,dc=spb,dc=ru
objectClass: top
objectClass: dNSZone
zoneName: artpaint
relativeDomainName: mail
dNSClass: IN
aRecord: 192.168.10.8
# router IN A 192.168.10.7
dn: relativeDomainName=router,zoneName=artpaint,ou=dns,dc=artpaint,dc=spb,dc=ru
objectClass: top
objectClass: dNSZone
zoneName: artpaint
relativeDomainName: router
dNSClass: IN
aRecord: 192.168.10.7
# fileserver IN A 192.168.10.6
dn: relativeDomainName=fileserver,zoneName=artpaint,ou=dns,dc=artpaint,dc=spb,dc=ru
objectClass: top
objectClass: dNSZone
zoneName: artpaint
relativeDomainName: fileserver
dNSClass: IN
aRecord: 192.168.10.6
# gate IN A 192.168.10.5
dn: relativeDomainName=gate,zoneName=artpaint,ou=dns,dc=artpaint,dc=spb,dc=ru
objectClass: top
objectClass: dNSZone
zoneName: artpaint
relativeDomainName: gate
dNSClass: IN
aRecord: 192.168.10.5
# terminal01 IN A 192.168.10.1
dn: relativeDomainName=terminal01,zoneName=artpaint,ou=dns,dc=artpaint,dc=spb,dc=ru
objectClass: top
objectClass: dNSZone
zoneName: artpaint
relativeDomainName: terminal01
dNSClass: IN
aRecord: 192.168.10.1
# terminal02 IN A 192.168.10.2
dn: relativeDomainName=terminal02,zoneName=artpaint,ou=dns,dc=artpaint,dc=spb,dc=ru
objectClass: top
objectClass: dNSZone
zoneName: artpaint
relativeDomainName: terminal02
dNSClass: IN
aRecord: 192.168.10.2
# terminal03 IN A 192.168.10.3
dn: relativeDomainName=terminal03,zoneName=artpaint,ou=dns,dc=artpaint,dc=spb,dc=ru
objectClass: top
objectClass: dNSZone
zoneName: artpaint
relativeDomainName: terminal03
dNSClass: IN
aRecord: 192.168.10.3
# addr-arpa
dn: zoneName=10.168.192.in-addr.arpa,ou=dns,dc=artpaint,dc=spb,dc=ru
objectClass: top
objectClass: dNSZone
zoneName: 10.168.192.in-addr.arpa
relativeDomainName: 10.168.192.in-addr.arpa
# SOA for addr-arpa
dn: relativeDomainName=@,zoneName=10.168.192.in-addr.arpa,ou=dns,dc=artpaint,dc=spb,dc=ru
objectClass: top
objectClass: dNSZone
zoneName: 10.168.192.in-addr.arpa
relativeDomainName: @
nSRecord: mail.artpaint.
sOARecord: mail.artpaint. root.mail.artpaint. 1 8H 2H 1W 1D
# PTR for .8
dn: relativeDomainName=8,zoneName=10.168.192.in-addr.arpa,ou=dns,dc=artpaint,dc=spb,dc=ru
objectClass: top
objectClass: dNSZone
zoneName: 10.168.192.in-addr.arpa
relativeDomainName: 8
pTRRecord: mail.artpaint.
# PTR for .7
dn: relativeDomainName=7,zoneName=10.168.192.in-addr.arpa,ou=dns,dc=artpaint,dc=spb,dc=ru
objectClass: top
objectClass: dNSZone
zoneName: 10.168.192.in-addr.arpa
relativeDomainName: 7
pTRRecord: router.artpaint.
# PTR for .6
dn: relativeDomainName=6,zoneName=10.168.192.in-addr.arpa,ou=dns,dc=artpaint,dc=spb,dc=ru
objectClass: top
objectClass: dNSZone
zoneName: 10.168.192.in-addr.arpa
relativeDomainName: 6
pTRRecord: fileserver.artpaint.
# PTR for .5
dn: relativeDomainName=5,zoneName=10.168.192.in-addr.arpa,ou=dns,dc=artpaint,dc=spb,dc=ru
objectClass: top
objectClass: dNSZone
zoneName: 10.168.192.in-addr.arpa
relativeDomainName: 5
pTRRecord: gate.artpaint.
# PTR for .1
dn: relativeDomainName=1,zoneName=10.168.192.in-addr.arpa,ou=dns,dc=artpaint,dc=spb,dc=ru
objectClass: top
objectClass: dNSZone
zoneName: 10.168.192.in-addr.arpa
relativeDomainName: 1
pTRRecord: terminal01.artpaint.
# PTR for .2
dn: relativeDomainName=2,zoneName=10.168.192.in-addr.arpa,ou=dns,dc=artpaint,dc=spb,dc=ru
objectClass: top
objectClass: dNSZone
zoneName: 10.168.192.in-addr.arpa
relativeDomainName: 2
pTRRecord: terminal02.artpaint.
# PTR for .3
dn: relativeDomainName=3,zoneName=10.168.192.in-addr.arpa,ou=dns,dc=artpaint,dc=spb,dc=ru
objectClass: top
objectClass: dNSZone
zoneName: 10.168.192.in-addr.arpa
relativeDomainName: 3
pTRRecord: terminal03.artpaint.
Код: Выделить всё
dn: relativeDomainName=localhost,zoneName=artpaint,ou=dns,dc=artpaint,dc=spb,dc=ru
objectClass: top
objectClass: dNSZone
zoneName: artpaint
relativeDomainName: localhost
dNSClass: IN
aRecord: 127.0.0.1
Код: Выделить всё
dn: zoneName=0.0.127.in-addr.arpa,ou=dns,dc=artpaint,dc=spb,dc=ru
objectClass: top
objectClass: dNSZone
relativeDomainName: 0.0.127.in-addr.arpa
zoneName: 0.0.127.in-addr.arpa
dn: relativeDomainName=@,zoneName=0.0.127.in-addr.arpa,ou=dns,dc=artpaint,dc=spb,dc=ru
objectClass: top
objectClass: dNSZone
relativeDomainName: @
zoneName: 0.0.127.in-addr.arpa
nSRecord: mail.artpaint.
sOARecord: mail.artpaint. root.mail.artpaint. 1 3H 1H 12W 1H
dn: relativeDomainName=1,zoneName=0.0.127.in-addr.arpa,ou=dns,dc=artpaint,dc=spb,dc=ru
objectClass: top
objectClass: dNSZone
relativeDomainName: 1
pTRRecord: localhost.artpaint.
zoneName: 0.0.127.in-addr.arpa
Добавляем записи в лдап:
Код: Выделить всё
[f0s@mail] /home/> ldapadd -x -D "cn=root,dc=artpaint,dc=spb,dc=ru" -W -f dnszone.ldif
[f0s@mail] /home/> ldapadd -x -D "cn=root,dc=artpaint,dc=spb,dc=ru" -W -f localhost.ldif
[f0s@mail] /home/> ldapadd -x -D "cn=root,dc=artpaint,dc=spb,dc=ru" -W -f localhost-rev.ldif
Теперь устанавливаем bind, который поддерживаем работу с лдап:
Код: Выделить всё
[f0s@mail] /home/> cd /usr/ports/dns/bind9-sdb-ldap
[f0s@mail] /usr/ports/dns/bind9-sdb-ldap/> make install clean
Теперь создаем конфигурационный файл named.conf
Код: Выделить всё
[f0s@mail] /home/> ee /etc/namedb/named.conf
Код: Выделить всё
acl lan { 192.168.10.0/24; 192.168.20.0/24; 192.168.0.0/24; };
acl transfers { 127.0.0.1; };
acl trusted { 192.168.100.0/24; };
key "rndc-key" {
algorithm hmac-md5;
secret "JW/YeNtwZo+uxKqIsWtpUZ==";
};
controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndc-key"; };
};
options {
directory "/etc/namedb";
pid-file "/var/run/named/pid";
dump-file "/var/dump/named_dump.db";
statistics-file "/var/stats/named.stats";
version "Windows 95";
listen-on { 127.0.0.1; 192.168.10.8; };
forward only;
forwarders { 80.177.122.1; 80.177.123.1; };
allow-query { lan; trusted; };
allow-recursion { trusted; lan; };
query-source address * port 53;
};
zone "." {
type hint;
file "named.root";
};
zone "artpaint" {
type master;
database "ldap ldap://192.168.10.8/zoneName=artpaint,ou=dns,dc=artpaint,dc=spb,dc=ru 178600";
allow-query { lan; trusted; };
allow-transfer { transfers; };
};
zone "10.168.192.in-addr.arpa" {
type master;
database "ldap ldap://192.168.10.8/zoneName=10.168.192.in-addr.arpa,ou=dns,dc=artpaint,dc=spb,dc=ru 178600";
allow-query { lan; trusted; };
allow-transfer { transfers; };
};
zone "0.0.127.in-addr.arpa" {
type master;
database "ldap ldap://192.168.10.8/zoneName=0.0.127.in-addr.arpa,ou=dns,dc=artpaint,dc=spb,dc=ru 178600";
allow-query { lan; trusted; };
allow-transfer { transfers; };
};
Обратите внимание, rndc-key нужно сконфигурировать. Для этого запускаем rndc-confgen, и там смотрим что он нам за
информацию выдаст на экран, и делаем по этой инструкции.
описываю подробнее:
Код: Выделить всё
[f0s@mail] /home/f0s/> rndc-confgen > tmp
[f0s@mail] /home/f0s/> cat tmp
# Start of rndc.conf
key "rndc-key" {
algorithm hmac-md5;
secret "IK0mpNGfZ82o8IrRuJRN2A==";
};
options {
default-key "rndc-key";
default-server 127.0.0.1;
default-port 953;
};
# End of rndc.conf
# Use with the following in named.conf, adjusting the allow list as needed:
# key "rndc-key" {
# algorithm hmac-md5;
# secret "IK0mpNGfZ82o8IrRuJRN2A==";
# };
#
# controls {
# inet 127.0.0.1 port 953
# allow { 127.0.0.1; } keys { "rndc-key"; };
# };
# End of named.conf
[f0s@mail] /home/f0s/>
Код: Выделить всё
key "rndc-key" {
algorithm hmac-md5;
secret "IK0mpNGfZ82o8IrRuJRN2A==";
};
options {
default-key "rndc-key";
default-server 127.0.0.1;
default-port 953;
};
Добавляем в rc.conf:
Код: Выделить всё
[f0s@mail] /home/> ee /etc/rc.conf
named_enable="YES"
named_flags="-c /etc/namedb/named.conf"
named_program="/usr/local/sbin/named"
Код: Выделить всё
[f0s@mail] /var/named/> chown -R bind:bind var
[f0s@mail] /var/named/> chown bind:bind /var/named/etc/namedb/master
[f0s@mail] /var/named/> chown bind:bind /var/named/etc/namedb/dynamic
[f0s@mail] /etc/namedb/> ll
total 34
-rw-r--r-- 1 bind bind 173 25 июн 17:32 10.168.192.rev
-rw-r--r-- 1 bind bind 173 25 июн 17:27 64.52.84.rev
-rw-r--r-- 1 bind bind 423 12 янв 2007 PROTO.localhost-v6.rev
-rw-r--r-- 1 bind bind 423 12 янв 2007 PROTO.localhost.rev
-rw-r--r-- 1 bind bind 564 25 июн 17:25 artpaint.spb.ru
drwxr-xr-x 2 bind bind 512 12 янв 2007 dynamic
-rw-r--r-- 1 bind bind 446 22 июн 10:07 localhost-v6.rev
-rw-r--r-- 1 bind bind 446 25 июн 17:28 localhost.rev
-rw-r--r-- 1 bind bind 1089 12 янв 2007 make-localhost
drwxr-xr-x 2 bind bind 512 22 июн 10:08 master
-rw-r--r-- 1 bind bind 4318 3 июл 11:12 named.conf
-rw-r--r-- 1 bind bind 2600 12 янв 2007 named.root
-rw-r--r-- 1 root wheel 479 29 июн 13:52 rndc.conf
drwxr-xr-x 2 bind bind 512 12 янв 2007 slave
[f0s@mail] /etc/namedb/>
Код: Выделить всё
[f0s@mail] /var/named/> /etc/rc.d/named start
Код: Выделить всё
[f0s@mail] /var/named/> cd /usr/ports/net/isc-dhcp3-server
[f0s@mail] /usr/ports/net/isc-dhcp3-server/> make install clean
Создаем файлик dhcp.ldif такого содержания (в нем хранятся все параметры области, в будущем можно редактировать
через ldapadmin):
Код: Выделить всё
[f0s@mail] /usr/local/etc/openldap/> ee dhcp.ldif
dn: ou=dhcp, dc=artpaint,dc=spb,dc=ru
ou: dhcp
description: configuration information for DHCP
objectClass: top
objectClass: organizationalUnit
dn: cn=conf, ou=dhcp, dc=artpaint,dc=spb,dc=ru
dhcpSecondaryDN: cn=mail.artpaint, ou=dhcp, dc=artpaint,dc=spb,dc=ru
dhcpStatements: ddns-update-style none
dhcpStatements: ddns-updates off
dhcpStatements: client-updates off
dhcpStatements: use-host-decl-names on
dhcpStatements: always-reply-rfc1048 on
dhcpStatements: default-lease-time 86400
dhcpStatements: max-lease-time 129600
#dhcpStatements: authoritative
objectClass: top
objectClass: dhcpService
objectClass: dhcpOptions
dhcpPrimaryDN: ou=dhcp, dc=artpaint,dc=spb,dc=ru
dhcpOption: domain-name "artpaint"
dhcpOption: netbios-scope ""
dhcpOption: netbios-node-type 8
dhcpOption: time-offset 10800
dhcpOption: ip-forwarding off
#dhcpOption: option-150 code 150 = ipaddress
dhcpOption: netbios-name-servers 192.168.10.8
cn: conf
dn: cn=mail.artpaint, ou=dhcp, dc=artpaint,dc=spb,dc=ru
dhcpServiceDN: cn=conf, ou=dhcp, dc=artpaint,dc=spb,dc=ru
objectClass: top
objectClass: dhcpServer
cn: mail.artpaint
dn: cn=192.168.10.0, cn=conf, ou=dhcp, dc=artpaint,dc=spb,dc=ru
objectClass: top
objectClass: dhcpSubnet
objectClass: dhcpOptions
dhcpNetMask: 24
dhcpRange: 192.168.10.50 192.168.10.150
dhcpOption: domain-name-servers 192.168.10.8
dhcpOption: routers 192.168.10.7
# для tftp
#dhcpOption: bootfile-name "pxelinux.0";
#dhcpOption: tftp-server-name "192.168.10.8";
#
dhcpOption: ntp-servers 192.168.10.7
dhcpOption: broadcast-address 192.168.10.255
dhcpOption: default-ip-ttl 64
dhcpOption: default-tcp-ttl 64
cn: 192.168.10.0
dn: cn=print-export, cn=192.168.10.0, cn=conf, ou=dhcp, dc=artpaint, dc=spb, dc=ru
dhcpHWAddress: ethernet 00:00:aa:99:b2:bd
dhcpStatements: fixed-address 192.168.10.15
objectClass: top
objectClass: dhcpHost
objectClass: dhcpOptions
cn: print-export
# ниже резервирование по макадресу. юзаю для принтеров сетевых.
dn: cn=print-buh, cn=192.168.10.0, cn=conf, ou=dhcp, dc=artpaint, dc=spb, dc=ru
dhcpHWAddress: ethernet 00:00:aa:99:b0:7f
dhcpStatements: fixed-address 192.168.10.16
objectClass: top
objectClass: dhcpHost
objectClass: dhcpOptions
cn: print-buh
dn: cn=print-sales-kanc, cn=192.168.10.0, cn=conf, ou=dhcp, dc=artpaint, dc=spb, dc=ru
dhcpHWAddress: ethernet 00:00:aa:99:b0:cd
dhcpStatements: fixed-address 192.168.10.17
objectClass: top
objectClass: dhcpHost
objectClass: dhcpOptions
cn: print-sales-kanc
dn: cn=print-sales-hudozh, cn=192.168.10.0, cn=conf, ou=dhcp, dc=artpaint, dc=spb, dc=ru
dhcpHWAddress: ethernet 00:14:38:5a:1d:c3
dhcpStatements: fixed-address 192.168.10.18
objectClass: top
objectClass: dhcpHost
objectClass: dhcpOptions
cn: print-sales-hudozh
dn: cn=print-mark-color, cn=192.168.10.0, cn=conf, ou=dhcp, dc=artpaint, dc=spb, dc=ru
dhcpHWAddress: ethernet 00:00:f0:ab:8f:64
dhcpStatements: fixed-address 192.168.10.19
objectClass: top
objectClass: dhcpHost
objectClass: dhcpOptions
cn: print-mark-color
dn: cn=print-mark-black, cn=192.168.10.0, cn=conf, ou=dhcp, dc=artpaint, dc=spb, dc=ru
dhcpHWAddress: ethernet 00:00:b4:c9:ee:a2
dhcpStatements: fixed-address 192.168.10.20
objectClass: top
objectClass: dhcpHost
objectClass: dhcpOptions
cn: print-mark-black
Добавляем в лдап:
Код: Выделить всё
[f0s@mail] /var/named/> ldapadd –x –D "cn=root,dc=artpaint,dc=spb,dc=ru" –W –f dhcp.ldif
Код: Выделить всё
[f0s@mail] /var/named/> ee /usr/local/etc/dhcpd.conf
ldap-server "127.0.0.1";
ldap-port 389;
ldap-username "cn=root,dc=artpaint,dc=spb,dc=ru";
ldap-password "password";
ldap-base-dn "ou=dhcp,dc=artpaint,dc=spb,dc=ru";
ldap-method dynamic;
проверяем права на файл:
Код: Выделить всё
-rw-r----- 1 dhcpd dhcpd 187 4 июл 13:28 dhcpd.conf
Добавляем автозапуск dhcp и стартуем его:
Код: Выделить всё
[f0s@mail] /var/named/> echo dhcpd_enable=\"YES\" >> /etc/rc.conf
[f0s@mail] /var/named/> /usr/local/etc/rc.d/isc-dhcpd start
Для динамического обновления зон нам потребуется мега-скрипт.
Код: Выделить всё
[f0s@mail] /root/> fetch http://www.venaas.no/ldap/bind-sdb/dhcp2ldapd-1.1.gz
[f0s@mail] /root/> gunzip dhcp2ldapd-1.1.gz
[f0s@mail] /root/> mkdir dhcp
затем редактируем:
Код: Выделить всё
[f0s@mail] /root/> ee /root/dhcp/dhcpd2ldap.pl
#!/usr/bin/perl
$LEASES = "/var/db/dhcpd/dhcpd.leases";
$DOMAIN = "artpaint";
$REVERSE = "10.168.192.in-addr.arpa";
$FORWARD_BASE = "zoneName=artpaint,ou=dns,dc=artpaint,dc=spb,dc=ru";
$REVERSE_BASE = "zoneName=10.168.192.in-addr.arpa,ou=dns,dc=artpaint,dc=spb,dc=ru";
$USER = 'cn=root,dc=artpaint,dc=spb,dc=ru';
$PASSWORD = "password";
$LDAP_HOST = '192.168.10.8';
$UPDATE_TIME = 30;
$AUTO_VERIFY = 0;
меняем там $fourth.$third на $fourth.
Код: Выделить всё
$result = $ldap->delete("relativeDomainName=$fourth.$third," . $REVERSE_BASE);
$result->code && warn "failed to remove entry: ", $result->error ;
$result = $ldap->add( "relativeDomainName=$fourth.$third," . $REVERSE_BASE,
attr => [
'relativeDomainName'=> "$fourth.$third",
Код: Выделить всё
$result = $ldap->delete("relativeDomainName=$fourth," . $REVERSE_BASE);
$result->code && warn "failed to remove entry: ", $result->error ;
$result = $ldap->add( "relativeDomainName=$fourth," . $REVERSE_BASE,
attr => [
'relativeDomainName'=> "$fourth",
Создаем скрипт /usr/local/etc/rc.d/dhcp2ldap.sh запуска dhcp2ldap.pl:
Код: Выделить всё
#!/bin/sh
case "$1" in
start)
if [ -f /var/run/dhcpd2ldap.pid ]
then
echo "Script already launched. PID: "`cat /var/run/dhcpd2ldap.pid`
else
echo "Starting dhcpd2ldap..."
daemon -f -p /var/run/dhcpd2ldap.pid /root/dhcp/dhcpd2ldap.pl && echo "...Done!"
fi
;;
stop)
if [ -f /var/run/dhcpd2ldap.pid ]
then
echo "Shutting down dhcpd2ldap..."
kill -TERM `cat /var/run/dhcpd2ldap.pid` && rm -f /var/run/dhcpd2ldap.pid && echo "...Done!"
else
echo "dhcpd2ldap not launched."
fi
;;
*)
echo "Use start script for: { start | stop }" >&2
exit 64
;;
esac
Код: Выделить всё
[f0s@mail] /usr/local/etc/rc.d/> chmod 0755 dhcpd2ldap.sh
[f0s@mail] /usr/local/etc/rc.d/> chown root:wheel dhcpd2ldap.sh
[f0s@mail] /usr/local/etc/rc.d/> ./dhcpd2ldap.sh start
[f0s@mail] /usr/local/etc/rc.d/> ps -ax | grep dhcp
585 ?? Is 0:00,03 /usr/local/sbin/dhcpd -cf /usr/local/etc/dhcpd.conf -
40200 ?? Ss 0:00,14 /usr/bin/perl /root/dhcp/dhcpd2ldap.pl (perl5.8.8)
40227 p0 RV 0:00,00 grep dhcp (csh)
Ну вот и все
