{"id":930,"date":"2016-04-03T23:13:35","date_gmt":"2016-04-03T14:13:35","guid":{"rendered":"http:\/\/darkgray.homelinux.com\/modules\/xpress\/?p=930"},"modified":"2016-04-03T23:13:35","modified_gmt":"2016-04-03T14:13:35","slug":"iptables%e3%81%8b%e3%82%89firewalld%e3%81%b8","status":"publish","type":"post","link":"https:\/\/darkgray.homelinux.com\/blog\/?p=930","title":{"rendered":"iptables\u304b\u3089firewalld\u3078"},"content":{"rendered":"<p>\u9577\u5e74\u3000\u30b5\u30fc\u30d0\u306e\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u306b\u306fiptables\u3092\u4f7f\u3063\u3066\u304d\u305f\u3002SentOS7\u3067\u306f\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u306fiptables\u3067\u306f\u306a\u304ffirewalld\u304c\u6a19\u6e96\u3067\u4f7f\u7528\u3055\u308c\u308b\u3002\u305d\u3053\u3067\u9577\u5e74\u611b\u7528\u3057\u3066\u304d\u305fiptables\u3092\u6b62\u3081\u3066\u3000firewalld\u3092\u8a66\u3057\u3066\u307f\u305f\u3002<\/p>\n<p>\n<!--more--><\/p>\n<p>\u53c2\u7167URL\uff1a<a href=\"https:\/\/centossrv.com\/iptables.shtml\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/centossrv.com\/iptables.shtml<\/a><br \/>\niptables\u306e\u8a2d\u5b9a\u306f\u3000\u4e0a\u306e\u53c2\u7167\u5148\u306e\u8a2d\u5b9a\u3092\u307b\u307c\u305d\u306e\u307e\u307e\u5229\u7528\u3055\u305b\u3066\u3082\u3089\u3063\u3066\u3044\u305f\u3002\u3053\u306eiptebles\u306e\u8a2d\u5b9a\u3067\u6c17\u306b\u5165\u3063\u3066\u308b\u306e\u306f\u3000\u602a\u3057\u3044\u56fdor\u5371\u306a\u3044\u56fd\u304b\u3089\u306e\u30a2\u30af\u30bb\u30b9\u3092\u30b7\u30e3\u30c3\u30bf\u30a2\u30a6\u30c8\u3067\u304d\u308b\u6240\u3060\u3002firewalld\u3067\u3082\u3053\u306e\u6a5f\u80fd\u306f\u4f7f\u3044\u305f\u3044\u3002\u8abf\u3079\u3066\u307f\u308b\u3068ipset\u306a\u308b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092firewalld\u3068\u7d44\u307f\u5408\u308f\u305b\u3066\u4f7f\u3046\u3068\u51fa\u6765\u308b\u3089\u3057\u3044\u3002ipset\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\uff06\u4f7f\u7528\u65b9\u6cd5\u306f\u5f8c\u65e5\u5225\u8a18\u4e8b\u3067\u7d39\u4ecb\u3059\u308b\u3068\u3057\u3066\u4eca\u65e5\u306ffirewalld\u3092\u53d6\u308a\u3042\u3048\u305a\u4f7f\u3063\u3066\u307f\u308b\u6240\u307e\u3067\u7d39\u4ecb\u3059\u308b\u3002<\/p>\n<hr \/>\n<p><strong><span style=\"color: #ff0000;\">\u6ce8\uff1a\u3000<\/span><\/strong>\u3000\u3053\u306e\u8a18\u4e8b\u306e\u5185\u5bb9\u3092\uff11\uff10\uff10\uff05\u4fe1\u7528\u3057\u306a\u3044\u3088\u3046\u306b\uff01\u3000\u6211\u304c\u5bb6\u306e\u30b5\u30fc\u30d0\u306e\u4ed5\u69d8\u306f\u3000CentOS7 + yum\u306f\u30d9\u30fc\u30b9\u30ea\u30dd\u30b8\u30c8\u30ea\u306b\u52a0\u3048\u3000epel\u00a0\u3068rpmforge\u306e\u30ea\u30dd\u30b8\u30c8\u30ea\u304c\u8ffd\u52a0\u3055\u308c\u3066\u81ea\u52d5\u7684\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u304d\u308b\u3088\u3046\u306b\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u3002\u3000Linux\u3084\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3084\u3000yum\u306e\u30ea\u30dd\u30b8\u30c8\u30ea\u306e\u8a2d\u5b9a\u306e\u9055\u3044\u306a\u3069\u306b\u3088\u308a\u3000\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u65b9\u6cd5\u3084\u4f7f\u7528\u65b9\u6cd5\u306f\u9055\u3063\u3066\u304f\u308b\u30fb\u30fb\u30fb\u3000\u304b\u3082\u3057\u308c\u306a\u3044\u3002<\/p>\n<hr \/>\n<p>\u30fbiptables\u306e\u30a2\u30f3\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3068firewalld\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\uff0b\u5b9f\u884c<\/p>\n<p>\u307e\u305a\u306f\u4eca\u307e\u3067\u4f7f\u3063\u3066\u304d\u305fiptables\u3092\u30a2\u30f3\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u306e\u3060\u304c\u3001\u6b63\u78ba\u306b\u306fiptables\u3092\u5236\u5fa1\u3059\u308biptables-service\u3068\u3044\u3046\u30a2\u30d7\u30ea\u3092\u524a\u9664\u3059\u308b\u3002iptables\u305d\u306e\u7269\u3092\u524a\u9664\u3057\u3066\u306f\u3044\u3051\u306a\u3044\u3002\u5b9f\u969b\u306e\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u306f\u4eca\u73fe\u5728\u3082iptables\u3067\u884c\u308f\u308c\u3066\u3044\u3066firewalld\u3067\u5236\u5fa1\u3057\u3066\u3044\u308b\u3002<\/p>\n<p>[bash]<br \/>\n[]# systemctl disable  iptables.service<br \/>\n[]# systemctl stop  iptables.service<br \/>\n[]# yum erase iptables-service<br \/>\n[\/bash]<\/p>\n<p>\u6b21\u306bfirewalld\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3002\u305f\u3076\u3093CentOS\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u72b6\u614b\u3067\u3000\u65e2\u306bfirewalld\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u308b\u3068\u601d\u3046\u304c\u3000\u3053\u3053\u3067\u306f\u3053\u3053\u3067\u306f\u5168\u304f\u4f55\u3082\u306a\u3044\u72b6\u614b\u304b\u3089\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u8d77\u52d5\u3059\u308b\u307e\u3067\u306e\u60c5\u5831\u3092\u66f8\u3044\u3066\u304a\u304f\u3002<\/p>\n<p>[bash]<br \/>\n[]# yum install firewalld<br \/>\n[]# systemctl start firewalld<br \/>\n[]# systemctl enable firewalld<br \/>\n[\/bash]<\/p>\n<p>\u7279\u306b\u4f55\u3082\u8a2d\u5b9a\u3057\u306a\u304f\u3066\u3082\u3000\u3053\u306e\u72b6\u614b\u3067\u3059\u3079\u3066\u306e\u30dd\u30fc\u30c8\u3092\u9589\u3058\u3066 dhcpv6-client,ssh\u306e\u4e8c\u3064\u306e\u30dd\u30fc\u30c8\u3092\u5f85\u3061\u53d7\u3051\u72b6\u614b\u306b\u306a\u308b\u3002\u3053\u306e\u72b6\u6cc1\u306e\u78ba\u8a8d\u3084\u8a2d\u5b9a\u306f\u3000firewall-cmd\u30b3\u30de\u30f3\u30c9\u3067\u3067\u304d\u308b\u3002<\/p>\n<p>[bash]<br \/>\n[]# firewall-cmd &#8211;list-all<br \/>\npublic (default, active)<br \/>\n  interfaces: enp0s3<br \/>\n  sources:<br \/>\n  services: dhcpv6-client ssh<br \/>\n  ports:<br \/>\n  masquerade: no<br \/>\n  forward-ports:<br \/>\n  icmp-blocks:<br \/>\n  rich rules: <\/p>\n<p>[]#<br \/>\n[\/bash]<\/p>\n<p>\u3055\u3089\u306bwww,\u30e1\u30fc\u30eb\u7b49\u306e\u5fc5\u8981\u306a\u30dd\u30fc\u30c8\u3092\u958b\u3051\u3066\u3084\u308b\u3002(\u30e1\u30fc\u30eb\u95a2\u4fc2\u306f\u5168\u3066SSL\u3067\u6697\u53f7\u5316\u3057\u305f\u30dd\u30fc\u30c8\u3092\u958b\u3051\u3066\u3044\u308b\u3002)<\/p>\n<p>[bash]<br \/>\n[]# firewall-cmd &#8211;permanent &#8211;add-service=http<br \/>\nsuccess<br \/>\n[]# firewall-cmd &#8211;permanent &#8211;add-service=https<br \/>\nsuccess<br \/>\n[]# firewall-cmd &#8211;permanent &#8211;add-service=smtps<br \/>\nError: INVALID_SERVICE: smtps<br \/>\n[]# firewall-cmd &#8211;permanent &#8211;add-service=pop3s<br \/>\nsuccess<br \/>\n[]# firewall-cmd &#8211;permanent &#8211;add-service=imaps<br \/>\nsuccess<br \/>\n[]# firewall-cmd &#8211;reload<br \/>\n[\/bash]<\/p>\n<p>\u6700\u5f8c\u306e&#8211;reload\u306e\u30b3\u30de\u30f3\u30c9\u3067\u3000\u8a2d\u5b9a\u304c\u53cd\u6620\u3055\u308c\u308b\u3002\u3000\u305f\u3060\u3057\u300csmtps\u3068\u3044\u3046\u30b5\u30fc\u30d3\u30b9\u304c\u5b58\u5728\u3057\u3066\u306a\u3044\u300d\u3063\u3066\u8a00\u3063\u3066\u308b\u306e\u3067\u3000\u3053\u308c\u3060\u3051smtp\u7528\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u4fee\u6b63\u3057\u3066\u767b\u9332\u3059\u308b\u3002<\/p>\n<p>[bash]<br \/>\n[root@lakhes services]# cp \/usr\/lib\/firewalld\/services\/smtp.xml \/etc\/firewalld\/services\/smtps.xml<br \/>\n[root@lakhes services]# vi \/etc\/firewalld\/services\/smtps.xml<br \/>\n[\/bash]<\/p>\n<p>\u3067\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5185\u5bb9\u3092\u4fee\u6b63\u3059\u308b\u3002\u30dd\u30fc\u30c8\u3092465\u306b\u4fee\u6b63\u3057\u3066\u3042\u308c\u3070\u3000\u540d\u524d\u3068\u304b\u8aac\u660e\u306f\u3069\u3046\u3067\u3082\u3044\u3044\u3002<\/p>\n<p>[code]<br \/>\n&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br \/>\n&lt;service&gt;<br \/>\n  &lt;short&gt;Mail (SMTPs)&lt;\/short&gt;<br \/>\n  &lt;description&gt;This option allows incoming SMTP mail delivery. If you need to allow remote hosts to connect directly to your machine to deliver mail, enable this option. You do not need to enable this if you collect your mail from your ISP&#8217;s server by POP3 or IMAP, or if you use a tool such as fetchmail. Note that an improperly configured SMTP server can allow remote machines to use your server to send spam.&lt;\/description&gt;<br \/>\n  &lt;port protocol=&quot;tcp&quot; port=&quot;465&quot;\/&gt;<br \/>\n&lt;\/service&gt;<br \/>\n[\/code]<\/p>\n<p>\u30d5\u30a1\u30a4\u30eb\u306e\u4fee\u6b63\u304c\u3067\u304d\u305f\u3089\u3000\u3082\u3046\u4e00\u5ea6\u3000smtps\u3092\u767b\u9332\u3057\u3066\u307f\u308b\u3002\u3067\u3000\u3061\u3083\u3093\u3068\u767b\u9332\u3067\u304d\u305f\u304b\u3069\u3046\u304b\u78ba\u8a8d\u3057\u3066\u307f\u308b\u3002<\/p>\n<p>[bash]<br \/>\n[]# firewall-cmd &#8211;permanent &#8211;add-service=smtps<br \/>\nsuccess<br \/>\n[]# firewall-cmd &#8211;reload<br \/>\n[]# firewall-cmd &#8211;list-all<br \/>\npublic (default, active)<br \/>\n  interfaces: enp0s3<br \/>\n  sources:<br \/>\n  services: dhcpv6-client http https imaps pop3s smtps ssh<br \/>\n  ports:<br \/>\n  masquerade: no<br \/>\n  forward-ports:<br \/>\n  icmp-blocks:<br \/>\n  rich rules: <\/p>\n<p>[]#<br \/>\n[\/bash]<\/p>\n<p>\u3053\u308c\u3067\u57fa\u672c\u7684\u306a\u8a2d\u5b9a\u306f\u3067\u304d\u305f\u3093\u3058\u3083\u306a\u3044\u304b\u306a\uff1f\u3000\u56de\u7dda\u5165\u308a\u53e3\u306e\u30eb\u30fc\u30bf\u30fc\u3067\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u3055\u308c\u3066\u3044\u308b\u306e\u3067firewalld\u306f\u7121\u304f\u3066\u3082\u826f\u3044\u3063\u3061\u3083\u826f\u3044\u3093\u3060\u304c\u30fb\u30fb\u30fb\u3000\u9632\u58c1\u3092\uff12\u91cd\u306b\u3057\u3066\u304a\u3051\u3070\u5c11\u3057\u306f\u5b89\u5168\uff08\u304b\u306a\u3041\uff5e\uff5e\uff1f\uff1f\uff09\u306b\u306a\u308b\u306e\u304b\u306a\u3068\u601d\u3063\u3066\u8a2d\u5b9a\u3057\u3066\u307f\u305f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9577\u5e74\u3000\u30b5\u30fc\u30d0\u306e\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u306b\u306fiptables\u3092\u4f7f\u3063\u3066\u304d\u305f\u3002SentOS7\u3067\u306f\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u306fiptables\u3067\u306f\u306a\u304ffirewalld\u304c\u6a19\u6e96\u3067\u4f7f\u7528\u3055\u308c\u308b\u3002\u305d\u3053\u3067\u9577\u5e74\u611b\u7528\u3057\u3066\u304d\u305fiptables\u3092\u6b62\u3081\u3066\u3000firewal &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/darkgray.homelinux.com\/blog\/?p=930\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;iptables\u304b\u3089firewalld\u3078&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[4,8],"tags":[],"class_list":["post-930","post","type-post","status-publish","format-standard","hentry","category-centos7","category-firewalld"],"_links":{"self":[{"href":"https:\/\/darkgray.homelinux.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/930","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/darkgray.homelinux.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/darkgray.homelinux.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/darkgray.homelinux.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/darkgray.homelinux.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=930"}],"version-history":[{"count":0,"href":"https:\/\/darkgray.homelinux.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/930\/revisions"}],"wp:attachment":[{"href":"https:\/\/darkgray.homelinux.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=930"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/darkgray.homelinux.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=930"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/darkgray.homelinux.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=930"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}