Code Monkey home page Code Monkey logo

modoboa-amavis's Introduction

modoboa-amavis

gha codecov

The amavis frontend of Modoboa.

Installation

Install this extension system-wide or inside a virtual environment by running the following command:

$ pip install modoboa-amavis

Edit the settings.py file of your modoboa instance and add modoboa_amavis inside the MODOBOA_APPS variable like this:

MODOBOA_APPS = (
    'modoboa',
    'modoboa.core',
    'modoboa.lib',
    'modoboa.admin',
    'modoboa.relaydomains',
    'modoboa.limits',
    'modoboa.parameters',
    # Extensions here
    # ...
    'modoboa_amavis',
)

Then, add the following at the end of the file:

from modoboa_amavis import settings as modoboa_amavis_settings
modoboa_amavis_settings.apply(globals())

Run the following commands to setup the database tables:

$ cd <modoboa_instance_dir>
$ python manage.py migrate
$ python manage.py collectstatic
$ python manage.py load_initial_data

Finally, restart the python process running modoboa (uwsgi, gunicorn, apache, whatever).

Note

Notice that if you dont configure amavis and its database, Modoboa won't work. Check docs/setup for more information.

modoboa-amavis's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar disko avatar evilham avatar spitfireap avatar tonioo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

modoboa-amavis's Issues

How can I mark false-negative spams?

Hi there!

I'm using modoboa for a week (nice job 👍 !) and I'm trying to get amavis/spamassassin couple to work. I've installed modoboa and its extensions with the modoboa-installer on a PGSQL DB, without any problem (except that the spamassasin DB was empty, due to the lack of the sql file in the filesystem, not sure why… I've fixed it manually).

Now my problem is that I have a lot of spams, and they pass the spamassassin filter, so I want to mark them manually to let spamassassin learn about. Unfortunately, I can't see any clean message in the quarantine. I can see, say, Banned messages, and mark them as spam successfully, but how can I get the clean messages to mark them too?

Or is there anything that I misunderstand/misuse in the false-negative spam tagging process?

Thanks!

Feature req.: Per user/group self-service

Hello,

would it be possible to have a kind of rights management for the self-service/release of messages on a per user/group basis?

For example: user A should be able to self-service himself and or release his quarantined mails, but user B not. (Or users in a specific group)

That would be nice to have.

-Paul

Reminder email support

From @tonioo on December 4, 2013 15:26

Originally created by Antoine Nguyen on 2011-04-21T13:36:32Z

Add the possibility to automatically send reminder emails to users who have messages in the quarantine. Some technical precisions:

  • This feature will controlled from the admin panel. If activated, it will install a new entry in the crontab,
  • Predefined frequencies will be available (daily, weekly, etc...),
  • Emails could be sent to three targets :
    • Admins,
    • Domain Admins,
    • Users
  • Permissions must be updated to allow this.

A reminder will contain the following information:

  • The current total number of quarantined emails for the targeted user/domain (function of the choosen level), or a per-domain list if the message is sent to a super administrator,
  • The list of the last N quarantined messages (N will be customizable from the admin panel).

Messages will be in plain/text format and available in all supported languages.

Copied from original issue: modoboa/modoboa#147

Full policy editor

From @tonioo on December 4, 2013 15:44

Originally created by Antoine Nguyen on 2012-10-21T09:33:54Z

Add a complete policy editor:

  • Possibility to define all policy fields
  • Possibility to assign a policy to a domain

Copied from original issue: modoboa/modoboa#320

amavis extension does not manage policies in a way compatible with amavisd-new's own documentation

From @tonioo on December 4, 2013 15:44

Originally created by Louis-Dominique Dubeau on 2012-09-06T12:34:53Z

Modoboa version: 0.9.2
Amavisd-new version: 2.7.1

The documentation regarding SQL usage provided with amavisd-new suggests that multiple records in the users table should point to the same record in the policy table. Said documentation is here:

http://www.ijs.si/software/amavisd/README.sql-mysql.txt

Recipes helping sysadmins setting up amavisd-new for SQL suggest populating the policy table with useful values. Here is a typical example:

INSERT INTO policy (id, policy_name,
virus_lover, spam_lover, banned_files_lover, bad_header_lover,
bypass_virus_checks, bypass_spam_checks,
bypass_banned_checks, bypass_header_checks, spam_modifies_subj,
spam_tag_level, spam_tag2_level, spam_kill_level) VALUES
(1, 'Non-paying', 'N','N','N','N', 'Y','Y','Y','N', 'Y', 3.0, 7, 10),
(2, 'Uncensored', 'Y','Y','Y','Y', 'N','N','N','N', 'N', 3.0, 999, 999),
(3, 'Wants all spam','N','Y','N','N', 'N','N','N','N', 'Y', 3.0, 999, 999),
(4, 'Wants viruses', 'Y','N','Y','Y', 'N','N','N','N', 'Y', 3.0, 6.9, 6.9),
(5, 'Normal', 'N','N','N','N', 'N','N','N','N', 'Y', -999, 6.9, 9.0),
(6, 'Trigger happy', 'N','N','N','N', 'N','N','N','N', 'Y', 3.0, 5, 5),
(7, 'Permissive', 'N','N','N','Y', 'N','N','N','N', 'Y', 3.0, 10, 20);

If an administrator manages multiple domains and all these domains require a policy corresponding to the "Normal" policy, then the administrator would have all of these domains point to the "Normal" policy record. E.g.:

  • @foo.com in the table users points to policy "Normal" (id 5) in the table policy.
  • @bar.com in the table users points to policy "Normal" (id 5) in the table policy.

Presumably, the idea is that if administrator decides to change what "Normal" means, then he does not have to go through all domains one by one. He just changes the "Normal" record in the policy table.

However, assuming the setup above, let's assume that an administrator adds Modoboa to his setup and uses Modoboa to alter the policy of foo.com.

Expected result: Only the settings of foo.com should change.

Actual result: Modoboa also silently alters the settings of bar.com. There is nothing on screen indicating that what Modoboa is changing has an effect greater than foo.com. This is because Modoboa modifies the settings for foo.com by modifying the "Normal" record in the policy table. Thus, everything pointing to "Normal" is altered.

(I've considered whether filing this as a bug or a feature request. I've decided on a bug since the current behavior yields unexpected results.)

As an administrator what I would ideally want the amavis extension to do is handle the two tables --- users and policy --- in a way which is compatible with what the developers of amavisd-new intended. I should be able to:

  • Create new policies. Delete policies. Edit policies. "Policies" here means "records in the policy table."
  • Change the relationship between a user and a policy (e.g. get foo.com to use the 'Trigger happy' policy rather than 'Normal'.)

Copied from original issue: modoboa/modoboa#302

Permission denied after fresh install

I've done a fresh install using installer and getting error with amavis:

Dec 15 09:34:42 derpy amavis[16380]: (16380-01) (!)run_av (ClamAV-clamd) FAILED - unexpected , output="/var/lib/amavis/tmp/amavis-20151215T153441-16380-aCsrzH3H/parts: lstat() failed: Permission denied. ERROR\n"
Dec 15 09:34:42 derpy amavis[16380]: (16380-01) (!)ClamAV-clamd av-scanner FAILED: CODE(0x4a5f280) unexpected , output="/var/lib/amavis/tmp/amavis-20151215T153441-16380-aCsrzH3H/parts: lstat() failed: Permission denied. ERROR\n" at (eval 100) line 905.
Dec 15 09:34:42 derpy amavis[16380]: (16380-01) (!)WARN: all primary virus scanners failed, considering backups

What can i do to correct that ?

"Table 'modoboa.users' doesn't exist" after "python manage.py load_initial_data"

I´ve got an existing modoboa installation and I wan´t to add modoboa-amavis. I have done all the steps described on github page and on the last step python manage.py load_initial_data I´ve got an error
"Table 'modoboa.users' doesn't exist". And I can´t get access to the web interface "An internal error occurred." because of the missing amavis db tables.

Here is the complete output:

(modoboa-1.4.5)root@testmail:/srv/mailadmin# python manage.py load_initial_data
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/srv/venv/modoboa-1.4.5/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
    utility.execute()
  File "/srv/venv/modoboa-1.4.5/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 346, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/srv/venv/modoboa-1.4.5/local/lib/python2.7/site-packages/django/core/management/base.py", line 394, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/srv/venv/modoboa-1.4.5/local/lib/python2.7/site-packages/django/core/management/base.py", line 445, in execute
    output = self.handle(*args, **options)
  File "/srv/venv/modoboa-1.4.5/local/lib/python2.7/site-packages/modoboa/core/management/commands/load_initial_data.py", line 64, in handle
    extension.load_initial_data()
  File "/srv/venv/modoboa-1.4.5/local/lib/python2.7/site-packages/modoboa_amavis/modo_extension.py", line 42, in load_initial_data
    policy = create_user_and_policy("@{0}".format(dom.name))
  File "/srv/venv/modoboa-1.4.5/local/lib/python2.7/site-packages/modoboa_amavis/lib.py", line 242, in create_user_and_policy
    if Users.objects.filter(email=name).exists():
  File "/srv/venv/modoboa-1.4.5/local/lib/python2.7/site-packages/django/db/models/query.py", line 586, in exists
    return self.query.has_results(using=self.db)
  File "/srv/venv/modoboa-1.4.5/local/lib/python2.7/site-packages/django/db/models/sql/query.py", line 484, in has_results
    return compiler.has_results()
  File "/srv/venv/modoboa-1.4.5/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 811, in has_results
    return bool(self.execute_sql(SINGLE))
  File "/srv/venv/modoboa-1.4.5/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 840, in execute_sql
    cursor.execute(sql, params)
  File "/srv/venv/modoboa-1.4.5/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/srv/venv/modoboa-1.4.5/local/lib/python2.7/site-packages/django/db/utils.py", line 98, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/srv/venv/modoboa-1.4.5/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/srv/venv/modoboa-1.4.5/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 124, in execute
    return self.cursor.execute(query, args)
  File "/srv/venv/modoboa-1.4.5/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute
    self.errorhandler(self, exc, value)
  File "/srv/venv/modoboa-1.4.5/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
django.db.utils.ProgrammingError: (1146, "Table 'modoboa.users' doesn't exist")

acl on amavis setup for a domain

From @tonioo on December 4, 2013 15:47

Originally created by Fabrice Flore-Thébault on 2013-04-16T14:54:40Z

Using modoboa with amavis plugin, the ability to disable antispam and antivirus for a domain is for now enabled for all users except single users.

It would be a nice feature to have it more configurable.

For example, one could decide to let no one except the superadmin disable antispam and antivirus, and let only the reseller decide of the tresholds.

  • a configurable default where the feature can be enabled or disabled for domain admins and resellers.
  • possibility to configure these features for each user.

Copied from original issue: modoboa/modoboa#387

cant see all mails in quarantine

Modoboa 1.4.5 1.4.5 The core part of Modoboa
Amavis frontend 1.0.6 1.0.6 Simple amavis management frontend

currently i have 10 mails in quarantine.
/user/#preferences/ set display count to a low number (5) so u shuld see multiple pages.

expected:
2 pages a 5 mail

but i only get 1 page without page navigation

Creating per-user policy from command line

Hi,

First of all, many thanks for your work on modoboa. This is really THE tool I always wanted to have to administer my mail server. Currently migrating from MacOSX Server to a Linux based solution using postfix+amavis+dovecot and modoboa, I'm in the process of configuring everything. However I would like to use the dovecot-antispam module to simplify reporting Spams/False positives for my users.

I have activated per-user training, and if I understand correctly, user policies are created only after first reporting spam/ham from the web interface. It means that dovecot-antispam per user cannot work until the user has reported at least one time from the web panel. Maybe I could leave with that, or find another way.

Do you see any solution to create users policies from a script ? I was thinking about adding a command to manage.py, but I must admit that I'm totally noob at writing python, and even more at using Django ;)

BTW I could try to implement something, but at least I would like to have some opinion about the feasibility.

Thank you.

Mail activity

From @aanriot on September 8, 2014 7:34

Hello,

As done in MailCleaner, it could be useful to have a page displaying the mail activity:

  • Arrival date / status ;
  • Envelope sender ;
  • Recipients ;
  • Status (spam / virus / bad header mail) ;
  • Deliver status / date.

with a few filters:

  • The liste of the configured domains
  • A type field (e.g. to look for logs of a specific mailbox)
  • Date

Copied from original issue: modoboa/modoboa#602

Amavis-quarantine - ability to assign per user permissions

From @tonioo on December 4, 2013 15:43

Originally created by Mike C on 2012-07-05T09:24:47Z

On special scenarios, such has exchange some user receive emails from "Distribution List", this list are not like alias, so the user does not "own" the address.

This means that if a Distribution List such as "[email protected]" exists in Exchange and its its members are: [email protected], [email protected], [email protected], when either of this users access the quarantine they will never see the emails that came to "[email protected]".

Possible solutions:

  • Add a new admin area where admins can manage amavis-quarantine permissions, something simple: "Add new permission set" - "Select mailbox" - "select other mailbox/alias/distribution list"
  • Create a tool that would query active directory or maybe using Exchange Web Services (EWS) and find and all distribution list and auto assign this permissions.

The second will be more difficult to develop I believe but perhaps the ideal.

Copied from original issue: modoboa/modoboa#287

Spamfilter improvements

These are things I'd like to see with the spamfilter if possible in future releases.

  1. Notification don't appear to work at the moment, means manually logging in and checking the quarantine, ideally an email sent at a certain time showing an quarantine summery

  2. Feedback loop, there doesn't seem to be any obvious way to tell the spam filter it missed something, I don't want all clean emails in the quarantine and I've been led to believe the plugin to support learning from the junk folder in IMAP isn't suitable for production use.

  3. Trusted IP's, So if using an external spam filtering service you can turn it off for any email that came through the service, but keep it on for anything else (Might not be possible to firewall SMTP if the modboa server hosts other domains)

amavis slow long running select

my cpus going crazy while mysql is using 100%

mysql> SHOW FULL PROCESSLIST;

one of the lonrunning:

| Id    | User    | Host                             | db      | Command | Time | State        | Info                                                                                                                                                                                                                                                                                                                    
|  1758 | amavis  | netzwerkplan01.mivitec.net:48759 | amavis  | Query   | 7712 | Sending data | SELECT COUNT(*) AS `__count` FROM `msgrcpt` INNER JOIN `maddr` ON ( `msgrcpt`.`rid` = `maddr`.`id` ) INNER JOIN `msgs` ON ( `msgrcpt`.`mail_id` = `msgs`.`mail_id` ) WHERE (`msgrcpt`.`rs` IN (' ', 'V', 'R', 'p', 'S', 'H') AND `maddr`.`email` REGEXP BINARY '(sadoni.net)' AND (`msgrcpt`.`mail_id`) IN (SELECT U0.`mail_id` FROM `quarantine` U0 WHERE U0.`chunk_ind` = 1)) |
Id User Host db Command Time State Info
65 dovecot localhost modoboa Sleep 0 NULL
66 dovecot localhost modoboa Sleep 0 NULL
1757 modoboa netzwerkplan01.mivitec.net:48758 modoboa Sleep 7745 NULL
1758 amavis netzwerkplan01.mivitec.net:48759 amavis Query 7745 Sending data SELECT COUNT(*) AS __count FROM msgrcpt INNER JOIN maddr ON ( msgrcpt.rid = maddr.id ) INNER JOIN msgs ON ( msgrcpt.mail_id = msgs.mail_id ) WHERE (msgrcpt.rs IN (' ', 'V', 'R', 'p', 'S', 'H') AND maddr.email REGEXP BINARY '(sadoni.net)' AND (msgrcpt.mail_id) IN (SELECT U0.mail_id FROM quarantine U0 WHERE U0.chunk_ind = 1))
1806 modoboa netzwerkplan01.mivitec.net:48817 modoboa Sleep 7721 NULL
1807 amavis netzwerkplan01.mivitec.net:48818 amavis Query 7721 Sending data SELECT COUNT(*) AS __count FROM msgrcpt INNER JOIN maddr ON ( msgrcpt.rid = maddr.id ) INNER JOIN msgs ON ( msgrcpt.mail_id = msgs.mail_id ) WHERE (msgrcpt.rs IN (' ', 'V', 'R', 'p', 'S', 'H') AND maddr.email IN ('[email protected]') AND (msgrcpt.mail_id) IN (SELECT U0.mail_id FROM quarantine U0 WHERE U0.chunk_ind = 1))
1830 modoboa netzwerkplan01.mivitec.net:48847 modoboa Sleep 7712 NULL
1831 amavis netzwerkplan01.mivitec.net:48848 amavis Query 7712 Sending data SELECT COUNT(*) AS __count FROM msgrcpt INNER JOIN maddr ON ( msgrcpt.rid = maddr.id ) INNER JOIN msgs ON ( msgrcpt.mail_id = msgs.mail_id ) WHERE (msgrcpt.rs IN (' ', 'V', 'R', 'p', 'S', 'H') AND maddr.email IN ('[email protected]') AND (msgrcpt.mail_id) IN (SELECT U0.mail_id FROM quarantine U0 WHERE U0.chunk_ind = 1))
16309 dovecot localhost modoboa Sleep 2144 NULL
19989 dovecot localhost modoboa Sleep 566 NULL
20853 modoboa localhost:42798 modoboa Sleep 13 NULL
20855 modoboa localhost:42799 modoboa Sleep 13 NULL
20856 modoboa localhost:42800 modoboa Sleep 13 NULL
20857 modoboa localhost:42801 modoboa Sleep 13 NULL
20858 modoboa localhost:42802 modoboa Sleep 13 NULL
20859 modoboa localhost:42803 modoboa Sleep 13 NULL
21480 modoboa localhost:42804 modoboa Sleep 13 NULL
21481 modoboa localhost:42805 modoboa Sleep 13 NULL
21482 dovecot localhost modoboa Sleep 7 NULL
21487 modoboa localhost:42807 modoboa Sleep 13 NULL
21491 root localhost NULL Query 0 NULL SHOW FULL PROCESSLIST

Per-user amavis policies not created

Hi,

I enabled Per-Domain and Per-user training and was expecting that the user being added to amavis.users, and a policy created in amavis.policy table the first time the user marks a message as spam or ham from the web interface.

What I see in practice:

  1. The username appears in spamassassin.bayes_vars, confirming that sa-learn was called with the correct username.
  2. In amavis.users, no entry is added. @Domain entries are present, which confirms that this is not a permission issue.
  3. In amavis.policy, no new entry is added. Only per-domain policies (without sa_username) are present, which confirms that this is not a permission issue.

It means that amavis will never use the user database but always the default one. Is this a known bug or did I missed something in the configuration ?

I'm using modoboa-amavis version 1.0.8 (was installed with pip a few days ago). I activated DEBUG mode but cannot see anything related to this issue in the Javascript console of the browser.

Problem when converting from byte to UTF8

From @carragom on November 13, 2015 5:51

Hi there,

I have some data in my amavis database that's rendering modoboa unusable. All parts of the system throw an internal server error. I have traced the issue to the file modoboa/extensions/amavis/sql_conector.py. The problem happens with all queries that use the function convert_from(maddr.email, 'UTF8'). Turns out if I manually run the query directly in PostgreSQL it throws the error:

ERROR: invalid byte sequence for encoding "UTF8": 0xf1657340

There seems to be data in there that's not UTF8 compliant. At first I saw #677 and upgraded to 1.2.2 thinking it was the same problem. But this did not fixed the issue. In the end I replaced all convert_from functions in modoboa/extensions/amavis/sql_conector.py to use LATIN1 instead of UTF8 and the issue is now fixed.

In the end, the problematic character was a ñ. I know RFC6531 states that email addresses could be encoded in UTF8 but amavis does not seem to be playing by those rules; yet?. An immediate solution is to switch to LATIN1 and hope it's the right encoding.

As an alternate solution the data could be retrieved in binary form from the database and converted in python maybe even a django filter that would fallback to something like "invalid address" if the conversion fails. But this would force modoboa to retrive all record from the database and in my case that would be around 7K and counting.

Hope this helps.
Cheers.

Copied from original issue: modoboa/modoboa#782

Cannot perform action on quarantined mail

Cannot delete/release/mark as spam/not spam this quarantined message. No issues with other quarantined messages. Apologies if its related to #35

Mail headers:

X-Envelope-To: <[email protected]>,
	<[email protected]>,
	<"[email protected] >>=brhclearance"@2wglobal.com>,
	<[email protected]>
X-Envelope-To-Blocked: <[email protected]>,
	<[email protected]>,
	<"[email protected] >>=brhclearance"@2wglobal.com>,
	<[email protected]>
X-Quarantine-ID: <WttDZv3e9d9l>
X-Spam-Flag: YES
X-Spam-Score: 5.587
X-Spam-Level: *****
X-Spam-Status: Yes, score=5.587 tag=4 tag2=4 kill=4
	tests=[DEAR_SOMETHING=1.731, DKIM_SIGNED=0.1, FILL_THIS_FORM=0.001,
	HTML_IMAGE_ONLY_24=1.282, HTML_MESSAGE=0.01,
	HTML_SHORT_LINK_IMG_3=0.328, SPF_PASS=-0.001, SUBJ_ALL_CAPS=1.625,
	T_DKIM_INVALID=0.01, T_REMOTE_IMAGE=0.5, URIBL_BLOCKED=0.001]
	autolearn=no autolearn_force=no
Received: from filter1001.mymailcheap.com ([127.0.0.1])
	by localhost (filter1001.mymailcheap.com [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id WttDZv3e9d9l; Mon, 20 Feb 2017 02:02:08 +0000 (UTC)
Received: from ghost.mxroute.com (ghost-outgoing.mxroute.com [107.155.64.166])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by filter1001.mymailcheap.com (Postfix) with ESMTPS;
	Mon, 20 Feb 2017 02:02:08 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=southfield.com.ph; s=default; h=Content-Type:MIME-Version:Date:Message-ID:
	Subject:From:Cc:To:Sender:Reply-To:Content-Transfer-Encoding:Content-ID:
	Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
	:Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
	List-Subscribe:List-Post:List-Owner:List-Archive;
	bh=85bZr1HrMD/3oj8OjQuVDujlq9vwPTMpGnJeOSdzleY=; b=ESZMXuVv3sJC+3d8M/SZNGmx7K
	SSCscXZe9GW9C/2mBnsO/dwKqpGlg/hM+CD86a4D589SBVttCfc+XMFHW1hji7RNsU7LrqmW2QhZA
	xe5W2lG/1jpfeWQmoOznuA46vLsgXA7+W7vWWtOnX7307pNGipU/VMEDQiQovrZUzvJpGjGDcJEc2
	uRB/9amjqZHnkjEkHnodA9J3ggnrXZ1Ppg5Rkfby0Py1ryC2yTjg1GDwDU0uLemJIJ9o1n4qXXrZM
	uqEe6zScJ9Ju5Iem7+0cTo9YjaIovQsPj1/7l88z9fla2gAKR6MLOAG0pqsf5PDWvVou/X0iyTOrA
	LNP7OIXg==;
To: MORNING COMPOSER <[email protected]>,
 [email protected],
 "[email protected] >> brhclearance"@2wglobal.com
Cc: "[email protected]" <[email protected]>,
 WSM-PUS-CREWING <[email protected]>
From: gail ramos <[email protected]>
Subject: MV MORNING COMPOSER - NOTICE OF COURIER
Message-ID: <[email protected]>
Date: Mon, 20 Feb 2017 10:01:52 +0800
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:45.0) Gecko/20100101
 Thunderbird/45.7.1
MIME-Version: 1.0
Content-Type: multipart/alternative;
 boundary="------------F922D238209F14162E844099"
X-Antivirus: avast! (VPS 170219-0, 02/19/2017), Outbound message
X-Antivirus-Status: Clean
X-AuthUser: [email protected]

Response with Debug on:

DoesNotExist at /quarantine/release/WttDZv3e9d9l/
Msgrcpt matching query does not exist.

Request Method: POST
Request URL: https://filter1001.mymailcheap.com/quarantine/release/WttDZv3e9d9l/?rcpt=%[email protected]%20&gt;&gt;=brhclearance%[email protected]
Django Version: 1.9.10
Python Executable: /usr/bin/uwsgi-core
Python Version: 2.7.9
Python Path: ['.', '', '/var/modoboa/env/lib/python2.7', '/var/modoboa/env/lib/python2.7/plat-x86_64-linux-gnu', '/var/modoboa/env/lib/python2.7/lib-tk', '/var/modoboa/env/lib/python2.7/lib-old', '/var/modoboa/env/lib/python2.7/lib-dynload', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/var/modoboa/env/local/lib/python2.7/site-packages']
Server time: Mon, 20 Feb 2017 07:25:59 +0100
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.sites',
 'django.contrib.staticfiles',
 'reversion',
 'rest_framework.authtoken',
 'rest_framework_swagger',
 'modoboa',
 'modoboa.core',
 'modoboa.lib',
 'modoboa.admin',
 'modoboa.relaydomains',
 'modoboa.limits',
 'modoboa_amavis',
 'modoboa_pdfcredentials',
 'modoboa_postfix_autoreply',
 'modoboa_sievefilters',
 'modoboa_stats')
Installed Middleware:
('x_forwarded_for.middleware.XForwardedForMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'modoboa.lib.middleware.AjaxLoginRedirect',
 'modoboa.lib.middleware.CommonExceptionCatcher',
 'modoboa.lib.middleware.RequestCatcherMiddleware')


Traceback:  

File "/var/modoboa/env/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  149.                     response = self.process_exception_by_middleware(e, request)

File "/var/modoboa/env/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  147.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/var/modoboa/env/local/lib/python2.7/site-packages/django/utils/decorators.py" in inner
  184.                     return func(*args, **kwargs)

File "/var/modoboa/env/local/lib/python2.7/site-packages/django/utils/decorators.py" in inner
  184.                     return func(*args, **kwargs)

File "/var/modoboa/env/local/lib/python2.7/site-packages/modoboa_amavis/lib.py" in wrapped_f
  40.                 return f(request, *args, **kwargs)

File "/var/modoboa/env/local/lib/python2.7/site-packages/modoboa_amavis/views.py" in release
  290.         msgrcpts += [connector.get_recipient_message(r, i)]

File "/var/modoboa/env/local/lib/python2.7/site-packages/modoboa_amavis/sql_connector.py" in get_recipient_message
  181.         return Msgrcpt.objects.get(mail=mailid, rid__email=address)

File "/var/modoboa/env/local/lib/python2.7/site-packages/django/db/models/manager.py" in manager_method
  122.                 return getattr(self.get_queryset(), name)(*args, **kwargs)

File "/var/modoboa/env/local/lib/python2.7/site-packages/django/db/models/query.py" in get
  387.                 self.model._meta.object_name

Exception Type: DoesNotExist at /quarantine/release/WttDZv3e9d9l/
Exception Value: Msgrcpt matching query does not exist.
Request information:
GET:
 = u'brhclearance"@2wglobal.com'
gt = u''
rcpt = u'"[email protected] '

POST:
rcpt = u'"[email protected] '

FILES: No FILES data

COOKIES:
csrftoken = 'Opez9axkdedyNp4GebiQ66nr3BybUc47'
sessionid = 'cek8cx12eli0pqu8ak5mbixmkl7irbee'

META:
wsgi.multiprocess = True
HTTP_REFERER = 'https://filter1001.mymailcheap.com/quarantine/'
UWSGI_SCRIPT = 'instance.wsgi:application'
SCRIPT_NAME = u''
HTTP_X_CSRFTOKEN = 'Opez9axkdedyNp4GebiQ66nr3BybUc47'
REQUEST_METHOD = 'POST'
PATH_INFO = u'/quarantine/release/WttDZv3e9d9l/'
HTTP_ORIGIN = 'https://filter1001.mymailcheap.com'
SERVER_PROTOCOL = 'HTTP/1.1'
QUERY_STRING = 'rcpt=%[email protected]%20&gt;&gt;=brhclearance%[email protected]'
CONTENT_LENGTH = '36'
HTTP_USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36'
HTTP_CONNECTION = 'keep-alive'
HTTP_COOKIE = 'csrftoken=Opez9axkdedyNp4GebiQ66nr3BybUc47; sessionid=cek8cx12eli0pqu8ak5mbixmkl7irbee'
SERVER_NAME = 'filter1001.mymailcheap.com'
REMOTE_ADDR = '79.98.74.190'
wsgi.url_scheme = 'https'
SERVER_PORT = '443'
uwsgi.node = 'filter1001.mymailcheap.com'
DOCUMENT_ROOT = '/var/modoboa/instance'
HTTP_CONTENT_LENGTH = '36'
HTTP_X_REQUESTED_WITH = 'XMLHttpRequest'
wsgi.input = <uwsgi._Input object at 0x7f0e2153f480>
HTTP_HOST = 'filter1001.mymailcheap.com'
HTTPS = 'on'
wsgi.multithread = False
HTTP_CONTENT_TYPE = 'application/x-www-form-urlencoded; charset=UTF-8'
REQUEST_URI = '/quarantine/release/WttDZv3e9d9l/?rcpt=%[email protected]%20&gt;&gt;=brhclearance%[email protected]'
HTTP_ACCEPT = 'application/json, text/javascript, */*; q=0.01'
wsgi.version = 
wsgi.run_once = False
wsgi.errors = <open file 'wsgi_errors', mode 'w' at 0x7f0e23b198a0>
REMOTE_PORT = '50316'
HTTP_ACCEPT_LANGUAGE = 'en-US,en;q=0.8'
UWSGI_APPID = 'filter1001.mymailcheap.com|'
uwsgi.version = '2.0.7-debian'
CONTENT_TYPE = 'application/x-www-form-urlencoded; charset=UTF-8'
wsgi.file_wrapper = ''
CSRF_COOKIE = u'Opez9axkdedyNp4GebiQ66nr3BybUc47'
HTTP_ACCEPT_ENCODING = 'gzip, deflate, br'

Settings:
Using settings module instance.settings
SECURE_REDIRECT_EXEMPT = []
SECURE_BROWSER_XSS_FILTER = False
USE_X_FORWARDED_PORT = False
USE_THOUSAND_SEPARATOR = False
CSRF_COOKIE_SECURE = False
LANGUAGE_CODE = 'en-us'
ROOT_URLCONF = 'instance.urls'
MANAGERS = []
BASE_DIR = '.'
SILENCED_SYSTEM_CHECKS = ['fields.W342']
DEFAULT_CHARSET = 'utf-8'
SWAGGER_SETTINGS = {'info': {'contact': '[email protected]', 'description': 'Modoboa API, requires a valid token.', 'title': 'Modoboa API'}, 'doc_expansion': 'none', 'api_path': '/', 'exclude_namespaces': [], 'template_path': 'rest_framework_swagger/index.html', 'is_authenticated': False, 'permission_denied_handler': None, 'enabled_methods': ['get', 'post', 'put', 'patch', 'delete'], 'token_type': 'Token', 'is_superuser': False, 'resource_access_handler': None, 'unauthenticated_user': 'django.contrib.auth.models.AnonymousUser', 'api_key': '', 'api_version': '1.0'}
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer'
STATIC_ROOT = './sitestatic'
ALLOWED_HOSTS = ['filter1001.mymailcheap.com']
MESSAGE_STORAGE = 'django.contrib.messages.storage.fallback.FallbackStorage'
EMAIL_SUBJECT_PREFIX = '[Django] '
SERVER_EMAIL = 'root@localhost'
PASSWORD_MIN_LENGTH = u'********************'
SECURE_HSTS_SECONDS = 0
STATICFILES_FINDERS = ['django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder']
SESSION_CACHE_ALIAS = 'default'
SESSION_COOKIE_DOMAIN = None
SESSION_COOKIE_NAME = 'sessionid'
TIME_INPUT_FORMATS = ['%H:%M:%S', '%H:%M:%S.%f', '%H:%M']
MODOBOA_APPS = 
DATABASES = {'default': {'ENGINE': 'django.db.backends.mysql', 'AUTOCOMMIT': True, 'ATOMIC_REQUESTS': True, 'NAME': 'modoboa', 'CONN_MAX_AGE': 0, 'TIME_ZONE': None, 'PORT': '', 'HOST': '127.0.0.1', 'USER': 'modoboa', 'TEST': {'COLLATION': None, 'CHARSET': None, 'NAME': None, 'MIRROR': None}, 'PASSWORD': u'********************', 'OPTIONS': {'init_command': 'SET foreign_key_checks = 0;'}}, 'amavis': {'ENGINE': 'django.db.backends.mysql', 'AUTOCOMMIT': True, 'ATOMIC_REQUESTS': True, 'NAME': 'amavis', 'CONN_MAX_AGE': 0, 'TIME_ZONE': None, 'PORT': '', 'HOST': '127.0.0.1', 'USER': 'amavis', 'TEST': {'COLLATION': None, 'CHARSET': None, 'NAME': None, 'MIRROR': None}, 'PASSWORD': u'********************', 'OPTIONS': {'init_command': 'SET foreign_key_checks = 0;'}}}
EMAIL_SSL_KEYFILE = u'********************'
FILE_UPLOAD_DIRECTORY_PERMISSIONS = None
PASSWORD_COMPLEXITY = u'********************'
FILE_UPLOAD_PERMISSIONS = None
FILE_UPLOAD_HANDLERS = ['django.core.files.uploadhandler.MemoryFileUploadHandler', 'django.core.files.uploadhandler.TemporaryFileUploadHandler']
DEFAULT_CONTENT_TYPE = 'text/html'
APPEND_SLASH = True
LOCALE_PATHS = []
DATABASE_ROUTERS = ['modoboa_amavis.dbrouter.AmavisRouter']
DEFAULT_TABLESPACE = ''
YEAR_MONTH_FORMAT = 'F Y'
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage'
CACHES = {'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}}
SESSION_COOKIE_PATH = '/'
EMAIL_HOST_PASSWORD = u'********************'
SECURE_CONTENT_TYPE_NOSNIFF = False
MIDDLEWARE_CLASSES = 
USE_I18N = True
THOUSAND_SEPARATOR = ','
SECRET_KEY = u'********************'
MODOBOA_API_URL = u'********************'
LANGUAGE_COOKIE_NAME = 'django_language'
DEFAULT_INDEX_TABLESPACE = ''
LOGGING_CONFIG = 'logging.config.dictConfig'
TEMPLATE_LOADERS = ['django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader']
FIRST_DAY_OF_WEEK = 0
WSGI_APPLICATION = 'instance.wsgi.application'
TEMPLATE_DEBUG = False
X_FRAME_OPTIONS = 'SAMEORIGIN'
CSRF_COOKIE_NAME = 'csrftoken'
FORCE_SCRIPT_NAME = None
USE_X_FORWARDED_HOST = False
CSRF_HEADER_NAME = 'HTTP_X_CSRFTOKEN'
EMAIL_TIMEOUT = None
SECURE_SSL_HOST = None
SIGNING_BACKEND = 'django.core.signing.TimestampSigner'
SESSION_COOKIE_SECURE = False
CSRF_COOKIE_DOMAIN = None
FILE_CHARSET = 'utf-8'
DEBUG = True
CSRF_TRUSTED_ORIGINS = []
LANGUAGE_COOKIE_DOMAIN = None
DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
INSTALLED_APPS = 
LANGUAGES = [('af', 'Afrikaans'), ('ar', 'Arabic'), ('ast', 'Asturian'), ('az', 'Azerbaijani'), ('bg', 'Bulgarian'), ('be', 'Belarusian'), ('bn', 'Bengali'), ('br', 'Breton'), ('bs', 'Bosnian'), ('ca', 'Catalan'), ('cs', 'Czech'), ('cy', 'Welsh'), ('da', 'Danish'), ('de', 'German'), ('el', 'Greek'), ('en', 'English'), ('en-au', 'Australian English'), ('en-gb', 'British English'), ('eo', 'Esperanto'), ('es', 'Spanish'), ('es-ar', 'Argentinian Spanish'), ('es-co', 'Colombian Spanish'), ('es-mx', 'Mexican Spanish'), ('es-ni', 'Nicaraguan Spanish'), ('es-ve', 'Venezuelan Spanish'), ('et', 'Estonian'), ('eu', 'Basque'), ('fa', 'Persian'), ('fi', 'Finnish'), ('fr', 'French'), ('fy', 'Frisian'), ('ga', 'Irish'), ('gd', 'Scottish Gaelic'), ('gl', 'Galician'), ('he', 'Hebrew'), ('hi', 'Hindi'), ('hr', 'Croatian'), ('hu', 'Hungarian'), ('ia', 'Interlingua'), ('id', 'Indonesian'), ('io', 'Ido'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja', 'Japanese'), ('ka', 'Georgian'), ('kk', 'Kazakh'), ('km', 'Khmer'), ('kn', 'Kannada'), ('ko', 'Korean'), ('lb', 'Luxembourgish'), ('lt', 'Lithuanian'), ('lv', 'Latvian'), ('mk', 'Macedonian'), ('ml', 'Malayalam'), ('mn', 'Mongolian'), ('mr', 'Marathi'), ('my', 'Burmese'), ('nb', 'Norwegian Bokmal'), ('ne', 'Nepali'), ('nl', 'Dutch'), ('nn', 'Norwegian Nynorsk'), ('os', 'Ossetic'), ('pa', 'Punjabi'), ('pl', 'Polish'), ('pt', 'Portuguese'), ('pt-br', 'Brazilian Portuguese'), ('ro', 'Romanian'), ('ru', 'Russian'), ('sk', 'Slovak'), ('sl', 'Slovenian'), ('sq', 'Albanian'), ('sr', 'Serbian'), ('sr-latn', 'Serbian Latin'), ('sv', 'Swedish'), ('sw', 'Swahili'), ('ta', 'Tamil'), ('te', 'Telugu'), ('th', 'Thai'), ('tr', 'Turkish'), ('tt', 'Tatar'), ('udm', 'Udmurt'), ('uk', 'Ukrainian'), ('ur', 'Urdu'), ('vi', 'Vietnamese'), ('zh-hans', 'Simplified Chinese'), ('zh-hant', 'Traditional Chinese')]
USE_L10N = True
SECURE_HSTS_INCLUDE_SUBDOMAINS = False
STATICFILES_DIRS = '/var/modoboa/env/lib/python2.7/site-packages/modoboa/bower_components'
PREPEND_WWW = False
SECURE_PROXY_SSL_HEADER = None
LANGUAGE_COOKIE_AGE = None
SESSION_COOKIE_HTTPONLY = True
DEBUG_PROPAGATE_EXCEPTIONS = False
CSRF_COOKIE_AGE = 31449600
MONTH_DAY_FORMAT = 'F j'
LOGIN_URL = '/accounts/login/'
SESSION_EXPIRE_AT_BROWSER_CLOSE = False
TIME_FORMAT = 'P'
AUTH_USER_MODEL = 'core.User'
DATE_INPUT_FORMATS = ['%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', '%b %d %Y', '%b %d, %Y', '%d %b %Y', '%d %b, %Y', '%B %d %Y', '%B %d, %Y', '%d %B %Y', '%d %B, %Y']
AUTHENTICATION_BACKENDS = 'modoboa.lib.authbackends.SimpleBackend'
AUTH_PASSWORD_VALIDATORS = u'********************'
PASSWORD_RESET_TIMEOUT_DAYS = u'********************'
SESSION_FILE_PATH = None
CACHE_MIDDLEWARE_ALIAS = 'default'
SESSION_SAVE_EVERY_REQUEST = False
NUMBER_GROUPING = 0
SESSION_ENGINE = 'django.contrib.sessions.backends.db'
CSRF_FAILURE_VIEW = 'django.views.csrf.csrf_failure'
CSRF_COOKIE_PATH = '/'
LOGIN_REDIRECT_URL = '/accounts/profile/'
DECIMAL_SEPARATOR = '.'
IGNORABLE_404_URLS = []
MIGRATION_MODULES = {}
TEMPLATE_STRING_IF_INVALID = ''
LOGOUT_URL = '/accounts/logout/'
EMAIL_USE_TLS = False
FIXTURE_DIRS = []
EMAIL_HOST = 'localhost'
DATE_FORMAT = 'N j, Y'
MEDIA_ROOT = './media'
DEFAULT_EXCEPTION_REPORTER_FILTER = 'django.views.debug.SafeExceptionReporterFilter'
ADMINS = []
FORMAT_MODULE_PATH = None
DEFAULT_FROM_EMAIL = 'webmaster@localhost'
REST_FRAMEWORK = {'DEFAULT_AUTHENTICATION_CLASSES': ('rest_framework.authentication.TokenAuthentication',), 'DEFAULT_PERMISSION_CLASSES': ('rest_framework.permissions.IsAuthenticated',)}
MEDIA_URL = '/media/'
DATETIME_FORMAT = 'N j, Y, P'
TEMPLATE_DIRS = []
SITE_ID = 1
DISALLOWED_USER_AGENTS = []
ALLOWED_INCLUDE_ROOTS = []
LOGGING = {'loggers': {'modoboa.auth': {'handlers': ['syslog-auth', 'modoboa'], 'propagate': False, 'level': 'INFO'}, 'modoboa.admin': {'handlers': ['modoboa'], 'propagate': False, 'level': 'INFO'}}, 'version': 1, 'formatters': {'syslog': {'format': '%(name)s: %(levelname)s %(message)s'}}, 'handlers': {'syslog-auth': {'formatter': 'syslog', 'class': 'logging.handlers.SysLogHandler', 'facility': 4}, 'modoboa': {'class': 'modoboa.core.loggers.SQLHandler'}}}
SHORT_DATE_FORMAT = 'm/d/Y'
TEMPLATES = [{'DIRS': [], 'APP_DIRS': True, 'OPTIONS': {'debug': False, 'context_processors': ['django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.template.context_processors.i18n', 'django.template.context_processors.media', 'django.template.context_processors.static', 'django.template.context_processors.tz', 'django.contrib.messages.context_processors.messages', 'modoboa.core.context_processors.top_notifications']}, 'BACKEND': 'django.template.backends.django.DjangoTemplates'}]
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
CACHE_MIDDLEWARE_KEY_PREFIX = u'********************'
SECURE_SSL_REDIRECT = False
TIME_ZONE = 'Europe/Paris'
FILE_UPLOAD_MAX_MEMORY_SIZE = 2621440
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_USE_SSL = False
TEMPLATE_CONTEXT_PROCESSORS = ['django.contrib.auth.context_processors.auth', 'django.template.context_processors.debug', 'django.template.context_processors.i18n', 'django.template.context_processors.media', 'django.template.context_processors.static', 'django.template.context_processors.tz', 'django.contrib.messages.context_processors.messages']
SESSION_COOKIE_AGE = 1209600
SETTINGS_MODULE = 'instance.settings'
USE_ETAGS = False
LANGUAGES_BIDI = ['he', 'ar', 'fa', 'ur']
FILE_UPLOAD_TEMP_DIR = None
INTERNAL_IPS = []
STATIC_URL = '/sitestatic/'
EMAIL_PORT = 25
USE_TZ = True
SHORT_DATETIME_FORMAT = 'm/d/Y P'
TEST_NON_SERIALIZED_APPS = []
PASSWORD_HASHERS = u'********************'
ABSOLUTE_URL_OVERRIDES = {}
LANGUAGE_COOKIE_PATH = '/'
CACHE_MIDDLEWARE_SECONDS = 600
EMAIL_SSL_CERTFILE = None
CSRF_COOKIE_HTTPONLY = False
DATETIME_INPUT_FORMATS = ['%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M:%S.%f', '%Y-%m-%d %H:%M', '%Y-%m-%d', '%m/%d/%Y %H:%M:%S', '%m/%d/%Y %H:%M:%S.%f', '%m/%d/%Y %H:%M', '%m/%d/%Y', '%m/%d/%y %H:%M:%S', '%m/%d/%y %H:%M:%S.%f', '%m/%d/%y %H:%M', '%m/%d/%y']
EMAIL_HOST_USER = ''


You're seeing this error because you have DEBUG = True in your
Django settings file. Change that to False, and Django will
display a standard page generated by the handler for this status code.


Update 1.2.1 -> 1.3.3 issue: modoboa_amavis.models.DoesNotExist: Policy matching query does not exist

From @mrh666 on June 20, 2015 12:33

Hi there,

During the migration from 1.2.1 to 1.3.3 I deployed a new modoboa instance, added extensions, dbs and routers section to settings.py:

MODOBOA_APPS = (
    'modoboa',
    'modoboa.core',
    'modoboa.lib',
    # Modoboa extensions here.
    'modoboa_admin',
    'modoboa_admin_relaydomains',
    'modoboa_admin_limits',
    'modoboa_postfix_autoreply',
    'modoboa_webmail',
    'modoboa_stats',
    'modoboa_sievefilters',
    'modoboa_radicale',
    'modoboa_amavis',
)
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'modoboa',
        'USER': 'USERNAME',
        'PASSWORD': 'PASSWORD',
        'HOST': 'localhost',
        'PORT': '3306',
        'ATOMIC_REQUESTS': True,
        'OPTIONS' : {
            "init_command" : 'SET foreign_key_checks = 0;',
        },
    },
    'amavis': {
       'ENGINE': 'django.db.backends.mysql',
       'HOST': '',
       'NAME': 'amavis',
       'USER': 'USERNAME',
       'PASSWORD': 'PASSWORD',
    }
}

DATABASE_ROUTERS = ["modoboa_amavis.dbrouter.AmavisRouter"]

During migration process I run python manage.py load_initial_data and I've got the next error:

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/lib64/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/usr/lib64/python2.7/site-packages/django/core/management/__init__.py", line 377, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib64/python2.7/site-packages/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/lib64/python2.7/site-packages/django/core/management/base.py", line 338, in execute
    output = self.handle(*args, **options)
  File "/usr/lib/python2.7/site-packages/modoboa/core/management/commands/load_initial_data.py", line 55, in handle
    extension.load_initial_data()
  File "/usr/lib/python2.7/site-packages/modoboa_amavis/modo_extension.py", line 43, in load_initial_data
    policy = create_user_and_policy("@{0}".format(dom.name))
  File "/usr/lib/python2.7/site-packages/modoboa_amavis/lib.py", line 242, in create_user_and_policy
    return Policy.objects.get(policy_name=name[:32])
  File "/usr/lib64/python2.7/site-packages/django/db/models/manager.py", line 92, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/django/db/models/query.py", line 357, in get
    self.model._meta.object_name)
modoboa_amavis.models.DoesNotExist: Policy matching query does not exist.

How can I fix it?

Thank you!

Copied from original issue: modoboa/modoboa#747

Manual learning options missing/not available

Impacted versions

  • Modoboa: 1.7.2; Modoboa Amavis: 1.1.1
  • Webserver: Nginx/Uwsgi

Current behavior

Modoboa > Parameters > Amavis is missing per-domain and per-user manual learning options.

Video/Screenshot link

Attached,
1

Impossible to execute management commands

Since the migration to Django 1.8 and changes made to models, management commands cannot be run anymore. For example:

Traceback (most recent call last):
  File "/srv/modoboa/instance/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
    utility.execute()
  File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 346, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 394, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 445, in execute
    output = self.handle(*args, **options)
  File "/srv/modoboa/env/local/lib/python2.7/site-packages/modoboa_amavis/management/commands/qcleanup.py", line 55, in handle
    if not msg.msgrcpt_set.exclude(rs__in=flags).count():
AttributeError: 'Msgs' object has no attribute 'msgrcpt_set'

Using modoboa just as a mailfilter quarantine management no webmail

From @stevie on November 16, 2016 13:16

Hi,

I have installed this and it looks great for what im trying to do, great work! However, I would not like the webmail component installed as im just trying to use it as a spam/virus filter/quarantine management tool. So using the modoboa installer I have removed this from the installer.cfg

For example:

extensions = modoboa-amavis modoboa-pdfcredentials modoboa-postfix-autoreply modoboa-sievefilters modoboa-stats

My question is on the notification side of things. Can modoboa generate it's notifications whether it's an admin/user for a particular domain if the modoboa-webmail component is not installed? I have tried installation a few times but it only seems to support notifications to a built in account ([email protected])

Is there something I could put into a config file to allow modoboa to send notifications to an external email address?

Any assistance or pointers would be greatly appreciated.

Thanks

Steve

Copied from original issue: modoboa/modoboa#962

Per Domain Bayes Learning

From @stalks on November 26, 2016 20:48

When I try and learn a mail using domain, the web panel doesn't respond.

issue

When clicking Validate nothing happens. If I select global database, it will work.

Copied from original issue: modoboa/modoboa#976

Manage DKIM keys

From @tonioo on December 4, 2013 15:45

Originally created by Antoine Nguyen on 2012-10-21T10:19:54Z

Add the possibility to enable DKIM signing from Modoboa. The big issue is: we need to generate amavis config. files :p

Copied from original issue: modoboa/modoboa#336

Add per user whitelist/blacklist support

From @tonioo on December 4, 2013 15:22

Originally created by Antoine Nguyen on 2009-11-06T08:22:26Z

As for quarantine, Amavisd-new allows users to define personnal whitelists/blacklists in an SQL database.

Create a new extension (or modify the existing quarantine extension) to handle this.

Additional specs are needed.

Copied from original issue: modoboa/modoboa#40

Releasing a message fails with Python error "ValueError"

I can send the release request as a user without any problem, but when as admin I try to actually release the message, I get a Python exception:

ValueError at /quarantine/release/v4bkPCreu7EE/

Django Version:	1.10.7
Exception Type:	ValueError
Exception Value:	
need more than 1 value to unpack
Exception Location:	<virtualenv>/lib/python2.7/site-packages/modoboa_amavis/views.py in release, line 285
Python Executable:	<path>/bin/uwsgi
Python Version:	2.7.13

From the backtrace:

Variable	Value
connector	<modoboa_amavis.sql_connector.SQLconnector object at 0x81276ea90>
mail_id		[u'v4bkPCreu7EE']
mid		u'v4bkPCreu7EE'
msgrcpts	[]
request		<WSGIRequest: GET '/quarantine/release/fURG9IyNZ7B6/[email protected]'>

Execution of management commands fails

Traceback (most recent call last):
  File "/srv/modoboa/instance/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
    utility.execute()
  File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 346, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 190, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 40, in load_command_class
    module = import_module('%s.management.commands.%s' % (app_name, name))
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/srv/modoboa/env/local/lib/python2.7/site-packages/modoboa_amavis/management/commands/amnotify.py", line 11, in <module>
    from modoboa.core.management.commands import CloseConnectionMixin
ImportError: cannot import name CloseConnectionMixin

qcleanup task should slice messages deletion

As I take many time to upgrade from 1.0.6 to latest version (1.0.11) and this old version had a bug in qcleanup code, I (without really view it until a few days ago) accumulated 180 days of quarantine.
When, after the update I wanted to launch a qcleanup (with 30 days of retention), the script began to grow in ram (up to 21G when it was oom-killed rollbacking the cleanup transaction). In addition, it locked the tables thus amavis was not able to write to quarantine and postfix began to defer messages with "451 4.3.0 Error: queue file write error".
I know that this issue is very related to my particular case and will appear often in normal operations, but I think it can also happen to someone who want to change his retention configuration (from 3 to one month by example), so I submit it with my quick patch.
If I understand well django queryset API, delete method is not able to work on sliced querysets by itself so I decided to manually slice the work by day (which by default will not change the global behaviour whith qcleanup scheduled daily). To understand what is happening, I also added a few debug messages.

Here is the diif from todays master branch:

--- qcleanup.py.orig	2017-02-15 09:54:39.687963778 +0100
+++ qcleanup.py	2017-02-15 09:55:28.135588882 +0100
@@ -2,6 +2,7 @@
 # coding: utf-8
 
 import time
+from datetime import timedelta
 from optparse import make_option
 
 from django.core.management.base import BaseCommand
@@ -53,16 +54,31 @@
         ids = Msgrcpt.objects.filter(rs__in=flags).values("mail_id").distinct()
         for msg in Msgs.objects.filter(mail_id__in=ids):
             if not msg.msgrcpt_set.exclude(rs__in=flags).count():
-                msg.delete()
-
+                deb=time.time()
+                (nmbr, objytpes) = msg.delete()
+                self.__vprint("%d lines deleted in %ds" % (nmbr, time.time() - deb))
+                self.__vprint("Par types : %s " % objtypes)
+
+        oldest = Msgs.objects.all().values_list("time_num", flat=True).order_by("time_num")[1]
+        oldest_age = timedelta(seconds=time.time()-oldest).days
+        self.__vprint("Oldest message is %d days old" % oldest_age)
+        for age in range(oldest_age, max_messages_age, -1):
+            deb=time.time()
         self.__vprint(
-            "Deleting messages older than %d days..." % max_messages_age)
-        limit = int(time.time()) - (max_messages_age * 24 * 3600)
-        Msgs.objects.filter(time_num__lt=limit).delete()
+                "Deleting messages older than %d days..." % age)
+            limit = int(time.time()) - (age * 24 * 3600)
+            (nmbr, objtypes) = Msgs.objects.filter(time_num__lt=limit).delete()
+            self.__vprint("%d lines deleted in %ds" % (nmbr, time.time() - deb))
+            self.__vprint("Par types : %s " % objtypes)
+            time.sleep(1)
 
         self.__vprint("Deleting unreferenced e-mail addresses...")
+        deb=time.time()
+        totnmbr = 0
         for maddr in Maddr.objects.all():
             if not maddr.msgs_set.count() and not maddr.msgrcpt_set.count():
-                maddr.delete()
+                (nmbr, objtypes) = maddr.delete()
+                totnmbr += nmbr
+        self.__vprint("%d addresses deleted in %ds" % (totnmbr, time.time() - deb))
 
         self.__vprint("Done.")

And the output in very verbose mode:

(env)modoboa@mail-gatewy:~/modoboa_instance$ python manage.py qcleanup --verbose -v 3
System check identified some issues:

WARNINGS:
modoboa_amavis.Msgrcpt.mail: (fields.W342) Setting unique=True on a ForeignKey has the same effect as using a OneToOneField.
        HINT: ForeignKey(unique=True) is usually better served by a OneToOneField.
modoboa_amavis.Quarantine.mail: (fields.W342) Setting unique=True on a ForeignKey has the same effect as using a OneToOneField.
        HINT: ForeignKey(unique=True) is usually better served by a OneToOneField.
Deleting marked messages...
Oldest message is 171 old
Deleting messages older than 171 days...
98 lines deleted in 0s
Par types : {u'modoboa_amavis.Quarantine': 52L, u'modoboa_amavis.Msgrcpt': 23L, u'modoboa_amavis.Msgs': 23L}
Deleting messages older than 170 days...
19094 lines deleted in 26s
Par types : {u'modoboa_amavis.Quarantine': 14932L, u'modoboa_amavis.Msgrcpt': 2158L, u'modoboa_amavis.Msgs': 2004L}
Deleting messages older than 169 days...
55501 lines deleted in 112s
Par types : {u'modoboa_amavis.Quarantine': 45179L, u'modoboa_amavis.Msgrcpt': 5775L, u'modoboa_amavis.Msgs': 4547L}
Deleting messages older than 168 days...
54355 lines deleted in 84s
Par types : {u'modoboa_amavis.Quarantine': 45468L, u'modoboa_amavis.Msgrcpt': 4841L, u'modoboa_amavis.Msgs': 4046L}
Deleting messages older than 167 days...
67179 lines deleted in 167s
Par types : {u'modoboa_amavis.Quarantine': 55856L, u'modoboa_amavis.Msgrcpt': 6509L, u'modoboa_amavis.Msgs': 4814L}
Deleting messages older than 166 days...
63566 lines deleted in 140s
Par types : {u'modoboa_amavis.Quarantine': 52663L, u'modoboa_amavis.Msgrcpt': 5840L, u'modoboa_amavis.Msgs': 5063L}
Deleting unreferenced e-mail addresses...
6578 addresses deleted in 317s
Done.

Hope this will help improve the quality of this great project.

CRON job error

Getting this cron error every minute (generated by cron email).

System check identified some issues:

WARNINGS:
modoboa_amavis.Msgrcpt.mail: (fields.W342) Setting unique=True on a ForeignKey has the same effect as using a OneToOneField.
        HINT: ForeignKey(unique=True) is usually better served by a OneToOneField.
modoboa_amavis.Quarantine.mail: (fields.W342) Setting unique=True on a ForeignKey has the same effect as using a OneToOneField.
        HINT: ForeignKey(unique=True) is usually better served by a OneToOneField.

LDAP backend support

From @tonioo on December 4, 2013 15:45

Originally created by Antoine Nguyen on 2012-10-21T10:18:35Z

Amavis is able to look into an LDAP directory, we should support this. (policies, etc.)

Copied from original issue: modoboa/modoboa#335

An account does not always have a 'users' entry

When "manual learning" mode is enabled and an account is renamed, the plugin tries to rename the corresponding entry inside the "users" table. Unfortunately, the entry is not always present.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.