Commit Graph

44 Commits

Author SHA1 Message Date
Thomas Egerer 4e29d6fac1 bus: Extend and reorder arguments of ike_derived_keys() hook
This now includes all key material derived for IKE_SAs in the order
defined in the RFC:

  {SK_d | SK_ai | SK_ar | SK_ei | SK_er | SK_pi | SK_pr}
               = prf+ (SKEYSEED, Ni | Nr | SPIi | SPIr)

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2021-06-07 17:08:27 +02:00
Tobias Brunner 08a3ee0cce bus: Change ike_update() signature and only call it once
This avoids multiple events when both addresses change (e.g. switching
address families).
2021-01-18 11:34:40 +01:00
Tobias Brunner b422f16d10 sys-logger: Optionally log the level of each message
Fixes #3509.
2020-10-27 10:42:49 +01:00
Tobias Brunner a3f5e38b7f file-logger: Optionally log the level of each message
Fixes #3509.
2020-10-27 10:42:39 +01:00
Tobias Brunner b06374f6a5 file-logger: Set owner/group of log file
The file is usually opened/created by root, however, if user/group IDs
are configured and the configuration is reloaded, the file will be reopened
as configured user.  Like with UNIX sockets we only attempt to change
the user if we have CAP_CHOWN allowing a start as regular user.

We don't have chown() on Windows, so check for it.
2020-05-07 09:30:57 +02:00
Thomas Egerer eed20c21d3 ha: Add auth method for HA IKEv1 key derivation
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2018-12-07 10:17:56 +01:00
Thomas Egerer 32c190634c custom-logger: Add optional reload method
The reload of the configuration of the loggers so far only included
the log levels. In order to support the reload of all other options,
a reload function may be implemented.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2018-08-29 15:55:33 +02:00
Tobias Brunner 1b67166921 Unify format of HSR copyright statements 2018-05-23 16:32:53 +02:00
Tobias Brunner f5fe0ffa2a bus: Add new hooks for derived IKE_SA and CHILD_SA keys 2016-10-04 10:01:49 +02:00
Andreas Steffen b12c53ce77 Use standard unsigned integer types 2016-03-24 18:52:48 +01:00
Thomas Egerer 2080c7e1e2 charon: Add custom logger to daemon
This logger can be used to easily register custom logging instances
using __attribute__((constructor)) benefiting from the global reload
mechanism (with reset of log levels).

Note that this is not intended to be used from plugins, which are loaded
after loggers have already been initialized.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2016-03-01 11:48:52 +01:00
Tobias Brunner 548b993488 file-logger: Add option to print milliseconds within the current second after timestamp
For this to look right time_format should end with %S or %T.

Closes strongswan/strongswan#18.
2015-11-09 16:30:00 +01:00
Tobias Brunner 072d9dc3c6 bus: Add new hook called when IKEv1 CHILD_SAs are migrated to a new IKE_SA
The interface is currently not very nice, but if we ever were able to
safely checkout multiple SAs concurrently we could add something similar
to ike_rekey() and call that when we detect a reauthentication.
2015-05-21 15:38:31 +02:00
Martin Willi e1fe2781b0 bus: Add an ike_update() hook invoked when peer endpoints change 2015-02-20 15:33:59 +01:00
Tobias Brunner 614359a7d5 bus: Add ike_reestablish_pre hook, called before DNS resolution
The old hook is renamed to ike_reestablish_post and is now also called
when the initiation of the new IKE_SA failed.
2014-07-22 11:10:36 +02:00
Martin Willi eef7427b0f bus: Add a handle_vips() hook invoked after handling configuration attributes
Similar to assign_vips() used by a peer assigning virtual IPs to the other peer,
the handle_vips() hook gets invoked on a peers after receiving attributes. On
release of the same attributes the hook gets invoked again.

This is useful to inspect handled attributes, as the ike_updown() hook is
invoked after authentication, when attributes have not been handled yet.
2014-06-17 15:14:51 +02:00
Martin Willi 7fc98a840b ikev1: Invoke the assign_vips() bus hook for IKEv1 as well 2014-06-16 15:59:17 +02:00
Martin Willi 55c2b47a90 file-logger: Emulate setlinebuf() if not supported by using fflush() 2014-06-04 15:53:09 +02:00
Martin Willi b9dca7057c filelog: Ignore flush_line option if setlinebuf() not supported 2014-06-04 15:53:04 +02:00
Tobias Brunner 0ceb288815 Fix various API doc issues and typos
Partially based on an old patch by Adrian-Ken Rueegsegger.
2013-07-18 18:30:36 +02:00
Martin Willi 61177388bd syslog: setlogmask() to include LOG_INFO
LOG_INFO seems to be excluded by default on some systems (OS X).
2013-07-18 12:17:54 +02:00
Martin Willi 5f55fd6e61 Introduce an optional logger_t.vlog() method with format string and arguments
To have more flexibility in the logging backend, receiving the original format
string and do printf() substitution in the logger may be preferable. An
additional but optional logger method does not touch the behavior of existing
loggers.
2013-05-06 15:00:15 +02:00
Andreas Steffen 12fa1784d0 emit a single assig_vips bus message for all VIPs 2013-04-06 14:16:30 +02:00
Andreas Steffen ba2880d569 ifmap plugin subscribes to assing_vip bus signal 2013-04-06 11:09:41 +02:00
Tobias Brunner d35d669180 Make syslog and file loggers configurable at runtime 2012-10-18 14:42:10 +02:00
Tobias Brunner 4dbb193190 Add ike_reestablish() event that is triggered when an IKE_SA is reestablished
This is particularly useful during reauthentication to get the new
IKE_SA.
2012-09-06 11:25:14 +02:00
Martin Willi d19f0ae3e0 Don't modify the message string passed to logger, as it gets reused 2012-07-13 15:43:04 +02:00
Tobias Brunner ead92870b8 Loggers specify what log messages they want to receive during registration.
This also allows us to generate the log message only once for all
loggers that need it (avoids calls to custom printf specifier callbacks).

To update the log levels loggers can simply be registered again.
2012-05-02 14:45:38 +02:00
Tobias Brunner d724fcd624 Ensure that multi-line log messages are not torn apart. 2012-05-02 14:45:38 +02:00
Tobias Brunner 0e474f9148 Use a separate interface for loggers.
The new interface does not allow loggers to unregister themselves from
the bus.  This allows us to use a rwlock_t for them.

The latter also means that loggers can now be called concurrently by
multiple threads.
2012-05-02 14:45:38 +02:00
Tobias Brunner f9f867899a Use a separate list and mutex for loggers.
This avoids deadlocks caused by extensive listener_t implementations
which might want to acquire a lock which is currently held by another
thread wanting to log messages. Since the latter requires that thread
to acquire the same lock the initial thread currently holds this
previously resulted in a deadlock.

With this change logging messages does not require threads to acquire
the main lock in bus_t and thus avoids the deadlock.
2012-05-02 14:45:38 +02:00
Martin Willi 47b8f6ef4b Invoke bus_t.message hook twice, once plain and parsed, once encoded and encrypted 2012-03-20 17:31:37 +01:00
Martin Willi 23f9e7a18d Pass IKEv1 specific keymat to ike_keys hook 2012-03-20 17:31:37 +01:00
Tobias Brunner f3bb1bd039 Fixed common misspellings.
Mostly found by 'codespell'.
2011-07-20 16:14:10 +02:00
Tobias Brunner b4c9ab9c79 Cache group name in sys_logger_t to avoid problems with Vstr.
Because syslog(3) is not replaced when using the Vstr wrapper, %N can
not be resolved properly.
2011-05-03 10:50:28 +02:00
Tobias Brunner b7cb8100c4 Migrated sys_logger_t to INIT/METHOD macros. 2011-05-03 10:21:58 +02:00
Tobias Brunner 5bbe0ee18c Migrated file_logger_t to INIT/METHOD macros. 2011-05-03 10:21:03 +02:00
Martin Willi 8427c78611 Added a ike_name logger option to prefix the IKE_SA name on each line 2010-08-25 09:55:37 +02:00
Martin Willi b2e447e24a Pass the CREATE_CHILD_SA initiator flag to the child_keys parameter 2010-07-26 13:53:53 +02:00
Martin Willi be715344c2 Added a hook to narrow traffic selectors for CHILD_SAs 2010-07-13 10:26:07 +02:00
Martin Willi 6f07f5e3d4 The file logger supports a time prefix using a strftime() format specifier 2010-07-08 17:44:19 +02:00
Tobias Brunner 6d7f4e0653 Moved syslog.h include. 2010-05-04 18:34:20 +02:00
Tobias Brunner d7e977aced Fixed some Doxygen warnings. 2010-03-24 15:45:06 +01:00
Tobias Brunner 08c5572602 Moving charon to libcharon. 2010-03-19 13:34:52 +01:00