ja:documentation:pandorafms:technical_annexes:01_ssh_and_ftp_setup

SSH および FTP でのデータ転送設定

The standard transfer method in Pandora FMS to send files, Tentacle, needs the Perl programming language installed. Some devices, such as ESX systems (UNIX), lack this tool. When this happens, the alternatives are to use FTP or SSH to transfer monitoring data.

Pandora FMS で標準の転送方法(tentacle)を使用できない場合があります。これは、Perl が無い Unix システム(ESX システムなど)を使用している場合で、古いシェルスクリプトのエージェントを使用する場合です。 この場合は、FTP または SSH を使用してファイルを転送することができます。

Pandora FMS can use the FTP or SSH protocol to copy the XML data packages generated by the software agents to the PFMS server.

Pandora FMS は、SSH プロトコルを使用して、ソフトウエアエージェントによって生成された XML データパッケージをサーバにコピーできます。

Always keep in mind Pandora FMS Security Architecture.

常に、Pandora FMS の セキュリティアーキテクチャ に注意してください。

Consider Pandora FMS server as Server and each one of the devices running the Software Agent as Client. You may always check which user you are working with by means of the whoami command.

Pandora FMS サーバを サーバ と見なし、ソフトウェアエージェントを実行している各デバイスを クライアント と見なします。 whoami コマンドを使用して、作業しているユーザをいつでも確認できます。

Step 1: Create a pandora user in the machine where Pandora FMS server is running. This machine will receive the data through SSH. If you have already installed a Pandora FMS server, surely this user is already created. Set a strong password for that user with the command:

ステップ 1: Pandora FMS サーバがインストールされているホストに pandora ユーザを作成します。このユーザーは SSH を介してデータを受信します。 Pandora FMS サーバがすでにインストールされている場合は、このユーザはすでに作成済です。 次のコマンドを使用して、このユーザに強力なパスワードを設定します。

passwd pandora

Step 2. Once within the server, create the /home/pandora/.ssh directory with 750 permissions and pandora:root user.

ステップ 2: サーバ内で、パーミッション 750 およびユーザ pandora:root/home/pandora/.ssh ディレクトリを作成します。

Step 3: Create, on each machine running a Software Agent that will use SSH, a pair of keys (private and public). To do this, execute the following command with the same user with which Pandora FMS Software Agent is executed:

ステップ 3: SSH を使用する必要があるエージェントの各システムで、鍵のペア(秘密鍵と公開鍵)を作成します。 これを行うには、Pandora FMS エージェントの実行に使用されるユーザで次のコマンドを実行します。

ssh-keygen

A series of questions will appear to which you will have to answer by simply pressing the Enter key. With this you have created a public key and a private key for that user in the machine. Now you should copy it to the destination machine, which is the Pandora FMS server where you want to send the monitoring data.

いくつかの質問が表示されます。Enter キーを押すだけで回答できます。 このユーザの公開/秘密鍵がシステムに作成されます。 次に、データの送信先である Pandora FMS サーバであるターゲットシステムにコピーします。

Step 4: Copy the public key to the Pandora FMS Server. The public key you just generated can be copied in two ways.

ステップ 4: 公開鍵を Pandora FMS サーバにコピーします。 作成された公開鍵をコピーするには、2つの方法があります。

手動コピー

The public key file generated in the Client is:

クライアント で生成された公開鍵は以下にあります。

/home/<user>/.ssh/id_rsa.pub

Where <user> is the user name 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 ユーザで生成した場合は、以下にあります。

/root/.ssh/id_rsa.pub

This file will have a content similar to this one:

このファイルには次のようなものが含まれます。

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzqyZwhAge5LvRgC8uSm3tWaFV9O6fHQek7PjxmbBUxTWfvNbbswbFsF0esD3COavziQAUl3rP8DC28vtdWHFRHq+RS8fmJbU/VpFpN597hGeLPCbDzr2WlMvctZwia7pP4tX9tJI7oyCvDxZ7ubUUi/bvY7tfgi7b1hJHYyWPa8ik3kGhPbcffbEX/PaWbZ6TM8aOxwcHSi/4mtjCdowRwdOJ4dQPkZp+aok3Wubm5dlZCNLOZJzd9+9haGtqNoAY/hkgSe2BKs+IcrOAf6A16yiOZE/GXuk2zsaQv1iL28rOxvJuY7S4/JUvAxySI7V6ySJSljg5iDesuWoRSRdGw== root@dragoon

This content must be added to the end of the authorized_keys file on the Server. Its path is:

この内容を、サーバauthorized_keys ファイルの最後に追加する必要があります。パスは次の通りです。

/home/pandora/.ssh/authorized_keys

The authorized_keys file on the Server must belong (ownership) to the user pandora:root and must have permissions 600

サーバの authorized_keys ファイルの所有者とグループは pandora:root で、パーミッションは 600 である必要があります。

自動コピー

Use the following command at Client:

クライアント にて次のコマンドを利用します。

ssh-copy-id pandora@<Server-address>

Where <Server-address> is the IP address or URL of the Server.

ここで、<Server-address> は、サーバ の IP アドレスまたは URL です。

It will ask for the server's pandora user password (set in step 1) and, once confirmed, it will display a message similar to the following:

pandora ユーザのパスワード(ステップ 1 で設定)を要求します。これが確認されると、次のようなメッセージが表示されます。

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.

Perform this test to verify automatic connection to Pandora FMS Server with the pandora user from the Client (with the user running the Software Agent):

クライアント (のソフトウエアエージェント実行ユーザ)から、Pandora FMS サーバpandora ユーザへ自動接続が可能であることを確認します。

ssh pandora@<Server-address>

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.

上記のように サーバ に接続できるようになると、クライアントのソフトウェアエージェントは監視データの送信を開始できるようになります。

Once you have verified the connection through SSH, 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 サーバディレクトリにコピーするために使用される方法になります。 このディレクトリは次の場所にあります。

/var/spool/pandora/data_in

Also make sure that the directory /var/spool/pandora/data_in exists and the pandora user has writing permissions, otherwise it will not work.

また、/var/spool/pandora/data_in ディレクトリが存在し、ユーザ pandora に書き込み権限があることを確認してください。そうでない場合は機能しません。

Finally, modify the software agent configuration in the Client to specify that the copying method is SSH. This is modified in /etc/pandora/pandora_agent.conf file, in the transfer_mode configuration token. Remember to restart the software agent service on each Client after this change.

最後に、クライアントの ソフトウエアエージェント設定を変更して、コピー方法を tentacle ではなく ssh に設定します。 これは /etc/pandora/pandora_agent.confファイルの transfer_mode 設定トークンで行います。この変更後は、クライアントのソフトウエアエージェントサービスを再起動することを忘れないでください。

Absolutely no one is safe from security attacks

Pandora FMS uses, among others, sftp/ssh2 (SCP) to copy data files from the software agents to the server. Therefore, 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 nothing that is absolutely secure; so, measures must be taken to make it “more” secure.

Pandora FMS は、特に sftp/ssh2(scp) を使用して、エージェントからサーバにデータファイルをコピーします。 このため、pandora ユーザを待ち受ける SSH2 サーバを備えた少なくとも 1つのデータサーバが必要です。 これは、厳密にセキュリティ保護する必要があるネットワークにとって重大なリスクになる可能性があります。 Open SSH2 は 非常に 安全ですが、コンピュータのセキュリティに関しては、絶対に安全なものはないため、“より安全” にするための対策を講じてください。

Always keep in mind Pandora FMS Security Architecture.

常に、Pandora FMS の セキュリティアーキテクチャ に注意してください。

It is possible to prevent SSH access for certain users, as well as to configure restrictions on FTP access.

FTP を介したアクセスに制限を設定するのと同じように、SSH を介した特定のユーザのアクセスを禁止することも可能です。

To do this, modify the pandora user on the Server. This user must have a strong password. Its login shell will be changed to restrict SSH access to the user, and its home directory, to prevent its access to other folders:

それを行うするには、サーバpandora ユーザの設定を変更します。 このユーザには強力なパスワードが必要です。 他のフォルダーへのアクセスを回避するために、ログインシェルを変更しホームディレクトリを変更します。

usermod -s /sbin/nologin -d /var/spool/pandora/data_in pandora

With these changes to the pandora user on the Server, when logging in via SSH, such user will not be able to execute commands with it in an interactive terminal.

サーバpandora ユーザに対するこの変更で、該当ユーザが SSH でログインした際にはターミナルでコマンドを実行できなくなります。

(See the recommended operating systems for Pandora FMS.) In Debian systems the shell path is /usr/sbin/nologin.

(Pandora FMS の 推奨 OS を確認してください。) Debian システムでは、シェルは /usr/sbin/nologin です。

The client settings for sending data via FTP allow you to specify the user and password to be sent, making it quite easy to implement FTP copying instead of Tentacle.

FTP 経由でデータを送信するクライアント設定は、送信するユーザとパスワードの指定で可能です。tentacle の代わりに FTP を介してコピーを実装するのは非常に簡単です。

What is File Transfer Protocol (FTP)?

Besides configuring Pandora FMS software agents to send data with FTP, you will have to configure an FTP server where you execute Pandora FMS server, establish a password for the pandora user and allow writing access to the pandora user to the /var/spool/pandora/data_in directory and its subdirectories.

FTP を使用してデータを送信するように Pandora FMS エージェントを設定するほか、Pandora FMS サーバに FTP サーバを設定し、ユーザ pandora (Pandora FMS エージェントで使用する)のパスワードを設定し、pandora ユーザに /var/spool/pandora/data_in 以下の書き込みアクセスを許可します。

This means that you should configure the FTP server to adapt it to these needs; for this, in this guide vsFTPd is used.

ニーズに合わせて FTP サーバを設定します。このガイドでは vsFTPd を使用します。

Tentacle の代わりに FTP を使用することの短所は、FTP を介したデータ送信は安全ではないため、Pandora FMS サーバで FTP サーバを実行することが脆弱になります。 以下のセクションでは、サーバーの安全性を最小限にする方法について説明します。

For this reason, and in the same way that the SSH login has been disabled for the pandora user for security reasons, a safe access method should be established for the FTP users. A safe and simple method for this is to create a PAM rule for vsftpd. For this you should create a file called /etc/pam.d/ftp containing the following:

安全上の理由で pandora ユーザの SSH 経由のログインを無効にするのと同様に、FTP 経由の安全なアクセス方法を設定する必要があります。簡単で安全な方法は、vsftpd の PAM ルールを作成することです。 次の内容の /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

(See the recommended operating systems for Pandora FMS.) In Debian systems the shell path is /usr/sbin/nologin.

(Pandora FMS の 推奨 OS を確認してください。) Debian システムでは、シェルは /usr/sbin/nologin です。

In the configuration file of vsftpd (/etc/vsftpd.conf) search the token pam_service_name and set the name of the created file:

vsftpd の設定ファイル(/etc/vsftpd.conf) で、pam_service_name トークンを探し、作成したファイル名を入力します。

pam_service_name=ftp

With this configuration, only the users that belong to the pandora group and have nologin as associated shell will be able to connect to Pandora FMS by FTP, so you should create the pandora group that includes the pandora user. In any case, verify that both exist in the Server.

この設定により、pandora グループに属し、nologin のシェルを持つユーザのみが FTP 経由でPandora FMS にアクセスできます。 そのため、pandora ユーザを含むグループ pandora を作成する必要があります(存在しない場合)。

With a last configuration of the /etc/vsftpd.conf file, the access of the users that access by FTP its root directory will be restricted. The parameters are as follows:

/etc/vsftpd.conf ファイルにて、いくつかの設定を調整するだけで、FTP 経由でログインするユーザの root へのアクセスを制限できます。 パラメータは次のとおりです。

chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.nochroot_list

In case you need to exclude a user from this 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 implement higher security are the following:

セキュリティを強化するための他のオプションは次のとおりです。

dirlist_enable=NO
download_enable=NO
deny_file=authorized_keys
deny_file=.ssh
chroot_local_user=YES

Remember to restart the vsftpd service after making changes to the configuration file for them to take effect.

設定を変更した際は、それを反映するために vsftpd サービスを再起動する必要があります。

With this configuration, the user will be restricted to its root directory (/var/spool/pandora/data_in in the case of the pandora user). The user will be able to make transfers via FTP (send files), but will not be able to list files.

これらの設定により、ユーザはそのルートディレクトリ (pandora ユーザの場合は /var/spool/pandora/data_in に限定されます)。 ユーザは FTP 転送を実行してファイルを送信できますが、ファイルの一覧は見ることができません

Try to log in with the pandora user in the FTP, change directory and list files; if it does not succeed, the configuration will have been successful.

FTP でユーザ pandora を使用してログインし、ディレクトリの移動とファイル一覧の取得を試してみてください。できない場合は、正しくセットアップができています。

Pandora FMS ドキュメント一覧に戻る

  • ja/documentation/pandorafms/technical_annexes/01_ssh_and_ftp_setup.txt
  • 最終更新: 2024/02/06 07:24
  • by junichi