Tuesday, May 12, 2009
Nagios, FreeBSD, and Lilac
Anyway, the rough steps are:
1. install mysql50-server
2. install apache22
3. install php5
4. install php5-extensions with the following modules enabled:
json, pcntl, posix, mysql, curl
5. install php5-pdo_mysql
6. install nmap
7. untar the lilac source to /usr/local/www/apache22/data/lilac
8. sudo chown www:www /usr/local/www/apache22/data/lilac/includes
9. restart apache.
Note: in order to get apache to work with php, I created a php config file in /usr/local/etc/apache22/Includes/php.conf:
DirectoryIndex index.php index.html index.htm
AddType application/x-httpd-php .php .htm .html
AddType application/x-httpd-php-source .phps
Thursday, May 7, 2009
Netgear Switches (FSM7352S) and Disabling Stackports
To disable stacking from the command line:
enable (if you aren't there already)
configure
stack
stack-port 1/0/51 ethernet
stack-port 1/0/52 ethernet
To revert them back to stack ports:
configure
stack
stack-port 1/0/51 stack
stack-port 1/0/52 stack
Nagios, FreeBSD, and nconf
Nconf is yet another web frontend for the configuration of Nagios. It seems to work okay. It's PHP based. It's not in the ports tree, but then again, it hasn't been around very long. Here's what I did to install it:
1. install nagios, apache, php5, php5-extensions, mysql (It can't use PostgreSQL at this point) etc.
2. Create an appropriate php5.ini in /usr/local/etc and make sure it contains at least:
short_open_tag = On
register_globals = Off
magic_quotes_gpc = Off
3. untar nconf into /usr/local/www/apache22/data/nconf
4. cd to that dir
chown www config output temp
5. sudo mysql (-p if you have a root password set at this point, if not it's a good idea)
CREATE DATABASE nconf;
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP on nconf.* to 'nconf_user'@'localhost' identified by 'difficult_password';
flush privileges;
6. add www to nagios group
7. restart apache (I also had to add:
AddType application/x-httpd-php .php .htm .html
AddType application/x-httpd-php-source .phps
to /usr/local/etc/apache22/httpd.conf)
8. Browse to http://your-host-ip-or-name/nconf and go through the setup (set the path to nagios to be /usr/local/bin/nagios)
9. remove INSTALL.php and the INSTALL directory in nconf
10. Download the default imagepak-base.tar.tar from here.)
11. rename the image pack to imagepak-base.tar.gz
12. cd /usr/local/www/nagios/images/logos
sudo gunzip /path/to/the/imagepak.tar.gz
sudo tar -xf /path/to/the/imagepak.tar
The base install is done.
It will generate a tarball with the configs in /usr/local/www/apache22/data/nconf/output. You'll need to untar it into /usr/local/etc/nagios and configure nagios.conf to parse the directories for configs.
I hope the project lasts. There have certainly been a lot of webguis for Nagios that have died. Hopefully, they will add the ability to import existing configs at some point.
Monday, April 27, 2009
ZFS, the ZIL, iSCSI, NFS, and ESXi
Anyway,
I've been working with Solaris 10 u6 x86 and ZFS. I started dabbling in it about two years ago, but I wasn't too interested. I guess I just needed another couple of years worth of pain wrestling with competing volume managers like Sun Volume Manager, LVM, etc.
We have several clients with real interest in a Solaris/ZFS solution for fileservers between branch offices and for DR planning. To prepare for this, I've been testing Solaris 10u6 with a couple of ASUS barebones, 4GB RAM, 4x 320GB 7,200RPM 16MB cache 2.5" SATA drives, and a dual core celeron clocked at 2GHZ. The boxes also have an Intel PCI-E desktop NIC. Not terrible, but nothing like the "Thumpers" that all the blogging Sun engineers are using (128GB RAM!)
The testing has been going fairly well. I know the system could use more RAM (I'm working on getting a used Dell PE and adding 16GB RAM) - but this will be good for demos. The snapshotting alone should be able to hook quite a few people. I recently purchased an OCZ Vertex 30GB SSD to test out dedicated ZILs. For those that don't know already, the ZIL is the log device for a given pool - by default, stored across the drives in a pool. The ZIL is used in client caching. If you do use a separate device for the ZIL, it would be safest to use ZIL devices in pairs as mirrors.
Anyway, I added it to my little pool as a dedicated ZIL device. I noticed right away that it had zero impact on iSCSI performance (I guess I should have realized that the ZIL wasn't for use by the iSCSI targetd.) I was getting near full line speeds on a gigabit Windows Vista client using the windows iSCSI initiator, a ZFS backed iSCSI lun, and the ATTO disk benchmark.
I decided to create a regular ZFS volume and share it out in NFS (zfs create -osharenfs=root=my.esxi.box's.ip-address mypool01/vols/nfs1) so I could mount it in ESXi as the datastore. I set up an ESXi install on a USB stick and booted another machine with a Q9400 Intel processor (4 cores at 2.5GHZ) with 4GB RAM and only the USB stick for a hard disk. I then added the NFS share as a datastore, and proceeded to install FreeBSD 7.1 i386 on a new vm.
It changed everything in regard to the ZIL. Whereas I was seeing zero activity on the ZIL disk, I was now seeing heavy activity on the ZIL, with up to 20 seconds of no activity on the four disks. I was seeing between 2 and 5 thousand kps on the ZIL, plus around 600 transactions per second. The transactions bit was pretty interesting, as I was used to seeing about 30-40 tps for each of the regular drives in iSCSI testing.
I later compiled cvsup on the VM and I noticed that there was much less activity. Bonnie++ produced a heavier throughput (~12,000kps) on the ZIL, but less transactions per second (around 350.) The drives were writing every 10 to 15 seconds, and were sustaining a speed of about 12,000kps.
I'll probably do a make buildworld on the vm later to get a better feel for the performance... As you can tell, this testing isn't even remotely scientific or thorough.
Friday, February 20, 2009
Extending the System Partition in Windows 2003 Server
Someone asked how one might resize a Windows 2003 system partition (typically C:.)
There are several utilities that can do this: Acronis and Easeus are two that come to mind. However, they aren't all that cheap, especially if you need to perform this operation on multiple servers.
Window's disk manager does not work - I even tried converting the disk to dynamic. Parted couldn't extend it, either. A friend suggested gparted.
I've had some issues with gparted before, but I decided to give it a try.
- I booted the virtual machine in VMWare workstation (you didn't think I'd try this on a real machine first, did you?) and noted the partition size of C:. It was 20GB. - I then shut it down, and used vmware-vdiskmanager to extend the volume to 30GB.
- I made a snapshot of the vm
- I then booted from the gparted live CD and extended the C: drive to 27GB from there.
- I rebooted and logged in. C: was now 27GB. I even checked the disk with the windows disk tools, and there were no errors.
Note: you'll need to have free space on your disk for this to work (obviously.) Back up your C: drive/system drive before starting (you can use ntbackup - make sure you get the system state, too.)
Thursday, January 15, 2009
OpenBSD 4.x, OpenVPN, and Kerberos Authentication
Since AD does have Kerberos support, it is possible.
1. Install OpenVPN from ports
2. Install the p5-Authen-Krb5-Simple perl module from ports (/usr/ports/security/p5-Authen-Krb5-Simple)
3. Add a script like so:
/etc/openvpn/krb5-auth.pl
#!/usr/bin/perl
use strict;
use Authen::Krb5::Simple;
# change the next variable to 1 to log errors to /tmp/autherror.txt
my $debug = 0;
my $user = $ENV{'username'};
my $pass = $ENV{'password'};
chomp ($user, $pass);
my $krb = Authen::Krb5::Simple->new([realm => 'YOURREALM.LOCAL']);
# Authenticate a user.
#
my $authen = $krb->authenticate($user, $pass);
unless($authen) {
my $errmsg = $krb->errstr();
if ($debug == 1) {
open ASD, ">/tmp/autherror.xt";
print ASD "User: $user authentication failed: $errmsg\n";
close ASD;
}
die "User: $user authentication failed: $errmsg\n";
}
Your script can be more complex than this, but this should work.
4. Add the following line to your client config:
auth-user-pass
5. Add the following lines to your server config:
auth-user-pass-verify /etc/openvpn/krb5-auth.pl via-env
6. create /etc/kerberosV/krb5.conf and add something along the lines of:
[libdefaults]
# Set the realm of this host here
default_realm = YOURREALM.LOCAL
# Maximum allowed time difference between KDC and this host
clockskew = 300
# Uncomment this if you run NAT on the client side of kauth.
# This may be considered a security issue though.
# no-addresses = yes
[realms]
YOURREALM.LOCAL = {
# Specify KDC here
kdc = mydomaincontroller.my.domain.local
# Administration server, used for creating users etc.
# admin_server = kerberos.my.domain
}
7. test kerberos:
kinit your_windows_username@YOUR_FQDN_WINDOWS_DOMAIN.IN_ALL_CAPS
If you get no error, run klist and you should see a ticket.
8. Make sure the time is accurate on your OpenBSD server.
Friday, January 2, 2009
IPSec tunnels on a dual homed Cisco ASA 5510
I assumed, incorrectly, that it was going to be as simple as adding a static route for the IP of the destination to route through the second ISP's gateway. That did allow me to bring up the tunnel, but traffic would not pass.
The route I added was something along the lines of:
route backup-link my.external.address my.netmask my.2nd.isps.gateway 1
As it turns out, the ASA assumes that even IPSec tunneled traffic will be using the default gateway, so I had to add another route like so:
route backup-link my.internal.subnet.at.the.other.office my.netmask my.2nd.isps.gateway 1
And that seemed to work.