{"id":57,"date":"2012-06-10T12:32:19","date_gmt":"2012-06-10T12:32:19","guid":{"rendered":"http:\/\/rmohan.com\/?p=57"},"modified":"2012-06-10T12:37:34","modified_gmt":"2012-06-10T12:37:34","slug":"shorewall-firewall","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=57","title":{"rendered":"Shorewall &#8211; Firewall"},"content":{"rendered":"<p>CentOS &#8211; Install and Configure Shorewall <\/p>\n<p>Add repository EPEL that is provided from Fedora project.<br \/>\nwget http:\/\/ftp.riken.jp\/Linux\/fedora\/epel\/RPM-GPG-KEY-EPEL-6<br \/>\nrpm &#8211;import RPM-GPG-KEY-EPEL-6<br \/>\nrm -f RPM-GPG-KEY-EPEL-6<br \/>\nvi \/etc\/yum.repos.d\/epel.repo<br \/>\n# create new<br \/>\n[epel]<br \/>\nname=EPEL RPM Repository for Red Hat Enterprise Linux<br \/>\nbaseurl=http:\/\/ftp.riken.jp\/Linux\/fedora\/epel\/6\/$basearch\/<br \/>\ngpgcheck=1<br \/>\nenabled=0<br \/>\n# when you use the repository, input yum command like follows<\/p>\n<p>yum &#8211;enablerepo=epel install shorewall<\/p>\n<p>Backup and Edit System Control<\/p>\n<p>cp \/etc\/sysctl.conf  \/etc\/sysctl.conf.org<\/p>\n<p>sed -i &#8216;s\/net.ipv4.ip_forward = 0\/net.ipv4.ip_forward = 1\/g&#8217; \/etc\/sysctl.conf<\/p>\n<p>Backup and Edit Shorewall Zones<br \/>\ncp \/etc\/shorewall\/zones \/etc\/shorewall\/zones.org<br \/>\nvi \/etc\/shorewall\/zones<\/p>\n<p>##<br \/>\n# For information about this file, type &#8220;man shorewall-zones&#8221;<br \/>\n#<br \/>\n# The manpage is also online at<br \/>\n# http:\/\/www.shorewall.net\/manpages\/shorewall-zones.html<br \/>\n#<br \/>\n###############################################################################<br \/>\n#ZONE TYPE OPTIONS IN OUT<br \/>\n# OPTIONS OPTIONS<br \/>\nfw firewall<br \/>\nnet ipv4<br \/>\nloc ipv4<br \/>\ndmz ipv4<br \/>\n#LAST LINE &#8211; ADD YOUR ENTRIES ABOVE THIS ONE &#8211; DO NOT REMOVE<\/p>\n<p>Backup and Edit Shorewall Interfaces<br \/>\ncp \/etc\/shorewall\/interfaces \/etc\/shorewall\/interfaces.ori<br \/>\nvi \/etc\/shorewall\/interfaces<\/p>\n<p>#<br \/>\n###############################################################################<br \/>\n#ZONE INTERFACE BROADCAST OPTIONS<br \/>\nnet eth0 detect tcpflags,dhcp,routefilter,nosmurfs,logmartians<br \/>\nloc eth1 detect tcpflags,nosmurfs<br \/>\ndmz eth2 detect<br \/>\n#LAST LINE &#8212; ADD YOUR ENTRIES BEFORE THIS ONE &#8212; DO NOT REMOVE<\/p>\n<p>Backup and Edit Shorewall Policy<br \/>\ncp \/etc\/shorewall\/policy \/etc\/shorewall\/policy.ori<br \/>\nvi \/etc\/shorewall\/policy<\/p>\n<p>#<br \/>\n# Shorewall version 4 &#8211; Policy File<br \/>\n#<br \/>\n# For information about entries in this file, type &#8220;man shorewall-policy&#8221;<br \/>\n#<br \/>\n# The manpage is also online at<br \/>\n# http:\/\/www.shorewall.net\/manpages\/shorewall-policy.html<br \/>\n#<br \/>\n###############################################################################<br \/>\n#SOURCE DEST POLICY LOG LIMIT:BURST<br \/>\n# LEVEL<br \/>\n# Policies for traffic originating from the local LAN (loc)<br \/>\n#<br \/>\n# If you want to force clients to access the Internet via a proxy server<br \/>\n# in your DMZ, change the following policy to REJECT info.<br \/>\nloc net ACCEPT<br \/>\n# If you want open access to DMZ from loc, change the following policy<br \/>\n# to ACCEPT. (If you chose not to do this, you will need to add a rule<br \/>\n# for each service in the rules file.)<br \/>\nloc dmz REJECT info<br \/>\nloc $FW REJECT info<br \/>\nloc all REJECT info<br \/>\n#<br \/>\n# Policies for traffic originating from the firewall ($FW)<br \/>\n#<br \/>\n# If you want open access to the Internet from your firewall, change the<br \/>\n# $FW to net policy to ACCEPT and remove the &#8216;info&#8217; LOG LEVEL.<br \/>\n$FW net REJECT info<br \/>\n$FW dmz REJECT info<br \/>\n$FW loc REJECT info<br \/>\n$FW all REJECT info<br \/>\n#<br \/>\n# Policies for traffic originating from the De-Militarized Zone (dmz)<br \/>\n#<br \/>\n# If you want open access from DMZ to the Internet change the following<br \/>\n# policy to ACCEPT. This may be useful if you run a proxy server in<br \/>\n# your DMZ.<br \/>\ndmz net REJECT info<br \/>\ndmz $FW REJECT info<br \/>\ndmz loc REJECT info<br \/>\ndmz all REJECT info<br \/>\n#<br \/>\n# Policies for traffic originating from the Internet zone (net)<br \/>\n#<br \/>\nnet dmz DROP info<br \/>\nnet $FW DROP info<br \/>\nnet loc DROP info<br \/>\nnet all DROP info<br \/>\n# THE FOLLOWING POLICY MUST BE LAST<br \/>\nall all REJECT info<br \/>\n#LAST LINE &#8212; DO NOT REMOVE<\/p>\n<p>Backup and Edit Shorewall Rules<\/p>\n<p>cp \/etc\/shorewall\/rules \/etc\/shorewall\/rules.orig<\/p>\n<p>vi \/etc\/shorewall\/rules<\/p>\n<p># The manpage is also online at<br \/>\n# http:\/\/www.shorewall.net\/manpages\/shorewall-rules.html<br \/>\n#<br \/>\n#######################################################################<br \/>\n#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER\/ MARK<br \/>\n# PORT PORT(S) DEST LIMIT GROUP<br \/>\n#SECTION ESTABLISHED<br \/>\n#SECTION RELATED<br \/>\n#<br \/>\n# Accept DNS connections from the firewall to the Internet<br \/>\n#<br \/>\nDNS\/ACCEPT $FW net<br \/>\n#<br \/>\n#<br \/>\n# Accept SSH connections from the local network to the firewall and DMZ<br \/>\n#<br \/>\nSSH\/ACCEPT loc $FW<br \/>\nSSH\/ACCEPT loc dmz<br \/>\n#<br \/>\n# DMZ DNS access to the Internet<br \/>\n#<br \/>\nDNS\/ACCEPT dmz net<br \/>\n#<br \/>\n# Drop Ping from the &#8220;bad&#8221; net zone.<br \/>\n#<br \/>\nPing\/DROP net $FW<br \/>\n#<br \/>\n# Make ping work bi-directionally between the dmz, net, Firewall and local zone<br \/>\n# (assumes that the loc->net policy is ACCEPT).<br \/>\n#<br \/>\nPing\/ACCEPT loc $FW<br \/>\nPing\/ACCEPT dmz $FW<br \/>\nPing\/ACCEPT loc dmz<br \/>\nPing\/ACCEPT dmz loc<br \/>\nPing\/ACCEPT dmz net<br \/>\nACCEPT $FW net icmp<br \/>\nACCEPT $FW loc icmp<br \/>\nACCEPT $FW dmz icmp<br \/>\n# Uncomment this if using Proxy ARP and static NAT and you want to allow ping from<br \/>\n# the net zone to the dmz and loc<br \/>\n#Ping\/ACCEPT net dmz<br \/>\n#Ping\/ACCEPT net loc<br \/>\n#LAST LINE &#8212; ADD YOUR ENTRIES BEFORE THIS ONE &#8212; DO NOT REMOVE<\/p>\n<p>Backup and Edit Shorewall Configuration<br \/>\n[root@localhost ~]# cp \/etc\/shorewall\/shorewall.conf \/etc\/shorewall\/shorewall.conf.orig<br \/>\n[root@localhost ~]# vi \/etc\/shorewall\/shorewall.conf<br \/>\nsed -i &#8216;s\/STARTUP_ENABLED=No\/STARTUP_ENABLED=Yes\/g&#8217; \/etc\/shorewall\/shorewall.conf<br \/>\nCheck Shorewall Configuration<br \/>\nshorewall check<br \/>\nCreate Auto Start and Restart Shorewall<br \/>\nchkconfig shorewall on<br \/>\nservice shorewall restart<br \/>\nor<br \/>\nshorewall restart<\/p>\n","protected":false},"excerpt":{"rendered":"<p>CentOS &#8211; Install and Configure Shorewall <\/p>\n<p>Add repository EPEL that is provided from Fedora project. wget http:\/\/ftp.riken.jp\/Linux\/fedora\/epel\/RPM-GPG-KEY-EPEL-6 rpm &#8211;import RPM-GPG-KEY-EPEL-6 rm -f RPM-GPG-KEY-EPEL-6 vi \/etc\/yum.repos.d\/epel.repo # create new [epel] name=EPEL RPM Repository for Red Hat Enterprise Linux baseurl=http:\/\/ftp.riken.jp\/Linux\/fedora\/epel\/6\/$basearch\/ gpgcheck=1 enabled=0 # when you use the repository, input yum command like follows<\/p>\n<p>yum &#8211;enablerepo=epel install [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,8],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/57"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=57"}],"version-history":[{"count":5,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/57\/revisions"}],"predecessor-version":[{"id":62,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/57\/revisions\/62"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=57"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=57"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=57"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}