メランジ雑記帳

2010年6月3日

/etc/aliasesのselinux contextが変更されていたので…

カテゴリー: selinux — admin @ 12:22 PM

# ls -lZ aliases
-rw-r–r–. root root unconfined_u:object_r:etc_t:s0 aliases

であった。

これだと、

SELinux is preventing /usr/sbin/sendmail.sendmail "write" access to
/etc/aliases.

SELinux denied access requested by newaliases. /etc/aliases may be a mislabeled.
/etc/aliases default SELinux type is etc_aliases_t, but its current type is
etc_t. Changing this file back to the default type, may fix your problem.

File contexts can be assigned to a file in the following ways.

* Files created in a directory receive the file context of the parent
directory by default.
* The SELinux policy might override the default label inherited from the
parent directory by specifying a process running in context A which creates
a file in a directory labeled B will instead create the file with label C.
An example of this would be the dhcp client running with the dhclient_t type
and creating a file in the directory /etc. This file would normally receive
the etc_t type due to parental inheritance but instead the file is labeled
with the net_conf_t type because the SELinux policy specifies this.
* Users can change the file context on a file using tools such as chcon, or
restorecon.

This file could have been mislabeled either by user error, or if an normally
confined application was run under the wrong domain.

However, this might also indicate a bug in SELinux because the file should not
have been labeled with this type.

If you believe this is a bug, please file a bug report against this package.

You can restore the default system context to this file by executing the
restorecon command. restorecon '/etc/aliases', if this file is a directory, you
can recursively restore using restorecon -R '/etc/aliases'.

/sbin/restorecon '/etc/aliases'

node=redhat.ocn2.melange.co.jp type=AVC msg=audit(1275532056.576:1251096): avc: denied { write } for pid=26507 comm="newaliases" name="aliases" dev=dm-2 ino=22750792 scontext=unconfined_u:system_r:sendmail_t:s0 tcontext=unconfined_u:object_r:etc_t:s0 tclass=file

node=redhat.ocn2.melange.co.jp type=SYSCALL msg=audit(1275532056.576:1251096): arch=40000003 syscall=5 success=yes exit=3 a0=111bbe8 a1=2 a2=0 a3=0 items=0 ppid=26502 pid=26507 auid=500 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=51 sgid=51 fsgid=51 tty=pts12 ses=2390 comm="newaliases" exe="/usr/sbin/sendmail.sendmail" subj=unconfined_u:system_r:sendmail_t:s0 key=(null)

のようなエラーになってしまう。
そこで

# chcon -t etc_aliases_t /etc/aliases

# ls -lZ /etc/aliases
-rw-r–r–. root root unconfined_u:object_r:etc_aliases_t:s0 aliases

で修正したが、これはバージョンアップ(11ー>12)した時に、コンテキスト属性を保存しないでバックアップしたのか?

restoreconでもよかったかもしれない。

コメントはまだありません »

コメントはまだありません。

このコメント欄の RSS フィード トラックバック URL

コメントをどうぞ

Powered by WordPress