Christian Keil | 4 Jan 09:15 2011
Picon

Aliasing Question & PDF Reports

Hello, first of all happy new year to the list.


Im currently trying to implement Baruwa with Mailscanner and migrate away from my current DSPAM Setup.

One thing thats really bugging me right now is the way aliases are treated.

i.e. Mail comes in via alias1-9IKiO1iGCm/QT0dZR+AlfA@public.gmane.org gets routed trough Mailscanner and then processed.

Afterwards on the way out it gets rewritten to the correct mailboxname-9IKiO1iGCm9hl2p70BpVqQ@public.gmane.orgm.

Is there any known way to do this prior to the Mail passing Mailscanner/Baruwa?

I also have problems generating pdf reports:

 manage.py sendpdfreports
=================== Processing reports ======================
Traceback (most recent call last):
  File "/usr/bin/manage.py", line 11, in <module>
    execute_manager(settings)
  File "/usr/lib/pymodules/python2.6/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/usr/lib/pymodules/python2.6/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/pymodules/python2.6/django/core/management/base.py", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/lib/pymodules/python2.6/django/core/management/base.py", line 220, in execute
    output = self.handle(*args, **options)
  File "/usr/lib/pymodules/python2.6/baruwa/reports/management/commands/sendpdfreports.py", line 341, in handle
    user = profile.user
  File "/usr/lib/pymodules/python2.6/django/db/models/fields/related.py", line 302, in __get__
    rel_obj = QuerySet(self.field.rel.to).using(db).get(**params)
  File "/usr/lib/pymodules/python2.6/django/db/models/query.py", line 341, in get
    % self.model._meta.object_name)
django.contrib.auth.models.DoesNotExist: User matching query does not exist.


Kind Regards
Christian Keil
_______________________________________________
Baruwa mailing list
Baruwa@...
http://lists.baruwa.org/mailman/listinfo/baruwa
Andrew Colin Kissa | 4 Jan 09:23 2011
Picon

Re: Aliasing Question & PDF Reports


On 04 Jan 2011, at 10:15 AM, Christian Keil wrote:

> Hello, first of all happy new year to the list.

Happy new year to you too, and welcome to the list.

> 
> One thing thats really bugging me right now is the way aliases are treated.
> 
> i.e. Mail comes in via alias1@... gets routed trough
Mailscanner and then processed.

This is going to be MTA specific which MTA are you using ?

> 
>  manage.py sendpdfreports
> =================== Processing reports ======================
> 
>   File "/usr/lib/pymodules/python2.6/baruwa/reports/management/commands/sendpdfreports.py",
line 341, in handle
>     user = profile.user
>   File "/usr/lib/pymodules/python2.6/django/db/models/fields/related.py", line 302, in __get__
>     rel_obj = QuerySet(self.field.rel.to).using(db).get(**params)
>   File "/usr/lib/pymodules/python2.6/django/db/models/query.py", line 341, in get
>     % self.model._meta.object_name)
> django.contrib.auth.models.DoesNotExist: User matching query does not exist.

That is weird, from what i can see, you have a profile that does not have a user account linked to it,
This should not be the case if you managed everything via baruwa. The only way this scenario
is possible is if you deleted a user directly from mysql in which case then the delete does not get
cascaded.

--
Baruwa - www.baruwa.org
Christian Keil | 4 Jan 09:30 2011
Picon

Re: Aliasing Question & PDF Reports

Hello Andrew,
 
>
> One thing thats really bugging me right now is the way aliases are treated.
>
> i.e. Mail comes in via alias1 <at> domain.com gets routed trough Mailscanner and then processed.

This is going to be MTA specific which MTA are you using ?

I'm using postfix and use my aliases provided by :
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_alias_maps.cf


That is weird, from what i can see, you have a profile that does not have a user account linked to it,
This should not be the case if you managed everything via baruwa. The only way this scenario
is possible is if you deleted a user directly from mysql in which case then the delete does not get
cascaded.

That did the trick, I still had a Profile listed in "profiles"

I have to add users via mysql aswell as Domains cause my whole Backend depends on it. My Users are using Postfix.Admin whenever they create a Mailbox or a Domain right now their Data gets added into DSPAM's Database. Aliases are being ignored as I rewrite Mails to their Destination Mailbox prior to sending them to the DSPAM Server. With Baruwa I wanted to give the Users the Ability to see Blacklisted Mails in their Log/Spam-Quarantine.

Kind Regards
Christian Keil
_______________________________________________
Baruwa mailing list
Baruwa@...
http://lists.baruwa.org/mailman/listinfo/baruwa
Andrew Colin Kissa | 4 Jan 09:38 2011
Picon

Re: Aliasing Question & PDF Reports


On 04 Jan 2011, at 10:30 AM, Christian Keil wrote:

> I'm using postfix and use my aliases provided by :
> virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_alias_maps.cf

I think this is due to the way mailscanner works with postfix, as postfix puts the messages in the hold
queue then mailscanner scans them and moves them to the delivery queue where the rewriting of
the address takes place.

The trick to get the address rewritten before mailscanner handles the message could be to use the
same logic as the splitting of recipients.

http://wiki.mailscanner.info/doku.php?id=documentation:configuration:mta:postfix:how_to:split_mails_per_recipient

YMMV as i do not use postfix so this is just a suggestion that you could test/

> 
> I have to add users via mysql aswell as Domains cause my whole Backend depends on it. My Users are using
Postfix.Admin whenever they create a Mailbox or a Domain right now their Data gets added into DSPAM's Database.

You could use triggers to insert the same data into the baruwa tables when the users create the domains via postfix.Admin

> With Baruwa I wanted to give the Users the Ability to see Blacklisted Mails in their Log/Spam-Quarantine.

Yes they will be able to do that.

--
Baruwa - www.baruwa.org
Andrew Colin Kissa | 4 Jan 09:41 2011
Picon

Re: Aliasing Question & PDF Reports


On 04 Jan 2011, at 10:30 AM, Christian Keil wrote:

> I have to add users via mysql aswell as Domains cause my whole Backend depends on it. My Users are using
Postfix.Admin whenever they create a Mailbox or a Domain right now their Data gets added into DSPAM's Database.

Oh you could just let them do everything within Baruwa.

--
Baruwa - www.baruwa.org
Christian Keil | 4 Jan 09:48 2011
Picon

Re: Aliasing Question & PDF Reports

Hello Andrew,

On Tue, Jan 4, 2011 at 9:38 AM, Andrew Colin Kissa <andrew-qeYcqAzTSW8Xhy9q4Lf3Ug@public.gmane.org> wrote:

I think this is due to the way mailscanner works with postfix, as postfix puts the messages in the hold
queue then mailscanner scans them and moves them to the delivery queue where the rewriting of
the address takes place.

The trick to get the address rewritten before mailscanner handles the message could be to use the
same logic as the splitting of recipients.

http://wiki.mailscanner.info/doku.php?id=documentation:configuration:mta:postfix:how_to:split_mails_per_recipient

YMMV as i do not use postfix so this is just a suggestion that you could test/

I am aware of that "trick" however I will loose one big thing that I really wanted my Users to see, if using split MTA's the "Mailscanner-MTA" will not be able to run RBL Checks, so my guess is that I cannot see "Listed in RBL" in the Quarantine or is there any option to let Spamassassin/Mailscanner do the trick so users see all Rejected Mails ?

I'm also Wondering if I can disable LOW Spam Score for Baruwa and simply use SPAM/HAM , I dont want to confuse my Users.

I basically just want to reject mails for non existing domains/mailboxes and put everything else into the Quarantine, its abit overhead but I have too many ppl asking for mail log checks due to rbls or policys.

Kind Regards
Christian Keil
_______________________________________________
Baruwa mailing list
Baruwa@...
http://lists.baruwa.org/mailman/listinfo/baruwa
Andrew Colin Kissa | 4 Jan 09:58 2011
Picon

Re: Aliasing Question & PDF Reports


On 04 Jan 2011, at 10:48 AM, Christian Keil wrote:

> I am aware of that "trick" however I will loose one big thing that I really wanted my Users to see, if using
split MTA's the "Mailscanner-MTA" will not be able to run RBL Checks, so my guess is that I cannot see
"Listed in RBL" in the Quarantine or is there any option to let Spamassassin/Mailscanner do the trick so
users see all Rejected Mails ?

Yes you are right, Am not sure if postfix can allow for header modification, but if it did you would be able to
work around this issue, BarricadeMX already had this support in MailScanner i have submitted a patch to
Jules to support the same for Exim which has been accepted and will be in the next release.

Which means with Exim you can split messages and still be able to use RBL's and Whitelisting from 127.0.0.1
as the correct received IP address is set not localhost (from the split)

> 
> I'm also Wondering if I can disable LOW Spam Score for Baruwa and simply use SPAM/HAM , I dont want to confuse
my Users.

Is this under the accounts or messages ?

--
Baruwa - www.baruwa.org
Christian Keil | 4 Jan 10:13 2011
Picon

Re: Aliasing Question & PDF Reports

Yes you are right, Am not sure if postfix can allow for header modification, but if it did you would be able to work around this issue, BarricadeMX already had this support in MailScanner i have submitted a patch to Jules to support the same for Exim which has been accepted and will be in the next release.

Which means with Exim you can split messages and still be able to use RBL's and Whitelisting from 127.0.0.1 as the correct received IP address is set not localhost (from the split)

That sounds very interesting, could you share your patch ? Its no problem for me to use Exim on the Incoming Machine. But I guess my best path would be to move all RBL Checks to Spamassassin and ignore 127.0.0.1
 
> I'm also Wondering if I can disable LOW Spam Score for Baruwa and simply use SPAM/HAM , I dont want to confuse my Users.

Is this under the accounts or messages ?

It appears inside the Accounts Config of a User, and also in Mailscanner aswell as in the Quarantine View. I just want to reduce from 3 States (Low Score, High Score, No Score) to SPAM/HAM.  One other thing , if a User is unknown to Baruwa due to external Auth, what is his default High Spam Score Value ? Is it 0 = disabled ?

One workaround i though of was giving the Low Score the same Color in the Quarantine View and simply removing the Edit Field from the User Settings for Low Score if I can disablw Low Score at all.



--
Baruwa - www.baruwa.org

_______________________________________________
Baruwa mailing list
Baruwa-nJFXYWEDAR/xThsfVBBi/g@public.gmane.org
http://lists.baruwa.org/mailman/listinfo/baruwa

_______________________________________________
Baruwa mailing list
Baruwa@...
http://lists.baruwa.org/mailman/listinfo/baruwa
Andrew Colin Kissa | 4 Jan 10:21 2011
Picon

Re: Aliasing Question & PDF Reports


On 04 Jan 2011, at 11:13 AM, Christian Keil wrote:

> That sounds very interesting, could you share your patch ? Its no problem for me to use Exim on the Incoming
Machine. But I guess my best path would be to move all RBL Checks to Spamassassin and ignore 127.0.0.1

Attached.

> 
> It appears inside the Accounts Config of a User, and also in Mailscanner aswell as in the Quarantine View. I
just want to reduce from 3 States (Low Score, High Score, No Score) to SPAM/HAM.  One other thing , if a User is
unknown to Baruwa due to external Auth, what is his default High Spam Score Value ? Is it 0 = disabled ?

This is a bit tricky it will involve some hacking, for the display of the info you can just change the
templates, the form's how ever you have to change that specific field to a hidden field.

> 
> One workaround i though of was giving the Low Score the same Color in the Quarantine View and simply
removing the Edit Field from the User Settings for Low Score if I can disablw Low Score at all.

Same color should work for the display, the Edit field you will have to make it hidden otherwise the form will
not validate.

> 

Attachment (ms-split-recipients-helper.patch): application/octet-stream, 607 bytes

--
Baruwa - www.baruwa.org

_______________________________________________
Baruwa mailing list
Baruwa@...
http://lists.baruwa.org/mailman/listinfo/baruwa
Andrew Colin Kissa | 4 Jan 10:28 2011
Picon

Re: Aliasing Question & PDF Reports


On 04 Jan 2011, at 11:13 AM, Christian Keil wrote:

> That sounds very interesting, could you share your patch ?

And you would have to use this 

received_header_text = Received: ${if def:sender_rcvhost {from $sender_rcvhost\n\t}{${if
def:sender_ident {from ${quote_local_part:$sender_ident} }}${if def:sender_helo_name
{(helo=$sender_helo_name)\n\t}}}}by $primary_hostname ${if def:received_protocol {with
$received_protocol}} ${if def:tls_cipher {($tls_cipher)\n\t}}(Exim $version_number)\n\t${if
def:sender_address {(envelope-from <$sender_address>)\n\t}}id $message_exim_id${if !eq
{$received_protocol}{split} { ret-id none;}{}}${if def:received_for {\n\tfor $received_for}}

and this

http://wiki.mailscanner.info/doku.php?id=documentation:configuration:mta:exim:how_to:split_mails_per_recipient

If you read the Message.pm file you will be able to understand what happens there, and what the patch does.

--
Baruwa - www.baruwa.org

Gmane