Terry Burton [Fri, 30 Aug 2019 14:59:16 +0000 (15:59 +0100)]
SQLite: Don't require a lease to have expired if we reallocate it to the previous client
The current default allocate_find query causes per-client IP allocation
instability that starts when allocate_clear rate limiting comes into
effect.
With initial pool conditions the default alloc_find query selects from
the pool of all *expired* leases. It selects the least recently used IP
address (i.e. the one with the oldest expiry_time) unless a matching
username and/or callingstationid exists in the table in which case these
are prioritised in order to issue the client with their previous lease.
Normally picking the least recently used address helps to avoid issuing
the address to a different client, maximising the chance of stickiness,
which is desirable.
However, if a user makes successive authentication attempts whilst
allocate_clear rate limiting is active they are always allocated a
different IP address because their existing address is unavailable (has
not yet expired and has not been explicitly expired by allocate_clear),
with the effect that there are now multiple rows in the table containing
the same pool_key, username and callingstationid.
The normal ordering then has the undesirable effect of ensuring that
successive future IP address selections for the client will flip-flop
between addresses because username + callingstationid are first
prioritied then the *oldest expiry_time* is chosen (rather than the most
recent expiry relating to the most recent lease). This behaviour
persists once allocate_clear rate limiting is no longer in effect.
We can avoid getting having multiple rows with the same client details
by amending the allocate_find query to include an existing row matching
nasipaddress and pool_key in the available set of IP addreses regardless
of whether the lease has expired or not (i.e. re-allocation of a current
lease to the same client).
Terry Burton [Fri, 30 Aug 2019 14:58:48 +0000 (15:58 +0100)]
Oracle: Don't require a lease to have expired if we reallocate it to the previous client
The current default allocate_find query causes per-client IP allocation
instability that starts when allocate_clear rate limiting comes into
effect.
With initial pool conditions the default alloc_find query selects from
the pool of all *expired* leases. It selects the least recently used IP
address (i.e. the one with the oldest expiry_time) unless a matching
username and/or callingstationid exists in the table in which case these
are prioritised in order to issue the client with their previous lease.
Normally picking the least recently used address helps to avoid issuing
the address to a different client, maximising the chance of stickiness,
which is desirable.
However, if a user makes successive authentication attempts whilst
allocate_clear rate limiting is active they are always allocated a
different IP address because their existing address is unavailable (has
not yet expired and has not been explicitly expired by allocate_clear),
with the effect that there are now multiple rows in the table containing
the same pool_key, username and callingstationid.
The normal ordering then has the undesirable effect of ensuring that
successive future IP address selections for the client will flip-flop
between addresses because username + callingstationid are first
prioritied then the *oldest expiry_time* is chosen (rather than the most
recent expiry relating to the most recent lease). This behaviour
persists once allocate_clear rate limiting is no longer in effect.
We can avoid getting having multiple rows with the same client details
by amending the allocate_find query to include an existing row matching
nasipaddress and pool_key in the available set of IP addreses regardless
of whether the lease has expired or not (i.e. re-allocation of a current
lease to the same client).
Terry Burton [Fri, 30 Aug 2019 14:58:12 +0000 (15:58 +0100)]
MySQL: Don't require a lease to have expired if we reallocate it to the previous client
The current default allocate_find query causes per-client IP allocation
instability that starts when allocate_clear rate limiting comes into
effect.
With initial pool conditions the default alloc_find query selects from
the pool of all *expired* leases. It selects the least recently used IP
address (i.e. the one with the oldest expiry_time) unless a matching
username and/or callingstationid exists in the table in which case these
are prioritised in order to issue the client with their previous lease.
Normally picking the least recently used address helps to avoid issuing
the address to a different client, maximising the chance of stickiness,
which is desirable.
However, if a user makes successive authentication attempts whilst
allocate_clear rate limiting is active they are always allocated a
different IP address because their existing address is unavailable (has
not yet expired and has not been explicitly expired by allocate_clear),
with the effect that there are now multiple rows in the table containing
the same pool_key, username and callingstationid.
The normal ordering then has the undesirable effect of ensuring that
successive future IP address selections for the client will flip-flop
between addresses because username + callingstationid are first
prioritied then the *oldest expiry_time* is chosen (rather than the most
recent expiry relating to the most recent lease). This behaviour
persists once allocate_clear rate limiting is no longer in effect.
We can avoid getting having multiple rows with the same client details
by amending the allocate_find query to include an existing row matching
nasipaddress and pool_key in the available set of IP addreses regardless
of whether the lease has expired or not (i.e. re-allocation of a current
lease to the same client).
Alan T. DeKok [Thu, 29 Aug 2019 16:04:04 +0000 (12:04 -0400)]
just print out each thing as we see it
which makes the output a little harder to read. But it also
means that the output is organized alphabetically. And therefore
doesn't change with different hashing methods of the parent shell
Terry Burton [Wed, 28 Aug 2019 23:33:23 +0000 (00:33 +0100)]
Don't require a lease to have expired if we reallocate it to the previous client
The current default allocate_find query causes per-client IP allocation
instability that starts when allocate_clear rate limiting comes into effect.
With initial pool conditions the default alloc_find query selects from the pool
of all *expired* leases. It selects the least recently used IP address (i.e.
the one with the oldest expiry_time) unless a matching username and/or
callingstationid exists in the table in which case these are prioritised in
order to issue the client with their previous lease. Normally picking the least
recently used address helps to avoid issuing the address to a different client,
maximising the chance of stickiness, which is desirable.
However, if a user makes successive authentication attempts whilst
allocate_clear rate limiting is active they are always allocated a different IP
address because their existing address is unavailable (has not yet expired and
has not been explicitly expired by allocate_clear), with the effect that there
are now multiple rows in the table containing the same pool_key, username and
callingstationid.
The normal ordering then has the undesirable effect of ensuring that successive
future IP address selections for the client will flip-flop between addresses
because username + callingstationid are first prioritied then the *oldest
expiry_time* is chosen (rather than the most recent expiry relating to the most
recent lease). This behaviour persists once allocate_clear rate limiting is no
longer in effect.
We can avoid getting having multiple rows with the same client details by
amending the allocate_find query to include an existing row matching
nasipaddress and pool_key in the available set of IP addreses regardless of
whether the lease has expired or not (i.e. re-allocation of a current lease to
the same client).
- Move password attributes under Password-Root
- Apply tighter bounds checks on hash length in password.c
- Failover between "known good" password types in password.c if one type can't be normalised or is the wrong length.
- Merge password info arrays into one table in password.c
- Provide two public functions in password.c, one provides a cannonical version of a password attribute, the other rewrites all the password attributes in the request->control list to their canonical form.
- s/(S?)SHA-Password/\1SHA1-Password/
- Support multiple levels of preprocessing callbacks
- Support restricting password types password.c can return
- Use Password-Root TLV to be more efficient about locating candidate "known good" passwords (should be MUCH faster, and no longer quadratic).
- Use proper hash length macros in the hash info table in password.c
- Split SHA2-Password and SHA3-Password values into SHA[23]-(224|256|348|512)-Password attributes automatically.
- Provide macro wrappers to allow us to easily add additional EVP based hashing mechanisms.
- Fix pap_auth_func signature so known_good is also constified.
- Prevent normalisation of Cleartext-Password, that's probably always the wrong thing to do.
Remove normalisation call from proto_radius_auth.c
As discussed. It's bad to mix internal attribute processing with protocols.
The normalisation could be applied equally well to many protocols, and rlm_pap and rlm_chap will do their own normalisation without mangling the existing attributes in the request.
Alan T. DeKok [Wed, 28 Aug 2019 14:11:49 +0000 (10:11 -0400)]
load simple things first
We can later add checks that new dictionary entries are NOT
added after some point. Otherwise the server fails with
"unknown attribute" error, instead of "attribute definition
is too late"
Alan T. DeKok [Tue, 27 Aug 2019 15:38:34 +0000 (11:38 -0400)]
un-break CHAP module
If there's no "known good" password, we still set Auth-Type = CHAP,
because that's the only thing which cam be done. We issue a
warning, but we hope that a subsequent module will do the right thing
Terry Burton [Tue, 27 Aug 2019 05:09:00 +0000 (06:09 +0100)]
radsqlrelay systemd watchdog (#2922)
* radsqlrelay: Clean up strict and warnings pragmas
The modules we use are clean so ensure that these pragmas apply to
includes.
* radsqlrelay: Add support for systemd watchdogs
systemd can terminate (and restart) the service if it stops providing
watchdogs for a defined interval.
* radsqlrelay: Don't get stuck processing the same broken SQL statements
If the file contains a broken SQL statement then it is continually
retried with a 1 sec delay.
Restarting the radsqlrelay will replay the entire file (which could get
stuck even earlier due to duplicate key fields).
We instead continue when we encounter a failing statement unless the
failure was the result of a database disconnect in which case it is
resumed once the connection is available.