Server Archived Log Files

Uncategorized No Comments

We have a policy to retain our security log files for 90 days. Our domain policy is setup to auto archive the logs instead of overwriting them. The problem is that the 90 day rule doesn’t stick since there aren’t any entries in the current log file for longer than 90 days. Over the course of the year the log files will eventually fill up our servers c:\ drive.

A quick remedy….

forfiles -p "c:\windows\system32\winevt\logs" -s -m Archive-Security* -d -90 -c "cmd /c del @path"

Batch file to delete all but latest two files

Uncategorized No Comments

@echo off
set folder=C:\test

pushd "%folder%"
for /f "skip=2 tokens=*" %%i in ('dir /a:-d-s /b /o:-d') do echo "%%i"

*** Stolen from Major Geeks forum member GermanOne

pfSense – Captive Portal

Uncategorized 1 Comment

To have reusable vouchers:

Edit /etc/inc/ and modify:

/* This user was already logged in so we disconnect the old one */
captiveportal_logportalauth($cpentry[4],$cpentry[3],$cpentry[2],"CONCURRENT LOGIN - TERMINATING OLD SESSION");


/* This user was already logged in so we disconnect the old one */
if (isset($config['captiveportal']['noconcurrentlogins']))  {
captiveportal_logportalauth($cpentry[4],$cpentry[3],$cpentry[2],"CONCURRENT LOGIN - TERMINATING OLD SESSION");

To get smaller voucher codes:

Generate new private and public key pair (can be done on any computer.)

openssl genrsa 31 > key.private
openssl rsa -in key.private -pubout -out key.public

Paste key.private and key.public in Services > Captive Portal > Vouchers under Voucher Public Key and Voucher Private Key.

I also changed the Character Set to: “2345678abcdefhjkmnpqrstuvwxyz”

It then generated 7 character voucher codes.

Disable IPv6 from CLI

Uncategorized No Comments

This must be run from a Administrator Command Prompt.

\Tcpip6\Parameters /v "DisabledComponents" /t REG_DWORD /d 0xffffffff

Windows XP Add New Hardware USB

Uncategorized No Comments

Recently ran into a problem where an XP Machine was always popping up asking to install drivers for every little thing including USB Mouse and USB Mass Storage Device which shouldn’t ever happen. To fix it where it automatically installs the driver and assigns a drive letter go to the Command Prompt and type each of the following:

regsvr32 Softpub.dll
regsvr32 Wintrust.dll
regsvr32 Initpki.dll
regsvr32 Dssenh.dll
regsvr32 Rsaenh.dll
regsvr32 Gpkcsp.dll
regsvr32 Sccbase.dll
regsvr32 Slbcsp.dll
regsvr32 Mssip32.dll
regsvr32 Cryptdlg.dll

Favorite Wallpapers for Ubuntu

Uncategorized No Comments

Here are two of my favorite wallpapers for Ubuntu. I like to go Distro themed when I work on computers by default.


Originally from Atkarus Designs.

Ubuntu 9.10 Wubi Install Grub2 Problems

Uncategorized No Comments

Apparently there are still some bugs to work out with Ubuntu 9.10 RC. If you install with Wubi and update grub2 automatically rewrites the MBR which disables bootup to Windows but Ubuntu keeps working. Here is a temporary solution.

We need to fix the MBR for Windows. Since Ubuntu is the only Operating System we can now boot we need a way to fix it from inside of Ubuntu. ms-sys is an older package that is no longer available in the repo’s because of copyrights.

Visit and download the package. Firefox should automatically ask you to open with GDebi Package Installer. Click Install Package and type in your password.

Next open up a terminal. Applications > Accessories > Terminal.

sudo ms-sys -w /dev/sda
[sudo] password for craig:
DOS/Windows NT master b oot record successfully written to /dev/sda

for a shorter way….

cd /tmp && wget -c && sudo dpkg -i ms-sys_2.1.0-1_i386.deb && sudo ms-sys -w /dev/sda

All the above assumes you only have one hard drive in your system on /dev/sda. If you have more than one hard drive please check by using “sudo sfdisk -l”. You’ll be looking for something like:

Device       Boot Start End     #cyls   #blocks      Id  System
/dev/sdb1   *      0+   2549    2550-  20482843+  7  HPFS/NTFS

This tells us we have a NTFS partition on /dev/sda1 which is the first partition on /dev/sda. So we know that we need to use /dev/sda. Substitute for your own hard drive. That may be /dev/sdb or /dev/sdc. Of course if your using Wubi its probably safe to say /dev/sda.

Ubuntu Customization Script

Uncategorized No Comments

I’m in the process of upgrading all my computers to the latest Ubuntu 9.10 (Karmic Koala) and I really wanted a way to quickly customize my interface. I wrote this quick script that I plan on running immediately after installing.

This script downloads and sets the Shiki-Brave theme, Droid Fonts, puts the Computer and Home folders on the desktop, Installs the Restricted software such as Java and Flash, and updates the system.


sudo apt-get update && sudo apt-get install shiki-brave-theme ttf-droid -y
gconftool-2 --type=string -s /desktop/gnome/interface/gtk_theme Shiki-Brave
gconftool-2 --type=string -s /desktop/gnome/interface/icon_theme gnome-brave
gconftool-2 --type=string -s /desktop/gnome/interface/document_font_name Droid\ Sans\ 10
gconftool-2 --type=string -s /desktop/gnome/interface/font_name Droid\ Sans\ 10
gconftool-2 --type=string -s /desktop/gnome/interface/monospace_font_name Droid\ Sans\ Mono\ 10
gconftool-2 --type=string -s /apps/metacity/general/titlebar_font Droid\ Sans\ Bold\ 10
gconftool-2 --type=string -s /apps/nautilus/preferences/desktop_font Droid\ Sans\ 10
gconftool-2 --type=string -s /apps/metacity/general/theme Shiki-Colors-Metacity
gconftool-2 --type=bool -s /apps/nautilus/desktop/computer_icon_visible 1
gconftool-2 --type=bool -s /apps/nautilus/desktop/home_icon_visible 1
gconftool-2 --type=bool -s /apps/nautilus/preferences/enable_delete 1
sudo apt-get install ubuntu-restricted-extras -y
sudo apt-get upgrade -y

Here is a screenshot:
Ubuntu 9.10 Screenshot

Zero Write Hard Drive

Uncategorized No Comments

I have always used third party tools to zero write hard disks when I’m done using them or when some body requests it done. However, I have started using a external hard drive enclosure and I wanted to do it within my Ubuntu.

dd if=/dev/zero of=/dev/sdb

Since I only have a single hard drive the external drive became /dev/sdb. You can double check to make sure your wiping the right drive by using…

sfdisk -l

Reset Gnome Panels to Default

Uncategorized No Comments

Recently I’ve some problems with the panels in Gnome getting all messed up. It can be difficult to get everything back exactly where you want it. Easy solution is just do delete your config and let gnome rebuild it back to the defaults.

At the terminal type:

rm -r ~/.gconf/apps/panel

« Previous Entries Next Entries »