Tobias Brunner
50d0c7f9de
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.
2021-12-31 17:50:22 +01:00
Tobias Brunner
54163948ae
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.
2021-12-31 17:50:22 +01:00
Tobias Brunner
27c68a3a91
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.
2021-12-31 17:50:22 +01:00
Tobias Brunner
05ee2b1209
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.
2021-12-31 17:50:22 +01:00
Tobias Brunner
554e369e4d
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.
2021-12-31 17:50:22 +01:00
Tobias Brunner
ec43b6c8cd
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.
2021-12-31 17:50:22 +01:00
Tobias Brunner
0abd02a7c1
bus: Support multiple key exchanges in ike/child_keys() events
2021-12-31 17:50:22 +01:00
Tobias Brunner
da21986522
keymat_v2: Support key derivation with multiple key exchanges
2021-12-31 17:50:22 +01:00
Tobias Brunner
9d8e99d031
key-exchange: Add helper to concatenate shared secrets of several key exchanges
2021-12-31 17:50:22 +01:00
Tobias Brunner
469ca13db3
keymat_v2: Proper cleanup if derive_ike_keys() is called multiple times
2021-12-31 17:50:22 +01:00
Tobias Brunner
7cecac7c74
ike-sa-manager: Log SPIs when checking in an IKE_SA
2021-12-31 17:50:22 +01:00
Tobias Brunner
22030e9198
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.
2021-12-31 17:50:22 +01:00
Tobias Brunner
b6ed732c3c
ike-auth: Calculate and collect IntAuth for IKE_INTERMEDIATE exchanges
2021-12-31 17:50:22 +01:00
Tobias Brunner
97ba080a24
pubkey-authenticator: Handle IntAuth data
2021-12-31 17:50:22 +01:00
Tobias Brunner
ad7a5b3141
psk-authenticator: Handle IntAuth data
2021-12-31 17:50:22 +01:00
Tobias Brunner
eb8ab8bbba
eap-authenticator: Handle IntAuth data
2021-12-31 17:50:22 +01:00
Tobias Brunner
ea86c65290
keymat_v2: Include optional IntAuth in signed octets
2021-12-31 17:50:22 +01:00
Tobias Brunner
140228a271
authenticator: Add optional method to set IntAuth data
2021-12-31 17:50:22 +01:00
Tobias Brunner
8c52556ca3
message: Add method to generate data to authenticate IKE_INTERMEDIATE exchanges
2021-12-31 17:50:22 +01:00
Tobias Brunner
55d2e10c57
generator: Make pointer to length field optional
...
Only useful if we generate an IKE header.
2021-12-31 17:50:22 +01:00
Tobias Brunner
8836eb472e
message: Fix payload type in last unprotected payload of a fragmented message
2021-12-31 17:50:22 +01:00
Tobias Brunner
6c23a531d3
keymat_v2: Add method to calculate IntAuth for IKE_INTERMEDIATE exchanges
2021-12-31 17:50:22 +01:00
Tobias Brunner
1c6ce56333
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.
2021-12-31 17:50:22 +01:00
Tobias Brunner
1aad6a5ffe
ikev2: Allow tasks to do work after processing requests/responses
2021-12-31 17:50:22 +01:00
Tobias Brunner
e9b6057f19
task: Add optional post_process() method
...
This will allows tasks to do some work after a message has been
processed.
2021-12-31 17:50:22 +01:00
Tobias Brunner
36cec38f22
ikev2: Allow tasks to do work after generating requests/responses
2021-12-31 17:50:22 +01:00
Tobias Brunner
79ef080811
task: Add optional post_build() method
...
This will allow tasks to do some work after the message has been
generated.
2021-12-31 17:50:22 +01:00
Tobias Brunner
8f390372bc
ike-auth: Support IKE_INTERMEDIATE exchange between IKE_SA_INIT and IKE_AUTH
2021-12-31 17:50:22 +01:00
Tobias Brunner
ee72206d23
child-create: Support IKE_INTERMEDIATE exchange between IKE_SA_INIT and IKE_AUTH
2021-12-31 17:50:22 +01:00
Tobias Brunner
a8494b7d7c
ike-mobike: Support IKE_INTERMEDIATE exchange between IKE_SA_INIT and IKE_AUTH
...
This changes the MID of the first IKE_AUTH message.
2021-12-31 17:50:22 +01:00
Tobias Brunner
a06da8a526
ike-config: Support IKE_INTERMEDIATE exchange between IKE_SA_INIT and IKE_AUTH
...
This changes the MID of the first IKE_AUTH message.
2021-12-31 17:50:22 +01:00
Tobias Brunner
7030cc7b7f
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.
2021-12-31 17:50:22 +01:00
Tobias Brunner
8372508d32
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.
2021-12-31 17:50:22 +01:00
Tobias Brunner
8cf3206979
status: Add return_need_more() utility function
2021-12-31 17:50:22 +01:00
Tobias Brunner
8454d094d4
message: Add rules for IKE_FOLLOWUP_KE exchanges
2021-12-31 17:50:22 +01:00
Tobias Brunner
c2f5b7ade8
wip: ike-header: Add IKE_FOLLOWUP_KE exchange type
2021-12-31 17:50:22 +01:00
Tobias Brunner
a6c2589402
message: Add rules for IKE_INTERMEDIATE exchanges
2021-12-31 17:50:22 +01:00
Tobias Brunner
5f724cd2d4
wip: ike-header: Add IKE_INTERMEDIATE exchange type
2021-12-31 17:50:22 +01:00
Tobias Brunner
91ac2f5eff
wip: notify-payload: Add notify types for multiple key exchanges
2021-12-31 17:50:22 +01:00
Tobias Brunner
0577bd291d
wip: notify-payload: Add notify type for IKE_INTERMEDIATE exchange
2021-12-31 17:50:22 +01:00
Tobias Brunner
473cbd84d0
proposal-substructure: Encode additional key exchange methods
2021-12-31 17:50:22 +01:00
Tobias Brunner
55515a5753
child-cfg: Add method to check if an algorithm is proposed
2021-12-31 17:50:22 +01:00
Tobias Brunner
0c7412391a
child-cfg: Generalize get_ke_method() method
2021-12-31 17:50:22 +01:00
Tobias Brunner
d30f1a6418
ike-cfg: Generalize get_ke_method() method
2021-12-31 17:50:22 +01:00
Tobias Brunner
4fa84482e7
proposal: Generalize KE methods
2021-12-31 17:50:22 +01:00
Tobias Brunner
6d18b11e54
proposal: Make all key exchange transforms optional in ESP/AH proposals
2021-12-31 17:50:22 +01:00
Tobias Brunner
3741499149
proposal: Skip all KE transforms if PROPOSAL_SKIP_KE given
2021-12-31 17:50:22 +01:00
Tobias Brunner
1d9d4866ed
transform: Add helper to check if transform type negotiates key exchange
2021-12-31 17:50:22 +01:00
Tobias Brunner
2d00ef745c
transform: Add additional key exchange transform types
2021-12-31 17:50:22 +01:00
Andreas Steffen
558003d269
Rename MODP_NONE to KE_NONE
2021-12-31 17:50:22 +01:00