diff --git a/repos/dde_linux/recipes/raw/test-wg_reconnect/content.mk b/repos/dde_linux/recipes/raw/test-wg_reconnect/content.mk new file mode 100644 index 0000000000..cfe49a2691 --- /dev/null +++ b/repos/dde_linux/recipes/raw/test-wg_reconnect/content.mk @@ -0,0 +1,8 @@ +CONTENT = index.html +CONTENT += example.pem lighttpd.conf +CONTENT += dynamic.config + +content: $(CONTENT) + +$(CONTENT): + cp $(REP_DIR)/recipes/raw/test-wg_reconnect/$@ $@ diff --git a/repos/dde_linux/recipes/raw/test-wg_reconnect/dynamic.config b/repos/dde_linux/recipes/raw/test-wg_reconnect/dynamic.config new file mode 100644 index 0000000000..db9e1807cd --- /dev/null +++ b/repos/dde_linux/recipes/raw/test-wg_reconnect/dynamic.config @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/repos/dde_linux/recipes/raw/test-wg_reconnect/example.pem b/repos/dde_linux/recipes/raw/test-wg_reconnect/example.pem new file mode 100644 index 0000000000..531b9fc6f2 --- /dev/null +++ b/repos/dde_linux/recipes/raw/test-wg_reconnect/example.pem @@ -0,0 +1,49 @@ +-----BEGIN PRIVATE KEY----- +MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQC4KHUZjDRew89c +wDlYPz9XFigcMDnDlHzdg2ByrGZIOUNYC5LH1QUK0TDbPP45Xx455niA0QY85dMQ +4DQx0Qk6+TDpVD3F2MYQgbIX6YkX9kgqX+jiHgsNzRD4KamNYmfUY+dJhlZEXWAF +uNSnRLvg4EH72AVKLLKiruGwkisW/AYU6dNE8iFOYL8Q75bBUADiQSDdD8vkpeXg +1NqxNyHPR6YRbA+vqcK0kbC8btKR9wG6m99OhTR4x3M87vtFFLNtJNEf54fYxi+L +1rljSqHbaXD+XJsVKgX+UlI1ZlYW4KqlMciMemkBp0CovCxLfsbMmkXAW2RONpkm ++sdO3CXFAgMBA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sGYEuRwIU/tmAmTbniptItN9VE0NNj9QeKh+hKQ9cHvhxmlBlf5b7Vb2JaRZdy88 +kRIFKiNkyjgQVg+5KuEIcg17mHSal7zG+jIZ3c1bIpVCM4AjUe7EXl8LM4+dJ5sX +Bwpd34tUk2edOiT8R/dU7uesxCdeIQ2FfvKyrXca73nj+UTvFGXUk/9mWY8KAaYc +F/PWBhiZhJD4/dkUHJnrVtjpcqW2Io8bFmrMq2vfqQv+W2FZGCsHgXkAZO2E0jyQ +5eOrwzgWRtMc5PvoGvqQfefseaLs0fvSQdcPqfv88Eqk5NGTOCIW8/KEsBwFJuwa +EpA5DBBklj8UE2CdONvN +-----END CERTIFICATE----- diff --git a/repos/dde_linux/recipes/raw/test-wg_reconnect/hash b/repos/dde_linux/recipes/raw/test-wg_reconnect/hash new file mode 100644 index 0000000000..bfbdcfff4e --- /dev/null +++ b/repos/dde_linux/recipes/raw/test-wg_reconnect/hash @@ -0,0 +1 @@ +2023-07-13 ea74be1d69e64b9f0a08e7bbf76c9e18960732ca diff --git a/repos/dde_linux/recipes/raw/test-wg_reconnect/index.html b/repos/dde_linux/recipes/raw/test-wg_reconnect/index.html new file mode 100644 index 0000000000..42ea90a784 --- /dev/null +++ b/repos/dde_linux/recipes/raw/test-wg_reconnect/index.html @@ -0,0 +1,8 @@ + + + Test site for wireguard + + + Some content. + + diff --git a/repos/dde_linux/recipes/raw/test-wg_reconnect/lighttpd.conf b/repos/dde_linux/recipes/raw/test-wg_reconnect/lighttpd.conf new file mode 100644 index 0000000000..cca889df6b --- /dev/null +++ b/repos/dde_linux/recipes/raw/test-wg_reconnect/lighttpd.conf @@ -0,0 +1,18 @@ +# lighttpd configuration +server.port = 80 +server.document-root = "/website" +server.event-handler = "select" +server.network-backend = "write" +server.upload-dirs = ( "/tmp" ) +server.modules = ("mod_openssl") +index-file.names = ( + "index.xhtml", "index.html", "index.htm" +) +mimetype.assign = ( + ".html" => "text/html", + ".htm" => "text/html" +) +$SERVER["socket"] == ":443" { + ssl.engine = "enable" + ssl.pemfile = "/etc/lighttpd/example.pem" +} diff --git a/repos/dde_linux/run/wg_reconnect.run b/repos/dde_linux/run/wg_reconnect.run new file mode 100644 index 0000000000..ab09de15e4 --- /dev/null +++ b/repos/dde_linux/run/wg_reconnect.run @@ -0,0 +1,354 @@ +# client restart tests for wireguard +# +# The run script sets up the following scenario: +# +# | 10.10.10.2/24 (DHCP) 10.10.10.1/24 (server_home) +# | ************ +++++++++++++++++++++++ +# | * lighttpd * ----- + nic_router (server) + +# | ************ +++++++++++++++++++++++ +# | 10.10.20.1/24 (vpn_inner) (no_arp) +# | | +# server init | | +# | 10.10.20.2/24 (DHCP) +# | %%%%%%%%%%%%% +# | % wg_server % +# | %%%%%%%%%%%%% +# | 10.10.0.2/24 (DHCP?) +# | +# | +# 10.10.0.1/24 (vpn_server) +# +++++++++++++++++++++++ +# + nic_router (global) + +# +++++++++++++++++++++++ +# 10.20.0.1/24 (vpn_client) +# | +# | +# | 10.20.0.2/24 (DHCP?) +# | %%%%%%%%%%%%% +# | % wg_client % +# | %%%%%%%%%%%%% +# | 10.20.20.2/24 (DHCP) +# | | +# client init | | +# | 10.20.20.1/24 (vpn_inner) (no_arp) +# | ************ +++++++++++++++++++++++ +# | * fetchurl * ----- + nic_router (client) + +# | ************ +++++++++++++++++++++++ +# | 10.20.10.2/24 (DHCP) 10.20.10.1/24 (client_home) +# +# The client side will be restarted two times to test reconnecting. + +if { ![expr [have_board linux] || [have_board pc]] } { + puts "Run script is not supported on this platform." + exit 0 +} + + +proc rtc_drv_binary_name { } { + switch [board] { + linux { return "linux_rtc_drv" } + pc { return "rtc_drv" } + } +} + + +proc rtc_drv_use_ld { } { + return [expr [have_board linux] ? "no" : "yes"] +} + + +create_boot_directory + + +set depot_archives { } +lappend depot_archives [depot_user]/raw/test-wg_reconnect +lappend depot_archives [depot_user]/src/[base_src] +lappend depot_archives [depot_user]/src/curl +lappend depot_archives [depot_user]/src/dynamic_rom +lappend depot_archives [depot_user]/src/fetchurl +lappend depot_archives [depot_user]/src/init +lappend depot_archives [depot_user]/src/libc +lappend depot_archives [depot_user]/src/libssh +lappend depot_archives [depot_user]/src/openssl +lappend depot_archives [depot_user]/src/lighttpd +lappend depot_archives [depot_user]/src/nic_router +lappend depot_archives [depot_user]/src/openssl +lappend depot_archives [depot_user]/src/posix +lappend depot_archives [depot_user]/src/report_rom +lappend depot_archives [depot_user]/src/[rtc_drv_binary_name] +lappend depot_archives [depot_user]/src/vfs +lappend depot_archives [depot_user]/src/vfs_jitterentropy +lappend depot_archives [depot_user]/src/vfs_lwip +lappend depot_archives [depot_user]/src/wireguard +lappend depot_archives [depot_user]/src/zlib + +import_from_depot $depot_archives + + +set server_init_config { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + } + + +set client_init_config { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + } + + +append config { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} $server_init_config { + + + + + + + + + + + + +} $client_init_config { + + + + + + + + + + } + + +install_config $config + +build_boot_image [build_artifacts] + +append qemu_args "-nographic " + +run_genode_until "fetchurl. exited with exit value 0.*\n" 12 + +for {set i 1 } { $i <= 2 } { incr i } { + puts "Wireguard reconnect $i" + run_genode_until "fetchurl. exited with exit value 0.*\n" 12 [output_spawn_id] +}