<?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>FreeCharity.org.uk &#187; WordPress</title>
	<atom:link href="http://www.freecharity.org.uk/category/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.freecharity.org.uk</link>
	<description>Free web hosting for UK charities and non-profit organisations</description>
	<lastBuildDate>Sun, 07 Jun 2009 20:59:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Keeping Track of WordPress Installs with Perl</title>
		<link>http://www.freecharity.org.uk/2009/01/20/trackingwordpress-installs-with-perl/</link>
		<comments>http://www.freecharity.org.uk/2009/01/20/trackingwordpress-installs-with-perl/#comments</comments>
		<pubDate>Tue, 20 Jan 2009 12:04:18 +0000</pubDate>
		<dc:creator>James Davis</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.freecharity.org.uk/?p=107</guid>
		<description><![CDATA[I&#8217;d taken a bit of a break from WordPress coding during the development of 2.7 and instead have been concentrating on simplifying the management of multiple WordPress installs. WordPress Mu offers is great for running multiple blogs for multiple users but sometimes it just doesn&#8217;t offer your users enough control over their own WordPress site. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;d taken a bit of a break from WordPress coding during the development of 2.7 and instead have been concentrating on simplifying the management of multiple WordPress installs. WordPress Mu offers is great for running multiple blogs for multiple users but sometimes it just doesn&#8217;t offer your users enough control over their own WordPress site. I&#8217;m going to post a number of tips and Perl snippets, detailing how to ease the management of your scripts.</p>
<p>Your first step is to be able to easily list the installs you have on your system. You could maintain a list but it&#8217;s easier to let MySQL do the hard work for you. Make sure your WordPress databases identifiable by name alone.</p>
<p>The following Perl snippet illustrates how you might list all your WordPress installs.</p>
<pre>$sql = "show databases like 'wordpress_\%'";
$sth = $dbh-&gt;prepare("$sql");
$sth-&gt;execute();
while($row = $sth-&gt;fetchrow_arrayref){
	($name) = @$row;
	print $row , "\n";
}</pre>
<p>It&#8217;s useful to be able to map your WordPress installations to their location on disk. You could record the location of each installation, but it&#8217;s probably better to have a standard location. For instance, each install could be found under /home/&lt;sitename&gt; or /var/www/&lt;sitename&gt;.</p>
<p>Here&#8217;s the Perl I use to map my database names to directories. The hash allows me to override the standard mapping for a few exceptional installations.</p>
<pre>
my %dir_exceptions = (
    "foo" =&gt; '/var/www/foo/wp',
    "bar" =&gt; '/home/bar/public_html/blog',
);
sub wordpress_location {   
    my $name = shift;
    $name =~ m/wordpress_(.*)/;
    $name = $1;
    if(defined($dir_exceptions{"$name"})){
        return $dir_exceptions{"$name"};
    } else {
        return "/var/www/$name/";
    }
}</pre>
<pre></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.freecharity.org.uk/2009/01/20/trackingwordpress-installs-with-perl/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Monitoring your WordPress install with tripwire</title>
		<link>http://www.freecharity.org.uk/2009/01/16/wordpress-tripwire/</link>
		<comments>http://www.freecharity.org.uk/2009/01/16/wordpress-tripwire/#comments</comments>
		<pubDate>Fri, 16 Jan 2009 11:28:26 +0000</pubDate>
		<dc:creator>James Davis</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.freecharity.org.uk/?p=83</guid>
		<description><![CDATA[You&#8217;ve installed WordPress, and you&#8217;re diligently upgrading with each new security fix that&#8217;s released. What happens if your install is compromised by a successful but previously unseen attack? What parts of your install has the attacker tampered with and which files can you trust? Will you notice the attack at all? A class of tools [...]]]></description>
			<content:encoded><![CDATA[<p>You&#8217;ve installed WordPress, and you&#8217;re diligently upgrading with each new security fix that&#8217;s released. What happens if your install is compromised by a successful but previously unseen attack? What parts of your install has the attacker tampered with and which files can you trust? Will you notice the attack at all? A class of tools called file &#8220;integrity checkers&#8221; can monitor your WordPress install for unexpected and unauthorized changes. In this article I&#8217;ll show you how you can use Tripwire, perhaps the best known of these tools, to do just that.<span id="more-83"></span></p>
<p>Tripwire is available as a package for most Linux distributions. Assuming you&#8217;re using Debian, Ubuntu or something similar, simply:</p>
<pre># apt-get install tripwire</pre>
<p>We&#8217;ll not go into full details on how to configure Tripwire, you should read the documentation and manual pages provided with Tripwire for more information. Let&#8217;s concentrate on the important part, a policy that monitors your WordPress files. In my case I&#8217;ve edited /etc/tripwire/twpol.txt to read.</p>
<pre>#
# Global Variable Definitions
#
# These definitions override those in to configuration file.  Do not
# change them unless you understand what you're doing.
#
@@section GLOBAL
TWBIN = /usr/sbin;
TWETC = /etc/tripwire;
TWVAR = /var/lib/tripwire;

#
# File System Definitions
#
@@section FS

#
# WordPress Files
#
(
    rulename = "WordPress Installs",
    severity = 100,
    emailto = james@freecharity.org.uk
)
{
        /var/www/main  -&gt; $(IgnoreNone);
        /var/www/main/wp-content  -&gt; $(Dynamic);
        /home/james/public_html  -&gt; $(IgnoreNone);
        /home/james/public_html/wp-content  -&gt; $(Dynamic);
}</pre>
<p>This policy protects two WordPress installations. One in /var/www/main and another in /home/james/public_html (in reality my configuration file protects over fifty similar installs).</p>
<p>The policy reports on any change to the core WordPress files. For the wp-content directories we use the Dynamic keyword. This tells Tripwire to be less concerned with minor changes such as file sizes (see the twpolicy man page for more details). You might wish to ignore this directory entirely. Change the line to read something like.</p>
<pre>        !/var/www/main/wp-content;</pre>
<p>Compile your Tripwire policy with</p>
<pre># twadmin --create-polfile -S site.key /etc/tripwire/twpol.txt</pre>
<p>and initialise your Tripwire database with</p>
<pre># tripwire --init</pre>
<p>To check the integrity of your WordPress files you can now run</p>
<pre># tripwire --check</pre>
<p>Tripwire will now check the integrity of the files specified in your policy. If you&#8217;re unlucky the resulting report will contain something like:</p>
<pre>-------------------------------------------------------------------------------
Rule Name: WordPress Installs (/var/www/main)
Severity Level: 100
-------------------------------------------------------------------------------
Modified:
"/var/www/main"
"/var/www/main/index.php"</pre>
<p>It looks like one of the core WordPress files, one that&#8217;s not meant to change ever, has been tampered with. It&#8217;d be best to take a look over the file and compare it with a known good copy. Once you&#8217;re happy that everything is back to normal you&#8217;ll want to update Tripwire&#8217;s database so that reported changes are ignored in future checks</p>
<pre># tripwire --update</pre>
<p>That&#8217;s it. Let&#8217;s hope that you never have to make full use of the facilities that Tripwire provides. It&#8217;s no substitute for keeping your install up to date!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.freecharity.org.uk/2009/01/16/wordpress-tripwire/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

