winbindによるメンバーサーバを作ってみる。
内容はsssdによるメンバーサーバ作成と同じです。連携方法がwinbinddにした場合のお話

2015y10m10d_232400233.png

メンバーサーバの準備

winbindによるメンバーサーバ作成だからと言って特別なことはない.

ホスト名IPアドレスOS参照DNS参照NTP
samba-winbind.chaperone.jp192.168.0.152RockyLinux8.5ad.chaperone.jpad.chaperone.jp

/etc/hostsファイルは、自身のアドレスのみで可

[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

そしてドメイン参加に必要なパッケージをインストールする

[root@samba-winbind ~]# dnf install samba-common samba-winbind

Domain UsersへのGID付与

ドメインコントローラの CHAPERONE\Domain Users にGIDを付与します。これがないとどうも無理みたい。
付与の方法はwindowsのツールを使います. samba/RSATの「ADSIエディター」を起動させ、画面左上の「ADSIエディター」ノードを右クリックして、「接続...」を選択します
2022y05m04d_105336792.png
その後、現れた「接続の設定」パネルではそのまま「OK」ボタンを押下します
「ADSIエディター」画面の左ツリーを展開して「CN=Users」を選択します
2022y05m04d_105835319.png
そして右側から「CN=Domain Users」を右クリックして、「プロパティ」を選びます
2022y05m04d_110013870.png
開いた「CN=Domain Usersのプロパティ」から「gidNumber」をダブルクリックして値を入力します.
gidNumberの値は何でもいいですが、ここでは3000にしてます。
2022y05m04d_110324902.png
これで「OK」ボタンを押下します.

chaperoneドメインへの参加

メンバーサーバの /etc/samba/smb.conf を調整して、
/etc/samba/smb.conf は samba-common パッケージに含まれている

[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 コマンドを使って sybyl ドメインに参加します。

[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を起動させます。

[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

そしてテスト。「getent passwd | grep illya」では表示されません。「getent passwd illya」でないと表示されない

[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 ~]#

留意 事前にドメインコントローラの CHAPERONE\Domain Users にGIDを割り当てることが必須みたい.

キャッシュのクリア

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

それをクリアにするためには下記を実行する

[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
最新の60件
2023-09-20 2023-09-19 2023-09-18 2023-09-17 2023-09-16 2023-09-14 2023-09-12 2023-09-11 2023-09-08 2023-09-05 2023-09-02 2023-08-30 2023-08-29 2023-08-28 2023-08-27 2023-08-22 2023-08-20 2023-08-18 2023-08-17 2023-08-14 2023-08-12 2023-08-09 2023-08-07 2023-08-06 2023-08-03 2023-07-31 2023-07-29 2023-07-27 2023-07-25 2023-07-24 2023-07-22 2023-07-17 2023-07-16 2023-07-09 2023-07-08

edit


トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2022-05-04 (水) 11:34:09