<?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>Linux System Admins Blog &#187; cpanel</title>
	<atom:link href="http://linuxsysadminblog.com/category/cpanel/feed/" rel="self" type="application/rss+xml" />
	<link>http://linuxsysadminblog.com</link>
	<description>System admins of Promet - an e-commerce, high availability Open Source web shop - share their findings</description>
	<lastBuildDate>Sat, 10 Jul 2010 01:33:47 +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>enabling allow_url_include locally in cPanel</title>
		<link>http://linuxsysadminblog.com/2009/07/enabling-allow_url_include-locally-in-cpanel/</link>
		<comments>http://linuxsysadminblog.com/2009/07/enabling-allow_url_include-locally-in-cpanel/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 17:44:44 +0000</pubDate>
		<dc:creator>max</dc:creator>
				<category><![CDATA[cpanel]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[include]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=803</guid>
		<description><![CDATA[When using cPanel the way to enable allow_url_include directive locally (per user) is to create an Virtual Host include:
First create an include file:
/usr/local/apache/conf/userdata/std/2/username/domain.com/custom.conf
Add directive to custom.conf:

php_admin_flag allow_url_include On

Then run to enable include:
/scripts/ensure_vhost_includes --user=username --verbose
Alternatively, enabling allow_url_include globally (server-wide) is done by editing /usr/local/lib/php.ini and adding  &#8220;allow_url_include = On&#8221; directive to the Fopen wrapper section.
;;;;;;;;;;;;;;;;;;
; [...]]]></description>
			<content:encoded><![CDATA[<p>When using cPanel the way to enable allow_url_include directive locally (per user) is to create an <strong>Virtual Host include</strong>:</p>
<p>First create an include file:<br />
<code>/usr/local/apache/conf/userdata/std/2/username/domain.com/custom.conf</code></p>
<p>Add directive to custom.conf:<br />
<code><IfModule mod_php5.c><br />
php_admin_flag allow_url_include On<br />
</Ifmodule></code></p>
<p>Then run to enable include:<br />
<code>/scripts/ensure_vhost_includes --user=username --verbose</code></p>
<p>Alternatively, enabling allow_url_include globally (server-wide) is done by editing /usr/local/lib/php.ini and adding  &#8220;allow_url_include = On&#8221; directive to the Fopen wrapper section.<br />
<code>;;;;;;;;;;;;;;;;;;<br />
; Fopen wrappers ;<br />
;;;;;;;;;;;;;;;;;;</code>                                                                                                                                           </p>
<p><code>;Whether to allow the treatment of URLs (like http:// or ftp://) as files.<br />
allow_url_fopen = On<br />
<strong>allow_url_include = On</strong></code></p>
<p>and restarting apache by issuing &#8220;service httpd restart&#8221; command as root.</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2009/07/enabling-allow_url_include-locally-in-cpanel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install GNUPG PHP extension in Cpanel</title>
		<link>http://linuxsysadminblog.com/2009/05/install-gnupg-php-extension-in-cpanel/</link>
		<comments>http://linuxsysadminblog.com/2009/05/install-gnupg-php-extension-in-cpanel/#comments</comments>
		<pubDate>Thu, 21 May 2009 09:20:35 +0000</pubDate>
		<dc:creator>gerold</dc:creator>
				<category><![CDATA[Centos]]></category>
		<category><![CDATA[Installation]]></category>
		<category><![CDATA[cpanel]]></category>
		<category><![CDATA[gnupg]]></category>
		<category><![CDATA[gpg]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[pecl]]></category>
		<category><![CDATA[php extension]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=674</guid>
		<description><![CDATA[Here&#8217;s my quick howto on installing GNUPG PHP Pecl extension (pecl docs) in Cpanel.  Please note that this covers only the installation process and no further details on setting up gpg keys or using the function with extension or sample PHP scripts.
Installation process is very straightforward provided you met the requirements like php-pear, gnupg, [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s my quick howto on installing <a href="http://us2.php.net/manual/en/book.gnupg.php">GNUPG</a> PHP Pecl extension (<a href="http://pecl.php.net/package/gnupg/docs">pecl docs</a>) in Cpanel.  Please note that this covers only the installation process and no further details on setting up gpg keys or using the function with extension or sample PHP scripts.</p>
<p>Installation process is very straightforward provided you met the requirements like php-pear, gnupg, libgpg-error, and gpgme.  You can install it directly from WHM -> Module Installers -> PHP Pecl, enter &#8216;<em>gnupg</em>&#8216; and click the Install button.  You can do the same via shell with this command &#8216;<em>pecl install gnupg</em>&#8216;.  Then restart your Apache.  Be sure to double check if the extension was added to you <em>php.ini</em>.<br />
<span id="more-674"></span><br />
On Cpanel servers most of the requirements are present, like <em>php-pear</em> (if you compiled your apache/php with pear), <em>gnupg, libgpg-error</em>, etc, except for <a href="http://www.gnupg.org/gpgme.html"><em>gpgme</em></a> which is the main library used by <em>gnupg</em> extension.  Our system is running CentOS 4.7 with latest STABLE branch of Cpanel (S35075 at this time of writing), PHP 5.2.9 with pear and libgpg-error (version 1.0-1 only).  Only missing requirement was <em>gpgme</em> which i installed from source as it was not available on our default yum repository.  You can also install it from other repositories like <em>centos.karan.org</em>.  At this time the latest <em>gpgme</em> version is <a href="http://www.gnupg.org/download/index.en.html#gpgme">1.1.8</a> but I installed version 1.1.2 because it&#8217;s the latest version compatible with our libgpg.</p>
<p>I also encountered an error library path when I check the extension, <code>"error while loading shared libraries: libgpgme.so.11: cannot open shared object file: No such file or directory"</code>, so I had to add &#8216;<em>/usr/local/lib</em>&#8216; to <em>/etc/ld.so.conf</em> and run <em>ldconfig</em>, so that libraries in this directory are detected automatically.</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2009/05/install-gnupg-php-extension-in-cpanel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>umask &#8216;ing apache under cPanel</title>
		<link>http://linuxsysadminblog.com/2009/05/umask-ing-apache-under-cpanel/</link>
		<comments>http://linuxsysadminblog.com/2009/05/umask-ing-apache-under-cpanel/#comments</comments>
		<pubDate>Thu, 14 May 2009 23:17:02 +0000</pubDate>
		<dc:creator>max</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[cpanel]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[umask]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=644</guid>
		<description><![CDATA[Ran into an issue today where a php created file was unreadable by other users or services that run under a different user.  Since this is a software originated issue the sysadmin would love for the developer to change the code to include the chmod() php function  to set permission to 644 after [...]]]></description>
			<content:encoded><![CDATA[<p>Ran into an issue today where a php created file was unreadable by other users or services that run under a different user.  Since this is a software originated issue the sysadmin would love for the developer to change the code to include the <a href="http://us2.php.net/chmod">chmod() php function</a>  to set permission to 644 after file creation.  On the flip side when a developer sees &#8220;permission&#8221; they automatically assume it&#8217;s OS related and want the sysadmin to resolve the issue. <span id="more-644"></span></p>
<p>This time I let the developer slide and implemented a fix on system end by appending <code lang="apache">umask 022</code> into /usr/local/apache/bin/envvars file and restarting apache. This will apply a umask of 022 to the default permission of 666 for newly created files. The result is that anytime apache creates a file be it via php or another way it will always have 644 permissions and will be world readable.<br />
But wait the fun doesn&#8217;t end there as we are running cPanel on this particular server and this env change will be lost next time Apache is rebuilt via <a href="http://www.cpanel.net/documentation/easyapache/ea3custom_modvar.html">EasyApache</a>. To make this change persistent create a file called umask with the digits 022 as contents in /var/cpanel/easy/apache/rawenv/</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2009/05/umask-ing-apache-under-cpanel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install ImageMagick and Imagick on Cpanel Server</title>
		<link>http://linuxsysadminblog.com/2009/05/install-imagemagick-and-imagick-on-cpanel-server/</link>
		<comments>http://linuxsysadminblog.com/2009/05/install-imagemagick-and-imagick-on-cpanel-server/#comments</comments>
		<pubDate>Tue, 12 May 2009 16:51:25 +0000</pubDate>
		<dc:creator>gerold</dc:creator>
				<category><![CDATA[Centos]]></category>
		<category><![CDATA[Installation]]></category>
		<category><![CDATA[cpanel]]></category>
		<category><![CDATA[imagemagick]]></category>
		<category><![CDATA[imagick]]></category>
		<category><![CDATA[php extension]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=621</guid>
		<description><![CDATA[Here&#8217;s a quick how-to for installing ImageMagick and Imagick on Cpanel server.  I will cover only the procedure using the Cpanel built-in scripts, although you can also install it the usual way (rpm or source install).  ImageMagick  is the application for working with images while the Imagick is a PHP extention to [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a quick how-to for installing <strong><a href="http://www.imagemagick.org/script/index.php">ImageMagick</a></strong> and <strong><a href="http://pecl.php.net/package/imagick">Imagick</a></strong> on Cpanel server.  I will cover only the procedure using the Cpanel built-in scripts, although you can also install it the usual way (rpm or source install).  <a href="http://www.imagemagick.org/script/index.php">ImageMagick</a>  is the application for working with images while the <a href="http://pecl.php.net/package/imagick">Imagick</a> is a PHP extention to modify/create images using the ImageMagick API.  </p>
<p><strong>Installation:</strong></p>
<p><strong>ImageMagick</strong><br />
  Check first if it&#8217;s installed:<br />
  <code lang="bash">/scripts/checkimagemagick</code><br />
  Proceed with Installation:<br />
  <code lang="bash">/scripts/installimagemagick</code><br />
  Installation will take a couple minutes as it will install other packages needed by ImageMagick.  After the installation, you can check your ImageMagick version:<br />
  <code lang="bash">/usr/bin/convert --version</code><br />
  It will give you something like:<br />
  <em>Version: ImageMagick 6.4.8 2009-05-11 Q16 OpenMP http://www.imagemagick.org<br />
  Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC</em><br />
<span id="more-621"></span><br />
<strong>Imagick</strong><br />
  Go to <strong>WHM -> Software -> Module Installers -> PHP Pecl </strong>(manage).  On the box below &#8220;<strong>Install a PHP Pecl</strong>&#8221; enter &#8220;<strong>imagick</strong>&#8221; and click &#8220;<strong>Install Now</strong>&#8221; button &#8211; that&#8217;s all.  </p>
<p>Restart Apache and check your <em><strong>phpinfo</strong></em> page to see the details of Imagick and ImageMagick as well.  See linked images for reference:  <a href="http://linuxsysadminblog.com/wp-content/uploads/2009/05/install.jpg">image1</a>, <a href="http://linuxsysadminblog.com/wp-content/uploads/2009/05/installed.jpg">image2</a>.</p>
<p><strong>Uninstall:</strong></p>
<p>If you decide to uninstall it&#8217;s as easy as the installation process:<br />
ImageMagick: <code lang="bash"> /scripts/cleanimagemagick</code><br />
Imagick:  <strong>WHM -> Software -> Module Installers -> PHP Pecl</strong> (manage). Click on <strong>Uninstall</strong> button for Imagick.</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2009/05/install-imagemagick-and-imagick-on-cpanel-server/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>CSF Not Detecting POP3 Login Failures</title>
		<link>http://linuxsysadminblog.com/2009/05/csf-not-detecting-pop3-login-failures/</link>
		<comments>http://linuxsysadminblog.com/2009/05/csf-not-detecting-pop3-login-failures/#comments</comments>
		<pubDate>Thu, 07 May 2009 09:22:56 +0000</pubDate>
		<dc:creator>gerold</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[cpanel]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[csf]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=612</guid>
		<description><![CDATA[This is the second time that CSF on our Cpanel server is not detecting POP3 login failures from a dictionary attack.  The IP address was added on the ip deny list but still it was able to attempt to login on POP3.  We have our LF_POP3D set to 20 and LF_POP3D_PERM to 1 [...]]]></description>
			<content:encoded><![CDATA[<p>This is the second time that <a href="http://configserver.com/cp/csf.html">CSF</a> on our Cpanel server is not detecting POP3 login failures from a dictionary attack.  The IP address was added on the ip deny list but still it was able to attempt to login on POP3.  We have our LF_POP3D set to 20 and LF_POP3D_PERM to 1 to block the ip permanently after 20 tries.  I can&#8217;t remember the CSF version when this first happened, but this time we&#8217;re running CSF version 4.65 and the latest is 4.67.  Of course, the usual way for me to fix the issue is to upgrade to the latest version.</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2009/05/csf-not-detecting-pop3-login-failures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Change Hostname of Cpanel Server</title>
		<link>http://linuxsysadminblog.com/2009/04/change-hostname-of-cpanel-server/</link>
		<comments>http://linuxsysadminblog.com/2009/04/change-hostname-of-cpanel-server/#comments</comments>
		<pubDate>Sun, 05 Apr 2009 12:19:16 +0000</pubDate>
		<dc:creator>gerold</dc:creator>
				<category><![CDATA[cpanel]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=498</guid>
		<description><![CDATA[This task is very simple and can be done in two steps:
1.)  Login as root and change your server hostname:
hostname newhos.name.tld
Note: Don&#8217;t forget to create an A entry for your new hostname, otherwise you will get a popup message during WHM login.
2.)  Issue /usr/local/cpanel/cpkeyclt to update your Cpanel License Key, otherwise you will get Invalid [...]]]></description>
			<content:encoded><![CDATA[<p>This task is very simple and can be done in two steps:<br />
1.)  Login as root and change your server hostname:</p>
<p style="padding-left: 30px;"><code><em><strong>hostname newhos.name.tld</strong></em></code></p>
<p><strong>Note:</strong> Don&#8217;t forget to create an A entry for your new hostname, otherwise you will get a popup message during WHM login.</p>
<p>2.)  Issue <code><em><strong>/usr/local/cpanel/cpkeyclt</strong></em></code> to update your Cpanel License Key, otherwise you will get Invalid License when you login to WHM/Cpanel interface.</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2009/04/change-hostname-of-cpanel-server/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cpanel:  Adding custom configuration to httpd.conf</title>
		<link>http://linuxsysadminblog.com/2008/11/cpanel-adding-custom-configuration-to-httpdconf/</link>
		<comments>http://linuxsysadminblog.com/2008/11/cpanel-adding-custom-configuration-to-httpdconf/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 14:39:23 +0000</pubDate>
		<dc:creator>gerold</dc:creator>
				<category><![CDATA[Installation]]></category>
		<category><![CDATA[cpanel]]></category>
		<category><![CDATA[apache]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=126</guid>
		<description><![CDATA[Recently, Cpanel implemented their standard way of adding custom changes to virtualhost configuration to preserve custom changes after an upgrade or Apache rebuild.
Here are the two common situations of adding custom changes:
1.)  Changes added inside a &#60;VirtualHost&#62;
This is very simple as we only need to create a single file that will contain our changes.  But [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, Cpanel implemented their standard way of adding custom changes to virtualhost configuration to preserve custom changes after an upgrade or Apache rebuild.</p>
<p>Here are the two common situations of adding custom changes:</p>
<p><strong>1.)  Changes added inside a &lt;VirtualHost&gt;</strong><br />
This is very simple as we only need to create a single file that will contain our changes.  But we need to understand the correct location on where to place this file so that our changes will be read properly.</p>
<p><span id="more-126"></span></p>
<p>There are several cases of adding these changes and below are some samples and the coresponding directory where to put them:</p>
<p>- One virtualhosts (either SSL or standard)<br />
Apache1/SSL:  <em>/usr/local/apache/conf/userdata/ssl/1/&lt;cpanel_user&gt;/&lt;domain&gt;/&lt;filename&gt;.conf</em><br />
Apache1/Standard:   <em>/usr/local/apache/conf/userdata/std/1/&lt;cpanel_user&gt;/&lt;domain&gt;/&lt;filename&gt;.conf</em><br />
Apache2/SSL:   <em>/usr/local/apache/conf/userdata/ssl/2/&lt;cpanel_user&gt;/&lt;domain&gt;/&lt;filename&gt;.conf</em><br />
Apache2/SSL:   <em>/usr/local/apache/conf/userdata/std/2/&lt;cpanel_user&gt;/&lt;domain&gt;/&lt;filename&gt;.conf</em></p>
<p>-  All virtualhosts (both SSL and standard)<br />
Apache 1/2:   <em>/usr/local/apache/conf/userdata/&lt;something&gt;.conf</em></p>
<p>-  All SSL virtualhost or all Standard virtualhost<br />
Apache 1/2 &#8211; all SSL:  <em>/usr/local/apache/conf/userdata/ssl/&lt;filename&gt;.conf</em><br />
Apache 1/2 &#8211; all Standard:   <em>/usr/local/apache/conf/userdata/std/&lt;filename&gt;.conf</em></p>
<p>* If you need to put the above changes on a specific Apache version you can put them this way:<br />
Apache 1 &#8211; all SSL:   <em>/usr/local/apache/conf/userdata/ssl/1/&lt;filename&gt;.conf</em><br />
Apache 2 &#8211; all Standard:  <em>/usr/local/apache/conf/userdata/std/2/&lt;filename&gt;.conf</em></p>
<p>The same process is followed on subdomains, like on one of my implementation i added a custom virtualhost in a subdomain to take effect on standard (http), so i put it on this directory:<br />
<em>/usr/local/apache/conf/userdata/ssl/2/gerold/mysubdomain.gerold.com/custom.conf</em>.</p>
<p>Take note that you also need to create the directories like &#8220;ssl&#8221;, &#8220;std&#8221;, &#8220;1&#8243;, &#8220;2&#8243;, or &#8220;mysubdomain.gerold.com&#8221; in order to have the correct directory structure/path.</p>
<p>You can verify if your custom changes were added correctly using this command:<br />
<strong><em>/scripts/verify_vhost_includes</em></strong></p>
<p>Then, update the include files:<br />
For changes concerning single account/user you can use this command:<br />
<strong><em> /scripts/ensure_vhost_includes &#8211;user=&lt;username&gt;</em></strong><br />
And for all users run:<br />
<strong><em>/scripts/ensure_vhost_includes &#8211;all-users</em></strong></p>
<p>And finally, restart Apache (<strong><em>/etc/init.d/httpd restart</em></strong>)</p>
<p><strong>2.)  Changes added outside a &lt;VirtualHost&gt;</strong></p>
<p>Adding custom changes outside of virtualhost can be done in different ways, like creating a templates or using the include editor.<br />
On my example, i will discuss using Include editor as i usually used this on some of our client sites.</p>
<p><strong>Cpanel have three ways to place our custom changes using Include editor, these are:</strong><br />
- <strong>Pre-Main Include</strong> &#8211; this is placed at the top of the httpd.conf file<br />
Location:  <em>/etc/httpd/conf/includes/pre_main_1.conf</em><br />
- <strong>Pre-VirtualHost Include</strong> &#8211; codes in this file are added before the first Vhost configuration<br />
Location:  <em>/etc/httpd/conf/includes/pre_virtualhost_1.conf</em><br />
- <strong>Post-VirtualHost Include</strong> &#8211; codes in this file are added at the end of httpd.conf<br />
Location:  <em>/etc/httpd/conf/includes/post_virtualhost_1.conf</em></p>
<p>So to add our changes we can go to WHM:  <em>Main &gt;&gt; Service Configuration &gt;&gt; Apache Setup &gt;&gt; Include Editor</em>, and select where you want to place your custom changes (<em>pre-main, pre-vhost, or post-vhost</em>).<br />
You can also edit directly the files (<em>pre_main_1.conf, pre_virtualhost_1.conf, post_virtualhost_1.conf</em>) located at <em>/etc/httpd/conf/includes/</em>.<br />
Finally, restart Apache (<strong><em>/etc/init.d/httpd restart</em></strong>) for changes to take effect.</p>
<p><strong>NOTE: For complete referrence please refer to<a href="http://www.cpanel.net/support/docs/ea/ea3/customdirectives.html"> Cpanel Docs</a>.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2008/11/cpanel-adding-custom-configuration-to-httpdconf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Server and backup woes</title>
		<link>http://linuxsysadminblog.com/2008/11/server-and-backup-woes/</link>
		<comments>http://linuxsysadminblog.com/2008/11/server-and-backup-woes/#comments</comments>
		<pubDate>Mon, 17 Nov 2008 13:31:58 +0000</pubDate>
		<dc:creator>Pim</dc:creator>
				<category><![CDATA[Down Time]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[cpanel]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[reboot]]></category>
		<category><![CDATA[repository]]></category>
		<category><![CDATA[rm]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[undelete]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=101</guid>
		<description><![CDATA[Looking back it seems like most posts on this blog are helpful tips and not reports of problems we encountered. Not that we don&#8217;t have any problems but we mostly report our solutions instead of the actual problems. Of course now and again a problem comes along that doesn&#8217;t have a solution ready to copy-paste [...]]]></description>
			<content:encoded><![CDATA[<p>Looking back it seems like most posts on this blog are helpful tips and not reports of problems we encountered. Not that we don&#8217;t have any problems but we mostly report our solutions instead of the actual problems. Of course now and again a problem comes along that doesn&#8217;t have a solution ready to copy-paste into a blog post. A week ago a wrong modification in a shell script resulted in the deletion of a good number of files before we caught it. The command below ended up being run with 2 empty variables:</p>
<p><code>rm -fr ${DIR}/${SUBDIR}</code></p>
<p><em>Hint: add the following alias for all users to prevent this: alias rm=&#8217;rm &#8211;preserve-root&#8221;</em></p>
<p>We were lucky in two ways. First off, this was not a production server, just a development and testing server and secondly the databases and web sites on that server were unaffected. That&#8217;s where the good news ended and Murphy&#8217;s Law kicked in. A couple of days before we found that our backup server had a corrupt filesystem on its RAID array. Since we did not have enough space available on other servers to place all the backups on other servers we temporarily suspended (you guessed it) the backups of the development and testing server.</p>
<p><span id="more-101"></span></p>
<h3>To undelete or not to undelete</h3>
<p>To get back up and running we immediately closed off access to the server and considered how we could recover the deleted files. Unfortunately undeleting files on an ext3 file system can only be done under certain circumstances. If the deleted files are still opened by some process the lsof utility can help as is documented on some web sites (just Google &#8220;ext3 undelete lsof&#8221;) but for larger scale undeletes the first step is to create an image of the partition in question. That image can then be searched for inode entries which can be very useful for finding specific files. However, if you want perform a more general undelete this method is a lot less useful because the file names will not be recovered.</p>
<p>Apart from the limited usefulness that creating this image would yield it would have taken several hours to complete during which development and testing would be at a standstill. We decided not to do this and instead take our losses instead. It is important to note what data we were losing at that point. Among the missing directories were some binary directories (/usr/sbin and such) which were easily recoverable by copying them from similarly configured servers. The most important missing data was the version control repository and a custom scripts directory. All the history of changes in the repository was lost but the latest state of the code was easily restored. We copied the latest code from the developer who had last performed a complete update (which is a part of the daily development process) and put that code into the repository again. Since the versions did not match up anymore after that (all code versions were reinitialized) all developers had to retrieve the complete set of code files again and copy their latest versions over it to keep working.</p>
<p>Although this is definitely a loss for us the impact is limited by the fact that we keep copies of all released code. These copies were unaffected on the server in question but are also present on other servers. If need be we can go through that history to track down a change, but the comments are gone and it&#8217;s not a process the developers can do themselves.</p>
<h3>Rebooting the server</h3>
<p>After all this we were left with one task, rebooting that server. Since we did not know exactly what got deleted this might give us some severe problems. This was scheduled for a quiet night with several system admins present. Unfortunately our hand was forced when a change in the iptables configuration caused a kernel panic. Rebooting the server revealed several more problems, the main one being the privileges on the /tmp directory. This resulted in Apache not being able to write session info there and MySQL not being able to write temporary data either. This was quickly solved of course. Without going into too many details the final action we took was to update our Cpanel. This reinstalled many missing scripts and binaries.</p>
<p>I bet you&#8217;re wondering why we don&#8217;t use off site backups. Well, we do actually. The problem is that this involves copying many gigabytes over a limited line so we made a selection of what needed to be copied and we focused mainly on all our production servers. The main purpose of our off site backups is to recover production servers in case our data center becomes unavailable.</p>
<h3>Conclusions</h3>
<p>It&#8217;s been an annoying experience and it&#8217;s hard to draw positive lessons from mr. Murphy&#8217;s teachings but all in all it could have been a lot worse. Production was not down or affected and even testing and development impact was pretty limited. The main things on our agenda after this are to review our backup strategy for essential locations and reviewing the use of root privileges on our servers. Although we use non-root users most of the time there are tasks that are made a lot quicker by changing to root. We all know the danger of this and need to be a lot more aware of it.</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2008/11/server-and-backup-woes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tomcat failure after Apache rebuild in CPanel</title>
		<link>http://linuxsysadminblog.com/2008/08/tomcat-failure-after-apache-rebuild-in-cpanel/</link>
		<comments>http://linuxsysadminblog.com/2008/08/tomcat-failure-after-apache-rebuild-in-cpanel/#comments</comments>
		<pubDate>Mon, 25 Aug 2008 08:33:08 +0000</pubDate>
		<dc:creator>marius</dc:creator>
				<category><![CDATA[cpanel]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[easyapache]]></category>
		<category><![CDATA[tomcat]]></category>
		<category><![CDATA[whm]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=48</guid>
		<description><![CDATA[After rebuilding Apache in CPanel using easyapache or WHM there are many things that can go wrong even if you use a stable branch of CPanel. For example Tomcat that was installed from CPanel can fail after the build and even if this might look unrelated to the apache build this can happen quite frequently.
If [...]]]></description>
			<content:encoded><![CDATA[<p>After <strong>rebuilding Apache</strong> in CPanel using <strong>easyapache </strong>or <strong>WHM </strong>there are many things that can go wrong even if you use a stable branch of CPanel. For example <em>Tomcat that was installed from CPanel can fail</em> after the build and even if this might look unrelated to the apache build this can happen quite frequently.</p>
<p><span id="more-48"></span>If you are running <strong>tomcat </strong>on a cpanel server here is what you can do to help you from losing your tomcat instance:</p>
<ul>
<li><strong>backup</strong>; newer cpanel versions backup apache, configs, etc. but they will <em>not care about tomcat</em>. This means it is your job to save the tomcat files. Here are some important folders you should save:<strong><br />
/usr/local/jdk</strong> &#8211; this is a link to the real jdk used on the system (jdk1.5.0_05 or jdk1.6.0_02 for ex.)<strong>; </strong>save the real jdk also, just in case&#8230;<br />
<strong> /usr/local/jakarta/tomcat </strong>- this will contain all your tomcat configs, apps, logs, etc.<strong><br />
/usr/sbin/starttomcat</strong> and <strong>/usr/sbin/stoptomcat</strong> &#8211; scripts used to start and stop tomcat (in case you made local changes, memory tunings, etc.)</li>
</ul>
<p>The files above can be lost during the rebuild, and it is important to have them on hand to restore tomcat if it fails starting after the apache build. For example last time this happened for us we had to fix the /usr/local/jdk link to point to the proper jdk (we use 1.5 and cpanel changed the link to 1.6) and also the startup scripts that contained various local customizations were obviously overwritten <img src='http://linuxsysadminblog.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  .</p>
<p>Hopefully this information will be useful for other people, and hopefully you will see it before running easyapache <img src='http://linuxsysadminblog.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  .</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2008/08/tomcat-failure-after-apache-rebuild-in-cpanel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
