From be57b101ff88da9964545f97f2e45585a190dbfe Mon Sep 17 00:00:00 2001 From: Bai Date: Fri, 20 Dec 2024 15:19:27 +0800 Subject: [PATCH] fix: set default ldap user dn cache time (0) --- apps/jumpserver/conf.py | 4 ++-- apps/settings/serializers/auth/ldap.py | 2 +- apps/settings/serializers/auth/ldap_ha.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/jumpserver/conf.py b/apps/jumpserver/conf.py index 6491b13ce..01af7ec96 100644 --- a/apps/jumpserver/conf.py +++ b/apps/jumpserver/conf.py @@ -290,7 +290,7 @@ class Config(dict): 'AUTH_LDAP_START_TLS': False, 'AUTH_LDAP_USER_ATTR_MAP': {"username": "cn", "name": "sn", "email": "mail"}, 'AUTH_LDAP_CONNECT_TIMEOUT': 10, - 'AUTH_LDAP_CACHE_TIMEOUT': 3600 * 24 * 30, + 'AUTH_LDAP_CACHE_TIMEOUT': 0, 'AUTH_LDAP_SEARCH_PAGED_SIZE': 1000, 'AUTH_LDAP_SYNC_IS_PERIODIC': False, 'AUTH_LDAP_SYNC_INTERVAL': None, @@ -310,7 +310,7 @@ class Config(dict): 'AUTH_LDAP_HA_START_TLS': False, 'AUTH_LDAP_HA_USER_ATTR_MAP': {"username": "cn", "name": "sn", "email": "mail"}, 'AUTH_LDAP_HA_CONNECT_TIMEOUT': 10, - 'AUTH_LDAP_HA_CACHE_TIMEOUT': 3600 * 24 * 30, + 'AUTH_LDAP_HA_CACHE_TIMEOUT': 0, 'AUTH_LDAP_HA_SEARCH_PAGED_SIZE': 1000, 'AUTH_LDAP_HA_SYNC_IS_PERIODIC': False, 'AUTH_LDAP_HA_SYNC_INTERVAL': None, diff --git a/apps/settings/serializers/auth/ldap.py b/apps/settings/serializers/auth/ldap.py index be022a659..7bfd78e55 100644 --- a/apps/settings/serializers/auth/ldap.py +++ b/apps/settings/serializers/auth/ldap.py @@ -85,7 +85,7 @@ class LDAPSettingSerializer(serializers.Serializer): ) AUTH_LDAP_CACHE_TIMEOUT = serializers.IntegerField( min_value=0, max_value=3600 * 24 * 30 * 12, - default=3600 * 24 * 30, + default=0, required=False, label=_('User DN cache timeout (s)'), help_text=_( 'Caching the User DN obtained during user login authentication can effectively ' diff --git a/apps/settings/serializers/auth/ldap_ha.py b/apps/settings/serializers/auth/ldap_ha.py index c653beeda..6b78682b2 100644 --- a/apps/settings/serializers/auth/ldap_ha.py +++ b/apps/settings/serializers/auth/ldap_ha.py @@ -67,7 +67,7 @@ class LDAPHASettingSerializer(serializers.Serializer): ) AUTH_LDAP_HA_CACHE_TIMEOUT = serializers.IntegerField( min_value=0, max_value=3600 * 24 * 30 * 12, - default=3600 * 24 * 30, + default=0, required=False, label=_('User DN cache timeout (s)'), help_text=_( 'Caching the User DN obtained during user login authentication can effectively'