Auto Update Script for MiniMyth

This script will download the newest version of MiniMyth and update your tftp directory.

It first downloads the version file and compares that version number to the current install version of MiniMyth install.  If it determines that the version dose not match it will then download the current release, untar it and move the files to their current locations. It dose not delete any older versions on your server.

  • The TFTPDIR variable is the location on your tftp server where the MiniMyth files are stored.
  • The URL variable is the MiniMyth directory that the install of MiniMyth you wish to use lives.

You may also download the full directory structure with this script from my github repository or from my server.

# /bin/bash
# Matt Rude <m@mattrude.com> 11-Nov-2009
#
TFTPDIR=/tftpboot/PXEClient
URL="http://minimyth.org/download/stable/latest/"
##############################################################################
if [ -e $TFTPDIR/version ]; then
 mv $TFTPDIR/version $TFTPDIR/version.last
 rm -rf $TFTPDIR/verstion.md5
else
 touch $TFTPDIR/version.log
 touch $TFTPDIR/version.last
fi

cd $TFTPDIR
wget -nc $URL/version > /dev/null 2>&1
VER=`cat $TFTPDIR/version`
OLDVER=`cat $TFTPDIR/version.last`

if [ "$VER" = "$OLDVER" ]; then
 chown -R apache:apache $TFTPDIR/*
 exit 0
else
 echo "`date` Upgraded to version: $VER" >> version.log

 rm -rf $TFTPDIR/ram-minimyth-*.tar.bz2.md5
 wget -nc $URL/ram-minimyth-$VER.tar.bz2 > /dev/null 2>&1
 wget -nc $URL/ram-minimyth-$VER.tar.bz2.md5 > /dev/null 2>&1
 MD5STAT=`md5sum -c ram-minimyth-$VER.tar.bz2.md5 |awk ' {print $2 }'`
 if [ "$MD5STAT" = "OK" ]; then
  rm -f $TFTPDIR/kerne*
  rm -f $TFTPDIR/rootf*
  rm -fr $TFTPDIR/conf/default/theme*
  tar -xjf ram-minimyth-$VER.tar.bz2
  rm -rf ram-minimyth-$VER.*
 else
  echo "`date` Minimyth Version $VER Failed the MD5 check" >> version.log
  echo "" > $TFTPDIR/version
  exit 1
 fi

 RAMDIR=$TFTPDIR/ram-minimyth-$VER

 mkdir -p $TFTPDIR/conf/default
 cp $RAMDIR/kernel $TFTPDIR/kernel-$VER
 cp $RAMDIR/rootfs $TFTPDIR/rootfs-$VER
 cp -r $RAMDIR/themes $TFTPDIR/conf/default/themes-$VER

 ln -s kernel-$VER kernel
 ln -s rootfs-$VER rootfs
 cd $TFTPDIR/conf/default
 ln -s themes-$VER themes
 #mythtvosd --template=scroller --scroll_text="minimyth upgraded to: $VER" > /dev/null
fi

cd $TFTPDIR
mv version.log version.tmp
tail -2 version.tmp > version.log
rm -rf version.tmp
chown -R apache:apache $TFTPDIR/*
exit 0

Next Gallery Image Link in Image Posts

If you were to view one of the images in my WordPress gallery, such as my Minnesota State Fair – 2009 gallery, and view one of the images.  You will see a previous and next image on the bottom of the image page.  As you may of already of guessed, the next and previous images are all part of the way my theme handles image pages.

In order to do this, I needed to add the below snippet to my image.php file.  You should already have a “navigation” section, find it, and replace it with the below code (MAKE SURE YOU BACK UP YOUR IMAGE.PHP FILE FIRST).

<div class="image-navigation">
	<?php $attachments = array_values(get_children( array('post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') ));
	foreach ( $attachments as $k => $attachment )
		if ( $attachment->ID == $post->ID )
			break;
	$attachments = array_values(get_children( array('post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') ));
       $next_url =  isset($attachments[$k+1]) ? get_permalink($attachments[$k+1]->ID) : get_permalink($attachments[0]->ID);
       $previous_url =  isset($attachments[$k-1]) ? get_permalink($attachments[$k-1]->ID) : get_permalink($attachments[0]->ID);
	if ( wp_get_attachment_image( $post->ID+1 ) != null ) { ?>
		<p class="attachment">
			Next Image<br />
			<a href="<?php echo $next_url; ?>"><?php echo wp_get_attachment_image( $post->ID+1, 'thumbnail' ); ?></a>
		</p>
    <?php }

    if ( wp_get_attachment_image( $post->ID-1 ) != null ) { ?>
        <p class="attachment">
            Previous Image<br />
            <a href="<?php echo $previous_url; ?>"><?php echo wp_get_attachment_image( $post->ID-1, 'thumbnail' ); ?></a>
        </p>
    <?php } ?>
</div>

WordPress 2.9 Post Thumbnail Function

post_thumbnailWordPress 2.9 brings a new function for users of gallery’s the add_theme_support(‘post-thumbnails’) function. with this you will get a new item on your new post window named Post Thumbnail (see right).  After you have added a post Thumbnail to a post, you need to display it.  By using a “gallery” category, creating the below two files (or adding the code to files) and editing your category.php file, you may display a custom gallery page.

To start, create a new file named gallery-function.php and add the following code to it, this file should live in the root of your current theme’s directory.

gallery-function.php

<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>gallery-function.css" type="text/css" media="screen" />
<div id="gallerypost-<?php the_ID(); ?>">
    <div id="gallerypost_main-<?php the_ID(); ?>">
	<div id="gallerypost_thumbnail-<?php the_ID(); ?>">
		<?php post_thumbnail(); ?>
	</div>
	<div id="gallerypost_body-<?php the_ID(); ?>">
		<?php $images =& get_children( 'post_type=attachment&post_mime_type=image' ); ?>
		<h2><a rel="bookmark" href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
		<div><small>Posted by <?php the_author_posts_link(); ?> on <?php the_time('F jS, Y') ?></small></div>
		<div>
			<?php the_excerpt(); ?>
		</div>
	</div>
    </div>
    <div id="gallerypost_sub-<?php the_ID(); ?>">
	<div id="gallerypost_sub_left-<?php the_ID(); ?>">
		<p><?php echo get_the_term_list( $post->ID, 'people', 'Who: ', ', ', '<br />' ); ?></p>
		<p><?php echo get_the_term_list( $post->ID, 'events', 'What: ', ', ', '<br />' ); ?></p>
             	<p><?php echo get_the_term_list( $post->ID, 'places', 'Where: ', ', ', '' ); ?></p>
	</div>
	<div id"gallerypost_sub_right-<?php the_ID(); ?>">
		This Album contains <?php echo $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_parent = '$post->ID' AND post_type = 'attachment'" ); ?> items.
	</div>
    </div>
</div>

Next create a file named gallery-function.css and also add it to our current theme’s root directory.
gallery-function.css

.gallerypost {
        background-color:#fff;
        display: block;
        hNeight: 300px;
        margin: 0px 0px 10px 0px;
        padding: 20px 10px 10px 10px;
        overflow: hidden;
        border-bottom: 1px solid #D2C4A2;
        }
.gallerypost_body {
        float: right;
        width: 430px;
        margin: 0 20px 0 0;
        }
.gallerypost_body p {
        margin: 50px 0px 0px 0px;
        }
.gallerypost_body .entry p {
        margin: 0px 0px 0px 0px;
        }
.gallerypost_body .entry {
        margin: 0px 0px 0px 0px;
        }
.gallerypost_main {
        width: 690px;
        }
.gallerypost_sub {
        display: block;
        padding: 210px 0px 0px 10px;
        }
.gallerypost_sub {
        display: block;
        padding: 210px 0px 0px 10px;
        }
.gallerypost_sub p {
        vertical-align: bottom;
        margin: 0;
        }
.gallerypost_sub_left {
        width: 220px;
        display: block;
        float: left;
        }
.gallerypost_sub_right {
        width: 220px;
        display: block;
        float: right;
        }
.gallerypost_thumbnail {
        float: left;
        }
.gallerypost_thumbnail img {
        margin: 0 0 0 10px;
        color: #000;
        }

And lastly you will need to add the following to your functions.php file in your current theme’s root directory (you may add it anywhere in functions.php).

add_theme_support('post-thumbnails');
set_post_thumbnail_size(200, 200);

Now that we have our functions built, we need to add some code to your category.php file.

Right after:

<?php while (have_posts()) : the_post(); ?>

Add the following code.  This will display the gallery-function.php code when a post is in the “gallery” category.

<? if ( is_category( 'gallery' )) {
                    include('gallery-index.php');
               } else { ?>

Next Before:

<?php endwhile; ?>

Add the following to close the if statement.

<?php } ?>

And that should do it, you should now see the post image on the gallery category page similar to below.

Gallery-screenshot

Postfix: remap from addresses with a generic map

Depending on the software you are using, you may need to change the outbound (from) address of outbound email.  In this How-To, we will change the outbound email address from “apache@example.com” to “webmaster@example.com”.

To start out, go to your postfix directory and modify/create your generic file.  Your generic file will map the two addresses to each other.  At the end of your generic file add a space or tab seperated file simmiler to this.

apache@example.com         webmaster@example.com

Once you have added the entries to your generic file, you need to hash the file so postfix may quickly access it.

postmap /etc/postfix/generic

After you map has been created, you will need to add the entry to your main.cf file to tell Postfix to use your generic map.

smtp_generic_maps = hash:/etc/postfix/generic

Once you have updated your main.cf file, you need to reload postfix

postfix reload

wp reCAPTCHA form version 0.1 released

I have released wp-reCAPTCHA version 0.1. This plugin will allows you to also add subjects to your contact form.  Please check it out on it page at http://mattrude.com/projects/wp-recaptcha-form/.

Installing Postfix with SQLite Support

This How-to will show you how to set up Postfix with SQLite support on a Fedora 11 system.  This will require us to compile Postfix from scratch.

Installing the dependences

yum -y install sqlite sqlite-devel gcc make patch db4-devel cyrus-sasl-devel
echo "postfix:x:89:89::/var/spool/postfix:/sbin/nologin" >> /etc/passwd
echo "postdrop:x:90:90::/var/spool/postfix:/sbin/nologin" >> /etc/passwd
echo "postfix:x:89:" >> /etc/group
echo "postdrop:x:90:" >> /etc/group
ln -s /usr/lib/sasl2/ /usr/local/lib/sasl2

Download and Patch Postfix

Download and unpack the current Postfix Version.

wget http://postfix.energybeam.com/source/official/postfix-2.6.5.tar.gz
tar -xzf postfix-2.6.5.tar.gz
cd postfix-2.6.5

Download and Patch Postfix with the SQLite Postfix patch

wget http://www.treibsand.com/postfix-sqlite/postfix-2.6-20080216_sqlite.patch
patch -ul -d . -p1 < postfix-2.6-20080216_sqlite.patch
echo $?

Building Postfix

To Build with SQLite Support

make -f Makefile.init makefiles 'CCARGS=-DHAS_SQLITE -I/usr/local/include' \
'AUXLIBS=-L/usr/local/lib -lsqlite3'
echo $?

Or to Build with SQLite & TLS Support
Requires:

yum -y install openssl-devel
make -f Makefile.init makefiles 'CCARGS=-DHAS_SQLITE -I/usr/local/include -DUSE_TLS' \
'AUXLIBS=-L/usr/local/lib -lsqlite3 -lz -lm -lssl -lcrypto'
echo $?

To Build with SQLite, Dovecot, & TLS Support

yum -y install openssl-devel dovecot-devel
make makefiles 'CCARGS=-DHAS_SQLITE -I/usr/include/sasl/ -DUSE_SASL_AUTH -DUSE_CYRUS_SASL  -DDEF_SERVER_SASL_TYPE=\"dovecot\" -DUSE_TLS' -I/usr/local/include \
   'AUXLIBS=-L/usr/local/lib -lsqlite3 -lz -lm -lssl -lcrypto -lsasl2'
echo $?

Compiling Postfix

Now Compile Postfix

make
echo $?

And Install it

make install

Building the SQLite Database

In order to use the SQLite function, you need a SQLite database. First using SQLite3 run

sqlite3 /etc/postfix/postfix.sqlite

To create the database, then you can copy and past the following scheme into the new database.

CREATE TABLE alias (
  address varchar(255) NOT NULL,
  goto text NOT NULL,
  domain varchar(255) NOT NULL,
  created datetime NOT NULL default '0000-00-00 00:00:00',
  modified datetime NOT NULL default '0000-00-00 00:00:00',
  active tinyint(1) NOT NULL default '1');

CREATE TABLE domain (
  domain varchar(255) NOT NULL,
  description varchar(255) NOT NULL,
  aliases int(10) NOT NULL default '0',
  mailboxes int(10) NOT NULL default '0',
  maxquota bigint(20) NOT NULL default '0',
  quota bigint(20) NOT NULL default '0',
  transport varchar(255) NOT NULL,
  backupmx tinyint(1) NOT NULL default '0',
  created datetime NOT NULL default '0000-00-00 00:00:00',
  modified datetime NOT NULL default '0000-00-00 00:00:00',
  active tinyint(1) NOT NULL default '1' );

CREATE TABLE mailbox (
  username varchar(255) NOT NULL,
  password varchar(255) NOT NULL,
  name varchar(255) NOT NULL,
  maildir varchar(255) NOT NULL,
  quota bigint(20) NOT NULL default '0',
  domain varchar(255) NOT NULL,
  created datetime NOT NULL default '0000-00-00 00:00:00',
  modified datetime NOT NULL default '0000-00-00 00:00:00',
  active tinyint(1) NOT NULL default '1',
  local_part varchar(255) NOT NULL );

Then close the database

.quit

Or you may download mine from below and use the same scheme work.

Once you have your database file place it in /etc/postfix/ as something like /etc/postfix/postfix.sqlite then run

chown root:root /etc/postfix/postfix.sqlite
chmod 600 /etc/postfix/postfix.sqlite

Configuring Postfix

Now add the maps to you config.

/etc/postfix/main.cf

relay_domains = sqlite:/etc/postfix/sqlite_relay_domains_maps.cf
relay_recipient_maps = sqlite:/etc/postfix/sqlite_relay_recipient_maps.cf
virtual_alias_maps = sqlite:/etc/postfix/sqlite_virtual_alias_maps.cf
virtual_mailbox_domains = sqlite:/etc/postfix/sqlite_virtual_domains_maps.cf
virtual_mailbox_maps = sqlite:/etc/postfix/sqlite_virtual_mailbox_maps.cf

virtual_mailbox_base = /var/spool/virtualmailboxes
virtual_minimum_uid= 1000
virtual_uid_maps = static:1000
virtual_gid_maps = static:1000

sqlite_relay_domains_maps.cf

dbpath = /etc/postfix/postfix.sqlite
query = SELECT domain FROM domain WHERE domain='%s' AND backupmx = '1' AND active = '1'

sqlite_relay_recipient_maps.cf

dbpath = /etc/postfix/postfix.sqlite
query = SELECT goto FROM alias WHERE address='%s' AND active = 1

sqlite_virtual_alias_maps.cf

dbpath = /etc/postfix/postfix.sqlite
query = SELECT goto FROM alias WHERE address='%s' AND active = '1'

sqlite_virtual_domains_maps.cf

dbpath = /etc/postfix/postfix.sqlite
query = SELECT domain FROM domain WHERE domain='%s' AND backupmx = '0' AND active = '1'

sqlite_virtual_mailbox_maps.cf

dbpath = /etc/postfix/postfix.sqlite
query = SELECT maildir FROM mailbox WHERE username='%s' AND active = '1'

Setting up a fresh install of Postfix

mkdir /var/spool/virtualmailboxes/
echo "virtualmail:x:1000:1000::/var/spool/virtualmailboxes:/sbin/nologin" >> /etc/passwd
echo "virtualmail:x:1000:" >> /etc/group
chmod 700 /var/spool/virtualmailboxes/
chown -R virtualmail:virtualmail /var/spool/virtualmailboxes/
rm -f /usr/lib/sendmail
ln -s /usr/sbin/sendmail /usr/lib/sendmail

Adding SQLite entry’s

First add a Domain

echo "INSERT INTO domain ( domain, description, transport )
VALUES ( 'laptop.mattrude.com', 'laptops domain', 'virtual' );" |sqlite3 /etc/postfix/postfix.sqlite

Then add a user

echo "INSERT INTO mailbox ( username, password, name, maildir, domain, local_part )
VALUES ( 'matt@laptop.mattrude.com', 'password', 'Matt', 'laptop.mattrude.com/matt@laptop.mattrude.com/', 'laptop.mattrude.com', 'matt' );" |sqlite3 /etc/postfix/postfix.sqlite

Last we need to add the mailboxes alias

echo "INSERT INTO alias ( address, goto, domain )
VALUES ( 'matt@laptop.mattrude.com', 'matt@laptop.mattrude.com', 'laptop.mattrude.com' );" |sqlite3 /etc/postfix/postfix.sqlite

Next, contue on to my Dovecot SQLite how-to to finish your email server.

RoundCube Regression Testing

With the release of RoundCube 0.3-stable and all the upgrades that will happen, It feels like a good time to talk about regression testing.  Regression testing is when you test the functions of a peace of software to make sure that your updates didn’t break any functions.  In RoundCube it takes me about 10 minuets to fully test a site.  Here’s my check list, yours my vary depending on the plugins your using.

Main Screen

  • Read a HTML message from the preview panel
    • Confirm the “View Header” drop down window works with HTML messages
  • Read a Plain Text message from the preview panel
    • Confirm the “View Header” drop down window works with Plain Text messages
  • Read a HTML message full screen
    • Confirm the “View Header” drop down window works with HTML messages
    • Confirm the “Read Source” button works with HTML messages
  • Read a Plain Text message full screen
    • Confirm the “View Header” drop down window works with Plain Text messages
    • Confirm the “Read Source” button works with Plain Text messages
  • Change Message pages
  • Select All, Unread, None from the bottom center
  • Is the quota meter displaying
  • Flag (star) a message
  • Search for a known message value
  • Move a message from Inbox to a folder
  • Move a message from a folder to the Inbox
  • Send a message to an internal account
  • Send a message to an external account
  • Add a message via the plus symbol when viewing a message
    • Dose it show up in Personal Settings / Spam / Address Rules

Address Book

  • Add an Address Book entry
    • Dose it show up in Personal Settings / Spam / Address Rules
  • Change an existing entry
  • Compose Mail To” button, top center
  • Export Contacts in vCard format” button, top center
  • “Import Contacts” button, top center
  • Delete a contact
    • Dose it delete from Personal Settings / Spam / Address Rules

Personal Settings / Folders

  • Subscribe to a folder
  • Unsubscribe from a folder
  • Add a folder
  • Delete a folder

Personal Settings / Identities

  • Add a new “Identity”
    • Send a message with this identity
  • Modify an existing “Identity”
    • Send a message with this identity
  • Delete an Identity
  • Change default Identity’s

Personal Settings / Spam

  • Add a new white list entry
  • Add a new black list entry
  • Delete a white list entry
  • Delete a black list entry

Allow Logwatch to collect data from OpenVPN’s logs

To allow Logwatch to check OpenVPN’s logs running on a Fedora or other Linux system you need to install this script & conf file.

In order for this script & config file to work you must disable both log & log-append in the OpenVPN Server Config File.

;log          openvpn.log
;log-append   openvpn.log

The Files are:

/etc/logwatch/scripts/openvpn      - Logwatch perl module
/etc/logwatch/conf/openvpn.conf    - Configuration file

/etc/logwatch/scripts/openvpn

#!/usr/bin/perl
##########################################################################
# $Log: openvpn,v $
# Revision 1.0  2005/07/27 17:19:34  hyppo
# Filippo Grassilli http://hyppo.com/email.php
#
# Written and maintained by:
#    Filippo Grassilli http://hyppo.com/email.php
##########################################################################

use Logwatch ':ip';

$Debug = $ENV{'LOGWATCH_DEBUG'};
$Detail = $ENV{'LOGWATCH_DETAIL_LEVEL'} || 0;
$DoLookup = $ENV{'openvpn_ip_lookup'};
$Detail = $ENV{'openvpn_detail_level'} || $Detail;

if ( $Debug >= 5 ) {
   print STDERR "\n\nDEBUG: Inside OpenVPN Filter \n\n";
}

while (defined($ThisLine = <STDIN>)) {
   if (  # Ignore...
      ($ThisLine =~ /Control Channel/) or
      ($ThisLine =~ /Data Channel (Decrypt|Encrypt|MTU)/) or
      ($ThisLine =~ /TLS: soft reset/) or
      ($ThisLine =~ /reading client specific options/) or
      ($ThisLine =~ /Expected Remote/) or
      ($ThisLine =~ /LZO compression/) or
      ($ThisLine =~ /killed expiring key/) or
      ($ThisLine =~ /Diffie-Hellman initialized/) or
      ($ThisLine =~ /Local Options hash/) or
      ($ThisLine =~ /Replay\-window backtrack/) or
      ($ThisLine =~ /TLS: Initial packet/) or
      ($ThisLine =~ /ip (addr add|link set) dev/) or
      ($ThisLine =~ /Re\-using SSL/) or
      ($ThisLine =~ /MULTI: Learn/) or
      ($ThisLine =~ /Received control message/) or
      ($ThisLine =~ /(Restart pause|process restarting)/) or
      ($ThisLine =~ /Inactivity timeout/) or
      ($ThisLine =~ /CRL CHECK OK/) or
      ($ThisLine =~ /VERIFY OK: nsCertType/) or
      ($ThisLine =~ /\d+:\d+ SIGUSR1\[.*restart/) or
      ($ThisLine =~ /^TCP\/UDP: Closing socket/) or
      ($ThisLine =~ /^UDPv4 link /) or
      ($ThisLine =~ /^TUN\/TAP device /) or
      ($ThisLine =~ /Closing TUN\/TAP interface/) or
      ($ThisLine =~ /Interrupted system call/) or
      ($ThisLine =~ /^TLS-Auth MTU parms/) or
      ($ThisLine =~ /^MULTI:/) or
      ($ThisLine =~ /^ succeeded$/) or
      ($ThisLine =~ /^IFCONFIG POOL/)
   ) {
      # Don't care about these...
   } elsif ( ($ThisLine =~ /^OpenVPN .* built on .*/) ) {
      # OpenVPN version
      chomp($ThisLine);
      $OpenVPNVersion=$ThisLine;
   } elsif ( ($ThisLine =~ /^Initialization Sequence Completed/) ) {
      $StartOpenVPN++;
   } elsif ( ($ThisLine =~ /^SIGTERM.* process exiting/) ) {
      $ShutdownOpenVPN++;
   } elsif ( ($Host,$Cert) = ( $ThisLine =~ /^([^:]*):\d+ VERIFY OK: depth=\d+, (.*)$/ ) ) {
      ## Successful cert exchange
      $FullHost = LookupIP ($Host);
      $CertVerified{$Cert}{$FullHost}++;
   } elsif ( ($Host,$User) = ( $ThisLine =~ /^([^:]*):\d+ \[([^\]]+)\] Peer Connection Init/ ) ) {
      ## x.x.x.x:y [user] Peer Connection Initiated with x.x.x.x:y
      $FullHost = LookupIP ($Host);
      $ClientConnection{$User}{$FullHost}++;
   } elsif ( ($HostUser,$Param) = ( $ThisLine =~ /^([^:]*):\d+ SENT CONTROL \[.*\]: (.*)/ ) ) {
      ## user/x.x.x.x:y SENT CONTROL [user]: xxxx....
      chomp($Param);
      $ClientParam{$HostUser}{$Param}++;
   } else {
      # Report any unmatched entries...
      chomp($ThisLine);
      $OtherList{$ThisLine}++;
   }
}

#######################################

if ( ( $Detail >= 5 ) and ($StartOpenVPN) ) {
   if ($OpenVPNVersion) { print "$OpenVPNVersion\n"; }
   print "OpenVPN started/reloaded: $StartOpenVPN Time(s)\n";
}
if ( ( $Detail >= 5 ) and ($ShutdownOpenVPN) ) {
   print "OpenVPN shutdown: $ShutdownOpenVPN Time(s)\n";
}

if ( ( $Detail >= 5 ) and (keys %ClientConnection) ) {
   print "\nOpenVPN Client Connections:\n";
   foreach $ThisOne (sort {$a cmp $b} keys %ClientConnection) {
      print "   $ThisOne:\n";
      foreach $Message (sort {$a cmp $b} keys %{$ClientConnection{$ThisOne}}) {
         print "       $Message: $ClientConnection{$ThisOne}{$Message} Time(s)\n";
      }
   }
}
if ( ( $Detail >= 5 ) and (keys %ClientParam) ) {
   print "\nOpenVPN Client Connection Parameters:\n";
   foreach $ThisOne (sort {$a cmp $b} keys %ClientParam) {
      print "   $ThisOne:\n";
      foreach $Message (sort {$a cmp $b} keys %{$ClientParam{$ThisOne}}) {
         print "       $Message: $ClientParam{$ThisOne}{$Message} Time(s)\n";
      }
   }
}
if ( ( $Detail >= 5 ) and (keys %CertVerified) ) {
   print "\nCertificates verified:\n";
   foreach $ThisOne (sort {$a cmp $b} keys %CertVerified) {
      ($Crt1,$Crt2) = ( $ThisOne =~ /^\/(.*)\/OU=(.*)$/ );
      # print " $ThisOne:\n";
      print " $Crt1\n OU=$Crt2:\n";
      foreach $Client (sort {$a cmp $b} keys %{$CertVerified{$ThisOne}}) {
         print "       $Client: $CertVerified{$ThisOne}{$Client} Time(s)\n";
      }
   }
}

if (keys %OtherList) {
   print "\n**Unmatched Entries**\n";
   foreach $line (sort {$a cmp $b} keys %OtherList) {
      print "   $line: $OtherList{$line} Time(s)\n";
   }
}

exit(0);

/etc/logwatch/conf/openvpn.conf

###########################################################################
# $Id: openvpn.conf,v 1.0 2005/07/27 17:08:09 hyppo Exp $
# Written and maintained by:
#    Filippo Grassilli <http://hyppo.com/email.php>
###########################################################################

Title = "OpenVPN"

# Which logfile group...
LogFile = messages

# Whether or not to lookup the IPs into hostnames...
# Setting this to Yes will significantly increase runtime
$openvpn_ip_lookup = Yes
$openvpn_detail_level = 5

# Only give lines pertaining to the named service...
*OnlyService = openvpn
*RemoveHeaders

Setting the Time Zone on Fedora from the shell

By default Fedora set’s the timezone to UTC, during the install you may change this. But, if you move a server or forget to set the timezone during install.  You may change it after the fact.

Lately I  moved a system from the EST to CST (From Virginia to Minneapolis).  Since this was a webserver, there is no GUI installed (wasting memory).  So I connected to the system via SSH and ran the following command:

cp /usr/share/zoneinfo/America/Chicago /etc/localtime

All your really doing is copy the timezone info for Chicago, into the local systems clock.

To get a list of your time zone, on Fedora, go to your “/usr/share/zoneinfo” directory and list the contents.

cd /usr/share/zoneinfo/
ls

This will give you a list of all the top level regions, find yours and go into it.

cd America

Now find the city that’s closest to you and in your same timezone.

So if your in the Central time zone, copy the Chicago file into your “/etc/localtime” file

cp Chicago /etc/localtime

now check to make sure it all worked.

$ date
Sun Aug 23 15:10:03 CDT 2009

Since this system is in Minneapolis, and Minneapolis is in the CST/CDT I’m good to go.

Adding a native WordPress gallery

I have heard a lot of talk lately of people complaining that they are unable to have image gallery’s in WordPress 2.8= without adding a plugin.  I assume this assumption comes from how hard it is to see what you can do when it comes to the gallery functions built into WordPress.   If you look at my gallery page, you will see a simple native WordPress gallery.  This gallery was built threw the theme but uses WordPress as it’s backend.

So How do I build a native WordPress gallery?

Well there’s two parts to accomplishing this successfully, but I’m only going to show you the first part in this post.  First you need to create a Category for all your gallery posts to be filed under. This Category may be named anything you would like it to be named.  I’m going to stick with the simple name of ‘Gallery’.  You will need some posts to be filed under it.  Create a new post as you normally would.  It is best to put some text to tell you readers what this gallery is all about, but that’s not needed.

Once you are ready to create your gallery, switch the editer from ‘Visual’ mode to ‘HTML’ mode (on the top right).  Once in ‘HTML’ mode, enter:

[ gallery ]

note: there should be no space between the brackets and the word ‘gallery’ (if I were to enter this line on my page, without the spaces, I would create a gallery).

Now switch back to the ‘Visual’ mode and you should see a new yellow box in your post box with an image of a camera with a photograph behind it.  If you move your mouse over this new yellow box, two new icons will appear.  From this point, just upload photos to your site and save it.

After you have uploaded your images, save the post and check it out on your website.  Depending on your theme, you should see a nice full gallery on your page, or as I have, just a single thumbnail on your index page, but the full gallery on the posts page.

Random Picture

Categories

Stay Updated...

What’s going on...