Commit Graph

571 Commits

Author SHA1 Message Date
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
Grigory Trenin
e40d735316 occtl: Fix column misalignment in ban command outputs
- Increase the width from 14 to 15 characters for 'show bans' and
'show ban points' commands. This ensures proper column alignment
for all valid IPv4 addresses.

- Reduce Score column to 10 characters since UINT_MAX is typically
10 digits.

- Remove unnecessary (unsinged int) cast since 'score' is an actual
unsigned int.

Signed-off-by: Grigory Trenin <grigory.trenin@gmail.com>
2026-01-04 13:32:51 -05:00
Nikos Mavrogiannopoulos
1837b5877d NEWS: updated for 1.4.1
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-01-04 15:11:37 +01:00
Nikos Mavrogiannopoulos
5f5ac6fe65 Released 1.4.0
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-01-04 14:41:44 +01:00
Grigory Trenin
98015b1b24 Fix max_mtu calculation in server stats
proc->mtu was incorrectly compared against min_mtu instead of max_mtu

Signed-off-by: Grigory Trenin <grigory.trenin@gmail.com>
2026-01-02 16:34:59 -05:00
Nikos Mavrogiannopoulos
ef075f6b83 get_auth_handler2: update to reflect username and password ask
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-01-01 20:14:20 +01:00
Nikos Mavrogiannopoulos
e12b278260 fixed typo
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2026-01-01 17:38:10 +01:00
Grigory Trenin
1893047e8f Fix irregular stats-report-time
Currently 'ocserv' sends session accounting statistics at irregular intervals.
For example, if 'stats-report-time' is set to 60, the actual intervals may vary
between 50, 60, 70, or even 80 seconds.  Moreover, these intervals are not
constant - they fluctuate arbitrarily with each statistics update.

This behavior was intentionally introduced to avoid worker processes acting
simultaneously in scenarios like server restarts, where all clients reconnect
at the same time, which could impose heavy load on the secmod process.

However, it causes issues for RADIUS servers that require accurate and
consistent timing.

Summary of changes:
 - Apply randomization only once when the timer is initially set up, affecting
   only the first timer firing.  All subsequent firings will occur at regular
   intervals relative to the first one.
 - Remove fuzzing from 'interim_update_secs'. This value originates either from
   RADIUS or from 'stats-report-time' and should not be altered.

Closes: #630

Signed-off-by: Grigory Trenin <grigory.trenin@gmail.com>
2026-01-01 17:31:01 +01:00
Grigory Trenin
0f53e0d6d9 Communicate secmod address to worker after successful authentication
This ensures all subsequent worker communications reach the original
secmod instance that authenticated the client, enabling correct session
accounting after IP address changes.

Closes: #674

Signed-off-by: Grigory Trenin <grigory.trenin@gmail.com>
2025-12-21 11:41:51 +01:00
Grigory Trenin
afa34bbd10 Fix ban score reset logic
The previous condition for resetting a ban score was insufficient.
It failed to reset the score for a client that had just exited a ban,
and also incorrectly reset the score of a currently banned client,
causing premature unbans.

Closes: #678

Signed-off-by: Grigory Trenin <grigory.trenin@gmail.com>
2025-12-21 11:24:19 +01:00
Grigory Trenin
d15b2af4b2 Fix 'occtl show ip bans' showing expired ban entries
Added current timestamp comparison to ensure only active bans
are shown by 'occtl show ip bans'.

Closes: #675.

Signed-off-by: Grigory Trenin <grigory.trenin@gmail.com>
2025-12-21 10:54:16 +01:00
Grigory Trenin
1c31314df4 occtl: Fix missing column headers in 'show ip bans' output
Existing code used the loop index 'i == 0' to determine when to print
column headers. However, a 'continue' statement inside the loop could
skip the 'i = 0' iteration, causing the headers to never be printed.

Introduced a separate boolean 'header_printed' variable to track
whether headers have been printed.

Closes: #677

Signed-off-by: Grigory Trenin <grigory.trenin@gmail.com>
2025-12-21 10:52:20 +01:00
Grigory Trenin
3892e032d9 Fix DTLS with systemd socket activation
Remove IPV6_V6ONLY flag from per-client UDP sockets as it prevents
IPv4 traffic on systemd-provided IPv6 sockets. This was a legacy
from the old reopen_udp_port() code and is no longer needed.

Fixes: #647

Signed-off-by: Grigory Trenin <grigory.trenin@gmail.com>
2025-12-21 10:48:59 +01:00
Dimitri Papadopoulos Orfanos
c5acc8580e Merge branch 'tmp-llhtp' into 'master'
llhttp: updated to latest version 9.3.0

See merge request openconnect/ocserv!459
2025-12-06 11:15:36 +01:00
Pavel Lavrukhin
59c67fb160 Fix invalid JSON output in occtl commands 2025-12-06 10:54:28 +01:00
Grigory Trenin
4dcf3aa524 Fix iroute option processing
Return proper values (1 for success, 0 for error) from iroutes_handler()
to prevent premature parser termination

Signed-off-by: Grigory Trenin <grigory.trenin@gmail.com>
2025-11-30 19:53:14 -05:00
Grigory Trenin
a307bda153 Repair ping-leases option
A misplaced bracket passed 'sizeof(*addr1) == -1' instead of 'sizeof(*addr1)'
to sendto(), causing it to fail. This prevented icmp_ping4() from sending
ICMP echo requests.

Consequently, the 'ping-leases' option has been non-functional since
this bug was introduced in commit 2aaa287a.

Signed-off-by: Grigory Trenin <grigory.trenin@gmail.com>
2025-11-21 15:59:01 -05:00
Grigory Trenin
1d76699731 Revert "combined CSCOT URLs"
This reverts commit 6fea92a961.

The URL consolidation caused worker to no longer recognize either of the original URLs.
This led to "unexpected URL" errors and immediate worker termination.

The original change was intended to simplify URL configuration,
but it inadvertently broke functionality for both endpoints.

Signed-off-by: Grigory Trenin <grigory.trenin@gmail.com>
2025-11-05 09:12:27 -05:00
Dimitri Papadopoulos
cc86919f28 llhttp: updated to latest version 9.3.0
Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
2025-08-28 22:17:07 +03:00
Dimitri Papadopoulos
78658605c9 updated to protobuf 1.5.1
Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
2025-03-02 19:30:44 +01:00
Nikos Mavrogiannopoulos
f5b85f130a doc update
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2024-11-19 08:21:15 +01:00
Nikos Mavrogiannopoulos
d6b18598cd NEWS: updated [ci skip]
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2024-09-08 10:49:12 +02:00
Nikos Mavrogiannopoulos
92dba6e4f5 released 1.3.0
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2024-05-05 21:08:20 +02:00
Nikos Mavrogiannopoulos
538be2b5ff NEWS: mentioned closed issue
Resolves: #597

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2024-04-29 22:26:21 +02:00
Nikos Mavrogiannopoulos
cf56c9754b Switch from http-parser to llhttp
http-parser is an unmaintained library that has been replaced by llhttp.

Resolves: #598

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2024-04-28 13:37:19 +02:00
Nikos Mavrogiannopoulos
71e4aba580 config: silence informational messages on worker reload
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2024-04-27 21:32:19 +02: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
Dimitri Papadopoulos
c734a9c929 Bump MAX_GROUPS to allow for more groups
Especially Radius accounts might belong to a large number of groups.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
2024-03-19 07:53:15 +01:00
Nikos Mavrogiannopoulos
444ae6022a bumped version [ci skip]
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2024-02-02 16:29:50 +01:00
Nikos Mavrogiannopoulos
7ced730fb2 released 1.2.4
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2024-01-22 22:57:08 +01: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
Dimitri Papadopoulos Orfanos
aa41bfb8fe Merge branch 'PACKAGE_NAME' into 'master'
Further improvements to arguments of AC_INIT

See merge request openconnect/ocserv!410
2024-01-07 16:28:04 +00:00
Nikos Mavrogiannopoulos
c403e2bd02 Added detection logic for new openconnect
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2024-01-06 22:21:54 +01:00
Dimitri Papadopoulos
badf9be99a Further improvements to arguments of AC_INIT
Reapply df6a3c2a, this time without regression.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
2024-01-06 18:21:27 +01:00
Dimitri Papadopoulos
3a3edcfd80 Bug reports are not to be sent by mail anymore
Instead they should be filed on GitLab.

Adapt the relevant explanation to the different tpye of bug reporting mechanism.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
2024-01-05 23:31:05 +01:00
Dimitri Papadopoulos
715b9b2ea1 Use proper symbol for second, prefix for kilo
The SI symbol for second is s:
https://www.bipm.org/en/si-base-units/second

The SI prefix for a multiplying factor of 10³ is k:
https://www.bipm.org/en/measurement-units/si-prefixes

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
2023-12-24 10:40:21 +01:00
Dimitri Papadopoulos
54818f3b67 Fix logging to stderr
While each `syslog()` adds a new entry to the system log,
`fprintf(stder, ...)` does not automatically add a newline
to distinguish between entries. We need to add the newline
ourselves.

We tried to make _oc_syslog() as atomic as possible in the
context of a multi-process daemonn by keeping a single
`fprtinf()` call. Probably not perfect, but the best we
can do when printing to stderr instead of using the system
logger. Works only with the GNU C or compatible compiler.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
2023-12-23 23:17:41 +01:00
Dimitri Papadopoulos
8a61a68f06 More missing entries in NEWS
Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
2023-12-22 15:59:13 +01:00
Dimitri Papadopoulos
2f2346c625 Add missing entry in NEWS
For ff57a148 / !397.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
2023-12-20 22:09:58 +01:00
Nikos Mavrogiannopoulos
675c1280a8 added missing NEWS entry [ci skip]
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2023-12-17 21:50:36 +01:00
Nikos Mavrogiannopoulos
0f5ba83f76 released 1.2.3
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2023-12-17 12:26:58 +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
39f274fb01 doc update [ci skip]
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2023-12-14 14:16:05 +01:00
Dimitri Papadopoulos
8ada82ff5c bin/ocserv-fw → libexec/ocserv-fw
Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
2023-11-28 21:57:02 +01:00
Dimitri Papadopoulos Orfanos
a3ff6864b9 Merge branch 'fix_clean_all_rules' into 'master'
Fix clean_all_rules bug on multiple devices

See merge request openconnect/ocserv!384
2023-11-27 21:35:39 +00:00
Gennady Sadchikov
392a6542d3 Fixed clean_all_rules logic on multiple similar devices
Signed-off-by: Gennady Sadchikov <dessolo@mail.ru>
2023-11-27 15:29:42 +03:00
Dimitri Papadopoulos
86ea13b213 A few RADIUS changes
* Use the exact names used in RFC 2548.
* Warn in case Radius sends more than 2 DNS server IPv6 addresses.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
2023-11-26 12:36:53 +01:00
Nikos Mavrogiannopoulos
80d6a32d11 doc update
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2023-10-03 12:29:47 +02:00
Florian Domain
ec6c48da4e occtl: add machine-readable "raw_connected_at" field for user stats
* useful for machines reading JSON to get directly the unix timestamp of
  the users connection start time

Signed-off-by: Florian Domain <f.domain@criteo.com>
2023-09-22 18:49:27 +02:00