<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Ufw on Wimpy's World</title><link>https://blog.wimpys.world/tags/ufw/</link><description>Recent content in Ufw on Wimpy's World</description><generator>Hugo -- gohugo.io</generator><language>en-gb</language><managingEditor>martin@wimpress.com (Martin Wimpress)</managingEditor><webMaster>martin@wimpress.com (Martin Wimpress)</webMaster><lastBuildDate>Thu, 14 Mar 2013 18:09:21 +0000</lastBuildDate><atom:link href="https://blog.wimpys.world/tags/ufw/rss.xml" rel="self" type="application/rss+xml"/><item><title>Install nginx on Debian</title><link>https://blog.wimpys.world/posts/install-nginx-on-debian/</link><pubDate>Thu, 14 Mar 2013 18:09:21 +0000</pubDate><author>martin@wimpress.com (Martin Wimpress)</author><guid>https://wimpysworld.com/posts/install-nginx-on-debian/</guid><description>&lt;p&gt;My webserver of choice is &lt;a href="http://nginx.org/"&gt;nginx&lt;/a&gt;, it&amp;rsquo;s resource friendly,
fast, reliable and versatile.&lt;/p&gt;
&lt;p&gt;I have a resource constrained Debian 6.0 &amp;ldquo;server&amp;rdquo; and wanted to deploy nginx on
it for testing. Sadly, the nginx package in the Squeeze repositories is very old.
Fortunately, the nginx team maintain a Debian package repository.&lt;/p&gt;
&lt;p&gt;Add the nginx repository.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo nano /etc/apt/sources.list.d/nginx.list
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="squeeze"&gt;Squeeze&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;deb http://nginx.org/packages/debian/ squeeze nginx
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;deb-src http://nginx.org/packages/debian/ squeeze nginx
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="wheezy"&gt;Wheezy&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;deb http://nginx.org/packages/debian/ wheezy nginx
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;deb-src http://nginx.org/packages/debian/ wheezy nginx
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Download the nginx package signing key.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;wget http://nginx.org/keys/nginx_signing.key
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Add the nginx package signing key to the keyring.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt-key add nginx_signing.key
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Update the repositories.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt-get update
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Install nginx.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt-get install nginx
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I run &lt;code&gt;ufw&lt;/code&gt; on my VPS so use the following to allow external access to my
website.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo ufw allow 80/tcp
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;nginx is installed and can be configured in the usual way.&lt;/p&gt;
&lt;h4 id="references"&gt;References&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://wiki.nginx.org/Install"&gt;http://wiki.nginx.org/Install&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://wiki.nginx.org/Pgp"&gt;http://wiki.nginx.org/Pgp&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description><summary>Installing nginx on a Debian (Squeeze) 6.0 and (wheezy) 7.0</summary></item><item><title>Uncomplicated Firewall (UFW) on Arch Linux</title><link>https://blog.wimpys.world/posts/uncomplicated-firewall-ufw-on-arch-linux/</link><pubDate>Sat, 09 Mar 2013 08:37:43 +0000</pubDate><author>martin@wimpress.com (Martin Wimpress)</author><guid>https://wimpysworld.com/posts/uncomplicated-firewall-ufw-on-arch-linux/</guid><description>&lt;p&gt;While migrating one of my VPS servers to &lt;a href="http://www.archlinux.org"&gt;Arch Linux&lt;/a&gt;
I deployed &lt;a href="https://wiki.ubuntu.com/UncomplicatedFirewall"&gt;Uncomplicated Firewall (UFW)&lt;/a&gt;
to handle basic firewall duties. I like &lt;code&gt;ufw&lt;/code&gt; as it provides simple host-based
firewall management and, in my opinion, one of the better projects to come out
of the Ubuntu camp.&lt;/p&gt;
&lt;p&gt;Install &lt;code&gt;ufw&lt;/code&gt; as follows.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo pacman -Syy -noconfirm --needed ufw
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Configuring &lt;code&gt;ufw&lt;/code&gt; is simple but make sure you have console access to the host
you are configuring just in case you lock yourself out.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;NOTE!&lt;/strong&gt; When enabling &lt;code&gt;ufw&lt;/code&gt; the chains are flushed and connections may be
dropped. You can add rules to the firewall before enabling it however, so if you
are testing &lt;code&gt;ufw&lt;/code&gt; on a remote machine it is recommended you perform&amp;hellip;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ufw allow ssh/tcp
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&amp;hellip;before running &lt;code&gt;sudo ufw enable&lt;/code&gt;. Once the firewall is enabled, adding and
removing rules will not flush the firewall, although modifying an existing rule
will.&lt;/p&gt;
&lt;p&gt;Set the default behaviour to deny all incoming connections.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo ufw default deny
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Open up TCP port 22 but with rate limiting enabled which will deny connections
from an IP address that has attempted to initiate 6 or more connections in the
last 30 seconds. Ideal for protecting &lt;code&gt;sshd&lt;/code&gt; but you should conisder other
&lt;a href="https://blog.wimpys.world/posts/ssh-brute-force-defense/"&gt;SSH brute force defense&lt;/a&gt;
techniques as well.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo ufw limit tcp/22
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I&amp;rsquo;m hosting a few websites on my VPS so I open http and https.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo ufw allow 80/tcp
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo ufw allow 443/tcp
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Enable the &lt;code&gt;ufw&lt;/code&gt; systemd unit.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo systemctl &lt;span class="nb"&gt;enable&lt;/span&gt; ufw
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo systemctl start ufw
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;However, &lt;code&gt;ufw&lt;/code&gt; is not enabled at this point. To enable the firewall you also
have to do the following.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo ufw &lt;span class="nb"&gt;enable&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can see the status of the firewall using &lt;code&gt;sudo ufw status&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;On low-end servers it might be beneficial to disable logging.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo ufw logging off
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;At this point you should have a basic firewall configured and &lt;code&gt;ufw help&lt;/code&gt; or the
references below will assist you.&lt;/p&gt;
&lt;h4 id="references"&gt;References&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://wiki.archlinux.org/index.php/Uncomplicated_Firewall"&gt;https://wiki.archlinux.org/index.php/Uncomplicated_Firewall&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://wiki.ubuntu.com/UncomplicatedFirewall"&gt;https://wiki.ubuntu.com/UncomplicatedFirewall&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://launchpad.net/ufw"&gt;https://launchpad.net/ufw&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description><summary>Configuring Uncomplicated Firewall (UFW) on Arch Linux.</summary></item></channel></rss>