Friday, July 30, 2010

New Console Game Out...

This is a fake game cover I made for a friend. Not computer related, but since no one reads this blog anyway, who cares?




Photobucket

Wednesday, June 23, 2010

Trouble sending out email from Bacula 5.0.2 and CentOS 5.5

I recently noticed that Bacula installations on CentOS 5.x (primarily 5.5) boxes were not sending out email after job completion. It was baffling as bsmtp worked fine on the command line... at least when I ran it as root. I tried running it as the bacula user (my Bacula director runs as the Bacula user, not root) and it failed:

$ su - bacula -s "/usr/sbin/bsmtp"
-bsmtp: error while loading shared libraries: libbac-5.0.1.so: cannot open shared object file: Permission denied


Ah... I checked the file permissions:

ls -la /usr/lib/libbac-5.0.1.so
-rwxr-x--- 1 root root 330240 Jun 22 12:46 /usr/lib/libbac-5.0.1.so

Simple fix:

chmod o+r /usr/lib/libbac-5.0.1.so

On 64 bit CentOS/Rhel, it will be /usr/lib64/libbac-50.0.1.so

I'm guessing that there was a problem in the spec file (I built it from an srpm.)

Sunday, May 23, 2010

Bacula Windows Client and error 1067

I recently ran into an error starting the bacula-fd service on a windows client: error 1067. I looked it up... several people had this error, but no resolution. I looked at the application log on the windows client, but there was no bacula message.

To figure it out, I started the bacula-fd.exe file by hand from a command prompt. It gave the full error message (I had a minor typo in the bacula-fd.conf file.)
I corrected the typo and was able to successfully start the service.

Coincidentally, a useful one liner for bconsole on Linux:

watch -n 1 --differences "echo status 2 2 | bconsole | \
    grep 'Files=' | sed -e 's/ */ /g' | cut -f 3 -d \" \""

In this case, my storage device is #2. It produces out put like this (every second):
Every 1.0s: echo status 2 2 | bconsole | grep 'Files=' | sed -e 's/ */ /g' | cut -f 3 -d " " Sun May 23 00:45:54 2010

Bytes=1,765,498,476



Unfortunately, this won't work on FreeBSD as the watch command from ports has different syntax.

Thursday, April 29, 2010

Removing the Request Tracker (RT) Subject Prefix

I have an installation of Request Tracker that I use at work to manage helpdesk tickets, assets, projects, and other things. I recently added a support queue for the customer services people. They're using another program to actually manage the cases, but want to use RT for the auto responder.

That's not a big deal, of course. The problem was the RT subject header. You can modify the template subject as you wish, but you can never get rid of the RT name prefix:

[So and So's support queue #233] Autoreply: I need help on this problem

Since the support people are using another program to manage the cases, they didn't want to confuse users with an RT ticket number. Once the user sends in his or her email and the support team creates a case in the other package, the ticket will be closed. The requestor will receive only the autoreply from RT, and the rest of the correspondence will be through the other system.

I could not figure a way to leave off the prefix without affecting all the queue. I searched through the code and found the least invasive hack:


In the Interface::Email::SendEmail method... here's a diff:
diff -ru Email.pm /usr/local/lib/perl5/site_perl/5.8.9/RT/Interface/Email.pm
--- Email.pm 2009-10-19 15:55:31.000000000 -0400
+++ /usr/local/lib/perl5/site_perl/5.8.9/RT/Interface/Email.pm 2010-04-29 17:34:52.000000000 -0400
@@ -308,6 +308,7 @@
=cut

sub SendEmail {
+
my (%args) = (
Entity => undef,
Bounce => 0,
@@ -315,6 +316,7 @@
Transaction => undef,
@_,
);
+
foreach my $arg( qw(Entity Bounce) ) {
next unless defined $args{ lc $arg };

@@ -329,6 +331,13 @@

my $msgid = $args{'Entity'}->head->get('Message-ID') || '';
chomp $msgid;
+#### 4.29.2010 - custom hack to skip ticket number on support queue
+my $tSub = $args{'Entity'}->head->get('Subject');
+if ($tSub =~ m/^\[MyCompany's Customer Support queue #[0-9]+\] (AutoReply:.*)$/) {
+ $args{'Entity'}->head->set('Subject' => "[MyCompany's Customer Support queue] $1");
+}
+#### end custom hack
+

# If we don't have any recipients to send to, don't send a message;
unless ( $args{'Entity'}->head->get('To')


Notice that it only affects messages sent out as Autoreply (i.e., responding to a Scrip creation event.) I could have been more sophisticated and added a custom field to the queues, and modified the actual Autoreply routine to look up the value... but I consider this to be a one off, and this was the simplest modification. I suppose I didn't absolutely need a temp variable, but I put one in anyway.

Monday, April 26, 2010

OpenBSD, Dual Gateways, and redirects

I wanted to allow users to ssh to an sftp server, but using the secondary ISP connection. The SFTP server is in a DMZ (actually, in this case, it's a VLAN off an internal NIC.) This is with OpenBSD version 4.4.

#As usual, we need to set up the pf.conf file so that NATing happens on both interfaces:

nat on $ext_if from !($ext_if) to ! -> ($ext_if:0)
nat on $ext_if2 from !($ext_if2) to ! -> ($ext_if2:0)

# here's the actual redirect
rdr pass on $ext_if2 proto tcp from any to ($ext_if2:0) port 40000 \
-> $sftp port 22

# I haven't tried this with 4.6 or later... anyway, keep state appears
# to break things, as later packets go out the primary ISP connection
# ($ext_if, not $ext_if2)
pass out on $dmz3_if proto tcp from any to $sftp port 22 no state
pass in on $dmz3_if route-to ($ext_if2 $gateway2) proto tcp from \
$sftp port 22 to any no state



It works for me.

Saturday, March 20, 2010

Migrating NT 4 to Windows 2000, Sun VirtualBox, and VMware

I just performed my last Windows NT to Windows 2000 domain migration (I certainly hope it's the last time!) I was tasked with moving an NT 4 domain with a single domain controller to Active Directory. Fortunately, the company did not have Exchange (I've done NT 4 + Exchange 6.5 to Win2k3 + Exchange 2003, and it's not a fun migration.)

Here are the steps I followed, more or less:

1. Obtained Windows NT Server media, Windows 2000 server media, and Windows 2003 R2 32bit media

2. I migrated the existing NT 4 server to a VMware server 1 VM (the company only had a single VMware server running on CentOS 5.2. I used VMware converter version 3.x (version 4 does not support NT 4.)

2a. I had some time on my hands, so I simulated the whole thing with a copy of the VM I created in step 3. I did the entire migration on virtual machines before continuing on site.

2b. I created a snapshot of the virtual NT 4 PDC.

2c. I set up an additional DNS server on another box (a windows 2003 server) and made it the primary DNS server. It is possible to use Bind 9, but the client did not have enough unix infrastructure to make that practical.

3. I created a Win NT BDC as a VM on Sun VirtualBox 3.x. I created a single disk of less than 4GB (I made it 3.8GB.) The disk did not need to be huge. I was not intending for this VM to be around long term. This worked fairly well. I originally tried to create it using VMware Workstation 7.x, but had several annoying problems, so I just used VirtualBox. The NIC on the VM was bridged. I gave it a static IP and put it in DNS.

4. I promoted the VM I created in step 3 to be the PDC (using the server manager on the original NT 4 PDC.

5. I created a snapshot of the new NT 4 PDC

6. I upgraded the new PDC to Windows 2000. I ran into some problems with the VM crashing (VirtualBox crashing, to be precise.) I stopped the crashing by disabling all virtualization extensions on the VirtualBox config for the VM. At any rate, this created an Active directory installation. I pointed DNS to the win2003 server I mentioned in step 2c.

8. After the upgrade and Active directory creation, I made the new win2000 box the primary dns server for the zone. Once I had transferred the zone successfully, I changed the zone to be active directory integrated.

9. I applied Windows 2000 Service pack 4 and all relevant updates ( I had to install IE 6 sp1 to get windows update to work correctly.)

10. I ran adprep /forestprep on the new windows 2000 domain controller. Adprep was located on the second disc of Windows 2003 R2 32bit in the directory CMPNENTS\R2\ADPREP.

11. I ran adprep /domainprep and adprep /domainprep gpprep on the Windows 2000 domain

At this point, I had a Windows 2000 domain. I could safely delete the NT 4 BDC and shut it down. I left it around, as there were a few files to grab.

12. I then ran dcpromo on the Windows 2003 box I mentioned earlier, and made it an additional DC.

13. I made the windows 2003 R2 dc a global catalog server.

I haven't had time to go back and finish up (add another Windows 2003 R2 box (or even Windows 2008 R2)) yet. I verified that filesharing and login worked, of course.

Thursday, March 11, 2010

Remote Desktop Clients, 32Bit Applications, and Windows 2008 R2

I recently ran into a problem with Remote Desktop Services on Windows 2008 R2 (formerly known as Terminal Services from Windows NT 4 through Windows 2008). The problem occurs when someone configures an RDP session that automatically launches a 32 bit application on connection. As you may know, Windows 2008 R2 is 64bit only. The problem I was seeing was that there was frequently a delay after exiting the application.

What should happen is that the RD session should drop after the application closes. What often happens is that the user sees a blue screen for up to two or three minutes, then the session completely drops.



I figured out the cause by using the Remote Desktop Services Manager. I launched a client session that launched the 32bit app upon login. I then closed the application, and the session hanged. Looking in the RD Services Manager, I noticed that there was a service from the session called "splwow64.exe." I killed that process, and the session dropped.



The Fix



The fix is pretty simple. It requires a regedit. Perform this regedit at your own risk! You should backup the registry before you start.

Navigate to the registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\SysProcs

Add the following 32 bit DWORD:
splwow64.exe

and set the value to 0

The fix worked instantly, at least for me. Your results may vary, of course. As far as I understand, you can create other dword values in there to terminate other programs that are stalling the exit of remote desktop sessions.

Apparently, splwow64.exe is used in thunking (in this context, converting memory addresses from 32 bit to 64 bit.)