Index: etc/mtree/BSD.tests.dist =================================================================== --- etc/mtree/BSD.tests.dist +++ etc/mtree/BSD.tests.dist @@ -803,6 +803,8 @@ mqueue .. net + if_ovpn + .. .. netgraph .. Index: tests/sys/net/Makefile =================================================================== --- tests/sys/net/Makefile +++ tests/sys/net/Makefile @@ -15,6 +15,7 @@ ATF_TESTS_SH+= if_tun_test ATF_TESTS_SH+= if_vlan +TESTS_SUBDIRS+= if_ovpn TESTS_SUBDIRS+= routing # The tests are written to be run in parallel, but doing so leads to random Index: tests/sys/net/if_ovpn/Makefile =================================================================== --- /dev/null +++ tests/sys/net/if_ovpn/Makefile @@ -0,0 +1,17 @@ +PACKAGE= tests + +TESTSDIR= ${TESTSBASE}/sys/net/if_ovpn + +ATF_TESTS_SH+= if_ovpn + +${PACKAGE}FILES+= \ + ca.crt \ + client.crt \ + client.key \ + dh.pem \ + server.crt \ + server.key \ + user.pass \ + utils.subr + +.include Index: tests/sys/net/if_ovpn/ca.crt =================================================================== --- /dev/null +++ tests/sys/net/if_ovpn/ca.crt @@ -0,0 +1,33 @@ +-----BEGIN CERTIFICATE----- +MIIFrzCCA5egAwIBAgIUFByUexsc+WCQtaEQZCg+nrJaFDowDQYJKoZIhvcNAQEL +BQAwZjELMAkGA1UEBhMCS0cxCzAJBgNVBAgMAk5BMRAwDgYDVQQHDAdCSVNIS0VL +MRUwEwYDVQQKDAxPcGVuVlBOLVRFU1QxITAfBgkqhkiG9w0BCQEWEm1lQG15aG9z +dC5teWRvbWFpbjAgFw0yMjA0MjcxNDM1NTZaGA8yMTIyMDQwMzE0MzU1NlowZjEL +MAkGA1UEBhMCS0cxCzAJBgNVBAgMAk5BMRAwDgYDVQQHDAdCSVNIS0VLMRUwEwYD +VQQKDAxPcGVuVlBOLVRFU1QxITAfBgkqhkiG9w0BCQEWEm1lQG15aG9zdC5teWRv +bWFpbjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAJnak7swgeJta01H +4pNQte3S0bdEGRvyhkz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um4h88DUkjw9 +qlMDTnkhWUfyPg8kS99dLodnxp1QeW0ISeWpAucJuOvu3ode/N3lOrxq88OrZQNJ +upQsdUxLEU6DzQlvBd2s4d8Ghvk3l65u688cE6dXIcNPEp78wy/IXkVvTRTstpuA +Ep9ZNwrEvaPQDxBJ6a2sPKwXst1NZZgmPQG2ZbpQfCQtJ0zYZWpI/LytiC/05joi +/aGh01GN7nODt9U7rtZtCQjjmIlK7fuBJLL9yQXcpzT5sItdQSkn9QuCBlnlxMqx +felbaNPxTLJVqCilqlx/xaybDljduKLvJouR+l/UjrXz+n02lzxPQ3FIr8/vJlVf +EFbSmkzS3C/O5gXUxHTq44z6LbnosjyiPEB2J7n5kvsA8HTynZU4GCrHa5LLG1eg +1odsgCIYiAwNBCbPtWWykUHXhA== +-----END CERTIFICATE----- Index: tests/sys/net/if_ovpn/ca.key =================================================================== --- /dev/null +++ tests/sys/net/if_ovpn/ca.key @@ -0,0 +1,51 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIJKQIBAAKCAgEAmdqTuzCB4m1rTUfik1C17dLRt0QZG/KGTNjwcjF7+l3PfvV9 +IvjSIFDb09Vmx4xU6xAisiiWGZripPK0zJT1UR8lGUGPyF2VsilvwUOy8w4XIL7v +4bEd2QBCUVXl9SPsnJ2fGJj4vztbtYRVpPL1lG24heG+RVlhMfO9XBfAvl7kR1wk +oex1qbj23LiuzoITsnToZifCYuT+cPC9lmEdMHlX68166tGjErJi9Rd49MKqHpwa +HZqzTrUnFTWPW+PdxM1WU/KY7zkS2XW3i4QeNfItUrb44Jxq5AafpBPTbGoUtGxu +TjaBY6SwWPnQ0NBW2nvUkgwCbDPPbKL5yrPWqp3I6V8t4/aijDWNhrceGG3kSz3S +bpiR4X/Tvd4tb+e5WygPns9nWucKVf71mzbgsA3++ddHWAr+cBmy/0I21F1a33JN +Kar+gZmPiRZTXnhfFEt9wNr2CPlf6D1njDphom2xrxdo56U9acGD8lcut0TvfUPD +INGqVI9iDDNTqDcKCNFX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DTpqIrpt9Jc3dgkkf7SPHzQFH4nLrK0VufMLBJFtNcO +OYpFZCLneNKlRzI6xb4YkBGc5Us2oXFV+gaSgqMOE/kWhhDjDaro1naNu9eWWzwg +dzdH+Kk9r68r5c0tsaSYhUjRYOH37oXpAoIBAQDAqjYwd64AKFnppbt5eAJtdJtd +BatS6DfNxYl6jmF0E9+ZUIALdmyxB/Y8Grng5kpd8VQHW5LDzX+ABrrD99+hSPDe +quq6S6JSvXfrGa5EGMkC6zkPFvppjYj4u+VVqn0sRKPLAa3tmXLECJ+lORX4LVhe +rG2/AmvG5YVqYBTgbBi+cYXToHXUp1D/qQLXN+8PvCvvWVCzfVYr25TsD+5UEbvc +TQA9WtwHy/xjzLx11IrI9xlDBPzfGQVStnroP6MkMe3ACc0pg/17ktY5MiFnzLpK +o58qMXWZMrYyDvlo9PBOYLFXL41yJMhZeJjP80Kk/L1EnDiTDHuU8qFltbD3 +-----END RSA PRIVATE KEY----- Index: tests/sys/net/if_ovpn/client.crt =================================================================== --- /dev/null +++ tests/sys/net/if_ovpn/client.crt @@ -0,0 +1,123 @@ +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1048686 (0x10006e) + Signature Algorithm: sha256WithRSAEncryption + Issuer: C=KG, ST=NA, L=BISHKEK, O=OpenVPN-TEST/emailAddress=me@myhost.mydomain + Validity + Not Before: Apr 27 15:00:37 2022 GMT + Not After : Apr 3 15:00:37 2122 GMT + Subject: C=KG, ST=NA, O=OpenVPN-TEST, CN=Test-Client/emailAddress=me@myhost.mydomain + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public-Key: (4096 bit) + Modulus: + 00:f0:86:38:95:a6:e0:76:52:eb:25:57:8b:47:2a: + e1:17:db:9b:84:64:33:0c:70:91:74:ae:f5:39:cc: + a7:9e:37:3c:d2:32:df:cd:57:8e:21:00:c9:43:b6: + b3:d3:a8:fc:15:84:c4:15:86:d8:d6:69:5b:d4:9b: + 19:c9:8e:71:9f:1d:12:72:89:e3:7b:db:80:6e:dc: + 69:fd:98:eb:22:33:ac:59:4a:57:bd:6d:48:60:fd: + 89:8c:94:fd:64:24:cf:98:ea:31:c0:20:50:38:2e: + c6:f3:67:54:c1:ea:70:13:a4:34:fd:38:59:9c:64: + bf:11:f1:ed:01:46:08:31:c8:de:32:13:47:38:81: + 84:4d:f6:00:d3:8c:ee:6f:71:a1:5a:b1:34:60:95: + 25:67:7f:4c:d5:86:09:0b:dc:75:a1:e5:aa:05:74: + 0f:e8:f1:b1:2a:63:be:53:cb:d8:a3:9f:f1:1a:c6: + fb:c8:c5:ec:6c:34:86:13:c7:e4:83:d2:11:66:2f: + ee:8e:19:8e:e5:da:0c:59:09:b3:c6:35:aa:7e:88: + 15:eb:53:29:cd:f6:a5:c4:d2:af:72:28:b0:a8:f5: + a4:38:5b:ab:9f:e0:db:f1:b9:e4:ca:d0:e8:c7:dd: + 95:81:c9:75:e2:23:74:30:59:b0:ca:74:b1:fe:86: + 0d:7c:5a:f3:5d:bb:42:75:7d:48:51:d7:6a:ee:93: + d2:e4:30:2a:5c:65:56:f4:5e:74:97:e1:7e:ae:2c: + f7:da:95:12:e0:1a:dd:f5:07:c0:4b:85:90:45:d1: + b0:61:ec:90:ab:20:c3:55:78:6c:da:bb:48:4f:33: + 61:04:4f:8d:1a:e4:57:8a:cb:e1:ea:db:8f:f3:9f: + d4:98:5f:27:dd:20:9e:76:35:54:75:ab:ef:74:6b: + 77:93:02:e9:79:a4:0b:83:a4:ff:fd:3d:bd:a5:e3: + 96:b8:78:13:5a:91:7d:bd:a2:90:54:9d:07:87:fd: + 62:e2:d9:01:9c:50:8b:d4:7c:a4:28:f6:31:2b:9a: + f1:6f:6f:85:71:7e:71:b2:bc:6d:97:e7:fc:8c:5e: + 97:85:c1:6a:61:10:c1:e5:b4:db:52:db:20:e3:42: + 8f:fa:48:4c:27:87:0f:05:0d:6d:93:4e:2f:a1:36: + 58:16:73:9f:61:68:d5:cb:67:1b:5d:41:c2:e6:6f: + e6:ca:e1:f3:b6:92:c1:48:72:3f:a9:84:3b:1f:9b: + 3d:73:85:46:f2:f7:dc:5e:de:e9:18:47:24:f4:7d: + 46:e1:0e:2e:5a:4a:9a:4e:f1:e5:7c:71:d0:7b:9e: + 62:3d:43:a3:62:9e:55:0a:77:a6:98:31:b7:a1:11: + b3:58:35 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: + CA:FALSE + Netscape Comment: + OpenSSL Generated Certificate + X509v3 Subject Key Identifier: + FC:B5:C3:D3:A0:B5:6C:8F:3D:52:4F:07:03:08:0A:BD:9D:A8:94:3A + X509v3 Authority Key Identifier: + keyid:88:07:18:C1:FE:2E:09:2E:7D:E0:B9:1B:83:A9:54:DE:09:B1:16:7E + + Signature Algorithm: sha256WithRSAEncryption + 5d:26:45:db:9f:d6:c7:86:a0:22:85:f2:fd:4a:41:3b:3a:2f: + 81:1b:93:38:e7:0e:81:bf:bc:5f:47:95:94:92:a6:12:47:78: + 74:68:65:fd:e0:99:b2:08:d5:2b:fa:aa:05:13:88:7f:00:e8: + cb:17:b0:04:4d:d1:6e:80:4b:11:1b:71:45:b9:61:c2:66:14: + e6:86:d9:13:a0:7d:63:14:fe:41:7c:86:42:c8:53:0e:04:da: + 1b:28:cc:a4:e8:ff:f4:b0:73:4b:c0:a3:d7:be:7c:2c:2a:e5: + aa:3e:8b:ce:07:8b:b2:62:a4:7d:f0:b3:75:39:02:10:f0:a8: + b9:d8:1f:70:4d:d1:b0:68:46:43:02:bc:8b:15:e6:df:5d:c3: + ae:e3:89:80:48:64:35:9b:0b:2b:d6:75:38:96:0d:6c:f1:cb: + 03:91:ec:75:58:3b:fb:f7:78:cf:38:58:9b:a6:04:48:fc:aa: + c0:fa:a3:9c:da:c3:26:e0:82:9a:0e:0e:2b:2f:50:00:56:7f: + d5:ab:87:61:dd:bb:34:23:af:38:5f:ea:40:72:cf:46:38:31: + 8c:a3:68:1c:a1:84:62:03:05:7e:92:46:1b:0f:e2:a3:47:d3: + a2:c5:f9:e8:7b:d1:0a:20:63:d6:ca:01:05:7f:3f:4c:4f:d5: + 6c:51:e8:ee:82:35:37:9b:1e:e8:76:6d:05:50:88:43:cc:8c: + 20:81:09:a9:76:57:97:7b:bc:38:14:d5:3e:38:b1:a5:7e:51: + b2:67:9b:50:05:00:1b:24:90:cc:57:e1:b1:27:3e:50:09:0b: + bc:9c:0e:b3:d1:08:80:30:d6:28:85:6c:4d:9f:d2:ea:96:de: + 6f:0d:25:0c:03:94:65:4e:88:aa:d8:81:78:49:44:09:4d:85: + c8:db:8c:57:be:6d:49:97:2b:a5:28:97:e3:99:ea:f1:b7:46: + 2e:a6:dc:85:1c:d6:66:6e:dd:a9:db:d6:d3:34:71:95:0a:6d: + bb:47:b5:18:b5:7e:95:92:9b:53:f9:9b:a3:6c:09:2c:e2:d0: + d3:9a:4e:31:21:0b:18:b6:b4:fc:65:8a:a2:e5:b9:c8:f5:4a: + 92:3f:4e:de:db:e5:3a:bf:22:4e:39:b6:ae:09:d1:1b:84:f5: + e6:53:6d:c2:8e:24:26:58:58:80:aa:8d:dd:54:21:9e:7b:c1: + 01:f8:94:cc:a6:c0:32:9a:4a:0c:b4:f5:b8:e7:b0:5c:c2:18: + 57:1e:49:93:72:c9:01:91:b7:ea:a1:0b:fa:f0:33:0d:ff:55: + b6:fb:07:30:85:47:ab:cd:05:4e:cc:a2:49:91:0b:7d:b7:a4: + bb:43:ea:bb:f9:95:bb:e9 +-----BEGIN CERTIFICATE----- +MIIFyjCCA7KgAwIBAgIDEABuMA0GCSqGSIb3DQEBCwUAMGYxCzAJBgNVBAYTAktH +MQswCQYDVQQIDAJOQTEQMA4GA1UEBwwHQklTSEtFSzEVMBMGA1UECgwMT3BlblZQ +Ti1URVNUMSEwHwYJKoZIhvcNAQkBFhJtZUBteWhvc3QubXlkb21haW4wIBcNMjIw +NDI3MTUwMDM3WhgPMjEyMjA0MDMxNTAwMzdaMGoxCzAJBgNVBAYTAktHMQswCQYD +VQQIDAJOQTEVMBMG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+BG5M45w6Bv7xfR5WUkqYS +R3h0aGX94JmyCNUr+qoFE4h/AOjLF7AETdFugEsRG3FFuWHCZhTmhtkToH1jFP5B +fIZCyFMOBNobKMyk6P/0sHNLwKPXvnwsKuWqPovOB4uyYqR98LN1OQIQ8Ki52B9w +TdGwaEZDAryLFebfXcOu44mASGQ1mwsr1nU4lg1s8csDkex1WDv793jPOFibpgRI +/KrA+qOc2sMm4IKaDg4rL1AAVn/Vq4dh3bs0I684X+pAcs9GODGMo2gcoYRiAwV+ +kkYbD+KjR9Oixfnoe9EKIGPWygEFfz9MT9VsUejugjU3mx7odm0FUIhDzIwggQmp +dleXe7w4FNU+OLGlflGyZ5tQBQAbJJDMV+GxJz5QCQu8nA6z0QiAMNYohWxNn9Lq +lt5vDSUMA5RlToiq2IF4SUQJTYXI24xXvm1JlyulKJfjmerxt0YuptyFHNZmbt2p +29bTNHGVCm27R7UYtX6VkptT+ZujbAks4tDTmk4xIQsYtrT8ZYqi5bnI9UqSP07e +2+U6vyJOObauCdEbhPXmU23CjiQmWFiAqo3dVCGee8EB+JTMpsAymkoMtPW457Bc +whhXHkmTcskBkbfqoQv68DMN/1W2+wcwhUerzQVOzKJJkQt9t6S7Q+q7+ZW76Q== +-----END CERTIFICATE----- Index: tests/sys/net/if_ovpn/client.key =================================================================== --- /dev/null +++ tests/sys/net/if_ovpn/client.key @@ -0,0 +1,51 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIJKAIBAAKCAgEA8IY4labgdlLrJVeLRyrhF9ubhGQzDHCRdK71Ocynnjc80jLf +zVeOIQDJQ7az06j8FYTEFYbY1mlb1JsZyY5xnx0Sconje9uAbtxp/ZjrIjOsWUpX +vW1IYP2JjJT9ZCTPmOoxwCBQOC7G82dUwepwE6Q0/ThZnGS/EfHtAUYIMcjeMhNH +OIGETfYA04zub3GhWrE0YJUlZ39M1YYJC9x1oeWqBXQP6PGxKmO+U8vYo5/xGsb7 +yMXsbDSGE8fkg9IRZi/ujhmO5doMWQmz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EsTwYaV31BCluwqFajrHWpOUDPFEigHIB +hACy9QKCAQB2JYiNU0O8amxPSDRyMHn77R//2xH07ZuTx+Y3C/NbZIXZRig1HzNH +ysfl1bR68yrOA+972V4jfPK90b8yuWkqBS7fRI14LEugQzC1Qb4jY8xkQ93PwzSy +SQQ6j37ulO8X2IOSeMsxqqHvBNYSmXk1zAv4SEpeK8OninFBsc52o5Q2EKEjePq1 +IWRXEaKqcSajodHaYwx8e8p3aTg26UJ32eze0ewS9nTcigRzEe/Iea0r3EqXGr1K +J3zZ40cI+dIxDDEX4rM242mrg2+YJw7GU98Of66IQ6oBXu8uqhWFei6UXhL8UTgr +s1MpcrsAUvtlRCzXVjgPgGwPke9NOBYbAoIBAALzEo+wH3NNIiqD1DfNTAGHuEC3 +SRkXVe2sQEGfXN8l5N5ujvhCUqhkVzni4t/7FqHDuGQW/FMoO9xpAfRzi2+09Ymg +JLbMDIuhoOqnFD8Kn7yW4TKnAtaPIjxYARf6ODAJkFQL0t6r3psgZH4oMYAeBNCz +DJES+ED5tj6q3nBPYR+4H9CAxBJd4Bmvpv5N9Sg1W7VByqSlM9HMxtbkWEV0WshL +Zvm2PXBsCEPDp1SQcF9Vxuf9YMx3etVfTZ82gZXOwUF+MCBA0EjqtqMznT4gd7tH +RQZRjuIyd4gRq6PcvW7hPvfE7FL9wC3CHCsD1JZ++TRChYe4HRbEY/Oz62k= +-----END RSA PRIVATE KEY----- Index: tests/sys/net/if_ovpn/dh.pem =================================================================== --- /dev/null +++ tests/sys/net/if_ovpn/dh.pem @@ -0,0 +1,8 @@ +-----BEGIN DH PARAMETERS----- +MIIBCAKCAQEArdnA32xujHPlPI+jPffHSoMUZ+b5gRz1H1Lw9//Gugm5TAsRiYrB +t2BDSsMKvAjyqN+i5SJv4TOk98kRRKB27iPvyXmiL945VaDQl/UehCySjYlGFUjW +9nuo+JwQxeSbw0TLiSYoYJZQ8X1CxPl9mgJl277O4cW1Gc8I/bWa+ipU/4K5wv3h +GI8nt+6A0jN3M/KebotMP101G4k0l0qsY4oRMTmP+z3oAP0qU9NZ1jiuMFVzRlNp +5FdYF7ctrH+tBF+QmyT4SRKSED4wE4oX6gp420NaBhIEQifIj75wlMDtxQlpkN+x +QkjsEbPlaPKHGQ4uupssChVUi8IM2yq5EwIBAg== +-----END DH PARAMETERS----- Index: tests/sys/net/if_ovpn/if_ovpn.sh =================================================================== --- /dev/null +++ tests/sys/net/if_ovpn/if_ovpn.sh @@ -0,0 +1,104 @@ +## +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2022 Rubicon Communications, LLC ("Netgate") +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +. $(atf_get_srcdir)/utils.subr + +atf_test_case "4in4" "cleanup" +4in4_head() +{ + atf_set descr 'IPv4 in IPv4 tunnel' + atf_set require.user root + atf_set require.progs openvpn +} + +4in4_body() +{ + ovpn_init + + l=$(vnet_mkepair) + + vnet_mkjail a ${l}a + jexec a ifconfig ${l}a 192.0.2.1/24 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 + + keepalive 100 600 + " + 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 + + keepalive 100 600 + " + + # 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 +} + +4in4_cleanup() +{ + ovpn_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "4in4" +} Index: tests/sys/net/if_ovpn/server.crt =================================================================== --- /dev/null +++ tests/sys/net/if_ovpn/server.crt @@ -0,0 +1,123 @@ +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1048687 (0x10006f) + Signature Algorithm: sha256WithRSAEncryption + Issuer: C=KG, ST=NA, L=BISHKEK, O=OpenVPN-TEST/emailAddress=me@myhost.mydomain + Validity + Not Before: Apr 27 15:01:41 2022 GMT + Not After : Apr 3 15:01:41 2122 GMT + Subject: C=KG, ST=NA, O=OpenVPN-TEST, CN=Test-Server/emailAddress=me@myhost.mydomain + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public-Key: (4096 bit) + Modulus: + 00:b1:4c:f3:d9:6e:39:ac:d7:8f:78:e9:37:dd:ae: + 73:f4:d6:77:84:42:3e:2a:76:76:6f:71:6a:b4:45: + a9:e3:84:0e:ee:3d:18:20:47:9d:fb:d1:ca:bb:d7: + cd:d5:e3:b8:3d:1b:9e:c1:f5:26:72:4a:bb:fe:4e: + ec:49:06:c0:ff:21:f4:b5:5c:72:fc:c7:3e:27:86: + 03:65:e2:d8:f7:5c:c7:23:16:82:ab:ee:81:7d:44: + 41:a0:34:06:14:19:08:7a:47:69:5e:b6:aa:6f:74: + 08:4f:13:ca:1d:b1:d8:2e:3a:a7:41:ec:e0:3e:b4: + 54:b2:7c:2e:dd:ee:f5:07:92:ed:f2:64:62:2f:7a: + c2:8e:f0:50:2d:f6:2b:1c:9d:1d:db:25:04:1e:b5: + 0d:18:c8:a4:b6:1e:cc:05:a1:10:74:e2:4c:98:32: + 44:6c:95:94:18:a0:64:0d:32:6b:84:f9:25:4d:04: + 0d:39:73:23:cf:b0:5a:ab:c0:ff:ec:c1:6b:ed:fa: + 9b:26:d0:45:d5:0e:75:72:d6:2f:36:26:fe:2d:bc: + 50:e0:a0:14:d4:34:e0:10:cf:aa:6a:46:79:7d:dc: + 30:e7:6c:c0:44:3e:fc:20:dd:e1:05:b2:a2:2f:aa: + 06:76:dd:33:44:19:8e:5c:54:50:d0:2b:a8:03:06: + ec:31:1c:48:1b:39:51:52:0f:44:b0:90:d5:29:c0: + b9:ae:e2:74:af:e2:08:c7:b2:e5:4e:71:f0:88:33: + 97:16:92:69:0b:48:8c:25:7c:8e:20:7c:8a:0f:32: + e6:15:90:02:33:d6:00:4f:1d:c9:7e:ef:5c:af:5f: + b4:f9:c5:8b:7b:c8:47:34:4d:85:80:f2:a9:3c:e0: + 53:d0:b7:15:59:67:0e:1b:17:6d:9b:ed:a8:14:e3: + 90:9d:6e:3a:83:ae:6f:0c:c6:58:2f:e6:41:f2:67: + b5:7c:86:97:98:55:59:14:a0:0a:f4:5f:2e:8d:ae: + e2:d9:68:a9:34:b1:c3:0f:44:04:9e:81:a5:45:8b: + 2c:82:a9:6c:ea:e7:a8:dd:27:8b:0e:0c:8c:14:35: + c8:86:01:1e:69:43:93:cb:57:c8:9d:43:d9:8e:22: + de:f8:27:e4:44:1c:3b:58:47:10:13:5f:ca:85:8b: + a6:ee:5a:27:17:13:9e:72:c5:a6:d1:60:e3:ec:69: + f0:2f:d0:d8:25:a1:80:c3:03:6b:5d:32:21:26:31: + 48:b7:ce:d2:32:2c:e9:1e:34:eb:21:e7:8e:a9:26: + 86:e6:a1:ba:0f:4a:8a:05:eb:4b:02:7a:65:e4:d3: + 39:da:10:3a:e6:0e:6f:22:ca:a0:2f:b7:7b:1e:65: + 05:73:d7 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: + CA:FALSE + Netscape Comment: + OpenSSL Generated Certificate + X509v3 Subject Key Identifier: + 4E:69:D9:D4:F1:8C:C7:F0:7D:02:79:DD:00:AB:5C:0B:61:42:F5:E2 + X509v3 Authority Key Identifier: + keyid:88:07:18:C1:FE:2E:09:2E:7D:E0:B9:1B:83:A9:54:DE:09:B1:16:7E + + Signature Algorithm: sha256WithRSAEncryption + 10:40:c5:a6:b4:4f:10:e1:ff:d4:fd:68:6d:b1:f4:02:7e:18: + 03:99:d2:fa:ce:24:b9:10:c3:d7:18:48:e6:9c:4c:b2:45:39: + a8:bc:7b:1f:66:bf:1a:bc:d5:22:f6:bc:61:e3:87:4d:d4:c8: + dc:ea:ee:5f:ad:95:94:e0:17:ff:7f:d5:b6:bd:a7:5f:2b:9d: + a4:5b:65:58:9f:83:c6:91:6f:d9:d9:1b:2e:e8:19:d8:d7:35: + ef:07:5d:1b:cd:89:2b:b3:d1:0c:bd:41:99:fc:54:fe:44:03: + a6:25:06:3a:e3:f5:3e:a1:9e:de:6b:7c:8e:dc:71:32:a9:2b: + 48:06:b7:72:f3:e4:38:fd:88:c0:62:48:d3:48:81:30:9e:ac: + 3f:d9:c6:40:92:98:39:7f:ec:bb:b8:8d:25:a0:c0:ed:c3:be: + 3c:df:54:42:3c:5d:2d:48:f5:35:b1:e9:b5:2f:0b:53:f1:fa: + 30:56:da:7d:2e:46:7d:7e:27:59:e5:ab:19:7b:be:9c:77:df: + 5d:6d:94:d7:3d:3b:45:09:0d:4e:a6:3e:2d:6d:95:76:78:af: + 03:d9:62:5d:64:14:f6:9b:36:a1:e4:6c:07:07:7f:ae:31:e6: + 69:6b:56:e6:42:6b:f6:de:24:ae:12:6a:58:13:31:9c:1a:87: + 01:a5:57:57:1f:0a:9e:16:85:30:c9:95:46:d1:05:70:df:39: + 80:fb:75:b1:44:43:e3:ba:8e:ef:c0:4d:db:9d:53:6c:32:e0: + 69:c8:74:b3:24:51:db:f9:7b:fb:0e:bc:61:0e:f3:56:31:2e: + 29:51:ed:dc:93:14:13:d0:6b:ab:88:d4:ae:e7:41:c2:da:7b: + 73:ec:d1:b9:49:07:85:73:e3:75:ed:ea:e8:48:09:01:45:52: + 58:05:37:bf:f8:5e:74:61:5f:1e:b2:db:1f:49:62:d1:ab:8f: + e6:d4:3e:69:1d:da:0b:93:88:3e:1c:2e:f4:03:32:9e:75:df: + af:65:0d:1c:cf:fd:35:36:f7:a5:93:01:11:69:2a:7b:76:8a: + 52:bb:e3:e9:b0:dc:e8:5b:78:65:3d:e9:36:84:8f:03:b3:ed: + 43:88:1f:97:71:ce:c6:c1:9e:e2:5d:51:b5:1a:bd:c6:fe:f1: + e2:c3:6c:95:6d:08:06:5b:b1:13:4b:57:36:07:c4:81:ea:d8: + f7:e4:2a:27:ce:75:1d:fd:ca:e4:82:a3:d1:0b:75:a3:77:8e: + c0:2b:34:87:2b:84:17:8c:23:e0:6d:fb:18:01:06:56:4b:f5: + 39:bc:3e:59:3d:ed:68:17:c0:12:66:56:0e:34:64:95:b2:84: + 99:de:71:94:2a:ca:a6:70 +-----BEGIN CERTIFICATE----- +MI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aG5qG6D0qKBetLAnpl5NM52hA65g5vIsqg +L7d7HmUFc9cCAwEAAaN7MHkwCQYDVR0TBAIwADAsBglghkgBhvhCAQ0EHxYdT3Bl +blNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFE5p2dTxjMfwfQJ5 +3QCrXAthQvXiMB8GA1UdIwQYMBaAFIgHGMH+LgkufeC5G4OpVN4JsRZ+MA0GCSqG +SIb3DQEBCwUAA4ICAQAQQMWmtE8Q4f/U/WhtsfQCfhgDmdL6ziS5EMPXGEjmnEyy +RTmovHsfZr8avNUi9rxh44dN1Mjc6u5frZWU4Bf/f9W2vadfK52kW2VYn4PGkW/Z +2Rsu6BnY1zXvB10bzYkrs9EMvUGZ/FT+RAOmJQY64/U+oZ7ea3yO3HEyqStIBrdy +8+Q4/YjAYkjTSIEwnqw/2cZAkpg5f+y7uI0loMDtw74831RCPF0tSPU1sem1LwtT +8fowVtp9LkZ9fidZ5asZe76cd99dbZTXPTtFCQ1Opj4tbZV2eK8D2WJdZBT2mzah +5GwHB3+uMeZpa1bmQmv23iSuEmpYEzGcGocBpVdXHwqeFoUwyZVG0QVw3zmA+3Wx +REPjuo7vwE3bnVNsMuBpyHSzJFHb+Xv7DrxhDvNWMS4pUe3ckxQT0GuriNSu50HC +2ntz7NG5SQeFc+N17eroSAkBRVJYBTe/+F50YV8estsfSWLRq4/m1D5pHdoLk4g+ +HC70AzKedd+vZQ0cz/01NvelkwERaSp7dopSu+PpsNzoW3hlPek2hI8Ds+1DiB+X +cc7GwZ7iXVG1Gr3G/vHiw2yVbQgGW7ETS1c2B8SB6tj35ConznUd/crkgqPRC3Wj +d47AKzSHK4QXjCPgbfsYAQZWS/U5vD5ZPe1oF8ASZlYONGSVsoSZ3nGUKsqmcA== +-----END CERTIFICATE----- Index: tests/sys/net/if_ovpn/server.key =================================================================== --- /dev/null +++ tests/sys/net/if_ovpn/server.key @@ -0,0 +1,51 @@ +-----BEGIN RSA PRIVATE KEY----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ys/net/if_ovpn/user.pass =================================================================== --- /dev/null +++ tests/sys/net/if_ovpn/user.pass @@ -0,0 +1,2 @@ +username +password Index: tests/sys/net/if_ovpn/utils.subr =================================================================== --- /dev/null +++ tests/sys/net/if_ovpn/utils.subr @@ -0,0 +1,63 @@ +## +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2022 Rubicon Communications, LLC ("Netgate") +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +. $(atf_get_srcdir)/../../common/vnet.subr + +ovpn_init() +{ + vnet_init + + if ! kldstat -q -m if_ovpn; then + atf_skip "This test requires if_ovpn" + fi + + has_dco=$(openvpn --version 2>&1 | grep '\[DCO\]') + if [ -z "$has_dco" ]; then + atf_skip "openvpn binary does not support DCO" + fi +} + +ovpn_cleanup() +{ + + vnet_cleanup +} + +ovpn_start() +{ + jail=$1 + cfg=$2 + + dir=$(pwd) + + echo "$cfg" > ovpn_${jail}.ovpn + + echo "Jail $jail:" + echo "===========" + cat ovpn_${jail}.ovpn + + jexec $jail sh -c "cd ${dir} && openvpn --config ovpn_${jail}.ovpn &" +}