ike: Track unprocessed initial IKE messages like half-open IKE_SAs

This should make the DoS limits (cookie_threshold[_ip] and block_threshold)
more accurate so that it won't be possible to create lots of jobs from
spoofed IP addresses before half-open IKE_SAs are actually created from
these jobs to enforce those limits.

Note that retransmits are tracked as half-open SAs until they are
processed/dismissed as the check only happens in checkout_by_message().

Increasing the count in process_message_job_create() avoids issues with
missing calls to track_init() before calling checkout_by_message() (e.g.
when processing fragmented IKEv1 messages, which are reinjected via a
process message job).
This commit is contained in:
Tobias Brunner
2022-04-14 15:28:07 +02:00
parent d8104b7c69
commit b866ee88bf
4 changed files with 78 additions and 23 deletions
+6 -4
View File
@@ -28,7 +28,8 @@ charon.accept_unencrypted_mainmode_messages = no
example, some SonicWall boxes).
charon.block_threshold = 5
Maximum number of half-open IKE_SAs for a single peer IP.
Maximum number of half-open IKE_SAs (including unprocessed IKE_SA_INITs)
for a single peer IP.
charon.cert_cache = yes
Whether relations in validated certificate chains should be cached in
@@ -70,11 +71,12 @@ charon.close_ike_on_child_failure = no
Close the IKE_SA if setup of the CHILD_SA along with IKE_AUTH failed.
charon.cookie_threshold = 30
Number of half-open IKE_SAs that activate the cookie mechanism.
Number of half-open IKE_SAs (including unprocessed IKE_SA_INITs) that
activate the cookie mechanism.
charon.cookie_threshold_ip = 3
Number of half-open IKE_SAs for a single peer IP that activate the cookie
mechanism.
Number of half-open IKE_SAs (including unprocessed IKE_SA_INITs) for a
single peer IP that activate the cookie mechanism.
charon.crypto_test.bench = no
Benchmark crypto algorithms and order them by efficiency.