SELinux は ~/.cert からファイルを読み取ることはできません。

SELinux は ~/.cert からファイルを読み取ることはできません。

私はFedora 23とSELinuxを初めて使用します。 NetworkManager経由でOpenVPNクライアントを使用しています。 OpenVPNアクセスに必要なすべてのファイル(証明書、CA、秘密鍵)が内部に保存されてい~/.certますupdatecon -R -v ~/.cert。出力の関連部分は次のとおりですgrep AVC /var/log/audit/audit.log | less

type=AVC msg=audit(1457179403.296:364): avc:  denied  { open } for  pid=2608 comm="nm-openvpn-serv" path="/home/ggoncalves/.cert/ggoncalves.key" dev="dm-2" ino=2888752 scontext=system_u:system_r:NetworkManager_t:s0 tcontext=system_u:object_r:svirt_sandbox_file_t:s0:c50,c545 tclass=file permissive=0
type=AVC msg=audit(1457179403.296:365): avc:  denied  { open } for  pid=2608 comm="nm-openvpn-serv" path="/home/ggoncalves/.cert/ggoncalves.key" dev="dm-2" ino=2888752 scontext=system_u:system_r:NetworkManager_t:s0 tcontext=system_u:object_r:svirt_sandbox_file_t:s0:c50,c545 tclass=file permissive=0
type=AVC msg=audit(1457179403.330:366): avc:  denied  { read } for  pid=2611 comm="openvpn" name="lastline-ca.crt" dev="dm-2" ino=2888749 scontext=system_u:system_r:openvpn_t:s0 tcontext=system_u:object_r:svirt_sandbox_file_t:s0:c50,c545 tclass=file permissive=0
type=AVC msg=audit(1457179403.332:367): avc:  denied  { read } for  pid=2611 comm="openvpn" name="ggoncalves.crt" dev="dm-2" ino=2888751 scontext=system_u:system_r:openvpn_t:s0 tcontext=system_u:object_r:svirt_sandbox_file_t:s0:c50,c545 tclass=file permissive=0
type=AVC msg=audit(1457179403.332:368): avc:  denied  { read } for  pid=2611 comm="openvpn" name="ggoncalves.key" dev="dm-2" ino=2888752 scontext=system_u:system_r:openvpn_t:s0 tcontext=system_u:object_r:svirt_sandbox_file_t:s0:c50,c545 tclass=file permissive=0

SELinuxを使用してから数日しか経っていないので、どこから探すべきかわかりません。どのようなヒントがありますか?

編集する:svirt_sandbox_file_t私が見るにはラベルに問題があるようです。私はこれらのファイルにタグを付ける必要があると思いますhome_cert_t

編集2:実際、svirt_sandbox_file_t何らかの理由で私のホームディレクトリ全体にフラグが立てられました。これがDocker戦略の特徴ですか、それともバグですか?

修正する

まあ、少し時間がかかりました。誰かが同じ状況に遭遇した場合に備えて、問題をより詳しく説明します。svirt_sandbox_file_t私のホームディレクトリをフラグ付きのボリュームとしてマウントしたとき、Dockerがそれをプロパティとして指定したことがわかりました:Z(言及どおり)。ここ)。その後、Dockerはホームディレクトリ全体にラベルを繰り返し適用しますが、どういうわけかFSラベルを再構築または適用しませんrestorecon

私のホームディレクトリを元の権限に復元するためにrsync一時フォルダに保存し、その中のすべてのアイテムを削除してrsync復元しました。最も賢いアイデアではありませんが、効果があります。

ベストアンサー1

ファイルのターゲットコンテキストタイプがまだ間違っています。

svirt_sandbox_file_t

のファイルはでマークする必要が~/.certありますhome_cert_t。もう一度お試しください。

restorecon -Rf ~/.cert

またはタイプを強制してみてください。

chcon -t home_cert_t ~/.cert/*

selinux-policyまたはdocker selinuxポリシーに誤ったデフォルトラベルを引き起こすバグがある可能性があります。

おすすめ記事