Idmap config ad

提供:雑廉堂Wiki
2019年3月1日 (金) 17:11時点におけるMeisina04 (トーク | 投稿記録)による版 (→‎adバックエンドの設定)

前書き

ad IDマッピングバックエンドは、Active Directory(AD)からアカウントおよびグループ情報を読み取るための読み取り専用API を実装します。 バックエンドはRFC 2307に基づいています。 詳細については、https://www.rfc-editor.org/rfc/rfc2307.txtを参照してください。

代替案については、アイデンティティマッピングバックエンドを参照してください。

{{#invoke:Message box|imbox}}

{{#invoke:Message box|imbox}}

adバックエンドのメリットとデメリット

利点:

  • Active Directory(AD)内のIDの集中管理。
  • adバックエンドを使用するすべてのSambaクライアントとサーバ上の一貫したID。
  • 必要な属性は一度作成するだけで済みます。これはユーザーまたはグループの作成時に行うことができます
  • IDはローカルにのみキャッシュされ、DCのADデータベースに格納されます。 つまり、ローカルキャッシュが破損してもファイルの所有権は失われません。

欠点:

  • Windowsの「Active Directoryユーザーとコンピュータ」(ADUC)プログラムが使用されていない場合、重複を避けるためにID値を手動で追跡する必要があります。
  • RFC2307属性の値は手動で設定する必要があります。

Winbind NSS infoモード固有の機能:

  • rfc2307:ユーザの個々のログインシェルとホームディレクトリパス。
  • template:ログインシェルとホームディレクトリのベースパスはすべてのユーザで同じです。

ID範囲の計画

smb.confファイルでadバックエンドを設定する前に、ドメインごとに一意のID範囲を選択する必要があります。 Sambaがドメイン内に作成された将来のすべてのユーザーおよびグループにIDを割り当てることができるように、範囲は連続的かつ十分に大きくなければなりません。

{{#invoke:Message box|imbox}}

前提条件

SambaがActive Directory(AD)からユーザ情報とグループ情報を取得できるようにするには:

  • ユーザーは少なくともuidNumber属性セットを持っている必要があります。 rfc2307 winbind NSS infoモードを使用する場合、ユーザーアカウントにもloginShellunixHomeDirectoryを設定する必要があります。
  • グループには、少なくともgidNumber属性セットが必要です。
  • コンピュータ、または 'machine network accounts'は、sambaドメインメンバーの共有にアクセスするためにuidNumber属性を設定する必要があります。
  • ユーザーとコンピュータのプライマリグループには、gidNumber属性を設定する必要があります。
  • ユーザー、コンピュータ、およびグループIDは、このドメインの smb.conf に設定されている範囲内でなければなりません。
  • ユーザーIDとコンピュータIDはすべてのユーザーとコンピュータに対して一意である必要があり、グループIDはすべてのグループに対して一意である必要があります。重複したID、または以前に削除されたアカウントのIDを再利用することで、新しいユーザー、コンピュータ、またはグループは、他のまたは以前のID所有者によって作成されたファイルにアクセスできます。 ADUCユーティリティを使用すると、ユーザーIDとグループIDはAD内で自動的に追跡され、新しいユーザーまたはグループを作成するときに増加します。
  • コンピュータID(uidNumber属性)はAD内で自動的に追跡されないため、コンピュータがドメインに参加しているときはADUC Attribute Editorタブで手動で設定する必要があります。

{{#invoke:Message box|imbox}}

RFC2307templateモードのオプション

Sambaバージョン4.6.0より前:


adIDマッピングバックエンドは、smb.conf[global]セクションのwinbind nss infパラメータににセットされた2つのモードをサポートしています:

  • winbind nss info = rfc2307: Active Directory(AD)からすべての情報が読み込まれます。
  • Users: アカウント名、UID、ログインシェル、ホームディレクトリのパス、およびプライマリグループ。
  • Groups:グループ名とGID
  • winbind nss info = template: ADから次の値のみ読み込まれます。
  • Users:アカウント名、UID、およびプライマリグループ。
ログインシェルとホームディレクトリは、smb.conf内にユーザーから独立した設定によって自動的にセットされます。
  • Groups:グループ名とGID


Samba バージョン 4.6.0から:

すでにwinbind nss infoパラメータは使用しなくなり、すでにidmap config DOMAIN:unix_nss_infoに置き換えられました。

ad IDマッピングバックエンドはsmb.confファイルの [global]セクションの idmap config DOMAIN:unix_nss_infoパラメータにセットされた2つのモードをサポートしています:

  • idmap config DOMAIN:unix_nss_info = yes: すべての情報がActive Directory(AD)から読み込まれます:
  • Users: アカウント名、UID、ログインシェル、ホームディレクトリパス、およびプライマリグループ。
  • Group: グループ名とGID。
  • これらの設定はDOMAIN単位で設定されます。つまり、DOMAINごとに異なる設定を行うことができます。
  • ユーザがRFC2307の属性を欠いている場合、ログインシェルとホームディレクトリは、 smb.confファイルのユーザに依存しない設定によって自動的に設定されます。
  • idmap config DOMAIN:unix_nss_info = no: 次の値だけがADから読み込まれます。
  • Users: アカウント名、UID、およびプライマリグループ。
ログインシェルとホームディレクトリは、smb.confファイルのユーザーに依存しない設定によって自動的に設定されます。
  • Group: グループ名とGID
  • これがデフォルト設定です。

新しい設定 unix_primary_groupが追加されました。これにより、ドメインユーザーの代わりにユーザーのプライマリグループに別のグループを使用することができます。

  • これがunix_primary_group = yesで設定されている場合、ユーザープライマリグループは、ユーザーADオブジェクトにあるgidNumber属性から取得されます。
  • これがunix_primary_group = noで設定されている場合、ユーザープライマリグループは「primaryGroupID」属性を使用して計算されます。
  • デフォルトは 'no'です。

adバックエンドの設定

Before Samba version 4.6.0:

  • To configure the ad back end using the 10000-999999 ID range for the SAMDOM domain, set the following in the [global] section of your smb.conf file:
security = ADS
workgroup = SAMDOM
realm = SAMDOM.EXAMPLE.COM

log file = /var/log/samba/%m.log
log level = 1

winbind nss info = rfc2307

# Default ID mapping configuration for local BUILTIN accounts
# and groups on a domain member. The default (*) domain:
# - must not overlap with any domain ID mapping configuration!
# - must use a read-write-enabled back end, such as tdb.
idmap config * : backend = tdb
idmap config * : range = 3000-7999
# - You must set a DOMAIN backend configuration
# idmap config for the SAMDOM domain
idmap config SAMDOM:backend = ad
idmap config SAMDOM:schema_mode = rfc2307
idmap config SAMDOM:range = 10000-999999

vfs objects = acl_xattr
map acl inherit = yes
store dos attributes = yes


From Samba version 4.6.0:

  • To configure the ad back end using the 10000-999999 ID range for the SAMDOM domain, set the following in the [global] section of your smb.conf file:
security = ADS
workgroup = SAMDOM
realm = SAMDOM.EXAMPLE.COM

log file = /var/log/samba/%m.log
log level = 1

# Default ID mapping configuration for local BUILTIN accounts
# and groups on a domain member. The default (*) domain:
# - must not overlap with any domain ID mapping configuration!
# - must use a read-write-enabled back end, such as tdb.
idmap config * : backend = tdb
idmap config * : range = 3000-7999
# - You must set a DOMAIN backend configuration
# idmap config for the SAMDOM domain
idmap config SAMDOM:backend = ad
idmap config SAMDOM:schema_mode = rfc2307
idmap config SAMDOM:range = 10000-999999
idmap config SAMDOM:unix_nss_info = yes

vfs objects = acl_xattr
map acl inherit = yes
store dos attributes = yes


{{#invoke:Message box|imbox}}

{{#invoke:Message box|imbox}}


  • Configure the Winbind NSS info mode:
  • To enable the template mode and set, for example, /bin/bash as shell and /home/%U as home directory path:
# Template settings for login shell and home directory
template shell = /bin/bash
template homedir = /home/%U
The settings are applied to all users in each domain that has the schema_mode = rfc2307 parameter set. From Samba 4.6.0, the global template settings can be overwritten on a domain-basis by enabling the idmap config domain_name:unix_nss_info parameter.
Samba resolves the %U variable to the session user name. For details, see the VARIABLE SUBSTITUTIONS section in the smb.conf(5) man page.
  • By default, Samba sets the Windows primary group as primary group for mapped domain user entries on Unix. The Windows primary group is retrieved from the primaryGroupID attribute of each user entry, this is usually set to the Domain Users group RID. This RID is then used to obtain the gidNumber attribute from the Windows primary group.
  • If you are running Samba 4.6.0 or later, you can optionally configure Samba to use the primary group set in the gidNumber attribute in the users entry instead. For example, when using the Active Directory Users and Computers application, this attribute is displayed in the UNIX Attributes tab. To use the group ID set in the users gidNumber attribute as primary group for each user instead of the Windows primary group, enable the following parameter in the [global] section in your smb.conf file:
idmap config SAMDOM:unix_primary_group = yes

{{#invoke:Message box|imbox}}

{{#invoke:Message box|imbox}}

  • Reload Samba:
# smbcontrol all reload-config

For further details, see the smb.conf(5) and idmap_ad(5) man page.