<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>UFW Archives - Linux Windows and android Tutorials</title>
	<atom:link href="https://www.osradar.com/tag/ufw/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.osradar.com</link>
	<description>tutorials and news and Seurity</description>
	<lastBuildDate>Thu, 06 May 2021 00:58:18 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.8.12</generator>
	<item>
		<title>Hardening Ubuntu Security with UFW Firewall</title>
		<link>https://www.osradar.com/hardening-ubuntu-security-ufw/</link>
					<comments>https://www.osradar.com/hardening-ubuntu-security-ufw/#respond</comments>
		
		<dc:creator><![CDATA[rajneesh]]></dc:creator>
		<pubDate>Wed, 05 May 2021 19:13:00 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Ubuntu 20.04 tutorials]]></category>
		<category><![CDATA[UFW]]></category>
		<guid isPermaLink="false">https://www.osradar.com/?p=29889</guid>

					<description><![CDATA[<p>Firewall security is the key to manage all critical services. So many seasoned and decent securities are there. But, there is always room for improvisation and simplification of Firewall systems for Linux. A very classic and well-known example is IPTABLES, of course. IPtables took lots of experience and seasoning to be perfect with. Essentially Ubuntu [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/hardening-ubuntu-security-ufw/">Hardening Ubuntu Security with UFW Firewall</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p> Firewall security is the key to manage all critical services. So many seasoned and decent securities are there. But, there is always room for improvisation and simplification of Firewall systems for Linux. A very classic and well-known example is IPTABLES, of course. IPtables took lots of experience and seasoning to be perfect with. Essentially Ubuntu Kernal system provides Netfilter as a packet filtering system. IPtables is the traditional interface to manipulate  Netfilter in form of commands. The <a href="https://wiki.ubuntu.com/UncomplicatedFirewall">UFW</a> act as a frontend for IPTables. Users, having trouble with IPTables can manage their securities easily with this feature. </p>



<h2> Prerequisites and installation.</h2>



<p>I would be using Ubuntu as demo OS here, Most of the Linux OS comes with that features by default.   </p>



<p>Check status of firewall.        </p>



<pre class="wp-block-preformatted">$ ufw status</pre>



<figure class="wp-block-image size-large"><img loading="lazy" width="660" height="74" src="//1081754738.rsc.cdn77.org/wp-content/uploads/2021/05/image-1.png" alt="" class="wp-image-29892" srcset="https://www.osradar.com/wp-content/uploads/2021/05/image-1.png 660w, https://www.osradar.com/wp-content/uploads/2021/05/image-1-300x34.png 300w" sizes="(max-width: 660px) 100vw, 660px" /></figure>



<p>Enable firewall. </p>



<pre class="wp-block-preformatted">$ ufw enable</pre>



<figure class="wp-block-image size-large"><img loading="lazy" width="834" height="129" src="//1081754738.rsc.cdn77.org/wp-content/uploads/2021/05/image-2.png" alt="" class="wp-image-29893" srcset="https://www.osradar.com/wp-content/uploads/2021/05/image-2.png 834w, https://www.osradar.com/wp-content/uploads/2021/05/image-2-300x46.png 300w, https://www.osradar.com/wp-content/uploads/2021/05/image-2-768x119.png 768w, https://www.osradar.com/wp-content/uploads/2021/05/image-2-696x108.png 696w" sizes="(max-width: 834px) 100vw, 834px" /></figure>



<p>Reload firewall. SSH may stope when you enable firewall. If you are working in virtual environment, connection may lost. </p>



<h2>Allow and deny rules.</h2>



<p>Allow ssh port </p>



<pre class="wp-block-preformatted">$ sudo ufw allow 22</pre>



<figure class="wp-block-image size-large"><img loading="lazy" width="746" height="80" src="//1081754738.rsc.cdn77.org/wp-content/uploads/2021/05/image-3.png" alt="" class="wp-image-29894" srcset="https://www.osradar.com/wp-content/uploads/2021/05/image-3.png 746w, https://www.osradar.com/wp-content/uploads/2021/05/image-3-300x32.png 300w, https://www.osradar.com/wp-content/uploads/2021/05/image-3-696x75.png 696w, https://www.osradar.com/wp-content/uploads/2021/05/image-3-741x80.png 741w" sizes="(max-width: 746px) 100vw, 746px" /></figure>



<p>Rule applied, check status. </p>



<figure class="wp-block-image size-large"><img loading="lazy" width="533" height="204" src="//1081754738.rsc.cdn77.org/wp-content/uploads/2021/05/image-4.png" alt="" class="wp-image-29896" srcset="https://www.osradar.com/wp-content/uploads/2021/05/image-4.png 533w, https://www.osradar.com/wp-content/uploads/2021/05/image-4-300x115.png 300w" sizes="(max-width: 533px) 100vw, 533px" /></figure>



<p>Like port number, we can allow to open for a particular IP address. </p>



<pre class="wp-block-preformatted">$ sudo ufw allow from 192.168.42.142 &amp;&amp; sudo ufw status.</pre>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="234" src="//1081754738.rsc.cdn77.org/wp-content/uploads/2021/05/image-5-1024x234.png" alt="" class="wp-image-29897" srcset="https://www.osradar.com/wp-content/uploads/2021/05/image-5-1024x234.png 1024w, https://www.osradar.com/wp-content/uploads/2021/05/image-5-300x68.png 300w, https://www.osradar.com/wp-content/uploads/2021/05/image-5-768x175.png 768w, https://www.osradar.com/wp-content/uploads/2021/05/image-5-696x159.png 696w, https://www.osradar.com/wp-content/uploads/2021/05/image-5-1068x244.png 1068w, https://www.osradar.com/wp-content/uploads/2021/05/image-5.png 1074w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>What if you wants to allow a particular port for specific IP Addr.</p>



<pre class="wp-block-preformatted">$ sudo sfw allow from 192.168.100.100 to any port 22</pre>



<p>Status check.</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="947" height="263" src="//1081754738.rsc.cdn77.org/wp-content/uploads/2021/05/image-6.png" alt="" class="wp-image-29901" srcset="https://www.osradar.com/wp-content/uploads/2021/05/image-6.png 947w, https://www.osradar.com/wp-content/uploads/2021/05/image-6-300x83.png 300w, https://www.osradar.com/wp-content/uploads/2021/05/image-6-768x213.png 768w, https://www.osradar.com/wp-content/uploads/2021/05/image-6-696x193.png 696w" sizes="(max-width: 947px) 100vw, 947px" /></figure>



<p>Deny a particular port for a specific IP addr. </p>



<pre class="wp-block-preformatted">$ sudo ufw deny from 192.168.100.100 to any port 80</pre>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="311" src="//1081754738.rsc.cdn77.org/wp-content/uploads/2021/05/image-7-1024x311.png" alt="" class="wp-image-29902" srcset="https://www.osradar.com/wp-content/uploads/2021/05/image-7-1024x311.png 1024w, https://www.osradar.com/wp-content/uploads/2021/05/image-7-300x91.png 300w, https://www.osradar.com/wp-content/uploads/2021/05/image-7-768x233.png 768w, https://www.osradar.com/wp-content/uploads/2021/05/image-7-696x211.png 696w, https://www.osradar.com/wp-content/uploads/2021/05/image-7.png 1028w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Now, delete created rule, there are two methods and first option  with rule number.</p>



<pre class="wp-block-preformatted"> $ sudo ufw status numbered</pre>



<figure class="wp-block-image size-large"><img loading="lazy" width="740" height="263" src="//1081754738.rsc.cdn77.org/wp-content/uploads/2021/05/image-8.png" alt="" class="wp-image-29903" srcset="https://www.osradar.com/wp-content/uploads/2021/05/image-8.png 740w, https://www.osradar.com/wp-content/uploads/2021/05/image-8-300x107.png 300w, https://www.osradar.com/wp-content/uploads/2021/05/image-8-696x247.png 696w" sizes="(max-width: 740px) 100vw, 740px" /></figure>



<p>Here, I want to delete rule number 5.</p>



<pre class="wp-block-preformatted">$ sudo ufw delete 5</pre>



<figure class="wp-block-image size-large"><img loading="lazy" width="583" height="140" src="//1081754738.rsc.cdn77.org/wp-content/uploads/2021/05/image-9.png" alt="" class="wp-image-29904" srcset="https://www.osradar.com/wp-content/uploads/2021/05/image-9.png 583w, https://www.osradar.com/wp-content/uploads/2021/05/image-9-300x72.png 300w" sizes="(max-width: 583px) 100vw, 583px" /></figure>



<p>Let&#8217;s use another way to delete any rule.</p>



<pre class="wp-block-preformatted">$ sudo ufw delete deny from 192.168.100.100 to any port 22</pre>



<p>Lets reset all firewall rules to default. </p>



<pre class="wp-block-preformatted">$ sudo ufw reset</pre>



<p>You can manage incoming and outgoing rules as well, have a look.</p>



<p></p>



<h2>GUI Tool for UFW </h2>



<p>Install  GUI application for the firewall.</p>



<pre class="wp-block-preformatted">$ sudo apt-get install gufw</pre>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="386" src="//1081754738.rsc.cdn77.org/wp-content/uploads/2021/05/image-10-1024x386.png" alt="" class="wp-image-29906" srcset="https://www.osradar.com/wp-content/uploads/2021/05/image-10-1024x386.png 1024w, https://www.osradar.com/wp-content/uploads/2021/05/image-10-300x113.png 300w, https://www.osradar.com/wp-content/uploads/2021/05/image-10-768x290.png 768w, https://www.osradar.com/wp-content/uploads/2021/05/image-10-696x262.png 696w, https://www.osradar.com/wp-content/uploads/2021/05/image-10-1068x403.png 1068w, https://www.osradar.com/wp-content/uploads/2021/05/image-10.png 1122w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>With basic understanding of security, a moderate user can manage items as well.</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="908" height="723" src="//1081754738.rsc.cdn77.org/wp-content/uploads/2021/05/image-11.png" alt="" class="wp-image-29907" srcset="https://www.osradar.com/wp-content/uploads/2021/05/image-11.png 908w, https://www.osradar.com/wp-content/uploads/2021/05/image-11-300x239.png 300w, https://www.osradar.com/wp-content/uploads/2021/05/image-11-768x612.png 768w, https://www.osradar.com/wp-content/uploads/2021/05/image-11-696x554.png 696w" sizes="(max-width: 908px) 100vw, 908px" /></figure>



<h2>Conclusion</h2>



<p>UFW can be used by that user, which is having not so deep knowledge of IPTables. but still wants to manage securities of their server and services. With very quick deployment ports or IP addresses, level restrictions can be managed to have a similar impact as it was supposed to be with IPTables. </p>



<p> </p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/hardening-ubuntu-security-ufw/">Hardening Ubuntu Security with UFW Firewall</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.osradar.com/hardening-ubuntu-security-ufw/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
