Commit Graph

154 Commits

Author SHA1 Message Date
Alan Jowett
945699097d Modify ocserv-sm to permit it to scale up to the number of CPUs. This permits a higher rate of client connections and prevents TLS signing from becoming a bottleneck for clients connecting.
Resolves: #341

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2020-08-26 09:46:04 -06:00
Nikos Mavrogiannopoulos
8aa39b0106 Improved user disconnection to avoid race conditions
Previously when we were disconnecting a user there were few seconds
after which the cookie was still valid, so a reconnect would succeed
by the same user. This change ensures that a disconnected (via occtl)
user cannot re-use the same cookie to connect. That enables a safe
user removal from the authentication database, and from run-time.

Resolves: #59

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-07-25 21:38:55 +02:00
Alan Jowett
6533299b78 Improve accept rate limitation and make it conditional on queue depth.
Resolves: #310

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2020-07-11 12:51:29 +02:00
Alan Jowett
722e030e58 Add reporting of RX latency
Resolve: #258

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2020-05-26 18:14:36 -06:00
Alan Jowett
ce66485ee6 Uses fork/exec to limit memory footprint of ocserv-worker processes
Capture all the required worker process state in a protobuf and
pass to worker via env. Snapshot all config files to ensure ocserv-sm
and ocserv-worker remain in sync. Split ocserv-worker functionality
into it's own executable with minimal dependencies.

Resolves: #285

Signed-off-by: Alan Jowett alanjo@microsoft.com
2020-05-25 08:33:16 +02:00
Alan Jowett
780fbb89a0 Script needs access to additional client metadata.
Export more information to the script, including client device platform,
type and user agent.

Resolves: #256

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2020-03-11 09:13:55 +01:00
Alan Jowett
c9662282a1 Prevent tampering of our_ip, ip, session_start_time in SEC_AUTH_INIT from ocserv-worker to ocserv->sm and reject replay of auth_init_messages from old sessions.
Resolves: #252

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2020-02-28 11:20:30 -07:00
Nikos Mavrogiannopoulos
55d5af2ebc check_multiple_users: do not account disconnected ones
When max-same-clients is set to 1 and a user re-using a cookie
connects, check_multiple_users() would prevent the user from
reconnecting. This corrects the issue by taking into account
only valid sessions that have not yet been disconnected.

Resolves: #223

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
2019-12-16 21:30:24 +01:00
Nikos Mavrogiannopoulos
807ce345de main: create a sec-mod socket file independent of pid
That addresses the issue of not being able to run under systemd,
or under non-forking mode. Added test case to detect proper
operation.

Resolves #154

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
2018-05-11 22:04:28 +02:00
Nikos Mavrogiannopoulos
03bccbcaef main/sec-mod: handle sec-mod reload via synchronous communication
This eliminates race-conditions related to signal handling and potential
main/sec-mod desynchronizations related to cert/key pairs.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
2018-04-15 09:25:55 +02:00
Nikos Mavrogiannopoulos
5fd5a1b349 main: allow forcing maintenance cycle with SIGUSR2
This is done for testing purposes; allow test the maintenance
cycle without waiting for the necessary time.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
2018-04-15 08:25:37 +02:00
Nikos Mavrogiannopoulos
ba6921ed9a Introduced the notion of virtual hosts
This provides virtualized server configurations which take
effect after client connection when client hello is received.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
2018-03-06 20:42:31 +01:00
Nikos Mavrogiannopoulos
53a166500f Hash the peer's DTLS IP separately from its CSTP IP
This allows keeping track of clients which have their DTLS
stream come from a different IP location than their CSTP
stream.

Relates ocserv/ocserv#61
2018-02-22 08:25:18 -08:00
Nikos Mavrogiannopoulos
99b2fdcd06 Reset periodically the server statistics kept
Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
2017-04-14 16:39:00 +03:00
Nikos Mavrogiannopoulos
e9cf88f8c2 main: store additional statistics globally
That is, store:
 * number of timed out sessions
 * number of timed out due being idle sessions
 * number of errored sessions
 * total number of session handled (closed)
 * total number of kbytes sent
 * total number of kbytes received
 * minimum MTU seen
 * maximum MTU seen
 * total authentication failures
 * average/max authentication time (in secs)
 * average/max session time (in minutes)

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
2017-04-14 16:39:00 +03:00
Nikos Mavrogiannopoulos
83bea71e38 tests: added unit test for cstp_recv_nb()
Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
2017-03-24 20:07:47 +01:00
Nikos Mavrogiannopoulos
5c9cda67fb ocserv: added a host-update-script config option
This option will set a script to be called once the user is
connected and provides a hostname to be used with his IP. That
script can be used to update a DNS server or so.

Relates #39
2016-06-04 19:49:03 +02:00
Nikos Mavrogiannopoulos
8892eb1934 use a single format for all messages simplifying server
That patch also combines all the message generation or receiving
functions for to allow easier modifications to the format.
2016-03-06 19:07:07 +01:00
Nikos Mavrogiannopoulos
f3338e84f7 Added occtl command to display cookies
This allows to display and examine valid cookies from occtl.
2016-03-06 12:05:36 +01:00
Nikos Mavrogiannopoulos
f41b425f23 worker: replaced the timeout-based session forwarding with a validity checking
That checks whether the first packet received in the new session is valid
and if true, accept the new fd. This avoids the mess with validity detection
based on timeouts.
2016-02-23 15:50:39 +01:00
Nikos Mavrogiannopoulos
010257c6a2 Simplified cookie handling
This change set eliminates the need for cryptographically authenticated
cookies and relies on sec-module providing accurate information on
the SID provided by the client.
2016-02-23 15:31:17 +01:00
Nikos Mavrogiannopoulos
ff5b2b7aad Use 32-bit length variable for transferring between occtl and ocserv
This allows to handle the transfer of long data between ocserv and occtl.
Reported by Liviu.

Resolves #29
2016-01-28 13:53:21 +01:00
Nikos Mavrogiannopoulos
a1d67c48ba main: ensure we call ev_child_stop() on child cleanup handlers 2016-01-27 10:54:00 +01:00
Nikos Mavrogiannopoulos
0681aa1e3c main.h: corrected typo in comment 2016-01-25 11:23:16 +01:00
Nikos Mavrogiannopoulos
e1fc1f3c45 TLS session resumption database was moved to sec-mod
This reduces the number of sensitive data available to main process.
Resolves #21
2015-12-07 19:52:30 +01:00
Nikos Mavrogiannopoulos
fe28fd15cd Added occtl command 'show events', as well as the corresponding command in main
This allows the main process to handle a single listener which will
get all information about new and disconnecting users.
2015-12-05 11:23:06 +01:00
Nikos Mavrogiannopoulos
12bc8955bd main: allow multiple clients in control channel (occtl) 2015-12-05 11:23:01 +01:00
Nikos Mavrogiannopoulos
0e604b8a9f Master process was converted to use libev 2015-12-05 11:18:09 +01:00
Nikos Mavrogiannopoulos
9252e22298 Added reference counting to configuration values.
That is, to allow referencing to these values from proc_st
without fearing of them being invalidated on a config reload. We
perform a cleanup of these values on the server periodic check.
2015-12-05 11:08:51 +01:00
Nikos Mavrogiannopoulos
2d823aa200 Added config option 'append-routes'
If set to true it will restore the old configuration semantics
of appending the global routes to per user/group config.
2015-11-28 19:28:24 +01:00
Nikos Mavrogiannopoulos
cefd77b633 Simplified per-user/group configuration handling
We now use a common structure in SESSION_REPLY and AUTH_REP
messages. That structure is generated by sec-mod and forwarded
by main to worker, thus eliminating the need to create passing
code for each new user-config variable being added.
2015-11-26 18:29:14 +01:00
Nikos Mavrogiannopoulos
2473633b8d Added cookie key rotation 2015-11-17 08:33:38 +01:00
Nikos Mavrogiannopoulos
d2dd7f124f tests: added unit test for IPv4 and IPv6 address banning 2015-11-10 13:49:36 +01:00
Nikos Mavrogiannopoulos
33f9b57714 occtl: move ctl.h in occtl/ and fixed args.def to include version.inc 2015-10-31 00:09:24 +01:00
Nikos Mavrogiannopoulos
ddd5ebc743 setproctitle: overwrite argv and argc 2015-08-31 16:35:19 +02:00
Nikos Mavrogiannopoulos
8ae336f2ba worker: notify early main on session info
That allows to pass TLS information early, but more importantly
to pass information on the IP of the client (and our listen IP),
to main, which will be provided in turn to the up and down scripts,
as well as occtl.
2015-08-22 20:13:46 +02:00
Nikos Mavrogiannopoulos
0abc1ee2db Allow overriding session-timeout from radius 2015-05-19 15:35:46 +02:00
Nikos Mavrogiannopoulos
7086212fad remove_proc: use flags instead of multiple variables 2015-05-13 18:10:37 +02:00
Nikos Mavrogiannopoulos
8b6b83a6f6 when the server exits don't wait for stats from sec-mod 2015-05-13 14:27:27 +02:00
Nikos Mavrogiannopoulos
8829441e82 updated main_mod_fd_sync doc 2015-05-13 14:14:33 +02:00
Nikos Mavrogiannopoulos
33bcfb178e main: use two sockets to communicate with sec-mod
That allows to have a reliable synchronous socket, and
a socket where messages are sent and received asynchronously.
2015-05-13 14:04:22 +02:00
Nikos Mavrogiannopoulos
df4425a7d2 radius: consider Acct-Interim-Interval by default
That can also be overriden by specifying 'override-interim-updates=true'
in the radius subconfig.
2015-05-05 11:24:34 +02:00
Nikos Mavrogiannopoulos
6e336431fe radius: distinguish between user disconnect and admin reset of worker process 2015-04-29 11:45:29 +02:00
Nikos Mavrogiannopoulos
02aa9c691e keep track of client entries in sec-mod and report them in status msg 2015-04-26 17:06:16 +02:00
Nikos Mavrogiannopoulos
b3db947a7d when the user has voluntarily terminated the session invalidate the cookie 2015-04-21 16:00:20 +02:00
Brian Chu
f2ede537db Remove addresses from old tun device when stealing leases 2015-04-15 14:59:47 +03:00
Nikos Mavrogiannopoulos
d4a26b9fbe clear_cfg_file() -> clear_cfg() 2015-03-02 13:18:58 +01:00
Nikos Mavrogiannopoulos
cc16a65819 separated permanent configuration options from the reloaded ones 2015-03-02 13:18:52 +01:00
Nikos Mavrogiannopoulos
9f95d086d9 removed unused variables and structures 2015-02-26 21:15:17 +01:00
Nikos Mavrogiannopoulos
a617485232 enforce of IP banning was moved to main 2015-02-25 13:16:56 +01:00