From 273f4f581db93ed239f9b412b8410ea65b8b11ea Mon Sep 17 00:00:00 2001 From: tonio Date: Mon, 14 Jun 2010 09:52:36 +0200 Subject: [PATCH] Ticket #62. --- COPYING | 2 +- INSTALL | 105 ++++++++++++------ README | 14 ++- .../scripts/upgrade_autoreply.py | 1 + settings_sample.py | 15 +++ 5 files changed, 100 insertions(+), 37 deletions(-) diff --git a/COPYING b/COPYING index 9ef7ecc00..e2f3d05f4 100644 --- a/COPYING +++ b/COPYING @@ -1,4 +1,4 @@ -Copyright (c) 2009, Antoine Nguyen +Copyright (c) 2009-2010, Antoine Nguyen Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above diff --git a/INSTALL b/INSTALL index 7e3ea7bd5..26db0b628 100644 --- a/INSTALL +++ b/INSTALL @@ -6,6 +6,7 @@ Requirements - Python version 2.6+ - Django version 1.0+ (http://docs.djangoproject.com/en/dev/intro/install/#intro-install) +- south version 0.7+ (http://south.aeracode.org/) How to install -------------- @@ -28,17 +29,23 @@ Settings file Initialise the database by running the following command:: - python manage.py syncdb + # python manage.py syncdb Create the super admin account (just follow the procedure). -Run the initialisation script. It will insert needed data into the database : +Since version 0.8, MailNG is using south to handle schema +migration. In order to finish the database creation, you must run the +first migration like this:: - export PYTHONPATH=$PWD/.. - DJANGO_SETTINGS_MODULE=mailng.settings ./scripts/populate.py + # python manage.py migrate How to upgrade -------------- + +First, decompress the new tarball at the same location than your +current installation. Then, check if the new version you're installing +required a migration:: + 0.7 -> 0.8 : SQL migration needed. south is needed to handle migrations. You will find instructions on @@ -59,10 +66,6 @@ INSTALLED_APPS. Then, run the following commands: 0.6 -> 0.7 : no SQL modifications. 0.5 -> 0.6 : no SQL modifications. -If no modifications have been made to the core SQL schema, juste -decompress the new tarball at the same location than your current -installation. - Time zone and language ---------------------- @@ -84,7 +87,7 @@ variable. For example:: Host configuration ------------------ -Before testing Mailng, you must create a group and a user that will be +Before testing MailNG, you must create a group and a user that will be used to store mails on the host filesystem. There is only one group/user needed because we are in a virtual hosting configuration (ie. users with non-UNIX accounts). @@ -106,12 +109,12 @@ file and add the following inside:: Testing installation -------------------- -As a typical Django application, Mailng can be tested using a simple web +As a typical Django application, MailNG can be tested using a simple web server. Just run this command to start it:: python manage.py runserver -You will be able to play with mailng by looking at +You will be able to play with MailNG by looking at http://:8000/mailng/admin/. Tips to link Mailng with postfix @@ -159,9 +162,9 @@ Then, use the following configuration in your /etc/postfix/main.cf file virtual_alias_maps = mysql:/etc/postfix/sql-aliases.cf # Stuff after -NB: Mailng supports both maildir and mbox formats. You can specify -which format to use by modifying the MAILBOX_TYPE variable located -inside 'settings.py'. +NB: MailNG supports both maildir and mbox formats. You can specify +which format to use by modifying the MAILBOX_TYPE parameter available +in the admin panel. Tips to activate auto-reply messages in Postifx ----------------------------------------------- @@ -173,9 +176,16 @@ line inside the INSTALLED_APPS variable:: 'mailng.extensions.postfix_autoreply', +Run the following command to activate the component:: + + # export PYTHONPATH=/.. + # DJANGO_SETTINGS_MODULE=mailng.settings \ + /scripts/extension.py postfix-autoreply on + Then run the following commands to update MailNG SQL schema and content:: # python manage.py syncdb + # python manage.py migrate postfix-autoreply # export PYTHONPATH=$PWD/.. # DJANGO_SETTINGS_MODULE=mailng.settings ./scripts/upgrade_autoreply.py @@ -214,7 +224,7 @@ of the directory where mailng is installed) NB: auto-reply messages are just sent one time per sender for a pre-defined time period. By default, this period is equal to 1 day (86400s), you can adjust this value by modifying the AUTOREPLY_TIMEOUT -variable located inside 'settings.py'. +parameter available in the admin panel. NB: Be sure that both 'autoreply' and 'autoreply.py' scripts (located inside the 'scripts' directory) have good permissions (ie. 0755). @@ -345,9 +355,11 @@ line inside the INSTALLED_APPS variable:: 'mailng.extensions.amavis_quarantine', -Just run the following command to update MailNG SQL schema:: +Then run the following command to activate the component:: - # python manage.py syncdb + # export PYTHONPATH=/.. + # DJANGO_SETTINGS_MODULE=mailng.settings \ + /scripts/extension.py amavis-quarantine on Then, you need to specify where is the database that contains the quarantine. Inside settings.py, add a new connection to the @@ -364,12 +376,6 @@ DB_CONNECTIONS variable like this:: Replace values between <> with yours. -Finally, create a symbolic link to the templates directory inside the -main templates directory:: - - # ln -s /extensions/amavis_quarantine/templates \ - templates/amavis_quarantine - When viewing messages, you can choose to display links (addresses, images). In order to display images correctly, you need to create a tmp directory under static/ for storing them. For example:: @@ -401,7 +407,7 @@ Don't forget to update the inet_acl list if you plan to release from the network. Once amavisd-new is configured, just tell MailNG where it can find the -"release server" by modifying following variables inside settings.py:: +"release server" by modifying following parameters in the admin panel:: # "unix" or "inet" AM_PDP_MODE = "inet" @@ -444,14 +450,13 @@ line inside the INSTALLED_APPS variable:: 'mailng.extensions.stats', -Create a symbolic link to the templates directory inside the main -templates directory:: +Then run the following command to activate the component:: + + # export PYTHONPATH=/.. + # DJANGO_SETTINGS_MODULE=mailng.settings \ + /scripts/extension.py stats on - # ln -s /extensions/stats/templates \ - templates/stats - -Then, adapt following parameters (still in settings.py) to your -environnement:: +Then, adapt the following parameters to your environnement:: # Path to mail log file LOGFILE = "/var/log/mail.log" @@ -477,4 +482,40 @@ crontab:: Replace mailng_dir with the installation path of MailNG. -Graphics are automatically created after each new parsing. \ No newline at end of file +Graphics are automatically created after each new parsing. + +Using the webmail component +--------------------------- + +MailNG provides a simple webmail component (you can browse, read and +compose messages). With this feature, it is possible to deploy an almost +standalone emails platform just with MailNG. + +The following requirements are needed before going further:: + +- lxml python module (http://codespeak.net/lxml/) +- pycrypto python module (http://www.dlitz.net/software/pycrypto/) + +Just run the following command to activate the component:: + + # export PYTHONPATH=/.. + # DJANGO_SETTINGS_MODULE=mailng.settings \ + /scripts/extension.py webmail on + +Next, go to the admin panel and modify the following parameters in +order to communicate with your IMAP and SMTP servers:: + + IMAP_SECURED = no + IMAP_SERVER = 127.0.0.1 + IMAP_PORT = 143 + + SMTP_SECURED = no + SMTP_AUTHENTICATION = no + SMTP_SERVER = 127.0.0.1 + SMTP_PORT = 25 + +Last but not least, modify the SECRET_KEY parameter and choose a new +value (exactly 16 characters). This key is really important, it is +used to encrypt/decrypt user passwords stored inside sessions. + +Do not communicate this key to anyone!! \ No newline at end of file diff --git a/README b/README index 8c55b2e89..3ec700bdc 100644 --- a/README +++ b/README @@ -3,10 +3,16 @@ facilitate virtual domains hosting. It is designed to be integrated with email servers like postfix (http://www.postfix.org/) and/or dovecot (http://www.dovecot.org/). -For now, only the administration component is available. Additional tools will -come in a near future. +Available components: + * Administration panel, + * Amavisd-new quarantine manager, + * Postfix auto-reply component, + * Graphical statistics about emails traffic, + * webmail. Django is needed to use Mailng (http://www.djangoproject.com/) -Mootools version 1.2 (http://www.mootools.net/) and SqueezeBox version 1.1 -(http://digitarald.de/project/squeezebox/) are provided with Mailng. +The following external tools are provided with MailNG: + * Mootools version 1.2+ (http://www.mootools.net/), + * SqueezeBox version 1.1+ (http://digitarald.de/project/squeezebox/), + * Calendar (http://electricprism.com/aeron/calendar/) diff --git a/extensions/postfix_autoreply/scripts/upgrade_autoreply.py b/extensions/postfix_autoreply/scripts/upgrade_autoreply.py index d532640bf..c7ee734c2 100755 --- a/extensions/postfix_autoreply/scripts/upgrade_autoreply.py +++ b/extensions/postfix_autoreply/scripts/upgrade_autoreply.py @@ -9,6 +9,7 @@ if __name__ == "__main__": import mailng.extensions.postfix_autoreply.main as par from mailng.extensions.postfix_autoreply.models import Transport, Alias + par.init() doms = Domain.objects.all() for dom in doms: try: diff --git a/settings_sample.py b/settings_sample.py index db4be5c68..7d6aa3fa9 100644 --- a/settings_sample.py +++ b/settings_sample.py @@ -82,6 +82,8 @@ INSTALLED_APPS = ( 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', + 'south', + 'mailng', 'mailng.lib', 'mailng.admin', 'mailng.userprefs', @@ -95,3 +97,16 @@ AUTHENTICATION_BACKENDS = ( 'mailng.lib.authbackends.SimpleBackend' ) +# Amavis quarantine +# DB_CONNECTIONS = ( +# {"amavis_quarantine" : {"driver" : "", +# "host" : "", +# "dbname" : "", +# "login" : "", +# "password" : ""} +# } +# ) + + +#SESSION_COOKIE_AGE = 300 +#CACHE_BACKEND = 'file://'