RT talking to RT

We are probably an unusual RT user because a significant number of the
tickets in our RT system are created by us, for external requestors.
(When we spot a problem, we create a new RT ticket and send mail to
the responsible party.)

We have currently extended our network monitoring to detect anomalies
involving external hosts, so we send report to people who run their
own trouble ticket system (surprisingly often RT! ;-). Some of them
discard the subject (we can fix this easily by using per-ticket email
addresses), and most of them write their own tracking number into the
subject. The subject associated with our ticket does not contain this
tracking information, and it has to be added manually.

I think I’m going to implement the following: On ticket creation, the
requestor receives a message with a special email address which
includes the ticket ID and an additional suffix ("-first" maybe).
When the mail gateway receives a message to such an address, it checks
whether the subject of the ticket has already been changed (by
searching for such a transaction). If no subject change occured, the
ticket subject is modified to match that of the incoming reply.

Does this seem sound? Has anybody implemented it already? :wink:

Florian Weimer Weimer@CERT.Uni-Stuttgart.DE
University of Stuttgart http://CERT.Uni-Stuttgart.DE/people/fw/
RUS-CERT fax +49-711-685-5898

Hi,

Florian Weimer wrote:

.When the mail gateway receives a message to such an address, it checks
whether the subject of the ticket has already been changed (by
searching for such a transaction). If no subject change occured, the
ticket subject is modified to match that of the incoming reply.

Does this seem sound? Has anybody implemented it already? :wink:

The problem was to get the mail from the MTA to the mailgate. With
postfix you could use something like "rt+1234@example.com" as address
and configure postfix with “recipient_delimiter = +” in main.cf .
Postfix then should do most recipient lookups (including aliases)
using “rt” as local part. Guess other MTA’s can be configured simmilliar.

Ciao
Andreas

smime.p7s (3.55 KB)

Andreas Hofmeister Andreas.Hofmeister@solutions.pyramid.de writes:

Does this seem sound? Has anybody implemented it already? :wink:

The problem was to get the mail from the MTA to the mailgate.

This is, actually, the trivial part. Our Exim routers looks like
this:

If the local part is a number, or a number followed by either

“-comment” or “-bounce”, this is mail for a specific ticket.

rt_ticket:
domains = +rt_domains
driver = accept
local_part_suffix = -comment : -bounce
local_part_suffix_optional
condition = ${if match{$local_part}{^[0-9]+$}{yes}{no}}
transport = rt_ticket_transport

Some people write “-comments”, erroneously.

rt_ticket_comments:
domains = +rt_domains
driver = redirect
local_part_suffix = -comments
data = $local_part-comment@$domain

All other mail is for some queue, possibly a comment.

rt_queue:
domains = +rt_domains
driver = accept
local_part_suffix = -comment
local_part_suffix_optional
condition = ${if match{$local_part}{^[a-z\-]+$}{yes}{no}}
transport = rt_queue_transport

Obviously, you have to use a dedicated domain to make the last one
work, and you have to catch the well-known mailboxes (such as
"postmaster") earlier.

Florian Weimer Weimer@CERT.Uni-Stuttgart.DE
University of Stuttgart http://CERT.Uni-Stuttgart.DE/people/fw/
RUS-CERT fax +49-711-685-5898

Florian Weimer wrote:

Andreas Hofmeister Andreas.Hofmeister@solutions.pyramid.de writes:

Does this seem sound? Has anybody implemented it already? :wink:

The problem was to get the mail from the MTA to the mailgate.

This is, actually, the trivial part. Our Exim routers looks like
this:

Mhh, one could do similar things with regex virtual domain ‘tables’ in
postfix. However, you can not use pcre’s for aliases with postfix, so
postfix users had to use virtual domains to use your nice extension :frowning:

Ciao
Andreas

smime.p7s (3.55 KB)

Mhh, one could do similar things with regex virtual domain ‘tables’ in
postfix. However, you can not use pcre’s for aliases with postfix, so
postfix users had to use virtual domains to use your nice extension :frowning:

In fact, rt.cpan.org does just that. I have a virtual map of type
"regexp" that looks like this:

/^comment-(.)@rt.cpan.org$/ cpan-comment+$1@pallas.eruditorum.org
/^comment(.
)@bugs.cpan.org$/ cpan-comment+$1@pallas.eruditorum.org
/^comment-(.)@rt-cpan.fsck.com$/ cpan-comment+$1@pallas.eruditorum.org
/^bug-(.
)@rt.cpan.org$/ cpan-bug+$1@pallas.eruditorum.org
/^bug-(.)@bugs.cpan.org$/ cpan-bug+$1@pallas.eruditorum.org
/^bug-(.
)@rt-cpan.fsck.com$/ cpan-bug+$1@pallas.eruditorum.org

and lines in /etc/aliases that look like this:

cpan-bug: "|/opt/rt-cpan/bin/mailaudit /opt/rt-cpan/bin/rt-mailgate --queue-from-extension --action ‘correspond’"
cpan-comment: “|/opt/rt-cpan/bin/mailaudit /opt/rt-cpan/bin/rt-mailgate --queue-from-extension --action ‘comment’”

But yes, the hard part here is keeping track of the remote ticket ID, so
that you don’t accidentally create a bunch of tickets at the remote
site. If everyone used ticket-specific addresses, it would be easy.

But florian’s idea of setting up a scrip to scrape subject changes from
autreplies seems clever enough to deal with most sites. I’d love to see
the scrip used to implement that.

Best,
Jesse

»|« http://www.bestpractical.com/rt – Trouble Ticketing. Free.

Jesse Vincent jesse@bestpractical.com writes:

But yes, the hard part here is keeping track of the remote ticket ID, so
that you don’t accidentally create a bunch of tickets at the remote
site. If everyone used ticket-specific addresses, it would be easy.

Well, no. You would have to reset the requestor, which is even more
troublesome: you might leak your conversation to unauthorized third
parties.

Florian Weimer Weimer@CERT.Uni-Stuttgart.DE
University of Stuttgart http://CERT.Uni-Stuttgart.DE/people/fw/
RUS-CERT fax +49-711-685-5898

Jesse Vincent jesse@bestpractical.com writes:

But florian’s idea of setting up a scrip to scrape subject changes from
autreplies seems clever enough to deal with most sites. I’d love to see
the scrip used to implement that.

Well, here it is.

I’ve split it into two parts, a condition which fires for the first
transaction of its kind, and the action changing the section. (I hope
these scrips will work with the official RT version, and not just our
slightly modified one.)

I’ll keep the files at
http://cert.uni-stuttgart.de/projects/rt/snippets/ updated to match
our production version.

Florian Weimer Weimer@CERT.Uni-Stuttgart.DE
University of Stuttgart http://CERT.Uni-Stuttgart.DE/people/fw/
RUS-CERT fax +49-711-685-5898

FirstTransaction.pm (1.3 KB)

AdoptSubject.pm (1.58 KB)