<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    <title>Josh McClain's personal blog - Web Hosting</title>
    <link>http://blog.185performance.com/</link>
    <description>ummm, ya...</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.1.3 - http://www.s9y.org/</generator>
    <pubDate>Tue, 27 Mar 2007 20:16:00 GMT</pubDate>

    <image>
        <url>http://blog.185performance.com/templates/default/img/s9y_banner_small.png</url>
        <title>RSS: Josh McClain's personal blog - Web Hosting - ummm, ya...</title>
        <link>http://blog.185performance.com/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>Shorewall Setup on a Gentoo Slice</title>
    <link>http://blog.185performance.com/archives/6-Shorewall-Setup-on-a-Gentoo-Slice.html</link>
            <category>Web Hosting</category>
    
    <comments>http://blog.185performance.com/archives/6-Shorewall-Setup-on-a-Gentoo-Slice.html#comments</comments>
    <wfw:comment>http://blog.185performance.com/wfwcomment.php?cid=6</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://blog.185performance.com/rss.php?version=2.0&amp;type=comments&amp;cid=6</wfw:commentRss>
    

    <author>nospam@example.com (Josh McClain)</author>
    <content:encoded>
    So you have a Gentoo slice at Slicehost.com, and you want a host-based firewall? Go for shorewall, which makes configuring iptables a breeze.&lt;br /&gt;
&lt;br /&gt;
I’m not gonna get into the specifics, because I’m way too lazy, but this should get you started.&lt;br /&gt;
&lt;br /&gt;
1) emerge sys-kernel/xen-sources so iptables doesn’t freak out. You’ll have to edit package.keywords&lt;br /&gt;
&lt;br /&gt;
2) Slicehost is nice enough to show us our kernel build options at /proc/config.gz. So copy that file to /usr/src/linux, then gunzip it. We’re not going to actually compile the kernel; emerging iptables simply needs to see the kernel build options.&lt;br /&gt;
&lt;br /&gt;
3) emerge iptables&lt;br /&gt;
&lt;br /&gt;
4) emerge shorewall&lt;br /&gt;
&lt;br /&gt;
5) rc-update add shorewall default&lt;br /&gt;
&lt;br /&gt;
6) Here are my various shorewall settings:&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;# egrep -v &quot;^#|^$&quot; shorewall.conf&lt;br /&gt;
STARTUP_ENABLED=Yes&lt;br /&gt;
LOGFILE=/var/log/messages&lt;br /&gt;
LOGFORMAT=&quot;Shorewall:%s:%s:&quot; &lt;br /&gt;
LOGTAGONLY=No&lt;br /&gt;
LOGRATE=&lt;br /&gt;
LOGBURST=&lt;br /&gt;
LOGALLNEW=&lt;br /&gt;
BLACKLIST_LOGLEVEL=&lt;br /&gt;
MACLIST_LOG_LEVEL=info&lt;br /&gt;
TCP_FLAGS_LOG_LEVEL=info&lt;br /&gt;
RFC1918_LOG_LEVEL=info&lt;br /&gt;
SMURF_LOG_LEVEL=info&lt;br /&gt;
LOG_MARTIANS=No&lt;br /&gt;
IPTABLES=&lt;br /&gt;
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin&lt;br /&gt;
SHOREWALL_SHELL=/bin/sh&lt;br /&gt;
SUBSYSLOCK=/var/lock/subsys/shorewall&lt;br /&gt;
MODULESDIR=&lt;br /&gt;
CONFIG_PATH=/etc/shorewall:/usr/share/shorewall&lt;br /&gt;
RESTOREFILE=&lt;br /&gt;
IPSECFILE=zones&lt;br /&gt;
FW=&lt;br /&gt;
IP_FORWARDING=Off&lt;br /&gt;
ADD_IP_ALIASES=Yes&lt;br /&gt;
ADD_SNAT_ALIASES=No&lt;br /&gt;
RETAIN_ALIASES=No&lt;br /&gt;
TC_ENABLED=Internal&lt;br /&gt;
CLEAR_TC=Yes&lt;br /&gt;
MARK_IN_FORWARD_CHAIN=No&lt;br /&gt;
CLAMPMSS=No&lt;br /&gt;
ROUTE_FILTER=No&lt;br /&gt;
DETECT_DNAT_IPADDRS=No&lt;br /&gt;
MUTEX_TIMEOUT=60&lt;br /&gt;
ADMINISABSENTMINDED=No&lt;br /&gt;
BLACKLISTNEWONLY=Yes&lt;br /&gt;
DELAYBLACKLISTLOAD=No&lt;br /&gt;
MODULE_SUFFIX=&lt;br /&gt;
DISABLE_IPV6=Yes&lt;br /&gt;
BRIDGING=No&lt;br /&gt;
DYNAMIC_ZONES=No&lt;br /&gt;
PKTTYPE=Yes&lt;br /&gt;
RFC1918_STRICT=No&lt;br /&gt;
MACLIST_TABLE=filter&lt;br /&gt;
MACLIST_TTL=&lt;br /&gt;
SAVE_IPSETS=No&lt;br /&gt;
MAPOLDACTIONS=No&lt;br /&gt;
FASTACCEPT=No&lt;br /&gt;
BLACKLIST_DISPOSITION=DROP&lt;br /&gt;
MACLIST_DISPOSITION=REJECT&lt;br /&gt;
TCP_FLAGS_DISPOSITION=DROP&lt;br /&gt;
&lt;br /&gt;
# tail -3 interfaces &lt;br /&gt;
#ZONE   INTERFACE       BROADCAST       OPTIONS&lt;br /&gt;
net     eth0            &lt;stripped&gt;   tcpflags,nosmurfs,norfc1918,blacklist&lt;br /&gt;
#LAST LINE -- ADD YOUR ENTRIES BEFORE THIS ONE -- DO NOT REMOVE&lt;br /&gt;
&lt;br /&gt;
# tail -5 zones&lt;br /&gt;
#ZONE   TYPE            OPTIONS         IN                      OUT&lt;br /&gt;
#                                       OPTIONS                 OPTIONS&lt;br /&gt;
fw      firewall&lt;br /&gt;
net     ipv4&lt;br /&gt;
#LAST LINE - ADD YOUR ENTRIES ABOVE THIS ONE - DO NOT REMOVE&lt;br /&gt;
&lt;br /&gt;
# tail -6 policy&lt;br /&gt;
#SOURCE         DEST            POLICY          LOG             LIMIT:BURST&lt;br /&gt;
#                                               LEVEL&lt;br /&gt;
$FW             net             REJECT          info    # YES, I&#039;m paranoid&lt;br /&gt;
net             all             DROP            info&lt;br /&gt;
all             all             REJECT          info&lt;br /&gt;
#LAST LINE -- DO NOT REMOVE&lt;br /&gt;
&lt;br /&gt;
# tail -3 routestopped &lt;br /&gt;
#INTERFACE      HOST(S)                 OPTIONS&lt;br /&gt;
eth0            &lt;your remote IP&gt;                       # so I can get in from my remote host when I stop shorewall&lt;br /&gt;
#LAST LINE -- ADD YOUR ENTRIES BEFORE THIS ONE -- DO NOT REMOVE&lt;br /&gt;
&lt;br /&gt;
# tail -40 rules&lt;br /&gt;
#ACTION         SOURCE                  DEST            PROTO   DEST    SOURCE          ORIGINAL        RATE            USER/&lt;br /&gt;
#                                                               PORT    PORT(S)         DEST            LIMIT           GROUP&lt;br /&gt;
#SECTION ESTABLISHED&lt;br /&gt;
#SECTION RELATED&lt;br /&gt;
SECTION NEW&lt;br /&gt;
&lt;br /&gt;
# INBOUND&lt;br /&gt;
Ping/ACCEPT     net:&lt;stripped&gt;          $FW                                             # ping from &lt;stripped&gt; for nagios&lt;br /&gt;
ACCEPT          net:&lt;stripped&gt;          $FW                     tcp     22              # ssh from &lt;stripped&gt; for nagios and remote access&lt;br /&gt;
ACCEPT          net                     $FW                     tcp     80              # http&lt;br /&gt;
ACCEPT          net                     $FW                     tcp     443             # https&lt;br /&gt;
&lt;br /&gt;
# OUTBOUND -- because I know &lt;strong&gt;exactly&lt;/strong&gt; what my server should be connecting to, and I&#039;ll REJECT and log otherwise per policy&lt;br /&gt;
DNS/ACCEPT      $FW                     net:63.76.232.182                               # dns to slicehost&lt;br /&gt;
DNS/ACCEPT      $FW                     net:63.99.9.195                                 # dns to slicehost&lt;br /&gt;
&lt;br /&gt;
SMTP/ACCEPT     $FW                     net:&lt;stripped&gt;                                  # smtp to &lt;stripped&gt;&lt;br /&gt;
SMTP/ACCEPT     $FW                     net:&lt;stripped&gt;                                  # smtp to &lt;stripped&gt;&lt;br /&gt;
&lt;br /&gt;
Rsync/ACCEPT    $FW                     net:209.59.138.21                               # rsync for portage to rsync.namerica.gentoo.org&lt;br /&gt;
Rsync/ACCEPT    $FW                     net:209.221.142.124                             # rsync for portage to rsync.namerica.gentoo.org&lt;br /&gt;
Rsync/ACCEPT    $FW                     net:209.189.242.21                              # rsync for portage to rsync.namerica.gentoo.org&lt;br /&gt;
Rsync/ACCEPT    $FW                     net:208.209.50.18                               # rsync for portage to rsync.namerica.gentoo.org&lt;br /&gt;
Rsync/ACCEPT    $FW                     net:206.75.218.53                               # rsync for portage to rsync.namerica.gentoo.org&lt;br /&gt;
Rsync/ACCEPT    $FW                     net:198.7.230.249                               # rsync for portage to rsync.namerica.gentoo.org&lt;br /&gt;
Rsync/ACCEPT    $FW                     net:156.56.247.193                              # rsync for portage to rsync.namerica.gentoo.org&lt;br /&gt;
Rsync/ACCEPT    $FW                     net:150.135.81.231                              # rsync for portage to rsync.namerica.gentoo.org&lt;br /&gt;
Rsync/ACCEPT    $FW                     net:141.219.155.230                             # rsync for portage to rsync.namerica.gentoo.org&lt;br /&gt;
Rsync/ACCEPT    $FW                     net:134.153.48.2                                # rsync for portage to rsync.namerica.gentoo.org&lt;br /&gt;
Rsync/ACCEPT    $FW                     net:132.207.4.160                               # rsync for portage to rsync.namerica.gentoo.org&lt;br /&gt;
Rsync/ACCEPT    $FW                     net:129.110.111.9                               # rsync for portage to rsync.namerica.gentoo.org&lt;br /&gt;
Rsync/ACCEPT    $FW                     net:128.61.111.9                                # rsync for portage to rsync.namerica.gentoo.org&lt;br /&gt;
Rsync/ACCEPT    $FW                     net:128.213.5.35                                # rsync for portage to rsync.namerica.gentoo.org&lt;br /&gt;
Rsync/ACCEPT    $FW                     net:128.104.70.17                               # rsync for portage to rsync.namerica.gentoo.org&lt;br /&gt;
Rsync/ACCEPT    $FW                     net:216.194.64.133                              # rsync for portage to rsync.namerica.gentoo.org&lt;br /&gt;
Rsync/ACCEPT    $FW                     net:216.176.132.235                             # rsync for portage to rsync.namerica.gentoo.org&lt;br /&gt;
Rsync/ACCEPT    $FW                     net:216.165.129.134                             # rsync for portage to rsync.namerica.gentoo.org&lt;br /&gt;
&lt;br /&gt;
ACCEPT          $FW                     net:141.218.143.14      tcp     80              # http for portage to prometheus.cs.wmich.edu&lt;br /&gt;
#LAST LINE -- ADD YOUR ENTRIES BEFORE THIS ONE -- DO NOT REMOVE&lt;/blockquote&gt; 
    </content:encoded>

    <pubDate>Tue, 27 Mar 2007 14:16:00 -0600</pubDate>
    <guid isPermaLink="false">http://blog.185performance.com/archives/6-guid.html</guid>
    
</item>

</channel>
</rss>