Tobias Brunner
2894ed17cc
unit-tests: Add tests for CHILD_SA rekeying with multiple key exchanges
2020-12-07 13:32:56 +01:00
Tobias Brunner
c74fdd936b
unit-tests: Add tests for CHILD_SA creation with multiple key exchanges
2020-12-07 13:32:56 +01:00
Tobias Brunner
6d0fea7c8e
unit-tests: Tests for additional key exchanges
2020-12-07 13:32:56 +01:00
Tobias Brunner
23402b29f3
unit-tests: Support multiple proposals in exchange tests
2020-12-07 13:32:56 +01:00
Tobias Brunner
bf7b64e6da
unit-tests: Hand out an actual shared secret in mock KE implementation
...
Makes key derivation a bit more realistic.
2020-12-07 13:32:56 +01:00
Tobias Brunner
55ab7e1949
proposal: Add prefix for additional key exchanges when logging proposals
2020-12-07 13:32:56 +01:00
Tobias Brunner
9aff25ad47
key-exchange: Add dynamic parser for additional key exchange methods
2020-12-07 13:32:56 +01:00
Tobias Brunner
e7ffc02292
child-rekey: Support CHILD_SA rekeying with multiple key exchanges
2020-12-07 13:32:51 +01:00
Tobias Brunner
187c2bb6ea
child-sa: Cache and forward actual initiator flag for outbound SA
...
Kernel interfaces (e.g. TKM) might rely on this flag to be correct.
2020-12-07 13:28:34 +01:00
Tobias Brunner
2f6eb395bc
unit-tests: Fix CHILD_SA rekey tests after INVALID_KE_PAYLOAD handling changes
...
The responder doesn't create a CHILD_SA and allocate an SPI anymore
when responding with an INVALID_KE_PAYLOAD notify.
2020-12-07 13:28:34 +01:00
Tobias Brunner
87b2ed3ce7
child-create: Add support for multiple key exchanges
2020-12-07 13:28:34 +01:00
Tobias Brunner
e93cde6ea6
ike-rekey: Support IKE_SA rekeying with multiple key exchanges
2020-12-07 13:28:34 +01:00
Tobias Brunner
9e8418f050
ikev2: Send deletes also for rekeyed SAs
...
This way we can use the IKE_REKEYED state for both redundant and old SAs
to suppress ike_updown().
In the ike-delete task we don't suppress events in state IKE_REKEYING as
that's the case when we delete an SA the peer is currently rekeying with
multiple key exchanges.
2020-12-07 13:28:34 +01:00
Tobias Brunner
350f1a81f6
ikev2: Let ike/child-rekey tasks indicate if the passive task was adopted
...
This gives us more flexibility with tasks that return NEED_MORE (currently
none of the colliding tasks do, but that will change with multi-KE
rekeyings). The active task has to check itself if the passive task is
done and should be removed from the task manager.
2020-12-07 13:28:34 +01:00
Tobias Brunner
bbbdc8fb68
ike-rekey: Remove collision task type checks
...
Since f67199378df9 ("ike-rekey: Handle undetected collisions also if
delete is delayed") we only ever track tasks of type TASK_IKE_REKEY, so
there is no need to check the type or use the generic task_t interface.
Also changed some of the comments to clarify collision handling.
2020-12-07 13:28:34 +01:00
Tobias Brunner
09f4f7fcb8
ike-rekey: Don't actively rekey already rekeyed SAs
...
If the peer successfully rekeyed the SA it gets marked as IKE_REKEYED
and it remains until the peer deletes it (or a timeout). There is no
point in rekeying such SAs again.
IKE_REKEYING will be relevant if we have multi-KE rekeyings and are
waiting for followup key exchanges for a passive rekeying.
2020-12-07 13:28:34 +01:00
Tobias Brunner
a63cfb9785
ike-init: Ignore COOKIE payloads during rekeying
...
This ensures that process_i() only returns NEED_MORE due to multiple
key exchanges or an INVALID_KE_PAYLOAD notify.
2020-12-07 13:28:34 +01:00
Tobias Brunner
46eb7d9030
ike-init: Add support for multiple key exchanges
...
Initially, this is handled with a key derivation for each
IKE_INTERMEDIATE exchange. When rekeying the keys are derived only when
all IKE_FOLLOWUP_KE exchanges are done.
2020-12-07 13:28:34 +01:00
Tobias Brunner
0ec45dfd56
bus: Support multiple key exchanges in ike/child_keys() events
2020-12-07 13:28:34 +01:00
Tobias Brunner
5be238d71e
keymat_v2: Support key derivation with multiple key exchanges
2020-12-07 13:28:34 +01:00
Tobias Brunner
0321a2a304
key-exchange: Add helper to concatenate shared secrets of several key exchanges
2020-12-07 13:28:34 +01:00
Tobias Brunner
41842faad9
keymat_v2: Proper cleanup if derive_ike_keys() is called multiple times
2020-12-07 13:28:34 +01:00
Tobias Brunner
0d5a94c1db
ike-sa-manager: Log SPIs when checking in an IKE_SA
2020-12-07 13:28:34 +01:00
Tobias Brunner
f25932be14
ikev2: Use hashes to detect retransmits
...
We avoid parsing messages with unexpected message IDs. This allows us to
process and detect retransmits of messages for which we don't have the keys
anymore (i.e. IKE_INTERMEDIATE after IKE_SA_INIT and changing the keys).
This also changes how retransmits for fragmented messages are triggered,
previously we waited for all fragments and reconstructed the message
before retransmitting the response. Now we only track the first
fragment and if we receive a retransmit of it respond immediately
without waiting for other fragments (which are now ignored). This is in
compliance with RFC 7383, section 2.6.1.
2020-12-07 13:28:34 +01:00
Tobias Brunner
bc513b2848
ike-auth: Calculate and collect IntAuth for IKE_INTERMEDIATE exchanges
2020-12-07 13:28:34 +01:00
Tobias Brunner
40f49249a9
pubkey-authenticator: Handle IntAuth data
2020-12-07 13:28:34 +01:00
Tobias Brunner
6527e3961c
psk-authenticator: Handle IntAuth data
2020-12-07 13:28:34 +01:00
Tobias Brunner
b315f6a8f7
eap-authenticator: Handle IntAuth data
2020-12-07 13:28:34 +01:00
Tobias Brunner
eb7f6d3108
keymat_v2: Include optional IntAuth in signed octets
2020-12-07 13:28:34 +01:00
Tobias Brunner
9f1be4ef71
authenticator: Add optional method to set IntAuth data
2020-12-07 13:28:34 +01:00
Tobias Brunner
90fd6457c3
message: Add method to generate data to authenticate IKE_INTERMEDIATE exchanges
2020-12-07 13:28:34 +01:00
Tobias Brunner
a1efa5510a
generator: Make pointer to length field optional
...
Only useful if we generate an IKE header.
2020-12-07 13:28:34 +01:00
Tobias Brunner
21b4bc87c8
message: Fix payload type in last unprotected payload of a fragmented message
2020-12-07 13:28:34 +01:00
Tobias Brunner
9a5626d91a
keymat_v2: Add method to calculate IntAuth for IKE_INTERMEDIATE exchanges
2020-12-07 13:28:34 +01:00
Tobias Brunner
1e82c9577a
ike-rekey: Reset IKE_SA after processing CREATE_CHILD_SA request
...
This probably didn't cause any problems, as there wasn't really anything
happening between the calls, but reset it anyway, just to be safe.
2020-12-07 13:28:34 +01:00
Tobias Brunner
f7882a24b4
ikev2: Allow tasks to do work after processing requests/responses
2020-12-07 13:28:34 +01:00
Tobias Brunner
a6a6461430
task: Add optional post_process() method
...
This will allows tasks to do some work after a message has been
processed.
2020-12-07 13:28:34 +01:00
Tobias Brunner
1250917f79
ikev2: Allow tasks to do work after generating requests/responses
2020-12-07 13:28:34 +01:00
Tobias Brunner
89ca791979
task: Add optional post_build() method
...
This will allow tasks to do some work after the message has been
generated.
2020-12-07 13:28:34 +01:00
Tobias Brunner
2455322ae2
ike-auth: Support IKE_INTERMEDIATE exchange between IKE_SA_INIT and IKE_AUTH
2020-12-07 13:28:34 +01:00
Tobias Brunner
d29d140630
child-create: Support IKE_INTERMEDIATE exchange between IKE_SA_INIT and IKE_AUTH
2020-12-07 13:28:34 +01:00
Tobias Brunner
1949a290c0
ike-mobike: Support IKE_INTERMEDIATE exchange between IKE_SA_INIT and IKE_AUTH
...
This changes the MID of the first IKE_AUTH message.
2020-12-07 13:28:34 +01:00
Tobias Brunner
41a5473556
ike-config: Support IKE_INTERMEDIATE exchange between IKE_SA_INIT and IKE_AUTH
...
This changes the MID of the first IKE_AUTH message.
2020-12-07 13:28:34 +01:00
Tobias Brunner
24a0d22fc1
ike-cert-post: Make absolutely sure certificates are only added to IKE_AUTH
...
The AUTH payload check should be fine, but add some extra checks just to make
really sure and also for clarification.
2020-12-07 13:28:34 +01:00
Tobias Brunner
b911387d0f
ike-cert-pre: Support IKE_INTERMEDIATE exchange between IKE_SA_INIT and IKE_AUTH
...
The first IKE_AUTH does not have MID 1 if that's the case.
2020-12-07 13:28:34 +01:00
Tobias Brunner
7321602bcd
status: Add return_need_more() utility function
2020-12-07 13:28:34 +01:00
Tobias Brunner
abb8199cdc
message: Add rules for IKE_FOLLOWUP_KE exchanges
2020-12-07 13:28:34 +01:00
Tobias Brunner
cbf93d853e
wip: ike-header: Add IKE_FOLLOWUP_KE exchange type
2020-12-07 13:28:34 +01:00
Tobias Brunner
9c7ef3be52
message: Add rules for IKE_INTERMEDIATE exchanges
2020-12-07 13:28:34 +01:00
Tobias Brunner
cc3eaa23e4
wip: ike-header: Add IKE_INTERMEDIATE exchange type
2020-12-07 13:28:34 +01:00