{"id":328,"date":"2010-11-09T16:40:07","date_gmt":"2010-11-09T08:40:07","guid":{"rendered":""},"modified":"2013-02-17T13:42:00","modified_gmt":"2013-02-17T05:42:00","slug":"%e5%88%86%e6%9e%90selinux%e6%97%a5%e5%bf%97%ef%bc%8c%e6%8e%92%e9%99%a4selinux%e7%96%91%e9%9a%be","status":"publish","type":"post","link":"https:\/\/ybzx.vip\/wp\/?p=328","title":{"rendered":"\u5206\u6790SELinux\u65e5\u5fd7\uff0c\u6392\u9664SELinux\u7591\u96be"},"content":{"rendered":"<p>\u4f60\u7ec8\u6709\u4e00\u5929\u4f1a\u88ab SELinux \u963b\u6b62\u4f60\u8bbf\u95ee\u6240\u9700\u7684\u4e1c\u897f\uff0c\u800c\u4e14\u8981\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u3002SELinux \u62d2\u7edd\u67d0\u4e2a\u6587\u4ef6\u3001\u8fdb\u7a0b\u6216\u8d44\u6e90\u88ab\u8bbf\u95ee\u7684\u57fa\u8981\u539f\u56e0\u6709\u6570\u4e2a\uff1a<\/p>\n<p>1 \u4e00\u4e2a\u88ab\u9519\u8bef\u6807\u7b7e\u7684\u6587\u4ef6<br \/>2 \u4e00\u4e2a\u8fdb\u7a0b\u5728\u9519\u8bef\u7684 SELinux \u5b89\u5168\u6027\u8109\u7edc\u4e0b\u8fd0\u884c<br \/>3 \u653f\u7b56\u51fa\u9519\u3002\u67d0\u4e2a\u8fdb\u7a0b\u8981\u8bbf\u95ee\u4e00\u4e2a\u5728\u7f16\u5199\u653f\u7b56\u65f6\u610f\u6599\u4e0d\u5230\u7684\u6587\u4ef6\uff0c\u5e76\u4ea7\u751f\u9519\u8bef\u4fe1\u606f<br \/>4 \u4e00\u4e2a\u5165\u4fb5\u7684\u4f01\u56fe\u3002<br \/>\u5934\u4e09\u4e2a\u60c5\u51b5\u6211\u4eec\u53ef\u4ee5\u5904\u7406\uff0c\u800c\u7b2c\u56db\u4e2a\u6b63\u6b63\u662f\u9884\u671f\u7684\u8868\u73b0\u3002<br \/><!--more--><\/p>\n<p>\u5148\u5b89\u88c5setroubleshoot \u7ec4\u4ef6\u3002\u6709\u7684\u8d44\u6599\u8bf4\u4ed6\u662f\u9ed8\u8ba4\u5b89\u88c5\u7684\uff0c\u4f46\u5728\u6211\u7684CentOS5.5\u4e0a\u6ca1\u6709\u3002<br \/>yum install setroubleshoot<br \/>\uff08https:\/\/fedorahosted.org\/setroubleshoot\uff09<\/p>\n<p>\u65e5\u5fd7\u6863\u662f\u6392\u9664\u4efb\u4f55\u7591\u96be\u7684\u5173\u952e\uff0c\u800c SELinux \u4ea6\u4e0d\u4f8b\u5916\u3002SELinux \u7f3a\u7701\u4f1a\u901a\u8fc7 Linux \u5ba1\u8ba1\u7cfb\u7edf\uff08auditd\uff09\u5c06\u65e5\u5fd7\u5199\u5728 \/var\/log\/audit\/audit.log \u5185\uff0c\u800c\u8fd9\u9879\u52a1\u670d\u7f3a\u7701\u4e3a\u542f\u7528\u7684\u3002\u5047\u82e5 auditd \u5e76\u672a\u8fd0\u884c\uff0c\u4fe1\u606f\u5c06\u4f1a\u88ab\u5199\u8fdb \/var\/log\/messages\u3002SELinux \u7684\u65e5\u5fd7\u90fd\u88ab\u6807\u7b7e\u6709 AVC \u8fd9\u4e2a\u5173\u952e\u5b57\uff0c\u65b9\u4fbf\u5b83\u4eec\u4ece\u5176\u5b83\u4fe1\u606f\u4e2d\u8fc7\u6ee4\u51fa\u6765\u3002<\/p>\n<p>\u7531 CentOS 5 \u8d77\uff0c\u4f60\u53ef\u4ee5\u7528 SELinux \u6392\u9664\u7591\u96be\u5de5\u5177\u534f\u52a9\u4f60\u5206\u6790\u65e5\u5fd7\u6863\uff0c\u5c06\u5b83\u4eec\u8f6c\u6362\u4e3a\u4f9b\u4eba\u9605\u8bfb\u7684\u683c\u5f0f\u3002\u8fd9\u4e2a\u5de5\u5177\u5305\u542b\u4e00\u4e2a\u4ee5\u53ef\u8bfb\u683c\u5f0f\u663e\u793a\u4fe1\u606f\u53ca\u89e3\u51b3\u65b9\u6848\u7684\u56fe\u50cf\u754c\u9762\u3001\u4e00\u4e2a\u684c\u9762\u901a\u62a5\u56fe\u793a\u3001\u4e0e\u53ca\u4e00\u4e2a\u957f\u9a7b\u8fdb\u7a0b\uff08setroubleshootd\uff09\uff0c\u5b83\u8d1f\u8d23\u67e5\u9605\u65b0\u7684 SELinux AVC \u8b66\u544a\u5e76\u4f20\u9001\u81f3\u901a\u62a5\u56fe\u793a\uff08\u4e0d\u8fd0\u884c X \u670d\u52a1\u5668\u7684\u8bdd\u53ef\u8bbe\u7f6e\u4ee5\u7535\u90ae\u901a\u62a5\uff09\u3002SELinux \u6392\u9664\u7591\u96be\u5de5\u5177\u662f\u7531 setroubleshoot \u7ec4\u4ef6\u6240\u63d0\u4f9b\uff0c\u5e76\u7f3a\u7701\u4f1a\u88ab\u5b89\u88c5\u3002\u8fd9\u4e2a\u5de5\u5177\u53ef\u4ee5\u4ece\u300c\u7cfb\u7edf\u300d\u9009\u5355\u6216\u547d\u4ee4\u884c\u5f15\u5bfc\uff1a<\/p>\n<p>sealert -b <br \/>\u4e0d\u8fd0\u884c X \u670d\u52a1\u5668\u7684\u4eba\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u4ea7\u751f\u4f9b\u4eba\u9605\u8bfb\u7684\u62a5\u544a\uff1a<\/p>\n<p>sealert -a \/var\/log\/audit\/audit.log > \/path\/to\/mylogfile.txt <\/p>\n<p>\u66f4\u591a\u4fe1\u606f\uff1ahttp:\/\/wiki.centos.org\/zh\/HowTos\/SELinux<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f60\u7ec8\u6709\u4e00\u5929\u4f1a\u88ab SELinux \u963b\u6b62\u4f60\u8bbf\u95ee\u6240\u9700\u7684\u4e1c\u897f\uff0c\u800c\u4e14\u8981\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u3002SELinux \u62d2\u7edd\u67d0\u4e2a\u6587\u4ef6\u3001\u8fdb\u7a0b\u6216 &hellip; <a href=\"https:\/\/ybzx.vip\/wp\/?p=328\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u5206\u6790SELinux\u65e5\u5fd7\uff0c\u6392\u9664SELinux\u7591\u96be<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[117],"tags":[79,78,87],"class_list":["post-328","post","type-post","status-publish","format-standard","hentry","category-network","tag-centos","tag-linux","tag-selinux"],"_links":{"self":[{"href":"https:\/\/ybzx.vip\/wp\/index.php?rest_route=\/wp\/v2\/posts\/328","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ybzx.vip\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ybzx.vip\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ybzx.vip\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ybzx.vip\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=328"}],"version-history":[{"count":0,"href":"https:\/\/ybzx.vip\/wp\/index.php?rest_route=\/wp\/v2\/posts\/328\/revisions"}],"wp:attachment":[{"href":"https:\/\/ybzx.vip\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=328"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ybzx.vip\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=328"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ybzx.vip\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=328"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}