Terry Burton [Wed, 27 Nov 2019 16:00:49 +0000 (16:00 +0000)]
SQL IP Pools support for MS SQL
Tested using the FreeTDS driver against SQL Server 2017 on Linux Docker, mostly
focussing on the stored procedure which gives 350 allocs/sec; 425 reallocs/sec
(with no specific database server optimisation).
The queries are more complicated than with most other dialects since MS SQL
lacks a "SELECT FOR UPDATE" statement, and its table hints do not provide a
direct means to implement the row-level read lock needed to guarentee that
concurrent queries do not select the same Framed-IP-Address for allocation to
distinct users.
Terry Burton [Mon, 18 Nov 2019 02:38:30 +0000 (02:38 +0000)]
PostgreSQL sqlippools: Find and allocate stored procedure
Replace existing stored procedure with one that combines the
allocate_find and allocate_update queries.
We can additionally avoid round trips by avoiding BEGIN and COMMIT since
calling an SP provides a new transaction context [*]. Therefore the IP
allocation process is reduced to running a single statement.
Indicative performance testing showed increased IP allocation
performance from 120 allocs/sec with separate queries to 1500 allocs/sec
on a two-node master/slave cluster.
[*] Verfied as follows which indicates that we are within a transaction
rather than "autocommit"ing:
> CREATE OR REPLACE FUNCTION sp_txid ()
RETURNS text
LANGUAGE plpgsql
AS $$
DECLARE
BEGIN
-- Write the current txid to a table
INSERT INTO txids SELECT txid_current();
INSERT INTO txids SELECT txid_current();
RETURN txid_current();
END$$;
Mathy Vanhoef [Fri, 4 Oct 2019 13:53:52 +0000 (17:53 +0400)]
EAP-pwd: fix DoS due to multithreaded BN_CTX access
The EAP-pwd module created one global OpenSSL BN_CTX instance, and
used this instance in all incoming requests. This means that different
threads used the same BN_CTX instance, which can result in a crash.
An adversary can trigger these crashes by concurrently initiating
multiple EAP-pwd handshakes from different clients.
Fix this bug by creating a separate BN_CTX instance for each request.
Terry Burton [Fri, 8 Nov 2019 21:02:09 +0000 (21:02 +0000)]
radsqlrelay changes backported to v3.0.x (#3112)
* radsqlrelay: actually do something in debug mode
* 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.
Matthew Newton [Fri, 4 Oct 2019 10:14:35 +0000 (11:14 +0100)]
Don't jump over group and profile checks
It means we're inconsistent in warning messages depending on
whether radreply entry was found or not. rlm_sql_process_groups()
already checks group_membership_query.
Alan T. DeKok [Mon, 16 Sep 2019 11:32:50 +0000 (07:32 -0400)]
remove chown.
It's not needed according to the Systemd documentation
---
RuntimeDirectory=foo/bar baz
the service manager creates /run/foo (if it does not exist), /run/foo/bar, and /run/baz. The directories /run/foo/bar and /run/baz except /run/foo are owned by the user and group specified in User= and Group=, and removed when the service is stopped.
---
Stefan Winter [Mon, 9 Sep 2019 12:51:36 +0000 (14:51 +0200)]
create an initial, empty CRL in DER encoding
If a user wants to deploy his CA, the URL in crlDistributionPoints should actually contain a DER-encoded CRL file. We create it here; the admin still needs to actually deploy the file at the URL chosen.
ObjectId() and Date() commands are not accepted by the low-level
mongo JSON engine.
For the field 'date' it's needed to use $date command.
For replacing ObjectId() it is possible to use sha256 or any others
hashing command.