Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug #42544: Additional Squid acl types #8

Open
wants to merge 1 commit into
base: 4.3-0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions services/univention-squid/conffiles/etc/squid/squid.conf
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,30 @@ def user_acls():
return 'dstdom_regex'
def acl_dstdomain_regex_i():
return 'dstdom_regex -i'
def acl_proxy_auth_regex():
return 'proxy_auth_regex'
def acl_rep_mime_type():
return 'rep_mime_type'
def acl_rep_mime_type_i():
return 'rep_mime_type -i'
def acl_urlpath_regex():
return 'urlpath_regex'
def acl_urlpath_regex_i():
return 'urlpath_regex -i'
def acl_dst():
return 'dst'
acltypes = {
'browser': acl_browser,
'browser-i': acl_browser_i,
'dstdomain': acl_dstdomain_regex,
'dstdomain-i': acl_dstdomain_regex_i,
'port': acl_port,
'proxy': acl_proxy_auth_regex,
'mime': acl_rep_mime_type,
'mime-i': acl_rep_mime_type_i,
'urlpath': acl_urlpath_regex,
'urlpath-i': acl_urlpath_regex_i,
'dst': acl_dst,
}
def squid_re_escape(value):
return r'\x20'.join(map(re.escape, value.split(' ')))
Expand All @@ -209,6 +227,9 @@ def user_acls():
if not 0 <= value <= 65535:
raise ValueError('Invalid port number %r' % (value, ))
return '%d' % (value, )
def value_network(value):
return '%s' % (value, )

valuetypes_regex = {
'string': value_string,
'substring': value_substring,
Expand All @@ -217,12 +238,21 @@ def user_acls():
valuetypes_port = {
'number': value_port_number,
}
valuetypes_network = {
'network': value_network,
}
valuetypes = {
'browser': valuetypes_regex,
'browser-i': valuetypes_regex,
'dstdomain': valuetypes_regex,
'dstdomain-i': valuetypes_regex,
'port': valuetypes_port,
'proxy': valuetypes_regex,
'mime': valuetypes_regex,
'mime-i': valuetypes_regex,
'urlpath': valuetypes_regex,
'urlpath-i': valuetypes_regex,
'dst': valuetypes_network,
}
aclnames = set()
for key, value, in configRegistry.items():
Expand Down