Bug 50620

Summary: False positives in system diagnostics when http_proxy is used
Product: UCS Reporter: Philipp Hahn <hahn>
Component: UMC - System diagnosticAssignee: Christian Castens <castens>
Status: CLOSED FIXED QA Contact: Florian Best <best>
Severity: normal    
Priority: P5 CC: ahrnke, best, castens, damrose, fg, grandjean, gulden, info, scheinig, schnick, voelker
Version: UCS 4.4   
Target Milestone: UCS 5.0-0-errata   
Hardware: Other   
OS: Linux   
See Also: https://forge.univention.org/bugzilla/show_bug.cgi?id=51682
https://forge.univention.org/bugzilla/show_bug.cgi?id=49151
What kind of report is it?: Bug Report What type of bug is this?: 5: Major Usability: Impairs usability in key scenarios
Who will be affected by this bug?: 3: Will affect average number of installed domains How will those affected feel about the bug?: 2: A Pain – users won’t like this once they notice it
User Pain: 0.171 Enterprise Customer affected?: Yes
School Customer affected?: Yes ISV affected?:
Waiting Support: Flags outvoted (downgraded) after PO Review:
Ticket number: 2020011421000538, 2020072421000508, 2020070321000299, 2020080321000564, 2020082521000273, 2020122821000214 Bug group (optional): External feedback, Regression
Max CVSS v3 score:
Bug Depends on:    
Bug Blocks: 53575    

Description Philipp Hahn univentionstaff 2019-12-10 16:44:43 CET
Situation: Internal DNS does not resolve external addresses. Access to internet only works through http-proxy.

Running the diagnostic checks fails:

univention-run-diagnostic-checks --username Administrator --bindpwdfile <(echo -n univention) -t 11_nameserver
  timeout resolving 'www.univention.de' with NS X.X.X.X

univention-run-diagnostic-checks --username Administrator --bindpwdfile <(echo -n univention) -t 12_proxy
  Failed writing body (0 != 8088) (code=23)

univention-run-diagnostic-checks --username Administrator --bindpwdfile <(echo -n univention) -t 23_check_update_sites
  {updates,appcenter}.software-univention.de are not resolvable
  The PROXY server does that, the host itself does not need to be able to resolve the host
Comment 1 Philipp Hahn univentionstaff 2019-12-10 16:45:11 CET
TT: 2019-12-09/10
Comment 2 Christina Scheinig univentionstaff 2020-01-14 14:54:55 CET
(In reply to Philipp Hahn from comment #0)
> Situation: Internal DNS does not resolve external addresses. Access to
> internet only works through http-proxy.
> 
> Running the diagnostic checks fails:

> univention-run-diagnostic-checks --username Administrator --bindpwdfile
> <(echo -n univention) -t 12_proxy
>   Failed writing body (0 != 8088) (code=23)
> 


A customer has this issue in two environments, after an update to 4.4-3 e413
Comment 3 Philipp Hahn univentionstaff 2020-06-19 17:10:04 CEST
TT: 2020-06-18/19
TT: 2020-05-14/15
TT: 2020-04-23/24
Comment 5 Dirk Schnick univentionstaff 2020-08-04 07:38:04 CEST
Added affected customers and ticket numbers I had to spend time on this issue (was not the main problem of the ticket, but had to explain the critical alert)
Comment 6 Christian Völker univentionstaff 2020-08-04 10:33:59 CEST
Same again... adding ticket.
Comment 7 Frank Greif 2020-08-24 20:16:38 CEST
Seems to me that 12_proxy.py does never succeed as soon as a proxy is set. I got used to tell my customers they only have to allow www.univention.de (http and https) in their proxy, but this never cured the problem.

You always get the write error (23) no matter if the proxy allows access.

I'd suspect the culprit to be line 53:

buf = io.StringIO()

which was changed from StringIO.StringIO() somewhere along the lines of Python3 preparation.

According to the docs http://pycurl.io/docs/latest/callbacks.html#writefunction the write function only accepts bytes strings, while io.StringIO requires unicode.

Changing line 53 to read

buf = io.BytesIO()

made it work.
Comment 8 Philipp Hahn univentionstaff 2020-08-26 18:38:59 CEST
Another major customer is affected by this.
Comment 9 Philipp Hahn univentionstaff 2020-11-18 17:18:25 CET
TT: 2020-11-19/20

diff --git a/management/univention-management-console-module-diagnostic/umc/python/diagnostic/plugins/12_proxy.py b/management/univention-management-console-module-diagnostic/umc/python/diagnostic/plugins/12_proxy.py
index f9e823c8d2..77d4b7ba45 100644
--- a/management/univention-management-console-module-diagnostic/umc/python/diagnostic/plugins/12_proxy.py
+++ b/management/univention-management-console-module-diagnostic/umc/python/diagnostic/plugins/12_proxy.py
@@ -50,7 +50,7 @@ def run(_umc_instance, url='http://www.univention.de/', connecttimeout=30, timeo
        curl.setopt(pycurl.URL, url)
        # curl.setopt(pycurl.VERBOSE, bVerbose)
 
-       buf = io.StringIO()
+       buf = io.BytesIO()
        curl.setopt(pycurl.WRITEFUNCTION, buf.write)
        MODULE.process(''.join("Trying to connect to %s via HTTP proxy %s" % (url, proxy)))
Comment 11 Dirk Ahrnke univentionstaff 2021-02-19 16:47:45 CET
TT: 2021-02-18/19
Comment 12 Christian Castens univentionstaff 2021-07-13 17:03:01 CEST
The patch from one of the previous comments has been applied.


5.0-0:
3936c2a2a47cd20a7f9f9d028e844943dedb053a (changes)
ab309682fd0c7ee244e492e008e6ac1475e42bfb (yaml)

Package: univention-management-console-module-diagnostic
Version: 6.0.0-13A~5.0.0.202107131648
Branch: ucs_5.0-0
Scope: errata5.0-0
Comment 13 Florian Best univentionstaff 2021-07-15 11:59:30 CEST
OK: fix
OK: code review
OK: YAML