Blog O' Matty


No md5sum? Use OpenSSL!

This article was posted by Matty on 2005-01-28 00:13:00 -0400 -0400

I constantly find myself generating checksums, and for some reason each Operating System likes to implement their open message digest command ( if they provide one at all ). If your system is missing a digest command, you can use the openssl utility to generate one-time hashes. OpenSSL supports the SHA1, MD5 and RIPEMD160 algorithms, and accepts one or more files as arguments:

$ openssl md5 passwd<strong>
MD5(passwd)= eb1e5c787c3d85b9cf214c70c1095934

$ </strong>openssl sha1 passwd<em>
SHA1(passwd)= 1163c343091756010a77f95068aca4c4e360b932

$ openssl rmd160 passwd</em>
RIPEMD160(passwd)= c5c52bd8506740387691c4b0eb606ad0ffe778d6

$ openssl rmd160 passwd passwd /etc/services<em>
RIPEMD160(passwd)= c5c52bd8506740387691c4b0eb606ad0ffe778d6 RIPEMD160(passwd)= c5c52bd8506740387691c4b0eb606ad0ffe778d6 RIPEMD160(/etc/services)= c5c52bd8506740387691c4b0eb606ad0ffe778d6

$ cat passwd | openssl md5</em>
eb1e5c787c3d85b9cf214c70c1095934

The OpenSSL source code can be downloaded from the main OpenSSL website:

http://www.openssl.org/source/

Nifty Solaris fuser trick

This article was posted by Matty on 2005-01-26 00:11:00 -0400 -0400

I was reading through Planet Sun, and came across Pete Shanahan’s fuser trick. This trick can be used to get the process name of each PID accessing a file system:

$ ps -o pid,ppid,rss,args -p "(fuser / 2>/dev/null)"

PID PPID RSS COMMAND
0 0 0 sched
1 0 776 /etc/init -
2 0 0 pageout
3 0 0 fsflush
49 1 1376 /usr/lib/sysevent/syseventd
56 1 1904 /usr/lib/picl/picld
127 1 1136 /usr/sbin/inetd -s
229 1 816 /bin/sh /usr/local/mysql/bin/safe_mysqld --user=mysql --bind-address=127.0.0.1
165 1 696 /usr/lib/utmpd
250 1 1280 /usr/lib/ssh/sshd
18312 250 3224 /usr/lib/ssh/sshd
255 1 1160 /usr/lib/saf/ttymon -g -h -p winnie console login: -T sun -d /dev/console -l c
204 1 1824 /usr/sbin/mdmonitord
251 1 4064 /usr/local/openldap/libexec/slapd -f /usr/local/openldap-common/etc/slapd.conf
2001 1 1736 /usr/sbin/syslogd -t

Thanks for the awesome trick Pete!

Linux software RAID

This article was posted by Matty on 2005-01-23 00:16:00 -0400 -0400

I just noticed that my article titled Monitoring and Managing Linux Software RAID was posted to the SysAdmin website. This article provides an introduction to RAID (MD) support under Linux. I hope to blog about madm in a future post.

Managing OS X open source packages with fink

This article was posted by Matty on 2005-01-22 00:10:00 -0400 -0400

fink is an open source package manager for OS X. The fink command allows packages be be installed, removed, and updated relatively easily. As of this writing, there were 2048 open source packages available:

$ fink list | wc -l
2048

To get started with fink, you need to download the latest version from the sourceforge website:

http://fink.sourceforge.net/

Once you download the disk image, you need to run the fink installer. This will create the software directory hierarchy, and set a few variables in your profile. After fink is installed, you can run fink’s “selfupdate” option to grab the latest package list and binary fixes:

$ fink selfupdate

To list all of the available packges, fink can be run with the “list” option:

$ fink list | grep gnupg

gnupg 1.2.4-1 Gnu privacy guard - A Free PGP replacement
gnupg-idea 1.11-4 Gnu privacy guard (v 1.2.4) with IDEA cipher support

To install a specific package, the “install” option can be used:

$ fink install gnupg

This will download, compile and install gnupg under “/sw.” If you wish to remove an installed package, you can use the “purge” or “remove” options:

$ fink remove gnupg

Further information can be obtained by running fink with the “–help” option, or by reading through the documentation on the fink website.

Speeding up firefox

This article was posted by Matty on 2005-01-20 00:09:00 -0400 -0400

As a UNIX and network guy, I try to optimize systems and networks to deliver the most bang for the buck. I recently came across the following post on the Mozilla Zine web forums:

http://forums.mozillazine.org/viewtopic.php?t=53650

This link covers several tunables for Firefox, several of which can significantly speedup page load times (especially when you have a tabbed list of news sites):

network.http.max-connections: This value controls the maximum number of outbound TCP connections. network.http.max-connections accepts an integer value and defaults to 24.

network.http.max-connections-per-server: This value controls the number of concurrent requests to a single site. For sites that contains hundreds of URIs in a single page, this should speedup page load times (barring the remote site isn’t rate limiting inbound connections). network.http.max-connections-per-server accepts an integer value and defaults to 8.

network.http.max-persistent-connections-per-server && network.http.max-persistent-connections-per-proxy: These values control the number of persistent HTTP connections that can be maintainted to a website. Both parameters accept integer values and default to 2 and 4.

network.http.pipelining && network.http.proxy.pipelining: These values control the HTTP 1.1 pipelining feature, which allows multiple HTTP requests to be requested at connection setup. Both parameters accept boolean “true”/“false” values and default to “false.”

You can tweak these settings by typing “about:config” into the Firefox navigation toolbar, or by directly editing the user.js preferences file. I picked my current values by adjusting the current values, clearing the cache, and calculating the time it took Firefox to load 50 tabs. I was able to cut 14 seconds off my news site load time by doubling, and sometimes tripling the default values :)