ONLamp.com
oreilly.comSafari Books Online.Conferences.

advertisement


FreeBSD Bag of Tricks

by Dru Lavigne, author of BSD Hacks
09/23/2004

As a software junkie, I'm always coming across new programs to experiment with. As I find programs I like, I add them to my mental bag of tricks so they're ready whenever a client asks, "What's the best program to do x?" In this article, I'll demonstrate how I used an old favorite as a lightweight webmail program as well as a new favorite I just ran across.

Webmail with Usermin

On one of my routine visits to a network I administer, the owner mentioned he was thinking of adding webmail functionality. Since he had only a dozen or so users, he didn't want anything too complicated, just a small program with which people could check their mail while away from the office. If he had to, he could take the time to write and test a few scripts himself, but he preferred not to spend his time reinventing the wheel.

We went to the Mail section of FreeBSD's ports collection to see the available options. Things looked hopeful, as more than half a dozen webmail programs were there. We took a closer look at each program to see which best suited his particular network. A few required Apache 1.x and wouldn't work with his server running Apache 2.x. Still others needed an IMAP server. His server has happily run popa3d for the past few years, and he was hesitant to learn, install, and test an IMAP server on a production system. (I know IMAP4 is more secure than POP3; I also know better than to tempt the network gods by replacing working software with something "better.") This narrowed our choices down to two applications.

We looked at the smaller application, but the owner didn't like the interface. The larger one's interface looked quite nice, judging from the web site's screenshots, so we agreed to install the application on a test system to see how easy it was to configure. That was when the fun began.

The install itself resulted in hundreds of SUID scripts, which started my heart going. Even the owner couldn't believe how big the program was. We then started wading through reams of documentation, soon followed by scouring the Internet for error messages when the scripts refused to run. After a couple of hours of this, the owner teetered between "Why did I even want a webmail program?" and "Forget this, let's try that IMAP thing."

That's when I began to mentally scan through my toolkit. I've used Webmin on many an occasion to check email as an administrator. I like Webmin so much, I wrote about it in An Introduction to Webmin. Obviously Webmin wouldn't help here, as it's a remote administration tool. However, Webmin does have a user equivalent--called, not surprisingly, Usermin.

Installing Usermin

While the owner took a break, I did this:

# cd /usr/ports/sysutils/usermin
# make install clean

When the install finished, I followed the instructions left by the pkg-message:

# /usr/local/lib/usermin/setup.sh
 ***********************************************************************
 *            Welcome to the Usermin setup script, version 1.080       *
 ***********************************************************************
 Usermin is a web-based interface that allows Unix-like operating
 systems and common Unix services to be easily administered.
 Installing Usermin in /usr/local/lib/usermin ...
 ***********************************************************************
 Usermin uses separate directories for configuration files and log files.
 Unless you want to run multiple versions of Usermin at the same time
 you can just accept the defaults.

 Config file directory [/usr/local/etc/usermin]: 
 Log file directory [/var/log/usermin]: 
 
 ***********************************************************************
 Usermin is written entirely in Perl. Please enter the full path to the
 Perl 5 interpreter on your system.
 Full path to perl (default /usr/bin/perl): 
 Testing Perl ...
 Perl seems to be installed ok
 ***********************************************************************
 Operating system name:    FreeBSD
 Operating system version: 5.2
 ***********************************************************************
 Usermin uses its own password protected web server to provide access
 to the administration programs. The setup script needs to know :
 - What port to run the web server on. There must not be another
   web server already using this port.
 - If the webserver should use SSL (if your system supports it).
 Web server port (default 20000): 8080
 Use SSL (y/n): y
 ***********************************************************************
 Creating web server config files..
 ..done
 Attempting to start Usermin mini web server..
 ..done
 ***********************************************************************
 Usermin has been installed and started successfully. Use your web
 browser to go to

  https://dru.domain.org:8080/

 and login as any Unix user on your system.

 Because Usermin uses SSL for encryption only, the certificate
 it uses is not signed by one of the recognized CAs such as
 Verisign. When you first connect to the Usermin server, your
 browser will ask you if you want to accept the certificate
 presented, as it does not recognize the CA. Say yes.

Note that I chose a random port of 8080, which users must specify in their browser in order to connect. Since I also chose SSL, users must use https in their URL. They will have the added bonus of encrypted connections, so accessing their mail with Usermin will be more secure than doing so with a POP3 client.

Note that while this particular client had an Apache web server, that's not a requirement in order to use Webmin or Usermin.

Before configuring Usermin, I also added this line to /etc/rc.conf:

usermin_enable="YES"

to ensure that Usermin will restart should the system ever reboot.

Pages: 1, 2

Next Pagearrow





Sponsored by: