Bug 1384871 - pflogsumm: many warnings when parsing logs with IPv6 addresses
Summary: pflogsumm: many warnings when parsing logs with IPv6 addresses
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: postfix
Version: 25
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jaroslav Škarvada
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-10-14 10:35 UTC by Dominik 'Rathann' Mierzejewski
Modified: 2017-06-19 14:35 UTC (History)
2 users (show)

Fixed In Version: postfix-3.1.4-2.fc25 postfix-3.2.2-1.fc26
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-06-16 18:51:57 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Dominik 'Rathann' Mierzejewski 2016-10-14 10:35:13 UTC
Description of problem:
pflogsumm emits many warnings (to stderr) when maillog contains IPv6 addresses.

Version-Release number of selected component (if applicable):
postfix-perl-scripts-3.0.7-1.fc23.x86_64

How reproducible:
Always.

Steps to Reproduce:
1. Given /var/log/maillog containing lines like:
Oct 13 00:33:24 doumeki postfix/smtpd[9148]: disconnect from localhost[::1] ehlo=1 mail=1 rcpt=1 data=1 commands=4
Oct 13 01:29:12 doumeki postfix/smtpd[14127]: disconnect from se01.ovh6.rpmfusion.net[2001:41d0:2:ad32::1] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
Oct 13 02:21:47 doumeki postfix/smtpd[18076]: disconnect from mail-yb0-x22e.google.com[2607:f8b0:4002:c09::22e] ehlo=2 starttls=1 mail=1 rcpt=1 data=1 quit=1 commands=7
2. /usr/sbin/pflogsumm -q -d yesterday -h 10 --ignore_case --smtpd_warning_detail=0 --mailq --problems_first --smtpd_stats --verp_mung=2 --zero_fill /var/log/maillog

Actual results:
Use of uninitialized value $domain in string eq at /usr/sbin/pflogsumm line 1539, <> line 62693.
Use of uninitialized value $domain in substitution (s///) at /usr/sbin/pflogsumm line 1545, <> line 62693.
Use of uninitialized value $hostID in hash element at /usr/sbin/pflogsumm line 768, <> line 62693.
Use of uninitialized value $hostID in hash element at /usr/sbin/pflogsumm line 769, <> line 62693.
Use of uninitialized value $hostID in hash element at /usr/sbin/pflogsumm line 770, <> line 62693.
Use of uninitialized value $hostID in hash element at /usr/sbin/pflogsumm line 772, <> line 62693.
Use of uninitialized value $hostID in hash element at /usr/sbin/pflogsumm line 774, <> line 62693.
Use of uninitialized value $hostID in hash element at /usr/sbin/pflogsumm line 773, <> line 62693.
Use of uninitialized value $domain in string eq at /usr/sbin/pflogsumm line 1539, <> line 63259.
Use of uninitialized value $domain in substitution (s///) at /usr/sbin/pflogsumm line 1545, <> line 63259.
Use of uninitialized value $hostID in hash element at /usr/sbin/pflogsumm line 768, <> line 63259.
Use of uninitialized value $hostID in hash element at /usr/sbin/pflogsumm line 772, <> line 63259.
Use of uninitialized value $hostID in hash element at /usr/sbin/pflogsumm line 774, <> line 63259.
Use of uninitialized value $domain in string eq at /usr/sbin/pflogsumm line 1539, <> line 64377.
Use of uninitialized value $domain in substitution (s///) at /usr/sbin/pflogsumm line 1545, <> line 64377.
Use of uninitialized value $hostID in hash element at /usr/sbin/pflogsumm line 768, <> line 64377.
Use of uninitialized value $hostID in hash element at /usr/sbin/pflogsumm line 772, <> line 64377.
Use of uninitialized value $hostID in hash element at /usr/sbin/pflogsumm line 774, <> line 64377.
Use of uninitialized value $hostID in hash element at /usr/sbin/pflogsumm line 773, <> line 64377.

(lines 62693, 63259 and 64377 are posted above)

Expected results:
No perl warnings in the output.

Additional info:
It looks like parsing in the gimme_domain function doesn't support IPv6 addresses. Here's a patch that fixes it for me:

--- /usr/sbin/pflogsumm	2016-10-03 13:39:01.000000000 +0200
+++ /root/bin/pflogsumm	2016-10-14 12:22:34.851472588 +0200
@@ -1529,7 +1529,7 @@
     # split domain/ipaddr into separates
     # newer versions of Postfix have them "dom.ain[i.p.add.ress]"
     # older versions of Postfix have them "dom.ain/i.p.add.ress"
-    unless((($domain, $ipAddr) = /^([^\[]+)\[((?:\d{1,3}\.){3}\d{1,3})\]/o) == 2 ||
+    unless((($domain, $ipAddr) = /^([^\[]+)\[((?:\d{1,3}\.){3}\d{1,3}|[0-9a-f:]+)\]/o) == 2 ||
            (($domain, $ipAddr) = /^([^\/]+)\/([0-9a-f.:]+)/oi) == 2) {
 	# more exhaustive method
         ($domain, $ipAddr) = /^([^\[\(\/]+)[\[\(\/]([^\]\)]+)[\]\)]?:?\s*$/o;

Comment 1 Dominik 'Rathann' Mierzejewski 2016-10-14 10:37:11 UTC
The pflogsumm script itself is version 1.1.3 and I noticed there's a newer version (1.1.5) on the upstream website (http://jimsun.linxnet.com/postfix_contrib.html), though it's labelled beta and has the same issue with IPv6.

Comment 2 Fedora End Of Life 2016-11-25 09:37:55 UTC
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '23'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 3 Dominik 'Rathann' Mierzejewski 2016-11-25 18:52:59 UTC
Still reproducible in F24:
postfix-perl-scripts-3.1.3-1.fc24.x86_64

pflogsumm script is unchanged from postfix-perl-scripts-3.0.7-1.fc23.

Comment 4 Dominik 'Rathann' Mierzejewski 2017-06-12 08:16:55 UTC
Still reproducible in F25:
postfix-perl-scripts-3.1.4-1.fc25.x86_64

pflogsumm script still unchanged. The above patch still applies. Please forward it upstream.

Comment 5 Jaroslav Škarvada 2017-06-13 16:43:59 UTC
Thanks, patch sent upstream. I will apply it to f25+ and probably also update the script to 1.1.5 beta in rawhide.

Comment 6 Fedora Update System 2017-06-13 18:16:18 UTC
postfix-3.2.1-1.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-9d3185b14b

Comment 7 Fedora Update System 2017-06-13 18:28:27 UTC
postfix-3.1.4-2.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2017-839f2b365c

Comment 8 Fedora Update System 2017-06-14 09:44:54 UTC
postfix-3.2.2-1.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-48ae31f568

Comment 9 Fedora Update System 2017-06-15 10:57:41 UTC
postfix-3.1.4-2.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-839f2b365c

Comment 10 Fedora Update System 2017-06-15 13:59:54 UTC
postfix-3.2.2-1.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-48ae31f568

Comment 11 Fedora Update System 2017-06-16 18:51:57 UTC
postfix-3.1.4-2.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.

Comment 12 Fedora Update System 2017-06-19 14:35:06 UTC
postfix-3.2.2-1.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.