Skip to content

Commit 2ab90df

Browse files
committed
Check for full permissions on certs too
1 parent 566020a commit 2ab90df

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

modules/auxiliary/admin/ldap/ad_cs_cert_template.rb

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,10 +326,14 @@ def action_read
326326
elog('failed to parse a binary security descriptor to SDDL', error: e)
327327
else
328328
print_status(" nTSecurityDescriptor: #{sddl_text}")
329-
permissions = [ 'READ' ] # if we have the object, we can assume we have read permissions
330-
permissions << 'WRITE' if adds_obj_grants_permissions?(@ldap, obj, SecurityDescriptorMatcher::Allow.new(:WP))
331-
permissions << 'ENROLL' if adds_obj_grants_permissions?(@ldap, obj, SecurityDescriptorMatcher::Allow.certificate_enrollment)
332-
permissions << 'AUTOENROLL' if adds_obj_grants_permissions?(@ldap, obj, SecurityDescriptorMatcher::Allow.certificate_autoenrollment)
329+
if adds_obj_grants_permissions?(@ldap, obj, SecurityDescriptorMatcher::Allow.full_control)
330+
permissions = [ 'FULL CONTROL' ]
331+
else
332+
permissions = [ 'READ' ] # if we have the object, we can assume we have read permissions
333+
permissions << 'WRITE' if adds_obj_grants_permissions?(@ldap, obj, SecurityDescriptorMatcher::Allow.new(:WP))
334+
permissions << 'ENROLL' if adds_obj_grants_permissions?(@ldap, obj, SecurityDescriptorMatcher::Allow.certificate_enrollment)
335+
permissions << 'AUTOENROLL' if adds_obj_grants_permissions?(@ldap, obj, SecurityDescriptorMatcher::Allow.certificate_autoenrollment)
336+
end
333337
whoami = adds_get_current_user(@ldap)
334338
print_status(" * Permissions applied for #{whoami[:userPrincipalName].first}: #{permissions.join(', ')}")
335339
end

0 commit comments

Comments
 (0)