<?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>Gorges Blog &#187; linux</title>
	<atom:link href="http://blog.GORGES.us/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.GORGES.us</link>
	<description>Web Sites that Grow Your Business - our blog</description>
	<lastBuildDate>Mon, 06 Feb 2012 14:23:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Distributed Dictionary Attack Solutions</title>
		<link>http://blog.GORGES.us/2010/06/distributed-dictionary-attack-solutions/</link>
		<comments>http://blog.GORGES.us/2010/06/distributed-dictionary-attack-solutions/#comments</comments>
		<pubDate>Sat, 26 Jun 2010 11:58:10 +0000</pubDate>
		<dc:creator>Matt Clark</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[dictionary attack]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[zombie]]></category>

		<guid isPermaLink="false">http://blog.GORGES.us/?p=283</guid>
		<description><![CDATA[Learn some ideas on how to thwart distributed dictionary attacks on your servers.]]></description>
			<content:encoded><![CDATA[<p>We have had the misfortune of having attempted distributed dictionary attacks on our Linux servers.  A dictionary attack uses a long list of common usernames and passwords trying to find a way to gain a foothold and eventually root access of a password-protected server.</p>
<p>Our servers use utilities such as <a href="http://www.fail2ban.org/">fail2ban</a> or <a href="http://denyhosts.sourceforge.net/">denyhosts</a> that look for repeated failed login attempts, and once found they direct the firewall service to ban the originating IP addresses.  However this technique fails when the attack is distributed among thousands of compromised &#8220;zombie&#8221; computers that are doing the bidding of a malicious hacker.</p>
<p>Our log files correctly diagnosed each attempt from an individual IP address, but a new attempt was immediately started from a different IP address.  We were clearly looking at an attack coordinated from a single unknown source.</p>
<p>There are several ways to reduce or thwart these attacks, including:</p>
<ul>
<li>never allow remote root logins (but attacks still occur on  non-root-user names)</li>
<li>have a chroot jail shell in case an attack on a non-root account succeeds</li>
<li>changing SSH service to use a non-obvious port (such as port 5022 instead of 22)</li>
<li>deactivate password authentication and rely exclusively on authentication keys</li>
<li>restrict allowed IP address by country of origin</li>
<li>only allow certain IP addresses or ranges of addresses to have access</li>
</ul>
<p>We chose to implement more than one of these solutions, and I wanted to share some techniques we used for our implementation.</p>
<p>For the last rule that only allows certain IP addresses, I wanted to start with a list of valid IP addresses used in the last month.  The following script extracts these IP numbers from our SSH log file, sorts them alphabetically, and then removes duplicates.  Note that this server uses Fedora &#8211; you may need to tweak it for other linux distributions.</p>
<pre class="brush: java; title: ; notranslate">
root# fgrep &quot;Accepted&quot; /var/log/secure* | awk '{print $11}' | sort | uniq
166.77.6.4
205.232.34.1
67.255.5.155
...
</pre>
<p>The IP addresses from the above script should be added to the file <strong>/etc/hosts.allow</strong> in the following format:</p>
<pre class="brush: plain; title: ; notranslate">
# hosts.allow   This file contains access rules which are used to
#               allow or deny connections to network services that
#               either use the tcp_wrappers library or that have been
#               started through a tcp_wrappers-enabled xinetd.
#
#               See 'man 5 hosts_options' and 'man 5 hosts_access'
#               for information on rule syntax.
#               See 'man tcpd' for information on tcp_wrappers

# allow local addresses
all: 127.0.0.1
all: 192.168.1.*

# valid IP addresses gathered June 2010
all: 166.77.6.4
all: 205.232.34.1
all: 67.255.5.155
...
</pre>
<p>Now disallow all other IP addresses for SSH by editing the file <strong>/etc/hosts.deny</strong>:</p>
<pre class="brush: plain; title: ; notranslate">
# hosts.deny    This file contains access rules which are used to
#               deny connections to network services that either use
#               the tcp_wrappers library or that have been
#               started through a tcp_wrappers-enabled xinetd.
#
#               The rules in this file can also be set up in
#               /etc/hosts.allow with a 'deny' option instead.
#
#               See 'man 5 hosts_options' and 'man 5 hosts_access'
#               for information on rule syntax.
#               See 'man tcpd' for information on tcp_wrappers
#
# The portmap line is redundant, but it is left to remind you that
# the new secure portmap uses hosts.deny and hosts.allow.  In particular
# you should know that NFS uses portmap!

# deny SSH service except for IP numbers in /etc/hosts.allow file
sshd: all
</pre>
<p>Restart your SSH service, and your server should now be a bit more secure against distributed dictionary attacks:</p>
<pre class="brush: plain; title: ; notranslate">
root# service sshd restart
</pre>
<p>An Internet search using keywords from the other mentioned solutions above will teach you how to change SSH port, disallow password authentication, etc.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.GORGES.us/2010/06/distributed-dictionary-attack-solutions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Securing Linux Web Servers</title>
		<link>http://blog.GORGES.us/2009/07/securing-linux-web-servers/</link>
		<comments>http://blog.GORGES.us/2009/07/securing-linux-web-servers/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 13:00:17 +0000</pubDate>
		<dc:creator>Matt Clark</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[firewalls]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://blog.GORGES.us/?p=130</guid>
		<description><![CDATA[We are often asked by our software development and hosting customers how we secure our servers.  We have several layers of security protection, and this blog posting will mention some that we implement. A firewall is used to only allow traffic to the outside world on a few of the TCP/UDP ports.  We obviously have [...]]]></description>
			<content:encoded><![CDATA[<p>We are often asked by our software development and hosting customers how we secure our servers.  We have several layers of security protection, and this blog posting will mention some that we implement.</p>
<p>A firewall is used to only allow traffic to the outside world on a few of the TCP/UDP ports.  We obviously have to allow web and e-mail users access to the server, but almost all other ports can be closed to prevent intrusion attempts.  On our newest servers we even prevent FTP and Telnet access, since those protocols rely on unencrypted packets which are easier to intercept and hijack.</p>
<p>Every day we have perhaps dozens of &#8220;dicitionary&#8221; attacks that try to gain e-mail or user account access.  A dictionary attack picks a user (for example &#8220;root&#8221; or &#8220;john&#8221;) and then goes through a long, long list of possible passwords.  We use two packages Fail2Ban and DenyHosts that monitor our log files looking for dictionary attacks; if found, the originating computer is banned from accessing our servers.</p>
<p>When we develop online shopping solutions, we choose to not store credit card numbers online.  We securely pass this information to the credit card processing vendor, and then we only record the order information and the payment confirmation number.  For some web sites with user accounts, we encrypt the user account passwords, therefore gaining access to our user password list would still not result in someone gaining access to their online account.</p>
<p>Some of our hosting customers are concerned about unencrypted web traffic.  We occasionally add a feature that automatically forwards a web page inquiry from non-SSL to SSL mode, which means it forward to a page starting with &#8220;https://&#8221; thus all traffic is encrypted between our server and each web browser client.</p>
<p>We also have logging records and constant monitoring to help us detect intrusion attempts and help us implement even better security measures.  &#8220;Tripwire&#8221; software can also alert us when certain files are modified.</p>
<p>Do these basic measures above make us impervious to hackers?  Alas, no.  On two occasions in the last five years we have had hackers penetrate one of our servers.  However no damage was done and we patched those specific holes quickly.  Security is a cat-and-mouse game, and we strive to stay one step ahead.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.GORGES.us/2009/07/securing-linux-web-servers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

