|
|
|
|
@ -1,23 +1,25 @@
|
|
|
|
|
######################################
|
|
|
|
|
# Virtual Vacation for Postfix Admin #
|
|
|
|
|
######################################
|
|
|
|
|
#
|
|
|
|
|
# Postfix Admin (Virtual Vacation)
|
|
|
|
|
# Originally authored by Mischa Peters <mischa at high5 dot net>
|
|
|
|
|
# Copyright (c) 2002 - 2005 High5!
|
|
|
|
|
# Licensed under GPL for more info check GPL-LICENSE.TXT
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
REQUIRED!
|
|
|
|
|
---------
|
|
|
|
|
# About Virtual Vacation
|
|
|
|
|
|
|
|
|
|
AKA 'An out of office' automated email response.
|
|
|
|
|
|
|
|
|
|
The vacation script runs as service within Postfix's master.cf configuration file.
|
|
|
|
|
Mail is sent to the vacation service via a transport table mapping.
|
|
|
|
|
When users mark themselves as away on vacation, an alias is added to their account
|
|
|
|
|
sending a copy of all mail to them to the vacation service.
|
|
|
|
|
|
|
|
|
|
e.g. mail to billy@goat.com will be delivered to
|
|
|
|
|
billy@goat.com AND
|
|
|
|
|
billy#goat.com@autoreply.goat.com
|
|
|
|
|
|
|
|
|
|
Mail to @autoreply.goat.com is caught by the vacation.pl script and a reply
|
|
|
|
|
will be sent based on various settings. By default a reply is only sent once.
|
|
|
|
|
|
|
|
|
|
# Dependencies / Requirements
|
|
|
|
|
|
|
|
|
|
There are a bunch of Perl modules which need installing, depending on your
|
|
|
|
|
distribution these may be available through your package management tool, or
|
|
|
|
|
will need installing through CPAN.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Perl dependencies
|
|
|
|
|
-----------------
|
|
|
|
|
|
|
|
|
|
Email::Valid
|
|
|
|
|
Email::Sender
|
|
|
|
|
Email::Simple
|
|
|
|
|
@ -34,35 +36,17 @@ You may install these via CPAN, or through your package tool.
|
|
|
|
|
CPAN: 'perl -MCPAN -e shell', then 'install Module::Whatever'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Debian Systems
|
|
|
|
|
|
|
|
|
|
On Debian based systems, you probably want these packages :
|
|
|
|
|
|
|
|
|
|
apt-get install libemail-sender-perl libemail-simple-perl libemail-valid-perl libtry-tiny-perl libdbd-pg-perl libmime-perl liblog-log4perl-perl liblog-dispatch-perl libgetopt-argvfile-perl libmime-charset-perl libmime-encwords-perl libmime-encwords-perl
|
|
|
|
|
|
|
|
|
|
and one of : libdbd-pg-perl or libdbd-mysql-perl
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Installing Virtual Vacation
|
|
|
|
|
|
|
|
|
|
About Virtual Vacation
|
|
|
|
|
----------------------
|
|
|
|
|
The vacation script runs as service within Postfix's master.cf configuration file.
|
|
|
|
|
Mail is sent to the vacation service via a transport table mapping.
|
|
|
|
|
When users mark themselves as away on vacation, an alias is added to their account
|
|
|
|
|
sending a copy of all mail to them to the vacation service.
|
|
|
|
|
|
|
|
|
|
e.g. mail to billy@goat.com will be delivered to
|
|
|
|
|
billy@goat.com AND
|
|
|
|
|
billy#goat.com@autoreply.goat.com
|
|
|
|
|
|
|
|
|
|
Mail to @autoreply.goat.com is caught by the vacation.pl script and a reply
|
|
|
|
|
will be sent based on various settings. By default a reply is only sent once.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Install Virtual Vacation
|
|
|
|
|
------------------------
|
|
|
|
|
|
|
|
|
|
1. Create a local account
|
|
|
|
|
-------------------------
|
|
|
|
|
## 1. Create a local account
|
|
|
|
|
|
|
|
|
|
Create a dedicated local user account called "vacation".
|
|
|
|
|
This user handles all potentially dangerous mail content - that is why it
|
|
|
|
|
@ -83,8 +67,7 @@ vacation:*:65501:65501:Virtual Vacation:/nonexistent:/sbin/nologin
|
|
|
|
|
vacation:*:65501:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2. Create a log directory or log file
|
|
|
|
|
-------------------------------------
|
|
|
|
|
## 2. Create a log directory or log file
|
|
|
|
|
|
|
|
|
|
If you want to log to a file ($log_to_file), create a log directory or an
|
|
|
|
|
empty log file.
|
|
|
|
|
@ -94,8 +77,7 @@ This file or directory needs to be writeable for the "vacation" user.
|
|
|
|
|
Note: If you are logging to syslog, you can skip this step.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3. Install vacation.pl
|
|
|
|
|
----------------------
|
|
|
|
|
## 3. Install vacation.pl
|
|
|
|
|
|
|
|
|
|
Create a directory /usr/lib/postfixadmin/ and copy the vacation.pl file to it:
|
|
|
|
|
|
|
|
|
|
@ -109,16 +91,16 @@ Which will then look something like:
|
|
|
|
|
-rwxr-x--- 1 root vacation 3356 Dec 21 00:00 vacation.pl*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4. Setup the transport type
|
|
|
|
|
---------------------------
|
|
|
|
|
## 4. Setup the transport type
|
|
|
|
|
|
|
|
|
|
Define the transport type in the Postfix master file:
|
|
|
|
|
|
|
|
|
|
#/etc/postfix/master.cf:
|
|
|
|
|
vacation unix - n n - - pipe
|
|
|
|
|
flags=Rq user=vacation argv=/usr/lib/postfixadmin/vacation.pl -f ${sender} -- ${recipient}
|
|
|
|
|
|
|
|
|
|
5. Setup the transport maps file
|
|
|
|
|
--------------------------------
|
|
|
|
|
|
|
|
|
|
## 5. Setup the transport maps file
|
|
|
|
|
|
|
|
|
|
Tell Postfix to use a transport maps file, so add the following to your
|
|
|
|
|
Postfix main.cf:
|
|
|
|
|
@ -141,10 +123,7 @@ Execute "postmap /etc/postfix/transport" to build the hashed database.
|
|
|
|
|
Execute "postfix reload" to complete the change.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6. Configure vacation.pl
|
|
|
|
|
------------------------
|
|
|
|
|
## 6. Configure vacation.pl
|
|
|
|
|
|
|
|
|
|
The perl vacation.pl script needs to know which database you are using, and also
|
|
|
|
|
how to connect to the database.
|
|
|
|
|
@ -173,8 +152,7 @@ b) create /etc/postfixadmin/vacation.conf and enter your settings there
|
|
|
|
|
$ chmod 640 /etc/postfixadmin/vacation.conf
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7. Check the alias expansion
|
|
|
|
|
----------------------------
|
|
|
|
|
## 7. Check the alias expansion
|
|
|
|
|
|
|
|
|
|
Depending on your setup, you may have multiple 'smtpd' service definitions within
|
|
|
|
|
your postfix master.cf file. This is especially the case if you are also using AMAVIS or
|
|
|
|
|
@ -206,34 +184,18 @@ smtp inet n - - - 12 smtpd
|
|
|
|
|
instead.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8. Security
|
|
|
|
|
-----------
|
|
|
|
|
## 8. Security
|
|
|
|
|
|
|
|
|
|
If security is an issue for you, read ../DOCUMENTS/Security.txt
|
|
|
|
|
|
|
|
|
|
# Postfixadmin
|
|
|
|
|
|
|
|
|
|
When this is all in place you need to have a look at the Postfix Admin
|
|
|
|
|
config.inc.php. Here you need to enable Virtual Vacation for the site.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
What do these files do?
|
|
|
|
|
-----------------------
|
|
|
|
|
When a user enables a vacation message on their account, the alias
|
|
|
|
|
definition is changed so that in addition to delivering to their own
|
|
|
|
|
mailbox, it also delivers to a dummy alias which calls the vacation.pl
|
|
|
|
|
program. In other words, if joeuser@domain.com enables their vacation, the
|
|
|
|
|
entry in the alias database table will deliver mail to
|
|
|
|
|
joeuser@something.com, as well as
|
|
|
|
|
joeuser#something.com@autoreply.yourdomain.com
|
|
|
|
|
|
|
|
|
|
vacation.pl then checks the database to see wether a user is on holiday and
|
|
|
|
|
what message to send back. Make sure that vacation.pl is able to communicate
|
|
|
|
|
to your database. You have to specify the database, username and password for
|
|
|
|
|
it as described in the "Configure vacation.pl" section.
|
|
|
|
|
|
|
|
|
|
NOTE: Make sure that the path to perl in vacation.pl is correct.
|
|
|
|
|
|
|
|
|
|
# Help ! It's not working
|
|
|
|
|
|
|
|
|
|
I'm in trouble!
|
|
|
|
|
---------------
|
|
|
|
|
When something is not working there are a couple of files that you can have
|
|
|
|
|
a look at. The most important one is your maillog (usually in /var/log/).
|
|
|
|
|
|
|
|
|
|
@ -241,7 +203,3 @@ Vacation.pl also has some debugging and logging capabilties. Check the top
|
|
|
|
|
of vacation.pl.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Done!
|
|
|
|
|
-----
|
|
|
|
|
When this is all in place you need to have a look at the Postfix Admin
|
|
|
|
|
config.inc.php. Here you need to enable Virtual Vacation for the site.
|
|
|
|
|
|