[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debian-users:15180] conffiles (Re: cracklib issue report)



佐野@浜松です。

In article <199905031556.AAA08222@xxxxxxxxxxxx>
 Hiroshi KISE <fuyuneko@xxxxxxxxxxxx> さん writes:

> From: mizuhara@xxxxxxxxxxxxxx
> Subject: [debian-users:15130] Re: cracklib issue report
> Date: Sun, 2 May 1999 06:13:07 +0900
> > つい先日私が「sendmail を exim に入れ替えたら /etc/rc2.d/S20sendmail が
> > 残っていて、/usr/sbin/sendmail からシンボリックリンクが張られた exim が
> > 実行されてしまう」というメールを出しまして、その後 debian のポリシーを
> > 調べているのですが、どうも --purge しないと cron や rc スクリプトは削除
> > しない、というのが debian 的には正しいようなんです。
> 
> バイナリ本体が消えている状態で crontab や rc スクリプトが残ってしまうのは、
> ちと理解できません。僕も理由が知りたいです。

一言でいえば、「それらが設定ファイル (conffiles)」だから」という
理由なのではないでしょうか。

# doc/debian-policy/policy.html/ch4.html#s4.7 には
# 
# 4.7 Configuration files 
#
# Any configuration files created or used by your package should 
# reside in /etc. If there are several you should consider 
# creating a subdirectory named after your package.
# 
# It is almost certain that any file in /etc that is in your package's 
# filesystem archive should be listed in dpkg's conffiles control area 
# file. (See the Debian Packaging Manual).
# 
# と書いてあります。

ニーズとしての面から言えば、 rc スクリプトについては起動オプションなどを
必要に応じて修正する場合があり得ます。例えば sendmail の場合なら -q15m で
指定される時間間隔をもっと短かく、あるいはもっと長くと変更する場合が
思いつきます。

また、他のパッケージであっても、起動オプションなどの設定変更は
私の場合はけっこうやってます。

# まったくの好みの問題で linuxlogo の -o オプションをいじったり、
# apmd の警告レベルをいじったり。

で、通常はこれらの「設定ファイル」が残っていても問題無いように、
 test -x などで実行バイナリをチェックして、それが実行可能な場合にのみ
動作するように作られているはずです。

 crontab のエントリーについても、例えば exim の場合

 %%% /etc/cron.daily/exim: %%%

#!/bin/sh

# Uncomment the following lines to get daily e-mail reports
#if [ -x /usr/sbin/eximstats ]; then
#  eximstats </var/log/exim/mainlog \
#                    | mail postmaster -s"Daily E-Mail Activity Report"
#fi

# Cycle logs
if [ -x /usr/sbin/exicyclog ]; then
  exicyclog
fi

 %%% /etc/cron.d/exim: %%%
# /etc/cron.d/exim: crontab fragment for exim

# Run queue every 15 minutes
08,23,38,53 *     * * *     mail   if [ -x /usr/sbin/exim ]; then /usr/sbin/exim
 -q >/dev/null 2>&1; fi

といったふうに、必ず実行バイナリをチェックしています。

もちろん、完全に不要になれば --purge で削除できるわけですが、
普段使っているのと違うものをすこし試してみたい場合など、
自分で変更した設定を残しておきたいことはあると思います。

# sendmail の -q15m を変更したくなることがあるのと同様に
# /etc/cron.d/exim の 08,23,38,53 も変更したくなるかも
# しれません。

今回の sendmail -> exim 移行の問題は、やはり sendmail のバグだと
思います。

"Debian Policy"  (doc/debian-policy/policy.html/ch5.html) には

5.5 Mail transport agents 

Debian packages which process electronic mail, whether mail-user-agents (MUAs) or
mail-transport-agents (MTAs), must make sure that they are compatible with 
the configuration decisions below. Failure to do this may result in lost mail, 
broken From: lines, and other serious brain damage!

The mail spool is /var/spool/mail and the interface to send a mail message is
/usr/sbin/sendmail (as per the FSSTND). The mail spool is part of the base 
system and not part of the MTA package.

という説明があり、 Debian システムの MTA は /usr/sbin/sendmail を
メール送信用インターフェイスとして備えなければならない、とされています。

一方、 (doc/debian-policy/policy.html/ch3.html#s-sysvinit) には

3.3.2 Writing the scripts 

Packages can and should place scripts in /etc/init.d to start or stop 
services at boot time or during a change of runlevel. These scripts 
should be named /etc/init.d/package, and they should accept one argument, 
saying what to do: 

... (中略)

These scripts should not fail obscurely when the configuration files 
remain but the package has been removed, as the default in dpkg is 
to leave configuration files on the system after the package has
been removed. Only when it is executed with the --purge option will 
dpkg remove configuration files.
Therefore, you should include a test statement at the top of the script, 
like this: 

              test -f program-executed-later-in-script || exit 0
 
とあります。

また doc/debian-policy/policy.html/ch3.html#s3.4 には

3.4 Cron jobs 

Packages may not touch the configuration file /etc/crontab, 
nor may they modify the files in /var/spool/cron/crontabs.

... (中略)

All files installed in any of these directories have to be scripts 
(shell scripts, Perl scripts, etc.) so that they can easily be 
modified by the local system administrator. In addition, they have to 
be registered as configuration file.

The scripts in these directories have to check, if all necessary 
programs are installed before they try to execute them. Otherwise, 
problems will arise when a package was removed (but not purged), since
the configuration files are kept on the system in this situation.

と書かれています。

結局、「共通インターフェイス」である /usr/sbin/sendmail という
パスを「特定のパッケージがインストールされているか否か」の判断に
使おうとしている点が間違いなわけです。 (> sendmail パッケージ)

先に書いたように、 sendmail.real などの名前で実行バイナリを置くか、
あるいは「パッケージ識別用」に sendmail.real というリンクを置いて、
 rc や cron のスクリプトではこれをチェックする (sendmail.real 自体は
 conffiles に含めず、 --remove で削除されるものとする) ようにすれば
この問題は解決するはずです。

不要な設定ファイルなどを削除するためには、時々 dpkg -l|grep '^r' で
 remove されたパッケージのリストを作成してチェックし、順に --purge 
するという作業が必要になりますが、それは「気軽にパッケージを交換できる」
というメリットの代償として仕方が無いかな、と。

# dpkg --forget-old-unavail っていうオプションもあるんですね。

-- 
     #わたしのおうちは浜松市、「夜のお菓子」で有名さ。
    <xlj06203@xxxxxxxxxxx> : Taketoshi Sano (佐野 武俊)