Commit Graph

20 Commits

Author SHA1 Message Date
Sheena Mira-ato fe3ae5be5d Add compile option to disable internal handling of fatal signals
By default, charon and its derivatives internally handle the SIGSEGV,
SIGILL, and SIGBUS signals raised by threads (segv_handler).  Add a compile
option so that the signal handling can optionally be done externally.

Closes strongswan/strongswan#132.
2019-05-28 10:44:48 +02:00
Tobias Brunner cbe9e575ee charon-systemd: Don't use atexit() to deinitialize the daemon
This is because OpenSSL 1.1 started to use atexit()-handlers of its own
to clean up.  Since the plugin is loaded and initialized after libcharon,
OpenSSL's cleanup functions ran before the daemon was properly
deinitialized (i.e. worker threads were still running and OpenSSL might
still be used during the deinit).  So several of OpenSSL's internal
structures were already destroyed when libcharon_deinit() was eventually
called via our own atexit()-handler.

The observed behavior was that the daemon couldn't be terminated properly
anymore for some test scenarios (only three TNC scenarios were affected
actually).  When the daemon tried to send the DELETE for the established
IKE_SA during its termination it got stuck in OpenSSL's RNG_WEAK
implementation (used to allocate random padding), which apparently tries
to acquire an rwlock that was already destroyed.  The main thread then
just busy-waited indefinitely on the lock, i.e. until systemd killed
it eventually after a rather long timeout.

We'll probably have to apply similar changes to other apps/scripts that
load plugins and currently use atexit() to clean up.  Although some
scripts (e.g. dh_speed or hash_burn) are not affected because they
register the deinitialization after loading the plugins.
2018-11-21 14:31:49 +01:00
Tobias Brunner 0ca0fa71c0 charon-systemd: Register journal logger as custom logger
This way we get early log messages during plugin loading (including
integrity check results).

Instead of the fallback we could also remove the `customlog` namespace,
which was added to avoid conflicts with other settings/sections.
2018-06-26 15:24:42 +02:00
Tobias Brunner 1b67166921 Unify format of HSR copyright statements 2018-05-23 16:32:53 +02:00
Tobias Brunner 9665686bd8 daemon: Use separate method to set default loggers
This way it is not necessary to pass the same values to reload the
loggers.
2017-01-25 14:58:09 +01:00
Tobias Brunner ff22d53ba9 charon-systemd: Handle SIGHUP the same way charon does
That is, reload strongswan.conf, the loggers and the plugins.
2017-01-25 14:58:05 +01:00
Martin Willi 518a5b2ece configure: Check for and explicitly link against -latomic
Some C libraries, such as uClibc, require an explicit link for some atomic
functions. Check for any libatomic, and explcily link it.
2016-06-14 14:27:20 +02:00
Tobias Brunner bc4e689db1 charon-systemd: Inherit all settings from the charon section
Our default config files are very charon specific.  So to avoid
confusion when only charon-systemd is installed we just default to all
settings defined for charon.  Since charon-systemd probably won't be used
together with charon this should not cause conflicts (settings may still
be overridden via the charon-systemd section).
2016-03-08 10:56:19 +01:00
Tobias Brunner 28649f6d91 libhydra: Remove empty unused library 2016-03-03 17:36:11 +01:00
Chris Patterson b15f987ddd configure: Support systemd >= 209
libsystemd-journal and libsystemd-daemon are now just
part of libsystemd.

Keep original systemd checks as a fallback.

Updates charon-systemd/Makefile.am accordingly.

Tested on:
- debian wheezy (systemd v44)
- ubuntu 15.10 (systemd v255).

Signed-off-by: Chris Patterson <pattersonc@ainfosec.com>

Closes strongswan/strongswan#24.
2015-12-21 11:53:31 +01:00
Tobias Brunner 88b85e022a sigwaitinfo() may fail with EINTR if interrupted by an unblocked signal not in the set
Fixes #1213.
2015-11-23 11:37:19 +01:00
Tobias Brunner 3195650180 Fix typo in error handling for sigwaitinfo() in charon-systemd and charon-tkm
Fixes 858148092d ("Replace usages of sigwait(3) with sigwaitinfo(2)")
2015-10-29 17:40:31 +01:00
Tobias Brunner 858148092d Replace usages of sigwait(3) with sigwaitinfo(2)
This is basically the same call, but it has the advantage of being
supported by FreeBSD's valgrind, which sigwait() is not.

References #1106.
2015-10-29 15:38:37 +01:00
Tobias Brunner d2f4345b03 charon-systemd: Optionally load plugin list from charon-systemd.load 2015-03-19 18:37:24 +01:00
Martin Willi 9c3c41f29b charon-systemd: Add missing semicolon
References #887, fixes f3c83322.
2015-03-16 09:31:17 +01:00
Tobias Brunner f3c8332220 charon-systemd: Add support to configure user and group via strongswan.conf
Fixes #887.
2015-03-13 14:34:53 +01:00
Tobias Brunner 245979abc0 charon-systemd: Typo in log message fixed 2014-10-13 16:51:20 +02:00
Martin Willi db8ae75bf6 systemd: Discover and check systemd libraries with pkg-config during configure 2014-09-22 14:19:38 +02:00
Martin Willi e2d9f27c19 systemd: Add a native systemd journal logger 2014-09-22 14:19:37 +02:00
Martin Willi 73ed38e74f systemd: Provide a charon-systemd daemon targeting full systemd integration 2014-09-22 13:55:11 +02:00