Re: [rt-users] ExtractCustomFields template and dropping errant HTML tags

2013-05-20 Thread Lundberg, Emory
Some additional information as I'm getting big blobs of text with markup in 
several fields on emails and forms that are submitted to my RT-4.0.10: 

> 2013-05-20 21:37:32 The RT System itself - FQDN you've completed this 
> form! align="center">  added 


I'm stuck on not being sure about the most appropriate way to proceed. I don't 
know if I should be trying to adjust my CustomField template to ignore HTML 
tags designated with '<', or if I should be stripping HTML at the MTA and 
forcing plain text on everybody.

I'm not using `Set($PreferRichText, 1);` because I don't know if that will even 
help with body parsing at all.

Anyone have an experience like this?

My Template for that field is written as:

>   FQDN|Body|FQDN:*([^<].*+)||


//emory

Original message below:

On May 15, 2013, at 10:39 AM, "Lundberg, Emory"  
wrote:

> I have a scrip to assign CustomFields based on a template and it often ends 
> up collecting junk like HTML tags trailing after the data I want to match.
> 
> I think I have made my regex as specific as I can, but now I'm concerned that 
> I went about this the wrong way.  I would love an opinion.
> 
> 
> 
> Emails that aren't human-generated typically have a block of data in them 
> that includes data like:
> 
> Room:Y10A
> Building:ddd
> IP:172.16.2.2,fe80::250:43ff:fe00:ed31
> MAC:DE:CA:FB:AD:11:97
> Port:ddd-1@4/40
> 
> And sometimes they're handled by applications that generate them with HTML 
> formatting, or are copy/pasted with HTML formatting, etc.
> 
> I have a CustomField called 'Building' and in my Template I have:
> 
> Building|Body|Building:*([^<]*+)\n||  
> 
> a) Is this ([^<]) necessary – or is there a way to merely ignore all HTML on 
> incoming mail before it gets handed off to rt-mailtool that is 
> preferred/better?
> b) Is there something about my Template use that is obviously wrong?


-- 
RT Training in Seattle, June 19-20: http://bestpractical.com/training


[rt-users] ExtractCustomFields template and dropping errant HTML tags

2013-05-15 Thread Lundberg , Emory
I have a scrip to assign CustomFields based on a template and it often ends up collecting junk like HTML tags trailing after the data I want to match.I think I have made my regex as specific as I can, but now I'm concerned that I went about this the wrong way.  I would love an opinion.Emails that aren't human-generated typically have a block of data in them that includes data like:Room:Y10ABuilding:dddIP:172.16.2.2,fe80::250:43ff:fe00:ed31MAC:DE:CA:FB:AD:11:97Port:ddd-1@4/40And sometimes they're handled by applications that generate them with HTML formatting, or are copy/pasted with HTML formatting, etc.I have a CustomField called 'Building' and in my Template I have:Building|Body|Building:*([^<]*+)\n||  a) Is this ([^<]) necessary – or is there a way to merely ignore all HTML on incoming mail before it gets handed off to rt-mailtool that is preferred/better?b) Is there something about my Template use that is obviously wrong?     [✔]  Never use your HawkID's email address and password anywhere else!      Emory Lundberg, Security Friend, Information Security & Policy Office      University of Iowa, UCC, Campus Phone: 5-6174 

-- 
RT Training in Seattle, June 19-20: http://bestpractical.com/training

[rt-users] Is anyone successfully using ExtractCustomFieldValues with a multiple-value IP address field?

2013-03-04 Thread Lundberg, Emory

I have a scrip and template that use ExtractCustomFieldValues to pull things 
out of the body of a message. The problem I have is that I can't seem to figure 
out how to format this for a multi-value IP address field.

What is the preferred method of inserting these IP addresses using 
ExtractCustomFieldValues?

Should they be space or comma-seperated?  Should they be looped?  Should they 
be repeated in the body of the message individually?

An example of strange behavior I'm seeing when attempting to set 
192.168.155.130 and 192.168.155.133 as values in a multi-value IP address field:

 [Mon Mar  4 22:13:34 2013] [debug]: Found value for CF: 
X-VIPS:192.168.155.130 
(/opt/rt/rt4/local/plugins/RT-Extension-ExtractCustomFieldValues/lib/RT/Action/ExtractCustomFieldValues.pm:207)
 [Mon Mar  4 22:13:34 2013] [info]: CustomFieldValue 
(VIPS,X-VIPS:192.168.155.130) added: 0 Could not add new custom field value: 
Couldn't create record: Content is an invalid IP address 
(/opt/rt/rt4/local/plugins/RT-Extension-ExtractCustomFieldValues/lib/RT/Action/ExtractCustomFieldValues.pm:213)
 [Mon Mar  4 22:13:34 2013] [debug]: Found value for CF: 192.168.155.133 
(/opt/rt/rt4/local/plugins/RT-Extension-ExtractCustomFieldValues/lib/RT/Action/ExtractCustomFieldValues.pm:207)

Needless to say I'm surely doing something wrong, I just don't know what.


-- 
RT training in Amsterdam, March 20-21: 
http://bestpractical.com/services/training.html

Help improve RT by taking our user survey: 
https://www.surveymonkey.com/s/N23JW9T

Re: [rt-users] custom actions for inserting multiple mixed v4/v6 IP addresses into a custom field

2012-11-26 Thread Lundberg, Emory

On Sep 5, 2012, at 11:00 AM, Kevin Falcone wrote:

I'd suggest looking at what RTIR's IP address parsing routines are 
doing.



To revisit this, I was able to get a scrip that would pick up the first 
occurrence of an address using a loop, but it would not pick up other 
instances of a match.


In light of that, I suspect having RTIR_FindIP.pm pick up those IP 
addresses in transactions like RTIR would be less rickety and suck-prone 
for someone that isn't me one day having the unfortunate task of 
following in my shoes, but I'm not sure how to include that 
RTIR_FindIP.pm's logic in RT.


Is it better to:

1. implement RTIR_FindIP.pm's voodoo as a scrip
2. hook RTIR_FindIP.pm and its dependancies into my RT as a local plugin
3. some other non-wrong option that I don't know?


We're hiring! http://bestpractical.com/jobs


Re: [rt-users] custom actions for inserting multiple mixed v4/v6 IP addresses into a custom field

2012-09-11 Thread Lundberg, Emory
On Sep 5, 2012, at 11:00 AM, Kevin Falcone:

> On Fri, Aug 31, 2012 at 05:49:36PM +0000, Lundberg, Emory wrote:
>> I cannot seem to get a scrip that will accept multiple comma-seperated 
>> addresses from an email (or any correspondevent for that matter), only one 
>> address will be accepted.
>> The scrip I am using is a custom action that looks like this:
> 
> I'd suggest looking at what RTIR's IP address parsing routines are
> doing.
> 
> You'll want lib/RT/Action/RTIR_FindIP.pm in the RTIR tarball.
> 
> Also, keep in mind that if you create an Multiple Value IP Address
> custom field, you still need to add your multiple values one at a time
> (like if you were adding multiple values to a normal multi-value CF).

It's my understanding that RTIR's module will snarf up all IP addresses and 
that isn't exactly what I was wanting to do.  I may be going about this in a 
weird way and I'm absolutely doing something with less resistance.

Users are filling out a form that is emailed into RT for staging new systems, 
and it would be advantageous for us to collect all the IP addresses on all 
interfaces at that time instead of one, which historically is the management IP 
address collected via scrip as X-IP.  We have a scrip that gathers up that and 
several other values in one go, and then inserts that into custom fields.  The 
reason that I'd like to avoid the RTIR approach is that those requests can have 
IP addresses in them for host ip filters or firewall policies.

I don't know how "normal multi-value" CFs behave, our other CFs are just 
one-value.  The RT cli is perfectly capable of handling multiple values for my 
new IP-addresses CF, and I cannot seem to have more than one X-IP-addresses 
match per reply/comment.  It picks up the first and then ignores the rest.

i.e.

X-IP-addresses: 127.0.0.1
X-IP-addresses: 127.0.0.2
X-IP-addresses: 127.0.0.3

would result in only `X-IP-addresses: 127.0.0.1` getting picked up.

I'm not at all opposed to being told I'm doing this in a dumb way. If adopting 
the logic in RTIR's module into a scrip for RT so that it only picks up 
addresses I tag with X-$CFNAME is the best way, I would appreciate any tips or 
suggestions to prime the pump, I am not confidant I'm approaching this right or 
understanding the recommendation.

thank you!



Final RT training for 2012 in Atlanta, GA - October 23 & 24
  http://bestpractical.com/training

We're hiring! http://bestpractical.com/jobs


[rt-users] custom actions for inserting multiple mixed v4/v6 IP addresses into a custom field.

2012-08-31 Thread Lundberg, Emory
I cannot seem to get a scrip that will accept multiple comma-seperated 
addresses from an email (or any correspondevent for that matter), only one 
address will be accepted.

The scrip I am using is a custom action that looks like this:

my $Ticket = $self->TicketObj;
my $Transaction = $self->TransactionObj;
my $body = $Transaction->Content();
my $cf = new RT::CustomField($RT::SystemUser);
my $id;
my $msg;
my $queue = 'Testes';

#---IPS
if($body =~ /X-addresses\:(.*)\n/i){
my $iplist = $1;
($id,$msg) = $cf->LoadByNameAndQueue (Name=>'ip-addresses', 
Queue=>$queue);
($id,$msg) = $Ticket->AddCustomFieldValue (Field => $cf, Value 
=>$iplist);
}
return(1);

I'm not opposed to being told I'm going about this the wrong way; present 
practice for my RT install is to have a web form submit requests, currently 
that request will have an IP address field that is picked up by a similar scrip 
(in addition to x-fqdn, x-contact, x-OS, and other information being collected) 
and I was thinking a comma-seperated list of mixed ipv4,ipv6 could be snarfed 
in one line and, as long as RT's address parser validated it, we'd be in 
business.



✔ Never use your HawkID's email address and password anywhere else!
   Emory Lundberg, Security Friend
   Information Security & Policy Office, University of Iowa