最小インストールのRHEL7環境で文字化けせずにNetBackup管理画面を表示するために必要なパッケージ


最小インストールのRHEL7環境で文字化けせずにNetBackup管理画面を表示するために必要なパッケージを確認した。

なお、表示させるのはLinuxサーバローカルのディスプレイではなく、同一ネットワーク上にあるWindows10にインストールされた「VcXSrv

# yum install libXext libXrender libXtst xorg-x11-fonts-Type1 vlgothic-fonts vlgothic-p-fonts

なお、「vlgothic-p-fonts」は入れなくても表示はされるが、文字がゴツゴツした感じとなる。

・vlgothic-fonts vlgothic-p-fontsの両方をインストールした場合


vlgothic-fonts vlgothic-p-fontsの両方をインストールした場合

・vlgothic-fontsのみインストールした場合


vlgothic-fontsのみインストールした場合

NetBackup GUIはJavaを使って表示している。

フォントに関する指定はJREのlibにfontconfig~.srcというファイルで保存されている。

# ls /usr/openv/java/jre/lib/fontconfig*.src
/usr/openv/java/jre/lib/fontconfig.RedHat.5.properties.src
/usr/openv/java/jre/lib/fontconfig.RedHat.6.properties.src
/usr/openv/java/jre/lib/fontconfig.SuSE.10.properties.src
/usr/openv/java/jre/lib/fontconfig.SuSE.11.properties.src
/usr/openv/java/jre/lib/fontconfig.Turbo.properties.src
/usr/openv/java/jre/lib/fontconfig.properties.src
#

「fontconfig.RedHat.6.properties.src」の中を見てみると、関係しそうな記述として以下を発見

# Font File Names
filename.-misc-kochi_gothic-medium-r-normal--*-%d-*-*-c-*-iso10646-1=/usr/share/fonts/vlgothic/VL-Gothic-Regular.ttf
filename.-misc-kochi_mincho-medium-r-normal--*-%d-*-*-c-*-iso10646-1=/usr/share/fonts/ipa-mincho/ipam.ttf
filename.-misc-zysong18030-medium-r-normal--*-%d-*-*-c-*-iso10646-1=/usr/share/fonts/cjkuni-uming/uming.ttc


# AWT X11 font paths
awtfontpath.chinese-tw-iso10646=/usr/share/fonts/cjkuni-uming
awtfontpath.chinese-cn-iso10646=/usr/share/fonts/cjkuni-uming
awtfontpath.japanese-iso10646=/usr/share/fonts/vlgothic
awtfontpath.korean-iso10646=/usr/share/fonts/un-core

どうやら明朝体は「ipa-mincho-fonts.noarch 」 に含まれる /usr/share/fonts/ipa-mincho/ipam.ttf、ゴシック体は「vlgothic-fonts」 に含まれる /usr/share/fonts/vlgothic/VL-Gothic-Regular.ttf を使っているようだ。


2022/07/10追記

最小インストールのOracle Linux 8でブラウザを動かす場合FirefoxとChromeのどっちが容量少ないか」 で検証した結果を踏まえると、RHEL8の標準状態で使えるフォントは「google-noto-cjk-fonts-common google-noto-sans-cjk-ttc-fonts google-noto-serif-cjk-ttc-fonts」になるんじゃないかと思われる。

もしくはEPELレポジトリを追加して、「vlgothic-fonts vlgothic-p-fonts」

NetBackupクライアントの接続エラーに関して調査


Veritas NetBackupにおいて、NetBackupクライアントとの接続に問題があった場合の調査手法についてメモ書き

1.1 マスタサーバ/メディアサーバ上での名前解決確認

マスタサーバ/メディアサーバ上で、/usr/openv/netbackup/bin/bpclntcmd もしくは C:\Program Files\Veritas\NetBacku\bin\bpclntcmd.cmd を実行して、自身の名前解決状況を確認する。

# bpclntcmd -hn マスタサーバ/メディアサーバ名
# bpclntcmd -hn ドメイン名付きのマスタサーバ/メディアサーバ名
# bpclntcmd -ip IPアドレス

ここで予期しないIPアドレスが出てきてしまうのであれば、ホスト名/IPアドレス/DNS設定を見直すこと。

続いて問題が発生しているクライアントについての名前解決状況を確認する。

# bpclntcmd -hn クライアントホスト名
# bpclntcmd -hn ドメイン名付きのクライアントホスト名
# bpclntcmd -ip クライアントのIPアドレス

クライアントホスト名からIPアドレスが取得できないようであれば、DNS設定を見直し、DNS関連の設定変更ができない場合は hostsファイル(/etc/hosts, C:\Windows\System32\drivers\etc\hosts)にクライアントホスト名のエントリを追加すること。

追加後は、再度bpclntcmdを実行して、状況が変化したことを確認する。

1.2. クライアント上での名前解決確認

クライアント上で、/usr/openv/netbackup/bin/bpclntcmd もしくは C:\Program Files\Veritas\NetBacku\bin\bpclntcmd.cmd を実行して、自身の名前解決状況を確認する。

# bpclntcmd -hn クライアントホスト名
# bpclntcmd -hn ドメイン名付きのクライアントホスト名
# bpclntcmd -ip クライアントのIPアドレス

通常はクライアント自身については正常に情報が取得できるはずです。

続いてマスタサーバ/メディアサーバについての名前解決状況を確認

# bpclntcmd -hn マスタサーバ/メディアサーバ名
# bpclntcmd -hn ドメイン名付きのマスタサーバ/メディアサーバ名
# bpclntcmd -ip IPアドレス

マスタサーバ上で実行した結果と異なる場合は、名前解決情報のキャッシュが残存している可能性があるため、「bpclntcmd -clear_host_cache」を実行してキャッシュ削除した上で、再度、名前解決状況を確認する。

マスタサーバ/メディアサーバ名からIPアドレスが取得できないようであれば、DNS設定を見直し、DNS関連の設定変更ができない場合は hostsファイル(/etc/hosts, C:\Windows\System32\drivers\etc\hosts)にマスタサーバ/メディアサーバ 名のエントリを追加すること。

1.3. クライアント上でマスタサーバが認識している情報の確認

クライアント上で、/usr/openv/netbackup/bin/bpclntcmd もしくは C:\Program Files\Veritas\NetBacku\bin\bpclntcmd.cmd を実行して、NetBackupが認識しているホスト名情報を確認する。

# bpclntcmd -pn -verbose

2.1. 接続テストを実施

マスタサーバ上で、/usr/openv/netbackup/bin/admincmd/bptestbpcd もしくは C:\Program Files\Veritas\NetBacku\bin\admin\bptestbpcd を実行して、 マスターサーバからクライアントへの接続テストを実施します。

# bptestbpcd -client クライアントホスト名 -verbose -debug

(Veritas KB: How to test client connections using the bptestbpcd command)

2.2 接続テスト2

マスタサーバ上で /usr/openv/netbackup/bin/bptestnetconn もしくは C:\Program Files\Veritas\NetBacku\bin\bptestnetconn.exe を実行して、接続を確認

# bptestnetconn -asp -H クライアントホスト名

(Veritas KB: Best Practices for bptestnetconn including arguments and outputs by NetBackup version )
(Veritas KB: Using bptestnetconn to test connectivity between NetBackup hosts )


おまけ: クライアントの情報が取得できるか確認

マスタサーバ上で、/usr/openv/netbackup/bin/admincmd か C:\Program Files\Veritas\NetBacku\bin\admin にある bpgetconfig を実行して、マスタサーバからクライアント上のNetBackup Agentのインストール情報を確認します。

# bpgetconfig -g クライアントホスト名 -L

出力内に、Agentのインストール先やバージョンが表示されれば接続できています。

(Veritas KB: Command line option to get client NetBackup version, OS, and hardware type)


おまけ2: 複数NICがある場合の設定に関する資料

How to follow best practices when using Preferred Network entries
 調査時に使うbplocaladdrsコマンド, bptestnetconnコマンド, bptestbpcdコマンドの出力サンプルあり

Best Practices when assigning an IP address to the appliance management interface
 bp.confにPREFERRED_NETWORK=~というエントリを追加する、という話

Required Interface or Preferred Network settings seem to cause connections between non-routed networks on weakhost platforms
 bp.confにPREFERRED_NETWORKかREQUIRED_INTERFACE設定をする
 (PREFERRED_NETWORKはNBU7.xで追加された設定項目)

How to force backups over multiple specific networks interfaces instead of all those available.


NetBackup 8.xでの証明書関連エラー対応

クライアントインストール時にサーバとの通信がうまくいかなかったけど、無視してインストールを完了した場合、サーバの証明書が、クライアント側に保存されておらず、バックアップを行うとエラーになる。

1: (7660) ピアプロキシは証明書プロトコルの使用可能な証明書を見つけることができません 

2022/10/24 10:28:10 - エラー bpbrm (pid=1956) [PROXY] Connecting host:  NBUサーバ
2022/10/24 10:28:10 - エラー bpbrm (pid=1956) [PROXY] ConnectionId: {149DAA97-CA51-4AC8-8E38-F4F253D9B113}:OUTBOUND
2022/10/24 10:28:10 - エラー bpbrm (pid=1956) [PROXY] pid: 2556
2022/10/24 10:28:10 - エラー bpbrm (pid=1956) [PROXY] Received status: 7660 with message 証明書のマッピングファイルを読み込めません。
2022/10/24 10:28:10 - エラー bpbrm (pid=1956) ホスト ( NBUクライアント) 上のピアプロキシで使用可能な証明書が見つかりませんでした。 証明書が正常に配備されていない可能性があります。
2022/10/24 10:28:10 - エラー bpbrm (pid=1956) [PROXY] 処理中 (CertProtocol) にエラーが発生しました (CERT_PROTOCOL_SELECT_COMMON_CA_ROOT)。
2022/10/24 10:28:10 - エラー bpbrm (pid=1956)  NBUクライアント の bpcd が状態 7660 で終了しました: ピアプロキシは証明書プロトコルの使用可能な証明書を見つけることができません
2022/10/24 10:28:10 - エラー bpbrm (pid=1956) [PROXY] Connecting host:  NBUサーバ
2022/10/24 10:28:10 - エラー bpbrm (pid=1956) [PROXY] ConnectionId: {84C7C072-EC87-4247-AE80-9066320C5EA5}:OUTBOUND
2022/10/24 10:28:10 - エラー bpbrm (pid=1956) [PROXY] pid: 2556
2022/10/24 10:28:10 - エラー bpbrm (pid=1956) [PROXY] Received status: 7660 with message 証明書のマッピングファイルを読み込めません。
2022/10/24 10:28:10 - エラー bpbrm (pid=1956) ホスト ( NBUクライアント) 上のピアプロキシで使用可能な証明書が見つかりませんでした。 証明書が正常に配備されていない可能性があります。
2022/10/24 10:28:10 - エラー bpbrm (pid=1956) [PROXY] 処理中 (CertProtocol) にエラーが発生しました (CERT_PROTOCOL_SELECT_COMMON_CA_ROOT)。
2022/10/24 10:28:10 - エラー bpbrm (pid=1956)  NBUクライアント の BPCD が状態 61 で終了したため、メールを送信できません: VNETD プロキシでエラーが発生しました
2022/10/24 10:28:10 - 情報 bpbkar32 (pid=0) done. status: 7660: ピアプロキシは証明書プロトコルの使用可能な証明書を見つけることができません
2022/10/24 10:28:10 - 推定で 0 KB 必要です
2022/10/24 10:28:10 - 情報 nbjm (pid=4240) started backup (backupid= NBUクライアント_1666574889) job for client  NBUクライアント, policy  NBUクライアント, schedule Full on storage unit diskstorage
2022/10/24 10:28:10 - 開始されたプロセス bpbrm (pid=1956)
2022/10/24 10:28:10 - 書き込みの終了
ピアプロキシは証明書プロトコルの使用可能な証明書を見つけることができません  (7660)

このエラーに関するKB 「How to resolve communication problems due to certificate errors after upgrading to 8.1 from a previously re-installed 8.0 host」「How to manually obtain a host ID Certificate.」「How to re-issue a token on a NetBackup 8.1.x client that has been reinstalled

上記からNetBackupクライアントから証明書取得のコマンドを実行してみる

# /usr/openv/netbackup/bin/nbcertcmd  -getCertificate -host  NBUクライアント -server NBUサーバ
nbcertcmd: The -getCertificate operation failed for server NBUサーバ
EXIT STATUS 8500: Connection with the web service was not established.
#

これはNetBackupサーバ側でポートが正しく空いていないためだった(Status Code:8500 Error when trying to install agent on new server)

今回はWindows Server上だったので、Windows FIrewallに対して、ポート1556とポート13724を開けた。(NetBackup master server portsをみるともポート 13782 もあった方がよさそう)

再実行すると下記となる

# /usr/openv/netbackup/bin/nbcertcmd  -getCertificate -host  NBUクライアント -server NBUサーバ
nbcertcmd: The -getCertificate operation failed for server NBUサーバ.
EXIT STATUS 8508: List of trusted Certificate Authorities could not be fetched.
#

これは証明書管理にホストが登録されていないために発生しています

新規トークンを発行します

ここで表示されるトークン値を使います

# /usr/openv/netbackup/bin/nbcertcmd -getCertificate -token QWRNKOHALAKDPAGF
nbcertcmd: The -getCertificate operation failed for server NBUサーバ.
EXIT STATUS 8508: List of trusted Certificate Authorities could not be fetched.
#

なんだろと調査をいろいろしてみるとnbcertcmd -displayCACertDetailの実行結果で問題が・・・

# /usr/openv/netbackup/bin/nbcertcmd -displayCACertDetail -server NBUサーバ

CA Certificate received successfully from server NBUサーバ.

         Subject Name : /CN=nbatd/OU=root@NBUサーバ/O=vx
           Start Date : 10月 20 04:36:48 2022 GMT
          Expiry Date : 10月 15 05:51:48 2042 GMT
     SHA1 Fingerprint : E4:3C:2E:12:4C:66:DF:62:28:98:C1:D3:EB:5A:E0:44:4F:52:64:62
 CA Certificate State : Not Trusted

# /usr/openv/netbackup/bin/nbcertcmd -displayCACertDetail -server NBUサーバ.adosakana.local
The target server NBUサーバ.adosakana.local could not be authenticated.
The server name does not match any of the host names listed in the server's certificate.
Names listed in the server's certificate are:
DNS:NBUサーバ
Failed to display CA certificate details

nbcertcmd: The -displayCACertDetail operation failed.
EXIT STATUS 8509: The specified server name was not found in the web service certificate
#

NetBackupサーバ上の証明書がドメイン無しで発行されているのにたいして、NetBackupクライアント側からはドメイン有りで接続しようとしているのでエラーとなっていた模様。

NetBackupサーバ側の証明書変更手法が分からないのでNetBackupクライアント側のbp.confのSERVER記述をドメイン無しに書き換えて再実行

# /usr/openv/netbackup/bin/nbcertcmd -getCertificate -token QWRNKOHALAKDPAGF -force
nbcertcmd: The -getCertificate operation failed for server NBUサーバ.
EXIT STATUS 8508: List of trusted Certificate Authorities could not be fetched.
#

これだけではなかった模様

「nbcertcmd -getCACertificate」を実行して取り込みした上で「nbcertcmd -getCertificate -token」で成功

# /usr/openv/netbackup/bin/nbcertcmd -getCACertificate
Authenticity of root certificate cannot be established.
The SHA1 fingerprint of root certificate is E4:3C:2E:12:4C:66:DF:62:28:98:C1:D3:EB:5A:E0:44:4F:52:64:62.
Are you sure you want to continue using this certificate ? (y/n): y
The validation of root certificate fingerprint is successful.
CA certificate stored successfully from server NBUサーバ.
# /usr/openv/netbackup/bin/nbcertcmd -getCertificate -token
QWRNKOHALAKDPAGF -force
Host certificate and certificate revocation list received successfully from server NBUサーバ
#

GUI上にも登録できた

SDカードの種類


SDカード(SDHC,SDXC含めて)の種類としてClass10とかU1とかある。どういうものがあるのか確認した。

SD Associcationによる公式記載を調べて見ると・・・「スピードクラス」に説明がある。

SD Associcationのスピードクラスより引用

また「アプリケーションパフォーマンスクラス」というのもある。

SD Associationのアプリケーションパフォーマンスクラスより引用

スピードクラスの方はシーケンシャルライト速度のみの規定しかないため並列書き込みが発生する用途では保証にならない、ということになる。

並列書き込みが発生しない用途、というのは、カメラ撮影ぐらいですね。

並列書き込みが発生する用途というのは、スマホ用(カメラ撮影の他にアプリケーションの領域にもなる)とか、ラズパイ用とかNintendo Switch/3DS用とかになります。

つまり、よくNintendo Switch用とかうたっているU1やU3しか書かれていない製品よりは、書かれていなくてもA1やA2が定義されているもののほうが良いようですね。

QUADSTOR VLTを使ってみた


以前「オープンソース版もあるVTLソフトウェアQUADSTOR」という記事を作成したが、使ってはいなかった。

よく見てみたら、ローカルのテープ装置/テープライブラリとしてエミュレートしてくれる機能もあったので、NetBackup Linuxでテープライブラリを使う案件が来たついでに、練習のためQUADSTORを使ってみた。

QUADSTORの注意点

  • CGIを使うWebインタフェースのプログラム(標準はポート80使用)
  • Webインタフェースに認証機能がないので要注意(アクセスすれば誰でも消せます)
  • SELinux環境下で使う場合、後述のSELinuxコマンドを実行すること
  • 仮想テープのデータを保存する領域はRAWデバイスディスクが必要(OSからマウントされない)
  • QUADSTORの起動に時間がかかる(うちの環境では10分かかった)

セットアップ実施

セットアップは簡単で、「Installation/Upgrading on RHEL/CentOS 6/7, SLES 12 SP2 and Debian 7/8」に書いてあるものをそのまま実行した形である。

# yum install httpd gcc perl kernel-devel sg3_utils
# rpm -ivh quadstor-vtl-ext-3.0.31.1-rhel.x86_64.rpm

プログラムの自動起動で以下を実行

# systemctl enable httpd.service
# systemctl enable quadstorvtl.service

SELinux環境で動作するように下記の設定を実行

# setsebool -P httpd_enable_cgi 1
# semanage permissive -a httpd_t

なお「semanage」は標準ではインストールされていないので「yum install policycoreutils-python」を実行して、追加インストールする必要がある。

Webインタフェースにアクセスする為に、firewallに穴を開けます。

# firewall-cmd --permanent --zone=public --add-service=http

iSCSIデバイスとして動作するので、iSCSIで使用するポートについても設定します。

# firewall-cmd --permanent --zone=public --add-service=iscsi-target

また、Webインタフェースには認証機能がなく、誰でも使用できる状態であるため「Accessing the Web Management Interface」の「SECURING ACCESS TO THE WEB INTERFACE」に記載されているように.htpasswdを使ってアクセス制限をかけましょう。

QUADstorとhttpdを起動します。

# systemctl start quadstorvtl
# systemctl start httpd

起動後、Webインタフェースにアクセスすると、以下の様な感じの画面がでてきます。

「Server Status: Server initialized and running」となっていればQUADstorの起動が完了しています。

まず「Physical Storage」タブにアクセスすると、いまマウントされているなローカルディスクが表示されます。

[Add]をクリックし、下記画面からQUADstor管理下に設定します。

指定したディスクの初期化が始まります。

なお、初期化中にさらなる追加を行おうとすると「ERROR: Reply from server is “Cannot add a disk when another is being configured “」とエラーになります。

初期化が終わると、下記の様になります。(なお、表示は自動更新されるますので、ブラウザの手動更新は不要です)

もう片側のディスクも同様に登録し、完了するのを待ちます。

次に「Virtual Libraries」から「Add VTL」よりテープチェンジャーを作成します。

[Add VTL]をクリックし、作成するテープチェンジャの設定を指定します。

登録したテープチェンジャーは下記の様に見えます。

作成した状態では中にテープメディアが入っていない状態です。

テープメディアは「VCartridge Information」にある[Add VCartridge]から行います。

テープメディアの種類はLTOドライブの選択に従って自動的に行われています。

指定するのは、作成する本数(Number of VCartridges)と、メディアにつけるバーコードラベルの書式指定です。

バーコード書式は英数6文字で、例えばLTO1カートリッジを10本、ラベル:BK0000と指定した場合「BK0000L1」~「BK0009L1」のテープメディアが登録されることになります。

iSCSIのテープ装置としては作成されましたので、Linuxサーバから接続してみます。

CentOS7だったら、まずは「yum install iscsi-initiator-utils」で接続に必要なソフトウェアをインストールします。

続いて、iSCSI接続を永続化するため「systemctl enable iscsid」を実行します。

「iscsiadm -m discovery -t sendtargets -p <IPアドレス>」を実行し、検出したあと、「iscsiadm -m node –login -p <IPアドレス>」でログインします。

# iscsiadm -m discovery -t sendtargets -p <IPアドレス>
# iscsiadm -m node --login -p <IPアドレス>

接続するとLinux上からは下記の様に見えるようになります。

# cat /proc/scsi/scsi
<略>
Host: scsi34 Channel: 00 Id: 00 Lun: 00
  Vendor: IBM      Model: ULT3580-TD1      Rev: D711
  Type:   Sequential-Access                ANSI  SCSI revision: 06
Host: scsi33 Channel: 00 Id: 00 Lun: 00
  Vendor: ADIC     Model: Scalar 24        Rev: 6.24
  Type:   Medium Changer                   ANSI  SCSI revision: 03
#

NetBackupのコマンドで確認してみると、下記の様にみえました。

# /usr/openv/volmgr/bin/tpautoconf -t
TPAC60 IBM     ULT3580-TD1     D711 2688700001 -1 -1 -1 -1 /dev/nst0 - -
# /usr/openv/volmgr/bin/tpautoconf -r
TPAC60 ADIC    Scalar 24       6.24 26887167A2DC4D54B8910000 -1 -1 -1 -1 /dev/sg4 - -
# /usr/openv/volmgr/bin/scan
************************************************************
*********************** SDT_TAPE    ************************
*********************** SDT_CHANGER ************************
************************************************************
------------------------------------------------------------
Device Name  : "/dev/sg4"
Passthru Name: "/dev/sg4"
Volume Header: ""
Port: -1; Bus: -1; Target: -1; LUN: -1
Inquiry    : "ADIC    Scalar 24       6.24"
Vendor ID  : "ADIC    "
Product ID : "Scalar 24       "
Product Rev: "6.24"
Serial Number: "26887167A2DC4D54B8910000"
WWN          : ""
WWN Id Type  : 0
Device Identifier: "ADIC    26887167A2DC4D54B8910000"
Device Type    : SDT_CHANGER
NetBackup Robot Type: 8
Removable      : Yes
Device Supports: SCSI-3
Number of Drives : 1
Number of Slots  : 20
Number of Media Access Ports: 1
Drive 1 Serial Number      : "2688700001"
Flags : 0x0
Reason: 0x0
------------------------------------------------------------
Device Name  : "/dev/nst0"
Passthru Name: "/dev/sg3"
Volume Header: ""
Port: -1; Bus: -1; Target: -1; LUN: -1
Inquiry    : "IBM     ULT3580-TD1     D711"
Vendor ID  : "IBM     "
Product ID : "ULT3580-TD1     "
Product Rev: "D711"
Serial Number: "2688700001"
WWN          : ""
WWN Id Type  : 0
Device Identifier: "IBM     ULT3580-TD1     2688700001"
Device Type    : SDT_TAPE
NetBackup Drive Type: 3
Removable      : Yes
Device Supports: SCSI-6
Flags : 0x0
Reason: 0x0
#

ドキュメントを確認すると、「Data deduplication best practices」というのがあり、重複排除が行われた状態でRAWストレージに格納されている模様。


2019/11/01追記

QUADstorをアップデートする場合の注意点。

「rpm -Uvh quadstor*.rpm」といったアップデートはできない。

一度、アンインストールした上で、再インストールする必要がある。

ここまでは「Installation or Upgrading the VTL software」にも書かれているのだが、実際にやろうとするとスクリプトの実行に失敗する場合がある。

アンインストール時、quadstorによりinitrd imageに組み込まれたモジュールを削除するために、quadstorの停止とモジュールのアンロードが実施されるのだが、モジュールの使用状況によってはアンロードが失敗する場合がある。

その場合は、一度OSを再起動して、モジュールがロードされていない状態にしないとアンインストールができなかった。

CentOS7の場合、以下の手順で行った。

(1) 「systemctl mask quadstorvtl」で再起動時にQUADstorが起動しない様に設定(maskしなくでも大丈夫な場合もある)
(2) OS再起動
(3) 「rpm -ev quadstor-vtl-ext-3.0.36-rhel.x86_64」といった感じでパッケージ削除
(4) 「rpm -ivh quadstor-vtl-ext-3.0.37-rhel.x86_64.rpm」といった感じでパッケージインストール
(5) 「 systemctl unmask quadstorvtl」 「systemctl enable quadstorvtl」で有効化
(6) OS再起動


2021/10/21追記

QUADStorVTLではなくて普通のiSCSIストレージに接続するために、Oracle Linux 8環境で「iscsiadm -m discovery -t sendtarget -p IPアドレス」を実行したら何も見つからなかった。

RHEL6ドキュメントを見直してみると「-t sendtarget」ではなく「-t st」だったのでこちらでやってみたら通った。というメモ書き

[root@oraclelinux ~]# iscsiadm -m discovery -t sendtarget -p 172.17.73.21 -o new
iscsiadm: Discovery record [172.17.73.21,3260] not found!
[root@oraclelinux ~]# iscsiadm -m discovery -t sendtarget -p 172.17.73.21 -d 5
iscsiadm: Max file limits 1024 262144
iscsiadm: Could not open /var/lib/iscsi/send_targets/172.17.73.21,3260: No such file or directory
iscsiadm: Discovery record [172.17.73.21,3260] not found!
[root@oraclelinux ~]# iscsiadm -m discovery -t st -p 172.17.73.21 -o new
172.17.73.21:3260,2460 iqn.2007-11.com.nimblestorage:test-v371c7edc5d1bd1e3.000000c8.6a07af3f
192.168.1.200:3260,2460 iqn.2007-11.com.nimblestorage:test-v371c7edc5d1bd1e3.000000c8.6a07af3f
192.168.11.3:3260,2460 iqn.2007-11.com.nimblestorage:test-v371c7edc5d1bd1e3.000000c8.6a07af3f
192.168.12.1:3260,2460 iqn.2007-11.com.nimblestorage:test-v371c7edc5d1bd1e3.000000c8.6a07af3f
172.17.73.21:3260,2460 iqn.2007-11.com.nimblestorage:vmwarestorage-v371c7edc5d1bd1e3.00000063.6a07af3f
192.168.1.200:3260,2460 iqn.2007-11.com.nimblestorage:vmwarestorage-v371c7edc5d1bd1e3.00000063.6a07af3f
192.168.11.3:3260,2460 iqn.2007-11.com.nimblestorage:vmwarestorage-v371c7edc5d1bd1e3.00000063.6a07af3f
192.168.12.1:3260,2460 iqn.2007-11.com.nimblestorage:vmwarestorage-v371c7edc5d1bd1e3.00000063.6a07af3f
[root@oraclelinux ~]#

Samba 4.9.xでActive Directoryを1から立てる


samba 4.10.2にアップデートした際にpython3関連で変更があったため「Samba 4.10.xでActive Directoryを1から立てる」という記事で内容を若干更新しています。


Samba 4.9.4に更新した際に、いろいろ修正点があったので更新。なお、この記事は、Active Directoryサーバとして使用することについてのみ解説しています。ファイルサーバとして使用することについては記述していません。

なお、過去バージョンの履歴。2018年3月版「Samba 4.7.xでActive Directoryを1から立てる」、2016年7月版「Samba 4.4.xでActive Directoryを1から立てる」、2014年2月版「Samba 4.xでActive Directoryを1から立てる

さて、Linux上でSambaを使ってActive Directoryサーバを立てるメリットは以下の点です。

その1:Windows Serverを買わなくてもActive Directoryを作れる

WindowsのCALを買わずにActive Directory環境の構築ができるため、ライセンス費用の低減になります。

その2:Active Directoryユーザの作成などのユーザ管理をWindowsマシンからWindows標準ツールで行える

ユーザーの作成/変更、コンピューターアカウントの作成、DNSの管理など、Active Directoryの管理を行う際に頻繁に使う操作については、WindowsのActive Directory管理ツールやDNS管理ツールを使用することができる。このため、普段はLinuxのCLIコマンド(samba-toolsやnetコマンドなど)を使う必要はない。

Active Directoryに参加しているWindowsマシンに、Windows機能のActive Directory管理ツールを追加インストールし、Active Directoryの管理者にてログオンすることで、管理ができる。

その3:sambaの設定は難しくない

10年ぐらい前のsambaでは、DNSサーバやLDAPサーバをsambaとは別に用意し、連携する必要がありました。いまのsambaはDNSサーバとLDAPサーバの機能が統合されているため設定が容易になりました。

Active Directory名とActive Directory上の役割、管理者パスワードを設定するぐらいで環境を作成することができます。

逆にデメリットとしてどのようなものがあるか?

その1:Active Directoryの全機能が搭載されていない

ドメイン/フォレストの機能レベルがWindows Server 2012R2レベルまで対応になったものの、「Kerberos関連機能が未搭載」となっています。(samba公式wiki「Raising the Functional Levels」)

「Windows Server 2008 R2」レベルまでであればフルサポートしています。このレベルであれば、Windows Server 2016環境でフェイルオーバークラスターマネージャーでクラスタを組むこともできました。(samba 4.7ぐらいから可能になった)


手順は、公式の「Setting up Samba as an Active Directory Domain Controller」と「Package Dependencies Required to Build Samba」を参照しながら実施していきます。

  1. CentOS7の最小インストールを実施

2. /etc/hostsの修正

自ホスト名を/etc/hostsに追加。
追加の際は、ショートのホスト名と、ドメイン付きのFQDNの両方を列挙すること。

[root@adserver ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
172.17.44.40    adserver adserver.adosakana.local
[root@adserver ~]#

3. 好みに応じて使うツールをインストール

セッションが途中で切れても良い様に「screen」か「tmux」と、ファイルダウンロードするためにwgetかcurlをインストールします。

[root@adserver ~]# yum install wget screen
<略>
[root@adserver ~]#

4. 必要なパッケージをインストール

Samba公式の「Package Dependencies Required to Build Samba」に記載されているパッケージをインストール

[root@adserver ~]# yum install attr bind-utils docbook-style-xsl gcc gdb krb5-workstation \
       libsemanage-python libxslt perl perl-ExtUtils-MakeMaker \
       perl-Parse-Yapp perl-Test-Base pkgconfig policycoreutils-python \
       python2-crypto gnutls-devel libattr-devel keyutils-libs-devel \
       libacl-devel libaio-devel libblkid-devel libxml2-devel openldap-devel \
       pam-devel popt-devel python-devel readline-devel zlib-devel systemd-devel \
       lmdb-devel jansson-devel gpgme-devel pygpgme libarchive-devel
<略>
[root@adserver ~]#

ここで問題発生・・・上記の説明に「RHEL7ではEPELレポジトリを追加する必要があるが、CentOS7とScientific Linux7では不要」とあるが、CentOS7環境で試してみると「perl-Test-Base」と「lmdb-devel」は無い。

ちなみにこの状態でsamab 4.9.xのconfigureを実行すると「Samba AD DC and –enable-selftest requires lmdb 0.9.16 or later」と言われて失敗します。

EPELレポジトリを追加してから、必要なパッケージのインストールをやり直します。(なお、perl-Test-Baseに関連付いていろいろパッケージが追加されます。)

[root@adserver ~]# yum install epel-release.noarch
<略>
[root@adserver ~]#

5. sambaのtar.gzをダウンロード

samba.orgからsambaをダウンロードします。

[root@adserver ~]# wget https://download.samba.org/pub/samba/stable/samba-4.9.4.tar.gz
--2018-12-28 13:10:22--  https://download.samba.org/pub/samba/stable/samba-4.9.4.tar.gz
download.samba.org (download.samba.org) をDNSに問いあわせています... 144.76.82.156, 2a01:4f8:192:486::443:2
download.samba.org (download.samba.org)|144.76.82.156|:443 に接続しています...  接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 18053738 (17M) [application/gzip]
`samba-4.9.4.tar.gz' に保存中

100%[======================================>] 18,053,738  3.65MB/s 時間 5.9s

2018-12-28 13:10:29 (2.93 MB/s) - `samba-4.9.4.tar.gz' へ保存完了 [18053738/18053738]

[root@adserver ~]# 

6. configure実施

[root@adserver ~]# tar xfz samba-4.9.4.tar.gz
[root@adserver ~]# cd samba-4.9.4/
[root@adserver samba-4.9.4]#  ./configure
Checking for program gcc or cc           : /usr/bin/gcc
Checking for program cpp                 : /usr/bin/cpp
Checking for program ar                  : /usr/bin/ar
Checking for program ranlib              : /usr/bin/ranlib
<略>
Checking if compiler accepts -fstack-protector                                                  : no
Checking if compiler accepts -fstack-clash-protection                                           : yes
'configure' finished successfully (1m24.346s)
[root@adserver samba-4.9.4]#

7. make & make install

[root@adserver samba-4.9.4]# make
WAF_MAKE=1 python ./buildtools/bin/waf build
Waf: Entering directory `/root/samba-4.9.4/bin'
<略>
Note: Writing nmblookup4.1
[4039/4039] Generating man/samba-gpupdate.8
Note: Writing samba-gpupdate.8
Waf: Leaving directory `/root/samba-4.9.4/bin'
'build' finished successfully (15m49.153s)
[root@adserver samba-4.9.4]# make install
WAF_MAKE=1 python ./buildtools/bin/waf install
Waf: Entering directory `/root/samba-4.9.4/bin'
        Selected embedded Heimdal build
Checking project rules ...
<略>
* installing bin/default/pidl/Parse::Pidl::Wireshark::NDR.3pm as /usr/local/samba/share/man/man3/Parse::Pidl::Wireshark::NDR.3pm
Waf: Leaving directory `/root/samba-4.9.4/bin'
'install' finished successfully (3m38.208s)
[root@adserver samba-4.9.4]#

8. インストール完了確認

インストールされたsambaのバージョンを確認します。

[root@adserver samba-4.9.4]# /usr/local/samba/sbin/samba -V
Version 4.9.4
[root@adserver samba-4.9.4]#

9. Active Directoryのセットアップ

ドメイン「adosakana.local」を作成します。
また、sambaの機能を使ってAD DNSを構築するので「SAMBA_INTERNAL」を選択します。

なお、「–use-rfc2307」はADにNIS連携機能を追加するオプションです。AD上にUnix用のUID/GID/shell情報なども格納できるようにします。Samba環境では有効にしておくべきものです。

また、セットアップ中、「Merge the contents of this file with your system krb5.conf or replace it with this one. Do not create a symlink!」とメッセージが出ますが、これは、この手順で自動生成されたkrb5.confをシステムのもつkrb5.confと統合しろ、というお知らせです。後の手順で対処します。

[root@adserver samba-4.9.4]# /usr/local/samba/bin/samba-tool domain provision --use-rfc2307 --interactive
Realm [example.com]:  ADOSAKANA.LOCAL
Domain [ADOSAKANA]:
Server Role (dc, member, standalone) [dc]:
DNS backend (SAMBA_INTERNAL, BIND9_FLATFILE, BIND9_DLZ, NONE) [SAMBA_INTERNAL]: 
DNS forwarder IP address (write 'none' to disable forwarding) [172.30.50.100]:  172.30.50.100
Administrator password:
Retype password:
Looking up IPv4 addresses
Looking up IPv6 addresses
No IPv6 address will be assigned
Setting up share.ldb
Setting up secrets.ldb
Setting up the registry
Setting up the privileges database
Setting up idmap db
Setting up SAM db
Setting up sam.ldb partitions and settings
Setting up sam.ldb rootDSE
Pre-loading the Samba 4 and AD schema
Unable to determine the DomainSID, can not enforce uniqueness constraint on local domainSIDs

Adding DomainDN: DC=adosakana,DC=local
Adding configuration container
Setting up sam.ldb schema
Setting up sam.ldb configuration data
Setting up display specifiers
Modifying display specifiers and extended rights
Adding users container
Modifying users container
Adding computers container
Modifying computers container
Setting up sam.ldb data
Setting up well known security principals
Setting up sam.ldb users and groups
Setting up self join
Adding DNS accounts
Creating CN=MicrosoftDNS,CN=System,DC=adosakana,DC=local
Creating DomainDnsZones and ForestDnsZones partitions
Populating DomainDnsZones and ForestDnsZones partitions
Setting up sam.ldb rootDSE marking as synchronized
Fixing provision GUIDs
A Kerberos configuration suitable for Samba AD has been generated at /usr/local/samba/private/krb5.conf
Merge the contents of this file with your system krb5.conf or replace it with this one. Do not create a symlink!
Setting up fake yp server settings
Once the above files are installed, your Samba AD server will be ready to use
Server Role:           active directory domain controller
Hostname:              wk70
NetBIOS Domain:        ADOSAKANA
DNS Domain:            adosakana.local
DOMAIN SID:            S-1-5-21-3471449246-245784766-327389652
[root@adserver samba-4.9.4]#

10. sambaを起動

sambaが起動していないことを確認した上で、sambaを起動します。

[root@adserver samba-4.9.4]# ps -ef|grep samba
root      45678  17315  0 14:16 pts/0    00:00:00 grep --color=auto samba
[root@adserver samba-4.9.4]# /usr/local/samba/sbin/samba
[root@adserver samba-4.9.4]# ps -ef|grep samba
root      45684      1 18 14:16 ?        00:00:00 /usr/local/samba/sbin/samba
root      45686  45684  0 14:16 ?        00:00:00 /usr/local/samba/sbin/samba
root      45687  45684  0 14:16 ?        00:00:00 /usr/local/samba/sbin/samba
root      45688  45684  0 14:16 ?        00:00:00 /usr/local/samba/sbin/samba
root      45689  45684  0 14:16 ?        00:00:00 /usr/local/samba/sbin/samba
root      45690  45684 36 14:16 ?        00:00:01 /usr/local/samba/sbin/samba
root      45691  45684  0 14:16 ?        00:00:00 /usr/local/samba/sbin/samba
root      45692  45684  0 14:16 ?        00:00:00 /usr/local/samba/sbin/samba
root      45693  45684  0 14:16 ?        00:00:00 /usr/local/samba/sbin/samba
root      45694  45686  0 14:16 ?        00:00:00 /usr/local/samba/sbin/samba
root      45695  45684  0 14:16 ?        00:00:00 /usr/local/samba/sbin/samba
root      45696  45684  0 14:16 ?        00:00:00 /usr/local/samba/sbin/samba
root      45697  45684  0 14:16 ?        00:00:00 /usr/local/samba/sbin/samba
root      45698  45684  0 14:16 ?        00:00:00 /usr/local/samba/sbin/samba
root      45699  45684  0 14:16 ?        00:00:00 /usr/local/samba/sbin/samba
root      45700  45694  9 14:16 ?        00:00:00 /usr/local/samba/sbin/smbd -D --option=server role check:inhibit=yes --foreground
root      45701  45695  0 14:16 ?        00:00:00 /usr/local/samba/sbin/samba
root      45702  45701  9 14:16 ?        00:00:00 /usr/local/samba/sbin/winbindd -D --option=server role check:inhibit=yes --foreground
root      45705  45698  0 14:16 ?        00:00:00 /usr/local/samba/sbin/samba
root      45706  45705 22 14:16 ?        00:00:00 python /usr/local/samba/sbin/samba_dnsupdate
root      45716  45700  0 14:16 ?        00:00:00 /usr/local/samba/sbin/smbd -D --option=server role check:inhibit=yes --foreground
root      45717  45700  0 14:16 ?        00:00:00 /usr/local/samba/sbin/smbd -D --option=server role check:inhibit=yes --foreground
root      45718  45702  1 14:16 ?        00:00:00 /usr/local/samba/sbin/winbindd -D --option=server role check:inhibit=yes --foreground
root      45719  45702  2 14:16 ?        00:00:00 /usr/local/samba/sbin/winbindd -D --option=server role check:inhibit=yes --foreground
root      45721  45702  0 14:16 ?        00:00:00 /usr/local/samba/sbin/winbindd -D --option=server role check:inhibit=yes --foreground
root      45722  45700  0 14:16 ?        00:00:00 /usr/local/samba/sbin/smbd -D --option=server role check:inhibit=yes --foreground
root      45724  17315  0 14:16 pts/0    00:00:00 grep --color=auto samba
[root@adserver samba-4.9.4]#

11. 動作確認

CentOS内部からSMB接続を行うテストを実施。

[root@adserver samba-4.9.4]# /usr/local/samba/bin/smbclient --version
Version 4.9.4
[root@adserver samba-4.9.4]# /usr/local/samba/bin/smbclient -L localhost -U%

        Sharename       Type      Comment
        ---------       ----      -------
        netlogon        Disk
        sysvol          Disk
        IPC$            IPC       IPC Service (Samba 4.9.4)
Reconnecting with SMB1 for workgroup listing.

        Server               Comment
        ---------            -------

        Workgroup            Master
        ---------            -------
[root@adserver samba-4.9.4]#

以前は「Domain=[ADOSAKANA.LOCAL] OS=[Unix] Server=[Samba x.y.z]」という出力もあったのですが、Samba 4.7以降では無くなっています。

netlogon共有にAdministrator権限でアクセスできるか確認。

[root@adserver samba-4.9.4]# /usr/local/samba/bin/smbclient //localhost/netlogon -UAdministrator -c 'ls'
Enter ADOSAKANA\Administrator's password:
  .                                   D        0  Fri Dec 28 14:13:09 2018
  ..                                  D        0  Fri Dec 28 14:13:15 2018

                36936068 blocks of size 1024. 33797580 blocks available
[root@adserver samba-4.9.4]#

12. AD DNSの動作テスト

AD DNSが想定通りに動作しているかテストします。

まず、どんなzoneが登録されているのか確認します。

[root@adserver samba-4.9.4]# /usr/local/samba/bin/samba-tool dns zonelist 127.0.0.1 -U Administrator
Password for [ADOSAKANA\Administrator]:
  2 zone(s) found

  pszZoneName                 : adosakana.local
  Flags                       : DNS_RPC_ZONE_DSINTEGRATED DNS_RPC_ZONE_UPDATE_SECURE
  ZoneType                    : DNS_ZONE_TYPE_PRIMARY
  Version                     : 50
  dwDpFlags                   : DNS_DP_AUTOCREATED DNS_DP_DOMAIN_DEFAULT DNS_DP_ENLISTED
  pszDpFqdn                   : DomainDnsZones.adosakana.local

  pszZoneName                 : _msdcs.adosakana.local
  Flags                       : DNS_RPC_ZONE_DSINTEGRATED DNS_RPC_ZONE_UPDATE_SECURE
  ZoneType                    : DNS_ZONE_TYPE_PRIMARY
  Version                     : 50
  dwDpFlags                   : DNS_DP_AUTOCREATED DNS_DP_FOREST_DEFAULT DNS_DP_ENLISTED
  pszDpFqdn                   : ForestDnsZones.adosakana.local
[root@adserver samba-4.9.4]#

Active Directoryで使用するDNSのSRVレコードが登録されているかをhostコマンドを使って確認します。

[root@adserver samba-4.9.4]# host -t SRV _ldap._tcp.adosakana.local 127.0.0.1
Using domain server:
Name: 127.0.0.1
Address: 127.0.0.1#53
Aliases:

_ldap._tcp.adosakana.local has SRV record 0 100 389 adserver.adosakana.local.
[root@adserver samba-4.9.4]# host -t SRV _kerberos._udp.adosakana.local 127.0.0.1
Using domain server:
Name: 127.0.0.1
Address: 127.0.0.1#53
Aliases:

_kerberos._udp.adosakana.local has SRV record 0 100 88 adserver.adosakana.local.
[root@adserver samba-4.9.4]#

ADサーバのホスト名が登録されているか確認します。

[root@adserver samba-4.9.4]# host -t A adserver.adosakana.local 127.0.0.1
Using domain server:
Name: 127.0.0.1
Address: 127.0.0.1#53
Aliases:

adserver.adosakana.local has address 172.17.15.70
[root@adserver samba-4.9.4]#

13. DNSサーバの変更

ADサーバの/etc/resolv.confを、ADサーバ自身を使う様に書き換えます。

14. /etc/krb5.conf の変更

/usr/local/samba/private/krb5.conf に元となるものが自動生成されているので、それを使用する。

[root@adserver samba-4.9.4]# ls -l /etc/krb5.conf /usr/local/samba/private/krb5.conf
-rw-r--r--. 1 root root 641 10月 30 23:40 /etc/krb5.conf
-rw-rw-rw-. 1 root root  96 12月 28 14:13 /usr/local/samba/private/krb5.conf
[root@adserver samba-4.9.4]# cat /usr/local/samba/private/krb5.conf
[libdefaults]
        default_realm = ADOSAKANA.LOCAL
        dns_lookup_realm = false
        dns_lookup_kdc = true
[root@adserver samba-4.9.4]# cp /usr/local/samba/private/krb5.conf /etc/krb5.conf
cp: `/etc/krb5.conf' を上書きしますか? y
[root@adserver samba-4.9.4]#

15. Kerberosの動作確認

「kinit administrator@ドメイン名」を実行して確認します。

[root@adserver samba-4.9.4]# kinit administrator@ADOSAKANA.LOCAL
Password for administrator@ADOSAKANA.LOCAL:
Warning: Your password will expire in 41 days on 2019年02月08日 14時13分15秒
[root@adserver samba-4.9.4]#

正常に設定されていれば、上記の様にAdministratorユーザのパスワード有効期限が表示されます。

「klist」コマンドでも確認することが出来ます。

[root@adserver samba-4.9.4]# klist
Ticket cache: FILE:/tmp/krb5cc_0
Default principal: administrator@ADOSAKANA.LOCAL

Valid starting       Expires              Service principal
2018-12-28T14:26:25  2018-12-29T00:26:25  krbtgt/ADOSAKANA.LOCAL@ADOSAKANA.LOCAL
        renew until 2018-12-29T14:26:22
[root@adserver samba-4.9.4]#

なお、ドメイン名指定の大文字/小文字を間違えると下記の様なエラーとなります。

[root@adserver ~]# kinit administrator@adosakana.local
Password for administrator@adosakana.local:
kinit: KDC reply did not match expectations while getting initial credentials
[root@adserver ~]#

DNSサーバ指定が誤っている場合は下記の様なエラーです。

[root@adserver ~]# kinit administrator@ADOSAKANA.LOCAL
kinit: Cannot resolve servers for KDC in realm "ADOSAKANA.LOCAL" while getting initial credentials
[root@adserver ~]#

16. フォレストとドメインの機能レベル確認

作成したActive Directoryのドメインの機能レベルとフォレストの機能レベルを確認します。

[root@adserver samba-4.9.4]# /usr/local/samba/bin/samba-tool domain level show
Domain and forest function level for domain 'DC=adosakana,DC=local'

Forest function level: (Windows) 2008 R2
Domain function level: (Windows) 2008 R2
Lowest function level of a DC: (Windows) 2008 R2
[root@adserver samba-4.9.4]#

Samba 4.9.4でもWindows Server 2008R2が標準設定となっています。

17. firewalldの設定

CentOS7ではfirewalldによりポートが制限されています。
現状を「firewall-cmd –list-all」で確認します。

[root@adserver samba-4.9.4]# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: ens160
  sources:
  services: ssh dhcpv6-client
  ports:
  protocols:
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:
[root@adserver samba-4.9.4]#

開けるべきポートのテンプレートがあらかじめ用意されているので「firewall-cmd –get-services」を実行して確認します 。

[root@adserver samba-4.9.4]# firewall-cmd --get-services
RH-Satellite-6 amanda-client amanda-k5-client bacula bacula-client bgp bitcoin bitcoin-rpc bitcoin-testnet bitcoin-testnet-rpc ceph ceph-mon cfengine condor-collector ctdb dhcp dhcpv6 dhcpv6-client dns docker-registry docker-swarm dropbox-lansync elasticsearch freeipa-ldap freeipa-ldaps freeipa-replication freeipa-trust ftp ganglia-client ganglia-master git gre high-availability http https imap imaps ipp ipp-client ipsec irc ircs iscsi-target jenkins kadmin kerberos kibana klogin kpasswd kprop kshell ldap ldaps libvirt libvirt-tls managesieve mdns minidlna mongodb mosh mountd ms-wbt mssql murmur mysql nfs nfs3 nmea-0183 nrpe ntp openvpn ovirt-imageio ovirt-storageconsole ovirt-vmconsole pmcd pmproxy pmwebapi pmwebapis pop3 pop3s postgresql privoxy proxy-dhcp ptp pulseaudio puppetmaster quassel radius redis rpc-bind rsh rsyncd samba samba-client sane sip sips smtp smtp-submission smtps snmp snmptrap spideroak-lansync squid ssh syncthing syncthing-gui synergy syslog syslog-tls telnet tftp tftp-client tinc tor-socks transmission-client upnp-client vdsm vnc-server wbem-https xmpp-bosh xmpp-client xmpp-local xmpp-server zabbix-agent zabbix-server
[root@adserver samba-4.9.4]#
サービス ポート プロトコル firewalld定義
DNS 53 tcp/udp dns
Kerberos 88 tcp/udp kerberos,freeipa-ldap,freeipa-ldaps
End Point Mapper (DCE/RPC Locator Service) 135 tcp freeipa-trust
NetBIOS Name Service 137 udp samba,samba-client
NetBIOS Datagram 138 udp samba,samba-client,freeipa-trust
NetBIOS Session 139 tcp samba,freeipa-trust
LDAP 389 tcp/udp freeipa-trust(ldap,freeipa-ldapはtcpのみ)
SMB over TCP 445 tcp samba,freeipa-trust(freeipa-trustはudpも含む)
Kerberos kpasswd 464 tcp/udp kpasswd,freeipa-ldap,freeipa-ldaps
LDAPS 636 tcp ldaps,freeipa-ldaps
Dynamic RPC Ports(4.7以前) 1024-1300 tcp freeipa-trust
Dynamic RPC Ports(samba 4.7以降) 49152-65535 tcp ?
Global Catalog 3268 tcp freeipa-trust
Global Catalog SSL 3269 tcp なし

・firewalldの定義「samba」「dns」「freeipa-ldaps」「freeipa-trust」を使用
・「Dynamic RPC Ports(samba 4.7以降):49152-65535」を追加するか、smb.confで「rpc server port」を定義するか。
・「Global Catalog SSL:3269」を追加

[root@adserver samba-4.9.4]# firewall-cmd --permanent --zone=public --add-service=samba
success
[root@adserver samba-4.9.4]# firewall-cmd --permanent --zone=public --add-service=dns
success
[root@adserver samba-4.9.4]# firewall-cmd --permanent --zone=public --add-service=freeipa-ldaps
success
[root@adserver samba-4.9.4]# firewall-cmd --permanent --zone=public --add-service=freeipa-trust
success
[root@adserver samba-4.9.4]# firewall-cmd --reload
success
[root@adserver samba-4.9.4]# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: eth0
  sources:
  services: ssh dhcpv6-client samba dns freeipa-ldaps freeipa-trust
  ports:
  protocols:
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:

[root@adserver samba-4.9.4]#
[root@adserver samba-4.9.4]# firewall-cmd --permanent --zone=public --add-port=49152-65535/tcp
success
[root@adserver samba-4.9.4]# firewall-cmd --permanent --zone=public --add-port=3269/tcp
success
[root@adserver samba-4.9.4]# firewall-cmd --reload
success
[root@adserver samba-4.9.4]# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: eth0
  sources:
  services: ssh dhcpv6-client samba dns freeipa-ldaps freeipa-trust
  ports: 49152-65535/tcp 3269/tcp
  protocols:
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:

[root@adserver samba-4.9.4]#

18. systemdへの登録

systemdへの登録については「Managing the Samba AD DC Service Using Systemd」を参照のこと
CentOS6の場合は「Managing the Samba AD DC Service Using an Init Script

以上で設定は終了です。