4276 Commits
Author SHA1 Message Date
Dimitri Papadopoulos 21eed65a60 Fix typos
Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
2026-04-09 21:49:54 +02:00
Nikos Mavrogiannopoulos 89a40dde31 tests: add radius-multi-group-comma test for group-separator=comma
Regression test for the group-separator=comma option: verifies that
OU= Class attributes with comma-separated group names (as sent by
Freeradius) are correctly parsed when group-separator=comma is set.

Relates: #428

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-04-06 21:27:28 +02:00
Nikos Mavrogiannopoulos 828fca691e radius: add group-separator option for OU= Class attributes
Freeradius deployments may send groups in the Class attribute using a
comma as separator (e.g. "OU=group1,group2") rather than the semicolon
that ocserv expects by default. Add a group-separator option to the
radius auth configuration to allow this to be changed:

  auth = "radius[config=...,group-separator=comma]"

Accepted values are 'semicolon' (default) and 'comma'. The literal
character is not accepted in the config syntax as it conflicts with the
key=value pair delimiter.

Resolves: #428

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-04-06 21:27:28 +02:00
Nikos Mavrogiannopoulos ab23290899 .gitignore: added .cache
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-04-06 21:26:58 +02:00
Nikos Mavrogiannopoulos 95c8207e07 auth/plain: use real passwd salt for timing normalisation and clear on deinit
Instead of always using a hardcoded $5$fakesalt$ when the requested user
is not found, read_auth_pass() now captures the salt from the first entry
in the passwd file whose password field starts with '$'. This ensures the
crypt() call in plain_auth_pass() uses the same algorithm as real entries,
preventing observable timing differences that could leak username existence.
Falls back to $5$fakesalt$ when no usable entry is found.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-04-06 21:12:38 +02:00
Nikos Mavrogiannopoulos 2e81af318e strsep: removed conditional code for strsep
strsep() was used conditionally in plain authentication with fallback
code, whereas radius code used it unconditionally. Rely on strsep()
unconditionally to simplify the code.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-04-06 21:02:06 +02:00
Nikos Mavrogiannopoulos 85b4d19f0a tests: check that empty password with correct OTP fails when password is set
Regression test: a user with both a password and OTP configured must not
be able to authenticate by supplying an empty password (even with the
correct OTP).

Relates: #323
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-04-03 13:58:18 +02:00
Nikos Mavrogiannopoulos ebb34f6787 auth/plain: fix password retry and prevent username enumeration via timing
Corrected bugs that prevented a correct password from being accepted after
a wrong one in the same session:

- worker-auth.c: a stale webvpncontext SID cookie caused a reconnecting
  client to skip SEC_AUTH_INIT and jump directly to SEC_AUTH_CONT with
  a PS_AUTH_FAILED session, which sec-mod rejects.

- auth/plain.c: the 'failed' flag was sticky across retry attempts, so a
  correct password following a wrong one was still treated as failure.
  Refactored into 'unknown_user' (sticky, for timing protection) and a
  local 'wrong_pass' (fresh each call). crypt() is now always called
  regardless of whether the user exists to normalise response timing and
  prevent username enumeration.

Resolves: #323

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-04-03 13:55:07 +02:00
Nikos Mavrogiannopoulos c45e3467bb tests: check for the case where a password is incorrectly entered
This is a reproducer for the issue reported in #323

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-04-03 12:29:01 +02:00
Nikos Mavrogiannopoulos 9840050511 .gitlab-ci.yml: increased jobs
Several tests run longer without taking any resources, allow
more parallelization to finish faster.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-04-02 23:15:56 +02:00
Nikos Mavrogiannopoulos b25a1e7d81 tests: check for IPv6 handling issue
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-04-02 23:04:29 +02:00
Nikos Mavrogiannopoulos 107c12a5b6 if_address_init: correctly handle local IPv6 addresses
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-04-02 22:44:38 +02:00
Nikos Mavrogiannopoulos 3db9ecd259 tests: fixed flaky condition in disconnect-user
Ensure the client is killed eventually to prevent an openconnect
re-connect to keep the test up.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-03-29 21:13:28 +02:00
Nikos Mavrogiannopoulos fd3235784f tests: gssapi tests were moved to a specific testsuite
They are skipped in Ubuntu 22.04.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-03-29 17:32:23 +02:00
Nikos Mavrogiannopoulos 233aa02236 tests: do not run the firewall tests in i386/Debian
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-03-29 17:32:23 +02:00
Nikos Mavrogiannopoulos 3026f46d1b cipher-tests: skip if legacy DTLS is disabled
This is to enable running the test suite under Ubuntu 24.04.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-03-29 17:32:23 +02:00
Nikos Mavrogiannopoulos 0ba0c091af tests: initialize worker_st using = {0}
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-03-29 17:32:16 +02:00
Nikos Mavrogiannopoulos 979ccc711d .gitlab-ci.yml: updated to Ubuntu 24.04 and Fedora 43
This deprecates Ubuntu 20.04 builds and Fedora 42 builds
and tests the latest version.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-03-29 17:00:33 +02:00
Nikos Mavrogiannopoulos 271b8b9303 tests: added tests for ocserv setting fw rules
This validates that restrict-user-to-ports and
restrict-user-to-routes are enforced by the fw script.

The test verifies three cases after connecting with a config that
allows only TCP 80 and advertises a single route:
 - allowed port + advertised route: connection succeeds
 - denied port + advertised route: rejected at port level
 - allowed port + non-advertised route: rejected at route level

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-03-29 16:55:12 +02:00
Nikos Mavrogiannopoulos bb4e91c58a ocserv-fw: allow override using environment var
This enables testing of the script.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-03-29 16:55:12 +02:00
Nikos Mavrogiannopoulos 598bcf405e Added ocserv-fw for nftables
This also introduces a basic functional test for ocserv-fw.

Resolves: #397

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-03-29 16:55:12 +02:00
Nikos Mavrogiannopoulos e21359716b test-script-multi-user: simplified
This enables the script to terminate quickly under meson.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-03-22 22:54:48 +01:00
Nikos Mavrogiannopoulos e5eb5d6de7 .lcovrc: exclude from coverage bundled 3rd party projects and tests
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-03-22 21:17:18 +01:00
Nikos Mavrogiannopoulos 0a2dc40251 occtl: fix trailing comma in JSON array for show sessions valid/all
The has_more flag passed to print_end_block() used the raw array index,
producing a trailing comma when the last entry in args->cookies[] was
filtered out (e.g. a PS_AUTH_FAILED session lingering until cookie-timeout).

Fix by adding a pre-pass that collects the indices of entries that will
actually be printed into a C99 variable array vis[].

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
2026-03-22 21:17:02 +01:00
Nikos Mavrogiannopoulos efa28e1492 worker: flush coverage data on exit
Add a worker_exit() wrapper that calls __gcov_exit() before _exit()
when built with coverage instrumentation (-Db_coverage=true -> WITH_COVERAGE).
As atexit() handlers from libgcov are not triggered by SIGTERM, it caused
caused all worker-side coverage data to be silently lost.

umask(022) is set before __gcov_exit() so the .gcda files
are written with 0644 permissions and are readable by lcov.

This restores coverage for code paths that run exclusively in the
worker, such as lzs_compress(), lz4_compress().

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-03-22 21:16:57 +01:00
Nikos Mavrogiannopoulos 790f97d1cb tests: enable parallelization
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-03-22 21:16:53 +01:00
Nikos Mavrogiannopoulos c223f51c91 occtl.8.md: document available commands
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-03-22 12:30:04 +01:00
Nikos Mavrogiannopoulos 1b8f7f8ede tests: introduced helper to have uniform termination of client and server
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-03-22 12:29:59 +01:00
Nikos Mavrogiannopoulos 13a8007280 occtl: test commands
This tests: show status, reload, show iroutes, disconnect id,
show sessions, show ip ban points.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-03-22 08:38:02 +01:00
Nikos Mavrogiannopoulos b76aa3b506 tests: run the compression tests also with data that are compressible
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-03-21 17:06:29 +01:00
Nikos Mavrogiannopoulos e05fc9852b tests: added test for PAM accounting
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-03-21 17:06:29 +01:00
Nikos Mavrogiannopoulos a33370ad93 tests: introduced test to check the bandwidth restrictions
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-03-21 17:06:26 +01:00
Nikos Mavrogiannopoulos 41b9016db1 meson: autogenerate AUTHORS
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-03-21 07:35:48 +01:00
Nikos Mavrogiannopoulos b5e631f6f4 .gitlab-ci.yml: added distcheck job
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-03-20 20:47:35 +01:00
Nikos Mavrogiannopoulos bdf4df9756 test-camouflage: improve termination of client connection
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-03-20 20:47:35 +01:00
Nikos Mavrogiannopoulos 763f98a93e dist-script: generate kkdcp_asn1_tab.c and fail if necessary files missing
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-03-20 20:47:35 +01:00
Nikos Mavrogiannopoulos a7df5240f1 http-heads: generate as C file to avoid issue with coverage
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-03-20 20:47:35 +01:00
Nikos Mavrogiannopoulos 97ad7e479a tests: explicitly specify the path (srcdir vs builddir) of config files
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-03-20 20:47:35 +01:00
Nikos Mavrogiannopoulos f98bf6afcb test-oidc: generate data
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-03-20 20:47:35 +01:00
Nikos Mavrogiannopoulos 7c740caf63 test-namespace-listen: only run when namespaces are enabled
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-03-20 20:47:35 +01:00
Nikos Mavrogiannopoulos df6cfdd64e tests: radius: auto-generate the freeradius config directory
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-03-20 20:47:35 +01:00
Nikos Mavrogiannopoulos 7e00f4247a test-script-multi-user: Fix timeout: move sleep 600 inside connect branch
The sleep-connect-script blocked on both connect and disconnect invocations.
When the server shuts down, two disconnect scripts race past the test -f
check simultaneously and both sleep 600s, exceeding the test timeout.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-03-20 20:47:35 +01:00
Nikos Mavrogiannopoulos 18401eb298 Replaced autoconf with meson build files
Resolves: #699

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-03-20 20:47:27 +01:00
Nikos Mavrogiannopoulos e0aebc0a3c terminate-commands: kill stray processes and reset routes
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-03-15 21:05:36 +01:00
Nikos Mavrogiannopoulos a6ec9e93df Merge branch 'feature/terminate-session-commands' into 'master'
Add terminate commands for session cookie invalidation

Closes #689

See merge request openconnect/ocserv!503
2026-03-15 17:13:53 +00: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
Dimitri Papadopoulos Orfanos d632aaf046 Merge branch 'fix/ns_name_collision' into 'master'
tests: Fix intermittent namespace conflicts in CI

See merge request openconnect/ocserv!508
2026-03-12 15:36:13 +02:00
Grigory Trenin cab071aa78 tests: Fix intermittent namespace conflicts in CI
Fix PID-based namespace name collisions by:
- Extracting last 9 digits of PID (instead of first 4)
- Shortening interface names to fit 15-character IFNAMSIZ limit

Signed-off-by: Grigory Trenin <grigory.trenin@gmail.com>
2026-03-11 18:58:24 -04:00
Dimitri PapadopoulosandNikos Mavrogiannopoulos a309ecead0 llhttp: updated to latest version 9.3.1
Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
2026-03-02 08:19:50 +01:00
Nikos Mavrogiannopoulos 1cb1e5706f NEWS: clarified fix on authentication bypass
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-03-02 08:13:54 +01:00