1. Setupコマンドでのアカウント移行方法 UNIX系のPost.Officeでは、インストール時にsendmailからの移行が予め考 慮されています。これは、通常、/opt/post.officeにインストールされるSetup コマンドを実行することで簡単に処理されます。 ここでの説明では、いくつかのPerlスクリプトが使われています。 Perl 5.004_04以上のバージョンをインストールしてください。 ここでの注意点は、/etc/passwdファイルと/etc/shadowファイルからアカウ ントデータを読み込みますが、移行する必要のないシステムアカウントまで 移行対象とするかもしれません。 Setupプログラムは、これらのシステムアカウントを移行しないようチェック していますが、完全なチェックではありません。 もし、このようなことを事前に避けたいならば、/etc/passwdファイルと /etc/shadowファイルを一旦、/tmpへコピーし、 付録-1のpwshmerge.pl スクリプトを実行し、カスタムパスワードファイルを作成するとよいでしょう。 また、カスタムパスワードファイルの方法は、別マシンへの移行でも適用可 能です。 ここでの各操作は、rootユーザで実行します。 例. # cd /tmp # cp /etc/passwd . # cp /etc/shadow . # perl pwshmerge.pl > passwd.merged 実際のSetupコマンド実行例を使い説明します。 # cd /opt/post.office # ./Setup =========================================================================== =========================================================================== = = = Post.Office Setup = = = =========================================================================== This program will occasionally ask you for permission to perform a task, or alert you of a problem. When asking a question that has a default response, you can simply press 'Return' to specify the default. The default is the value shown in the square brackets '[' and ']'. Do you want to continue? yes/no/quit [yes] # 続行するためにyesまたは、リターンを入力します。 Checking software license.... Your current license to use Post.Office is 1234-123456789-1234U100L100S0V38J. Do you have a new license number? yes/no/quit [no] # ライセンス変更はありませんので、noを入力または、リターンします。 Checking for Mailbox directory.... found Checking user maildrop directory.... OK Reading configuration information.... done Your Address Completion Domain was already set to "opentech.co.jp". This value can be found on the System Configuration form. Post.Office can be configured remotely using a graphical World-Wide-Web browser, or an E-mail client that supports MIME. The WWW configuration is handled by a server that is built into Post.Office. The port used by this server can be modified so it doesn't conflict with a general-purpose WWW server operating on port 80, or any other service provided by this machine. Also the E-mail configuration mechanism can be turned on or off depending on your needs. Post.Office is currently configured with the following settings: TCP/IP port for World-Wide-Web configuration: 9090 World-Wide-Web configuration allowed from: everywhere Allow configuration via E-mail: yes Send greeting messages to new users: no Do you want to change this information? yes/no/quit [no] # ここでの変更はありませんので、noまたは、リターンを入力します。 There are already some electronic mail accounts in the Post.Office account database. If you would like to synchronize your UNIX password database with the internal Post.Office database, you can do that now. The UNIX password database will be searched for users that currently don't have accounts in Post.Office, and accounts for those users will be created. Please select one of the following methods for setting up the accounts: [A] Search for all users, including those in the /etc/passwd file and NIS/NIS+. [P] Search through /etc/passwd only. [F] Search through a custom password file. [N] Don't automatically set up any accounts. Which method? All/Passwd/File/None/Quit [N] F # /etc/passwdから移行する場合は、Pを入力し、一旦、修正したカスタム # パスワードから移行する場合は、Fを入力します。 Enter the password file name: [/etc/passwd] /tmp/passwd.merged Searching through /tmp/passwd.merged.... 7 UNIX accounts found. (Existing accounts will not be modified.) # 移行対象アカウント数が表示されます。 Please list all of the mail domains that each user should receive mail for, listing the most important one first (i.e. the one that should show up on outgoing mail). For example, if you want all of your users to receive mail addressed to as well as , and you prefer the address with just your domain for outgoing mail, you would specify opentech.co.jp,posun3.opentech.co.jp here. You can list as many domains as you want, separated by spaces or commas. Mail domains: [opentech.co.jp,posun3.opentech.co.jp] Checking domains.... The following domains will be used for addresses in each user's account: opentech.co.jp posun3.opentech.co.jp # 各アカウントのSMTPアドレスのドメインパートが表示されます。 Also, addresses in outgoing mail will have opentech.co.jp as the domain. Is this what you want? yes/no [yes] # 変更がなければ、yesを入力します。 If you want, you can set up a POP login name for each newly created account. The POP login name will be the same as the UNIX username for the account. You may want to do this whether or not you set up the account with POP delivery by default, just to make things easier later. If you don't want users to enable POP delivery, you would not want to set up POP login names for them. Set up POP login names? yes/no [yes] # POPログインを有効にする場合には、yesを入力します。 If you want, you can set up a UNIX login name for each newly created account. You need to do this if you want to set up the account with UNIX delivery. You may want to do this whether or not you set up the account with UNIX delivery by default, just to make things easier later. If you don't want users to enable UNIX delivery, you would not want to set up UNIX login names for them. Set up UNIX login names? yes/no [yes] no # UNIX配信をしない場合は、noを入力します。(通常、UNIX配信の必要は # ありません。 Since you have chosen POP delivery by default, you may want to move each user's existing mail from the UNIX spool directory to the Post.Office POP mailbox directory, so that the user can retrieve the old mail using POP. Convert mailboxes to POP mailboxes? [yes] # Setupによるsendmailメールボックスの移行はサポートされていませんので # ここでの質問は意味がありませんので、改行を入力してください。 Creating user accounts.... norika@opentech.co.jp (norika)....created akiko@opentech.co.jp (akiko)....created yuki@opentech.co.jp (yuki)....created asumi@opentech.co.jp (asumi)....created fumina@opentech.co.jp (fumina)....created furusawa@opentech.co.jp (furusawa)....created terai@opentech.co.jp (terai)....created # アカウント作成状況が表示されます。 Checking for Postmaster account.... found The Postmaster account is currently configured with the following information: Password: [not shown] Access Domains: opentech.co.jp Postmasters: root@posun3.opentech.co.jp Do you want to change any information? yes/no/quit [no] # Postmaster情報の変更が必要がなければ、noを入れてください。 Checking inetd configuration.... OK Checking for sendmail daemon.... not found (that's good) Installing sendmail emulator.... done Checking for active server processes.... Post.Office is running Installation is complete. To administer Post.Office using a World Wide Web browser such as NCSA Mosaic, use the URL: http://posun3.opentech.co.jp:9090 To administer Post.Office via E-mail, request account management forms from and configuration forms from . The body of the message should contain a list of the forms you want to retrieve. Account management forms include the "Account", "List", and "SMTP aliases" forms. Configuration forms include the "System", "Security", "SMTP", and "Queue" forms. For a complete list and detailed instructions, please refer to the Post.Office Reference Manual. # 以上でSetupによるアカウントデータの移行は完了です。 2. addacctコマンドでのアカウント移行方法 addacctコマンドによる移行方法の良い点は、Post.Officeのアカウントパラメー タをここで示すaddacct_bat.plスクリプト 内で細かく指定できる点です。 Mailbox-Quota、SMTP-RewriteStyle等を設定することができます。 アカウントデータは、/etc/passwdから移行します。 このaddacct_bat.plスクリプトでは、 各アカウントのドメインパートを$domainName 変数でセットします。 またユーザのパスワードに関しては、移行できないためパスワードファイルの ユーザ名がセットされます。もし、一時的に固定したパスワード文字列をセッ トする場合は、Passwordパラメータに直接、セットしてください。 ユーザの実名には、passwdファイルの最初のユーザ名をセットするようになっ ていますが、gcos fieldをセットすることも可能です。ただし、この場合、,;$等の 特殊文字が含まれないようにしてください。 ユーザの実名は重複しても構いませんが、POP-Address、SMTP-Addressの 重複は許されませんし、英数字のみの文字列に限定されます。 ここでの各操作は、rootユーザで実行します。 (1) まず、不必要なシステムアカウントを削除するため、/etc/passwdを /tmp等へコピーし、エディターを使用して不必要なアカウントを削除します。 (2) 付録-2のaddacct_bat.plスクリプト を用い、passwdファイルのアカウントを 移行します。 # cat /tmp/passwd | perl addacct_bat.pl 3. メールボックスの移行方法 sendmailのメールボックスは、/var/mailディレクトリにアカウント名のファイル が作成され、全ての保持されたメッセージはこの一つのファイルに保存され ます。 各メッセージの先頭行は、From(:無し)行で始まります。 例. From foo.bar@opentech.co.jp Wed Mar 12 13:56:58 2003 一方、Post.Officeは、各メッセージを一つのファイルとして管理しています。 各アカウントのメールボックスディレクトリ下に受信箱 (INBOX)であれば、inと いうディレクトリが作成されます。メッセージはそのディレクトリ下にMessage-Id にもとづいたファイル名で作成されます。 ここで説明する方法は、実際に実行可能ですが、あくまでサンプルスクリプトと して説明します。 (1) 各アカウントのメールボックスをメッセージ単位に分割します。   付録-3のmigmbox.plスクリプト を用い、メッセージを展開します。 # perl migmbox.pl /var/mail/yamada ここで/var/mail/yamadaは、アカウント yamadaのメールボックスファイルです。 migmbox.plスクリプトを実行すると yamadaというディレクトリがカレントディレクト リ下に作成され、各メッセージが yamada-1.msg、yamada-2.msg、 yamada-3.msg、... という形式のファイル単位で作成されます。 (2) 各メッセージの移行は、Post.Officeのコマンドユーティリティであるsendmail コマンドを使います。もし、移行先が別マシンであれば、上で分割したメールボッ クスをtarコマンド等でアーカイブし、予め移行先へコピーしておきます。 通常、/opt/post.office/bin/sendmailとしてインストールされ、 /usr/lib/sendmailは、このコマンドにシンボリックリンクされています。このコマ ンドは、引数として与えられたSMTPメールアドレスへ標準入力からのメッセー ジをローカル配送することによって移行します。 sendmailのメールボックスをメッセージ単位に分割したディレクトリ下で # csh # cd "作成されたアカウントディレクトリ" # foreach in ( `ls *.msg` ) ? cat $in | /opt/post.office/bin/sendmail -oem "アカウントのSMTPアドレス" ? end # 例. # csh # cd yamada # foreach in ( `ls *.msg` ) ? cat $in | /opt/post.office/bin/sendmail -oem yamada@opentech.co.jp ? end # 実際には次のようなスクリプトで全アカウントのメールボックスを移行すると よいでしょう。 # csh # foreach in ( `ls` ) ? if ( -d $in ) then ? cd $in ? foreach msg ( `ls *.msg` ) ? cat $msg | /opt/post.office/bin/sendmail -oem ${in}@opentech.co.jp ? end ? cd .. ? endif ? end # # アカウントのSMTPアドレスは、メールボックス名であることに注意して # ください。 以上でSun Solaris等、UNIX系でのメールボックスを含むsendmailからのアカ ウント移行作業は完了です。 アカウントの移行では、事前にテストアカウントを作成し、メールボックスの内 容や、移行後のメール送受信が確認できるようにするとよいでしょう。 【注意】 移行後、ホスト名が変った場合、メーラー (MUA)によっては、移行後のメール ボックスが今までと別のものであると判断し、再度全メッセージをローカル (メーラー側) のメールボックスにコピー (受信)し直すことに注意してください。