Commit Graph

3040 Commits

Author SHA1 Message Date
Martin Willi a47e431ba9 vici: Return a Python generator instead of a list for streamed responses
In addition that it may reduce memory usage and improve performance for large
responses, it returns immediate results. This is important for longer lasting
commands, such as initiate/terminate, where immediate log feedback is preferable
when interactively calling such commands.
2015-03-18 13:59:14 +01:00
Martin Willi 90e16837ba vici: Raise a Python CommandException instead of returning a CommandResult 2015-03-18 13:59:14 +01:00
Martin Willi 871cffa141 vici: Add initial Python egg documentation to README 2015-03-18 13:59:14 +01:00
Martin Willi 305023a27d vici: Use OrderedDict to handle vici responses in Python library
The default Python dictionaries are unordered, but order is important for some
vici trees (for example the order of authentication rounds).
2015-03-18 13:59:14 +01:00
Martin Willi 94bb26fae3 vici: Return authentication rounds with unique names
To simplify handling of authentication rounds in dictionaries/hashtables on the
client side, we assign unique names to each authentication round when listing
connection.
2015-03-18 13:59:14 +01:00
Martin Willi d1ad65f7b2 vici: Rebuild ruby gem on source file changes 2015-03-18 13:59:14 +01:00
Martin Willi fb8b119cfa vici: Use default Unix vici socket if none passed to ruby constructor
While we currently have a static path instead of one generated with Autotools,
this at least is congruent to what we have in the Python library.
2015-03-18 13:59:14 +01:00
Martin Willi 61fb10c8cf vici: Support non-Unix sockets for vici connections using Python 2015-03-18 13:59:14 +01:00
Martin Willi 358793389a vici: Add python egg setuptools building and installation using easy_install
An uninstall target is currently not supported, as there is no trivial way with
either plain setuptools or with easy_install. pip would probably be the best
choice, but we currently don't depend on it.
2015-03-18 13:59:14 +01:00
Martin Willi 1e2ec9f96a vici: Generate a version specific setup.py for setuptools installation 2015-03-18 13:59:14 +01:00
Martin Willi 2c8c52c4e2 vici: Include python package in distribution 2015-03-18 13:59:14 +01:00
Björn Schuberg 163e15a571 vici: Add python package MIT license 2015-03-18 13:59:13 +01:00
Björn Schuberg b269c1a89a vici: Expose Session as a top-level symbol in python package 2015-03-18 13:59:13 +01:00
Björn Schuberg 6a31a0f60c vici: Introduce main API Session class in python package 2015-03-18 13:59:13 +01:00
Björn Schuberg 8c089cddef vici: Add a python vici command execution handler 2015-03-18 13:59:13 +01:00
Björn Schuberg b26e142863 vici: Add vici python protocol handler 2015-03-18 13:59:13 +01:00
Martin Willi 84738b1aed encoding: Verify the length of KE payload data for known groups
IKE is very strict in the length of KE payloads, and it should be safe to
strictly verify their length. Not doing so is no direct threat, but allows DDoS
amplification by sending short KE payloads for large groups using the target
as the source address.
2015-03-18 13:33:25 +01:00
Martin Willi b8ecdfd895 ikev2: Migrate MOBIKE additional peer addresses to new SA after IKE_SA rekeying 2015-03-18 13:32:27 +01:00
Martin Willi 80a1ebb1d9 ikev2: Immediately initiate queued tasks after establishing rekeyed IKE_SA
If additional tasks get queued before/while rekeying an IKE_SA, these get
migrated to the new IKE_SA. We previously did not trigger initiation of these
tasks, though, leaving the task unexecuted until a new task gets queued.
2015-03-18 13:28:34 +01:00
Tobias Brunner 6d41927b42 vici: Use %u to print stats returned by mallinfo(3)
Fixes #886.
2015-03-13 15:26:01 +01:00
Tobias Brunner 8286e2050b stroke: Use %u to print stats returned by mallinfo(3)
References #886.
2015-03-13 15:25:53 +01:00
Martin Willi c4b6332211 eap-radius: Increase Acct-Session-ID string buffer
As the startup timestamp needs 10 characters, we only have left 4 characters
for the IKE_SA unique identifier. This is insufficient when having 10000 IKE_SAs
or more established, resulting in non-unique session identifiers.

Fixes #889.
2015-03-13 09:42:03 +01:00
Martin Willi 799f4c5db9 ikev2: Don't set old IKE_SA to REKEYING state during make-before-break reauth
We are actually not in rekeying state, but just trigger a separate, new IKE_SA
as a replacement for the current IKE_SA. Switching to the REKEYING state
disables the invocation of both IKE and CHILD_SA updown hooks as initiator,
preventing the removal of any firewall rules.

Fixes #885.
2015-03-11 14:48:08 +01:00
Martin Willi 438318c6c3 ha: Destroy synced IKE_SA if no configuration is found during update 2015-03-10 15:08:58 +01:00
Martin Willi eb3e339a3c ikev1: Don't handle DPD timeout job if IKE_SA got passive
While a passively installed IKE_SA does not queue a DPD timeout job, one that
switches from active to passive might execute it. Ignore such a queued job if
the IKE_SA is in passive state.
2015-03-10 14:02:22 +01:00
Martin Willi 607eebcfcf libipsec: Pass separate inbound/update flags to the IPsec SA manager
Similar to other kernel interfaces, the libipsec backends uses the flag for
different purposes, and therefore should get separate flags.
2015-03-09 18:18:20 +01:00
Martin Willi 942797a5b5 kernel-interface: Add a separate "update" flag to add_sa()
The current "inbound" flag is used for two purposes: To define the actual
direction of the SA, but also to determine the operation used for SA
installation. If an SPI has been allocated, an update operation is required
instead of an add.

While the inbound flag normally defines the kind of operation required, this
is not necessarily true in all cases. On the HA passive node, we install inbound
SAs without prior SPI allocation.
2015-03-09 18:18:20 +01:00
Martin Willi acad5e9f51 Revert "child-sa: Remove the obsolete update logic"
While the the meaning of the "inbound" flag on the kernel_interface->add_sa()
call is not very clear, we still need that update logic to allow installation of
inbound SAs without SPI allocation. This is used in the HA plugin as a passive
node.

This reverts commit 698ed656.
2015-03-09 18:18:20 +01:00
Martin Willi 8be21ae7ef Revert "ha: Always install the CHILD_SAs with the inbound flag set to FALSE"
While this change results in the correct add/update flag during installation,
it exchanges all other values in the child_sa->install() call. We should pass
the correct flag, but determine the add/update flag by other means.

This reverts commit e722ee5d.
2015-03-09 18:18:20 +01:00
Tobias Brunner 708dff0700 ikev2: Move code in pubkey authenticator's build() method into separate functions 2015-03-09 16:59:07 +01:00
Tobias Brunner 03a340c6c6 ikev2: Try all eligible signature schemes
Previously, we failed without recovery if a private key did not support
a selected signature scheme (based on key strength and the other peer's
supported hash algorithms).
2015-03-09 16:59:07 +01:00
Tobias Brunner 69bb1b8c18 daemon: Remove scheduled jobs before unloading plugins
Especially callback jobs might refer to memory that gets invalid after
the plugins got unlaoded, so make sure we destroy these jobs before.

References #840.
2015-03-09 15:58:06 +01:00
Andreas Steffen 00cd79b678 Make access requestor IP address available to TNC server 2015-03-08 17:17:11 +01:00
Tobias Brunner 9fda0bf007 ikev1: Set protocol ID and SPIs in INITIAL-CONTACT notification payloads
The payload we sent before is not compliant with RFC 2407 and thus some
peers might abort negotiation (e.g. with an INVALID-PROTOCOL-ID error).

Fixes #819.
2015-03-06 16:50:13 +01:00
Tobias Brunner 4e6f102842 ikev2: Try all RSA signature schemes if none is configured 2015-03-04 13:54:12 +01:00
Tobias Brunner 1d94b7950b ikev2: Consider signature schemes in rightauth when sending hash algorithms 2015-03-04 13:54:12 +01:00
Tobias Brunner f9e0caab6d keymat: Use hash algorithm set 2015-03-04 13:54:11 +01:00
Tobias Brunner b67ae0f89c ikev2: Add an option to disable constraints against signature schemes
If this is disabled the schemes configured in `rightauth` are only
checked against signature schemes used in the certificate chain and
signature schemes used during IKEv2 are ignored.

Disabling this could be helpful if existing connections with peers that
don't support RFC 7427 use signature schemes in `rightauth` to verify
certificate chains.
2015-03-04 13:54:11 +01:00
Tobias Brunner 31bccf4ba1 stroke: Enable BLISS-based public key constraints 2015-03-04 13:54:11 +01:00
Tobias Brunner cc048f0c50 ikev2: Fall back to SHA-1 signatures for RSA
This is really just a fallback to "classic" IKEv2 authentication if the other
peer supports no stronger hash algorithms.
2015-03-04 13:54:10 +01:00
Tobias Brunner 0bdc79b5f9 ikev2: Select a signature scheme appropriate for the given key
By enumerating hashes we'd use SHA-1 by default.  This way stronger
signature schemes are preferred.
2015-03-04 13:54:10 +01:00
Tobias Brunner 0b14ce5802 ikev2: Log the actual signature scheme used for RFC 7427 authentication 2015-03-04 13:54:09 +01:00
Tobias Brunner a7bbe59f85 ikev2: Store signature scheme used to verify peer in auth_cfg
This enables late connection switching based on the signature scheme used
for IKEv2 and allows to enforce stronger signature schemes.

This may break existing connections with peers that don't support RFC 7427
if signature schemes are currently used in `rightauth` for certificate chain
validation and if the configured schemes are stronger than the default used
for IKE (e.g. SHA-1 for RSA).
2015-03-04 13:54:09 +01:00
Tobias Brunner fff3576b6b ikev2: Add a global option to disable RFC 7427 signature authentication
This is mostly for testing.
2015-03-04 13:54:09 +01:00
Tobias Brunner 6a2a9bfb48 ikev2: Remove private AUTH_BLISS method
We use the new signature authentication instead for this.  This is not
backward compatible but we only released one version with BLISS support,
and the key format will change anyway with the next release.
2015-03-04 13:54:09 +01:00
Tobias Brunner 295e37ab66 ikev2: Handle RFC 7427 signature authentication in pubkey authenticator 2015-03-04 13:54:09 +01:00
Tobias Brunner f6329cae9c ikev2: Enable signature authentication by transmitting supported hash algorithms 2015-03-04 13:54:08 +01:00
Tobias Brunner 828e71bd43 keymat: Add facility to store supported hash algorithms 2015-03-04 13:54:08 +01:00
Tobias Brunner 159b7bec9e ikev2: Add SIGNATURE_HASH_ALGORITHMS notify payload 2015-03-04 13:54:08 +01:00
Tobias Brunner 7cd8371da2 ikev2: Add new authentication method defined by RFC 7427 2015-03-04 13:54:08 +01:00