LoginSignup
4
7

More than 5 years have passed since last update.

[CentOS7.4] ActiveDirectoryに参加させてみよう

Last updated at Posted at 2017-12-05

はじめに

別に参加させる必要もないかなとは思いつつ、ドメインサーバーと連携できるように設定をしてみた。
多分今後、インフラ周りを整えていく上で必要になってくるのかな?
2018-04-03追記:
realm.local を設定すると一部環境下(Mac/Linux等)で正常に動作しないおそれがある模様。
@picturecode さん、ご指摘ありがとうございました。
なお、詳しい内容については こちらをご覧ください。

前提条件

項目
ドメインサーバー Windows Server 2012 R2
ADサーバー名 domain_server
ドメインIP 192.168.10.100
ドメイン名 sample
レルム SAMPLE.LOCAL
レルムに local はあまりよろしくない模様。
ホスト名 sample.local
マシンIP 192.168.10.10
プロファイル eno1

参加手順

パッケージインストール

console
yum -y install realmd sssd oddjob oddjob-mkhomedir adcli samba-common samba-winbind samba-winbind-clients pam_krb5

DNSを変更

console
nmcli modify eno1 ipv4.dns 192.168.10.100
nmcli c down eno1; nmcli c up eno1

※この作業はGUI側「設定」→「Network」→「IPv4」→「DNS」でも可。

ADの情報が取得できるか確認

console
realm discover SAMPLE.LOCAl
# sample.local
#  type: kerberos
#  realm-name: SAMPLE.LOCAL
#  domain-name: sample.local
#  configured: kerberos-member
#  server-software: active-directory
#  client-software: winbind
#  required-package: oddjob-mkhomedir
#  required-package: oddjob
#  required-package: samba-winbind-clients
#  required-package: samba-winbind
#  required-package: samba-common-tools
#  login-formats: %U
#  login-policy: allow-any-login

ADへのログイン設定

console
authconfig-tui
ユーザー情報 認証
[ ] キャッシュ情報 [ ] MD5パスワードを使用
[ ] LDAPを使用 [*] シャドウパスワードを使用
[ ] NISを使用 [ ] LDAP認証を使用
[ ] IPAv2を使用 [*] Kerberos 5を使用
[*] Winbindを使用 [*] 指紋リーダーを使用
[*] Winbind認証を使用
[*] ローカル認証で十分

と入力した後、「次へ」を選択する。

項目名 設定値
レルム(Realm) SAMPLE.LOCAL
KDC sample.local
管理サーバー sample.local

と入力し、「次」を選択。

項目名 設定値
セキュリティモデル ads
ドメイン sample
ドメインコントローラー sample.local
ADSレルム(Realm) SAMPLE.LOCAL
テンプレートシェル /bin/bash

設定後、「OK」を選択。下のチェックボックスは選択しない。

設定ファイル書き換え

console
authconfig --enablemkhomedir --update
sed -i '/winbind use default domain/s/false/true/g' /etc/samba/smb.conf
systemctl restart winbind

# tuiから設定したため、こちらの作業は不要になるものと思われる
# authconfig \
# --enablekrb5 \
# --krb5kdc=sample.local \
# --krb5adminserver=sample.local \
# --krb5realm=SAMPLE.LOCAL \
# --enablewinbind \
# --enablewinbindauth \
# --smbsecurity=ads \
# --smbrealm=SAMPLE.LOCAL \
# --smbservers=sample.local \
# --smbworkgroup=sample \
# --winbindtemplatehomedir=/home/%U \
# --winbindtemplateshell=/bin/bash \
# --enablemkhomedir \
# --enablewinbindusedefaultdomain \
# --update 
# Job for winbind.service failed. See 'systemctl status winbind.service' and 'journalctl -xn' for details.
# このエラーメッセージは無視してよい

ドメイン参加

console
# ドメイン参加
net ads join -U (管理者ユーザー名)

# ドメイン情報取得
net ads info
# LDAP server: 192.168.10.100
# LDAP server name: domain_server.sample.local
# Realm: SAMPLE.LOCAL
# Bind Path: dc=SAMPLE,dc=LOCAL
# LDAP port: 389
# Server time: 火, 05 12月 2017 11:30:28 JST
# KDC server: 192.168.10.100
# Server time offset: 0
# Last machine account password change: 月, 04 12月 2017 18:45:57 JST

# ユーザーリスト取得
wbinfo -u
# ユーザーリスト

# ドメインユーザーとしてログインテスト
su - (domain_user)

2018-04-03追記:

現環境ではMacユーザーがいなかったからトラブルには発展しなかった模様。
その後設定をしていく中でドメインに参加させる理由がなくなったので、現在は設定を外しています。

参考

4
7
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
7