From patchwork Thu May 7 08:26:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 1285029 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sipsolutions.net Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20170209 header.b=Dc7VE9HS; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49Hmm95h6Mz9sSW for ; Thu, 7 May 2020 18:27:21 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=v2yiygEayFfo1NhGikC5yT/2MNvxekrXb2bMXGSbLPM=; b=Dc7VE9HSo9BIN8 ypD6D1cHGTMbFfSuGfRnnLlvopBA/bwjioIps4w9HpJPo5iN5khmrWyYzdbJFM9c+vj4+JU7sUqDP A07lasz63BqSsZz1vXDhN2mZzVl8hDQIuTR7HuJLWl/z8LNdcN4Ey+dtHEK//k5qqpXQhi6dIC/3s Pwgbqk2+dpHBnr9WuDoTDHspf1jOtesyce9Wz6g0A3YHNEhbX2+RGoMJFYs2MM1F7bGQXnd11NFpU Ui6XmdI7NXsdD/T8nXjawLsuSXXDwbNMH+wrR7GKQypledCR8GtEoQi+Hhy6Mgppk8VbiP80liusQ F7EkfpdwLyMA4bb1UV/Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jWbs7-0005nQ-JQ; Thu, 07 May 2020 08:27:11 +0000 Received: from s3.sipsolutions.net ([2a01:4f8:191:4433::2] helo=sipsolutions.net) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jWbs0-0005i5-GC for hostap@lists.infradead.org; Thu, 07 May 2020 08:27:06 +0000 Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.93) (envelope-from ) id 1jWbrx-007NWW-Vh; Thu, 07 May 2020 10:27:02 +0200 From: Johannes Berg To: hostap@lists.infradead.org Subject: [PATCH v2 5/5] test_ap_ciphers: add delayed group rekey retransmit test for IGTK Date: Thu, 7 May 2020 10:26:51 +0200 Message-Id: <1588840011-I26935478844d49052523c8cb489c7deb3d7eff04@changeid> X-Mailer: git-send-email 2.25.1 In-Reply-To: <1588840011-I8f7f07654f74c5ea9f22e934c42096982b555701@changeid> References: <1588840011-I8f7f07654f74c5ea9f22e934c42096982b555701@changeid> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200507_012704_547491_94ABF39F X-CRM114-Status: UNSURE ( 8.30 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.3 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (0.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.3 KHOP_HELO_FCRDNS Relay HELO differs from its IP's reverse DNS X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Johannes Berg Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Johannes Berg Add a test for delayed group rekey retransmission that checks that the IGTK is protected against it by not resetting the IPN replay counter when reinstalling such a key. Signed-off-by: Johannes Berg --- tests/hwsim/test_ap_ciphers.py | 61 ++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/tests/hwsim/test_ap_ciphers.py b/tests/hwsim/test_ap_ciphers.py index 741e3a5cba73..d43831bc776a 100644 --- a/tests/hwsim/test_ap_ciphers.py +++ b/tests/hwsim/test_ap_ciphers.py @@ -867,6 +867,67 @@ def run_ap_wpa2_delayed_group_m1_retransmission(dev, apdev): if a < b: raise Exception("RX counter decreased: idx=%d before=%d after=%d" % (i, b, a)) +def test_ap_wpa2_delayed_group_m1_retransmission_igtk(dev, apdev): + """Delayed group M1 retransmission (check IGTK protection)""" + require_under_vm() + try: + subprocess.call(['sysctl', '-w', 'net.ipv6.conf.all.disable_ipv6=1'], + stdout=open('/dev/null', 'w')) + subprocess.call(['sysctl', '-w', + 'net.ipv6.conf.default.disable_ipv6=1'], + stdout=open('/dev/null', 'w')) + run_ap_wpa2_delayed_group_m1_retransmission_igtk(dev, apdev) + finally: + subprocess.call(['sysctl', '-w', 'net.ipv6.conf.all.disable_ipv6=0'], + stdout=open('/dev/null', 'w')) + subprocess.call(['sysctl', '-w', + 'net.ipv6.conf.default.disable_ipv6=0'], + stdout=open('/dev/null', 'w')) + +def run_ap_wpa2_delayed_group_m1_retransmission_igtk(dev, apdev): + params = hostapd.wpa2_params(ssid="test-wpa2-psk", passphrase="12345678", + ieee80211w="2") + hapd = hostapd.add_ap(apdev[0], params) + + # XXX: what's this for? + Wlantest.setup(hapd) + wt = Wlantest() + wt.flush() + wt.add_passphrase("12345678") + + phy = dev[0].get_driver_status_field("phyname") + dev[0].connect("test-wpa2-psk", psk="12345678", scan_freq="2412", + ieee80211w="1") + hapd.wait_sta() + + hwsim_utils.test_connectivity(dev[0], hapd, timeout=1) + + # deauth once to see that works OK + addr = dev[0].own_addr() + hapd.request("DEAUTHENTICATE ff:ff:ff:ff:ff:ff") + dev[0].wait_disconnected(timeout=10) + + # now to check the protection + dev[0].connect("test-wpa2-psk", psk="12345678", scan_freq="2412", + ieee80211w="1") + hapd.wait_sta() + + hwsim_utils.test_connectivity(dev[0], hapd, timeout=1) + + if "OK" not in hapd.request("RESEND_GROUP_M1 " + addr): + raise Exception("RESEND_GROUP_M1 failed") + if "OK" not in hapd.request("RESET_PN ff:ff:ff:ff:ff:ff IGTK"): + raise Exception("RESET_PN failed") + + time.sleep(0.1) + hapd.request("DEAUTHENTICATE ff:ff:ff:ff:ff:ff test=25") + + time.sleep(0.1) + hwsim_utils.test_connectivity(dev[0], hapd, timeout=1) + + dev[0].request("DISCONNECT") + dev[0].wait_disconnected() + def test_ap_wpa2_delayed_m1_m3_zero_tk(dev, apdev): """Delayed M1+M3 retransmission and zero TK""" params = hostapd.wpa2_params(ssid="test-wpa2-psk", passphrase="12345678")