1

Topic: [FAQ] How to dump disclaimer text from LDAP/MySQL automaticly.

Note

Signing disclaimer on outgoing mails is available in iRedMail/iRedOS-0.5.0 and later, users upgrade from 0.4.0 or even older versions can add this feature manually with steps explained in our Upgrade Tutorial (0.4.0 -> 0.5.0).
============

Note

============

iRedAdmin-v1.1.0+ ships python script used to dump disclaimer text from OpenLDAP server. Below is steps to use it:

  • Find script in iRedAdmin installation directory, default is /var/www/iredadmin/tools/dump_disclaimer.py

  • Open it and edit below variables

# -------------------------- Settings ------------------------------
# Directory used to store disclaimer files.
# Default directory is /etc/postfix/disclaimer/.
# Default disclaimer file name is [domain_name].txt
DISCLAIMER_DIR='/etc/postfix/disclaimer'    # NOT need to end with slash ('/').
DISCLAIMER_FILE_EXT='.txt'

# Debug: True, False
# WARNING:
#   * If set to True, cron daemon will send output message to root user.
DEBUG = False

# Backend used to store disclaimer: ldap, mysql. 
BACKEND='ldap'

############################################################
# LDAP Settings. Required if you use LDAP backend.
#
# LDAP server address.
LDAP_URI = 'ldap://127.0.0.1:389'

# LDAP base dn.
LDAP_BASEDN = 'o=domains,dc=iredmail,dc=org'

# LDAP bind dn & password.
# WARNING:
#   * Only READ permission is requied for dumping disclaimer text.
#   * Use 'cn=vmailadmin' or 'cn=Manager' is *NOT* recommended.
#   * 'cn=vmail' IS recommended.
# TIP:
#   You can find password for 'cn=vmail' in /etc/postfix/ldap_*.cf.
LDAP_BINDDN = 'cn=vmail,dc=iredmail,dc=org'
LDAP_BINDPW = 'WEx7NAeBV9WrAPbGpehyN2pwymvTe5'
  • Add one more crontab job for root user.

# crontab -e -u root
*/1   *   *   *   *   python /var/www/iredadmin/tools/dump_disclaimer.py

Note: Here we make it dump disclaimer every minute (*/1), you can change it to other interval you like, such as every 5 minutes (*/5), 30 minutes (*/30).

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2 (edited by k04l 2015-05-29 08:44:55)

Re: [FAQ] How to dump disclaimer text from LDAP/MySQL automaticly.

This is old, should be in Docs, since the dump_disclaimer.py gets settings from global config u only have to add a crontab to use after u enabled it in amavisd config. Test in console like this


Make Sure to enable disclaimer settings in /etc/amavisd.conf (RHEL/CentOS) or /etc/amavis/conf.d/50-user (Debian/Ubuntu)

python /opt/www/iredadmin/tools/dump_disclaimer.py /etc/postfix/disclaimer/

Output of file should be something like:


* [2015-05-28 21:37:34] Connecting to LDAP server
* [2015-05-28 21:37:34] Binding with dn: o=domains,dc=example,dc=at
* [2015-05-28 21:37:34] Searching accounts which have disclaimer configured
* [2015-05-28 21:37:34] Dumping ...
* [2015-05-28 21:37:34] - example.at -> [REMOVE] Unused disclaimer: /etc/postfix/disclaimer/example.at.{txt,html}.
* [2015-05-28 21:37:34] + mynewdomain.at -> /etc/postfix/disclaimer/mynewdomain.at.{txt,html}
* [2015-05-28 21:37:34] Total 1 domains.
* [2015-05-28 21:37:34] Connection closed.

Then add Lines to crontab

# iRedMail: Dump Disclaimer from iredadmin Webinterface to defined folder
*/5   *   *   *   *   python /opt/www/iredadmin/tools/dump_disclaimer.py /etc/postfix/disclaimer/