0
0
mirror of https://github.com/postfixadmin/postfixadmin.git synced 2024-09-19 19:22:14 +02:00
postfixadmin/DOCUMENTS
2021-01-12 22:05:48 +00:00
..
screenshots screenshots: adding 2007-09-25 19:54:03 +00:00
BACKUP_MX.txt INSTALL.txt, UPGRADE.txt: 2009-05-31 20:31:04 +00:00
DOVECOT.txt Fixed linebreak typo in user_query SQL 2020-12-25 10:44:03 +05:30
FAQ.txt FAQ.txt: updating 2009-01-21 13:47:04 +00:00
HASHING.md some initial documentation on password hashing for Postfixadmin, probably incomplete, probably contains errors but may be better than nothing 2021-01-12 22:05:48 +00:00
HORDE.txt file extensions should be lower case ;) 2007-11-14 21:43:02 +00:00
LANGUAGE.txt LANGUAGE.txt: 2008-04-11 22:53:31 +00:00
POSTFIX_CONF.txt POSTFIX_CONF.txt: Add transport map support 2019-12-29 16:59:28 +01:00
Postfix-Dovecot-Postgresql-Example.md Update Postfix-Dovecot-Postgresql-Example.md 2020-09-23 11:55:57 +01:00
POSTFIXADMIN.txt DOCUMENTS/POSTFIXADMIN.txt: updated 2008-04-26 21:01:13 +00:00
README.password_expiration move into DOCUMENTS 2018-12-28 19:20:40 +00:00
SECURITY.txt SUPERADMIN.txt: 2011-07-31 23:15:41 +00:00
SUPERADMIN.txt SUPERADMIN.txt: 2011-07-31 23:15:41 +00:00
UPGRADE.txt Fix instructions for templates_c directory in UPGRADE.txt 2018-01-13 18:18:10 +01:00

*Description

This extension adds support for password expiration.
It is designed to have expiration on users passwords. An email is sent when the password is expiring in 30 days, then 14 days, then 7 days.
It is strongly inspired by https://abridge2devnull.com/posts/2014/09/29/dovecot-user-password-expiration-notifications-updated-4122015/, and adapted to fit with Postfix Admin & Roundcube's password plugin
Expiration unit is day
Expiration value for domain is set through Postfix Admin GUI

*Installation

Perform the following changes:

**Changes in MySQL/MariaDB mailbox table (as defined in $CONF['database_tables'] from config.inc.php):

You are invited to backup your DB first, and ensure the table name is correct.

Execute the attached SQL script (password_expiration.sql) that will add the required columns. The expiration value for existing users will be set to 90 days. If you want a different value, edit line 2 in the script and replace 90 by the required value.

**Changes in Postfix Admin :

To enable password expiration, add the following to your config.inc.php file:
$CONF['password_expiration'] = 'YES';

All my tests are performed using $CONF['encrypt'] = 'md5crypt';

**If you are using Roundcube's password plugin, you should also adapt the $config['password_query'] value.

I recommend to use:

$config['password_query'] = 'UPDATE mailbox SET password=%c, modified = now(), password_expiry = now() + interval 90 day';

of cource you may adapt to the expected expiration value

All my tests are performed using $config['password_algorithm'] = 'md5-crypt';

**Changes in Dovecot (adapt if you use another LDA)

Edit dovecot-mysql.conf file, and replace the user_query (and only this one) by this query:

password_query = SELECT username as user, password, concat('/var/vmail/', maildir) as userdb_var, concat('maildir:/var/vmail/', maildir) as userdb_mail, 20001 as userdb_uid, 20001 as userdb_gid, m.domain FROM mailbox m, domain d where d.domain = m.domain and m.username = '%u' AND m.active = '1' AND (m.password_expiry > now() or d.password_expiry = 0)

Of course you may require to adapt the uid, gid, maildir and table to your setup

**Changes in system

You need to have a script running on a daily basis to check password expiration and send emails 30, 14 and 7 days before password expiration (script attached: check_mailpass_expiration.sh).
Edit the script to adapt the variables to your setup.
This script is using postfixadmin.my.cnf to read credentials. Edit this file to enter a DB user that is allowed to access (read-write) your database. This file should be protected from any user (chmod 400).