Monday, June 23, 2008

sshfs - mount a filesystem when you only have ssh access

sshfs is one of the most useful tools I've found recently. Basically it allows you to mount a filesystem, let's say your home directory, on a remote machine, just by using ssh. It uses FUSE and sftp in the background, but you don't need to worry about that. If you can ssh, you can mount the remote filesystem.

By default it only allows root to mount, but all you have to do is add yourself to the "fuse" group and re-login(or sudo -yourloginid if you're lazy or don't want to lose all your windows) and you can start using it:
mount remotemachine:/your/home/directory /local/mount/point

to unmount it just do:
fusermount -u /local/mount/point

It's excellent when you don't have NFS/samba available.

Wednesday, June 11, 2008

Want a better "top", try atop

I was recently looking for a utility that could record cpu, memory, and load usage on a per-process basis over a specified period of time. "top" itself has a -p flag, that lets you watch a single process, but no way to record to a logfile that I could find. Other utilities, like sar are system-wide, instead of process-specific. I was ready to write a script, when I found atop.

Atop can work like top or sar(if used with atopsar binary), but unlike either of these, it has heaps of flexibility, including being able to write to a logfile. It also has color highlighting, so that you can define when the CPU reaches a certain threshold, that it should turn red. It can write an ASCII logfile with timestamps based on the intervals you define, and it lists the system state, along with the process state that you've chosen.

Try this simple .atoprc to watch firefox's activity at 5 minute intervals:
interval 5
procname firefox

Then just run it with "atop -M > your_log_file" and let it's do it's magic. This produces human-readable format but if you want something that's easily parseable(ie. tab separated data, check out the -P flag.

Tuxpaint--Brilliant painting program for kids

I recently read about TuxPaint on Newsforge, and since I'm always on the lookout for programs that my little daughter can play with, I was keen to check it out. I was definitely impressed!

It has a very simple and intuitive interface, lots of fun brush shapes(heart, star, flower etc) with a color palette on the bottom. It's easy to change the size of the brush. Then you have your basic set of shapes, but the thing that makes the program very unique is the stamps.

There are heaps of stamps. At first I only noticed the first set(animals), but there are 34 pages of shapes within a wide range of categories. These include, fruits and veggies, coins, letters and smilies, planets, cars and traffic signs, musical instruments, sports equipment, and even holiday-specific icons. And again the stamps are easily resized, and some allow you to change their colors. Very cool!

In addition to the above there are the "Magic" tools which are some of the usual photo retouching tools, with some creative ones(like sparkles) that again make it fun for kids. Even saving and opening is extremely easy. The dialogs only ask "yes" or "no" and are simple visual representations. I wish other programs designed for kids (for example Potato Guy) used similar dialogs.

So in conclusion, if you have kids try Tuxpaint. You won't be disappointed.
-T

Monday, June 2, 2008

Goosh-the CLI interface to google(web based!)

Like to use the command line? Want to have your recent searches all visible on an easy to read page.

http://www.goosh.org


Even does images (i ), and you can tell it to search blogs(b ). Press "h" for the full list. "addengine" adds it to the firefox search bar. Very cool!
-T

Thursday, May 29, 2008

Screen, Fruity and Nikto

These are the latest applications I've found extremely useful.

GNU Screen- Terminal multiplexer with ability to detach and reattach a session
Useful when:
  • You want to be sure that a terminal program you started on a server keeps running even if you lose your ssh session
  • You want to leave a terminal program and resume it exactly where you left off.
  • You want multiple sessions within single window. Many other terminals do this, but screen will do it even when there's no GUI(like from the console)
Quickstart:
Start it: screen or screen yourprogram
Detach it: Ctrl-a d
Reattach it: screen -r -d

The beauty of it is, that you can do the reattach from a different computer logging in from an entirely different ssh session. And even if your ssh session dies, you can reconnect and reattach it. That's brilliant! There's lots more cool things you can do with screen. To have multiple terminals within one, do "Ctrl-a C" to create a new window, and Ctrl-A (or Ctrl-a n) to switch to the next window. And yes, when you detach all those windows will stay there.

Fruity- Web-based Nagios configuration tool. (nagios2 only)
Useful when:

  • Your nagios configs are not setup in a logical concise way-this often happens if you start small and add over time.
  • You're not taking advantage of the advanced features of config file modularity, such as separate client/site directories, services, or even service groups applied per hostgroup, or templates.
  • You want a powerful tool, that will easily let you organize and maintain your nagios config file.
Quickstart:
  • Generally you want to install fruity on the same machine that you have Nagios2 on. If that's a production box, then you can tar up /etc/nagios2 and untar it on the test box where you install Fruity on.
  • untar and unzip(tar -zxvf) the source file and move the directory to your Apache DocumentRoot(mv fruity1.0-rc2 /var/www/fruity )
  • Import the DB schema(mysql -u root -p < /var/www/fruity/sqldata/fruity.sql
  • The web interface(ie. http://localhost/fruity) should now "just work". It won't automatically import your configs, nor will it change the actual config files when you make changes. These are done via import and export tabs.
Nikto - Nikto is an HTTP security scanner. It will scan for common files and directories which may reveal versions of not just Apache, but PHP and even MySQL.
Useful when: You want to secure your website against fingerprinting and ensure that nothing more is revealed than necessary.

Quickstart:
Nikto is a perl script, so after you unzip/tar the source, you just run it:
nikto.pl -host yourtargetwebsite

It takes quite a while to run(took about 20min for the site I tried), but it gives you lots of very useful information, and presents it in a concise way. I have yet to figure out how to run it on an SSL(https) website.


Wednesday, May 28, 2008

Starting by Popular Request

I've been a *nix sysadmin for 8 years now. Damn, has it been that long? :)

Along the way I've learned a lot, and continue to learn and discover new tools that make my life easier.

I'm a devout fan of Open Source Software and have discovered, that you can find virtually any open source tool that rivals or exceeds its commercial equivalent. Network security and testing is another one of my main interests, which often overlaps with the above, so hopefully I can mesh the two.

On the same premise, I love to share information which I find with my colleagues. Since they're probably getting tired of me spamming that with that information, I decided to start this blog. Let's hope I have time to update it, and that others find it useful.