Skip to content

[defect]: Date parsing fails when using Redis cache #5304

Open
@GabrielMajeri

Description

@GabrielMajeri

What type of defect/bug is this?

Unexpected behaviour (obvious or verified by project member)

How can the issue be reproduced?

I've successfully configured the freeradius-oauth2-perl module module for authenticating with Microsoft Azure AD. Now I'm trying to get it to use Redis for cache, instead of the non-persistent in-memory cache.

I've enabled the redis module and configured it and I've also updated the freeradius-oauth2-perl/module file:

cache oauth2_cache {
    # ...
 
	# Use Redis instead of `rlm_cache_rbtree`
	driver = "rlm_cache_redis"

	# Connect to Redis container
	redis {
		server = 'redis-node-0'
		port = 6379
		query_timeout = 5
		pool = redis
}

The first time I use radtest to authenticate, it works, and it creates a new cache entry in Redis:

(0) oauth2_cache: No cache entry found for "[email protected]"
(0) oauth2_cache: Creating new cache entry
(0) oauth2_cache:   &request:OAuth2-Password-Last-Modified := &control:OAuth2-Password-Last-Modified -> Feb 18 2024 09:35:31 UTC
(0) oauth2_cache:   &control:Password-With-Header := &control:Password-With-Header -> '{ssha512}a0c7e7b2ef84ed2d19172b41 [truncated]'
(0) oauth2_cache: Merging cache entry into request

The cache entry (read directly from redis-cli) looks as follows:

"&Cache-Expires = 1711011923\n&Cache-Created = 1710147923\n&control:Password-With-Header := '{ssha512}a0c7... long hash here...'\n&OAuth2-Password-Last-Modified := Feb 18 2024 09:35:31 UTC\n"

However, subsequent requests fail to access the cache:

(1) oauth2_cache: EXPAND %{User-Name}
(1) oauth2_cache:    --> [email protected]
rlm_redis (redis): Reserved connection (0)
(1) oauth2_cache: ERROR: failed to parse time string "Feb"
rlm_redis (redis): Released connection (0)
(1)           [oauth2_cache] = fail

The issue seems to be with reading back the cached date, which FreeRADIUS created in the first place. I'm guessing this issue is similar to #3602, but I haven't been able to determine why it's happening.

Metadata

Metadata

Assignees

No one assigned

    Labels

    defectcategory: a defect or misbehaviourv3.2.xmeta: relates to the v3.2.x branch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions