Commit Graph

2113 Commits

Author SHA1 Message Date
Nikos Mavrogiannopoulos
f6cb0db8e0 get_cert_names: made infinite loop apparent
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-12-09 15:44:12 +01:00
Nikos Mavrogiannopoulos
07606fc2d8 load_keys: avoid hiding a global variable
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-12-09 15:10:41 +01:00
Nikos Mavrogiannopoulos
9482756e6c parse_cfg_file: avoid hiding a global variable
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-12-09 15:10:01 +01:00
Nikos Mavrogiannopoulos
e035221030 update_auth_time_stats: cast operations to avoid overflows
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-12-09 15:05:24 +01:00
Nikos Mavrogiannopoulos
d619c90518 Avoid localtime() in favor of localtime_r()
This is to keep some static analyzers happy that check for the
thread safe functions, even if in practice we do not need to be
thread safe.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-12-09 15:01:39 +01:00
Nikos Mavrogiannopoulos
24814ac874 ocserv: avoid the use of ctime
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-12-09 14:55:46 +01:00
Nikos Mavrogiannopoulos
5c53d5f82d Updated bundled http-parser
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-12-09 09:31:07 +01:00
Nikos Mavrogiannopoulos
d08f4832e4 update_fd_limits: removed comment on future raise
This increases the maximum number of fds by 96 to allow up to
128 scripts being run when close to the maximum limit of clients.

Resolves: #349

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-12-03 23:52:32 +01:00
Nikos Mavrogiannopoulos
86138698fe update_fd_limits: set fd limits for "unlimited" users to 8k
Relates: #349

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-12-03 23:42:14 +01:00
Russ Young
3055c15c96 Log changes to reduce logging noise
Signed-off-by: Russell Young <ruyoung@microsoft.com>
2020-12-03 10:58:22 +01:00
Nikos Mavrogiannopoulos
5cf457b425 Removed the listen-clear-file config option
This option was almost impossible to use in general and worked with
very few clients only (not including openconnect). That also meant that
it could not be tested. Removed to reduce maintenance to parameters
that are used in practice.

Resolves: #376

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-12-03 10:04:57 +01:00
Nikos Mavrogiannopoulos
6c9615618d Merge branch 'tmp-coverity-fixes' into 'master'
Several fixes or annotations attributed to coverity scan

See merge request openconnect/ocserv!237
2020-12-03 09:00:59 +00:00
Alan Jowett
50ab40782a Fix coverty warning in forward_udp_to_owner
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
2020-12-02 12:58:56 -07:00
Nikos Mavrogiannopoulos
8000de58bd handle_sec_auth_cont: corrected use of ps_status_to_str
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-12-01 21:03:29 +01:00
Nikos Mavrogiannopoulos
6805023bd3 handle_sec_auth_cont: print status in readable form
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-12-01 20:48:22 +01:00
Nikos Mavrogiannopoulos
b797d509fc set_non_block: ensure we log errors
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-11-26 14:38:05 +01:00
Nikos Mavrogiannopoulos
d60cbf53c5 handle_commands_from_main: silence coverity
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-11-26 14:38:03 +01:00
Nikos Mavrogiannopoulos
9680622d86 handle_events_cmd: silence coverity
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-11-26 14:25:14 +01:00
Nikos Mavrogiannopoulos
65a0e595e5 gssapi_vhost_init: simplified
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-11-26 14:22:36 +01:00
Nikos Mavrogiannopoulos
6fe528ec4c post_auth_handler: added error checking to cstp_printf
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-11-26 14:22:25 +01:00
Nikos Mavrogiannopoulos
57c0381269 send_stats_to_secmod: silence coverity
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-11-26 14:22:17 +01:00
Nikos Mavrogiannopoulos
56c6ab9cbf _listen_unix_ports: error when remove fails
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-11-26 14:20:26 +01:00
Nikos Mavrogiannopoulos
4150c2251b pam: silence coverity warning
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-11-26 14:20:22 +01:00
Nikos Mavrogiannopoulos
3be9234cb9 gnutls_rnd(): always check its return value
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-11-19 22:20:19 +01: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
Nikos Mavrogiannopoulos
82fc1e4881 Merge branch 'tmp-enhance-syscalls' into 'master'
worker-privs: enhanced with syscalls used by socket wrapper

See merge request openconnect/ocserv!233
2020-11-01 22:27:55 +00:00
Nikos Mavrogiannopoulos
9521918143 worker-privs: allow new syscalls
This adds the syscalls used by socket wrapper as observed
in Fedora builders, as well as syscalls observed in different
platforms such as aarch64.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-10-30 22:31:59 +01:00
Nikos Mavrogiannopoulos
d83a39da51 set_env_from_ws: ensure there are no uninitialized variables from snapshot
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-10-30 22:11:09 +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
16bfb30586 inih: reintroduced INI_STOP_ON_FIRST_ERROR
This also introduces better error reporting to inih, and
handling of the errors received by inih.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-10-18 21:05:08 +02:00
Nikos Mavrogiannopoulos
c49d981274 inih: updated to latest version
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-10-18 21:05:05 +02:00
Nikos Mavrogiannopoulos
e7233819da inih: increased max line size
This also removes the stop on first error directive
which was set but not used for very long time.

Resolves: #364

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-10-18 13:30:00 +02:00
Alan Jowett
6fe6926cff Log disconnects from TCP healt probe at debug level
Signed-off-by: Alan Jowett alan.jowett@microsoft.com
2020-10-16 09:13:49 -06:00
Alan Jowett
f116c134a4 Log fatal key retrieval errors at LOG_ERR
Resolves #365

Signed-off-by: Alan Jowett alan.jowett@microsoft.com
2020-10-14 15:47:48 -06:00
Alan Jowett
c106bb86fc Merge branch 'issue363' into 'master'
Latency stats should be at LOG_DEBUG not LOG_INFO level

Closes #363

See merge request openconnect/ocserv!225
2020-10-07 19:52:35 +00:00
Alan Jowett
cd0f382628 Latency stats should be at LOG_DEBUG not LOG_INFO level
Resolves: #363

Signed-off-by: Alan Jowett alan.jowett@microsoft.com
2020-10-07 13:09:05 -06:00
Alan Jowett
7ffb4d1ca2 TCP health probes shouldn't be logged at INFO level
Resolves: #362

Signed-off-by: Alan Jowett alan.jowett@microsoft.com
2020-10-07 12:56:24 -06: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
Alan Jowett
7a924b6d9c Don't attempt TLS if the client closes the connection with zero data sent.
Resolves #357

Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
2020-09-30 16:03:38 -06:00
Alan Jowett
12c3d62276 Stop listening on ocserv-sm socket on error to prevent looping.
Resolves #356

Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
2020-09-29 22:51:52 +02:00
Nikos Mavrogiannopoulos
61c2b5c155 Merge branch 'tmp-nanosleep' into 'master'
disable_system_calls: added clock_nanosleep

See merge request openconnect/ocserv!216
2020-09-21 07:24:23 +00:00
Nikos Mavrogiannopoulos
8208f74138 disable_system_calls: added clock_nanosleep
It seems that new fedora versions depend on it for nanosleep().

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-09-21 08:41:32 +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
5cb41a570b Fix display of rx/tx per sec limit
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2020-09-15 19:14:37 +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
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
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
c3e62fe7a3 Merge branch 'tmp-enable-asan' into 'master'
.gitlab-ci.yml: reenable address sanitizer

See merge request openconnect/ocserv!202
2020-08-06 11:10:13 +00: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