Skip to content

luisbosque/simple_vacation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This code is still in development process.
It's not suitable for production use.
You can use it at your own risk.

Description
===========
This is a server-side script. It checks in real time if a person is on vacation, and if so, the script
sends an automatic reply to the remitent with a user custom message.

It fetchs all this information from a LDAP server. If a user wants to activate this feature, he has to 
activate the vacationActive and vacationInfo attributes in the LDAP tree where his user information is stored.

It is intended to be a gnarwl alternative. It's easier to use and to hack.

Requirements
============
* Postfix MTA
* OpenLDAP with the ISPEnv2 schema
* Python >= 2.4

Installation and Setup
======================
This script is supposed to work in with any open source MTA (Postfix, qmail, exim, ...).
Right now is only tested in conjunction with Postfix.  I appreciate any kind of feedback about the use with other MTAs.

First of all you have to copy the entire simple_vacation folder in any path on your server (ex. /usr/local/simple_vacation)
You can clone directly the repo in the desired path:
  
    git clone git://github.com/lbosque/simple_vacation.git /usr/local/simple_vacation


* Postfix

There are a few options to use this script with Postfix. I use the recipient_bcc_maps configuration parameter that sends a BCC to any email address listed in the table.
In case you want to activate this feature for every incoming email you can use the always_bcc parameter if you prefer.
Here is an example of use of recipient_bcc_maps (main.cf):
  
    recipient_bcc_maps = hash:/etc/postfix/recipients_maps

With this paraameter, postfix knows that it has to compare compare every incoming email against the recipient_maps table.
This is an example of this table:

    @example.com      vacation@localhost

With the above table, every email sent to an example.com address (supossely hosted in your server), postfix will create a bcc to the vacation@localhost address. So, here you have two options. One of them is create a vacation system user with a .forward file in his home path. The other, is to add a postfix transport table like the next one:

    vacation@localhost     vacation:localhost

We are going to store this table, for example, in  /etc/postfix/transport so we need to write the next configuration line in oir main.cf:

    transport_maps = hash:/etc/postfix/transport

Now, we have to define this transport behaviour. We can do this in the master.cf configuration file:

    vacation   unix  -       n       n       -       -       pipe
      user=vmail argv=/usr/local/simple_vacation/bin/vacation.py

This tells postfix that every email sent to the vacation transport (vacation:localhost) has to be redirected to the /usr/local/simple_vacation/bin/vacation.py program stdin with a pipe and it has to be executed by the vmail user. You can choose any user you want but postfix user, that is not allowed. In this case, it's necessary to do change some permissions to simple_vacation directory:

    chown vmail:root /usr/local/simple_vacation -R
    chmod ug+x /usr/loval/simple_vacation/bin/vacation.py 


Old vacation cleaning
=====================
It's necessary to clean the emails address registry every time a person come back from vacations. To do this, we can put in cron the chech_people_on_vacation.py script. This scripts, read all email registries and check if these emails are still on vacation. If it is, it remove this email registry, so there is a new fresh start next time this person go away on vacation.
This script also read some configuration parameters from the same configuration file than the main vacation script.


Comments
========
This README and the script itself are work in progress. For any doubts you can mail me to luisico AT gmail DOT com

About

Script to auto respond emails to people on vacation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages