(ab)use of --extension with rt-mailgate

Hi,

I’ve had a situation for a while where mail sent to several addresses all goes to the same queue, but I’d like to set ownership automatically based on which address it was actually sent to. Also I’d like to keep the address->owner mapping out of RT, ideally in the aliases file where the address->queue mapping is.

When looking to see if I could hack on rt-mailgate to enable this to happen, I found the code for the --extension parameter could put stuff into the X-RT-Mail-Extension header of the message. It only seems to be documented for certain values, but it will allow anything to go into the header.

So I’ve implemented a solution where my aliases file says:

bob: “|/path/to/rt/bin/rt-mailgate --queue Main --action correspond --url http://rt.example.org/ --extension for-bob”

And an on-create scrip that checks for the header and if it matches /^for-(\w+)/, try and give ownership to the matched value as a username.

Since this isn’t a documented use of this feature, I’d like some community feedback. So is it one or more of the below:

a) That’s stupid - there’s an easier way to do that which is…

b) That’s gonna break if you upgrade to a future version (We’re currently on 3.8.2)

c) That’s a massive security hole

d) That’s pretty neat, can you put it up in the wiki?

Thanks

Carl

 Carl Vincent             http://www.netskills.ac.uk/ (URL)
 Systems Manager                       0191 222 5003 (voice)
 Netskills, Newcastle University       0191 222 5001  (fax)
             Netskills is a JISC Advance service
    Training  -  Development  -  Research  -  Innovation

We’re using an exim filter to take care of this.

All the mail is pulled in through fetchmail, and handed to the local mailserver, for the RT user.
The RT user has an exim filter that checks the header_to: header against a number of addresses, each with its own delivery pipe.

We’re doing a few other things with it, like restricting which addresses can create tickets, and running big mails through altermime to strip attachments.

Steve Anderson-----Original Message-----
From: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Carl Vincent
Sent: 19 August 2010 4:42 PM
To: rt-users@lists.bestpractical.com
Subject: [rt-users] (ab)use of --extension with rt-mailgate

Hi,

I’ve had a situation for a while where mail sent to several addresses all goes to the same queue, but I’d like to set ownership automatically based on which address it was actually sent to. Also I’d like to keep the address->owner mapping out of RT, ideally in the aliases file where the address->queue mapping is.

When looking to see if I could hack on rt-mailgate to enable this to happen, I found the code for the --extension parameter could put stuff into the X-RT-Mail-Extension header of the message. It only seems to be documented for certain values, but it will allow anything to go into the header.

So I’ve implemented a solution where my aliases file says:

bob: “|/path/to/rt/bin/rt-mailgate --queue Main --action correspond --url http://rt.example.org/ --extension for-bob”

And an on-create scrip that checks for the header and if it matches /^for-(\w+)/, try and give ownership to the matched value as a username.

Since this isn’t a documented use of this feature, I’d like some community feedback. So is it one or more of the below:

a) That’s stupid - there’s an easier way to do that which is…

b) That’s gonna break if you upgrade to a future version (We’re currently on 3.8.2)

c) That’s a massive security hole

d) That’s pretty neat, can you put it up in the wiki?

Thanks

Carl

 Carl Vincent             http://www.netskills.ac.uk/ (URL)
 Systems Manager                       0191 222 5003 (voice)
 Netskills, Newcastle University       0191 222 5001  (fax)
             Netskills is a JISC Advance service
    Training  -  Development  -  Research  -  Innovation

RT Training in Washington DC, USA on Oct 25 & 26 2010
Last one this year – Learn how to get the most out of RT!

This email has been scanned by Netintelligence
http://www.netintelligence.com/email

BiP Solutions Limited is a company registered in Scotland with Company
Number SC086146 and VAT number 383030966 and having its registered
office at Medius, 60 Pacific Quay, Glasgow, G51 1DZ.

This e-mail (and any attachment) is intended only for the attention of
the addressee(s). Its unauthorised use, disclosure, storage or copying
is not permitted. If you are not the intended recipient, please destroy
all copies and inform the sender by return e-mail.
This e-mail (whether you are the sender or the recipient) may be
monitored, recorded and retained by BiP Solutions Ltd.
E-mail monitoring/ blocking software may be used, and e-mail content may
be read at any time.You have a responsibility to ensure laws are not
broken when composing or forwarding e-mails and their contents.

Hi,

I’ve had a situation for a while where mail sent to several addresses all goes to the same queue, but I’d like to set ownership automatically based on which address it was actually sent to. Also I’d like to keep the address->owner mapping out of RT, ideally in the aliases file where the address->queue mapping is.

When looking to see if I could hack on rt-mailgate to enable this to happen, I found the code for the --extension parameter could put stuff into the X-RT-Mail-Extension header of the message. It only seems to be documented for certain values, but it will allow anything to go into the header.

So I’ve implemented a solution where my aliases file says:

bob: “|/path/to/rt/bin/rt-mailgate --queue Main --action correspond --url http://rt.example.org/ --extension for-bob”

And an on-create scrip that checks for the header and if it matches /^for-(\w+)/, try and give ownership to the matched value as a username.

Why your scrip doesn’t just look at the Delivered-To header of the mail
??

Carl,

We have over a hundred Queues. Each one has a distinct email email
correspond address. that way, any email sen to that address automatically
gets into the correct Queue. That allows us to create scrips specifically
for each Queue that will auto-assign an owner to the new ticket. We think
that’s a simpler way of doing it without all that hacking of a
mailgate.“KISS”.

Kenn
LBNLOn Thu, Aug 19, 2010 at 9:10 AM, Emmanuel Lacour elacour@easter-eggs.comwrote:

On Thu, Aug 19, 2010 at 04:42:29PM +0100, Carl Vincent wrote:

Hi,

I’ve had a situation for a while where mail sent to several addresses all
goes to the same queue, but I’d like to set ownership automatically based on
which address it was actually sent to. Also I’d like to keep the
address->owner mapping out of RT, ideally in the aliases file where the
address->queue mapping is.

When looking to see if I could hack on rt-mailgate to enable this to
happen, I found the code for the --extension parameter could put stuff into
the X-RT-Mail-Extension header of the message. It only seems to be
documented for certain values, but it will allow anything to go into the
header.

So I’ve implemented a solution where my aliases file says:

bob: “|/path/to/rt/bin/rt-mailgate --queue Main --action correspond --url
http://rt.example.org/ --extension for-bob”

And an on-create scrip that checks for the header and if it matches
/^for-(\w+)/, try and give ownership to the matched value as a username.

Why your scrip doesn’t just look at the Delivered-To header of the mail
??

RT Training in Washington DC, USA on Oct 25 & 26 2010
Last one this year – Learn how to get the most out of RT!