[HOME] [github] [twitter] [blog] [fml4] [fml8] [北海道] Powered by NetBSD and [nuinui.net] .

Debian/Linux: Samba4 による AD の構築

以下の Debian 8 上での手順一式は samba4-ad-setup.sh ツールにまとめてあります。 ftp://ftp.fml.org/pub/tips/samba4-ad-setup.sh をダウンロードし

# sh samba4-ad-setup.sh install
を実行してみてください。

Samba4 による AD の構築 - OS そのものの準備

(LXC ではリブートすると設定が元にもどってしまうみたい?なので) はじめから OS の設定は最終形でインストールします (LXC でないなら関係ないか?)。

ホスト名   ... ADの名前
IPアドレス ... ADのアドレス
リゾルバ   ... ADのアドレス (/etc/resolv.conf の nameserer 行のこと)

*** このあと apt-get 直前に /etc/resolv.conf を直す必要があります ***

Samba4 による AD の構築 - 準備

*** /etc/resolv.conf の設定を確認してからスタートしてください ***

パッケージを最新にしてから、 samba をインストールする前に必要なパッケージをインストールし、

# apt-get update
# apt-get upgrade
# apt-get install いろいろ
8.2 での「apt-get install いろいろ」は次のようなものでした。
# apt-get -y install acl attr autoconf bison build-essential \
	debhelper dnsutils docbook-xml docbook-xsl flex gdb krb5-user \
	libacl1-dev libaio-dev libattr1-dev libblkid-dev libbsd-dev \
	libcap-dev libcups2-dev libgnutls28-dev libjson-perl \
	libldap2-dev libncurses5-dev libpam0g-dev libparse-yapp-perl \
	libpopt-dev libreadline-dev perl perl-modules pkg-config \
	python-all-dev python-dev python-dnspython python-crypto \   
	zlib1g-dev \
	smbclient heimdal-clients ntp

あと /etc/samba/smb.conf を消去し、SELINUX も切っておきます。

( cd /etc/samba && test -f smb.conf && mv -v smb.conf smb.conf.orig )
echo SELINUX=permissive > /etc/selinux/config

Samba4 による AD の構築 - インストール

準備が終ったら samba 本体をインストールしてください。

# apt-get install samba

Samba4 による AD の構築 - AD の設定

samba4 の設定ツールを起動します。

# samba-tool domain provision \
		--use-rfc2307 --interactive --use-ntvfs \
		--function-level=2008_R2
いろいろ聞かれますが、 DNS forwaderer 以外はデフォルト値でいいはずです。

Caution

DNS forwaderer が同じセグメントの IP (たとえば 192.168.0.1)では、 うまく動きません(AD 外のアドレスが解決できません)でした。 外部セグメントの参照用 DNS (たとえば 202.232.0.1)を指定すると、 DNS が正常に動作しました (この例は LXC 上の VM だから変なのかもしれません)。

【実行例】

# samba-tool domain provision ...
Realm [AD.FML.ORG]: 
 Domain [AD]: 
 Server Role (dc, member, standalone) [dc]: 
 DNS backend (SAMBA_INTERNAL, BIND9_FLATFILE, BIND9_DLZ, NONE) [SAMBA_INTERNAL]: 
 DNS forwarder IP address (write 'none' to disable forwarding) [192.168.0.2]: 202.232.0.1
Administrator password: 
Retype password: 
Looking up IPv4 addresses
Looking up IPv6 addresses
No IPv6 address will be assigned
Setting up secrets.ldb
Setting up the registry
Setting up the privileges database
Setting up idmap db
Setting up SAM db
Setting up sam.ldb partitions and settings
Setting up sam.ldb rootDSE
Pre-loading the Samba 4 and AD schema
Adding DomainDN: DC=AD,DC=fml,DC=org
Adding configuration container
Setting up sam.ldb schema
Setting up sam.ldb configuration data
Setting up display specifiers
Modifying display specifiers
Adding users container
Modifying users container
Adding computers container
Modifying computers container
Setting up sam.ldb data
Setting up well known security principals
Setting up sam.ldb users and groups
Setting up self join
Adding DNS accounts
Creating CN=MicrosoftDNS,CN=System,DC=AD,DC=fml,DC=org
Creating DomainDnsZones and ForestDnsZones partitions
Populating DomainDnsZones and ForestDnsZones partitions
Setting up sam.ldb rootDSE marking as synchronized
Fixing provision GUIDs
A Kerberos configuration suitable for Samba 4 has been generated at /var/lib/samba/private/krb5.conf
Setting up fake yp server settings
Once the above files are installed, your Samba4 server will be ready to use
Server Role:           active directory domain controller
Hostname:              dc00
NetBIOS Domain:        AD
DNS Domain:            AD.fml.org
DOMAIN SID:            S-1-5-21-2466056368-1569883684-428547966

【エラー例】

エラー: 難しいパスワードをつけなかった場合

// muzukasii password de naito,kounaru ;_;
ERROR(ldb): uncaught exception - 0000052D: Constraint violation - check_password_restrictions: the password does not meet the complexity criteria!

エラー: --use-rfc2307 オプションをつけなかった場合

ERROR(<class 'samba.provision.ProvisioningError'>): Provision failed - ProvisioningError: Your filesystem or build does not support posix ACLs, which s3fs requires.  Try the mounting the filesystem with the 'acl' option.

Samba4 による AD の構築 - AD の設定、あと、もう少しだけ

Kerberos の設定ファイルを samba4 が生成したものにしてください (samba4 の生成する krb5.conf にシンボリックリンクを張っておきます)。

# cd /etc/ || exit 1
# mv -f krb5.conf krb5.conf.bak
# ln -s /var/lib/samba/private/krb5.conf .

Samba4 による AD の構築 - AD 動作モードの確認

Windows サーバは互換性がないので、動作モードを確認しましょう。

# samba-tool domain level show 
Domain and forest function level for domain 'DC=AD,DC=fml,DC=org'

Forest function level: (Windows) 2008 R2
Domain function level: (Windows) 2008 R2
Lowest function level of a DC: (Windows) 2008 R2
2008 R2 と表示されればOKです。

Samba4 による AD の構築 - ぜんぶ作業が終ったらリブート

OS ごとリブートしてください。

[HOME] [github] [twitter] [blog] [fml4] [fml8] [北海道] Powered by NetBSD and [nuinui.net] .
Copyright (C) 1993-2022 Ken'ichi Fukamachi mail:< fukachan at fml.org >