Bug 27815 - squid config überarbeiten
squid config überarbeiten
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: Squid
UCS 3.0
Other Linux
: P5 minor (vote)
: UCS 3.1
Assigned To: Florian Best
Felix Botner
: interim-1
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-04 10:56 CEST by Florian Best
Modified: 2012-12-12 21:08 CET (History)
2 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): Cleanup
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2012-07-04 10:56:59 CEST
Im aktuellen squid.conf template werden UCR variablen mit var == 'yes' ausgewertet. Da sollte ucr.is_true verwendet werden.

$ grep -n "'yes'" squid.conf 
44:if configRegistry.get( 'squid/cache', 'yes' ).lower() in ( 'no', 'false' ):
50:if 'yes' in [ configRegistry.get('squid/virusscan', ''), configRegistry.get('squid/contentscan', '') ]:
59:     if configRegistry.get('squid/transparentproxy','no').lower() in ['yes', 'true']:
82:if configRegistry['squid/ntlmauth'] == 'yes':
93:if configRegistry['squid/basicauth'] == 'yes':
155:    if not 'yes' in [ configRegistry.get('squid/virusscan', ''), configRegistry.get('squid/contentscan', '') ]:

zusätzlich werden Ports ab und zu als strings behandelt (%s → %d + defaultwerttyp sollte int sein)

$ grep -n configRegistry squid.conf  | grep port
53:             squidport = int(configRegistry.get('squid/httpport', '3128'))+1
61:     print "http_port %s %s" % ( configRegistry.get('squid/httpport', '3128'), transparent )
65:for port in configRegistry.get('squid/webports', '80 443 21').split(" "):
98:     auth += ' -p '  + configRegistry.get("ldap/server/port", '7389')
122:            ldapGroup += ' -p '  + configRegistry.get("ldap/server/port", "7389")
214:    print 'cache_peer '+configRegistry['squid/parent/host']+' parent '+configRegistry.get( 'squid/parent/port', '3128' ) +' 0 '+configRegistry.get( 'squid/parent/options', 'default' )

Außerdem werden im postinst nur 3 variablen gesetzt. Meiner Meinung nach sollten da alle defaultwerte gesetzt werden, damit es einfacher ist nach squid-Variablen zu suchen.
Comment 1 Stefan Gohmann univentionstaff 2012-07-17 17:09:55 CEST
UCS 3.1 will be the next release.
Comment 2 Florian Best univentionstaff 2012-07-25 09:53:05 CEST
Die squid.conf wurde aufgeräumt:
* Benutzung von ucr.is_true/is_false 
* Behandlung von Ports als int
* kleinigkeiten: string interpolation

univention-squid (6.0.0-1) unstable; urgency=low
  * cleaned up the squid.conf template (Bug #27815)
Comment 3 Felix Botner univentionstaff 2012-09-13 17:38:09 CEST
Die Konvertierung von if ucr.get() in ["no"] etc. muss nochmal geprüft werden, ich habe jetzt 2 Stellen, wo sich das neue anders verhält.

import univention.config_registry
configRegistry = univention.config_registry.ConfigRegistry()
configRegistry.load()

print configRegistry.get('squid/virusscan')
print configRegistry.get('squid/krb5auth/keepalive')

# old
if not 'yes' in [ configRegistry.get('squid/virusscan', ''), configRegistry.get('squid/contentscan', '') ]:
        print "old if virus"

#  new -> vermutlich besser is_true OR is_true
if configRegistry.is_false('squid/virusscan') and configRegistry.is_false('squid/contentscan'):
        print "new if virus"

# old
if not configRegistry.get('squid/krb5auth/keepalive', '').lower() in ['no', 'false']:
        print "old if krb5auth/keepalive"

# new -> vermutlich .is_true(... default=True)
if configRegistry.is_true('squid/krb5auth/keepalive'):
        print "new if krb5auth/keepalive"

-> python ...
None
None
old if virus
old if krb5auth/keepalive
Comment 4 Florian Best univentionstaff 2012-09-14 14:37:32 CEST
(In reply to comment #3)
> Die Konvertierung von if ucr.get() in ["no"] etc. muss nochmal geprüft werden,
> ich habe jetzt 2 Stellen, wo sich das neue anders verhält.
Das lag an ungesetzen UCR variablen und wurde korrigiert.
Comment 5 Felix Botner univentionstaff 2012-09-14 16:32:58 CEST
root@master:~# ucr commit /etc/squid3/squid.conf
File: /etc/squid3/squid.conf
Traceback (most recent call last):
  File "<stdin>", line 66, in <module>
  File "/usr/lib/pymodules/python2.6/univention/config_registry/backend.py", line 227, in is_true
    if key in self:
  File "/usr/lib/pymodules/python2.6/univention/config_registry/backend.py", line 147, in __contains__
    if key in registry:

vermutlich durch -> if configRegistry.is_true(['squid/basicauth']):

----------

Bitte noch


if configRegistry.is_false('squid/virusscan', True) and configRegistry.is_false('squid/contentscan', True)

--------------

Warum das?

-       if configRegistry.is_true("squid/ntlmauth/keepalive"):
+       if configRegistry.is_true("squid/ntlmauth/keepalive", True):

das ist ja eine Verhaltensänderung, ohne squid/ntlmauth/keepalive wurde das bisher nicht gesetzt, jetzt schon, ich denke das True sollte weg
Comment 6 Florian Best univentionstaff 2012-09-17 08:15:14 CEST
(In reply to comment #5)
> vermutlich durch -> if configRegistry.is_true(['squid/basicauth']):
Ja

> ----------
> 
> Bitte noch
> 
> 
> if configRegistry.is_false('squid/virusscan', True) and
> configRegistry.is_false('squid/contentscan', True)
> 
> --------------
Das war doch schon.
 
> Warum das?
> 
> -       if configRegistry.is_true("squid/ntlmauth/keepalive"):
> +       if configRegistry.is_true("squid/ntlmauth/keepalive", True):
> 
> das ist ja eine Verhaltensänderung, ohne squid/ntlmauth/keepalive wurde das
> bisher nicht gesetzt, jetzt schon, ich denke das True sollte weg
Ja, wurde revertet.

univention-squid 6.0.2-1
Comment 7 Felix Botner univentionstaff 2012-09-17 11:23:29 CEST
OK, das Template funktioniert. Changelog Eintrag vorhanden.
Comment 8 Stefan Gohmann univentionstaff 2012-12-12 21:08:25 CET
UCS 3.1-0 has been released: 
 http://forum.univention.de/viewtopic.php?f=54&t=2125

If this error occurs again, please use "Clone This Bug".