忍者ブログ

ブランクがあるインフラエンジニアの備忘録

サーバ構築のメモ

samba-toolによるActive Directory運用➀ ドメイン、及びアカウントポリシーの設定

×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。

samba-toolによるActive Directory運用➀ ドメイン、及びアカウントポリシーの設定

◆samba-toolによるADドメイン管理
・samba-tool domainコマンドの主なサブコマンド

サブコマンド 意味
provision 新規ドメインコントローラーの構築。
join 既存ドメインへ追加のドメインコントローラーやメンバサーバーとしての参加。
classicupgrade Samabaで構築したNTドメインからのアップグレード。
demote ドメインコントローラーの降格。
level フォレストやドメインの機能レベルの上昇。
passwordsettings アカウントポリシーの設定。


◆DCの降格。
 DCを追加すると、AD各所に関連する設定が追加されます。その為、不要になったDCを単に停止しておくと、同名のDCが追加できない。複製エラーが発生し続けるといった問題が発生します。
 こうした問題はAD機能不全に直結するものではないので、意味を理解したうえで無視することも出来ますが、不要になったDCを降格して、これらの設定を削除することが強く推奨されています。
 SamabaのDC降格は、samba-tool domain demote コマンドを使用します。このコマンドは必ず降格するDC上で実行する必要があります。

 sudo samba-tool domain demote -Uadministrator
WARNING: Using passwords on command line is insecure. Installing the setproctitle python module will hide these from shortly after program start.
Using dc1.ad.co.jp as partner server for the demotion
Password for [AD\administrator]:
Deactivating inbound replication
Asking partner server dc1.ad.co.jp to synchronize from us
【中略】
INFO 2024-10-29 08:01:54,980 pid:1162 /usr/lib/python3/dist-packages/samba/remove_dc.py #212: updating DC=_ldap._tcp.dc,DC=_msdcs.ad.co.jp,CN=MicrosoftDNS,DC=ForestDnsZones,DC=ad,DC=co,DC=jp keeping 1 values, removing 1 values
Demote successful

◆アカウントポリシーの設定
【書式】sudo samba-tool domain passwordsettings {show | set --設定名=値}

 Samabaの実装上の制限で、パスワードの最低長や有効期限といったADドメインのアカウントポリシーについては、グループポリシーの設定が反映されません。
 その為、samba-tool passwordsettingsコマンドで設定を行う必要はあります。

〇パスワードのアカウントポリシーの確認。
$ sudo samba-tool domain passwordsettings show  #設定の表示
Password information for domain 'DC=ad,DC=co,DC=jp'
Password complexity: on
Store plaintext passwords: off
Password history length: 24
Minimum password length: 7
Minimum password age (days): 1
Maximum password age (days): 42
Account lockout duration (mins): 30
Account lockout threshold (attempts): 0
Reset account lockout after (mins): 30

〇パスワードの複雑性の強制オプションの無効化
$ sudo samba-tool domain passwordsettings set --complexity=off  #パスワードの複雑性強制オプションの無効化
Password complexity deactivated!
All changes applied successfully!
$ sudo samba-tool domain passwordsettings show  #設定が反映されていることを確認。
Password information for domain 'DC=ad,DC=co,DC=jp'
Password complexity: off  #無効化されていることを確認。
(以下略)

◆機能レベルの制御
【書式】samba-tool domain level {show | raise {--forest-level=レベル | --domain-level=レベル }}

〇現在の機能レベルの確認
$ sudo samba-tool domain level show
Domain and forest function level for domain 'DC=ad,DC=co,DC=jp'
Forest function level: (Windows) 2008 R2
Domain function level: (Windows) 2008 R2
Lowest function level of a DC: (Windows) 2008 R2

〇機能レベルのアップ
$ sudo samba-tool domain level raise
All changes applied successfully!

# 下位のドメインコントローラーには下げられない(Samabaでは非サポート)
$ sudo samba-tool domain level raise --domain-level=2008 --forest-level=2008
ERROR: Domain function level can't be smaller than or equal to the actual one!

# 2008R2位上のレベルには設定できない。
$ sudo samba-tool domain level raise --domain-level=2012 --forest-level=2012
ERROR: Domain function level can't be higher than the lowest function level of a DC!

◆FSMOの管理
【書式】samba-tool fsmo {show | transfer | seize } [--role=FSMOロール名]

 ADドメインのDCはNTドメイン時のPDとBDの関係と違い、基本的に対等の関係ですが、例外としてFSMOと呼ばれる5つの特殊な役割をDCに割り当てる必要があります。
 デフォルトでは最初に構築したDCがすべてのFSMOを保持しており、小規模なドメインであれば設定を変更する必要はありません。

〇samba-tool fsmoコマンドの主なオプション

コマンド名 説明
transfer 指定したFSMOを転送する
seize 指定したFSMOを強制する
show 現在FSMOとなっているDCを表示する


$ sudo samba-tool fsmo show   #FSMOを所持しているサーバを確認。
SchemaMasterRole owner: CN=NTDS Settings,CN=DC1,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=ad,DC=co,DC=jp
InfrastructureMasterRole owner: CN=NTDS Settings,CN=DC1,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=ad,DC=co,DC=jp
RidAllocationMasterRole owner: CN=NTDS Settings,CN=DC1,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=ad,DC=co,DC=jp
PdcEmulationMasterRole owner: CN=NTDS Settings,CN=DC1,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=ad,DC=co,DC=jp
DomainNamingMasterRole owner: CN=NTDS Settings,CN=DC1,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=ad,DC=co,DC=jp
DomainDnsZonesMasterRole owner: CN=NTDS Settings,CN=DC1,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=ad,DC=co,DC=jp
ForestDnsZonesMasterRole owner: CN=NTDS Settings,CN=DC1,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=ad,DC=co,DC=jp


$ sudo samba-tool fsmo transfer --role=all  #すべてのFSMOの転送。
FSMO transfer of 'rid' role successful
FSMO transfer of 'pdc' role successful
FSMO transfer of 'naming' role successful
FSMO transfer of 'infrastructure' role successful
FSMO transfer of 'schema' role successful
This DC already has the 'domaindns' FSMO role
This DC already has the 'forestdns' FSMO role

◆DNSの管理
〇samba-tool dnsコマンドのサブコマンド
サブコマンド 意味
add DNSレコードの追加
delete DNSレコードの削除
query DNS名の照会
roothinits ルートヒントの照会
serverinfo サーバ情報の照会
update DNSレコードの更新
zonecreate DNSゾーンの追加
zonedelete DNSゾーンの削除
zoneinfo DNSゾーン情報の照会
zonelist DNSゾーン一覧の照会


$ sudo samba-tool dns serverinfo localhost -U administrator  #DNSサーバの各種設定確認。
WARNING: Using passwords on command line is insecure. Installing the setproctitle python module will hide these from shortly after program start.
Password for [AD\administrator]:
  dwVersion                   : 0xece0205
  fBootMethod                 : DNS_BOOT_METHOD_DIRECTORY
  fAdminConfigured            : FALSE
  fAllowUpdate                : TRUE
  fDsAvailable                : TRUE
  pszServerName               : DC1.ad.co.jp
  pszDsContainer              : CN=MicrosoftDNS,DC=DomainDnsZones,DC=ad,DC=co,DC=jp
(略)

$ sudo samba-tool dns add localhost ad.co.jp testA A 10.0.1.12 -U Administrator  #Aレコードの追加
WARNING: Using passwords on command line is insecure. Installing the setproctitle python module will hide these from shortly after program start.
Password for [AD\Administrator]:
Record added successfully


$ sudo samba-tool dns query localhost ad.co.jp testA A -U Administrator  #追加したレコードの参照
WARNING: Using passwords on command line is insecure. Installing the setproctitle python module will hide these from shortly after program start.
Password for [AD\Administrator]:
  Name=, Records=1, Children=0
PR

コメント

プロフィール

HN:
のらくら
性別:
非公開
自己紹介:
介護と自身の手術でブランクが出来たインフラエンジニアの学習メモ。VirtualBOXで仮想サーバーを建て、GNS3でCiscoルーター&スイッチによるネットワークのエミュレーションもしています。GNS3ネットワーク内に仮想サーバーと連携させて、実際のネットワーク環境におけるサーバーをシミュレートする他、LinuC level3 300の対策もしています。

P R