<?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>Admin Blogishness &#187; administration</title>
	<atom:link href="http://blog.linux-tech.net/category/administration/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.linux-tech.net</link>
	<description>Hiding inside the Kernel</description>
	<lastBuildDate>Thu, 31 Jul 2008 16:27:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.3</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Cron: Permission denied?</title>
		<link>http://blog.linux-tech.net/2007/11/30/cron-permission-denied/</link>
		<comments>http://blog.linux-tech.net/2007/11/30/cron-permission-denied/#comments</comments>
		<pubDate>Sat, 01 Dec 2007 01:48:19 +0000</pubDate>
		<dc:creator>Tom Whiting</dc:creator>
				<category><![CDATA[administration]]></category>

		<guid isPermaLink="false">http://blog.linux-tech.net/2007/11/30/cron-permission-denied/</guid>
		<description><![CDATA[When setting up new server this week, and trying to add cronjobs, I noticed that I was getting an error:
cron/user: Permission denied
What caused this? Why is it here?  How to resolve? Read more
This was caused because of a faulty CPanel setup, or a faulty server setup. Either way,  permissions were not set appropriately [...]]]></description>
			<content:encoded><![CDATA[<p>When setting up new server this week, and trying to add cronjobs, I noticed that I was getting an error:</p>
<blockquote><p>cron/user: Permission denied</p></blockquote>
<p>What caused this? Why is it here?  How to resolve? Read more<span id="more-12"></span></p>
<p>This was caused because of a faulty CPanel setup, or a faulty server setup. Either way,  permissions were not set appropriately for fixing this issue. Here&#8217;s how I got it fixed, and a brief explanation of HOW this happens, WHY it happens, and whatnot (ie: the tech crap)</p>
<p>This happens because the user did not have permission to write to the specific file that cron needs to change in the /var/spool/cron directory.  There are two ways to change this:</p>
<ol>
<li>Make the directory world writable. This is a security risk, because this would let anything write anything to this directory, without any sort of security. Bad idea, but if you want to do this, you can do this like so.<br />
<blockquote><p>chmod a+w /var/spool/cron</p></blockquote>
</li>
<li>Fix the permissions on cron so that the user can execute it with suid priviledges. This will allow the binary to write to this specific file, but ONLY the binary.<br />
<blockquote><p>chmod 4775 /usr/bin/crontab</p></blockquote>
</li>
</ol>
<p>Obviously the second way is more secure, because it enforces strict rules as to what can be done, what can&#8217;t be done, and the like. This keeps things secured to a degree, while still allowing security measures to be in place. Of course, someone abusing the crontab binary is STILL possible, but that&#8217;s for another entry.</p>
<ol></ol>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fblog.linux-tech.net%2F2007%2F11%2F30%2Fcron-permission-denied%2F';
  addthis_title  = 'Cron%3A+Permission+denied%3F';
  addthis_pub    = 'twhiting9275';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://blog.linux-tech.net/2007/11/30/cron-permission-denied/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Server Security &#8211; How much is too much (or too little)</title>
		<link>http://blog.linux-tech.net/2007/11/18/server-security-how-much-is-too-much-or-too-little/</link>
		<comments>http://blog.linux-tech.net/2007/11/18/server-security-how-much-is-too-much-or-too-little/#comments</comments>
		<pubDate>Sun, 18 Nov 2007 21:23:00 +0000</pubDate>
		<dc:creator>Tom Whiting</dc:creator>
				<category><![CDATA[administration]]></category>

		<guid isPermaLink="false">http://blog.linux-tech.net/wordpress/?p=3</guid>
		<description><![CDATA[I read  a number of individual comments about &#8220;server security&#8221;, and how individuals focus more on &#8220;security&#8221; and less on &#8220;customer usability&#8221;, and it just makes me wonder HOW individuals get away with pulling such ridiculous stunts. Well, here&#8217;s a few tips from someone who&#8217;s been in the game a while. I&#8217;m not going [...]]]></description>
			<content:encoded><![CDATA[<p>I read  a number of individual comments about &#8220;server security&#8221;, and how individuals focus more on &#8220;security&#8221; and less on &#8220;customer usability&#8221;, and it just makes me wonder HOW individuals get away with pulling such ridiculous stunts. Well, here&#8217;s a few tips from someone who&#8217;s been in the game a while. I&#8217;m not going to tell you HOW to do this (I don&#8217;t reveal any secrets), but a few good tips should be all it takes.<br />
<span id="more-3"></span><br />
Firstly, when it comes to a server, you have to ask yourself</p>
<blockquote><p> What is this going to be used for?</p></blockquote>
<p>If you&#8217;re going to use your server for <strong>hosting</strong>, then you are going to be going through an uphill battle. Thankfully, this entry will help you at least somewhat keep things stable.<br />
Now that  we&#8217;ve established what you&#8217;re using it for, it&#8217;s time to secure the server. Seriously, security MUST be placed on any server, updated, and managed as if it were your own computer (it is, after all, you&#8217;re just paying someone to use it).</p>
<p><em>Step One , the firewall</em><br />
There are a few schools of thought on this, and none are &#8220;wrong&#8221; per se, none are correct. You NEED to have a firewall (iptables) interface in your system though if you&#8217;re running ANY kind of Linux Server online. The firewall will dictate whom can access which ports, and set the rules forth. This is VERY important! In the web hosting industry, the two more popular ones are APF and CSF. Do your homework on each, especially the authors of each, before you download and install either! I would also (very) strongly suggest that you harden your tcpwrappers, part of which is shown <a href="http://blog.linux-tech.net/index.php?/archives/3-Does-YOUR-ISP-support-insecure-DNS-Youd-be-surprised-to-see-which-DO!.html" title="here">here</a>  .</p>
<p><em>Step Two, the system</em><br />
Ok, we&#8217;ve got a firewall installed, now let&#8217;s move on to the system. Here are a few tips and tricks that you might want to use when securing systems<br />
A&gt; Disable compilers for normal users<br />
B&gt; Disable wget, get, lynx, curl for normal users<br />
C&gt; Secure /tmp so that exes can&#8217;t be run from it directly (note: this will NOT stop perl exploits!!)<br />
D&gt; Disable ICMP<br />
E&gt; Remove unused stuff (cups, etc)</p>
<p><em>Step Three, the logs</em><br />
Your system talks to you on a daily basis, do you know what it&#8217;s saying? Better yet, do you know how to <strong>interpret </strong>what it&#8217;s saying?<br />
Have your critical logs forwarded to you. These can be done from logwatch , but that will also ignore day to day things such as alerts from your firewall, etc. Don&#8217;t just have them forwarded, but LOOK at them, see what your system is telling you!</p>
<p><em>Step Four, the software</em><br />
Update your software, ALWAYS use protective patches like suhosin to secure your software, whenever possible, and whenever it won&#8217;t defeat the purpose of your server.  Keep your software up to date!<br />
A few things <strong>NOT</strong> to do (unless you like a lot of headaches, that is):<br />
&#8211; Never disable php functionality. It&#8217;s there for a reason, and your client needs access to these things. Instead, use something like suhosin to properly secure and harden php!</p>
<p>&#8211; Never use phpsuexec/suphp . These are serious deterrents to real php programmers and developers. Why?</p>
<p>1: phpsuexec/suphp don&#8217;t like php values in .htaccess files. This means that your advanced programmer (such as myself) who places multiple sites under one directory, and uses htaccess to control each site and directory is screwed. This will also upset and alienate advanced programmers. You ARE running a hosting business, right? Do you WANT individuals complaining about not being able to use software?<br />
2: phpsuexec/suphp HATE symlinks. While this isn&#8217;t (usually) going to be a problem, it will if you&#8217;re running, say, large media sites that should have data stored on another drive</p>
<p>&#8211; Never use grsecurity for your kernel, EVER! The Linux Kernel is the core of the OS, the <strong>most important</strong> part of the entire beast, yet, the most fragile. Putting something like grsecurity in there is just asking for trouble. Not to mention, it is a beast and a half to configure properly for your users to access.</p>
<p>&#8211; Never allow full ssh access, <strong>ever</strong>. Yes, I stress that, because there is no reason that anyone should ever need ssh access. With advanced, on the fly editors like Ultraedit, changes can be made to websites from within Windows itself, and ftp&#8217;ed over to the server. The only reason a user would need &#8220;ssh access&#8221; is to compile something, to run a program (daemon) on your server, or something else. There are no other reasons, and if they&#8217;re doing that, you&#8217;d <strong>best</strong> have some sort of proof that they&#8217;re legitimate.</p>
<p>Now, following the above examples is just a start to providing a <strong><em>usable, secured</em></strong> server. Of course, any admin with half their sense to them will tell you anything is hackable, as long as it is online, or has a keyboard input.  Them&#8217;s the breaks though, really. The difference between MOST and what is recommended here? You&#8217;re going to end up with client usability with what is recommended here. With most, you&#8217;re seriously cutting off client usability.</p>
<p>As always, questions, thoughts, and ideas are welcomed. Spam is not,</p>
<p>Tom</p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fblog.linux-tech.net%2F2007%2F11%2F18%2Fserver-security-how-much-is-too-much-or-too-little%2F';
  addthis_title  = 'Server+Security+%26%238211%3B+How+much+is+too+much+%28or+too+little%29';
  addthis_pub    = 'twhiting9275';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://blog.linux-tech.net/2007/11/18/server-security-how-much-is-too-much-or-too-little/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL and backups. How do I do it?</title>
		<link>http://blog.linux-tech.net/2007/09/18/sql-and-backups-how-do-i-do-it/</link>
		<comments>http://blog.linux-tech.net/2007/09/18/sql-and-backups-how-do-i-do-it/#comments</comments>
		<pubDate>Tue, 18 Sep 2007 06:04:22 +0000</pubDate>
		<dc:creator>Tom Whiting</dc:creator>
				<category><![CDATA[administration]]></category>

		<guid isPermaLink="false">http://blog.linux-tech.net/wordpress/?p=4</guid>
		<description><![CDATA[Probably one of the most important things you will have to do in your life as a systems admin is BACKUPS. Typically, you can rsync things from A to B, and then reverse to restore. HOWEVER, there are certain things that this should never be done for. One of those very critical things is MySQL.

Now, [...]]]></description>
			<content:encoded><![CDATA[<p>Probably one of the most important things you will have to do in your life as a systems admin is BACKUPS. Typically, you can rsync things from A to B, and then reverse to restore. HOWEVER, there are certain things that this should never be done for. One of those very critical things is MySQL.<br />
<span id="more-4"></span><br />
Now, there are those that would say &#8220;Oh, you can simply rsync mysql over, no big deal&#8221;, and those individuals are partially correct. HOWEVER, it is key to note that this is not the <strong>safe</strong> way to do this. Why? Well, let&#8217;s examine this, and you&#8217;ll see why.</p>
<p>Mysql, in it&#8217;s raw format is binary. What happens when you try to click on an .exe that is only partially downloaded? Oops, you can&#8217;t do that. The very same risk is there with mysql, only MORESO, because of what mysql is, and how it handles itself.</p>
<p>Firstly, mysql, on a properly setup server can handle hundreds of queries a second. I&#8217;ve had my own 2 servers going at 500+ each repeatedly. Now that&#8217;s not good on processing and whatnot, but hey, it&#8217;s not a completely BAD thing.<br />
Secondly, mysql, when properly setup, locks tables on execution. So, if it has to so much as go to the bathroom on another table, it locks a table so nothing else can deal with it. Smart thinking there.<br />
Thirdly, mysql is god. Seriously. Ok, maybe not GOD, but it is used in EVERYTHING from blogs (this one is powered by it) to forums (phpbb,smf,ipb,vbulletin, all use it)to you name it, they all use it.</p>
<p>Now, let&#8217;s just say that you&#8217;re running along and doing a backup at midnight, and at the same time Joe Bloe invites his 5 friends to his blog, and they all make a comment on different entries. Well, if you&#8217;re doing things the RIGHT way, nothing happens, maybe those entries aren&#8217;t made, but maybe they are copied. No harm, no foul, right? However, IF you&#8217;re doing things the wrong way, the entire blog can be seriously messed up, due to the binary structure of mysql.</p>
<p>Let&#8217;s say you have to restore from those backups, the very next day. What&#8217;s going to happen to Joe Bloe&#8217;s blog? If you did things properly, nothing at all. if you did things the way that others mention to do it (rsync), it can , in fact, be a VERY big (and messy) deal. Joe Bloe&#8217;s blog (at minimum) is not going to be right, and will need repairing, and that&#8217;s ONLY if you&#8217;re lucky. Typically, much more will break.</p>
<p>Let&#8217;s say you&#8217;re moving from server A to server B . Server A has mysql4 on it, while server B has mysql 5 on it. OOPS, your backups are going to screw the entire server over, literally.</p>
<p>So, that said and done, how do we do backups PROPERLY, so that they will work in (virtually) any scenario with minimal issues? That&#8217;s easy.<br />
First, we need our script:</p>
<blockquote><p> DATE=`date +%m%d%y`<br />
THISNEWDATE=`date +%m%d%y-%T`<br />
THISMONTH=`date +%b-%y`<br />
BACKUP=/backup/sql<br />
OLDBACKUPDIR=/backup/sql-archived<br />
BACKMONTH=$BACKUP/$THISMONTH<br />
BACKDEST=$BACKMONTH/$DATE<br />
echo &#8220;SQL Backup Started : $THISNEWDATE&#8221;;<br />
if [ ! -d $BACKMONTH ];then<br />
tar jcpf $OLDBACKUPDIR/$THISMONTH.tar.bz2 $BACKUP<br />
rm -rf $BACKUP<br />
mkdir $BACKUP<br />
mkdir $BACKMONTH<br />
fi</p>
<p>if [ $BACKDEST ];then<br />
rm -rf $BACKDEST<br />
fi</p>
<p>if [ ! -d $BACKDEST ];then<br />
mkdir $BACKDEST<br />
fi</p>
<p>for var in `find /var/lib/mysql/ -type d | \<br />
sed -e &#8220;s/\/var\/lib\/mysql\///&#8221;`; do<br />
mysqldump  &#8211;add-drop-table  $var &gt;&gt; $BACKDEST/$var.sql<br />
done<br />
THISENDATE=`date +%m%d%y-%T`<br />
echo &#8220;SQL Backup Ended : $THISENDATE&#8221;;</p></blockquote>
<p>Now, 4 variables need to be changed there:<br />
A&gt; backdest needs to point to an actual backup destination<br />
B&gt; oldbackupdir needs to be changed to the directory you want your ARCHIVED backups sent to</p>
<p>SO, an explanation as to what this does to your srever, how it&#8217;s run (as root), and the like:</p>
<p>Firstly, this checks to see if the backup destination exists. If it doesn&#8217;t, it takes care of that.<br />
Secondly, it checks to see if the backup destination / month exists. If it doesn&#8217;t, then it archives everything from the PREVIOUS month to your archived directory (what you created in B)<br />
Thirdly, it then makes a backup of the entire database structure in .sql dump format, adding the necessary &#8211;add-drop-table format to this.</p>
<p>I can&#8217;t tell you how many times over the years that this has worked for me. It&#8217;s literally a lifesaver. SQL is so critical that you SHOULD back it up every day, while flat files are usually good with once a week (though I do every day as well), and incremental backups.</p>
<p>So, now that we have the script in a file, how to use it? We call it through cron:<br />
From the shell (as root)</p>
<blockquote><p> crontab -e</p></blockquote>
<p>add this to the cron tab</p>
<blockquote><p> 0 1 * * *  /path/to/sqlback.sh &gt; /dev/null 2&gt;&amp;1</p></blockquote>
<p>Good luck with your backups!</p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fblog.linux-tech.net%2F2007%2F09%2F18%2Fsql-and-backups-how-do-i-do-it%2F';
  addthis_title  = 'SQL+and+backups.+How+do+I+do+it%3F';
  addthis_pub    = 'twhiting9275';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://blog.linux-tech.net/2007/09/18/sql-and-backups-how-do-i-do-it/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL &#8211; Is it optimized?</title>
		<link>http://blog.linux-tech.net/2007/09/17/sql-is-it-optimized/</link>
		<comments>http://blog.linux-tech.net/2007/09/17/sql-is-it-optimized/#comments</comments>
		<pubDate>Mon, 17 Sep 2007 06:06:05 +0000</pubDate>
		<dc:creator>Tom Whiting</dc:creator>
				<category><![CDATA[administration]]></category>

		<guid isPermaLink="false">http://blog.linux-tech.net/wordpress/?p=5</guid>
		<description><![CDATA[Running 2 webservers myself,  both very intense in SQL services (what server isn&#8217;t any more?), I found that SQL can be ugly, it can be just downright ugly, especially when NOT optimized on a frequent basis. Today, I&#8217;ll go through a very simple trick and script to optimize your SQL databases. Doing this saves [...]]]></description>
			<content:encoded><![CDATA[<p>Running 2 webservers myself,  both very intense in SQL services (what server isn&#8217;t any more?), I found that SQL can be ugly, it can be just downright ugly, especially when NOT optimized on a frequent basis. Today, I&#8217;ll go through a very simple trick and script to optimize your SQL databases. Doing this saves me 10-20 meg a day in backups.</p>
<p>Tomorrow, how to create daily SQL backups OUTSIDE of your control panel, and restore from them if necessary!<br />
<span id="more-5"></span><br />
First, we need a script. This script will be a php script, used to determine the databases, and whatnot. This is a php script, so create a .php file on your server (as root), and put these contents in there:</p>
<blockquote><p> #!/usr/local/bin/php<br />
$myuser=&#8221;root&#8221;;<br />
$mypass=&#8221;insertyourrootpasswordhere&#8221;;<br />
$myhost=&#8221;localhost&#8221;;<br />
$query = &#8220;SHOW DATABASES&#8221;;<br />
$mtime = microtime();<br />
$mtime = explode(&#8221; &#8220;,$mtime);<br />
$mtime = $mtime[1] + $mtime[0];<br />
$start_time = $mtime;</p>
<p>$dbh=mysql_connect (&#8221;$myhost&#8221;, &#8220;$myuser&#8221;, &#8220;$mypass&#8221;) or die(mysql_error());<br />
$result = mysql_query($query) or die (&#8221;Error in query: $query. &#8220;.mysql_error());<br />
$count = 0;<br />
while ($row = mysql_fetch_array($result)) {<br />
$count = $count + 1;<br />
$thisdb=$row[0];<br />
cleanup($thisdb);</p>
<p>}<br />
function cleanup($dbname)<br />
{<br />
check_exists($dbname);<br />
global $myuser, $mypass, $myhost;<br />
$dbh=mysql_connect (&#8221;$myhost&#8221;, &#8220;$myuser&#8221;, &#8220;$mypass&#8221;) or die(mysql_error());<br />
mysql_select_db ($dbname) or die(mysql_error());<br />
$db_clean = $dbname;<br />
$tot_data = 0;<br />
$tot_idx = 0;<br />
$tot_all = 0;<br />
$local_query = &#8216;SHOW TABLE STATUS FROM &#8216;.$dbname;<br />
$result=mysql_query($local_query) or die(mysql_error());<br />
if (mysql_num_rows($result)) {<br />
while ($row = mysql_fetch_array($result)) {<br />
$tot_data = $row['Data_length'];<br />
$tot_idx  = $row['Index_length'];<br />
$total = $tot_data + $tot_idx;<br />
$total = $total / 1024 ;<br />
$total = round ($total,3);<br />
$gain= $row['Data_free'];<br />
$gain = $gain / 1024 ;<br />
$total_gain += $gain;<br />
$gain = round ($gain,3);<br />
$local_query = &#8216;OPTIMIZE TABLE &#8216;.$row[0];<br />
$resultat=mysql_query($local_query);<br />
if ($gain == 0) {</p>
<p>} else {</p>
<p>}<br />
}<br />
}</p>
<p>while ($row = mysql_fetch_row($result)) {<br />
$histo += $row[0];<br />
$cpt += 1;<br />
}<br />
}<br />
function check_exists($dbname)<br />
{<br />
global $myuser, $mypass, $myhost;<br />
$dbh=mysql_connect (&#8221;$myhost&#8221;, &#8220;$myuser&#8221;, &#8220;$mypass&#8221;) or die(mysql_error());<br />
mysql_select_db ($dbname) or die(mysql_error());<br />
}<br />
function microtime_diff($a, $b) {<br />
list($a_dec, $a_sec) = explode(&#8221; &#8220;, $a);<br />
list($b_dec, $b_sec) = explode(&#8221; &#8220;, $b);<br />
return $b_sec &#8211; $a_sec + $b_dec &#8211; $a_dec;<br />
}<br />
$mtime = microtime();<br />
$mtime = explode(&#8221; &#8220;,$mtime);<br />
$mtime = $mtime[1] + $mtime[0];<br />
$end_time = $mtime;<br />
$total_time = ($end_time &#8211; $start_time);<br />
$total_time = substr($total_time,0,5);<br />
print&#8221;Processing Time: $total_time seconds\n&#8221;;<br />
?&gt;</p></blockquote>
<p>One thing here:</p>
<p>You&#8217;ll notice that this uses ROOT priviledges, so I&#8217;d suggest you encrypt this script. <a href="http://www.ioncube.com/" title="ioncube">ioncube</a> does a remarkably good per-script encoding online. Usually, they want (about) .10, which is incredibly reasonable!</p>
<p>SO, now that we have our script, what on earth are we going to do it? Using it is the most important part, right? Let&#8217;s get to that:</p>
<p>You&#8217;ll need to change the permissions on the script to what you like them to be, but it should (note: shoudl) at minimum be executable</p>
<blockquote><p> chmod u+x ./scriptname.php</p></blockquote>
<p>And we&#8217;re done</p>
<p>Now, let&#8217;s call the script to make sure that it works right</p>
<blockquote><p> ./scriptname.php</p></blockquote>
<p>If it doesn&#8217;t work right, well, there&#8217;s usually a problem. Firstly, make sure that php is correct, and in the correct location. From bash:</p>
<blockquote><p> which php</p></blockquote>
<p>If it&#8217;s not in /usr/local/bin/php (which most are), then adjust the first line of the script<br />
Secondly, maybe you need to update php? That one, I&#8217;m not going to cover in a tutorial as it CAN break things. Feel free to <a href="http://www.linux-tech.net/contact.php">Contact Me</a> though for a very well priced update<br />
Thirdly, hey, things happen. If it still doesn&#8217;t work, after you&#8217;ve updated php AND checked the location, then please, feel free to reply with your problem and we can see if we can&#8217;t get it working together.</p>
<p>Now, it works. Let&#8217;s tell the system to do it automatically. Again, from bash:</p>
<blockquote><p> crontab -e</p></blockquote>
<p>Add the following to your cron job:</p>
<blockquote><p> 30 12 * * * /path/to/scriptname.php &gt; /dev/null 2&gt;&amp;1</p></blockquote>
<p>THIS will set the cron job to run @ 1230 every day, and then you will have optimized tables.</p>
<p>Thoughts, comments, ideas? As always, put &#8216;em here.</p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fblog.linux-tech.net%2F2007%2F09%2F17%2Fsql-is-it-optimized%2F';
  addthis_title  = 'SQL+%26%238211%3B+Is+it+optimized%3F';
  addthis_pub    = 'twhiting9275';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://blog.linux-tech.net/2007/09/17/sql-is-it-optimized/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>service httpd does not support chkconfig  &#8212; How to fix?</title>
		<link>http://blog.linux-tech.net/2007/09/08/service-httpd-does-not-support-chkconfig-how-to-fix/</link>
		<comments>http://blog.linux-tech.net/2007/09/08/service-httpd-does-not-support-chkconfig-how-to-fix/#comments</comments>
		<pubDate>Sat, 08 Sep 2007 06:07:33 +0000</pubDate>
		<dc:creator>Tom Whiting</dc:creator>
				<category><![CDATA[administration]]></category>

		<guid isPermaLink="false">http://blog.linux-tech.net/wordpress/?p=6</guid>
		<description><![CDATA[So, on setting up a few new servers tonight for a client, I ran into the following error
 [root@server ~]# rpm -e httpd httpd-suexec httpd-devel php php-pear php-devel php-imap
service httpd does not support chkconfig
error: %preun(httpd-2.0.52-32.3.ent.centos4.i386) scriptlet failed, exit status 1
[root@server ~]#
What happened here? This was a stock CentOS4 server (completely updated). How to resolve? Read [...]]]></description>
			<content:encoded><![CDATA[<p>So, on setting up a few new servers tonight for a client, I ran into the following error</p>
<blockquote><p> [root@server ~]# rpm -e httpd httpd-suexec httpd-devel php php-pear php-devel php-imap<br />
service httpd does not support chkconfig<br />
error: %preun(httpd-2.0.52-32.3.ent.centos4.i386) scriptlet failed, exit status 1<br />
[root@server ~]#</p></blockquote>
<p>What happened here? This was a stock CentOS4 server (completely updated). How to resolve? Read more to find out.<br />
<span id="more-6"></span></p>
<p>in /etc/init.d/httpd (or /etc/rc.d/init.d/httpd) , on the second line, add</p>
<blockquote><p> # chkconfig: 2345 10 90<br />
# description: Activates/Deactivates Apache Web Server</p></blockquote>
<p>This will force httpd to support chkconfig.</p>
<p>Now, you can run the following safely</p>
<blockquote><p> [root@server ~]# rpm -e httpd httpd-suexec httpd-devel php php-pear php-devel php-imap</p></blockquote>
<p>Unfortunately, you will need to reinstall your control panel (CPanel, DirectAdmin), as they don&#8217;t  install correctly when they hit that error. If you don&#8217;t know how to do this, that&#8217;s quite simple.</p>
<p>Installing <strong>Cpanel</strong>:</p>
<blockquote><p> wget http:// layer1.cpanel.net/cpanel-universal-install-v11.sea (take out the space after http://)<br />
sh ./cpanel-universal-install-v11.sea</p></blockquote>
<p>Then sit back and wait for the stuff to go on. It&#8217;ll take 1-2 hours to install CP, then you need to re-install rvskins and Fantastico if you have them<br />
<strong>Fantastico</strong></p>
<blockquote><p> cd /usr/local/cpanel/whostmgr/docroot/cgi<br />
wget -N http:// files.betaservant.com/files/free/fantastico_whm_admin.tgz (again, take out the space after http://)<br />
tar -xzpf fantastico_whm_admin.tgz<br />
rm -rf fantastico_whm_admin.tgz</p></blockquote>
<p><strong>Rvskin</strong></p>
<blockquote><p> mkdir /root/rvadmin;<br />
cd /root/rvadmin;<br />
wget http:// download.rvglobalsoft.com/download.php/download/rvskin-auto/saveto/rvauto.tar.bz2;  (again, remove the space after http://)<br />
bunzip2 -d rvauto.tar.bz2; tar -xvf rvauto.tar;<br />
perl /root/rvadmin/auto_rvskin.pl</p></blockquote>
<p>Now you&#8217;ve got cpanel re-installed properly. Hope that helps out</p>
<p>Installing <strong>Directadmin</strong>:</p>
<blockquote><p> wget http:// www.directadmin.com/setup.sh (again, take out the space after http://)<br />
chmod 755 setup.sh<br />
sh ./setup.sh</p></blockquote>
<p>Did this help you out? Hey, leave a comment and say so!</p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fblog.linux-tech.net%2F2007%2F09%2F08%2Fservice-httpd-does-not-support-chkconfig-how-to-fix%2F';
  addthis_title  = 'service+httpd+does+not+support+chkconfig++%26%238212%3B+How+to+fix%3F';
  addthis_pub    = 'twhiting9275';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://blog.linux-tech.net/2007/09/08/service-httpd-does-not-support-chkconfig-how-to-fix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Does YOUR ISP support insecure DNS? You&#8217;d be surprised to see which DO!</title>
		<link>http://blog.linux-tech.net/2007/09/04/does-your-isp-support-insecure-dns-youd-be-surprised-to-see-which-do/</link>
		<comments>http://blog.linux-tech.net/2007/09/04/does-your-isp-support-insecure-dns-youd-be-surprised-to-see-which-do/#comments</comments>
		<pubDate>Tue, 04 Sep 2007 06:08:51 +0000</pubDate>
		<dc:creator>Tom Whiting</dc:creator>
				<category><![CDATA[administration]]></category>

		<guid isPermaLink="false">http://blog.linux-tech.net/wordpress/?p=7</guid>
		<description><![CDATA[With CPanel 11 rolling out as stable, you&#8217;d be surprised to see the number of individuals I get with this response:
I can&#8217;t access CPanel/webmail/etc. When I try, I get the following error
The server was configured to not permit you access to the specified resource. If you believe this is in error or inadvertent, please contact [...]]]></description>
			<content:encoded><![CDATA[<p>With CPanel 11 rolling out as stable, you&#8217;d be surprised to see the number of individuals I get with this response:<br />
I can&#8217;t access CPanel/webmail/etc. When I try, I get the following error</p>
<blockquote><p>The server was configured to not permit you access to the specified resource. If you believe this is in error or inadvertent, please contact the<br />
system administrator and ask them to update the host access files.</p></blockquote>
<p><span id="more-7"></span><br />
There IS only one thing causing this through CPanel, a <strong>properly configured</strong> server, at least the way I set servers up there is. With a great deal of investigation (ok, it only took me about 3 hours, within the first week of using CP 11;)), I found the issue. The problem? It&#8217;s NOT a server issue, but an ISP DNS issue. Here&#8217;s what happened, why it&#8217;s happening now and not before, and what the ISPs are saying about it:</p>
<p>Firstly, what is happening, and why it&#8217;s happening now:<br />
Servers should <strong>always</strong> be configured to deny host spoofing attacks, through any method available.  One simple method? Adding</p>
<blockquote><p> ALL: PARANOID</p></blockquote>
<p>to /etc/hosts.deny</p>
<p>What does this do? Well, that&#8217;s actually quite simple:<br />
This entry in hosts.deny will deny access to ANY program utilizing tcpwrapper security unless the DNS is properly setup. If it is not setup properly, the activity is denied. Simple, right? Still don&#8217;t understand? Ok, I&#8217;ll go a bit more in depth here:<br />
Let&#8217;s take an ip I own, lease, etc, and use that as an example. This ip is <strong>65.254.41.186</strong><br />
Now, doing a lookup on 65.254.41.186 shows the following:</p>
<blockquote><p>  nslookup 65.254.41.186<br />
Server:         208.67.222.222<br />
Address:        208.67.222.222#53<br />
Non-authoritative answer:<br />
186.41.254.65.in-addr.arpa      name = jarlata.linux-tech.net.<br />
Authoritative answers can be found from:</p></blockquote>
<p>This is good. I have RDNS setup for this ip address to point to the hostname of jarlata.linux-tech.net . Now, according to RFC standards, I must ALSO have a SINGLE A entry in my dns configuration for jarlata.linux-tech.net, and it MUST point to the ip address <strong>65.254.41.186</strong>. I do, and  it does</p>
<blockquote><p> nslookup jarlata<br />
Server:         208.67.222.222<br />
Address:        208.67.222.222#53</p>
<p>Non-authoritative answer:<br />
Name:   jarlata.linux-tech.net<br />
Address: 65.254.41.186</p></blockquote>
<p>So, by doing this, I&#8217;ve passed a basic security check, and first year networking classes.<br />
The problem, however, comes when ips are NOT properly configured. For example, let&#8217;s take a very odd situation, let&#8217;s say I had <strong>127.0.0.1</strong>  configured to point to <strong>unlocalhost</strong> as a reverse dns entry. Of course, we all know (those of us in the security game) that&#8217;s not right, and it&#8217;s wrong, but let&#8217;s say for the sake of argument that I did. If I did NOT have an <strong>unlocalhost</strong> entry in my FORWARD dns (the zone responsible for 127.0.0.1), then , well, I wouldn&#8217;t be doing things properly, now, would I? Of course not. Even better, if I had <strong>unlocalhost</strong> pointing to <strong>127.0.0.1</strong> <em>and</em> <strong>127.0.0.2</strong>, it would be, again, an incorrect entry.</p>
<p>Now, what all affect does this have on servers, security, and the like? Believe it or not, a LOT!<br />
In the first case (my host), the DNS is configured properly, so traffic walks in through tcpwrappers, no worries , walks out,  and things are normal. They&#8217;re normal because they were setup properly!<br />
In the second case (my unlocalhost), things are NOT configured properly, so traffic walks up to the tcpwrapper security guard, and gets booted out. WHY? Because it&#8217;s not possible to verify the authority of the host requesting traffic. What? Why SHOULD anyone leave a server open to traffic which can not be tracked back if need be? You SHOULDN&#8217;T!</p>
<p>The problem here is that without this check, it&#8217;s entirely possible to setup a fake sub.domain.com check and get into a server. I&#8217;ve seen it done enough times (not on my servers mind you) to know it IS entirely possible! For example, I could setup a server and ip with the hostname of suck.microsoft.com , ssh into a server, do my damage and leave. They, in turn would see that I came from suck.microsoft.com and think &#8220;hrrm, that&#8217;s odd&#8221;. Of course, they&#8217;d have NO way to know where the original attack came from, and NO way to pursue any sort of investigation.</p>
<p>So, that said, on to the LAST two questions:<br />
Why is this just <strong>now</strong> taking effect on Cpanel related services? Truth be told, CPanel is just <strong>now</strong> getting in the game of increasing security and awareness of it., and they&#8217;re starting to be mroe and more open to using tcpwrappers which have been built into the Linux environment for ages now!</p>
<p>How to get this resolved?<br />
That one is tricky. In order to get this issue resolved you will need to have your ISP setup PROPER dns for your ip and all of their ip addresses. If your ip is 1.2.3.4 and has an rdns entry of ip-4-3-2-1.provider.com  , then there MUST be an Authoritative entry and ONLY one authoritative entry for   ip-4-3-2-1.provider.com pointing to 1.2.3.4 . No other A entries may exist for  ip-4-3-2-1.provider.com .</p>
<p>Your basic ISP tech will tell you that they can&#8217;t help you, because, guess what, they <strong>can&#8217;t</strong>. In fact they&#8217;ll try to tell you that you need to have a tech come out. Well, guess what, THAT isn&#8217;t going to solve anything either. This isn&#8217;t something that can be solved by some Joe Bloe in a cable (or ISP) truck (or van), it must be solved within their level 2 (or 3) network administration setup. You&#8217;ve got it, you need to talk to the bigwigs, and you probably won&#8217;t have much luck with them. Have them add an A entry for your IP, or FIX the A entry so that there&#8217;s only ONE in there.</p>
<p>In the past couple of months, I&#8217;ve had the unfortunate experience of dealing with ISP&#8217;s left and right about this issue. While MANY of them are co-operative, many just choose to be ignorant about proper RFCs, standards, and refuse to change their dns so that it is PROPERLY adherent to standards. Much like Microsoft trying to use IE to write their own standards, ISP&#8217;s are doing this left and right. More notably, the ISP&#8217;s who have repeatedly REFUSED to do things and correct their mistakes?</p>
<p>AT&amp;T<br />
ComCast<br />
Hargray (1)</p>
<p><strong>1 </strong>-</p>
<blockquote><p> One of our support reps here at Hargray Communications forwarded my<br />
group your e-mail. I help maintain our DNS servers, and hopefully I can<br />
shed some light on this situation.You&#8217;re right, we don&#8217;t have A records for the names we have in our PTR<br />
records. We consider this unnecessary, and would just add to clutter in<br />
our nameservers&#8217; configurations. The only RFC I can find that says this<br />
is required is <a href="http://faqs.org/rfcs/rfc1912.html" title="RFC 1912">RFC 1912</a>, which is not an &#8220;Internet Standard&#8221; RFC. If<br />
you can point to an Internet Standard document which says this is<br />
required, we would appreciate the opportunity to peruse it.</p></blockquote>
<p>Yeah, it&#8217;s unnecessary to provide authentication of an IP, and password auth really isn&#8217;t necessary either. ALL authentication methods and security methods are valuable. An ISP claiming &#8220;it&#8217;s not necessary to provide A entries for DNS&#8221; is just wrong!!  Clutter? Maybe, but if you don&#8217;t CHANGE it, and keep it all in one zone, that takes one guy an hour (MAYBE an hour) to edit a zone file for all ip address. Hire a flunky to do it! it&#8217;s simple text editing!</p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fblog.linux-tech.net%2F2007%2F09%2F04%2Fdoes-your-isp-support-insecure-dns-youd-be-surprised-to-see-which-do%2F';
  addthis_title  = 'Does+YOUR+ISP+support+insecure+DNS%3F+You%26%238217%3Bd+be+surprised+to+see+which+DO%21';
  addthis_pub    = 'twhiting9275';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://blog.linux-tech.net/2007/09/04/does-your-isp-support-insecure-dns-youd-be-surprised-to-see-which-do/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A2 day is here!</title>
		<link>http://blog.linux-tech.net/2007/08/11/a2-day-is-here/</link>
		<comments>http://blog.linux-tech.net/2007/08/11/a2-day-is-here/#comments</comments>
		<pubDate>Sat, 11 Aug 2007 06:10:02 +0000</pubDate>
		<dc:creator>Tom Whiting</dc:creator>
				<category><![CDATA[administration]]></category>

		<guid isPermaLink="false">http://blog.linux-tech.net/wordpress/?p=8</guid>
		<description><![CDATA[So, finally, the day has arrived. I woke up around 3am because of an alert from a client&#8217;s server. Services down, so naturally, I responded.
Being the kind of person that doesn&#8217;t (rather can&#8217;t) just go back to bed, I looked to see what had progressed the past few days with a few things. Lo and [...]]]></description>
			<content:encoded><![CDATA[<p>So, finally, the day has arrived. I woke up around 3am because of an alert from a client&#8217;s server. Services down, so naturally, I responded.<br />
Being the kind of person that doesn&#8217;t (rather can&#8217;t) just go back to bed, I looked to see what had progressed the past few days with a few things. Lo and behold, I found that php 5.2.1 was released and attempted to update it via the &#8220;cpanel&#8221; way.<br />
So, by now you&#8217;re probably wondering &lt;em&gt;what the fork is a2, and what does it have to do with CPanel?&lt;/em&gt;. The answer is quite simple:<span id="more-8"></span><br />
Cpanel has fought for quite some time to declare apache 2 as &#8220;unstable&#8221;, because, well, it is. At least if you take CPanel&#8217;s perspective it is. With all the modules loaded into CP, apache, bandwidth and the like, it can be quite tricky to convert everything to an Apache 2 configuration.</p>
<p>As of Cpanel 11, Apache 2 is now the <em>default</em> installation. The apache build script is completely rewritten (or so it would appear), the way it works is quite new, at least as it results to Apache 2.</p>
<p>Seeing that they had declared it  the default, I figured I&#8217;d give it a go, try to figure out what could  about it and to get things working in a stable, production environment. After all, why not , it <strong>is</strong> after all what individuals expect of me, right? To try to figure out how to make things work? Well,  it took about 8 hours, but I do believe I&#8217;ve finally got &#8216;er figured out and ready to roll.</p>
<p>So, what was/is the problem?</p>
<p>Originally, the CPanel build failed to build http at all. Not a real issue, I&#8217;ve dealt with that before. It took about an hour to get a stable build of apache2 on one server.<br />
Once CPanel had built apache2, I had to recompile php. With the custom configuration I use (patches/updates/etc), I had to completely rebuild it from the ground up. Of course, this meant rewriting my own build script (soon to be released, more info on that later), but that was due.<br />
Once my own build script got rebuilt (another hour), and php was recompiled, I noticed that ioncube wasn&#8217;t loading right. My thoughts were :<br />
<em>WTH, it&#8217;s loading fine in the CLI (shell)?</em><br />
So, now, 2 hours after the rebuild process, I have to try to revert things. This time, not only on ONE server but both, because I had actually thought (foolishly) that the problems were resolved. Silly, silly me!</p>
<p>Well, reverting things didn&#8217;t even come CLOSE to going as well as it should have, and, yeah, I should have expected as much (right?). I mean, regression NEVER works as well as you want it to. So, after 2 failed builds, I just kept digging in until the problem was found.</p>
<p>The problem? Apparently Zend Optimizer wasn&#8217;t loading. Since the ion loaders are built off of Zend (even standalone), thusly, ion couldn&#8217;t load. Not a huge surprise there. So, how did I solve the issue? Well, with a little help from the ion <a href="http://www.ioncube.com/faqs/loaders.php#9a" title="faq">faq</a>,  I was able to find out that &#8211;enable-versioning needed to be turned OFF. From their website:</p>
<blockquote><p>This option can prevent the export of global PHP API symbols, causing failure when attempting to link libraries such as the Loader or Zend Optimiser. PHP must be rebuilt without that option so that the PHP API is correctly visible. A phpinfo page should show at the top of the page what options were used to configure PHP, and should confirm that the option had been used.</p></blockquote>
<p>So, after about 8 hours of solid hair pulling, investigation, and the like, FINALLY I have a <strong>working</strong> php/apache2 build on both servers. Talk about a frustrating experiment gone wild, and all starting out when I just wanted to update php. FUUUUN!</p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Fblog.linux-tech.net%2F2007%2F08%2F11%2Fa2-day-is-here%2F';
  addthis_title  = 'A2+day+is+here%21';
  addthis_pub    = 'twhiting9275';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://blog.linux-tech.net/2007/08/11/a2-day-is-here/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
