<?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>Spind.net Blog &#187; CentOS</title>
	<atom:link href="http://blog.spind.net/tag/centos/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.spind.net</link>
	<description>Stories from the trenches of System Administration</description>
	<lastBuildDate>Thu, 10 Jun 2010 10:51:21 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>CentOS 5 Remote Reinstall over VNC</title>
		<link>http://blog.spind.net/2010/01/14/centos-5-remote-reinstall-over-vnc/</link>
		<comments>http://blog.spind.net/2010/01/14/centos-5-remote-reinstall-over-vnc/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 21:26:57 +0000</pubDate>
		<dc:creator>hc</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Installation]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Reinstall]]></category>
		<category><![CDATA[Remote]]></category>
		<category><![CDATA[VNC]]></category>

		<guid isPermaLink="false">http://blog.spind.net/?p=169</guid>
		<description><![CDATA[So you want to live your life on the edge, and do a remote reinstall of your server? The reasons can be many &#8211; maybe the server was compromised, or &#8211; like me &#8211; you just received a freshly installed new system with a horrible disk partitioning or maybe even the wrong choice of architecture. [...]]]></description>
			<content:encoded><![CDATA[<p>So you want to live your life on the edge, and do a remote reinstall of your server? The reasons can be many &#8211; maybe the server was compromised, or &#8211; like me &#8211; you just received a freshly installed new system with a horrible disk partitioning or maybe even the wrong choice of architecture. I&#8217;ll show you how! <img src='http://blog.spind.net/wp/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>I just received my dedicated server at bulk price, but unfortunately also with a bulk installation of CentOS. It&#8217;s fitted with two 250G disks, yet there is no mirroring or anything installed. On top of this, this delicious 64-bit system was running a 32-bit operating system. I was not amused. Asking for a special reinstall would probably cost me a fortune in support, and even then I probably wouldn&#8217;t get it exactly like I wanted it.</p>
<p>Luckily most new Linux distributions feature remote installation via VNC. If the system is already running Linux &#8211; like this one &#8211; its both easy and safe to play around with this method. In this example, we&#8217;ll be installing CentOS 5.4 x86_64.</p>
<p>Step 1: Get a hold of the bootstrap files. This includes the Linux kernel image and the ramdisk image. Put these on your /boot partition:</p>
<div class="codebox">
$ cd /boot<br />
$ mkdir centos5-x86_64<br />
$ cd centos5-x86_64<br />
$ wget http://mirror.leaseweb.com/centos/5.4/os/x86_64/isolinux/vmlinuz<br />
$ wget http://mirror.leaseweb.com/centos/5.4/os/x86_64/isolinux/initrd.img
</div>
<p>Step 2: Add an entry to the Grub boot loader. Adjust values for network (ip, netmask, dns, gateway) and pick a better VNC password than me. Copy the &#8220;root (&#8230;)&#8221; line from a working entry:</p>
<div class="codebox">
title CentOS 5 VNC Install<br />
        root (hd0,0)<br />
        kernel /centos5-x86_64/vmlinuz vnc vncpassword=foobar headless ip=1.2.3.4 netmask=255.255.255.0 gateway=1.2.3.1 dns=2.3.4.5 ksdevice=eth0 method=http://mirror.leaseweb.com/centos/5.4/os/x86_64/ lang=en_US keymap=us<br />
        initrd /centos5-x86_64/initrd.img
</div>
<p>Step 3: Ask the Grub boot loader to boot your new entry next time, and only next time. This makes a lot of sense if your hosting facility allows you to power cycle the server remote &#8211; and they should. Really. If you can&#8217;t do this yourself, at least you can have some support drone push the reset button if the server doesn&#8217;t come up. Note what number your new entry in the Grub configuration file has. First one is 0, second is 1 etc. I had two entries already, so that made my new entry number 2:</p>
<div class="codebox">
$ echo &#8220;savedefault &#8211;stage2=/boot/grub/stage2 &#8211;default=2 &#8211;once&#8221; | grub &#8211;batch
</div>
<p>Step 4: Reboot and be patient. Some servers take up to five minutes to come back up &#8211; probably because of a BIOS misconfiguration. Anyway, reboot it:</p>
<div class="codebox">
$ reboot
</div>
<p>Step 5: Connect to your server with your favorite VNC client. Mine&#8217;s <a href="http://sourceforge.net/projects/cotvnc/">Chicken of the VNC</a> <img src='http://blog.spind.net/wp/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  You&#8217;ll need to connect to port 5901, which in VNC-terms often is referred to as &#8220;Display 1&#8243;. Use the password you specified:</p>
<p><a href="/uploads/2010/01/vnc.png"><img src="/uploads/2010/01/vnc.png" alt="vnc" title="vnc" width="509" height="314" class="alignnone size-full wp-image-173" /></a></p>
<p>Step 6: Run the install <img src='http://blog.spind.net/wp/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  After this, your neat remote installation will be wiped, so double check all your network settings.</p>
<p><a href="/uploads/2010/01/install.png"><img src="/uploads/2010/01/install-600x466.png" alt="install" title="install" width="600" height="466" class="alignnone size-medium wp-image-174" /></a></p>
<p>Good luck! <img src='http://blog.spind.net/wp/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.spind.net/2010/01/14/centos-5-remote-reinstall-over-vnc/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>CentOS 5 (64) on Sun VirtualBox on Fedora 10 (64)</title>
		<link>http://blog.spind.net/2009/05/21/centos-5-64-on-sun-virtualbox-on-fedora-10-64/</link>
		<comments>http://blog.spind.net/2009/05/21/centos-5-64-on-sun-virtualbox-on-fedora-10-64/#comments</comments>
		<pubDate>Thu, 21 May 2009 14:20:32 +0000</pubDate>
		<dc:creator>hc</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[Sun]]></category>
		<category><![CDATA[VirtualBox]]></category>
		<category><![CDATA[x86_64]]></category>

		<guid isPermaLink="false">http://blog.spind.net/?p=141</guid>
		<description><![CDATA[I&#8217;ve been playing around with Sun VirtualBox. Installation of both Windows XP and CentOS 5 went smooth, but installing the guest OS tweaks &#8211; in the VirtualBox world referred to as Additions &#8211; gave me a little trouble on CentOS. It&#8217;s done the same way as on VMWare, by mounting an ISO with the scripts [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been playing around with <a href="http://www.virtualbox.org/">Sun VirtualBox</a>. Installation of both Windows XP and CentOS 5 went smooth, but installing the guest OS tweaks &#8211; in the VirtualBox world referred to as <em>Additions</em> &#8211; gave me a little trouble on CentOS. It&#8217;s done the same way as on VMWare, by mounting an ISO with the scripts and drivers required. It&#8217;s not as painless as on VMWare though.</p>
<p>For starters, you have to find the ISO yourself &#8211; but I&#8217;ll give you a hint: look in <tt>/usr/share/virtualbox/</tt> <img src='http://blog.spind.net/wp/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  After mounting the ISO image, a directory popped up. I tried double clicking on <tt>autorun.sh</tt> but nothing ever comes easy, does it? I tried running it in the terminal, and was somewhat enlightened as I realized it was looking in vain for <tt>gksu</tt> &#8211; probably a Gnome frontend for <tt>su</tt>. Luckily there seemed to be another script I could run &#8211; <tt>VBoxLinuxAdditions-amd64.run</tt> &#8211; but it whined about OpenGL direct rendering:</p>
<div class="codebox">
Verifying archive integrity&#8230; All good.<br />
Uncompressing VirtualBox 2.2.2 Guest Additions for Linux Installation&#8230;&#8230;<br />
VirtualBox 2.2.2 Guest Additions installation<br />
Please install the build and header files for your current Linux kernel.<br />
The current kernel version is 2.6.18-128.el5<br />
This system does not seem to have support for OpenGL direct rendering.<br />
VirtualBox requires Linux 2.6.27 or later for this.  Please see the log.<br />
file /var/log/vboxadd-install.log if your guest uses Linux 2.6.27 and you still see this message.<br />
Problems were found which would prevent the Guest Additions from installing.<br />
Please correct these problems and try again.
</div>
<p>Before I ran the script, I made sure the newly installed CentOS was crispy by running <tt>yum upgrade</tt>. I also had a sneaking suspicion that a C compiler was required, so I made sure the system also sported <tt>gcc</tt>. The only thing I personally noticed by reading the message above, was that some missing OpenGL crap prevented the additions to be installed. As I was typing the message in this blog, I also noticed something about kernel headers. Rather embarrassing, but I really didn&#8217;t see it until now. Anyway, obviously the thing needed was kernel goodness, so I ran <tt>yum install kernel-devel</tt>. That seemed to make the VirtualBox additions script more happy and now it seems to be running flawlessly.</p>
<p>So, to summarize &#8211; what to do to make the damned thing work:</p>
<div class="codebox">
$ yum upgrade -y<br />
$ yum install -y gcc kernel-devel<br />
$ ln -s /usr/src/kernels/2.6.18-128.1.10.el5-i686 /usr/src/linux<br />
$ cd /media/VBOXADDITIONS_2.2.2_46594/<br />
$ sh VBoxLinuxAdditions-amd64.run
</div>
<p>I rebooted as I was told to, but mouse integration didn&#8217;t seem to work. Probably due to the kernel being upgraded without rebooting and actually utilizing it. So, I ran the additions script again, rebooted again and woo &#8211; mouse integration seems to work. The clipboard doesn&#8217;t though, and the maching is still creating some really nasty spikes on my CPU graph every three seconds or so:</p>
<p><a href="/uploads/2009/05/VirtualBox-CPUUsage1.png"><img src="/uploads/2009/05/VirtualBox-CPUUsage1-600x497.png" alt="VirtualBox-CPUUsage" title="VirtualBox-CPUUsage" width="600" height="497" class="alignnone size-medium wp-image-146" /></a></p>
<p>It&#8217;s worth mentioning that when I&#8217;m running my Windows XP guest in VirtualBox, the CPU graphs on the host system are nice and flat.</p>
<p>I&#8217;m not entirely pleased, but I think VirtualBox will eventually win me over from VMWare.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.spind.net/2009/05/21/centos-5-64-on-sun-virtualbox-on-fedora-10-64/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>The mysterious case of the 501 error</title>
		<link>http://blog.spind.net/2009/05/13/the-mysterious-case-of-the-501-error/</link>
		<comments>http://blog.spind.net/2009/05/13/the-mysterious-case-of-the-501-error/#comments</comments>
		<pubDate>Wed, 13 May 2009 09:10:30 +0000</pubDate>
		<dc:creator>hc</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[ModSecurity]]></category>
		<category><![CDATA[Paranoia]]></category>

		<guid isPermaLink="false">http://blog.spind.net/?p=137</guid>
		<description><![CDATA[I recently installed mod_security on our Apache server, and everything seemed to be working fine. Suddenly, while working on the previous post, I was presented with this error:

Method Not Implemented
POST to /wp/wp-admin/post.php not supported.

I checked the log files, and found these hits:

[Wed May 13 10:52:48 2009] [error] [client xxx.xxx.xxx.xxx] ModSecurity: Access denied with code 501 [...]]]></description>
			<content:encoded><![CDATA[<p>I recently installed <a href="http://www.modsecurity.org/">mod_security</a> on our Apache server, and everything seemed to be working fine. Suddenly, while working on the <a href="http://blog.spind.net/2009/05/13/prioritizing-linux-services/">previous post</a>, I was presented with this error:</p>
<div class="codebox">
Method Not Implemented<br />
POST to /wp/wp-admin/post.php not supported.
</div>
<p>I checked the log files, and found these hits:</p>
<div class="codebox">
[Wed May 13 10:52:48 2009] [error] [client xxx.xxx.xxx.xxx] ModSecurity: Access denied with code 501 (phase 2). Pattern match &#8220;(?:\\b(?:\\.(?:ht(?:access|passwd|group)|www_?acl)|global\\.asa|httpd\\.conf|boot\\.ini)\\b|\\/etc\\/)&#8221; at ARGS:content. [file "/etc/httpd/modsecurity.d/modsecurity_crs_40_generic_attacks.conf"] [line "114"] [id "950005"] [msg "Remote File Access Attempt"] [data "/etc/"] [severity "CRITICAL"] [tag "WEB_ATTACK/FILE_INJECTION"] [hostname "blog.spind.net"] [uri "/wp/wp-admin/post.php"] [unique_id "xxxxxxxxxxxxx"]
</div>
<p>In short, it&#8217;s <tt>mod_security</tt> telling me that the text <tt>/etc/</tt> triggered rule 950005, which should be protecting our server against malicious attempts to access local files &#8211; like the ones in the <tt>/etc</tt> directory. The access file only showed a POST to <tt>/wp/wp-admin/post.php</tt> so I had no idea where the <tt>/etc/</tt> string was coming from. Maybe some weird hidden Javascript? Maybe something else?</p>
<p><a href="http://techpulp.com/2009/02/how-to-resolve-post-to-wp-admin-post-php-not-supported-error-in-wordpress/">This post</a> narrowed acknowledged it to be related to <tt>mod_security</tt> and suggested to disable it permanently or just turn it temporarily off while posting. I aim to do better.</p>
<p>The <a href="http://blog.spind.net/2009/05/13/prioritizing-linux-services/">previous post</a> has a wonderful nugget of enlightenment about prioritizing services on Linux, and suggested a couple of changes to the Linux configuration files &#8211; most of which are located in.. the <tt>/etc/</tt> folder. In short, I triggered <tt>mod_security</tt> rule 950005 by posting data containing <tt>/etc/</tt>.</p>
<p>If you ever plan to cover issues related to deployment and administration of operating system in the Unix family, this rule absolutely has got to go. Obviously it&#8217;s written with the best of intentions, but as it is doesn&#8217;t work and should be disabled.</p>
<p>Avoid messing with <tt>/etc/httpd/modsecurity.d/modsecurity_crs_40_generic_attacks.conf</tt> and just disable the specific rules in <tt>/etc/httpd/conf.d/mod_security.conf</tt> by adding this:</p>
<div class="codebox">
# Disable a couple of rules in modsecurity.d/modsecurity_crs_40_generic_attacks.conf<br />
# that prevents submitting text containing filenames in the Unix family.<br />
SecRuleRemoveById 950005<br />
SecRuleRemoveById 950006
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.spind.net/2009/05/13/the-mysterious-case-of-the-501-error/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Custom SuEXEC for Apache &#8211; the easy way</title>
		<link>http://blog.spind.net/2009/04/15/custom-suexec-for-apache-the-easy-way/</link>
		<comments>http://blog.spind.net/2009/04/15/custom-suexec-for-apache-the-easy-way/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 14:33:43 +0000</pubDate>
		<dc:creator>hc</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[SuEXEC]]></category>

		<guid isPermaLink="false">http://blog.spind.net/?p=124</guid>
		<description><![CDATA[I&#8217;m a security freak, and prefer to switch to individual users, when running scripts on different sites. There are numerous advantages to this, including being able to write to your web directory, without leaving a huge security hole open for root-kits on other hosted sites on the server.
To do this, I&#8217;ve decided to use the [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m a security freak, and prefer to switch to individual users, when running scripts on different sites. There are numerous advantages to this, including being able to write to your web directory, without leaving a huge security hole open for root-kits on other hosted sites on the server.</p>
<p>To do this, I&#8217;ve decided to use the Apache <tt>suexec</tt> option for all my scripts. I won&#8217;t go into specific details about the setup here, but present a pretty solution to an annoying problem that arises when using <tt>suexec</tt> and applying software updates for the Apache server.</p>
<p>If your web files are located in <tt>/var/www</tt>, you won&#8217;t need this. For security reasons, <tt>suexec</tt> is compiled with various configuration options that can&#8217;t be changed runtime &#8211; the &#8220;safe&#8221; location of scripts is one of them. If you &#8211; like me &#8211; have your web files located somewhere else, you&#8217;ll need to recompile <tt>suexec</tt> and re-install it every time you upgrade Apache. If you decide to get the entire source code tree for Apache, just for this, you&#8217;ll find yourself in a mess that could easily be avoided.</p>
<p>Here is my solution: Since the <tt>suexec</tt> source files themselves rarely change, I picked out exactly the files needed to compile the <tt>suexec</tt> binary and simplified the Makefile. This way, I&#8217;ve got a very small directory with the files required to build my <tt>suexec</tt> with my own configuration options, without messing with the rest of the Apache source code. As long as I remember to run <tt>make install</tt> after updating Apache, it&#8217;s all good.</p>
<p>First of all, you need to set up a directory for the <tt>suexec</tt> files:</p>
<div class="codebox">
$ cd /usr/src<br />
$ mkdir suexec<br />
$ cd suexec<br />
$ wget http://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x/support/suexec.c<br />
$ wget http://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x/support/suexec.h
</div>
<p>Now make the changes you need to <tt>suexec.h</tt> and write a suitable Makefile:</p>
<div class="codebox">
suexec: suexec.h suexec.c<br />
&nbsp; &nbsp; gcc suexec.c -o suexec -I /usr/include/apr-1/ -I /usr/include/httpd/<br />
<br />
clean:<br />
&nbsp; &nbsp; rm -fv suexec.o suexec<br />
<br />
install: suexec<br />
&nbsp; &nbsp; cp suexec /usr/sbin/suexec<br />
&nbsp; &nbsp; chmod 4775 /usr/sbin/suexec
</div>
<p>You&#8217;ll need the <tt>apr-devel</tt> and <tt>httpd-devel</tt> packages for this to work. Remember that you need to indent with tabs in makefiles. Run <tt>make install</tt> to install:</p>
<div class="codebox">
$ make install<br />
gcc suexec.c -o suexec -I /usr/include/apr-1/ -I /usr/include/httpd/<br />
cp suexec /usr/sbin/suexec<br />
chmod 4775 /usr/sbin/suexec
</div>
<p>If you&#8217;re running <tt>php-cgi</tt> and getting http error 500, your <tt>suexec</tt> probably needs to be re-installed. Remember to check the <tt>suexec</tt> logfile.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.spind.net/2009/04/15/custom-suexec-for-apache-the-easy-way/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Updating CentOS &#8211; the right way</title>
		<link>http://blog.spind.net/2009/04/15/updating-centos-the-right-way/</link>
		<comments>http://blog.spind.net/2009/04/15/updating-centos-the-right-way/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 14:13:43 +0000</pubDate>
		<dc:creator>hc</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[RPM]]></category>
		<category><![CDATA[Yum]]></category>

		<guid isPermaLink="false">http://blog.spind.net/?p=121</guid>
		<description><![CDATA[I&#8217;ve always had trouble understanding exactly why I would get a million .rpmnew files after updating my servers, especially when those files were exactly identical to their original counterparts. Luckily there seems to be a solution &#8211; the yum-merge-conf plugin!
I updated my CentOS 5.2 to 5.3 by running yum --merge-conf, and after downloading and updating, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve always had trouble understanding exactly why I would get a million <tt>.rpmnew</tt> files after updating my servers, especially when those files were exactly identical to their original counterparts. Luckily there seems to be a solution &#8211; the <tt>yum-merge-conf</tt> plugin!</p>
<p>I updated my CentOS 5.2 to 5.3 by running <tt>yum --merge-conf</tt>, and after downloading and updating, yum asked me what it should do about the new configuration files &#8211; kindly sparing me the identical ones:</p>
<div class="codebox">
&#8230;<br />
Config files &#8216;/etc/ld.so.conf&#8217; and &#8216;/etc/ld.so.conf.rpmnew&#8217; are identical, I&#8217;m removing the duplicate one<br />
Config files &#8216;/etc/nsswitch.conf&#8217; and &#8216;/etc/nsswitch.conf.rpmnew&#8217; are identical, I&#8217;m removing the duplicate one<br />
Config files &#8216;/etc/krb5.conf&#8217; and &#8216;/etc/krb5.conf.rpmnew&#8217; are identical, I&#8217;m removing the duplicate one<br />
Config files &#8216;/etc/libaudit.conf&#8217; and &#8216;/etc/libaudit.conf.rpmnew&#8217; are identical, I&#8217;m removing the duplicate one</p>
<p>Package sudo: merging configuration for file &#8220;/etc/sudoers&#8221;:<br />
By default, RPM would keep your local version and rename the new one to /etc/sudoers.rpmnew<br />
What do you want to do ?<br />
 &#8211; diff the two versions (d)<br />
 &#8211; do the default RPM action (q)<br />
 &#8211; install the package&#8217;s version (i)<br />
 &#8211; merge interactively with vim (v)<br />
 &#8211; background this process and examine manually (z)<br />
Your answer ?
</p></div>
<p>I chose <em>install the package’s version</em> for everything I know I didn&#8217;t mess with, and <em>do the default RPM action</em> (keep local version) for the ones I had been tweaking.</p>
<p>Now, isn&#8217;t that cool?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.spind.net/2009/04/15/updating-centos-the-right-way/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
