「samba-tool domain provision」実行時に使用するDNSのタイプが求められる
- SAMBA_INTERNAL
samba内蔵のDNSを使います
- BIND9_FLATFILE
外部のDNS bindを使用するが、その連携はファイルベース
- BIND9_DLZ
こちらも外部のDNS bindを使用するが、連携はbindのdlz機構を使います
- NONE
他のsambaADDCをDNSに使用するなら。smb.confに「passdb backend = samba_dsdb」が加わる
留意 BIND9_FLATFILE はメニューにありますが、サポート外とされました
ここではBIND9_DLZを選択・切り替えるするとして、そのDNS bindを構築してみます
方針 †
RockyLinux8 を使います. そして残念ながらSELinuxを無効にします. どうも「dlz_bind9」の取り込みでエラーになる.
「dlz_dlopen failed to open library '/opt/samba/lib/bind9/dlz_bind9_11.so' - /opt/samba/lib/bind9/dlz_bind9_11.so: failed to map segment from shared object」と表示される
chconなんだろうなぁって思って調べてもうまく動かなかった. ただ手動ではSELinuxでも動いた. systemctl系から行うとエラーになってしまった...
sambaによって求められるbindのバージョンは下記に記載されている
https://wiki.samba.org/index.php/BIND9_DLZ_DNS_Back_End#Configuring_the_BIND9_DLZ_Module
これによると現在導入した samba は
[root@ad ~]# /opt/samba/sbin/samba -V
Version 4.16.0
[root@ad ~]# getenforce
Disabled
[root@ad ~]#
なので、BIND 9.8より新しければいいみたい. だが、用意されている BIND9_DLZ モジュールは
[root@ad ~]# ls -l /opt/samba/lib/bind9/
total 300
-rwxr-xr-x. 1 root root 61024 May 2 10:30 dlz_bind9_10.so
-rwxr-xr-x. 1 root root 61024 May 2 10:30 dlz_bind9_11.so
-rwxr-xr-x. 1 root root 61024 May 2 10:30 dlz_bind9_12.so
-rwxr-xr-x. 1 root root 61024 May 2 10:30 dlz_bind9_14.so
-rwxr-xr-x. 1 root root 61024 May 2 10:30 dlz_bind9_16.so
[root@ad ~]#
なので、実質 BIND 9.10 以上になりそうである.
幸い RockyLinux8 でリリースされているbindは9.11.26なので「dlz_bind9_11.so」が使えそうである
[root@ad ~]# dnf info bind
Last metadata expiration check: 3:20:57 ago on Mon 02 May 2022 02:34:02 PM JST.
Available Packages
Name : bind
Epoch : 32
Version : 9.11.26
Release : 6.el8
Architecture : x86_64
Size : 2.1 M
Source : bind-9.11.26-6.el8.src.rpm
Repository : appstream
Summary : The Berkeley Internet Name Domain (BIND) DNS (Domain Name System) server
URL : https://www.isc.org/downloads/bind/
License : MPLv2.0
Description : BIND (Berkeley Internet Name Domain) is an implementation of the DNS
: (Domain Name System) protocols. BIND includes a DNS server (named),
: which resolves host names to IP addresses; a resolver library
: (routines for applications to use when interfacing with DNS); and
: tools for verifying that the DNS server is operating properly.
[root@ad ~]#
ソースからコンパイルもありますが、パッケージが利用可能なのでそちらを使います.
留意 bind-chrootは使わないです. むしろ使えないが正解かな
構築 †
[root@ad ~]# dnf install bind
sambaページの「Step 4: Provision Samba」から †
prpvisionの際に「BIND9_DLZ」を指定すると次なる指示書が発行される
[root@ad ~]# /opt/samba/bin/samba-tool domain provision --use-rfc2307 --interactive
Realm [CHAPERONE.JP]:
Domain [CHAPERONE]:
Server Role (dc, member, standalone) [dc]:
DNS backend (SAMBA_INTERNAL, BIND9_FLATFILE, BIND9_DLZ, NONE) [SAMBA_INTERNAL]: BIND9_DLZ <-- ここでBIND9_DLZを入力
Administrator password:
Retype password:
Looking up IPv4 addresses
Looking up IPv6 addresses
No IPv6 address will be assigned
(略
See /opt/samba/bind-dns/named.conf for an example configuration include file for BIND
and /opt/samba/bind-dns/named.txt for further documentation required for secure DNS updates
(略
[root@ad ~]#
1つは既に設置したbindの設定ファイル(/etc/named.conf)にincludeさせるファイル.
もう一つは指示書.
bindの調整 †
dnfでインストールしたbindパッケージの設定ファイル(/etc/named.conf)を修正します.
| --- /etc/named.conf.20220502 2022-05-02 19:35:30.533756724 +0900
+++ /etc/named.conf 2022-05-02 19:41:21.348785567 +0900
@@ -7,16 +7,19 @@
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
+acl network {
+ 192.168.0.0/24;
+};
options {
- listen-on port 53 { 127.0.0.1; };
- listen-on-v6 port 53 { ::1; };
+ listen-on port 53 { any; };
+ listen-on-v6 port 53 { none; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
secroots-file "/var/named/data/named.secroots";
recursing-file "/var/named/data/named.recursing";
- allow-query { localhost; };
+ allow-query { localhost; network; };
/*
- If you are building an AUTHORITATIVE DNS server, do NOT enable recursion.
@@ -40,6 +43,8 @@
/* https://fedoraproject.org/wiki/Changes/CryptoPolicy */
include "/etc/crypto-policies/back-ends/bind.config";
+ tkey-gssapi-keytab "/opt/samba/bind-dns/dns.keytab";
+ minimal-responses yes;
};
logging {
@@ -57,3 +62,4 @@
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
+include "/opt/samba/bind-dns/named.conf";
|
それと下記を実行します. SELinuxをoffにしたので意味はないけど
[root@ad ~]# chcon -t named_conf_t /opt/samba/bind-dns/dns.keytab
テスト †
まずbindを動かします
[root@ad ~]# systemctl enable named --now
Created symlink /etc/systemd/system/multi-user.target.wants/named.service → /usr/lib/systemd/system/named.service.
[root@ad ~]#
(テスト)
[root@ad ~]# host -t SRV _ldap._tcp.chaperone.jp.
_ldap._tcp.chaperone.jp has SRV record 0 100 389 ad.chaperone.jp.
[root@ad ~]# host -t SRV _kerberos._udp.chaperone.jp.
_kerberos._udp.chaperone.jp has SRV record 0 100 88 ad.chaperone.jp.
[root@ad ~]# host -t A ad.chaperone.jp.
ad.chaperone.jp has address 192.168.0.131
[root@ad ~]# host -t A www.fujitsu.co.jp
www.fujitsu.co.jp has address 80.70.171.77
[root@ad ~]#
別のターミナルで samba を起動させます
[root@ad ~]# /opt/samba/sbin/samba -i -M single
samba version 4.16.0 started.
Copyright Andrew Tridgell and the Samba Team 1992-2022
binary_smbd_main: samba: using 'single' process model
その上でDNS動的更新のテストを行ってみます
[root@ad ~]# LANG=C kinit administrator@CHAPERONE.JP
Password for administrator@CHAPERONE.JP:
Warning: Your password will expire in 41 days on Mon Jun 13 18:15:44 2022
[root@ad ~]# nsupdate -g
>
> update add c200.chaperone.jp 100 in a 192.168.0.200
> send
> quit
[root@ad ~]# host c200.chaperone.jp
c200.chaperone.jp has address 192.168.0.200
[root@ad ~]# nsupdate -g
>
> update delete c200.chaperone.jp
> send
> quit
[root@ad ~]# host c200.chaperone.jp
Host c200.chaperone.jp not found: 3(NXDOMAIN)
[root@ad ~]#
DNS backendを「SAMBA_INTERNAL」にした際には表示された「; TSIG error with server: tsig verify failure」が生じない.
この後 †
ntpの設定やら、smb.conf、samba.serviceの設定はsambaと同様です.