From nobody Tue Aug 09 13:57:02 2022 X-Original-To: dev-commits-src-all@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 4M2F4H1hQKz4Z7P3; Tue, 9 Aug 2022 13:57:03 +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 4M2F4H19g5z42h1; Tue, 9 Aug 2022 13:57:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660053423; 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=b+KDYLb46RhLnMIN1cuDaToCqsdbuc4jPj/tIcmpgNE=; b=Q9aaMpX5LAm/G10aE9Yxe0CjT5ng/lQTHgQjdsdaKMx0P70vacHvnPxwhuNNqFl7QlnoX1 z8MRDz+4toQ35B4GaQjPFejlHCrTciL0TLLPMACWdhtC1r/tIAajZLSUK1mdmPmppbaZ2v DWfMLSUohqxNOSyCvo/w5I9OXkgvGdYLU+u3lOZtxZZhF+baHzNXhYX+1BZcAiYITgWX8G PKLqkvn0GnvTfRif13A0oDyFA8BgjtKPQZ4nCABJuIMZ6IR+F09MLOQ93rJdOWRgD/Ziw7 x8MQgNZbjZGJoYkpWgX4mjtHPvnikGz/dDGZ6afpyAk0Tz3zGuDneIRseX+NZg== 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 4M2F4H0D3fzZR9; Tue, 9 Aug 2022 13:57:03 +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 279Dv2Zm030526; Tue, 9 Aug 2022 13:57:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 279Dv2PB030525; Tue, 9 Aug 2022 13:57:02 GMT (envelope-from git) Date: Tue, 9 Aug 2022 13:57:02 GMT Message-Id: <202208091357.279Dv2PB030525@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: b77d581535da - main - if_ovpn tests: remote access test case List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: b77d581535dabd8b191591b454e829e1cd77dc4a Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660053423; 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=b+KDYLb46RhLnMIN1cuDaToCqsdbuc4jPj/tIcmpgNE=; b=dj+U8ysHHdhh1wlanxhmUdicgpvftSVzBITVAGRq6FpeCqk/4zE85jlnk4Da7uqUMj0A86 tlAJek076b/zKDX0exP1ahIy4z/toC7nA1Ngs5nAy4z/JHBHRCXQBrCOG3VQHv8JllVv11 HHJmtkNfhR03C3znCRwQExnLb3n60ffxflRqmntaq61DoZzgwe3gJEj4GVoRBdrD1UxH+7 ic3lSLGyIcFWj5KnB4WAvsdhJU62IHEYWTTcD5KqAlh7RKJ++m8USf0LDxfpjvIMjlC0lE 7ZLOh7vvqyuvmVUwIXZ7EosPhdXVI15O7T4yE0a9BKHLjrPBPSSfiiVvZgodvw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1660053423; a=rsa-sha256; cv=none; b=jXgZ8ODg+FIEucxDnROpYYsRBJMbqj/oXPuZ4kZ0qhuL4HIV9X4HQjK5SBUKrazuC1ydC7 V+pXO4kuUVergW4rb8H5BpZwo4Rb8yfSxXJvFRavwHI6RWFNiIqybEvuY58MTzkHT8UABY TM2FRdmpU/X8r5Asz75Z3LYXlYBXsjMQqYs/G2Rd6xUgpcNr6hDmfvjfy4F7Xi1h4A/znw U5E5U9wcnAEd05XEMSk/dwRclahWQ4wNuLyaDJVkERtX8L+p9MqDfjaUPrAVb/+dGatFLz JIWl8eJpGt40XHL84lOpGydD6GvtElDL1GnAONZgYck9L0ZltbSVMbBkYRW4gw== 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=b77d581535dabd8b191591b454e829e1cd77dc4a commit b77d581535dabd8b191591b454e829e1cd77dc4a Author: Kristof Provost AuthorDate: 2022-07-28 09:55:53 +0000 Commit: Kristof Provost CommitDate: 2022-08-09 13:14:14 +0000 if_ovpn tests: remote access test case Add a (multi-client) test case where we route traffic beyond the ovpn server, onto a shared LAN. Sponsored by: Rubicon Communications, LLC ("Netgate") --- tests/sys/net/if_ovpn/if_ovpn.sh | 138 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) diff --git a/tests/sys/net/if_ovpn/if_ovpn.sh b/tests/sys/net/if_ovpn/if_ovpn.sh index faf21d5669b1..024f2488c951 100644 --- a/tests/sys/net/if_ovpn/if_ovpn.sh +++ b/tests/sys/net/if_ovpn/if_ovpn.sh @@ -690,6 +690,143 @@ route_to_cleanup() pft_cleanup } +atf_test_case "ra" "cleanup" +ra_head() +{ + atf_set descr 'Remote access with multiple clients' + atf_set require.user root + atf_set require.progs openvpn +} + +ra_body() +{ + ovpn_init + + bridge=$(vnet_mkbridge) + srv=$(vnet_mkepair) + lan=$(vnet_mkepair) + one=$(vnet_mkepair) + two=$(vnet_mkepair) + + ifconfig ${bridge} up + + ifconfig ${srv}a up + ifconfig ${bridge} addm ${srv}a + ifconfig ${one}a up + ifconfig ${bridge} addm ${one}a + ifconfig ${two}a up + ifconfig ${bridge} addm ${two}a + + vnet_mkjail srv ${srv}b ${lan}a + jexec srv ifconfig ${srv}b 192.0.2.1/24 up + jexec srv ifconfig ${lan}a 203.0.113.1/24 up + vnet_mkjail lan ${lan}b + jexec lan ifconfig ${lan}b 203.0.113.2/24 up + jexec lan route add default 203.0.113.1 + vnet_mkjail one ${one}b + jexec one ifconfig ${one}b 192.0.2.2/24 up + vnet_mkjail two ${two}b + jexec two ifconfig ${two}b 192.0.2.3/24 up + + # Sanity checks + atf_check -s exit:0 -o ignore jexec one ping -c 1 192.0.2.1 + atf_check -s exit:0 -o ignore jexec two ping -c 1 192.0.2.1 + atf_check -s exit:0 -o ignore jexec srv ping -c 1 203.0.113.2 + + jexec srv sysctl net.inet.ip.forwarding=1 + + ovpn_start srv " + 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 + + push \"route 203.0.113.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 + duplicate-cn + script-security 2 + auth-user-pass-verify /usr/bin/true via-env + topology subnet + + keepalive 100 600 + " + ovpn_start one " + 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 + + keepalive 100 600 + " + sleep 2 + ovpn_start two " + 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)/client2.crt + key $(atf_get_srcdir)/client2.key + dh $(atf_get_srcdir)/dh.pem + + keepalive 100 600 + " + + # Give the tunnel time to come up + sleep 10 + + atf_check -s exit:0 -o ignore jexec one ping -c 1 198.51.100.1 + atf_check -s exit:0 -o ignore jexec two ping -c 1 198.51.100.1 + + # Client-to-client communication + atf_check -s exit:0 -o ignore jexec one ping -c 1 198.51.100.3 + atf_check -s exit:0 -o ignore jexec two ping -c 1 198.51.100.2 + + # RA test + atf_check -s exit:0 -o ignore jexec one ping -c 1 203.0.113.1 + atf_check -s exit:0 -o ignore jexec two ping -c 1 203.0.113.1 + + atf_check -s exit:0 -o ignore jexec srv ping -c 1 -S 203.0.113.1 198.51.100.2 + atf_check -s exit:0 -o ignore jexec srv ping -c 1 -S 203.0.113.1 198.51.100.3 + + atf_check -s exit:0 -o ignore jexec one ping -c 1 203.0.113.2 + atf_check -s exit:0 -o ignore jexec two ping -c 1 203.0.113.2 + + atf_check -s exit:0 -o ignore jexec lan ping -c 1 198.51.100.1 + atf_check -s exit:0 -o ignore jexec lan ping -c 1 198.51.100.2 + atf_check -s exit:0 -o ignore jexec lan ping -c 1 198.51.100.3 + atf_check -s exit:2 -o ignore jexec lan ping -c 1 198.51.100.4 +} + +ra_cleanup() +{ + ovpn_cleanup +} + + atf_test_case "chacha" "cleanup" chacha_head() { @@ -773,5 +910,6 @@ atf_init_test_cases() atf_add_test_case "timeout_client" atf_add_test_case "multi_client" atf_add_test_case "route_to" + atf_add_test_case "ra" atf_add_test_case "chacha" }