Archive for August, 2007

Nagios exec logging

Nagios can be a pain in the butt to troubleshoot because finding out what it is passing to it’s plugins isn’t easy to log.

A friend says that this works, haven’t tried it yet, but it seems logical.

strace -s 4096 /usr/local/nagios/bin/nagios -c /usr/local/nagios/etc/nagios.cfg 2>&1 | vim -

syntax on
set filetype=strace

Comments

Simple Testing of SMTP with Telnet

SMTP is a pretty straightforward protocol, and thats why it is so simple for spammers to mess with, but it also makes it easy for us to test if its working.

Many times you want to verify your server before bringing it live in your MX record or even just test to make sure everything is good on your sendmail side.

Simple way of doing this is using telnet from the command line:

$ telnet your.mail.server.name.com 25

Trying your.mail.server.name.com…
Connected to your.mail.server.name.com.
Escape character is ‘^]’
220 your.mail.server.name.com ESMTP Sendmail 10.0.1/10.0.1; Mon, 13 Aug 2007 18:36:27 -0400 (EDT)

HELO your.doman.com
250 your.mail.server.name.com, nice to meet you!
MAIL FROM:you@your.domain.com
250 2.1.0 you@your.domain.com… Sender ok

RCPT TO:me@your.domain.com
250 me@your.domain.com… Recipient ok
DATA
354 Enter mail, end with “.” on a line by itself

Put your message here, and finish with a line that
only contains a period, so hit enter, then hit period, then hit enter, like below
.

250 2.0.0 l7DMerMV044784 Message accepted for delivery
QUIT

That should give you a good idea of what areas are having issues, so if you receive something like:
550 5.7.1 someone@someother.com… Relaying denied

you know that the mail server isn’t setup to receive messages for that user, or that the server is mis-configured for relaying.

Comments

Setting the time zone in FreeBSD

Couldn’t figure out how to set the timezone on my FreeBSD router/server box.

Found a mailing list post that suggested copying the appropriate file (in my case, PST8PDT) from /usr/share/zoneinfo to /etc/localtime. It worked well.. probably not perfect, but ;)

Comments

Find out what perl modules you have currently

Some simple cpan trickery to save you some sanity on cloning a box, finding out what perl modules are installed will save you some hassle later when your scripts won’t run:

$ perl -MCPAN -e shell

cpan> install ExtUtils::Installed
cpan> quit

$ perldoc perllocal

will give you a list of what you have installed.

Comments

How to test local reverse dns lookups from your name server

I was having issues with reverse dns not working on one of the nameservers I admin and couldn’t figure out how to test it without changing the reverse dns delegation at my ISP, which I had implemented as a temporary fix to our issues (Hey take over our Reverse DNS, here are the records, quick, I can’t send any mail!!)

It took a while to find it, but this is how you can query your local DNS server for reverse response… write a nice nagios script around it and save yourself some embarrassment when the bosses ask why every email is bouncing saying invalid server. :)

host -t ptr 4.3.2.1.in-addr.arpa ns.yournameserver.com

Comments

Quick test of TCP between firewalls with Netcat

So sometimes I’m on a box and need to test if a port is cleared on a firewall.. i may not yet have apache installed but I want to test if port 80 is open, or I may want to act as a server to grab a request..

simple with Netcat.

nc -l -p 8080

will open a listen on port 8080 and after the first connect, exit and go back to shell… useful for testing

Comments

« Previous entries ·