479 Commits

Author SHA1 Message Date
Nikos Mavrogiannopoulos
1e08ef47e0 Merge branch 'compression-tests' into 'master'
Fix race condition in traffic tests

See merge request openconnect/ocserv!499
2026-02-03 17:31:57 +00:00
Nikos Mavrogiannopoulos
e05485f008 Merge branch 'issue599' into 'master'
Fix session timeout bypass

Closes #599

See merge request openconnect/ocserv!489
2026-01-29 18:47:55 +00:00
Grigory Trenin
016c1b7f51 Use separate port for second iperf3 daemon
Avoids race condition when the first daemon's port release is delayed

Signed-off-by: Grigory Trenin <grigory.trenin@gmail.com>
2026-01-28 18:19:03 -05:00
Dimitri Papadopoulos Orfanos
360e4714e3 Merge branch 'bugfix/ban-json' into 'master'
occtl: Fix 'show ip bans' may produce invalid JSON (#683)

Closes #683

See merge request openconnect/ocserv!495
2026-01-26 09:16:47 +02: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 Trenin
9cc0191236 occtl: Fix 'show ip bans' may produce invalid JSON (#683)
Modified the printing logic to use a 'comma-before' approach instead of
'comma-after'.

Signed-off-by: Grigory Trenin <grigory.trenin@gmail.com>
2026-01-23 12:54:43 -05:00
Grigory Trenin
b080d7dd2b Rename min-reauth-time to ban-time (#676)
Signed-off-by: Grigory Trenin <grigory.trenin@gmail.com>
2026-01-23 05:44:05 -05:00
Grigory Trenin
74ebc5ec8a Strip domain suffix from hostname
The hostname validation was rejecting any hostname containg a '.'
character (eg: 'MacBook-Air.local'). This was overly restrictive and
prevented the HOSTNAME environment variable from being populated for
a signifficant number of clients, particularly on macOS.

Strip the domain suffix from such hostnames instead of discarding them.

Signed-off-by: Grigory Trenin <grigory.trenin@gmail.com>
2026-01-11 09:15:14 +01:00
Nikos Mavrogiannopoulos
29786781ed tests: resumption: enhanced and avoid the use of gnutls-cli insecure option
This test was improved to test resumption with TLS 1.3 in addition to TLS 1.2
as well as improve fallback on centos10. This patch introduces validation using
the right CA file.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-01-11 09:04:18 +01:00
Grigory Trenin
8636464880 tests: replace strcpy() with strlcpy()
- Replaced strcpy() with strlcpy() in test files
- Added linking to libcommon.a (and its dependency libnettle)
  as not all systems provide strlcpy()
- Centralized syslog_open variable by moving it from multiple definitions
  in main.c, worker.c, and test files into log.c. This avoids duplication
  and resolves a linking conflict with libcommon.a

Signed-off-by: Grigory Trenin <grigory.trenin@gmail.com>
2026-01-07 15:46:16 -05:00
Nikos Mavrogiannopoulos
5fad4f93dd tests: use jq to test json correctness
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-01-02 11:18:23 +01:00
Lee Keitel
70d936ca95 Fix network namespace setup script
At least my machine was generating IDs that were to long and any test
that required networking wouldn't work. This patch restricts the
namespace names to 4 digits.

Signed-off-by: Lee Keitel <lee@keitel.xyz>
2026-01-01 20:14:15 +01:00
Dimitri Papadopoulos Orfanos
e5de27a316 Merge branch 'tmp-main' into 'master'
Main() signature compliant with C standard

See merge request openconnect/ocserv!438
2025-12-06 11:08:40 +01:00
Dimitri Papadopoulos
4a4c341b45 Option listen-host expects a single IP address
Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
2025-03-02 19:07:22 +01:00
Dimitri Papadopoulos
5d1eeee8ca Main() signature compliant with C standard
Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
2024-12-06 12:08:52 +01:00
Nikos Mavrogiannopoulos
78c65b5adf Updated code to follow with kernel coding style
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2024-12-01 17:01:05 +01:00
Marcin Ochab
3f966ae8ca Allow selecting group by URL or profile
This introduces the 'select-group-by-url' config option
that allows selecting an authgroup just by connecting to
a dedicated URI.

Signed-off-by: Marcin Ochab <marcin.ochab@gmail.com>
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2024-04-23 21:35:00 +02:00
Daniel Lenski
aa8ab8ed30 Expand no-ipv6-ocv3 test
As added in c1a6f2b04a, this test verifies
that ocserv will NOT send IPv6 routes to OpenConnect v3 clients, which can't
handle them correctly.

Additionally, we can also verify that ocserv DOES send IPv6 routes to
totally unknown clients, which is the intended outcome resulting from
8b8a1a7b53.

Signed-off-by: Daniel Lenski <dlenski@amazon.com>
2024-02-19 17:41:29 -08:00
Dimitri Papadopoulos
ab58d9e9d7 Retrieve connection speed from RADIUS
Hijack Roaring Penguin's RADIUS attributes for that purpose:
* RP-Upstream-Speed-Limit → rx_per_sec
* RP-Downstream-Speed-Limit → tx_per_sec

While the ocserv configuration options use b/s, ocserv uses kb/s
internally. The radius attributes are already expressed in kb/s,
so we don't need to convert them.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
2024-01-20 20:12:34 +01:00
Nikos Mavrogiannopoulos
bc4b1c5f12 tests: auto-generate random addresses instead of hard-coding them
The main benefit is that there is less manual work to add a
test (discovery of unique random addresses is not necessary),
but it also ensures that the tests can run on environments where the
previously hard-coded addresses were present.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2023-12-29 21:18:28 +01:00
Nikos Mavrogiannopoulos
21e35358b4 tests: improved radius log presentation
Include the radiusd output with debugging information on stdout
for the radius tests. This allows better visibility to potential
configuration issues of radiusd.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2023-12-29 16:38:03 +01:00
Dimitri Papadopoulos
7d6213a0d0 Fix openconnect --authgroup option in tests
Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
2023-12-20 13:34:31 +01:00
Nikos Mavrogiannopoulos
e44cc6fd78 Separated logging for worker and main and oc_syslog() respects log-level
This makes oc_syslog respect the configured log-level. This also introduces
a clear separation of the logging function between the two processes.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2023-12-17 11:18:47 +01:00
Nikos Mavrogiannopoulos
f0067ae0ea Cleanup of the logging subsystem; allow logging to stderr only
Separated the logging logically from any remaining debugging
features. Introduced command line option for logging to stderr
only (for systemd and containers). The default log level is set
to (2) info.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2023-12-15 13:04:40 +01:00
Nikos Mavrogiannopoulos
c1a6f2b04a Added test for IPv6 routes in openconnect v3
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2023-12-14 13:28:56 +01:00
Rob van Oostenrijk
ed538039c3 Skip camouflage check for authenticated users
Once a client has progressed through the initial
auth checks (and successfully passed the initial
camouflage check), it's safe to skip further camouflage
checks. This allows the Cisco Secure client continue
successfully through HTTP requests for /profiles//etc/ocserv/profile.xml
and /1/VPNManifest.xml.

Resolves: #544

Signed-off-by: Rob van Oostenrijk <robvanoostenrijk@users.noreply.github.com>
2023-10-03 12:27:11 +02:00
Florian Domain
798dce24ba tests: add a test to validate occtl output
* this test allows to validate the occtl output (JSON format) returns
  expected fields
* we only test 2 fields for now (ID and raw_connected_at), but could
  be expanded easily

Signed-off-by: Florian Domain <f.domain@criteo.com>
2023-09-25 18:02:56 +02:00
Nikos Mavrogiannopoulos
747940238d tests: added test for idle and session timeout
This checks the functionality of idle-timeout and
session-timeout as well as whether the cookies are
invalidated after the user is disconnected.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2023-09-19 10:41:57 +02:00
Nikos Mavrogiannopoulos
a12873af21 Merge branch 'codespell' into 'master'
Fix misspelling newly reported by codespell

See merge request openconnect/ocserv!369
2023-09-15 13:29:41 +00:00
Nikos Mavrogiannopoulos
fbfbdc058a tests: use sec-mod-scale on cookie tests
This ensures we catch issues similar to !288.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2023-09-15 15:19:19 +02:00
Dimitri Papadopoulos
b29d915699 Fix misspelling newly reported by codespell
Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
2023-09-11 19:18:37 +02:00
Nikos Mavrogiannopoulos
59400941cf tests: verify that address got by the proxy matches the client
Also measure whether ban points are credited to the right
address for failed attempts.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2023-08-17 16:14:14 +02:00
Nikos Mavrogiannopoulos
02442aabbc Replaced nuttcp tests with iperf3
iperf3 is consistently included in all distributions we
are testing at, in contrast with nuttcp.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2023-07-27 15:50:33 +02:00
Nikos Mavrogiannopoulos
c393d4d7b4 vhost: do not require setting device per vhost
It is not necessary to specify the device config directive on
each virtual host configuration. Ensure that we don't require it
by mistake. This also introduces a traffic test when operating
with virtual hosts.

Resolves: #480

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2023-07-18 16:32:34 +02:00
Nikos Mavrogiannopoulos
b09b1b81de tests: added missing file
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2023-07-11 18:11:06 +02:00
Gareth Palmer
996d021e1b Add support for Cisco IP-Phone Enterprise firmware VPN client.
The VPN client that comes with the Cisco IP-Phone Enterprise
firmware is based on AnyConnect but was unable to authenticate
with ocserv.

The phone makes an initial GET request and looks for a cookie
named 'webvpn' that has an expiry attribute and a cookie named
'webvpnlogin' containing a non-empty value.

When username+password mode is configured, the phone will then
send a POST request containing those credentials. When using
certificate authentication an empty POST request is sent.

A handler that implements this new behaviour has been added
under the '/svc' path.

To use DTLS 'dtls-legacy' must be enabled and 'udp-port' must
be 443, a new 'cisco-svc-client-compat' option automatically
checks those settings.

New test cases test-pass-svc and test-cert-svc check the above
behaviour.

Older versions of the phone's firmware will fail to create the
DTLS tunnel if the cipher negotiated for HTTPS does not match
that selected for DTLS.

To work-around this either disable DTLS or only allow the
RSA-AES-256-CBC/SHA1 or RSA-AES-128-CBC/SHA1 cipher to be used.

doc/README-cisco-svc.md includes additional information.

Note: 'Enterprise' here is used to differentiate between that
firmware and the MPP (Multi-Platform) firmware which uses the
same hardware.

Signed-off-by: Gareth Palmer <gareth.palmer3@gmail.com>
2023-07-11 22:48:22 +12:00
Nikos Mavrogiannopoulos
e547733d61 tests: removed legacy tests and added missing ones
Added test-group-cert and test-fork tests that were
present but were never included in the CI test suite.

Removed unix-test which was an obsolete test present
in tests/.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2023-06-22 12:29:02 +02:00
Nikos Mavrogiannopoulos
a28ffdd4c3 Test both --debug and plain options.
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2023-06-20 06:58:00 +00:00
Dimitri Papadopoulos
5942ced085 tests: check JSON output with occtl --debug
Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
2023-06-17 23:06:50 +02:00
Nikos Mavrogiannopoulos
1373a11f57 tests: added a test for groups defined over multiple AVPs
This adds a test for the available multi-group options as
well as documentation for the feature. This tests two options:
 * Separate group names in separate class attributes
 * Separate group names in separate class attributes with the OU= format

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2023-06-17 00:25:55 +02:00
Nikos Mavrogiannopoulos
1ca50d7337 Removed gnulib
Supporting gnulib brought a whole class of problems due to its complexity.
Removing its support eliminates this class of problems and simplifies the
code significantly.

This sets the locale explicitly on server startup to eliminate the
need for custom string comparison functions.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2023-06-13 16:54:38 +02:00
Nikos Mavrogiannopoulos
0fac0efc14 .gitlab-ci.yml: added almalinux9
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2023-06-13 16:51:38 +02:00
johnson
eadebbbd71 ignore querystring while dispatching
Signed-off-by: johnson <10619522-OnFIs@users.noreply.gitlab.com>
2023-06-10 16:21:34 +08:00
Dimitri Papadopoulos
25b85eadb3 This file is part of GnuTLS → ocserv.
Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
2023-02-23 21:51:37 +01:00
Dimitri Papadopoulos
8bde99db99 PAM tests: ROOTUID → ROOTGID
Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
2023-01-05 13:07:05 +01:00
Dimitri Papadopoulos
3eec11bfcd Get rid of deprecated option cookie-validity
Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
2022-12-24 12:46:53 +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
Tara Mallesh
cfe2ea06d9 Allow HTTP headers to be configurable 2022-07-02 04:02:56 +00:00
Tara Mallesh
058c63303f Update test-owasp-headers with Pragma and Cache-control checks 2022-03-09 17:48:51 +00:00
Nikos Mavrogiannopoulos
cd2ad0c66f radiusd.conf: set libdir through autoconf
It should depend on the system tested.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2021-12-22 22:28:06 +01:00