{"id":18139,"date":"2013-12-30T07:06:23","date_gmt":"2013-12-29T23:06:23","guid":{"rendered":"https:\/\/2blog.ilc.edu.tw\/25793\/2013\/12\/30\/squid-proxy-server-selinux\/"},"modified":"2013-12-30T07:06:23","modified_gmt":"2013-12-29T23:06:23","slug":"squid-proxy-server-selinux","status":"publish","type":"post","link":"https:\/\/2blog.ilc.edu.tw\/25793\/2013\/12\/30\/squid-proxy-server-selinux\/","title":{"rendered":"squid Proxy Server &amp; SELinux"},"content":{"rendered":"<p>\u91cd\u65b0\u5b89\u88dd\u4e86\u4e4b\u524d\u786c\u789f\u6545\u969c\u7684 Proxy Server\uff0c\u7cfb\u7d71\u5b89\u88dd\u5b8c\u5f8c\uff0c\u8907\u88fd\u4e4b\u524d\u5099\u4efd\u7684\u8a2d\u5b9a\u6a94\u5f8c\uff0c\u91cd\u65b0\u555f\u52d5 Proxy Server\u00a0\u5f8c\uff0c\u767c\u73fe\u7121\u6cd5\u555f\u52d5 Proxy Server<br \/># <span style=\"color: #ff0000;\">service squid start<\/span><br \/><span style=\"color: #0000ff;\">\u6b63\u5728\u555f\u52d5 squid\uff1a\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 [\u5931\u6557]<\/span><br \/><span style=\"color: #0000ff;\">2013\/12\/27 13:59:21| Processing Configuration File: \/etc\/squid\/squid.conf (depth 0)<\/span><br \/><span style=\"color: #0000ff;\">FATAL: Unable to open configuration file: \/etc\/squid\/squid.conf: (13) Permission denied<\/span><br \/><span style=\"color: #0000ff;\">Squid Cache (Version 3.1.10): Terminated abnormally.<\/span><br \/><span style=\"color: #0000ff;\">CPU Usage: 0.009 seconds = 0.005 user + 0.004 sys<\/span><br \/><span style=\"color: #0000ff;\">Maximum Resident Size: 22736 KB<\/span><br \/><span style=\"color: #0000ff;\">Page faults with physical i\/o: 0<\/span>[@more@]\u6aa2\u67e5 \/etc\/squid\/squid.conf\u00a0\u7684\u6a94\u6848\u6b0a\u9650<br \/># <span style=\"color: #ff0000;\">ls -l \/etc\/squid\/squid.conf*<\/span><br \/><span style=\"color: #0000ff;\">-rw-r&#8212;&#8211;. 1 root root 4399 2013-11-19 00:48 \/etc\/squid\/squid.conf<\/span><br \/><span style=\"color: #0000ff;\">-rw-r&#8212;&#8211;. 1 root squid 2510 2013-10-01 21:44 \/etc\/squid\/squid.conf.bak<\/span><\/p>\n<p>\u6240\u5c6c\u7fa4\u7d44\u4f3c\u4e0d\u540c<br \/># <span style=\"color: #ff0000;\">chown root:squid \/etc\/squid\/squid.conf<\/span><br \/>#<span style=\"color: #ff0000;\"> ls -l \/etc\/squid\/squid.conf*<\/span><br \/><span style=\"color: #0000ff;\">-rw-r&#8212;&#8211;. 1 root squid 4399 2013-11-19 00:48 \/etc\/squid\/squid.conf<\/span><br \/><span style=\"color: #0000ff;\">-rw-r&#8212;&#8211;. 1 root squid 2510 2013-10-01 21:44 \/etc\/squid\/squid.conf.bak<\/span><\/p>\n<p>\u4f46\u9084\u662f\u7121\u6cd5\u555f\u52d5<br \/># service squid start<br \/><span style=\"color: #0000ff;\">\u6b63\u5728\u555f\u52d5 squid\uff1a\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 [\u5931\u6557]<\/span><br \/><span style=\"color: #0000ff;\">2013\/12\/27 13:59:21| Processing Configuration File: \/etc\/squid\/squid.conf (depth 0)<\/span><br \/><span style=\"color: #0000ff;\">FATAL: Unable to open configuration file: \/etc\/squid\/squid.conf: (13) Permission denied<\/span><br \/><span style=\"color: #0000ff;\">Squid Cache (Version 3.1.10): Terminated abnormally.<\/span><br \/><span style=\"color: #0000ff;\">CPU Usage: 0.009 seconds = 0.005 user + 0.004 sys<\/span><br \/><span style=\"color: #0000ff;\">Maximum Resident Size: 22736 KB<\/span><br \/><span style=\"color: #0000ff;\">Page faults with physical i\/o: 0<\/span><\/p>\n<p>\u5f8c\u4f86\u767c\u73fe\u53ef\u80fd\u662f SELinux\u00a0\u7684\u554f\u984c\uff0c\u6b0a\u9650\u4e0d\u5c0d<br \/>#\u00a0<span style=\"color: #ff0000;\"> ls -lZ \/etc\/squid\/squid.conf*<\/span><br \/><span style=\"color: #0000ff;\">-rw-r&#8212;&#8211;. root squid <span style=\"color: #ff0000;\">unconfined_u:object_r:admin_home_t:s0<\/span> \/etc\/squid\/squid.conf<\/span><br \/><span style=\"color: #0000ff;\">-rw-r&#8212;&#8211;. root squid <span style=\"color: #ff0000;\">system_u:object_r:squid_cache_t:s0<\/span> \/etc\/squid\/squid.conf.bak<\/span><\/p>\n<p>\u66f4\u6539\u6210\u6b63\u78ba\u7684\u5c6c\u6027<br \/># <span style=\"color: #ff0000;\">chcon -R -u system_u -t squid_conf_t \/etc\/squid\/squid.conf<\/span><\/p>\n<p>\u518d\u6b21\u6aa2\u67e5\u5c6c\u6027<br \/>#<span style=\"color: #ff0000;\"> ls -lZ \/etc\/squid\/squid.conf*<\/span><br \/><span style=\"color: #0000ff;\">-rw-r&#8212;&#8211;. root squid system_u:object_r:squid_conf_t:s0 \/etc\/squid\/squid.conf<\/span><br \/><span style=\"color: #0000ff;\">-rw-r&#8212;&#8211;. root squid system_u:object_r:squid_conf_t:s0 \/etc\/squid\/squid.conf.bak<\/span><\/p>\n<p>\u539f\u672c Squid Proxy Server Cache\u00a0\u76ee\u9304\u6b0a\u9650<br \/>#\u00a0 <span style=\"color: #ff0000;\">ls -lZ \/cache1\/* | head<\/span><br \/><span style=\"color: #0000ff;\">\/cache1\/00:<\/span><br \/><span style=\"color: #0000ff;\">drwxr-x&#8212;. squid squid system_u:object_r:default_t:s0\u00a0\u00a0 00\/<\/span><br \/><span style=\"color: #0000ff;\">drwxr-x&#8212;. squid squid system_u:object_r:default_t:s0\u00a0\u00a0 01\/<\/span><br \/><span style=\"color: #0000ff;\">drwxr-x&#8212;. squid squid system_u:object_r:default_t:s0\u00a0\u00a0 02\/<\/span><br \/><span style=\"color: #0000ff;\">drwxr-x&#8212;. squid squid system_u:object_r:default_t:s0\u00a0\u00a0 03\/<\/span><br \/><span style=\"color: #0000ff;\">drwxr-x&#8212;. squid squid system_u:object_r:default_t:s0\u00a0\u00a0 04\/<\/span><br \/><span style=\"color: #0000ff;\">drwxr-x&#8212;. squid squid system_u:object_r:default_t:s0\u00a0\u00a0 05\/<\/span><br \/><span style=\"color: #0000ff;\">drwxr-x&#8212;. squid squid system_u:object_r:default_t:s0\u00a0\u00a0 06\/<\/span><br \/><span style=\"color: #0000ff;\">drwxr-x&#8212;. squid squid system_u:object_r:default_t:s0\u00a0\u00a0 07\/<\/span><br \/><span style=\"color: #0000ff;\">drwxr-x&#8212;. squid squid system_u:object_r:default_t:s0\u00a0\u00a0 08\/<\/span><\/p>\n<p>\u66f4\u6539\u6210\u6b63\u78ba\u7684\u5c6c\u6027<br \/># <span style=\"color: #ff0000;\">chcon -R -u system_u -t squid_cache_t \/cache1<\/span><\/p>\n<p>\u518d\u6b21\u6aa2\u67e5\u5c6c\u6027<br \/>#\u00a0 <span style=\"color: #ff0000;\">ls -lZ \/cache1\/* | head<\/span><br \/><span style=\"color: #0000ff;\">\/cache1\/00:<\/span><br \/><span style=\"color: #0000ff;\">drwxr-x&#8212;. squid squid system_u:object_r:squid_cache_t:s0 00\/<\/span><br \/><span style=\"color: #0000ff;\">drwxr-x&#8212;. squid squid system_u:object_r:squid_cache_t:s0 01\/<\/span><br \/><span style=\"color: #0000ff;\">drwxr-x&#8212;. squid squid system_u:object_r:squid_cache_t:s0 02\/<\/span><br \/><span style=\"color: #0000ff;\">drwxr-x&#8212;. squid squid system_u:object_r:squid_cache_t:s0 03\/<\/span><br \/><span style=\"color: #0000ff;\">drwxr-x&#8212;. squid squid system_u:object_r:squid_cache_t:s0 04\/<\/span><br \/><span style=\"color: #0000ff;\">drwxr-x&#8212;. squid squid system_u:object_r:squid_cache_t:s0 05\/<\/span><br \/><span style=\"color: #0000ff;\">drwxr-x&#8212;. squid squid system_u:object_r:squid_cache_t:s0 06\/<\/span><br \/><span style=\"color: #0000ff;\">drwxr-x&#8212;. squid squid system_u:object_r:squid_cache_t:s0 07\/<\/span><br \/><span style=\"color: #0000ff;\">drwxr-x&#8212;. squid squid system_u:object_r:squid_cache_t:s0 08\/<\/span><\/p>\n<p>\u5c31\u53ef\u4ee5\u6b63\u5e38\u555f\u52d5 Proxy Server\u00a0\u4e86\uff01<br \/># <span style=\"color: #ff0000;\">service squid start<\/span><br \/><span style=\"color: #0000ff;\">\u6b63\u5728\u555f\u52d5 squid\uff1a.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 [\u00a0 \u78ba\u5b9a\u00a0 ]<\/span><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u91cd\u65b0\u5b89\u88dd\u4e86\u4e4b\u524d\u786c\u789f\u6545\u969c\u7684 Proxy Server\uff0c\u7cfb\u7d71\u5b89\u88dd\u5b8c\u5f8c\uff0c\u8907\u88fd\u4e4b\u524d\u5099\u4efd\u7684\u8a2d\u5b9a\u6a94\u5f8c\uff0c\u91cd\u65b0\u555f\u52d5 Proxy &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/2blog.ilc.edu.tw\/25793\/2013\/12\/30\/squid-proxy-server-selinux\/\" class=\"more-link\">\u95b1\u8b80\u5168\u6587<span class=\"screen-reader-text\">\u3008squid Proxy Server &amp; SELinux\u3009<\/span><\/a><\/p>\n","protected":false},"author":55,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[135,136],"tags":[],"class_list":["post-18139","post","type-post","status-publish","format-standard","hentry","category-c-78480","category-c-78481"],"meta_key":{"_encloseme":["1"],"lt_post_id":["468447"]},"_links":{"self":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts\/18139"}],"collection":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/users\/55"}],"replies":[{"embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/comments?post=18139"}],"version-history":[{"count":0,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts\/18139\/revisions"}],"wp:attachment":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/media?parent=18139"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/categories?post=18139"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/tags?post=18139"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}