Bug 39509 - get_notifier_id.py fails on IPv6 systems.
get_notifier_id.py fails on IPv6 systems.
Product: UCS
Classification: Unclassified
Component: Listener (univention-directory-listener)
UCS 4.0
Other Linux
: P5 normal (vote)
: UCS 4.1-2-errata
Assigned To: Philipp Hahn
Arvid Requate
Depends on:
  Show dependency treegraph
Reported: 2015-10-09 13:41 CEST by Bastian Reitemeier
Modified: 2016-07-21 15:16 CEST (History)
5 users (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:

proposed patch (417 bytes, patch)
2015-11-05 12:22 CET, Bastian Reitemeier
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bastian Reitemeier univentionstaff 2015-10-09 13:41:47 CEST
nagios/plugins/check_univention_replication cannot generate a notifier id on  systems where the master hostname is resolved as an IPv6 address.

nagios/plugins/check_univention_replication uses management/univention-directory-listener/python/get_notifier_id.py to get the notifier id. This script uses a tcp socket to communicate with the master, which is initialized as socket.AF_INET and therefore not able to connect over IPv6:

        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        sock.connect((master, 6669))

        sock.send('Version: 2\nCapabilities: \n\n')

        sock.send('MSGID: 1\nGET_ID\n\n')
        notifier_result = sock.recv(100)

        if notifier_result:
            print "%s" % notifier_result.splitlines()[1]
    except socket.error, ex:
        print >> sys.stderr, 'Error: %s' % (ex,)

This results in most tests in ucs-test to fail like this, with nid set to
"Error: [Errno -2]".

[2015-10-05 12:59:04.198281]CRITICAL: no change of listener transaction id for last 0 checks (nid=Error: [Errno -2] Name or service not known lid=314)
[2015-10-05 12:59:05.254182]CRITICAL: no change of listener transaction id for last 0 checks (nid=Error: [Errno -2] Name or service not known lid=314)
[2015-10-05 13:04:20.786333]CRITICAL: no change of listener transaction id for last 0 checks (nid=Error: [Errno -2] Name or service not known lid=314)
[2015-10-05 13:04:21.835229]CRITICAL: no change of listener transaction id for last 0 checks (nid=Error: [Errno -2] Name or service not known lid=314)
[2015-10-05 13:04:22.838307]Error: replication incomplete.
Comment 1 Bastian Reitemeier univentionstaff 2015-11-05 12:22:36 CET
Created attachment 7250 [details]
proposed patch
Comment 2 Bastian Reitemeier univentionstaff 2015-11-05 12:25:34 CET
I propose the attached patch, which uses socket.create_connection(), which is higher level than socket.socket().connect(), and is able to detect the correct protocol version.

Tested (by hand) on an ipv4 and an ipv6 setup.
Comment 3 Sönke Schwardt-Krummrich univentionstaff 2016-02-10 09:12:50 CET
This bug breaks all ucs-test scripts in IPv6 environments using wait_for_replication.
Comment 4 Philipp Hahn univentionstaff 2016-06-07 18:07:39 CEST
r69890 | Bug #39509 UDL: Add IPv6 support for get_notifier_id.py

Package: univention-directory-listener
Version: 10.0.0-11.315.201606071717
Branch: ucs_4.1-0
Scope: errata4.1-2

r69910 | Bug #22383,Bug #30227,Bug #30263,Bug #34324,Bug #34507,Bug #34738,Bug #3490,Bug #38696,Bug #39509,Bug #40600,Bug #41261: UDL YAML
Comment 5 Philipp Hahn univentionstaff 2016-06-07 18:15:06 CEST
r69891 | Bug #39509 UDL: autopep8
Comment 6 Arvid Requate univentionstaff 2016-07-13 18:40:29 CEST
See Bug 28232 Comment 3.
Comment 7 Philipp Hahn univentionstaff 2016-07-18 15:19:58 CEST
(In reply to Arvid Requate from comment #6)
> See Bug 28232 Comment 3.

r71061 | Bug #39509 UDL: Make tab-lovers happy again
Comment 8 Arvid Requate univentionstaff 2016-07-18 17:51:23 CEST
Code: review: Ok
Advisory: Ok
Comment 9 Janek Walkenhorst univentionstaff 2016-07-21 15:16:10 CEST