Skip to content

LDAP group caching no longer works after upgrade to v2.11.10 #6926

@koratfood

Description

@koratfood

NetBox version

v2.11.10

Python version

3.8

Steps to Reproduce

  1. Install a new instance of Netbox v2.11.9 (or earlier) with LDAP authentication. Use LDAP config params towards a working LDAP server as suggested by official Netbox documentation, except the following:
AUTH_LDAP_FIND_GROUP_PERMS = False
AUTH_LDAP_CACHE_GROUPS = True
AUTH_LDAP_CACHE_TIMEOUT = 60
AUTH_LDAP_GROUP_CACHE_TIMEOUT = 60
AUTH_LDAP_REQUIRE_GROUP = "CN=Netbox Users,OU=Groups,DC=mycompany,DC=com"
AUTH_LDAP_MIRROR_GROUPS = ["Netbox Admins", "Netbox Users"]
AUTH_LDAP_USER_FLAGS_BY_GROUP = {
        "is_superuser": ["CN=Netbox Admins,OU=Groups,DC=mycompany,DC=com"]
}

Substitute domain and group names as appropriate, and make sure the LDAP account you use for testing is a member of 'Netbox Admins' as well as 'Netbox Users'.

  1. Log in and create an API token for yourself, with "write enabled" and no expiration date.
  2. POST an object via the REST-API (just to rule out potential hiccups with initial POST-request after upgrade)
curl -X POST \
-H "Authorization: Token <insert your token here>" \
-H "Content-Type: application/json" \
-H "Accept: application/json; indent=4" \
https://my-netbox-server/api/ipam/ip-addresses/ \
--data '{
    "address": "10.0.0.1/24",
	"description": "My IP Host 1"
}'
  1. POST another object via the REST-API, and take note of how long it takes to complete
curl -X POST \
-H "Authorization: Token <insert your token here>" \
-H "Content-Type: application/json" \
-H "Accept: application/json; indent=4" \
https://my-netbox-server/api/ipam/ip-addresses/ \
--data '{
    "address": "10.0.0.2/24",
	"description": "My IP Host 2"
}'
  1. Upgrade Netbox instance to v2.11.10 in accordance with official documentation
  2. POST an object via the REST-API (just to rule out potential hiccups with initial POST-request after upgrade)
curl -X POST \
-H "Authorization: Token <insert your token here>" \
-H "Content-Type: application/json" \
-H "Accept: application/json; indent=4" \
https://my-netbox-server/api/ipam/ip-addresses/ \
--data '{
    "address": "10.0.0.3/24",
	"description": "My IP Host 3"
}'
  1. POST another object via the REST-API, and take note of how long it takes to complete
curl -X POST \
-H "Authorization: Token <insert your token here>" \
-H "Content-Type: application/json" \
-H "Accept: application/json; indent=4" \
https://my-netbox-server/api/ipam/ip-addresses/ \
--data '{
    "address": "10.0.0.4/24",
	"description": "My IP Host 4"
}'

Expected Behavior

Netbox takes an (approximately) equal amount of time to return a response in step 7 when compared to step 4.

Observed Behavior

Netbox takes more than twice as long to return a response in step 7 when compared to step 4. In my specific case (low-spec'ed VM), this translates to step 4 taking around half a second, and step 7 taking over two seconds. I have also reproduced it on a higher-spec'ed bare-metal machine which is naturally faster, but the equation is still the same - i.e. step 7 taking over twice as long as step 4.

Metadata

Metadata

Assignees

No one assigned

    Labels

    pending closureRequires immediate attention to avoid being closed for inactivitystatus: needs ownerThis issue is tentatively accepted pending a volunteer committed to its implementationtype: bugA confirmed report of unexpected behavior in the application

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions