0

SELinux に関連しているように見えるディレクトリのアクセス許可を変更する際に問題が発生しています。SELinuxをa)シェフクライアントセッションの残りの部分で、b)永久に無効にする方法を見つけようとしています。

リソース:

# Change permissions for mounted repository
directory "/home/analytics" do
  owner "analytics"
  mode "711"
end

エラー:

/sbin/restorecon set context /analytics/file failed:'Operation not supported'

環境:

SELinuxがうまくいかないようです。偉大な。SELinuxを無効にしましょう!

Chef's box の在庫構成は permissive に設定されています。

[root@analytics selinux]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#   enforcing - SELinux security policy is enforced.
#   permissive - SELinux prints warnings instead of enforcing.
#   disabled - SELinux is fully disabled.
SELINUX=permissive
# SELINUXTYPE= type of policy in use. Possible values are:
#   targeted - Only targeted network daemons are protected.
#   strict - Full SELinux protection.
SELINUXTYPE=targeted

構成をテンプレート化して無効に設定できますが、それは再起動後にのみ適用されます。通常、現在のセッションで SELinux を無効にするには、CLI (sestatus、setenforce など) を使用します。私たちのクックブック (および公式のクックブック) は、この機能に依存しています。しかし、ここで壊れているようです...

[root@analytics selinux]# sestatus
bash: sestatus: command not found
[root@analytics selinux]# getstatus
bash: getstatus: command not found

[root@analytics selinux]# rpm -q policycoreutils
policycoreutils-1.33.12-14.13.el5

では、ボックスを再起動したり Chef を 2 回実行したりせずに SELinux を無効にするにはどうすればよいでしょうか?

4

1 に答える 1

0

/etc/selinux/config の設定を DISABLED に設定して新しい .box を作成することで問題を解決しました。

しかし、@szpalは正しいです。バイナリは /usr/sbin の下にありました (私が探していた /sbin ではなく):

[vagrant@analytics-centos-510 sbin]$ ls /usr/sbin/se* /usr/sbin/selinuxenabled /usr/sbin/semodule /usr/sbin/sestatus /usr/sbin/semanage /usr/sbin/setenforce

簡単なテストでは、実行リソースへのフル パスを指定するだけで、セッション中の SELinux を無効にできることが示されました。

execute "disable selinux - running" do
      command "/usr/sbin/setenforce 0"
end
于 2015-02-04T20:10:41.100 に答える