15.10.4 SELinuxに関する設定(Linuxの場合)
Linux 8以降のSELinuxが有効な環境で,JP1/AJS3を動作させる手順について説明します。
この手順は,rootおよびroot以外のユーザーを制限のないSELinuxユーザーunconfined_uとして運用することが前提となります。unconfined_u以外のSELinuxユーザーで運用する場合は,ユーザー責任で対応してください。
Linux 8以降のSELinuxが有効な環境でJP1/AJS3を動作させるには,JP1/AJS3のインストール後に,OSのデフォルトラベルの再設定およびセキュリティコンテキストの設定を実施する必要があります。OSのデフォルトラベルを再設定する手順については,「12.2.6 Linuxの場合のインストール」を参照してください。
なお,セキュリティコンテキストの設定および解除には,semanage fcontextコマンドとrestoreconコマンドを使用します。
(1) JP1/AJS3 - Managerの設定
ここでは,Linux 8以降のSELinuxが有効な環境で,JP1/AJS3 - Managerを動作させる方法を説明します。
(a) JP1/AJS3 - Managerで必要な設定
SELinuxを有効化している場合は,JP1/AJS3 - Managerの実行ファイルのコンテキストタイプをbin_tに設定します。設定手順を次に示します。
-
次のコマンドを実行して,ファイルのコンテキストタイプをbin_tに設定する。
# find /etc/opt/jp1ajs2 -type f -perm /u=x -exec semanage fcontext -a -t bin_t '{}' \; # restorecon -FR /etc/opt/jp1ajs2 # semanage fcontext -a -t bin_t '/opt/jp1ajs2/tools/[^/]*' # semanage fcontext -a -t bin_t '/opt/jp1ajs2/tools/IMDDAdapter/IMDDAdapter_HITACHI_JP1_AJS3.sh' # semanage fcontext -a -t bin_t '/opt/jp1ajs2/tools/RHELDB/[^/]*' # semanage fcontext -a -t bin_t '/opt/jp1ajs2/tools/RHELDB/OLDPP/[^/]*' # semanage fcontext -a -t bin_t '/opt/jp1ajs2/tools/SLESDB/[^/]*' # restorecon -FR /opt/jp1ajs2/tools
(b) データベースの設定
SELinuxを有効化している場合は,データベースのインストール先ディレクトリ配下のファイルにセキュリティコンテキストを設定します。
■ 標準のデータベースを使用する場合の設定
データベースのインストール先ディレクトリ配下のファイルへの,セキュリティコンテキストの設定手順を次に示します。
-
次のコマンドを実行して,データベースのインストール先ディレクトリ配下のファイルにセキュリティコンテキストを設定する。
# semanage fcontext -a -t usr_t /opt/jp1ajs2/embdb/セットアップ識別子'(/.*)?' # semanage fcontext -a -t bin_t /opt/jp1ajs2/embdb/セットアップ識別子/bin'(/.*)?' # semanage fcontext -a -t lib_t /opt/jp1ajs2/embdb/セットアップ識別子/lib'(/.*)?' # semanage fcontext -a -t bin_t /opt/jp1ajs2/embdb/セットアップ識別子/lib/servers'(/.*)?' # semanage fcontext -a -t lib_t /opt/jp1ajs2/embdb/セットアップ識別子/client/lib'(/.*)?' # semanage fcontext -a -t bin_t /opt/jp1ajs2/embdb/セットアップ識別子/client/utl'(/.*)?' # restorecon -FR /opt/jp1ajs2/embdb/セットアップ識別子
■ 標準以外のデータベースを使用する場合の設定
データベースを標準以外のディレクトリにインストールした場合,インストール先ディレクトリ配下のファイルに対して,セキュリティコンテキストを設定します。設定手順を次に示します。
-
次のコマンドを実行して,データベースのインストール先ディレクトリ配下のファイルにセキュリティコンテキストを設定する。
# semanage fcontext -a -t usr_t インストール先ディレクトリ'(/.*)?' # semanage fcontext -a -t bin_t インストール先ディレクトリ/bin'(/.*)?' # semanage fcontext -a -t lib_t インストール先ディレクトリ/lib'(/.*)?' # semanage fcontext -a -t bin_t インストール先ディレクトリ/lib/servers'(/.*)?' # semanage fcontext -a -t lib_t インストール先ディレクトリ/client/lib'(/.*)?' # semanage fcontext -a -t bin_t インストール先ディレクトリ/client/utl'(/.*)?' # restorecon -FR インストール先ディレクトリ
(c) メール連携機能を使用する場合の設定
SELinuxを有効化している場合,専用のコンテキストタイプを追加するポリシーを作成し,jpomailrecvに設定します。設定例を次に示します。
■ sendmailを使用する場合
-
次の内容をviなどのエディターで作成し,jp1ajs_unconfined.teとして保存する。
module jp1ajs_unconfined 1.0; require { type sendmail_t ; type unconfined_t ; attribute entry_type, exec_type, file_type ; class process transition ; class file { getattr open read execute entrypoint } ; } type jp1ajs_unconfined_exec_t ; typeattribute jp1ajs_unconfined_exec_t entry_type, exec_type, file_type ; allow sendmail_t unconfined_t:process transition ; allow sendmail_t jp1ajs_unconfined_exec_t:file { getattr open read execute }; allow unconfined_t jp1ajs_unconfined_exec_t:file entrypoint ; type_transition sendmail_t jp1ajs_unconfined_exec_t:process unconfined_t ; -
次のコマンドを実行する。
# checkmodule -M -m -o jp1ajs_unconfined.mod jp1ajs_unconfined.te # semodule_package -o jp1ajs_unconfined.pp -m jp1ajs_unconfined.mod # semodule -i jp1ajs_unconfined.pp # semanage fcontext -a -t jp1ajs_unconfined_exec_t /opt/jp1ajs2/bin/jpomailrecv # restorecon -F /opt/jp1ajs2/bin/jpomailrecv
■ Postfixを使用する場合
-
次の内容をviなどのエディターで作成し,jp1ajs_unconfined.teとして保存する。
module jp1ajs_unconfined 1.0; require { type postfix_local_t ; type unconfined_t ; attribute entry_type, exec_type, file_type ; class process transition ; class file { getattr open read execute entrypoint } ; } type jp1ajs_unconfined_exec_t ; typeattribute jp1ajs_unconfined_exec_t entry_type, exec_type, file_type ; allow postfix_local_t unconfined_t:process transition ; allow postfix_local_t jp1ajs_unconfined_exec_t:file { getattr open read execute }; allow unconfined_t jp1ajs_unconfined_exec_t:file entrypoint ; type_transition postfix_local_t jp1ajs_unconfined_exec_t:process unconfined_t ; -
次のコマンドを実行する。
# checkmodule -M -m -o jp1ajs_unconfined.mod jp1ajs_unconfined.te # semodule_package -o jp1ajs_unconfined.pp -m jp1ajs_unconfined.mod # semodule -i jp1ajs_unconfined.pp # semanage fcontext -a -t jp1ajs_unconfined_exec_t /opt/jp1ajs2/bin/jpomailrecv # restorecon -F /opt/jp1ajs2/bin/jpomailrecv
(2) JP1/AJS3 - Agentの設定
ここでは,Linux 8以降のSELinuxが有効な環境で,JP1/AJS3 - Agentを動作させる方法を説明します。
(a) JP1/AJS3 - Agentで必要な設定
SELinuxを有効化している場合は,JP1/AJS3 - Agentの実行ファイルのコンテキストタイプをbin_tに設定します。
設定手順を次に示します。
-
次のコマンドを実行して,ファイルのコンテキストタイプをbin_tに設定する。
# find /etc/opt/jp1ajs2 -type f -perm /u=x -exec semanage fcontext -a -t bin_t '{}' \; # restorecon -FR /etc/opt/jp1ajs2 # semanage fcontext -a -t bin_t '/opt/jp1ajs2/tools/[^/]*' # semanage fcontext -a -t usr_t /opt/jp1ajs2/tools/embsch # restorecon -FR /opt/jp1ajs2/tools
(b) メール連携機能を使用する場合の設定
SELinuxを有効化している場合,専用のコンテキストタイプを追加するポリシーを作成し,jpomailrecvに設定します。設定例を次に示します。
■ sendmailを使用する場合
-
次の内容をviなどのエディターで作成し,jp1ajs_unconfined.teとして保存する。
module jp1ajs_unconfined1.0; require { type sendmail_t ; type unconfined_t ; attribute entry_type, exec_type, file_type ; class process transition ; class file { getattr open read execute entrypoint } ; } type jp1ajs_unconfined_exec_t ; typeattribute jp1ajs_unconfined_exec_t entry_type, exec_type, file_type ; allow sendmail_t unconfined_t:process transition ; allow sendmail_t jp1ajs_unconfined_exec_t:file { getattr open read execute }; allow unconfined_t jp1ajs_unconfined_exec_t:file entrypoint ; type_transition sendmail_t jp1ajs_unconfined_exec_t:process unconfined_t ; -
次のコマンドを実行する。
# checkmodule -M -m -o jp1ajs_unconfined.mod jp1ajs_unconfined.te # semodule_package -o jp1ajs_unconfined.pp -m jp1ajs_unconfined.mod # semodule -i jp1ajs_unconfined.pp # semanage fcontext -a -t jp1ajs_unconfined_exec_t /opt/jp1ajs2/bin/jpomailrecv # restorecon -F /opt/jp1ajs2/bin/jpomailrecv
■ Postfixを使用する場合
-
次の内容をviなどのエディターで作成し,jp1ajs_unconfined.teとして保存する。
module jp1ajs_unconfined 1.0; require { type postfix_local_t ; type unconfined_t ; attribute entry_type, exec_type, file_type ; class process transition ; class file { getattr open read execute entrypoint } ; } type jp1ajs_unconfined_exec_t ; typeattribute jp1ajs_unconfined_exec_t entry_type, exec_type, file_type ; allow postfix_local_t unconfined_t:process transition ; allow postfix_local_t jp1ajs_unconfined_exec_t:file { getattr open read execute }; allow unconfined_t jp1ajs_unconfined_exec_t:file entrypoint ; type_transition postfix_local_t jp1ajs_unconfined_exec_t:process unconfined_t ; -
次のコマンドを実行する。
# checkmodule -M -m -o jp1ajs_unconfined.mod jp1ajs_unconfined.te # semodule_package -o jp1ajs_unconfined.pp -m jp1ajs_unconfined.mod # semodule -i jp1ajs_unconfined.pp # semanage fcontext -a -t jp1ajs_unconfined_exec_t /opt/jp1ajs2/bin/jpomailrecv # restorecon -F /opt/jp1ajs2/bin/jpomailrecv
(3) JP1/AJS3 - Web Consoleの設定
SELinuxを有効化している場合は,JP1/AJS3 HTTP Serverサービス,JP1/AJS3 Web Application Serverサービス(JP1/AJS3 - Web Console)の起動および停止を実行するファイルのコンテキストタイプをbin_tに設定します。設定手順を次に示します。
-
次のコマンドを実行する。
# semanage fcontext -a -t bin_t '/etc/opt/jp1ajs3web/jajs_web' # semanage fcontext -a -t bin_t '/etc/opt/jp1ajs3web/jajs_web_stop' # restorecon -F /etc/opt/jp1ajs3web/jajs_web # restorecon -F /etc/opt/jp1ajs3web/jajs_web_stop # semanage fcontext -a -t bin_t '/etc/rc.d/init.d/jp1ajs3web' # restorecon -F /etc/rc.d/init.d/jp1ajs3web
-
同一ホスト内にJP1/Baseをインストールしていない場合は,次のコマンドを実行する。
# semanage fcontext -a -t usr_t '/opt/hitachi/HNTRLib2/etc(/.*)?' # restorecon -R -F /opt/hitachi/HNTRLib2/etc