Commit Graph
13907 Commits
Author SHA1 Message Date
Tobias Brunner 83dcb2d46d credential-manager: Store BLISS key strength in auth config 2015-03-04 13:54:11 +01:00
Tobias Brunner ddb09a0603 auth-cfg: Add BLISS key strength constraint 2015-03-04 13:54:11 +01:00
Tobias Brunner 7a9c0d51f4 testing: Don't check for exact IKEv2 fragment size
Because SHA-256 is now used for signatures the size of the two IKE_AUTH
messages changed.
2015-03-04 13:54:10 +01:00
Tobias Brunner 4aa24d4c13 testing: Update test conditions because signature schemes are now logged
RFC 7427 signature authentication is now used between strongSwan hosts
by default, which causes the actual signature schemes to get logged.
2015-03-04 13:54:10 +01:00
Tobias Brunner 2f1b2d9183 testing: Add ikev2/rw-sig-auth scenario 2015-03-04 13:54:10 +01:00
Tobias Brunner 3b31245a0f testing: Add ikev2/net2net-cert-sha2 scenario 2015-03-04 13:54:10 +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 1f648d756b public-key: Add helper to determine acceptable signature schemes for keys 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 d874101055 hasher: Add helper to determine hash algorithm from signature scheme 2015-03-04 13:54:09 +01:00
Tobias Brunner 353294ea5c public-key: Add helper to map signature schemes to ASN.1 OIDs
There is a similar function to map key_type_t and hasher_t to an OID,
but this maps schemes directly (and to use the other function we'd
have to have a function to map schemes to hash algorithms first).
2015-03-04 13:54:08 +01:00
Tobias Brunner 0f29f5ed02 public-key: Add helper to determine key type from signature scheme 2015-03-04 13:54:08 +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 247eadb73d hasher: Add filter function for algorithms permitted by RFC 7427 2015-03-04 13:54:08 +01:00
Tobias Brunner 4f9e1c49eb hasher: Redefine hash algorithms to match values defined by RFC 7427
Other algorithms are defined in private use range.
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
Tobias Brunner dd0ebb5483 ikev2: Only accept initial messages in specific states
The previous code allowed an attacker to slip in an IKE_SA_INIT with
both SPIs and MID 1 set when an IKE_AUTH would be expected instead.

References #816.
2015-03-04 13:47:53 +01:00
Tobias Brunner 650a3ad515 ike-sa-manager: Make sure the message ID of initial messages is 0
It is mandated by the RFCs and it is expected by the task managers.

Initial messages with invalid MID will be treated like regular messages,
so no IKE_SA will be created for them.  Instead, if the responder SPI is 0
no SA will be found and the message is rejected with ALERT_INVALID_IKE_SPI.
If an SPI is set and we do find an SA, then we either ignore the message
because the MID is unexpected, or because we don't allow initial messages
on established connections.

There is one exception, though, if an attacker can slip in an IKE_SA_INIT
with both SPIs set before the client's IKE_AUTH is handled by the server,
it does get processed (see next commit).

References #816.
2015-03-04 13:47:53 +01:00
Tobias Brunner eb25190629 ikev2: Don't destroy the SA if an IKE_SA_INIT with unexpected MID is received
This reverts 8f727d8007 ("Clean up IKE_SA state if IKE_SA_INIT request
does not have message ID 0") because it allowed to close any IKE_SA by
sending an IKE_SA_INIT with an unexpected MID and both SPIs set to those
of that SA.

The next commit will prevent SAs from getting created for IKE_SA_INIT messages
with invalid MID.

Fixes #816.
2015-03-04 13:47:53 +01:00
Martin Willi 1a31fe5580 ikev2: Don't adopt any CHILD_SA during make-before-break reauthentication
While the comment is rather clear that we should not adopt live CHILD_SAs
during reauthentication in IKEv2, the code does nonetheless. Add an additional
version check to fix reauthentication if the reauth responder has a replace
uniqueids policy.

Fixes #871.
2015-03-04 11:18:42 +01:00
Tobias Brunner 436cdae840 unit-tests: Base attributes get adopted by seg-env/seg-contract 2015-03-03 17:05:16 +01:00
Tobias Brunner a2b400b16b seg-env: Destroy base attribute if segmentation is not possible 2015-03-03 17:05:16 +01:00
Martin Willi ec57527475 Merge branch 'eap-constraints'
Introduces basic support for EAP server module authentication constraints. With
EAP-(T)TLS, public key, signature and end entity or CA certificate constraints
can be enforced for connections.

Fixes #762.
2015-03-03 14:08:55 +01:00
Martin Willi f05a578b8b NEWS: Introduce EAP constraints support for EAP-(T)TLS 2015-03-03 14:08:47 +01:00
Martin Willi f2e2cce2aa man: Describe trust chain constraints configuration for EAP methods 2015-03-03 14:08:01 +01:00
Martin Willi f6b5952b32 stroke: Support public key constraints for EAP methods 2015-03-03 14:08:01 +01:00
Martin Willi 0864a31d13 eap-ttls: Support EAP auth information getter in EAP-TTLS 2015-03-03 14:08:01 +01:00
Martin Willi de2a62cfb6 eap-tls: Support EAP auth information getter in EAP-TLS 2015-03-03 14:08:01 +01:00
Martin Willi 666c552381 libtls: Add getters for TLS handshake authentication details 2015-03-03 14:08:00 +01:00
Martin Willi aba5b76ce1 libtls: Merge trustchain auth verification details done during TLS handhsake 2015-03-03 14:08:00 +01:00
Martin Willi 0c608316dd ikev2: Merge EAP client authentication details if EAP methods provides them 2015-03-03 14:08:00 +01:00
Martin Willi cfe7125357 eap: Add an optional authentication details getter to the EAP method interface 2015-03-03 14:08:00 +01:00
Martin Willi 1fd7025499 Merge branch 'stroke-purge-on-reread'
Remove all previously loaded certificates during "ipsec reread", finally
allowing the removal of CA certificates from a running daemon.

Fixes #842, #700, #305.
2015-03-03 13:52:35 +01:00
Martin Willi 9dde9d69ed ipsec: Update rereadcacerts/aacerts command description in manpage 2015-03-03 13:50:26 +01:00
Martin Willi 11c14bd2f5 stroke: Serve ca section CA certificates directly, not over central CA set
This makes these CA certificates independent from the purge issued by reread
commands. Certificates loaded by CA sections can be removed through ipsec.conf
update/reread, while CA certificates loaded implicitly from ipsec.d/cacerts
can individually be reread using ipsec rereadcacerts.
2015-03-03 13:50:26 +01:00
Martin Willi ef2c61bc92 mem-cred: Add a method to unify certificate references, without adding it
In contrast to add_cert_ref(), get_cert_ref() does not add the certificate to
the set, but only finds a reference to the same certificate, if found.
2015-03-03 13:50:26 +01:00
Martin Willi aba46b104e stroke: Purge existing CA/AA certificates during reread 2015-03-03 13:50:26 +01:00
Martin Willi d69cf39bb4 stroke: Use separate credential sets for CA/AA certificates 2015-03-03 13:50:26 +01:00
Martin Willi 845d36969e stroke: Refactor load_certdir function 2015-03-03 13:50:26 +01:00
Martin Willi 1549a98493 vici: Don't use a default rand_time larger than half of rekey/reauth_time 2015-03-03 13:49:14 +01:00
Martin Willi f6511e36b5 vici: If a IKE reauth_time is configured, disable the default rekey_time 2015-03-03 13:49:14 +01:00
Martin Willi 1cce0df4a6 ikev2: Schedule a timeout for the delete message following passive IKE rekeying
Under some conditions it can happen that the CREATE_CHILD_SA exchange for
rekeying the IKE_SA initiated by the peer is successful, but the delete message
does not follow. For example if processing takes just too long locally, the
peer might consider us dead, but we won't notice that.

As this leaves the old IKE_SA in IKE_REKEYING state, we currently avoid actively
initiating any tasks, such as rekeying or scheduled DPD. This leaves the IKE_SA
in a dead and unusable state. To avoid that situation, we schedule a timeout
to wait for the DELETE message to follow the CREATE_CHILD_SA, before we
actively start to delete the IKE_SA.

Alternatively we could start a liveness check on the SA after a timeout to see
if the peer still has that state and we can expect the delete to follow. But
it is unclear if all peers can handle such messages in this very special state,
so we currently don't go for that approach.

While we could calculate the timeout based on the local retransmission timeout,
the peer might use a different scheme, so a fixed timeout works as well.

Fixes #742.
2015-03-03 13:45:39 +01:00
Martin Willi 6b57790270 kernel-netlink: Respect kernel routing priorities for IKE routes
If a system uses routing metrics, we should honor them when doing (manual)
routing lookups for IKE. When enumerating routes, the kernel reports priorities
with the RTA_PRIORITY attribute, not RTA_METRICS. We prefer routes with a
lower priority value, and fall back to longest prefix match priorities if
the priority value is equal.
2015-03-03 13:42:41 +01:00