Commit Graph
106 Commits
Author SHA1 Message Date
Grigory Trenin cde58c22be protobuf: use 64-bit signed integers for timestamp fields
Signed-off-by: Grigory Trenin <grigory.trenin@gmail.com>
2026-04-14 13:59:05 -04:00
Ivan Verbin a8730a6997 occtl: add terminate commands for session cookie invalidation
Add 'terminate user', 'terminate id' and 'terminate session' commands
to occtl that disconnect users and invalidate their session cookies,
preventing reconnection with cached credentials.

Short session IDs are resolved to full safe_id by fetching the cookie
list from sec-mod via CTL_CMD_LIST_COOKIES with prefix matching and
ambiguity detection. Active sessions trigger a warning before
invalidation.

Add integration tests for all three terminate commands.

Signed-off-by: Ivan Verbin <verbinivan@gmail.com>
2026-03-15 17:05:29 +03:00
Grigory Trenin fb41d4203d Fix session timeout bypass
- Fixes an issue #599 where the session timeout could be bypassed
  by reconnecting, such as through a laptop lid close/open cycle.
- Adds 'Session started at:' field to 'occtl show user' output.

Signed-off-by: Grigory Trenin <grigory.trenin@gmail.com>
2026-01-25 18:59:13 -05:00
Grigory TreninandNikos Mavrogiannopoulos 0f53e0d6d9 Communicate secmod address to worker after successful authentication
This ensures all subsequent worker communications reach the original
secmod instance that authenticated the client, enabling correct session
accounting after IP address changes.

Closes: #674

Signed-off-by: Grigory Trenin <grigory.trenin@gmail.com>
2025-12-21 11:41:51 +01:00
Nikos Mavrogiannopoulos e665fd5a5b Account the correct number of points when proxyproto is in use
When the proxy protocol is used ensure that authentication failure
will credit the right number of points to the actual client IP
address.

Resolves: #529

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2023-08-19 20:51:48 +02:00
Nikos Mavrogiannopoulos 6edfb7f104 ipc.proto: time_t is sent in 64 bit value
This prevents Y2K38 issues.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2023-07-18 11:38:23 +02:00
Dimitri Papadopoulos 4cd41e0ccf Full name for message types in sequence diagrams
Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
2023-03-03 13:30:08 +01:00
Dimitri Papadopoulos f28669bf60 Remove spaces
* Remove trailing spaces at end-of-line
* Remove blank lines at end-of-file

Signed-off-by: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com>
2022-11-28 11:22:33 +01:00
fdomainandNikos Mavrogiannopoulos b3fe0d85c2 Added client-bypass-protocol config option
By default, anyconnect clients will drop all traffic of a given IP
version if there is no IP address in that version assigned to the
client. The client-bypass-protocol option, if enabled, will send an
extra header to the clients telling anyconnect client to bypass VPN
tunnel if there is no IP assigned. No impact for openconnect clients,
this header will simply be ignored.

Signed-off-by: Florian Domain <f.domain@criteo.com>
2021-05-18 07:15:43 +00:00
Alan Jowett 01a9815bdf Set disconnect reason when updating ban-ip
Resolves: #360

Signed-off-by: Alan Jowett alan.jowett@microsoft.com
2020-11-06 13:16:32 -07:00
Alan Jowett 34eab81339 Resolves: #326
Pass the hostname to ocserv-main after receiving the connect request.

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2020-07-28 13:37:20 -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 JowettandAlan 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 JowettandNikos Mavrogiannopoulos 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 JowettandNikos Mavrogiannopoulos 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 4bcf29643d ocserv: added support for per-user split-dns directive
Resolves: #229

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
2019-11-17 11:06:47 +01:00
Nikos Mavrogiannopoulos 8b0b1e6067 tlslib: added support for gnutls 3.6.3 (unreleased)
That adds support for GNUTLS_PRIVKEY_INFO_PK_ALGO_BITS which is
necessary for RSA-PSS private keys.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
2018-03-10 19:19:07 +01: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 907c34c520 occtl: improved session output
That is, do not print expiration time in sessions that are in use
(they don't expire during that time), and print whether a session
is in use.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
2018-01-07 11:42:09 +01:00
Nikos MavrogiannopoulosandNikos Mavrogiannopoulos 6cb4b37153 occtl: print cookie expiration time
Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
2017-12-11 08:26:48 +01:00
Nikos MavrogiannopoulosandNikos Mavrogiannopoulos 20fbbdbcd0 occtl: replaced last_modified time with created
ocserv no longer sends the last modified time, but rather the
cookie creation time.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
2017-12-11 08:26:48 +01:00
Nikos Mavrogiannopoulos af2a64df2f ocserv: handle RSA-PSS and ed25519 key types when compiled with gnutls 3.6.0
That is, enhance the security module to accept and understand
more elaborate signing commands.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
2017-08-23 12:00:15 +02:00
Nikos Mavrogiannopoulos d6ff620487 secmod sends periodically stats to main
That ensures that statistics will reach main even if no
users are logged in/logged out.

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 145ba5c14d Explicitly specify the protocol buffers syntax used in .proto files.
Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
2017-02-12 10:19:02 +01:00
Nikos Mavrogiannopoulos fdea01f4f5 Do not log the internal session ID nor re-use it in radius
Use instead a value derived from it, to avoid access to the debugging
log files, or radius result to access to the server.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
2017-01-29 15:48:46 +01:00
Nikos Mavrogiannopoulos 5fce6c8c86 Use the X-AnyConnect-Identifier-Platform header to identify mobile clients
That is, if the header contains "android" or "apple-ios" mark it as
a mobile client. The header X-AnyConnect-Identifier-DeviceType is only
considered for logging purposes and appended to the user-agent name
if present.
2016-09-25 15:44:43 +02:00
Nikos Mavrogiannopoulos 0c093ad8f3 ocserv: allow overriding hostname on the per-user configuration
This allows for the administrator to set specific hostnames, or even
empty hostname for specific users.
2016-06-18 11:08:53 +02:00
Nikos Mavrogiannopoulos 3a834fad26 occtl: print the cookie associated with a user on user info
This allows to map existing cookies to connected users.
2016-05-14 20:37:12 +02:00
Nikos Mavrogiannopoulos e0947340bb ipc: pass the connection status as integer
Conversion to textual form now happens at the client (occtl)
instead of the main server.
2016-03-06 19:07:24 +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 63d3b98cad use more consistent naming in internal messages 2016-03-05 14:00:50 +01:00
Nikos Mavrogiannopoulos 33a11af1b8 worker: pass received hostname to user via SESSION_INFO msg 2016-03-04 16:52:48 +01:00
Nikos Mavrogiannopoulos 9d144c89a9 Eliminated hostname handling in sec-mod
This value never reached sec-mod as it is only get known
after session is initiated by the client (i.e., after
auth_rep message is received).
2016-03-04 16:47:52 +01:00
Nikos MavrogiannopoulosandNikos 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 MavrogiannopoulosandNikos 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 6c6481de40 radius: send user agent information as Connect-Info
That allows the radius server to store information on particular
client. Resolves #26
2016-01-16 23:01:10 +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 14d19b3e9a Enhanced configuration option 'restrict-user-to-ports'
This enhancement allows to negate the rules and allow the user connecting
to all ports except the specified.
2015-12-07 11:15:56 +01:00
Nikos Mavrogiannopoulos eabfbe8473 Added configuration option 'restrict-user-to-ports'
This option is intended to allow restricting users to accessing
specific ports once they enter the VPN. The rules set using this
option will be enforced by the ocserv-fw script.
2015-12-02 10:38:12 +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 f5fca982dc Added configuration option restrict-user-to-routes
This option, if set, will call /usr/bin/ocserv-fw for each user
connecting, i.e., adding firewall restrictions based on its allowed
routes.
2015-11-23 17:31:55 +01:00
Nikos Mavrogiannopoulos 2473633b8d Added cookie key rotation 2015-11-17 08:33:38 +01:00
Nikos Mavrogiannopoulos 65004a55df Added configuration option tunnel-all-dns 2015-11-10 13:50:03 +01:00
Nikos MavrogiannopoulosandNikos Mavrogiannopoulos 5138a39116 Added a draft design document 2015-11-10 13:49:56 +01:00
Nikos Mavrogiannopoulos 0b8f4beb8b Added user-specific configuration options dpd, mobile-dpd, keepalive, max-same-clients 2015-11-10 13:49:13 +01:00
Nikos Mavrogiannopoulos 40bd1550c1 ipv6: introduced ipv6-subnet-prefix config option
That option allows to specify the IPv6 subnet prefix to be given
to client. That is, allow providing the clients networks larger
than /128. Set the option to 128 to simulate the previous behavior
of ocserv.
2015-10-24 19:26:48 +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 c60a0bce50 Combined password prompt and message
That is because there are clients (anyconnect) which only print
the message but not the prompt.
2015-05-20 10:01:25 +02:00