Weblogs for nicc777
I recently wanted to check which servers on a large sub-net was listening on port 22/tcp.
Now nmap is obviously the tool to use, but the output was very long, and not all that clear. Here is a quick one liner I did, and maybe some one else can use this as well.
$ nmap -P0 -sT -p22 10.0.102.0/23 | perl -e 'while(<>){ chomp; push( @l, $_ ); } $lc = -1; foreach $t ( @l ) { $lc++; if( $t =~ /Interesting ports on (\d+\.\d+\.\d+\.\d+)/ ) { $ip = $1; $nlc = $lc + 2; if( $l[$nlc] =~ /open/ ) { print "IP: $ip\t\t$l[$nlc]\n"; } } }'
IP: 10.0.102.3 22/tcp open ssh
IP: 10.0.102.4 22/tcp open ssh
IP: 10.0.102.5 22/tcp open ssh
IP: 10.0.102.54 22/tcp open ssh
IP: 10.0.102.57 22/tcp open ssh
IP: 10.0.102.58 22/tcp open ssh
IP: 10.0.102.59 22/tcp open ssh
IP: 10.0.102.69 22/tcp open ssh
IP: 10.0.102.250 22/tcp open ssh
IP: 10.0.102.251 22/tcp open ssh
IP: 10.0.103.54 22/tcp open ssh
IP: 10.0.103.57 22/tcp open ssh
IP: 10.0.103.58 22/tcp open ssh
IP: 10.0.103.59 22/tcp open ssh
IP: 10.0.103.69 22/tcp open ssh
A while back I introduced myself, as well as one of the projectes that I am busy playing with. The project's name is LAMPAS, and is available from SourceForge.
I have just released version 0.005 which is now available for download.
This has been a great learning experience in Apache and mod_perl, and although I am still only scratching the surface, I am very happy with what I have learned. Although some have been advising against mod_perl on Apache 2.2.2, I have succesfully compiled the two packages and have not run into major problems yet, except that I can not yet seem to find an alternative to Apache::DBI but this is so far only a minor set-back. The Apache::DBI documentation notes that "Apache::DBI version 0.90_02 and later might work under mod_perl 2.0. See the Changes file for more information. Beware that it has only been tested very lightly." - so it seems I might be the tester for Apache 2.2.2 and mod_perl here :)
My build and testing steps are documented at the LAMPAS project page. Feel free to play around. LAMPAS 0.005 is based on this build, so I am not sure how it will behave on other builds.
I will now start to focus on building the actual management interface, so hopefully releases will become more frequent. One frustrating part for me was a combination of long delays with major redesign changes between the 0.004 and 0.005 release. It might not be that aparent once you poke around the directory structure, but belief me - I changed my mind a couple of times after reading some mod_perl documentation, getting advice and trying out stuff.
Well, that's it for now. BTW: Do you belief I should make Apache 2.2.2 and mod_perl available as .deb packages? Will anybody here be interested in these packages?
Cheers
I had some trouble installing VMWare WS 5.0.0 build 13124 on Dapper, but eventually got it up and running.
I have posted some notes about this on on my personal blog for those interested.
You can try this:
# cat /etc/passwd | perl -e 'while(<>){ chomp; @f=split(/:/,$_); if( ( $f[0] eq "root" ) || ( $f[2] > 999 ) ) { $c="crontab -l -u " . $f[0]; $r=`$c`; print "USER: ",$f[0],"\n----\n\n$r\n\n"; } }'
In general, excluding anything in a *bin* directory:
# find / -type f -ls | sort -k 7 -r -n | grep -v '/bin' | head
Then, to really only exclude executables:
# find / -type f -not -perm -g=x,-o=x -ls | sort -k 7 -r -n | headand obviously to check the largest executable files:
# find / -type f -perm -g=x,-o=x -ls | sort -k 7 -r -n | head
Have fun
I finally have some time to contribute again...
There are many tools to mirror a site, and the most common is almost certain to be wget(1). The problem with these programs - CLI or GUI - is all the options available. In my case, I rarely have to fidle with the options. So, I created a simple brain-dead wrapper script to quickly grab an mirrir a directory from a web server:
#!/bin/sh # mirror a site tool => ms.sh # - - # usage: # # ms.sh BASEDIR URL # # What this program will do is to create (mkdir) the 'basedir' and then # run 'wget' in a mirror mode to dump the site in that directory. After # the download is complete, the script will write the source URL in a # file called source.txt. # MKDIR=/bin/mkdir WGET=/usr/bin/wget ECHO=/bin/echo $MKDIR -p $1 cd $1 $WGET -t 0 -nc -c -x -nH -r -l 5 -k -p -L -np $2 $ECHO $2 > $1/source.txt $ECHO '\nOperation Completed...\n\n'
Have fun...
We have a number of Debian servers (100+), and we recently upgraded from woody to sarge. Problem is that we will go through that same routine in a year or so. It further seems that a distribution like Ubuntu aims at longer release cycles (around 5 years).
What are your thoughts on this - will it be better to go with a longer release cycle distro, or should I just bite the bullet and do a distro upgrade more frequently?
Any comments will be highly appreciated.
Thanks
Nico
This was rather interesting, but something I would like to add for us Debian admins is the start-stop-daemon(8).
With this little gem it is very easy to write your own startup scripts.
Here is my skeleton startup script:
#! /bin/sh
# /etc/init.d/jboss: start and stop the jboss daemon
SSD=/sbin/start-stop-daemon
ECHO=/bin/echo
TEST=/usr/bin/test
HOSTNAME=`/bin/hostname`
MYAPP=/path/to/app
MYAPPNAME=app
$TEST -x $MYAPP || exit 0
case "$1" in
start)
$ECHO -n "Starting $MYAPPNAME: $MYAPP"
$SSD -c myusername --start -b --quiet -p /var/run/app.pid -m --exec /path/to/app
$ECHO "."
;;
stop)
$ECHO -n "Stopping $MYAPPNAME: $MYAPP"
$SSD --stop -p /var/run/app.pid
$ECHO "."
;;
*)
$ECHO "Usage: /etc/init.d/$MYAPPNAME {start|stop)"
exit 1
esac
exit 0
Have fun.
Now that I have blown some steam, I can continue with the day :)
Anyway, I know the last couple of days have seen a lot of "virtual" based technologies, but in the blog entry I have once again touched on areas such as LTSP and OpenMosix for those interested.
BTW: Will OpenMosix work on several Xen systems running on the same hardware? I don't have the time right now to play with this, but it would be nice if some one can play with this idea. Could be a nice place to learn more about clustering in a cheap way perhaps?
Have a good one!
Nico