mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2026-07-29 23:58:23 -05:00
Handle subyptes in ACIs
While enabling console output in the server installation the "Allow trust agents to retrieve keytab keys for cross realm principals" ACI was throwing an unparseable error because it has a subkey which broke parsing (the extra semi-colon): userattr="ipaAllowedToPerform;read_keys#GROUPDN"; The regular expression pattern needed to be updated to handle this case. Related: https://pagure.io/freeipa/issue/6760 Signed-off-by: Rob Crittenden <rcritten@redhat.com> Reviewed-By: Stanislav Laznicka <slaznick@redhat.com> Reviewed-By: Christian Heimes <cheimes@redhat.com>
This commit is contained in:
+2
-1
@@ -25,7 +25,8 @@ import six
|
|||||||
# The Python re module doesn't do nested parenthesis
|
# The Python re module doesn't do nested parenthesis
|
||||||
|
|
||||||
# Break the ACI into 3 pieces: target, name, permissions/bind_rules
|
# Break the ACI into 3 pieces: target, name, permissions/bind_rules
|
||||||
ACIPat = re.compile(r'\(version\s+3.0\s*;\s*ac[li]\s+\"([^\"]*)\"\s*;\s*([^;]*);\s*\)', re.UNICODE)
|
ACIPat = re.compile(r'\(version\s+3.0\s*;\s*ac[li]\s+\"([^\"]*)\"\s*;'
|
||||||
|
r'\s*(.*);\s*\)', re.UNICODE)
|
||||||
|
|
||||||
# Break the permissions/bind_rules out
|
# Break the permissions/bind_rules out
|
||||||
PermPat = re.compile(r'(\w+)\s*\(([^()]*)\)\s*(.*)', re.UNICODE)
|
PermPat = re.compile(r'(\w+)\s*\(([^()]*)\)\s*(.*)', re.UNICODE)
|
||||||
|
|||||||
@@ -162,3 +162,15 @@ def test_aci_parsing_8():
|
|||||||
def test_aci_parsing_9():
|
def test_aci_parsing_9():
|
||||||
check_aci_parsing('(targetfilter = "(|(objectClass=person)(objectClass=krbPrincipalAux)(objectClass=posixAccount)(objectClass=groupOfNames)(objectClass=posixGroup))")(targetattr != "aci || userPassword || krbPrincipalKey || sambaLMPassword || sambaNTPassword || passwordHistory")(version 3.0; acl "Account Admins can manage Users and Groups"; allow (add, delete, read, write) groupdn = "ldap:///cn=admins,cn=groups,cn=accounts,dc=greyoak,dc=com";)',
|
check_aci_parsing('(targetfilter = "(|(objectClass=person)(objectClass=krbPrincipalAux)(objectClass=posixAccount)(objectClass=groupOfNames)(objectClass=posixGroup))")(targetattr != "aci || userPassword || krbPrincipalKey || sambaLMPassword || sambaNTPassword || passwordHistory")(version 3.0; acl "Account Admins can manage Users and Groups"; allow (add, delete, read, write) groupdn = "ldap:///cn=admins,cn=groups,cn=accounts,dc=greyoak,dc=com";)',
|
||||||
'(targetattr != "aci || userPassword || krbPrincipalKey || sambaLMPassword || sambaNTPassword || passwordHistory")(targetfilter = "(|(objectClass=person)(objectClass=krbPrincipalAux)(objectClass=posixAccount)(objectClass=groupOfNames)(objectClass=posixGroup))")(version 3.0;acl "Account Admins can manage Users and Groups";allow (add,delete,read,write) groupdn = "ldap:///cn=admins,cn=groups,cn=accounts,dc=greyoak,dc=com";)')
|
'(targetattr != "aci || userPassword || krbPrincipalKey || sambaLMPassword || sambaNTPassword || passwordHistory")(targetfilter = "(|(objectClass=person)(objectClass=krbPrincipalAux)(objectClass=posixAccount)(objectClass=groupOfNames)(objectClass=posixGroup))")(version 3.0;acl "Account Admins can manage Users and Groups";allow (add,delete,read,write) groupdn = "ldap:///cn=admins,cn=groups,cn=accounts,dc=greyoak,dc=com";)')
|
||||||
|
|
||||||
|
|
||||||
|
def test_aci_parsing_10():
|
||||||
|
"""test subtypes"""
|
||||||
|
check_aci_parsing('(targetattr="ipaProtectedOperation;read_keys")'
|
||||||
|
'(version 3.0; acl "Allow trust agents to retrieve '
|
||||||
|
'keytab keys for cross realm principals"; allow(read) '
|
||||||
|
'userattr="ipaAllowedToPerform;read_keys#GROUPDN";)',
|
||||||
|
'(targetattr = "ipaProtectedOperation;read || keys")'
|
||||||
|
'(version 3.0;acl "Allow trust agents to retrieve '
|
||||||
|
'keytab keys for cross realm principals";allow (read) '
|
||||||
|
'userattr = "ipaAllowedToPerform;read_keys#GROUPDN";)')
|
||||||
|
|||||||
Reference in New Issue
Block a user