From nobody Tue Oct 18 08:23:13 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Ms6Ln3J8Hz4gPSw; Tue, 18 Oct 2022 08:23:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ms6Ln2pjtz3pgD; Tue, 18 Oct 2022 08:23:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1666081393; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0a/xkeKC5Je5o/RT4VOvhuP/BRNlFPYUMSrvh/K/Xxg=; b=BngRZvmt8xruEPYV3lEou2b+pYz8yU93DZaMQMYpKVzwMNT87+3E7/Pzucdc0m2vElPyNF XirPbv1QlGJEt2CErnq8mhoNZrEHrzMzEPtmxs/n8d1GWvYajon0k5c/GWrmIjex5iuqLM hjK6UFBl8y5qbB0jOC/fX006nUlAOlCQW1gZVjGZMjEIryVjMqO5WO4666kgz0eM2+pezt xE6GzklJRDuV3l8z+NDyaamhMyMMLyBhT9drSjmZT3Yb5qfLaYZw4OFhM8x24v+BRKQe5J WFp610ngOGgPKzjka4FNXi6tkBgePEH9Z6nxxuW0oW29w5e4wm3VThKIXHnbQg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Ms6Ln1vNrz16VJ; Tue, 18 Oct 2022 08:23:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 29I8ND9S071603; Tue, 18 Oct 2022 08:23:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 29I8NDvb071602; Tue, 18 Oct 2022 08:23:13 GMT (envelope-from git) Date: Tue, 18 Oct 2022 08:23:13 GMT Message-Id: <202210180823.29I8NDvb071602@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 188e0696705f - main - if_ovpn tests: test explicit exit notifications List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 188e0696705fecd6f063b41b61b7dc4b6a3b0343 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1666081393; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0a/xkeKC5Je5o/RT4VOvhuP/BRNlFPYUMSrvh/K/Xxg=; b=CoeGM86n/VfH2hO+ilWqx+8mpP9sqevpTEbwjlmUf+Fgs4aYXNlSDTGZovu6+CoZqK55e3 D/zbKBNxOKTQggyG+0vxCmEdR+4R4JFx8KvUDgAmwUl/2HLDtvnKDEhUSa/Y5luteoXOTM oohBr6stgTWksefL/6c6mB+r5WkKr4q5FGMZ9PvLvl/MHPL9cHUyhjHpo5rwN2YfaamXT4 +B4lOVdol491ExA1JQCZTb4GahrtOzDDyPnyYcybKdAI9bi1D0GR7BfwiOJnvvkCwiMZU3 s4R2K0mTQQ5IzAB2BHTcFlXd5PzQIozfS3mPIZP56NGuN2+jeXyZHfMSxMSDuQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1666081393; a=rsa-sha256; cv=none; b=UC93/QfWQUhcUs+G9sIO7mn4pTOwDPsfLNdzd8KzxfzvWaVQLhlk++CuyXYGJRjn+TxIIo MnCd+EIlkWBo56LQAIytV+0tNzpq9E6/nfUMmQz/KZcGGHB1AULkM4KIyus4KrtYviKgbo vrzPl7sBDjkevTJ0/8fcunqxdOxVLjmKqczp/lkP1rcLqSSVlhe10wYjwZpLtTckEMOGR0 ii63ec7DBNfNAQCSp4G1RMZDRaMQ6aVGtwB0sU+zDeHoFWQXruYs/A08ruvqv7GSNCI2sP p/xF0QLL5YpAbH1Ecm0cHZoc44AchOY5cL+yTj8uVBaiRvjnxy31WFOG4yZrxQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=188e0696705fecd6f063b41b61b7dc4b6a3b0343 commit 188e0696705fecd6f063b41b61b7dc4b6a3b0343 Author: Kristof Provost AuthorDate: 2022-10-17 15:42:35 +0000 Commit: Kristof Provost CommitDate: 2022-10-18 08:12:22 +0000 if_ovpn tests: test explicit exit notifications Test that when a client exits the server notices this, even without keepalive traffic. Sponsored by: Rubicon Communications, LLC ("Netgate") --- tests/sys/net/if_ovpn/if_ovpn.sh | 87 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/tests/sys/net/if_ovpn/if_ovpn.sh b/tests/sys/net/if_ovpn/if_ovpn.sh index bc1d3a85c987..531a4fc2c856 100644 --- a/tests/sys/net/if_ovpn/if_ovpn.sh +++ b/tests/sys/net/if_ovpn/if_ovpn.sh @@ -475,6 +475,92 @@ timeout_client_cleanup() ovpn_cleanup } +atf_test_case "explicit_exit" "cleanup" +explicit_exit_head() +{ + atf_set descr 'Text explicit exit notification' + atf_set require.user root + atf_set require.progs openvpn +} + +explicit_exit_body() +{ + ovpn_init + + l=$(vnet_mkepair) + + vnet_mkjail a ${l}a + jexec a ifconfig ${l}a 192.0.2.1/24 up + jexec a ifconfig lo0 127.0.0.1/8 up + vnet_mkjail b ${l}b + jexec b ifconfig ${l}b 192.0.2.2/24 up + + # Sanity check + atf_check -s exit:0 -o ignore jexec a ping -c 1 192.0.2.2 + + ovpn_start a " + dev ovpn0 + dev-type tun + proto udp4 + + cipher AES-256-GCM + auth SHA256 + + local 192.0.2.1 + server 198.51.100.0 255.255.255.0 + ca $(atf_get_srcdir)/ca.crt + cert $(atf_get_srcdir)/server.crt + key $(atf_get_srcdir)/server.key + dh $(atf_get_srcdir)/dh.pem + + mode server + script-security 2 + auth-user-pass-verify /usr/bin/true via-env + topology subnet + + management 192.0.2.1 1234 + " + ovpn_start b " + dev tun0 + dev-type tun + + client + + remote 192.0.2.1 + auth-user-pass $(atf_get_srcdir)/user.pass + + ca $(atf_get_srcdir)/ca.crt + cert $(atf_get_srcdir)/client.crt + key $(atf_get_srcdir)/client.key + dh $(atf_get_srcdir)/dh.pem + + explicit-exit-notify + " + + # Give the tunnel time to come up + sleep 10 + + atf_check -s exit:0 -o ignore jexec b ping -c 3 198.51.100.1 + + if ! echo "status" | jexec a nc -N 192.0.2.1 1234 | grep 192.0.2.2; then + atf_fail "Client not found in status list!" + fi + + # Kill the client + jexec b killall openvpn + + while echo "status" | jexec a nc -N 192.0.2.1 1234 | grep 192.0.2.2; do + jexec a ps auxf + echo "Client disconnect not discovered" + sleep 1 + done +} + +explicit_exit_cleanup() +{ + ovpn_cleanup +} + atf_test_case "multi_client" "cleanup" multi_client_head() { @@ -909,6 +995,7 @@ atf_init_test_cases() atf_add_test_case "6in6" atf_add_test_case "4in6" atf_add_test_case "timeout_client" + atf_add_test_case "explicit_exit" atf_add_test_case "multi_client" atf_add_test_case "route_to" atf_add_test_case "ra"