#use wml::debian::template title="push サーバを設定する" #use wml::debian::translation-check translation="1.11" #O

Setting up a push server consists of two basic tasks: setting up rsync #O access (for normal, "pull" mirroring) and setting up ssh trigger mechanism #O (for "pushing" the pull mirroring).

push サーバの設定は、基本的に 2 つの作業からなります。 ひとつは rsync 接続 (通常の "pull" ミラー) の設定、 もうひとつは ssh のトリガ機構 (pull ミラーを "push" するためのもの) の設定です。 #O

(For more information on what a push server is, please read #O the explanation of push mirroring.)

(push サーバに関する詳細はpush ミラーの説明 をご覧ください。) #O

Setting up rsync

rsync の設定

#O

Install rsync 2.1.1 or greater. If your site is running #O Debian, just install the latest #O rsync package.

rsync 2.1.1 以降をインストールします。 もし Debian を使っているサイトでしたら、単に rsync パッケージの最新版をインストールするだけです。 #O

Create rsyncd.conf file and put something similar to this #O in it:

rsyncd.conf ファイルを作り、 以下のような内容を追加します。

uid = nobody
gid = nogroup
max connections = 25
syslog facility = daemon
socket options = SO_KEEPALIVE

[debian]
  path = /org/ftp.debian.org/ftp
  comment = Debian FTP Archive (~24 GB)
  auth users = authorized_account1,authorized_account2,authorized_accountN
  read only = true
  secrets file = /etc/rsyncd/debian.secrets
[debian-web]
  path = /org/www.debian.org/debian.org
  comment = Debian Web Site (~400 MB)
  auth users = authorized_account1,authorized_account2,authorized_accountN
  read only = true
  secrets file = /etc/rsyncd/debian.secrets
#O

Add an entry for each site you are pushing to in the #O /etc/rsyncd/debian.secrets file:

push する各サイトに対応するエントリを、 /etc/rsyncd/debian.secrets ファイルに追加します。

authorized_account1:a_password
authorized_account2:another_password
authorized_accountN:password
#O

You have now given the downstream mirrors access to the archive on your #O machine.

これで下流のミラーに、あなたのマシンのアーカイブへの 接続を許したことになります。 #O

You will probably want to start the rsync daemon from inetd. To do this, #O you have to add rsync service in /etc/services file (if it #O isn't already there), like this:

rsync デーモンは inetd から起動することになるでしょう。 これにはまず、/etc/services ファイルに 次のような rsync サービスを (まだなければ) 追加します。

rsync           873/tcp
#O To enable the daemon from inetd, add the following to your #O /etc/inetd.conf file: デーモンを inetd から起動させるには、次の行を /etc/inetd.conf ファイルに加えます。
rsync      stream      tcp         nowait      root /usr/bin/rsync rsyncd --daemon
#O (Remember to send inetd a HUP signal to tell it to reread its config file #O after modifying the file.) (修正後に inetd に HUP シグナルを送り、 修正された設定ファイルを読み込ませるのを忘れないこと) #O

Setting up ssh trigger mechanism

ssh トリガ機構の設定

#O

Create a new ssh key for the account that you use to mirror Debian. Make #O sure you don't overwrite your original ssh key by using the -f option, for #O example:

Debian のミラーに用いるアカウントの ssh 鍵を新しく作ります。 すでにある自分の鍵を上書きしないよう、-f オプションを用いましょう。 たとえば次のようになります。

ssh-keygen -f ~/.ssh/identity.mysite
#O

Make sure that the new public key (~/.ssh/identity.mysite.pub) contains #O this at the beginning:

公開鍵 (~/.ssh/identity.mysite.pub) の先頭に、 次の内容を追加してください。

no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty,command="~/websync &"
#O

(replace "websync" with "ftpsync", or "ftpsync-non-US", or whatever's #O the command to start the mirroring called)

("websync" は適宜 "ftpsync", "ftpsync-non-US" など、 ミラーを開始するコマンドに書き換えてください) #O

You need to set up a script that will contact the downstream mirrors. #O Create a file called signal, containing this:

次に、下流のミラーに接続するスクリプトを書きます。 signal という名前のファイルを作り、 以下の内容を書き込みます。

#!/bin/sh

# This script is called to signal the remote host that it is time to
# mirror the archive.

echo Signalling $1
ssh -o"BatchMode yes" -o"user $2" "$1" -i $HOME/.ssh/identity.mysite sleep 1
#O

This script will login to a remote host using the special ssh key you #O created above. The script itself will not do anything useful remotely, the #O ~/websync (or ~/ftpsync, or ~/ftpsync-non-US) command will be run from the #O key.

このスクリプトは先に作った専用の ssh 鍵でリモートホストにログインします。 このスクリプト自身はリモートでなんら作業を行いませんが、 鍵の設定によってリモートでは ~/websync (あるいは ~/ftpsync や ~/ftpsync-non-US) が実行されます。 #O

To actually signal the mirrors, you need to add ./signal #O <site> <username> lines at the end of either the #O websync script, or if it's more convenient for you, in a new #O script, and then run that script from websync.

実際にミラーを開始させるには、 ./signal <site> <username> という行を websync スクリプトの末尾に追加します。 あるいは別のスクリプトに書いて、そのスクリプトを websync から呼び出す形の方が便利なら、それでもかまいません。 #O

This new script, runmirrors, would contain something like #O this:

この新しいスクリプト runmirrors は、 次のような内容になるでしょう。

#!/bin/sh

# This script is called by websync to signal the downstream mirrors.

./signal some.other.site archvsync
./signal and.another.site othersiteaccount
#O

Thus, as soon as your site is finished mirroring from the upstream site, #O you will start pushing to those downstream from you.

こうすると、あなたのサイトが上流からのミラーを終えると、 すぐさま下流への push を開始することになります。 #O

If you have any trouble with this, #O contact us.

もし問題が起こったら、 連絡してください