Display ip addresses + hostnames in tickets and notifications

Dont create your support topics here! No new topics with questions allowed!

Moderator: crythias

gears
OTRS newbie
Posts: 35
Joined: 24 Feb 2011, 18:29
OTRS Version?: 5.0.14

Display ip addresses + hostnames in tickets and notifications

Postby gears » 08 Dec 2016, 22:57

This is a 5.0 updated followup and expansion on previous 3.0 writeup at http://forums.otterhub.org/viewtopic.php?f=60&t=9023
Credit to helpful posts learned from:
http://forums.otterhub.org/viewtopic.php?t=30458
http://forums.otterhub.org/viewtopic.php?t=28863





Create dynamic fields with naming & labeling of your choice corresponding to data you want to query from clients at Admin >> dynamic fields (otrs/index.pl?Action=AdminDynamicField) -
Name Label
TicketFreeText1 Client.IP
TicketFreeText2 Client.Host
TicketFreeText4 X-SOURCE-IP
TicketFreeText5 X-ORIGINATING-IP


sysconfig changes -

Edit Config Settings in Ticket ? Frontend::Customer::Ticket::ViewNew
Ticket::Frontend::CustomerTicketMessage###DynamicField
TicketFreeText1 - 1
TicketFreeText2 - 1


Edit Config Settings in Ticket ? Frontend::Agent::Ticket::ViewZoom
Ticket::Frontend::AgentTicketZoom###DynamicField
TicketFreeText1 - 1
TicketFreeText2 - 1
TicketFreeText4 - 1
TicketFreeText5 - 1


Edit Config Settings in Ticket ? Frontend::Agent::Ticket::ViewFreeText
Ticket::Frontend::AgentTicketFreeText###DynamicField
TicketFreeText1 - 1
TicketFreeText2 - 1
TicketFreeText4 - 1
TicketFreeText5 - 1


Edit Config Settings in Ticket ? Core::PostMaster PostmasterX-Header
Add the email header fields you want, in this example it's x-source-ip & x-originating-ip


Add the new mail header fields to be scanned by postmaster mail filter at /otrs/index.pl?Action=AdminPostMasterFilter
in new postmaster filter "get-x-source-ip"-
filter condition - check mail header - x-source-ip - look for value: (.*)
set email headers - x-otrs-dynamicfield-ticketfreetext4 - set value [***]

in new postmaster filter "get-x-originating-ip"
filter condition - check mail header - x-originating-ip - look for value: \[(.*)\]
(regex escapes brackets for this one due to the format of our own headers)
set email headers - x-otrs-dynamicfield-ticketfreetext5 - set value [***]



To query ip + hostname of customers submitting tickets via web add the following code at the very end of /opt/otrs/Kernel/Output/HTML/Templates/Standard/CustomerTicketMessage.tt -

Code: Select all

[% WRAPPER JSOnDocumentComplete %]
<script type="text/javascript">
$(function() {
var ip = '[% Env("REMOTE_ADDR") | html %]';
$('#DynamicField_TicketFreeText1').parent().addClass( 'Hidden' );
$('#LabelDynamicField_TicketFreeText1').parent().addClass( 'Hidden' );
$('#DynamicField_TicketFreeText1').val(ip);

var host = '[% Env("REMOTE_HOST") | html %]';
$('#DynamicField_TicketFreeText2').parent().addClass( 'Hidden' );
$('#LabelDynamicField_TicketFreeText2').parent().addClass( 'Hidden' );
$('#DynamicField_TicketFreeText2').val(host);

});
</script>
[% END %]




Add to ticket create notifications (/otrs/index.pl?Action=AdminNotificationEvent) -

Code: Select all

Client IP: <OTRS_TICKET_DynamicField_TicketFreeText1>
Client Host: <OTRS_TICKET_DynamicField_TicketFreeText2>
X-Originating-IP: <OTRS_TICKET_DynamicField_TicketFreeText5>
X-Source-IP: <OTRS_TICKET_DynamicField_TicketFreeText4>




Notes for our own Debian environment -
"hostnameLookups On" should be in /etc/apache2/conf.d/otrs.conf
Hostnames only resolve for clients on domain of dns server in the first slot in /etc/resolv.conf, reverse dns zones required to get hostname of clients on second domain is not available on that primary dns server.
OTRS 5.0.14 / Debian 7.11 x64 / Apache 2.2.22 / MySQL 14.14 Distrib 5.5.53

Return to “Howtos”

Who is online

Users browsing this forum: No registered users and 3 guests

cron