Bug 1375851 - ocserv kdcproxy stopped to work in Fedora 25 due to GNUTLS error
Summary: ocserv kdcproxy stopped to work in Fedora 25 due to GNUTLS error
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: ocserv
Version: 25
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Nikos Mavrogiannopoulos
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-09-14 05:44 UTC by Alexander Bokovoy
Modified: 2016-10-10 17:47 UTC (History)
1 user (show)

Fixed In Version: ocserv-0.11.4-3.fc25 ocserv-0.11.5-1.fc25
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-10-10 17:47:31 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Alexander Bokovoy 2016-09-14 05:44:34 UTC
Description of problem:
After upgrade to Fedora 25, ocserv's KDC proxy stopped working. Journal output says there is a problem with randomness source reported by GNUTLS:

ocserv-0.11.4-1.fc25.x86_64

# journalctl -u ocserv -f
-- Logs begin at Sat 2014-11-01 17:38:46 CET. --
Sep 14 07:27:56 id.vda.li systemd[1]: Starting OpenConnect SSL VPN server...
Sep 14 07:27:56 id.vda.li ocserv[2537]: Setting 'plain' as primary authentication method
Sep 14 07:27:56 id.vda.li ocserv[2537]: Enabling 'gssapi' as authentication method
Sep 14 07:27:56 id.vda.li ocserv[2537]: Enabling 'gssapi' as authentication method
Sep 14 07:27:56 id.vda.li ocserv[2537]: Setting 'file' as supplemental config option
Sep 14 07:28:06 id.vda.li systemd[1]: ocserv.service: PID file /var/run/ocserv.pid not readable (yet?) after start: No such file or directory
Sep 14 07:28:06 id.vda.li ocserv[2608]: main: initialized ocserv 0.11.4
Sep 14 07:28:06 id.vda.li ocserv[2609]: sec-mod: reading supplemental config from files
Sep 14 07:28:06 id.vda.li systemd[1]: Started OpenConnect SSL VPN server.
Sep 14 07:28:06 id.vda.li ocserv[2609]: sec-mod: sec-mod initialized (socket: /var/lib/ocserv/ocserv.sock.2608)
Sep 14 07:28:32 id.vda.li ocserv[2613]: GnuTLS error (at worker-vpn.c:585): Error in the system's randomness device.
Sep 14 07:28:32 id.vda.li ocserv[2608]: main: X.X.X.X:50280 user disconnected (reason: unspecified, rx: 0, tx: 0)

Unfortunately, nothing can point to exact issue. audit.log does not have any indications that ocserv daemon process couldn't write to /dev/random or /dev/urandom. gnutls-cli-debug cannot connect to the ocserv as ocserv just drops connection immediately due to GNUTLS error. gnutls-cli when run on the same host against an Apache server running on the same host works just fine.

Looking at similar errors in search engines, I can see Debian users complaining about nzbt showing the same problem in daemon mode when built against gnutls. Unfortunately, no recipe was provided there other than rebuilding against OpenSSL.

I'm filing the bug against ocserv but feel free to move to gnutls if that is the real place where the issue happens.

Comment 1 Alexander Bokovoy 2016-09-14 05:55:46 UTC
Ok, tracing ocserv shows following:
--------------------------------------------------------------------------
[pid  2781] clock_gettime(CLOCK_REALTIME, {1473832277, 955959216}) = 0
[pid  2781] brk(NULL)                   = 0x563df2640000
[pid  2781] brk(NULL)                   = 0x563df2640000
[pid  2781] brk(0x563df263b000)         = 0x563df263b000
[pid  2781] brk(NULL)                   = 0x563df263b000
[pid  2781] getrandom(0x7ffd1021dc90, 32, 0) = -1 EPERM (Operation not permitted)
[pid  2781] sendto(7, "<27>Sep 14 07:51:17 ocserv[2781]: GnuTLS error (at worker-vpn.c:585): Error in the system's randomness device.", 110, MSG_NOSIGNAL, NULL, 0) = 110
[pid  2781] exit_group(1)               = ?
--------------------------------------------------------------------------

So, gnutls started using getrandom() call but environment is not set to allow it.

I'm running 4.8.0-0.rc5.git1.1.fc25.x86_64 kernel.

Both bug 1172273 and 1329996 sound not very optimistic in getting getrandom() to glibc. Can we back out use of getrandom() in gnutls or at least try other means if that one is failing?

Comment 2 Alexander Bokovoy 2016-09-14 05:56:26 UTC
This is, at the very least, a blocker for use of ocserv in Fedora 25.

Comment 3 Nikos Mavrogiannopoulos 2016-09-14 08:19:39 UTC
Yes gnutls uses getrandom() in F25 using the syscall() interface. If you set isolate-worker=false would that work? If yes, then I need to update ocserv's allowed set of system calls to include getrandom().

Comment 5 Alexander Bokovoy 2016-09-14 08:26:38 UTC
Yes, changing 'isolate-workers' to 'true' helped.

Comment 6 Fedora Update System 2016-09-14 08:43:39 UTC
ocserv-0.11.4-3.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2016-86f48d69f1

Comment 7 Nikos Mavrogiannopoulos 2016-09-14 08:50:08 UTC
To get deeper into the issue, getrandom() was detected on gnutls library initialization, and the getrandom handlers were set to obtain randomness. However, once the child process started with limited privileges in terms of syscalls gnutls failed.

Given that this is supposed to happen (seccomp filter), I guess this is a legitimate bug for ocserv rather than something that should be addressed in gnutls.

Comment 8 Fedora Update System 2016-09-14 21:23:45 UTC
ocserv-0.11.4-3.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-86f48d69f1

Comment 9 Fedora Update System 2016-09-20 17:07:05 UTC
ocserv-0.11.4-3.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.

Comment 10 Fedora Update System 2016-09-24 01:50:56 UTC
ocserv-0.11.5-1.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-f145304e25

Comment 11 Fedora Update System 2016-10-10 17:47:31 UTC
ocserv-0.11.5-1.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.