freeradius and the current date

Arran Cudbard-Bell a.cudbardb at freeradius.org
Thu Mar 5 16:25:48 CET 2015


> On 5 Mar 2015, at 09:56, Graham Leggett <minfrin at sharp.fm> wrote:
> 
> Hi all,
> 
> I am looking to perform an LDAP search in freeradius that includes the option to specify users that have not expired, where expiry is contained an a standard LDAP attribute. Something similar to this:
> 
> (&(uid=%{User-Name})(myExpiryTimestamp>=%{[TIMESTAMP_NOW]}))
> 
> (In other words, I am looking for a suitable unlang attribute that represents “time now on radius server”)
> 
> The closest I’ve found are these deprecated one character variables as follows:
> 
> http://wiki.freeradius.org/config/Run%20time%20variables
> 
> Unfortunately they are marked as deprecated with no indication of what replaces them.
> 
> The source code for rlm_date seems to indicate that date formatting is possible, but there is no functionality that I can see to provide the current date, which is a shame. Should this module be a good place for this kind of functionality or should I be looking somewhere else for this?

Call rlm_preprocess which will give you Event-Timestamp.

#
#  Create or parse an ASN1 generalized time stamp
#
#  Note: Not as flexible as it should be due to fixed strftime format
#
#  Should be able to deal with fractional seconds and lack of timezone.
#
date generalized_time {
	format = "%Y%m%d%H%M%S%z"
}

(&(uid=%{User-Name})(myExpiryTimestamp>=%{generalized_time:&Event-Timestamp}))

the rlm_date and Event-Timestamp combo replace the one letter expansions.

-Arran

Arran Cudbard-Bell <a.cudbardb at freeradius.org>
FreeRADIUS development team

FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 872 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20150305/8218126f/attachment.sig>


More information about the Freeradius-Users mailing list