This is a quick post showing how we used Chris Samuel’s vacation program to add quick auto-responder support to a mail set up on a CentOS box. Here’s the existing situation: we run a CentOS 5.8 box that provides alias services for email. In other words, it maps email@example.com to firstname.lastname@example.org. This is handled via text entries in the /etc/aliases file. Most users do not have a real account on the machine that hosts the aliases file.
We want to let our users know that a particular email address is no longer valid and can no longer be used. In this case, we want them to know that they cannot email “email@example.com” to request help with computer issues. We currently have elshelpdesk configured via the aliases file to forward to another account. That account fed our old help desk system, which we have just recently retired. Now that we are using a new help system, we need to let the users know that they will need to re-submit their request using another method.
In the old days, I would have used procmail for this task. However, Chris Samuel’s port of vacation looks like an easier approach to this. Here’s how we got it to work:
Install the gdbm development library (as root or using sudo): yum install gdbm-devel
Fetch the vacation software from Chris’s site and expand the archive:
$ tar xvfz vacation-18.104.22.168.tar.gz
Change into the directory and make one small change to the Makefile
$ cd vacation-22.214.171.124
Use your favorite editor to edit the Makefile). Locate line 48 and change it from:
MANDIR = $(PREFIX)/man/man
MANDIR = $(PREFIX)/share/man/man
This solves a tiny bug (at least for me) that prevents the manual pages from installing correctly. Now type “make” and “make install”. The program should compile cleanly and should install without errors.
Configuration and Usage
Our user is “virtual”. Our first requirement is to change the elshelpdesk user to be an actual user of the system. Create the elshelpdesk user (“adduser elshelpdesk”) and set the password to something secure. Remove or comment out the entry in /etc/aliases for elshelpdesk. Now become that user (from root, do “su – elshelpdesk”).
As “elshelpdesk”, type “vacation”. This will automatically configure a .forward file for this user and also launches the default editor (usually vi or vim) so that you can edit the message. If you don’t want to use vim, you can set the EDITOR environment variable to the name of another editor before you launch vacation. For example, if you would prefer to use nano rather than vim, do “export EDITOR=nano” before launching the vacation interactive session.
Once you’ve run “vacation”, it will remain active until you remove the file called .forward that is located in the home directory of the user. For more information, take a look at the vacation manual pages: “man vacation”.
Is there a better way or a different way to accomplish the same task on a CentOS machine? Let us hear from you in the comments.