#author("2022-05-04T02:32:30+00:00","default:sysosa","sysosa")
#author("2022-05-04T02:34:09+00:00","default:sysosa","sysosa")
&color(magenta){''winbind''};による&color(green){''メンバーサーバ''};を作ってみる。
&size(10){内容は[[sssdによる&color(green){メンバーサーバ};作成>samba/Linux参加]]と同じです。連携方法がwinbinddにした場合のお話};

&ref(2015y10m10d_232400233.png,nolink,noborder);

***&color(green){メンバーサーバ};の準備 [#k73b5e32]
&color(magenta){''winbind''};による&color(green){''メンバーサーバ''};作成だからと言って特別なことはない.

|BGCOLOR(YELLOW):ホスト名|BGCOLOR(YELLOW):IPアドレス|BGCOLOR(YELLOW):OS|BGCOLOR(YELLOW):参照DNS|BGCOLOR(YELLOW):参照NTP|
|samba-winbind.chaperone.jp|192.168.0.152|RockyLinux8.5|ad.chaperone.jp|ad.chaperone.jp|
/etc/hostsファイルは、自身のアドレスのみで可
#code(nonumber){{
[root@samba-winbind ~]# hostnamectl set-hostname samba-winbind.chaperone.jp
[root@samba-winbind ~]# echo `hostname -I` `hostname -A` `hostname -s` >> /etc/hosts
[root@samba-winbind ~]# echo "192.168.0.131 ad.chaperone.jp ad" >>  /etc/hosts
[root@samba-winbind ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.0.152 samba-winbind.chaperone.jp samba-winbind
192.168.0.131 ad.chaperone.jp ad
[root@samba-winbind ~]# echo "pool ad iburst" > /etc/chrony.conf
}}
そしてドメイン参加に必要なパッケージをインストールする
#code(nonumber){{
[root@samba-winbind ~]# dnf install samba-common samba-winbind
}}
***Domain UsersへのGID付与 [#ef457c20]
ドメインコントローラの &color(magenta){CHAPERONE\Domain Users}; にGIDを付与します。これがないとどうも無理みたい。
付与の方法はwindowsのツールを使います. [[samba/RSAT]]の「ADSIエディター」を起動させ、画面左上の「ADSIエディター」ノードを右クリックして、「接続...」を選択します
&ref(2022y05m04d_105336792.png,nolink);
その後、現れた「接続の設定」パネルではそのまま「OK」ボタンを押下します
「ADSIエディター」画面の左ツリーを展開して「CN=Users」を選択します
&ref(2022y05m04d_105835319.png,nolink);
そして右側から「CN=Domain Users」を右クリックして、「プロパティ」を選びます
&ref(2022y05m04d_110013870.png,nolink);
開いた「CN=Domain Usersのプロパティ」から「gidNumber」をダブルクリックして値を入力します.
gidNumberの値は何でもいいですが、ここでは3000にしてます。
&ref(2022y05m04d_110324902.png,nolink);
これで「OK」ボタンを押下します.

***&color(magenta){chaperone};ドメインへの参加 [#r5a11aa8]
&color(green){''メンバーサーバ''};の /etc/samba/smb.conf を調整して、
&size(10){/etc/samba/smb.conf は samba-common パッケージに含まれている};
#code(nonumber){{
[root@samba-winbind ~]# cat << _EOT_ > /etc/samba/smb.conf
[global]
  workgroup = CHAPERONE
  security = ADS
  realm = CHAPERONE.JP
  password server = ad.chaperone.jp
  idmap config CHAPERONE:backend = ad
  idmap config CHAPERONE:schema_mode = rfc2307
  idmap config CHAPERONE:range = 1000-30000
  idmap config CHAPERONE:unix_nss_info = yes
  idmap config CHAPERONE:unix_primary_group = yes
  idmap config *:range = 30001-30010
  idmap config *:backend = tdb
  #winbind nss info = rfc2307
  winbind use default domain = true
_EOT_
[root@samba-winbind ~]#
}}
net コマンドを使って &color(magenta){sybyl}; ドメインに参加します。
#code(nonumber){{
[root@samba-winbind ~]# net ads join osName=RockyLinux osVer=8.5 -Uadministrator
Enter administrator's password:
Using short domain name -- CHAPERONE
Joined 'SAMBA-WINBIND' to dns domain 'chaperone.jp'
[root@samba-winbind ~]#
}}
参加完了後、ユーザ情報参照先と認証情報参照先を変更して、winbinddを起動させます。
#code(nonumber){{
[root@samba-winbind ~]# authselect  create-profile  samba-winbind -b winbind --symlink-pam --symlink-dconf
New profile was created at /etc/authselect/custom/samba-winbind

[root@samba-winbind ~]# echo "Enable SAMBA-WINBIND for system authentication" > /etc/authselect/custom/samba-winbind/README

[root@samba-winbind ~]# authselect current
No existing configuration detected.
[root@samba-winbind ~]# authselect list
- minimal                Local users only for minimal installations
- nis                    Enable NIS for system authentication
- sssd                   Enable SSSD for system authentication (also for local users only)
- winbind                Enable winbind for system authentication
- custom/samba-winbind   Enable SAMBA-WINBIND for system authentication
[root@samba-winbind ~]# authselect select custom/samba-winbind --force
Backup stored at /var/lib/authselect/backups/2022-05-04-02-13-54.pe5Clq
Profile "custom/samba-winbind" was selected.
The following nsswitch maps are overwritten by the profile:
- passwd
- group

Make sure that winbind service is configured and enabled. See winbind documentation for more information.

[root@samba-winbind ~]# authselect current
Profile ID: custom/samba-winbind
Enabled features: None

[root@samba-winbind ~]# systemctl enable winbind --now
}}


そしてテスト。&size(10){「getent passwd | grep illya」では表示されません。「getent passwd illya」でないと表示されない};
#code(nonumber){{
[root@n2 ~]# getent passwd illya
illya:*:1002:3000:Illyasviel von Einzbern:/home/illya:/bin/bash
[root@n2 ~]#
[root@samba-winbind ~]# id illya
uid=1002(illya) gid=2000(fate) groups=2000(fate),3000(domain users)

[root@samba-winbind ~]# getent passwd illya
illya:*:1002:2000:Illyasviel von Einzbern:/home/illya:/bin/bash

[root@samba-winbind ~]#
}}

&color(white,blue){留意}; 事前にドメインコントローラの &color(magenta){sybyl\Domain Users}; にGIDを割り当てることが必須です。
これを行わないで、ドメイン参加(&color(red){net ads join};)するとドメインコントローラのユーザ情報は拾えないです。
もしドメイン参加後なら、&color(red){find /var/lib/samba -type f -exec rm -rf {} \;}; にて関連ファイルを削除してから再びドメイン参加しましょう。
&color(white,blue){留意}; 事前にドメインコントローラの &color(magenta){CHAPERONE\Domain Users}; にGIDを割り当てることが必須みたい.


***キャッシュのクリア [#le9a4efd]
ipmadのbackendにadをここでは使っているが、
仮に別のbackend、例えば rid らを使った際、ユーザのUID、GIDはそのマシンでのみ有効でADDCのUID,GIDとは異なる。
一度ridらを使うとそれが残ってしまい、backendをadに切り替えてもUID,GIDは更新されない。

それをクリアにするためには下記を実行する
#code(nonumber){{
[root@c ~]# systemctl stop winbind    *あるいはsystemctl stop samba
[root@c ~]# net cache flush
[root@c ~]# rm -f /var/lib/samba/*.tdb
[root@c ~]# rm -f /var/lib/samba/group_mapping.ldb
[root@c ~]# systemctl start winbind
}}
1

トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS