文書の表示以前のリビジョンバックリンク文書の先頭へ この文書は読取専用です。文書のソースを閲覧することは可能ですが、変更はできません。もし変更したい場合は管理者に連絡してください。 ====== SSH および FTP でのデータ転送設定 ====== {{indexmenu_n>1}} [[ja:documentation:start|Pandora FMS ドキュメント一覧に戻る]] <wrap #ks1 /> ===== 概要 ===== The standard transfer method in Pandora FMS to transmit files, [[:en:documentation:pandorafms:technical_reference:09_tentacle|Tentacle]], needs the Perl programming language installed. Some devices, such as ESX (UNIX) systems, lack this tool. When this happens, the alternatives are to use FTP or SSH to transfer monitoring data. Pandora FMS でファイルを転送するための標準の転送方法である [[ja:documentation:pandorafms:technical_reference:09_tentacle|Tentacle]] では、Perl プログラミング言語がインストールされている必要があります。ESX (UNIX) システムなどの一部のデバイスにはこのツールがありません。その場合は、監視データを転送するために FTP または SSH を使用するという代替手段があります。 Pandora FMS can use the FTP or SSH protocol to copy the XML data packets generated by [[:en:documentation:pandorafms:introduction:03_glossary#software_agent|software agents]] to PFMS server. Pandora FMS は、SSH プロトコルを使用して、[[:ja:documentation:pandorafms:introduction:03_glossary#ソフトウエアエージェント|ソフトウエアエージェント]]によって生成された XML データパッケージをサーバにコピーできます。 <wrap #ks2 /> ===== Pandora FMS へのデータ取り込みのための SSH 設定 ===== <WRAP center round info 90%> Always take into account the [[:en:documentation:pandorafms:technical_annexes:15_security_architecture|Security Architecture]] of Pandora FMS. </WRAP> <WRAP center round info 90%> 常に、Pandora FMS の [[:ja:documentation:pandorafms:technical_annexes:15_security_architecture|]] に注意してください。 </WRAP> Consider Pandora FMS server as **Server** and each one of the devices running the [[:en:documentation:pandorafms:installation:01_installing#ks1_9_3|Software Agent]] as **Client**. At any time, it will be possible to check with which user it works by means of the **whoami** command. Pandora FMS サーバを **サーバ** と見なし、[[:ja:documentation:pandorafms:installation:01_installing#pandora_fms_ソフトウエアエージェントのオンラインインストール|ソフトウェアエージェント]]を実行している各デバイスを **クライアント** と見なします。 **whoami** コマンドを使用して、作業しているユーザをいつでも確認できます。 <wrap #ks2_1 /> ==== サーバでのユーザ作成 ==== A ''pandora'' user should be created in the machine where Pandora FMS server is running. This machine will receive the data through SSH. If a Pandora FMS server was already installed, surely this user is already created. Set a strong password for that user with the command: Pandora FMS サーバがインストールされているホストに ''pandora'' ユーザを作成します。このユーザーは SSH を介してデータを受信します。 Pandora FMS サーバがすでにインストールされている場合は、このユーザはすでに作成済です。 次のコマンドを使用して、このユーザに強力なパスワードを設定します。 <code bash> passwd pandora </code> <wrap #ks2_2 /> ==== サーバのユーザ設定 ==== In the server, you should create a directory called ''/home/pandora/.ssh'' with permissions ''750'' and user ''pandora:root''. サーバ内で、パーミッション ''750'' およびユーザ ''pandora:root'' で ''/home/pandora/.ssh'' ディレクトリを作成します。 <wrap #ks2_3 /> ==== クライアントでの鍵作成 ==== A pair of keys (private and public) has to be created in each machine that runs a Software Agent that will use SSH. To that end, run the following command **with the same user with which Pandora FMS Software Agent** is executed: SSH を使用する必要があるエージェントの各システムで、鍵のペア(秘密鍵と公開鍵)を作成します。 これを行うには、Pandora FMS エージェントの実行に使用されるユーザで次のコマンドを実行します。 <code bash> ssh-keygen </code> A series of questions will be displayed which you will have to answer by simply pressing the Enter key. Then a public and a private key will have been created for that user in the machine. Now it should be copied to the destination machine, which is the Pandora FMS server where you need to send the monitoring data. いくつかの質問が表示されます。Enter キーを押すだけで回答できます。 このユーザの公開/秘密鍵がシステムに作成されます。 次に、データの送信先である Pandora FMS サーバであるターゲットシステムにコピーします。 <wrap #ks2_3 /> ==== 公開鍵のサーバへのコピー ==== The public key that you just generated can be copied in two ways to Pandora FMS **Server**. 公開鍵を Pandora FMS サーバにコピーします。 作成された公開鍵をコピーするには、2つの方法があります。 <wrap #ks2_4_1 /> === 手動コピー === The public key file generated in the **Client** is: **クライアント** で生成された公開鍵は以下にあります。 <file> /home/<user>/.ssh/id_rsa.pub </file> Where ''<user>'' is the username that runs Pandora FMS Software Agent in the **Client**. If the key pair was generated as root user, it will be in: ここで、''<user>'' は、**クライアント** で Pandora FMS ソフトウエアエージェントを実行するユーザ名です。鍵のペアを root ユーザで生成した場合は、以下にあります。 <file> /root/.ssh/id_rsa.pub </file> This file will have a content similar to this one: このファイルには次のようなものが含まれます。 <file> ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzqyZwhAge5LvRgC8uSm3tWaFV9O6fHQek7PjxmbBUxTWfvNbbswbFsF0esD3COavziQAUl3rP8DC28vtdWHFRHq+RS8fmJbU/VpFpN597hGeLPCbDzr2WlMvctZwia7pP4tX9tJI7oyCvDxZ7ubUUi/bvY7tfgi7b1hJHYyWPa8ik3kGhPbcffbEX/PaWbZ6TM8aOxwcHSi/4mtjCdowRwdOJ4dQPkZp+aok3Wubm5dlZCNLOZJzd9+9haGtqNoAY/hkgSe2BKs+IcrOAf6A16yiOZE/GXuk2zsaQv1iL28rOxvJuY7S4/JUvAxySI7V6ySJSljg5iDesuWoRSRdGw== root@dragoon </file> This content must be added to the end of the ''authorized_keys'' file on the **Server**. Its path is: この内容を、**サーバ** の ''authorized_keys'' ファイルの最後に追加する必要があります。パスは次の通りです。 <file> /home/pandora/.ssh/authorized_keys </file> <WRAP center round info 90%> The ''authorized_keys'' file on the **Server** must belong (//ownership//) to the user ''pandora:root'' and must have ''600'' permissions. </WRAP> <WRAP center round info 90%> サーバの ''authorized_keys'' ファイルの所有者とグループは ''pandora:root'' で、パーミッションは ''600'' である必要があります。 </WRAP> <wrap #ks2_4_2 /> === 自動コピー === Use the following command at **Client**: **クライアント** にて次のコマンドを利用します。 <file> ssh-copy-id pandora@<Server-address> </file> Where ''<Server-address>'' is the IP address or **Server** URL. ここで、''<Server-address>'' は、**サーバ** の IP アドレスまたは URL です。 It will ask for the server's ''pandora'' user password ([[:en:documentation:07_technical_annexes:01_ssh_and_ftp_setup#user_creation_in_server|set in step 1]]) and, once confirmed, it will display a message similar to the following: ''pandora'' ユーザのパスワード([[:ja:documentation:07_technical_annexes:01_ssh_and_ftp_setup#サーバでのユーザ作成|ステップ 1 で設定]])を要求します。これが確認されると、次のようなメッセージが表示されます。 <file> Now try logging into the machine, with "ssh '<Server-address>'", and check in: .ssh/authorized_keys to make sure we haven't added extra keys that you weren't expecting. </file> Perform this test to verify the automatic connection to Pandora FMS **Server** with the user ''pandora'' from the **Client** (with the user that runs the Software Agent): **クライアント** (のソフトウエアエージェント実行ユーザ)から、Pandora FMS **サーバ** の ''pandora'' ユーザへ自動接続が可能であることを確認します。 <file> ssh pandora@<Server-address> </file> Once you are able to connect to the **Server** as described above, the Software Agent on the **Client** will be able to start sending monitoring data. 上記のように **サーバ** に接続できるようになると、**クライアント** のソフトウェアエージェントは監視データの送信を開始できるようになります。 <wrap #ks2_5 /> ==== クライアント設定 ==== Once the connection through SSH is verified, this will be the method used by the software agents to copy data to Pandora FMS Server directory. This directory is located at: SSH を介した接続を確認できたら、これがソフトウェアエージェントがデータを Pandora FMS サーバディレクトリにコピーするために使用される方法になります。 このディレクトリは次の場所にあります。 <file> /var/spool/pandora/data_in </file> Verify that the directory ''/var/spool/pandora/data_in'' exists and the user ''pandora'' has writing permissions, otherwise it will not work. また、''/var/spool/pandora/data_in'' ディレクトリが存在し、ユーザ ''pandora'' に書き込み権限があることを確認してください。そうでない場合は機能しません。 Finally, the [[:en:documentation:pandorafms:installation:05_configuration_agents#transfer_mode|software agent configuration]] in the **Client** is modified to specify that the copy method is SSH. This is modified in file ''/etc/pandora/pandora_agent.conf'', in the configuration token ''transfer_mode''. The software agent service must be restarted on each **Client** after this change. 最後に、クライアントの [[:ja:documentation:pandorafms:installation:05_configuration_agents#transfer_mode|ソフトウエアエージェント設定]]を変更して、コピー方法を tentacle ではなく ssh に設定します。 これは ''/etc/pandora/pandora_agent.conf'' ファイルの ''transfer_mode'' 設定トークンで行います。この変更後は、クライアントのソフトウエアエージェントサービスを再起動することを忘れないでください。 <wrap #ks2_6 /> ==== SSH サーバのセキュリティ強化 ==== Pandora FMS uses, among others, sftp/ssh2 (SCP) to copy data files from software agents to the server. Because of this, you will need at least one data server with an SSH2 server listening to the ''pandora'' user. This could be a significant risk in a network that needs to be strictly secured. OpenSSH2 is **very** secure, but in terms of computer security there is no such thing as absolutely secure, so steps must be taken to make it "more" secure. Pandora FMS は、特に sftp/ssh2(scp) を使用して、エージェントからサーバにデータファイルをコピーします。 このため、''pandora'' ユーザを待ち受ける SSH2 サーバを備えた少なくとも 1つのデータサーバが必要です。 これは、厳密にセキュリティ保護する必要があるネットワークにとって重大なリスクになる可能性があります。 Open SSH2 は **非常に** 安全ですが、コンピュータのセキュリティに関しては、絶対に安全なものはないため、"より安全" にするための対策を講じてください。 It is possible to prohibit SSH access for certain users, as well as to configure restrictions on FTP access. 特定のユーザに対して SSH アクセスを禁止したり、FTP アクセスの制限を設定したりすることも可能です。 To do this, the user ''pandora'' must be modified in the **Server**. This user must have a [[#ks2_1|strong password]]. His login //shell// will be changed to restrict SSH access to the user, and his ''home'' directory, to prevent their access to other folders: それを行うするには、**サーバ** の ''pandora'' ユーザの設定を変更します。 このユーザには[[#ks2_1|強力なパスワード]]が必要です。 他のフォルダーへのアクセスを回避するために、ログインシェルを変更しホームディレクトリを変更します。 <code bash> usermod -s /sbin/nologin -d /var/spool/pandora/data_in pandora </code> With these changes to the user ''pandora'' on the **Server**, when logging in via SSH you will not be able to run commands with it in an interactive terminal. **サーバ** の ''pandora'' ユーザに対するこの変更で、該当ユーザが SSH でログインした際にはターミナルでコマンドを実行できなくなります。 <WRAP center round tip 90%> * See the [[:en:documentation:pandorafms:installation:01_installing#ks1_3|recommended operating systems]] for Pandora FMS. * On Debian systems, the shell path is ''/usr/sbin/nologin''. </WRAP> <WRAP center round tip 90%> * Pandora FMS の [[:ja:documentation:pandorafms:installation:01_installing#最低ソフトウエア要件|推奨 OS]] を確認してください。 * Debian システムでは、シェルは ''/usr/sbin/nologin'' です。 </WRAP> <wrap #ks3 /> ===== FTP にてサーバがデータを受け取る設定 ===== The client configuration for sending data through FTP allows you to specify the user and password to be sent, making it fairly easy to implement FTP copying instead of [[:en:documentation:pandorafms:technical_reference:09_tentacle|Tentacle]]. FTP 経由でデータを送信するクライアント設定は、送信するユーザとパスワードの指定で可能です。[[:ja:documentation:pandorafms:technical_reference:09_tentacle|tentacle]] の代わりに FTP を介してコピーを実装するのは非常に簡単です。 Besides configuring the Pandora FMS software agents for sending data with FTP, **you will have to configure an FTP server where the Pandora FMS server executes**, [[#ks2_1|set a password for the user]] ''pandora'' and allow writing access to the user ''pandora'' to the directory ''/var/spool/pandora/data_in'' and its subdirectories. FTP でデータを送信するために Pandora FMS ソフトウェアエージェントを設定することに加えて、**Pandora FMS サーバを実行実行しているサーバに FTP サーバを設定し** 、[[#ks2_1|ユーザ ''pandora'' のパスワードを設定し]]、ユーザ ''pandora'' にディレクトリ ''/var/spool/pandora/data_in'' とそのサブディレクトリへの書き込みアクセスを許可する必要があります。 The FTP server must be configured to meet these needs; **vsftpd** is used in this guide. FTP サーバはこれらのニーズを満たすように設定する必要があります。このガイドでは **vsftpd** を使用します。 <wrap #ks3_1 /> ==== vsftpd のインストール ==== The disadvantage of using FTP instead of Tentacle is that sending data through FTP is less secure, because having an FTP running on Pandora FMS server makes it more vulnerable to inherent failures in the design of the FTP system. The following sections will show how to **configure in a minimal way the vsftpd server** (simply called **Server**). Tentacle の代わりに FTP を使用することの欠点は、FTP を介したデータ送信の安全性が低くなることです。これは、Pandora FMS サーバで FTP を実行すると、FTP システム固有の設計に起因して脆弱になるためです。次のセクションでは、**vsftpd サーバ** (単に **サーバ** と呼びます) を最小限の方法で設定する方法を説明します。 For that reason, and in the same way that [[#ks2_6|disabled for security]] SSH login for the ''pandora'' user, a secure access method must be established for FTP users. A secure and simple method for this is to create a PAM rule for **vsftpd**. To do this, create a file called ''/etc/pam.d/ftp'' containing the following: 安全上の理由で ''pandora'' ユーザの [[:ja:documentation:pandorafms:technical_annexes#ks2|SSH 経由のログインを無効にする]]のと同様に、FTP 経由の安全なアクセス方法を設定する必要があります。簡単で安全な方法は、**vsftpd** の PAM ルールを作成することです。 次の内容の ''/etc/pam.d/ftp'' ファイルを作成します。 <file /etc/pam.d/ftp> auth required pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed # Standard pam includes @include common-account @include common-session @include common-auth auth required pam_succeed_if.so quiet user ingroup pandora auth required pam_succeed_if.so quiet shell = /sbin/nologin </file> In the **vsftpd** configuration file (''/etc/vsftpd.conf'') the ''pam_service_name'' token is configured: **vsftpd** 設定ファイル (''/etc/vsftpd.conf'') では、''pam_service_name'' トークンが次のように設定されています。 <file> pam_service_name=ftp </file> With this configuration only the users that belong to the group ''pandora'' and have ''nologin'' as associated shell will be able to connect to Pandora FMS by FTP, //so you should create the group// ''pandora'' //that includes the user// ''pandora''. In any case, verify that both exist in the **Server**. この設定により、''pandora'' グループに属し、''nologin'' のシェルを持つユーザのみが FTP 経由でPandora FMS にアクセスできます。 そのため、''pandora'' ユーザを含むグループ ''pandora'' を作成する必要があります(存在しない場合)。 With a final configuration of the ''/etc/vsftpd.conf'' file, you will restrict the access of users accessing your home directory through FTP. The parameters are as follows: ''/etc/vsftpd.conf'' ファイルにて、いくつかの設定を調整するだけで、FTP 経由でログインするユーザの root へのアクセスを制限できます。 パラメータは次のとおりです。 <code> chroot_local_user=YES chroot_list_enable=YES chroot_list_file=/etc/vsftpd.nochroot_list </code> In case you need to exclude a user from this performance and avoid restricting it to your **Chroot**, just include that user in this ''vsftpd.nochroot_list'' file (one user per line). 一部のユーザを除外し、**Chroot** に制限することを避ける必要がある場合は、''vsftpd.nochroot_list'' ファイルにそのユーザを含めます(1行に1ユーザー)。 Other options to be configured to establish greater security measures are as follows: セキュリティ対策を強化するための他のオプションは次のとおりです。 <code> dirlist_enable=NO download_enable=NO deny_file=authorized_keys deny_file=.ssh chroot_local_user=YES </code> <WRAP center round tip 90%> The **vsftpd** service must be restarted after making changes to the configuration file for them to take effect. </WRAP> <WRAP center round tip 90%> 設定を変更した際は、それを反映するために **vsftpd** サービスを再起動する必要があります。 </WRAP> With this configuration, users will be restricted to their home directory (''/var/spool/pandora/data_in'' in the case of the ''pandora'' user). The user will be able to perform FTP transfers (send files), **but will not be able to list files**. これらの設定により、ユーザはそのルートディレクトリ (''pandora'' ユーザの場合は ''/var/spool/pandora/data_in'' に限定されます)。 ユーザは FTP 転送を実行してファイルを送信できますが、**ファイルの一覧は見ることができません** 。 <WRAP center round tip 90%> It is recommended to try to log in with the user ''pandora'' in the FTP, change directory and list files; if **unsuccessful**, then the configuration will have been successful. </WRAP> <WRAP center round tip 90%> FTP でユーザ pandora を使用してログインし、ディレクトリの移動とファイル一覧の取得を試してみてください。**できない場合** は、正しくセットアップができています。 </WRAP> [[:ja:documentation:start|Pandora FMS ドキュメント一覧に戻る]] CKG Edit ja/documentation/pandorafms/technical_annexes/01_ssh_and_ftp_setup.txt 最終更新: 2024/11/12 01:19by kanayama