[rt-users] custom actions for inserting multiple mixed v4/v6 IP addresses into a custom field.
Kevin Falcone
falcone at bestpractical.com
Tue Sep 4 13:24:10 EDT 2012
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).
-kevin
> 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
>
>
>
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20120904/7cc310df/attachment.sig>
More information about the rt-users
mailing list