====== OpenSearch のインストールと設定 ====== {{indexmenu_n>38}} **Online installation and requirements** (recommended method) **are specified in the topic** "Pandora FMS Installation" in [[:en:documentation:pandorafms:installation:01_installing#ks3|its corresponding section]]. **オンラインインストールと要件**(推奨方法)については、[[:ja:documentation:pandorafms:installation:01_installing#ks3|該当するセクション]]の「Pandora FMS のインストール」に記載されています。 To configure Pandora FMS with OpenSearch see "[[:en:documentation:pandorafms:monitoring:09_log_monitoring|Log collection and monitoring]]" and "[[:en:documentation:pandorafms:cybersecurity:21_siem|SIEM monitoring]]". OpenSearch を使用した Pandora FMS 設定は、「[[:ja:documentation:pandorafms:monitoring:09_log_monitoring#ks4|ログの収集と監視]]」および 「[[:ja:documentation:pandorafms:cybersecurity:21_siem|SIEM 監視]]」 を参照してください。 ===== 手動インストールと高度な OpenSearch 設定 ===== **Before running OpenSearch**, memory paging and swap must be disabled on the host to improve performance and increase the number of memory maps available for OpenSearch. See "Important settings" for more information: **OpenSearch を実行する前に**、パフォーマンスを向上させ、OpenSearch で使用できるメモリマップの数を増やすために、ホスト上のメモリページングとスワップを無効にする必要があります。 詳細については、「重要な設定」を参照してください。 [[https://opensearch.org/docs/latest/install-and-configure/install-opensearch/index/#important-settings|https://opensearch.org/docs/latest/install-and-configure/install-opensearch/index/#important-settings]] # Disable memory paging and swapping. sudo swapoff -a # Edit the sysctl config file that defines the host's max map count. sudo vi /etc/sysctl.conf # Set max map count to the recommended value of 262144. vm.max_map_count=262144 # Reload the kernel parameters. sudo sysctl -p For Rocky Linux 8, installation [[https://opensearch.org/docs/latest/install-and-configure/install-opensearch/rpm/|via RPM package]] is recommended. Once OpenSearch is installed, access to OpenSearch must be checked from Pandora FMS. Before performing this test, each [[#ks3|node]] or [[#ks4|cluster]] must be configured. To check the installation, run: Rocky Linux 8 の場合、[[https://opensearch.org/docs/latest/install-and-configure/install-opensearch/rpm/|RPM パッケージによるインストール]] が推奨されます。OpenSearch がインストールされたら、Pandora FMS から OpenSearch へのアクセスを確認する必要があります。このテストを実行する前に、[[#ks3|ノード]] または [[#ks4|クラスター]] を設定してください。このインストール チェックでは、次を実行します。 curl -X GET https://: -u 'admin:admin' --insecure You should get a response similar to: 次のような応答が返されます。 { "name" : "hostname", "cluster_name" : "opensearch", "cluster_uuid" : "6XNc9m2gTUSIoKDqJit0PA", "version" : { "distribution" : "opensearch", "number" : , "build_type" : , "build_hash" : , "build_date" : , "build_snapshot" : false, "lucene_version" : , "minimum_wire_compatibility_version" : "7.10.0", "minimum_index_compatibility_version" : "7.0.0" }, "tagline" : "The OpenSearch Project: https://opensearch.org/" } By default, the OpenSearch installation enables SSL, username and password which is a good practice; It is recommended to [[#ks6|change the default username and password]]. デフォルトの OpenSearch のインストールでは SSL、ユーザ名、パスワードが有効になっており、これが推奨事項です。 [[#ks6|デフォルトのユーザ名とパスワードを変更する]]ことをお勧めします。 ===== ノード設定 ===== First, the configuration file ''/etc/opensearch/opensearch.yml'' must be edited, **and then the OpenSearch service will be restarted**. まず設定ファイル ''/etc/opensearch/opensearch.yml'' を編集します。**その後、OpenSearch サービスを再起動します**。 This file contains the configuration for all OpenSearch service parameters; see the official documentation for more information: このファイルには、OpenSearch サービスのすべてのパラメータ設定が含まれています。 詳細については、公式ドキュメントを参照してください。 [[https://opensearch.org/docs/latest/install-and-configure/configuration/|https://opensearch.org/docs/latest/install-and-configure/configuration/]] Minimum configurations necessary to start the service and its use with Pandora FMS. サービスを開始して Pandora FMS で使用するために必要な最低限の設定。 * Port number. * ポート番号 # ---------------------------------- Network # Set the bind address to a specific IP (IPv4 or IPv6): network.host: 0.0.0.0 # Set a custom port for HTTP: http.port: 9200 # For more information, consult the network module documentation. * Location of stored data and logs: * データおよびログの保存場所 # ----------------------------------- Paths # Path to directory where to store the data (separate multiple locations by comma): path.data: /var/lib/opensearch # Path to log files: path.logs: /var/log/opensearch It will also be necessary to uncomment and define the following lines: 次の行のコメントを外して定義することも必要になります。 cluster.name: pandorafms node.name: ${HOSTNAME} network.host: 0.0.0.0 * ''cluster.name'': This will be the name that the group or cluster will receive. * ''node.name'': To name the node using the ''${HOSTNAME}'' system variable, it will automatically take the name of the host. * For ''network.host'' the value ''0.0.0.0'' allows OpenSearch to “listen” on all network interfaces (NIC); To use a specific NIC, enter a corresponding specific value. * ''cluster.name'': これは、グループまたはクラスタの名前になります。 * ''node.name'': ''${HOSTNAME}'' システム変数を使用してノードに名前を付けると、ホストの名前が自動的に取得されます。 * ''network.host'' の値 ''0.0.0.0'' により、OpenSearch はすべてのネットワークインターフェイス (NIC) で待ち受けできます。 特定の NIC を使用するには、対応する特定の値を入力します。 If you work with a single node, add the line to the configuration file to allow the single node to start: 単一ノードを使用する場合は、設定ファイルに次の行を追加して、単一ノードが起動できるようにします。 discovery.type: single-node In case of working with a cluster you need to complete the ''discovery.seed_hosts'' parameter: クラスターを使用する場合は、''discovery.seed_hosts'' パラメータを設定する必要があります。 discover.seed_hosts : ["ip:port", "ip", "ip"] In the most recent versions of OpenSearch, memory management of the Java® virtual machine is done automatically and it is recommended to let it be managed this way in production environments, so it is unnecessary to modify the JVM values. OpenSearch の最新バージョンでは、Java® 仮想マシンのメモリ管理は自動的に行われ、実稼働環境ではこの方法で管理することをお勧めします。そのため、JVM 値を変更する必要はありません。 To start OpenSearch, execute: OpenSearch を開始するには、次のように実行します。 systemctl start opensearch.service To restart use ''restart'', to stop ''stop'' and ''status'' to check the status. 再起動には ''restart''、停止には ''stop''、状態を確認するには ''status'' を使用します。 If the service does not start, check the logs located at ''/var/log/opensearch/'' (in this case the file ''pandorafms.log'' or the name given to the node). サービスが開始しない場合は、''/var/log/opensearch/'' にあるログ (この場合はファイル ''pandorafms.log'' またはノードに指定された名前) を確認してください。 Remember that to check the installation and operation of OpenSearch you may run: OpenSearch のインストールと動作の確認は、次のコマンドで行なえます。 curl -X GET https:// -u 'admin:admin' --insecure ===== OpenSearch クラスタのセットアップ ===== For OpenSearch cluster configuration, it is recommended to follow the official documentation: OpenSearch クラスターの設定については、公式ドキュメントに従うことをお勧めします。 https://opensearch.org/blog/optimize-opensearch-index-shard-size/ A [[:en:documentation:pandorafms:technical_annexes:47_pfms_opensearch_cluster|configuration guide for Pandora FMS]] is also provided. [[:ja:documentation:pandorafms:technical_annexes:47_pfms_opensearch_cluster|Pandora FMS の設定ガイド]] も提供しています。 ===== OpenSearch ユーザ管理 ===== To change the default password from ''admin'', a series of steps must be followed. The first thing is to export the variable to use the Java® JDK installed by OpenSearch to use any of the tools: デフォルトのパスワードを ''admin'' から変更するには、一連の手順に従う必要があります。 まず、OpenSearch によってインストールされた Java® JDK を使用していずれかのツールを使用できるように変数をエクスポートします。 export OPENSEARCH_JAVA_HOME=/usr/share/opensearch/jdk Then, to generate the hashed password to place in the OpenSearch configuration file, the following script is used (replace ''< password >'' with the password to use): 次に、ハッシュ化されたパスワードを生成して OpenSearch 設定ファイルに配置するために、次のスクリプトを使用します (''< password >'' を使用するパスワードに置き換えます)。 /usr/share/opensearch/plugins/opensearch-security/tools/hash.sh -p For example: 例: {{ :wiki:opensearch-hash_sh.png }} Then open the file ''/etc/opensearch/opensearch-security/internal_users.yml'' with the text editor **vim** or **nano** to modify the password of the required user or users. 次に、テキストエディタ **vim** または **nano** でファイル ''/etc/opensearch/opensearch-security/internal_users.yml'' を開き、必要なユーザのパスワードを変更します。 It is recommended to leave only the ''admin'' user for use with Pandora FMS, it is unnecessary to maintain any other user. Pandora FMS で使用するために ''admin'' ユーザのみを残すことをお勧めします。他のユーザを維持する必要はありません。 Example file: ファイル例: {{ :wiki:opensearch-internal_users_yml.png }} To make the changes effective, the following must be executed: 変更を有効にするには、以下を実行する必要があります。 cd /usr/share/opensearch/plugins/opensearch-security/tools OPENSEARCH_JAVA_HOME=/usr/share/opensearch/jdk ./securityadmin.sh -cd /etc/opensearch/opensearch-security/ -cacert /etc/opensearch/root-ca.pem -cert /etc/opensearch/kirk.pem -key /etc/opensearch/kirk-key.pem -icl -nhnv-t internalusers -icl -nhnv -cacert /etc/opensearch/root-ca.pem -cert /etc/opensearch/kirk.pem -key /etc/opensearch/ kirk-key.pem A final message ''Done with success'' should be displayed; to check the new password (following the previous example with ''pandora'' used): 最後のメッセージ ''Done with success'' が表示されます。 新しいパスワードを確認するには (''pandora'' を使用した前の例に従って) 次のようにします: {{ :wiki:opensearch-curl_ku.png }} For more information on user management in OpenSearch: OpenSearch でのユーザ管理の詳細については、以下を参照してください。 * [[https://opensearch.org/docs/latest/security/configuration/yaml/|https://opensearch.org/docs/latest/security/configuration/yaml/]] * [[https://opensearch.org/docs/latest/security/access-control/users-roles/#create-users|https://opensearch.org/docs/latest/security/access-control/users-roles/#create-users]] ===== OpenSearch を使用する Pandora FMS 設定 ===== To configure Pandora FMS with OpenSearch see the topic "[[:en:documentation:pandorafms:monitoring:09_log_monitoring#ks3_1|Log collection and monitoring]]". OpenSearch を使用するように Pandora FMS を設定するには、"[[:ja:documentation:pandorafms:monitoring:09_log_monitoring#コンソールの設定|ログ収集と監視]]" を参照してください。 ==== データモデルとテンプレート ==== Before setting an environment into production, whether it is a single node or a data cluster, it is recommended to apply the corresponding configurations to this node or cluster based on its use. In the case of indexes generated by **Pandora FMS**, the most effective way to do so is by defining a template to define the configuration of the fields and the stored data. 本番環境に設定する前に、それが単一ノードであってもデータクラスタであっても、その用途に基づいてこのノードまたはクラスタに対応する設定を適用することをお勧めします。 **Pandora FMS** によって生成されたインデックスの場合、最も効果的な方法は、フィールドと保存されたデータの設定を定義するテンプレートを定義することです。 Templates are configurations that are only applied at the time of index creation. Changing a template will not have any impact on existing indexes. テンプレートは、インデックスの作成時にのみ適用される設定です。 テンプレートを変更しても、既存のインデックスには影響しません。 To create a **basic template**, you only need to define the following fields: **基本テンプレート**を作成するには、次のフィールドを定義するだけで済みます。 curl -X PUT -ku 'admin:admin' https://:9200/_index_template/pandorafms -H 'Content-Type: application/json' -d' { "index_patterns": [ "pandorafms*" ], "template": { "aliases": { "pandorafms_logs": {} }, "settings": { "number_of_shards": 1, "auto_expand_replicas" : "0-1", "number_of_replicas": "0" }, "mappings" : { "properties" : { "agent_id" : { "type" : "long" }, "group_id" : { "type" : "long" }, "group_name" : { "type" : "text" }, "logcontent" : { "type" : "text" }, "source_id" : { "type" : "text" }, "suid" : { "type" : "text" }, "type" : { "type" : "text" }, "utimestamp" : { "type" : "long" }, "@timestamp": { "type": "date" } } } } } ' Through [[:en:documentation:03_monitoring:09_log_monitoring#configuracion_de_la_consola|Pandora FMS (menu)]] interface you may upload said template: [[:ja:documentation:03_monitoring:09_log_monitoring|Pandora FMS (メニュー)]] インターフェイスを通じて、上記のテンプレートをアップロードできます。 * **PUT _template/**: in this example ''PUT _template/pandorafms'' . You can also check the templates through the same Pandora FMS interface: * **PUT _template/