Commit Graph

411 Commits

Author SHA1 Message Date
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
Nikos Mavrogiannopoulos
53c8c0f139 tests: added reproducer for drain-server-ms failure
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-09-29 22:51:47 +02:00
Nikos Mavrogiannopoulos
067c96cb06 tests: renamed test-drain-server to drain-server
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-09-29 21:07:47 +02:00
William Dauchy
3ba9ebdab0 tests, radius-group: fix unstable tests
- print outfile instead of new command; this will help debug when an
  issue occurs, to know what was the original output
- also add some time between tests to avoid race; this was failing on
  "could not find group information"

  Established DTLS connection (using GnuTLS). Ciphersuite (DTLS1.2)-(PSK)-(AES-256-GCM).
      inet 192.168.93.190/32 scope global tun0
  PING 192.168.93.1 (192.168.93.1) 56(84) bytes of data.
  64 bytes from 192.168.93.1: icmp_seq=1 ttl=64 time=0.217 ms
  64 bytes from 192.168.93.1: icmp_seq=2 ttl=64 time=0.246 ms
  64 bytes from 192.168.93.1: icmp_seq=3 ttl=64 time=0.235 ms

  --- 192.168.93.1 ping statistics ---
  3 packets transmitted, 3 received, 0% packet loss, time 2052ms
  rtt min/avg/max/mdev = 0.217/0.232/0.246/0.011 ms

  could not find group information

Signed-off-by: William Dauchy <w.dauchy@criteo.com>
2020-09-20 22:11:25 +02:00
William Dauchy
80babceacf listen-netns: fix worker case for DTLS
while using udp, we later open a file descriptor for the worker. With a
listen netns config, I overlooked this case which oblige me to move the
struct containing the file descriptor in the main one. Then I can access
them from each worker to make it possible to open the socket in the
correct netns. I also need to keep the netns fd open during the whole
life of the process.

the issue was not visible on a tcp-only case, but while using udp you
can see logs such as:

main[user]: x.x.x.x:54024 bind UDP to 0.0.0.0:443: Cannot assign requested address
worker[user]: x.x.x.x setting up DTLS-PSK connection
main[user]: x.x.x.x:54024 bind UDP to 0.0.0.0:443: Cannot assign requested address

update tests to reflects that:
- instead of creating our own netns, use the one created in common.sh
- we start server in ns1, but listen in ns2, and test client from ns3
  (we don't want to listen in ns1 to test listen-ns)

Signed-off-by: William Dauchy <w.dauchy@criteo.com>
2020-09-20 21:49:08 +02:00
Yousong Zhou
c47911a7d0 Fix typo in comment of sample config
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2020-09-15 19:14:50 +08:00
Nikos Mavrogiannopoulos
6be284dd63 radius: ignore redundant group class
This ignores any items following the first group class attribute.

Resolves: #332

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-09-03 14:35:31 +02:00
Nikos Mavrogiannopoulos
dbbf7fe3e0 ns.sh: conditionally call IP with NSNAME3 route
This fixes operation in Fedora 32.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-09-03 14:34:03 +02:00
Alan Jowett
77dfa36c71 Stop accepting new TCP connections when the server is at maximum active connection capacity.
Add support for gracefully stopping the server.
Add primer on using ocserv with L3 load balancer.

Resolves: #345

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2020-08-28 16:01:35 -06:00
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
d0a509c6c3 tests: introduced new proxy protocol tests
This replaces the old no longer used "docker-tests".

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-08-09 21:32:27 +02:00
Nikos Mavrogiannopoulos
5021c994db tests: always use @ISOLATE_WORKERS@
Now all tests configs are being auto-generated, so this variable
will be replaced.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-08-09 19:56:37 +02:00
Nikos Mavrogiannopoulos
d84272ffed tests: added test for ping-leases
Resolves: #340

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-08-09 17:59:04 +02:00
Nikos Mavrogiannopoulos
b2c0c6c1cf tests: replaced explicit ports with random assignment
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-08-09 13:14:22 +02:00
Nikos Mavrogiannopoulos
f814cf851b tests: added session resumption test
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-08-09 11:54:04 +02:00
Nikos Mavrogiannopoulos
ae9f299b0f Merge branch 'tmp-warn-in-password-auth' into 'master'
config: error when multiple password authentication methods are present

See merge request openconnect/ocserv!205
2020-08-06 11:10:53 +00:00
Nikos Mavrogiannopoulos
0ecef93423 .gitlab-ci.yml: reenable address sanitizer
This disables all the tests that use LD_PRELOAD, and thus limits
the test suite on the tests that are run as root.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-08-05 23:08:43 +02:00
Nikos Mavrogiannopoulos
7a7d432d0f use REMOTE_HOSTNAME to pass the user's advertised hostname
The previously used HOSTNAME variable is being overriden by bash and
thus was not a reliable one. We switch to setting REMOTE_HOSTNAME,
but keep the HOSTNAME for compatibility.

This also changes 'test-pass-script' to check for the new variable.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-08-05 23:05:24 +02:00
Nikos Mavrogiannopoulos
08c0eecc85 config: error when multiple password authentication methods are present
This prevents starting a server with an invalid configuration.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-08-05 22:46:24 +02:00
Nikos Mavrogiannopoulos
91712b3420 test-script-multi-user: do not run under asan
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-08-04 22:48:33 +02:00
Nikos Mavrogiannopoulos
99fd5d7263 test-pass-script: introduced more sophisticated timeouts
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-08-04 22:48:33 +02:00
Nikos Mavrogiannopoulos
8934be816c Merge branch 'issue326' into 'master'
Pass the hostname to ocserv-main after receiving the connect request.

Closes #326

See merge request openconnect/ocserv!200
2020-07-29 17:13:21 +00: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
68eccaedf7 sample.config: documented host-update-script and added unit test
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-07-28 20:12:52 +02:00
Nikos Mavrogiannopoulos
9460367822 Added the config option of a pre-login banner
Resolves: #313

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-07-27 22:15:12 +02: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
William Dauchy
1bb2d8800f tests, ns: use namespace option for all ip commands
simplifies use of of `ip netns exec` when it is about ip commands

Signed-off-by: William Dauchy <w.dauchy@criteo.com>
2020-07-14 12:15:46 +02:00
William Dauchy
f4c7d41d14 add basic namespace support for listen address
- this patch adds `listen-netns` parameter
- when set the listening socket will be created in the given namespace

it allows to properly segregate your traffic:
- do the backend traffic in the root namespace
- receive the VIP traffic in a given namespace

All this patch is widely inspired by haproxy implementation which allows
to bind each IP in a given namespace.

Resolves: #316

Signed-off-by: William Dauchy <w.dauchy@criteo.com>
2020-07-13 18:11:30 +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
770c4202f5 Provide option to suppress tests that depend on /dev/net/tun
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2020-07-08 14:31:35 -06:00
Nikos Mavrogiannopoulos
6f3b20f17b radius-config: stability updates
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-06-29 12:06:35 +02:00
Nikos Mavrogiannopoulos
95fb96ee32 test-udp-listen-host: added some reliability improvements
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-06-29 12:06:29 +02:00
Nikos Mavrogiannopoulos
fdb80bb23e tests: detect openconnect's path and fail if not found
Resolves: #311

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-06-11 22:26:33 +02:00
Nikos Mavrogiannopoulos
1dacbb13a7 tests: added test cases for no-route in group and main configuration
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-05-30 10:38:44 +02: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
Nikos Mavrogiannopoulos
3a8e280a92 translate labels to groups when provided by client
This addresses issues with anyconnect clients which send back the descriptive labels.

Resolves #267

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-05-21 22:24:17 +02:00
Nikos Mavrogiannopoulos
03b05526c3 tests: check whether ipv6 interface is up
Relates: #301

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-05-13 06:16:27 +02:00
Alan Jowett
9d9907ef5e Attempt to download updated JWKs if the client presents an unknown key.
Limit the download of keys to every 900s.

Resolves: #284
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2020-04-19 16:30:12 -06:00
Nikos Mavrogiannopoulos
fd2bd42cb2 .gitlab-ci.yml: corrected kerberos tests
This also corrects the kerberos test script environment
to enable running the test.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
2020-04-10 23:06:07 +02:00
Nikos Mavrogiannopoulos
e9251a66e8 tests: test-max-same-1/test-multi-cookie: use update_config
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
2020-04-08 19:37:57 +02:00
Nikos Mavrogiannopoulos
9246431590 tests: radius tests are not run when radius is disabled
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-04-08 19:25:56 +02:00
Nikos Mavrogiannopoulos
689843e874 tests: separate resources in haproxy-connect in test-udp-listen-host
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-04-08 19:25:47 +02:00
Nikos Mavrogiannopoulos
fe99e77ccb vpnc-script: added attempt-reconnect
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-04-06 13:49:01 +02:00
Nikos Mavrogiannopoulos
2d9bc11f59 occtl: list actual banned entries
This fixes the ban entries listing from printing all the items in
the database, to all the items that are actually banned from
connecting.

Resolves: #272

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
2020-04-03 22:09:14 +02:00
Nikos Mavrogiannopoulos
3544e3ee2b tests: verify environment under Apple clients
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-03-16 22:21:37 +01:00
Nikos Mavrogiannopoulos
65a7fcab67 tests: remove option pointing to non-existant script
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-03-15 13:23:35 +01:00
Nikos Mavrogiannopoulos
881953c293 Merge branch 'tmp-test-psk-negotiate' into 'master'
Fix PSK-NEGOTIATE ciphers

Closes #262

See merge request openconnect/ocserv!147
2020-03-12 19:40:32 +00:00
Nikos Mavrogiannopoulos
bcc07c935e tests: improved ipv6-prefix
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-03-12 19:47:50 +01:00
Nikos Mavrogiannopoulos
bf8616cbca tests: generate_oidc_test_data: fixed used of strncat
Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
2020-03-12 19:47:50 +01:00
Nikos Mavrogiannopoulos
5e817d3d60 tests: added test to test match-tls-dtls-ciphers config option
Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
2020-03-12 17:01:01 +01:00