-
-
Notifications
You must be signed in to change notification settings - Fork 3
login_tasks.3
login_tasks - perform set of important tasks on login
#include <indimail.h>
int login_tasks(pw, user, service_type);
struct passwd *pw;
const char *user;
char *service_type;
login_tasks(3) api carries out a set of instructions. login_tasks(3) is called by IndiMail(7) authentication modules for POP3 and IMAP. They carry out the following steps in the order given below
The first step login_tasks(3) does is to create user's home directory. It is not neccssary for a user to have a home directory during user creation (e.g. '-d' option not specified when running vadduser(1)). The directory gets created automatically when the user logs in successfully using IMAP or POP3. Also, a user may not have a home directory if inactivated by vmoduser(1) or vdelolduser(8) programs. If a user is inactive, login_tasks(3) makes the user active on successful authentication.
login_tasks(3) copies any bulletins present in bulk_mail directory to the user's Maildir. You can change the name of this directory by seting BULK_MAILDIR environment variable. When a user is being activated, login_tasks(3) checks for the bulletin activatemail.txt. You can change this filename by defining ACTIVATEMAIL environment variable. For a new user, login_tasks(3) copies the bulletin welcomemail.txt,all. WELCOMEMAIL environment variable can be used to use a different filename. ACTIVATEMAIL and WELCOMEMAIL environment variables should refer to a filename in the directory /var/indimail/domain_name/bulk_mail.
If NOLASTAUTH environment variable is defined, login_tasks(3) exits after copying bulletins. If not defined, further actions as described below are performed
An entry is made in the MySQL RELAY table. This enables the POP/IMAP before SMTP feature, allowing a user to use SMTP relay (from the same IP address) to succeeed for a period of RELAY_CLEAR_MINUTES minutes after a successful IMAP/POP3 authentication. (see clearopensmtp(8)).
If MIN_LOGIN_INTERVAL environment variable is defined login_tasks(3) exits if time interval equal to MIN_LOGIN_INTERVAL seconds has not elapsed since the last successful authentication. You can use MIN_LOGIN_INTERVAL to control brain-dead applications like MS Outlook and family.
login_tasks(3) puts an entry in the lastauth MySQL table, recording the IP address from which the IMAP/POP3 access has occurred, the timestamp and the service (POP3 or IMAP).
If POSTAUTH environment variable is defined, login_tasks(3) will execuate the script/program defined by the POSTAUTH environment variable
If the program/script /usr/local/bin/migrateuser is present, login_tasks(3) executes the program/script just once. If the program/script exits with non-zero status, it will be executed again till the next successful IMAP/POP3 authentication. You can change the path to the migrateuser program by defining MIGRATEUSER environment variable. login_tasks(3) uses a filename as a flag to execute the migrateuser program just once. By default this flag Qmail.txt is created in the user's Maildir after successful execution of the migrateuser program. If this file already exists, then execution of migrateuser program is skipped. You can chose A different filename by setting MIGRATEFLAG environment variable.
login_tasks(3) also arranges for bulletins to be copied to the user's Maildir. Bulletins are email messages that can be deposited instantly in the user's home directory without injecting a mail. You can create bulletins using the vbulletin(1) program. Bulletings is a good way to communicate with all users or a large number of users instantly. Bulletins are instant and do not involve any queuing. Bulletins are available to all users (regardless of the number of users) the instant they are created. See the section on Bulletins below.
If the user is overquota, an overquota warning mail is sent. Site administrators can customize Over Quota Bounce messages, by setting environment variables QUOTAWARN1, QUOTAWARN2 ... upto QUOTAWARN10. These variables should be set to a percentage quota usage for which warning should be sent. If BOUNCE flag has been set (by vdelivermail(8)) for the user and the user currently is not overquota, login_tasks(3) removes the BOUNCE flag (pw_gid field).
You can create a bulletin by creating RFC 822 formated files in the directory /var/indimail/domain_name/bulk_mail where domain_name is a name for a virtual domain created by the vadddomain(1) program.
If the filename has the extension ,all then the bulletin gets copied to every user's Maildir on successful login. To prevent multiple copies of the same bulletin getting copied to user's Maildir, the copy happens only for the first successful authentication.
If you want bulletins to be sent to specific users, then you should have the filename without the ,all extension. The specific users need to be inserted into the MySQL table bulkmail. You need to insert data for the emailid and filename columns. You can automate the creation of bulletins by using the vbulletin(1) program.
vadddomain(1), vmoduser(1), vdeloldusers(1) imapd(8), pop3d(8), proxyimap(8), proxypop3(8), vdelivermail(8), clearopensmtp(8), authlib(7), vchkpass(8), vbulletin(1),