Monday, December 3, 2007

How to write custom rules for spamassassin

How to configure the spam filter for custom rules

do you really need to do this?

answer: if the customer is getting spam that is solicted or unsolicted and it is not marked spam and the customer is concerned, then yes. It is best to leave the filter alone until really needed because the kind of change you will be making will be global

* Ssh into your mail server and gain root privileges
* edit /etc/mail/spamassassin/
* add filters to the bottom of the file indicating your filter text
* here is an example that would work for marking email containing the phrase "foo bar is king" as spam:

body NO_FOO /foo bar is king/i

score NO_FOO 5.0

* save off
* restart the spam filter as such:

/etc/init.d/spampd restart (this depends on your implementation)

Monday, October 29, 2007

How to use rbot, svnwatch.rb plugin and post-commit to log svn commits to an IRC channel

I have not seen this all in one place so here it is: (Obviously if you do not know what I am talking about here, then you do not need this)

How to setup svn (subversion) logging when a commit is made

1. using Debian, issue this command as root: apt-get install rbot
2. using other Linux'es, install the ruby gem, first search for it: sudo gem list --remote rbot
3. pick the rbot you want (get the latest stable) and install the gem
4. run rbot, the first time you run it, rbot will check to see if you have a ~/.rbot directory, if not, then the setup script runs
5. answer most questions as the defauit. The questions you need to fill in are the irc user, the irc server, the irc channel to join
6. ensure the irc channel to join is in the format: #our_cool_channel somepassword
7. once rbot loads and starts running, check to see if the rbot user you made up actually joined the irc channel. If it did, continue, of not, then go back and troubleshoot
8. Shutdown rbot by sending a CTRL-c to the term, then start it back up in "daemon" mode: rbot -b
9. Add "svnwatch.rb" to ~/.rbot/plugins/ This file should be on RobbyOnRails somewhere, search for it
10. Add the post-commit file somewhere (also on RobbyOnRails) where apache can run it when a commit is made, I recommend something like /usr/local/bin
11. create a symlink to the post-commit script in the hooks directory of each svn project you will to run this post-commit script for
12. For example, I want to have a script log to the irc channel when a commit is made to liberty sweet. So I would: ln -s /usr/local/bin/post-commit /home/svn/src/cool_project/hooks/post-commit
13. What this does is run the post-commit in /usr/local/bin/post-commit which fires off a commit message (on port 7666 by default) to rbot, which is logged into the channel.

Monday, September 17, 2007

How to create a reverse ssh tunnel

Say you have a customer that has a firewall, but you need to ssh into their box and you can't mess with firewall (poking holes through it, etc.) If you can convince them to run a script you email to them or get to them someway, you can get a shell easily.


local: (the customer's machine, which is behind the firewall)
remote: a box you have a shell on already


both the local and remote computers must be running sshd (ports do not matter, but you will need root to listen on a port lower than 1024)

here is the line to execute on the local computer:

ssh -nNT -R 1100:local:22 remote


you are ssh'ing from the local computer, past the firewall and into the computer you control. The 'n' option tells ssh to disregard stuff that comes in on stdin (we won't be sending local stdin over the wire, thus send it to /dev/null. The 'N' tells ssh to setup the tunnel but do not associate it with a command stream. 'T' means "do not give me a tty on the remote end". When the above command is run from a shell on the local computer, the shell will hang (after asking for login credentials) and no just a tunnel for other ssh sessions coming in from the other end. It will need to run during the entire session. Now from the remote computer you can simply ssh as such:

ssh localhost -p 1100 -l username

now you should have a shell on the local computer and have essentially defeated the firewall. For those of you reading this and wondering "Wow, someone can generate syn packets into my network, by tricking a user into executing some code, thus defeating my outer defenses.", you would be correct!

Sunday, June 3, 2007

I always forget this, how to place a process in the background after it is already running

So you started this process in your terminal and it is taking a really long time to complete. You want that terminal back but it seems too late to kill the process and rerun it with the '&' to detach it into the background. Well there is hope. You can complete the following to place the process in the background and get your terminal back.

1. From the terminal in question, the one where you do not have a prompt because the application is still running, hit Ctrl-z (this signals the process to pause, but not stop, it can be picked up again right where it left off)
2. Then type 'jobs', if you only have one job on that terminal (you most likely do), then this stopped job will be '1'.
3. Then type 'bg 1' or whatever the jobs output was. Blamo, you have restarted your process into the background.
4. If you logout of the terminal (pty) which launched the process, you are essentially orphaning the process. This will cause the process to zombie (which means the process will never end/die because it is waiting on a signal from the parent that it received its result code) when the process finally does end. Also, if the process outputs to stdout/stderr, then there will be no pty parent associated with it, so Linux will cleanup this process.
5. Thanks to Charles Jones for pointing out that you can issue a 'disown %1' where 1 is the job number.

Reimplementation is back on!

Exciting news over the past week. I have been given the opportunity to lead the IT department at the company I work for. This is good news because it gives me a chance to take the department in the direction I want (which includes updating the suite of tools.) I am excited about this because because Jade Meskill is finally free to fully devote his time to his own company, Integrum.

Monday, May 28, 2007

Looks like the reimplementation is off

Looks like the company that employs me has decided not to upgrade the software they use. This is unfortunate. I will need to reevaluate how this book might get written. There will be no empirical data to include for the domain of the book.

Saturday, May 12, 2007


We just started on a new beer rating site. By we, I mean myself and 3 other people from work. Socialdrinkr is an experiment for those who love beer and would like to share their thoughts about the brews they love. We hope to make it useful for anyone. This is definitely a labor of love. All four of the developers have keen domain knowledge as well the knowledge to build the site. Alright time to get back hacking on socialdrinkr.

Friday, May 11, 2007

Writing a book!

I have been given a great opportunity to write a book. My employer is giving me the opportunity to implement enterprise-level software using Ruby on Rails. I am very fortunate to be a part of this plan. Rails is new and exciting, but needs to be proven. We need to prove concepts like REST (representational state transfer) can work running a multiple million dollar operation. We need to implement a distributed database. Most importantly, we need Rails to work with legacy systems and data. This book will be a practicum of sorts, chronically the entire process from bidding the system to the client through to the "maintenance phase".

Sunday, May 6, 2007

Going to Rails Conf!

Excited = 'Yes'. I would really like to hear David A. Black speak as well as Dave Thomas (no not the Wendys guy), the Ruby guy. Myself and 6 others from Integrum will be going on May 16th. This should be a good time and a chance to show Integrum's colors in Planet Argon's backyard.

Thursday, April 5, 2007

Living the dream

Sipping a latte
Typing with one hand smartly
Igoring those around me

Coming at you like a spider monkey

Greatest generation, my ass!