{"id":776,"date":"2013-05-23T12:00:51","date_gmt":"2013-05-23T03:00:51","guid":{"rendered":"http:\/\/www.nightmare-yk.com\/?p=776"},"modified":"2016-02-24T08:15:03","modified_gmt":"2016-02-23T23:15:03","slug":"selinux%e3%83%9d%e3%83%aa%e3%82%b7%e3%83%bc%e8%bf%bd%e5%8a%a0","status":"publish","type":"post","link":"http:\/\/www.nightmare-yk.com\/?p=776","title":{"rendered":"SELinux \u30dd\u30ea\u30b7\u30fc\u30e2\u30b8\u30e5\u30fc\u30eb\u4f5c\u6210"},"content":{"rendered":"<p>\u4e45\u3005\u306e\u66f4\u65b0\u306b\u306a\u308a\u307e\u3059\u3002\u3044\u308d\u3044\u308d\u306a\u6280\u8853\u306b\u89e6\u308c\u308b\u6a5f\u4f1a\u304c\u591a\u3044\u306e\u306b\u5c55\u958b\u3067\u304d\u306a\u304f\u3066\u3002\u3002\u3002<\/p>\n<p>SELinux\u306e\u8a2d\u5b9a\u3092\u3057\u3066\u3044\u308b\u3068\u304d\u306b\u3001\u306f\u307e\u3063\u305f\u3053\u3068\u3067\u3059\u3002\u4eca\u5f8c\u306f\u307e\u3089\u306a\u3044\u3088\u3046\u306b\u3059\u308b\u305f\u3081\u306b\u3082\u66f8\u304d\u307e\u3059\u3002<\/p>\n<p>\u3042\u308b\u30b5\u30fc\u30d0\u3092\u898b\u3066\u307f\u308b\u3068\u3001SELinux\u306e\u30a8\u30e9\u30fc\u304c\u51fa\u529b\u3055\u308c\u3066\u304a\u308a\u307e\u3057\u305f\u3002<br \/>\nSELinux\u306e\u30dd\u30ea\u30b7\u30fc\u3092\u8ffd\u52a0\u3057\u3066\u5bfe\u5fdc\u3057\u3001\u30a8\u30e9\u30fc\u306f\u51fa\u529b\u3055\u308c\u306a\u3044\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u304c\u3001\u52d5\u4f5c\u3057\u306a\u3044\u3002\u306a\u305c\u3060&#8230;<br \/>\n\u304b\u306a\u308a\u306f\u307e\u3063\u305f\u306e\u3067\u3001\u30dd\u30ea\u30b7\u30fc\u8ffd\u52a0\u3068\u5408\u308f\u305b\u3066\u30e1\u30e2\u30e1\u30e2\u3006(.. )<\/p>\n<p>\u539f\u56e0\u306f\u300cdontaudit\u300d\u3067\u3057\u305f\u3002SELinux\u306e\u6a5f\u80fd\u3068\u3057\u3066\u3001\u30ed\u30b0\u51fa\u529b\u6291\u6b62\u30eb\u30fc\u30eb\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u3053\u306e\u6a5f\u80fd\u306fon\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002\u30eb\u30fc\u30eb\u306b\u3088\u308a\u8a31\u53ef\u3055\u308c\u306a\u304b\u3063\u305f\u30a2\u30af\u30bb\u30b9\u306f\u62d2\u5426\u3055\u308c\u30ed\u30b0\u306b\u8a18\u9332\u3055\u308c\u308b\u306e\u3067\u3059\u304c\u3001dontaudit \u30eb\u30fc\u30eb\u3067\u5b9a\u3081\u3089\u308c\u305f\u30a2\u30af\u30bb\u30b9\u306b\u3064\u3044\u3066\u306f\u30a2\u30af\u30bb\u30b9\u304c\u62d2\u5426\u3055\u308c\u3066\u3082\u30ed\u30b0\u306b\u8a18\u9332\u3055\u308c\u306a\u3044\u306e\u3067\u3059\u3002<br \/>\n\u77e5\u3089\u3093\u304b\u3063\u305f\u308f\u30fcw(\uffe3\u0414\uffe3;)w<\/p>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u6a5f\u80fd\u3092off\u306b\u3057\u307e\u3059\u3002<\/p>\n<table style=\"table-layout:fixed;\">\n<tr>\n<td>\n<div style=\"overflow-x:auto;\">\n<pre># semanage dontaudit off<\/pre>\n<\/p><\/div>\n<\/td>\n<\/tr>\n<\/table>\n<p>&nbsp;<\/p>\n<p>\u305d\u306e\u5f8c\u306f\u30ed\u30b0\u3092\u78ba\u8a8d\u3057\u3066\u30dd\u30ea\u30b7\u30fc\u306e\u8ffd\u52a0\u3092\u3059\u308b\u306e\u3067\u3059\u304c\u3001\u3084\u308a\u65b9\u3092\u4ee5\u4e0b\u306b\u66f8\u304d\u307e\u3059\u3002<br \/>\n\u306a\u304b\u306a\u304b\u3084\u308b\u6a5f\u4f1a\u304c\u306a\u3044\u3068\u3001\u5fd8\u308c\u3066\u3057\u307e\u3046\u3093\u3067\u3059\u3088\u306d\u30fb\u30fb\u30fb\u3002<\/p>\n<p>\u307e\u305a\u306f\u3001SELinux\u306e\u62d2\u5426\u3055\u308c\u3066\u3044\u308b\u30ed\u30b0\u304b\u3089\u3001\u30a2\u30af\u30bb\u30b9\u306e\u30eb\u30fc\u30eb\u3092\u4f5c\u308a\u307e\u3059\u3002<\/p>\n<table style=\"table-layout:fixed;\">\n<tr>\n<td>\n<div style=\"overflow-x:auto;\">\n<pre>$ cat \/var\/log\/audit\/audit.log | audit2allow -m test_module >  test_module.te<\/pre>\n<\/p><\/div>\n<\/td>\n<\/tr>\n<\/table>\n<p>&nbsp;<\/p>\n<p>\u4e2d\u8eab\u3092\u898b\u3066\u307f\u308b\u3068\u3001\u3053\u3093\u306a\u611f\u3058\u3067\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3084\u3089\u30d5\u30a1\u30a4\u30eb\u3084\u3089\u306e\u66f8\u304d\u8fbc\u307f\u6a29\u9650\u3084\u524a\u9664\u6a29\u9650\u304c\u66f8\u304b\u308c\u3066\u3044\u307e\u3059\u306d\uff01<\/p>\n<table style=\"table-layout:fixed;\">\n<tr>\n<td>\n<div style=\"overflow-x:auto;\">\n<pre>$ cat test_module.te\r\n\uff5e\r\nmodule test_module 1.0;\r\n\r\nrequire {\r\n        type httpd_t;\r\n        type usr_t;\r\n        class dir { write remove_name add_name };\r\n        class file { rename unlink };\r\n}\r\n\r\n#============= httpd_t ==============\r\nallow httpd_t usr_t:dir { write remove_name add_name };\r\nallow httpd_t usr_t:file { rename unlink };<\/pre>\n<\/p><\/div>\n<\/td>\n<\/tr>\n<\/table>\n<p>&nbsp;<\/p>\n<p>\u624b\u52d5\u3067\u30b3\u30f3\u30d1\u30a4\u30eb\u3057\u307e\u3059\u3002<\/p>\n<table style=\"table-layout:fixed;\">\n<tr>\n<td>\n<div style=\"overflow-x:auto;\">\n<pre>$ checkmodule -M -m -o test_module.mod test_module.te\r\ncheckmodule:  loading policy configuration from test_module.te\r\ncheckmodule:  policy configuration loaded\r\ncheckmodule:  writing binary representation (version 10) to test_module.mod<\/pre>\n<\/p><\/div>\n<\/td>\n<\/tr>\n<\/table>\n<p>&nbsp;<\/p>\n<p>\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002.pp\u30d5\u30a1\u30a4\u30eb\u304c\u30d1\u30c3\u30b1\u30fc\u30b8\u3067\u3059\u306d\u266a<\/p>\n<table style=\"table-layout:fixed;\">\n<tr>\n<td>\n<div style=\"overflow-x:auto;\">\n<pre>$ semodule_package -o test_module.pp -m test_module.mod<\/pre>\n<\/p><\/div>\n<\/td>\n<\/tr>\n<\/table>\n<p>&nbsp;<\/p>\n<p>\u3084\u3063\u3066\u307f\u308b\u3068\u6848\u5916\u7c21\u5358\u3067\u3059\uff01\uff01<br \/>\n\u6700\u5f8c\u306b\u4f5c\u6210\u3057\u305f\u30dd\u30ea\u30b7\u30fc\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002\u5c11\u3005\u6642\u9593\u304c\u304b\u304b\u308a\u307e\u3059\u306e\u3067\u3001\u304a\u8336\u3067\u3082\u98f2\u3093\u3067\u5f85\u3061\u307e\u3057\u3087\u3046\uff01\uff01<\/p>\n<table style=\"table-layout:fixed;\">\n<tr>\n<td>\n<div style=\"overflow-x:auto;\">\n<pre># semodule -i test_module.pp<\/pre>\n<\/p><\/div>\n<\/td>\n<\/tr>\n<\/table>\n<p>&nbsp;<\/p>\n<p>\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u3092\u4e00\u89a7\u3092\u8868\u793a\u3057\u3066\u78ba\u8a8d\u3057\u307e\u3059\u3002\u4eca\u56de\u4f5c\u6210\u3057\u305ftest_module\u304c\u3042\u308c\u3070\u6210\u529f\u3067\u3059\u3002<\/p>\n<table style=\"table-layout:fixed;\">\n<tr>\n<td>\n<div style=\"overflow-x:auto;\">\n<pre># semodule -l | grep test_module\r\ntest_module     1.0<\/pre>\n<\/p><\/div>\n<\/td>\n<\/tr>\n<\/table>\n<p>&nbsp;<\/p>\n<p>\u306f\u307e\u3063\u3066\u3044\u308b\u65b9\u306f\u8a66\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002\u305f\u3060\u3001\u3080\u3084\u307f\u306bSELinux\u306e\u30eb\u30fc\u30eb\u3092\u8a31\u53ef\u306b\u3059\u308b\u306e\u306f\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u7684\u306b\u3042\u308c\u3067\u3059\u306e\u3067\u3001\u5fc5\u8981\u306a\u8a2d\u5b9a\u3092\u7cbe\u67fb\u3057\u3066\u8a31\u53ef\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u306d\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u3001SELinux\u306e\u30ed\u30b0\u3092\u8aad\u307f\u8fbc\u3093\u3067\u4e00\u6c17\u306b\u30d1\u30c3\u30b1\u30fc\u30b8\u304c\u4f5c\u308c\u307e\u3059\u3002<\/p>\n<table style=\"table-layout:fixed;\">\n<tr>\n<td>\n<div style=\"overflow-x:auto;\">\n<pre># audit2allow -M test_module < \/var\/log\/audit\/audit.log<\/pre>\n<\/p><\/div>\n<\/td>\n<\/tr>\n<\/table>\n<p>&nbsp;<\/p>\n<div class='wp_social_bookmarking_light'>\n            <div class=\"wsbl_facebook_like\"><div id=\"fb-root\"><\/div><fb:like href=\"http:\/\/www.nightmare-yk.com\/?p=776\" layout=\"button_count\" action=\"like\" width=\"100\" share=\"false\" show_faces=\"false\" ><\/fb:like><\/div>\n            <div class=\"wsbl_google_plus_one\"><g:plusone size=\"medium\" annotation=\"none\" href=\"http:\/\/www.nightmare-yk.com\/?p=776\" ><\/g:plusone><\/div>\n    <\/div>\n<br class='wp_social_bookmarking_light_clear' \/>\n","protected":false},"excerpt":{"rendered":"<p>\u4e45\u3005\u306e\u66f4\u65b0\u306b\u306a\u308a\u307e\u3059\u3002\u3044\u308d\u3044\u308d\u306a\u6280\u8853\u306b\u89e6\u308c\u308b\u6a5f\u4f1a\u304c\u591a\u3044\u306e\u306b\u5c55\u958b\u3067\u304d\u306a\u304f\u3066\u3002\u3002\u3002 SELinux\u306e\u8a2d\u5b9a\u3092\u3057\u3066\u3044\u308b\u3068\u304d\u306b\u3001\u306f\u307e\u3063\u305f\u3053\u3068\u3067\u3059\u3002\u4eca\u5f8c\u306f\u307e\u3089\u306a\u3044\u3088\u3046\u306b\u3059\u308b\u305f\u3081\u306b\u3082\u66f8\u304d\u307e\u3059\u3002 \u3042\u308b\u30b5\u30fc\u30d0\u3092\u898b\u3066\u307f\u308b\u3068\u3001SELinux\u306e\u30a8\u30e9\u30fc\u304c\u51fa\u529b\u3055\u308c\u3066\u304a\u308a\u307e\u3057\u305f\u3002 SELinux\u306e\u30dd\u30ea\u30b7\u30fc\u3092\u8ffd\u52a0\u3057\u3066\u5bfe\u5fdc\u3057\u3001\u30a8\u30e9\u30fc [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[3],"tags":[22,95],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"http:\/\/www.nightmare-yk.com\/index.php?rest_route=\/wp\/v2\/posts\/776"}],"collection":[{"href":"http:\/\/www.nightmare-yk.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.nightmare-yk.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.nightmare-yk.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.nightmare-yk.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=776"}],"version-history":[{"count":13,"href":"http:\/\/www.nightmare-yk.com\/index.php?rest_route=\/wp\/v2\/posts\/776\/revisions"}],"predecessor-version":[{"id":1910,"href":"http:\/\/www.nightmare-yk.com\/index.php?rest_route=\/wp\/v2\/posts\/776\/revisions\/1910"}],"wp:attachment":[{"href":"http:\/\/www.nightmare-yk.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=776"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.nightmare-yk.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=776"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.nightmare-yk.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=776"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}