Commit Graph

460 Commits

Author SHA1 Message Date
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
Nikos Mavrogiannopoulos
accfc8169d Merge branch 'chmod+x' into 'master'
chmod +x executable scripts

See merge request openconnect/ocserv!280
2021-12-22 18:35:24 +00:00
Dimitri Papadopoulos
a58ff2534f chmod +x autogen.sh
Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
2021-12-22 19:17:58 +01:00
Dimitri Papadopoulos
a5d79fc230 Improve const char declarations
Declare C string constants using array syntax, avoid pointer syntax
when possible. They are different, the array syntax generates smaller,
faster code.

Also, const char[] should usually be static, again to avoid poor
compilation and runtime performance where compilers tend to
initialize the const declaration for every call instead of using
.rodata for the string.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
2021-12-17 10:26:17 +01:00
Nikos Mavrogiannopoulos
11c79189cc tests: skip leaks in occtl
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2021-11-01 10:23:01 +01:00
Nikos Mavrogiannopoulos
296b4fb4fe test-explicit-ip: corrected the illegal IP address
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2021-10-31 22:26:25 +01:00
Nikos Mavrogiannopoulos
ceebc11cc4 tests: check functionality of an IPv6 net with prefix 127
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2021-10-31 22:26:16 +01:00
Dimitri Papadopoulos
81df79a95b Typos found by codespell
Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
2021-10-09 17:57:11 +02:00
Nikos Mavrogiannopoulos
3c783faaa2 .gitlab-ci.yml: removed epel RPM builds on second stage
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2021-06-12 22:55:19 +02:00
fdomain
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
Russ Young
1d5b699e49 Changed mode 2021-05-12 13:27:35 -06:00
Russ Young
c4bc01766d Removed conditional code for OWASP headers 2021-05-12 11:56:09 -06:00
Russ Young
065f51e6af Added build flags and Test for OWASP headers 2021-04-20 11:55:28 -06:00
Nikos Mavrogiannopoulos
13f59eebbd tests: increase verbosity on coverage runs
This includes the debugging output into our tests.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-12-19 14:15:56 +01:00
Nikos Mavrogiannopoulos
70150a856b tests: drain-server-fail: make sure it runs only when root
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-12-06 22:14:38 +01:00
Nikos Mavrogiannopoulos
7ee163ad2c kerberos: fixes for fedora33 kdc
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-11-14 22:05:56 +01:00
Alan Jowett
3436705a9c Allow setup of new DTLS session while processing on old session
Resolves: #359

Signed-off-by: Alan Jowett alan.jowett@microsoft.com
2020-10-19 10:36:03 -06:00
Nikos Mavrogiannopoulos
b7575cc220 tests: fixed space after \
Also ensure that similar warnings are treated as errors
in CI.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-10-18 21:15:40 +02:00
Nikos Mavrogiannopoulos
66a263e477 tests: increase the size of a transmitted banner to reproduce #364
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-10-18 13:30:12 +02:00
Alan Jowett
5b402014fd Don't apply BanIP checks to clients on the same subnet.
Resolves #360

Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
2020-10-01 11:59:41 -06:00