<?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>RandomStringOfWords &#187; FedoraCore</title>
	<atom:link href="http://randomstringofwords.com/tag/fedoracore/feed/" rel="self" type="application/rss+xml" />
	<link>http://randomstringofwords.com</link>
	<description>RandomStringOfWords.com &#124;&#124; RSoW.com</description>
	<lastBuildDate>Tue, 03 Jan 2012 19:38:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Server hacked</title>
		<link>http://randomstringofwords.com/server-hacked/</link>
		<comments>http://randomstringofwords.com/server-hacked/#comments</comments>
		<pubDate>Tue, 15 Jan 2008 20:32:05 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[RSoW.com]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[bot]]></category>
		<category><![CDATA[FedoraCore]]></category>
		<category><![CDATA[hacker]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://info.rsow.com/server-hacked/</guid>
		<description><![CDATA[Yay! Everything is back and working nicely. The nice thing about having your server hacked is that you end up having to put everything back &#8212; which yes is a colossal pain in the ass, but you will just about always put it back in better shape than it was in to begin with. My [...]]]></description>
			<content:encoded><![CDATA[<p>Yay! Everything is back and working nicely.  The nice thing about having your server hacked is that you end up having to put everything back &#8212; which yes is a colossal pain in the ass, but you will just about always put it back in better shape than it was in to begin with.</p>
<p><span id="more-106"></span>My old server was FedoraCore2.. *shudder*  I wasn&#8217;t given a choice there.. it was core2 or nothing. And since it was out of date pretty much the day I was given it, it was doomed to be hacked at some point.  I knew that going into it.. Eh what can ya do.</p>
<p>Well, it happened.  Sometime last week someone rooted the box.  They did a pretty thorough job of it too, though the more I looked at it the more I thought it was a script kiddie instead of someone that&#8217;s actually clever..</p>
<p>They went through and added a program that listened on port 50030 for some sort of command before it went out and did it&#8217;s misdeeds..  Then went through the trouble of replacing every tool that you would normally use to detect these things with their own custom version which hid the running process..</p>
<p>That&#8217;s not even the sneaky part..  they also went through and set the attrib of those files to make them undeletable even by root.  Annoying.</p>
<p>So instead of trying to save the box, and undo the fuckery that they had installed.  I just wiped it.  I installed a much later version of the OS and all new stuff.. restored the database, and all things are now happy.</p>
<p>It was a good learning experience and interesting for the most part.  It really went a long way to point out that I&#8217;m a software engineer, not a server admin.  And it really seems like the more you are one, the less you are the other..  I&#8217;m trying to learn this stuff, but its a lot of magic to me at this point.  I mean there is so much to know, I don&#8217;t see how anyone could know it all.</p>
<p>Add to the fact that the internet is by it very nature a warzone and this server/hacker thing is an eternal arms race and I begin to think, why the hell bother?   I want a server is the obvious answer..</p>
<p>As always I don&#8217;t blame the hacker .. its a game really.. I wish I knew how they got in, not so I could hack other boxes but so I could make it safe on mine &#8212; this is something I&#8217;ll likely never learn.</p>
<p>So this is what I did once I got a fresh install on the box &#8212; I put this here for me so I can do it quickly and easily next time;</p>
<p>less /etc/inittab &#8212; make sure we are in rc level 3, if not change it and reboot</p>
<p>chkconfig &#8211;list | grep 3:on  &#8212; Shows run level of services managed through init.d make sure everything is on you want on, and off that you don&#8217;t want.</p>
<blockquote><p>Only do this if you want sendmail off, which you likely wont want because PHP needs it.</p></blockquote>
<blockquote><p>chkconfig &#8211;level 3 sendmail off &#8212; turn off sendmail so it doesn&#8217;t start on boot and annoy me constantly<br />
service sendmail stop &#8212; turn off sendmail (smtp port 25 is now closed)</p></blockquote>
<p>cd /etc/cron.daily &#8212; turn off the annoying logwatch email spam which is again an annoyance.</p>
<p>netstat -pan | grep LIST  &#8212; Show a list of all open ports/listeners<br />
nmap localhost &#8212; does the same thing, make sure they don&#8217;t conflict</p>
<p>useradd [newuser]<br />
passwd [newuser]</p>
<p>visudo &#8212; Add [newuser] to the sudoers list<br />
log out as root and relog in as [newuser]</p>
<p>sudo yum install vim &#8212; install VIM because I prefer it as my remote editor<br />
sudo vim /etc/ssh/sshd_config &#8212; set PermitRootLogin to no so that root can&#8217;t SSH into the box</p>
<p>sudo yum list all &gt; ~/rpm-avail.txt &#8212; get a list of everything installable, its easier to get a grep on the file</p>
<p>sudo yum -y install httpd php mysql mysql-server php-mysql  &#8212; Install traditional LAMP setup</p>
<p>sudo /sbin/service mysqld start &#8212; Start up mysqld<br />
sudo /sbin/service httpd start &#8212; Start up apache</p>
<p>sudo /sbin/chkconfig &#8211;level 3 mysqld on &#8212; Make sure mysqld starts on reboot<br />
sudo /sbin/chkconfig &#8211;level 3 httpd on &#8212; Make sure apache starts on reboot</p>
<p>We don&#8217;t want people hitting our MySQL from out side so we need to make sure its only listening to the internal port.. Not sure why this isn&#8217;t the default setting.</p>
<p>sudo vim /etc/my.cnf  &#8212; Add &#8220;bind-address=127.0.0.1&#8243; to the [mysqld] block<br />
mysqladmin -u root password &#8216;new-password&#8217;</p>
<p>We want to keep people from using our apache as a proxy, so;<br />
sudo vim /etc/httpd/conf/httpd.conf<br />
Comment out LoadModule proxy_{anything} and restart apache<br />
Change the AllowOverride None to AllowOverride ALL in the root directory (this lets .htaccess changes work)</p>
<p>Now create the various databases and restore those bad boys using the database user/passwords appropriate for those.</p>
<p>Restore the files to their correct places and make sure the virtual host information is correct in httpd.conf</p>
<p>Also, change the logrotate.conf to rotate the httpd logs daily instead of weekly.. otherwise they get biggish..</p>
<p>aaaannd.. GO!</p>
]]></content:encoded>
			<wfw:commentRss>http://randomstringofwords.com/server-hacked/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

