Created on
05-19-2021
07:23 AM
Edited on
04-23-2025
09:06 AM
By
Stephen_G
Description
This article explains some common syntax and provides some examples of LDAP filters which may be used in configuring groups or setting remote user synchronization rules in FortiAuthenticator.
Scope
FortiAuthenticator.
Solution
FortiAuthenticator allows for setting LDAP filters when querying LDAP filters for a variety of reasons, most commonly for remote user sync rules and groups.
When constructing a filter, it may be as broadly or as narrowly defined as necessary, by setting broad matches or combining multiple attributes
LDAP filters are constructed in this manner:
(<and/or>(condition1)(condition2)(condition3)(etc))
These can also be nested and negated.
Wildcards are supported for some attributes like CN (common name), but not supported with negated conditions, and not supported for the ‘memberOf’ attribute.
Filter examples.
Find all users of a particular group:
(&(objectClass=user)(memberOf=cn=group1,ou=users,dc=test,dc=lab))
Find all users with ‘admin’ in their common name (CN):
(&(objectClass=user)(cn=*admin*))
Find all users or computers:
(|(objectClass=user)(objectClass=computer))
Find a user with only partial information of their name:
(anr=<name string)
Find all but one user in a group:
(&(objectClass=user)(memberOf=cn=group1,ou=users,dc=test,dc=lab)(!(sAMAccountName=testuser)))
Find all users in a group with 'svc' or 'service' in their common name (CN):
(&(objectClass=user)(memberOf=cn=group1,ou=users,dc=test,dc=lab)(|(cn=*svc*)(cn=*service*)))
Find users in groups AND nested groups (only in Active Directory environments):
(&(objectClass=user)(memberOf:1.2.840.113556.1.4.1941:=cn=group1,ou=users,dc=test,dc=lab)
Common LDAP attributes to use in filters:
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2025 Fortinet, Inc. All Rights Reserved.