• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

LDAP Extended Query with Multiple Groups

Scheduled Pinned Locked Moved General pfSense Questions
6 Posts 6 Posters 12.8k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J
    justein230
    last edited by Aug 10, 2016, 4:50 AM

    I am having trouble getting the syntax right for specifying two security groups in an LDAP extended query. Example situation below:
    Security Group 1 = group1
    dn="CN=group1,DC=test,DC=local"

    Security Group 2 = group2
    dn="CN=group2,DC=test,DC=local"

    I can get one security group working with the syntax "memberOf=CN=group1,DC=test,DC=local", but I cannot figure out how to tell it to query for "IF user is a member of group1 OR group2". Any help would be greatly appreciated. Thank you!

    1 Reply Last reply Reply Quote 0
    • T
      tarakesh
      last edited by Aug 10, 2016, 8:23 AM

      That would be a little bit more complex…

      As an example:
      Found here: http://stackoverflow.com/questions/19536519/ldap-search-filter-multiple-groups-squid

      (&(|(memberOf=CN=normal_group,OU=Test_Users,DC=matthew,DC=com)(memberOf=CN=internet_group,OU=Test_Users,DC=matthew,DC=com))(sAMAccountName=%s))

      2.4.1-RELEASE (amd64) on Intel D2500CCE Board Intel Atom D2500 DC @1.86GHz, 2GB RAM, 64GB Transcend SSD370
      Internet Connection: UnityMedia 200Mbit/10Mbit Cable

      1 Reply Last reply Reply Quote 0
      • J
        jimp Rebel Alliance Developer Netgate
        last edited by Aug 12, 2016, 2:29 PM

        For fiddling with LDAP search queries to get them right, it's hard to beat a utility like Apache Directory Studio. It's easier than trying to dial them in using just the pfSense GUI.

        Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

        Need help fast? Netgate Global Support!

        Do not Chat/PM for help!

        1 Reply Last reply Reply Quote 1
        • L
          logo78
          last edited by Mar 7, 2017, 3:30 PM

          hi,
          thank you for the hints. I had the same requirements. I just want to share my expirience.

          I needed two groups. One for VPN users and the other one for VPN access and pfsense administration.

          For me its perfect now  :)
          A picture is worth a thousand words.

          ![Image 28.png_thumb](/public/imported_attachments/1/Image 28.png_thumb)
          ![Image 28.png](/public/imported_attachments/1/Image 28.png)

          1 Reply Last reply Reply Quote 0
          • G
            gcarey3
            last edited by Apr 15, 2019, 6:21 PM

            What worked for me on pfSense 2.4.4-p2:

            Search scope: Entire Subtree
            Base DN: dc=ad,dc=mydomain,dc=com
            Authentication containers: CN=Users,DC=ad,DC=mydomain,DC=com
            Extended query: checked
            Query: |(memberOf=CN=pfsenseadmins,cn=Users,dc=ad,dc=mydomain,dc=com)(memberOf=CN=pfsenseoperators,cn=Users,dc=ad,dc=mydomain,dc=com)
            Bind anonymous: unchecked
            Bind credentials: MYDOMAIN\pfsense ************
            User naming attribute: samAccountName
            Group naming attribute: cn
            Group member attribute: memberOf
            RFC 2307 Groups: unchecked
            Group Object Class: posixGroup

            I created the groups 'pfsenseadmins' and 'pfsenseoperators' and assigned the appropriate access for each group.

            Seems that pfSense choked on the extra grouping characters at the beginning of the search expression as referenced above. I started with just the pipe 'or' operator and it worked okay. I also didn't need to add the samAccount part at the end, perhaps because it was defined in a different field.

            Hope it's helpful to others.

            1 Reply Last reply Reply Quote 0
            • L
              loeken
              last edited by May 16, 2019, 4:08 PM

              https://redmine.pfsense.org/issues/9527
              might be of interest too for rfc 2307 enabled

              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                This community forum collects and processes your personal information.
                consent.not_received