Category Archives: Ubuntu

ASA syslog parsing…

The ASA syslog format can be a bit of a pain to parse, especially when you want a concise list of the access a host has been granted or denied via the firewall. The original log format looks like this:

00:00:00 %ASA-6-106100: access-list inside permitted tcp Inside/ -> Outside/ hit-cnt 1 first hit [0x62c4905, 0x0]

Lets clean this up a bit with the following command, for this example we only care about the permitted access across the inside interface

$grep access-list\ inside\ permitted <SYSLOG FILE>.log | sed -e 's/\// /g' | sed -e 's/(.*>//' | awk '{print $7,$8,$9,$10,$11}'

This will result in the following:

tcp Inside Outside

Obviously you would be left with a few thousand entries like the one above, now you can add a unique sort to the mix and clean things up, the whole thing will look like this:

$ grep access-list\ inside\ permitted <SYSLOG FILE>.log | sed -e 's/\// /g' | sed -e 's/(.*>//' | awk '{print $7,$8,$9,$10,$11}' | sort | uniq -c | sort -nr

XBMC and Boxee with HDMI Audio

On my Asus M3A78-EM running Ubuntu 9.04 I use  XBMC and Boxee for media playback. I recently had the need to output audio over s/pdif optical and via HDMI due to the fact that I have a HDMI switch to send the output to two separate LCDs.  I also have a MSI N9400GT-MD512H GeForce 9400 GT installed in this box to perform VDPAU video hardware acceleration.  As you may or may not know this GeForce card requires a 2 pin s/pdif cable to be run from the motherboard to video card.  In order for HDMI audio to function you must go into your bios and set the `SPDIF OUT mode` setting to ‘SPDIF Output’.  One the system is back online, be sure to disable Pulse Audio as it does not play well with Boxee and XBMC. Next you need to have the latest ALSA v1.0.22 installed, a nice upgrade script for Ubuntu can be found here . To check what version you have installed check the following file:

htpc@Electric:/media/sda3$ cat /proc/asound/version
Advanced Linux Sound Architecture Driver Version
Compiled on Feb 21 2010 for kernel 2.6.28-18-generic (SMP).

Ok, once you have the latest version installed you need to configure your /etc/asound.conf  file as follows:

pcm.!default {
type plug
slave {
pcm “spdif”
rate 48000

EDIT 2/22/2010:  I found that under the latest Boxee Beta I could not get sound to function at all!  On a hunch I deleted the asound.conf file above and everything including navigational sounds worked like a charm . XBMC also function perfectly, so I really question the need for the global asound.conf file above.

You may also want to check in your home folder to be sure that you don’t have any custom asound configuration files, you really should remove these as to not cause any confusion.

Go ahead and do a reboot if you have not done so. Once the system is back up you should run alsamixer and turn all your volume levels up, pay special attention to the SPDIF levels  be sure they are unmuted. An unmuted channel will have a ‘OO’ and a muted channel will have a ‘MM’.  Once you have your levels set run ‘sudo alsactl store 0’ to save your settings.  Lastly, in Boxee and XBMC set your audio settings as follows:

Audio output———————————-Digital
-Dolby Digital (AC3) Capable receiver—-off
-DTS Capable Receiver———————–off
Audio ouput device————————–default
Passthrough output device——————iec958
Downmix multichannel audio to stereo—on

These are the setting I have to use for everything to work with an older Sony XBR1 I have, the TV does not seem to be able to support Dolby Digital or any special formats.  Good Luck.

How to quickly chmod files and directories selectivly

I recently had to secure a number of samba file shares which contained a few thousand directories and files. I wanted a quick way to set the permissions on all the files and then turn around and set the permissions on the folders but in a different manner. The following command will recursively search though a folder and find all files and change their permissions to the octal permission 664:

sudo find . -type f -exec chmod 0664 {} \;

Likewise we can change the search type to directories and change their permissions to 775.

sudo find . -type d -exec chmod 0775 {} \;

Syslog-ng and Ubuntu Gutsy

I have run Kiwi syslog server on window for years however it is starting to show its age. I figure why not move to an open platform that rocks! The great thing is that Syslog-ng on Ubuntu is configured as a drop in replacement to sysklog ( the default logger daemon). The first thing we need to do is grab and install syslog-ng.

sudo atp-get syslog-ng

Once this has been completed its time we pop open it’s config file and make some needed changes to allow for the reception of remote systems syslogs.

Continue reading Syslog-ng and Ubuntu Gutsy

Ubuntu Backup Script

I covered creating an IPcop backup script last time. This time around I want to go over a backup script I’ve been using for an Ubuntu box. The script works just like the IPcop script with some slight modifications made to accommodate Ubuntu’s file system. In my case I mounted a separate volume at /media/backup. Either copy or create the following files in that location and modify them to fit your needs. If you want to ignore any files or folders for any reason simply add them to the ignore.txt file and they will be skipped. Remember to ignore any network mount points you may have, otherwise that MP3 collection on your other box is going to end up in your new 40gb backup tar file 😉

Continue reading Ubuntu Backup Script

How to remove a badly installed .deb

I really needed a solid text editor for Ubuntu. On Windows I run TextPad which is excellent, after some searching I found jEdit which looks like it contains all the features of TextPad and then some!

I attempted to install the development package for jEdit as such:

$ sudo dpkg -i jedit_4.3pre6_all.deb

Selecting previously deselected package jedit.
(Reading database … 102247 files and directories currently installed.)
Unpacking jedit (from jedit_4.3pre6_all.deb) …
dpkg: error processing jedit_4.3pre6_all.deb (–install):
unable to create `./usr/lib/menu/jedit': No such file or directory
dpkg (subprocess): unable to execute new post-removal script: No such file or directory
dpkg: error while cleaning up:
subprocess post-removal script returned error exit status 2
dpkg-deb: subprocess paste killed by signal (Broken pipe)
Errors were encountered while processing:

At this point nothing was installed and running 'sudo dpkg -r jedit' did not help matters. After some reading I found that the following did the trick:

"dpkg –remove –force-remove-reinstreq jedit"

 I have since followed this guide on installing jedit using synaptec. 

Ubuntu Dapper on a Nforce2 with WakeOnLan!

If there is one thing I cant stand is a computer humming needlessly in the background. I usually set all my boxes to drop into suspend mode after an hour of no use. Recently I installed Ubuntu Dapper Drake on one of my boxes, it happens to be an Asus a7n8x-deluxe. Enabling WakeOnLan with ethtool did not help. Well today I found the fix, this link will tell you how to install nvidia's own ethernet drivers and how to disable the included forcedeth drivers for good. I followed the instructions, rebooted and then shutdown my box. I ran etherwake from my other workstation and wouldn't ya know… it fired up!