「Idmap config ad」の版間の差分

提供:雑廉堂Wiki
107行目: 107行目:
== adバックエンドの設定 ==
== adバックエンドの設定 ==


* <code>smb.conf</code>ファイルの<code>[global]</code>セクションに以下を設定します:
:* ローカルの <code>BUILTIN</code>アカウントとドメインメンバーのグループのバックエンドが設定されていない場合は、<code>*</code>デフォルトドメインの<code>tdb</code>バックエンドを追加し、ID範囲を設定します。例えば:


<pre># Default idmap config for local BUILTIN accounts and groups
'''Before Samba version 4.6.0:'''
idmap config * : backend = tdb
idmap config * : range = 3000-7999</pre>
:: デフォルトのバックエンドの設定は必須です。


:* <code>SAMDOM</code>ドメインの<code>10000-999999</code> ID範囲を使用して広告バックエンドを設定するには:
* To configure the <code>ad</code> back end using the <code>10000-999999</code> ID range for the <code>SAMDOM</code> domain, set the following in the <code>[global]</code> section of your <code>smb.conf</code> file:


<pre># idmap config for the SAMDOM domain
security = ADS
idmap config SAMDOM:backend = ad
workgroup = SAMDOM
idmap config SAMDOM:schema_mode = rfc2307
realm = SAMDOM.EXAMPLE.COM
idmap config SAMDOM:range = 10000-999999</pre>
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


{{imbox
 
|type = content
'''From Samba version 4.6.0:'''
|style = margin:4px 2%;
 
|text = '<code>*</code>'デフォルトドメインを含むすべてのドメインの範囲を設定する必要があります。 '<code>*</code>'デフォルトドメインを除くすべてのドメインに対して、バックエンドとスキーマモードを設定する必要があります。 <code>smb.conf</code>ファイルで設定されたすべてのドメインのID範囲は重複してはいけません。
* To configure the <code>ad</code> back end using the <code>10000-999999</code> ID range for the <code>SAMDOM</code> domain, set the following in the <code>[global]</code> section of your <code>smb.conf</code> 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
 
 
{{Imbox
| type = important
| text = Setting the default back end is mandatory.
}}
}}


* Winbind NSS情報モードを設定する:
{{Imbox
:* <code>template</code>モードを有効にして、<code>/bin/bash</code>をシェルとして、 <code>/home/%U</code>をホームディレクトリのパスとして設定するには:
| type = important
| text = You must set the range for every domain, including the <code>*</code> default domain. You must set the back end and schema mode for every domain, except the <code>*</code> default domain. The ID ranges of all domains configured in the smb.conf file must not overlap.
}}
 
 
* Configure the Winbind NSS info mode:


<pre># Template settings for login shell and home directory
:* To enable the <code>template</code> mode and set, for example, <code>/bin/bash</code> as shell and <code>/home/%U</code> as home directory path:
template shell = /bin/bash
template homedir = /home/%U</pre>
::この設定は、 <code>schema_mode = rfc2307</code>パラメータが設定されている各ドメインのすべてのユーザに適用されます。 Samba 4.6.0から、グローバルテンプレート設定は、i<code>dmap config domain_name:unix_nss_info</code>パラメータを有効にすることによって、ドメインベースで上書きすることができます。


::Sambaは <code>%U</code>変数をセッションのユーザ名に解決します。詳細は、 <code>smb.conf(5)</code>のmanページの <code>VARIABLE SUBSTITESS</code>セクションを参照してください。
# Template settings for login shell and home directory
template shell = /bin/bash
template homedir = /home/%U


:* Active Directory(AD)からシェルとホームディレクトリを取得できるようにするには、<code>smb.conf</code>ファイルの<code>[global]</code>セクションに次の値を設定します。
:: The settings are applied to all users in each domain that has the <code>schema_mode = rfc2307</code> parameter set. From Samba 4.6.0, the global template settings can be overwritten on a domain-basis by enabling the <code>idmap config ''domain_name'':unix_nss_info</code> parameter.
::* Samba 4.6.0から、この機能をドメイン単位で有効にしてください:


<pre>idmap config SAMDOM:unix_nss_info = yes</pre>
:: Samba resolves the <code>%U</code> variable to the session user name. For details, see the <code>VARIABLE SUBSTITUTIONS</code> section in the <code>smb.conf(5)</code> man page.
::* Samba 4.5以前では、すべてのドメインに対してこの機能をグローバルに設定しました:


<pre>winbind nss info = rfc2307</pre>
* 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 <code>primaryGroupID</code> attribute of each user entry, this is usually set to the <code>Domain Users</code> group RID. This RID is then used to obtain the <code>gidNumber</code> attribute from the Windows primary group.  
* デフォルトでは、SambaはWindowsプライマリグループをUnix上のマップされたドメインユーザエントリのプライマリグループとして設定します。 Windowsプライマリグループは、各ユーザエントリの <code>primaryGroupID</code>属性から取得されます。これは、通常、<code>Domain Users</code>グループのRIDに設定されます。このRIDは、Windowsプライマリグループから <code>gidNumber</code>属性を取得するために使用されます。
* Samba 4.6.0以降を実行している場合は、必要に応じてSambaがユーザエントリの <code>gidNumber</code>属性に設定されたプライマリグループを使用するように設定できます。たとえば、 <code>Active Directory Users and Computers</code>アプリケーションを使用する場合、この属性は<code>UNIX Attributes</code>タブに表示されます。ユーザの <code>gidNumber</code>属性に設定されたグループIDを、Windowsプライマリグループではなく各ユーザのプライマリグループとして使用するには、<code>smb.conf</code>ファイルの <code>[global]</code>セクションで次のパラメータを有効にします:


<pre>idmap config SAMDOM:unix_primary_group = yes</pre>
* If you are running Samba 4.6.0 or later, you can optionally configure Samba to use the primary group set in the <code>gidNumber</code> attribute in the users entry instead. For example, when using the <code>Active Directory Users and Computers</code> application, this attribute is displayed in the <code>UNIX Attributes</code> tab. To use the group ID set in the users <code>gidNumber</code> attribute as primary group for each user instead of the Windows primary group, enable the following parameter in the <code>[global]</code> section in your <code>smb.conf</code> file:


{{imbox
idmap config SAMDOM:unix_primary_group = yes
| type = content
 
| style = margin:4px 2%
{{Imbox
| text = いずれの設定を使用しても、ユーザープライマリグループとして設定されたグループには、<code>gidNumber</code>属性が設定されている必要があります。たとえば、<code>Domain Users</code>グループのみをすべてのアカウントのプライマリグループとして使用する場合、<code>Domain Users</code>グループには<code>gidNumber</code>属性が設定されている必要があります。 Winbindは、<code>gidNumber</code>属性が設定されていないプライマリグループを使用するアカウントをマップできません。
| type = important
| text = Whichever setting you use, the group (or groups) set as the users primary group must have the <code>gidNumber</code> attribute set. For example, if you only use the <code>Domain Users</code> group as the primary group for all accounts, then the <code>Domain Users</code> group must have a <code>gidNumber</code> attribute set. Winbind is unable to map accounts that use primary groups that do not have the <code>gidNumber</code> attribute set.
}}
}}


* Sambaの設定をリロードする:
{{Imbox
| type = important
| text = Whichever setting you use, do not change the users <code>primaryGroupID</code> attribute, Windows relies on all users being a member of <code>Domain Users</code>. If you require your Unix users to have a primary group other than <code>Domain Users</code>, you should use Samba version 4.6.0 or later.
}}
 
* Reload Samba:
 
# smbcontrol all reload-config
 
For further details, see the <code>smb.conf(5)</code> and <code>idmap_ad(5)</code> man page.
 
 
 
 


<pre># smbcontrol all reload-config</pre>
----
詳細は、<code>smb.conf(5)</code>および<code>idmap_ad(5)</code>のマニュアルページを参照してください。
[[Category:Active Directory]]
[[Category:Domain Members]]

2019年3月1日 (金) 17:11時点における版

前書き

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.