From 40c1bfc9386e630ee3f76747c736a5a964333e2a Mon Sep 17 00:00:00 2001 From: Pierre Hubert Date: Fri, 2 Sep 2022 09:43:07 +0200 Subject: [PATCH] Add new test based on token auth with TLS --- .gitignore | 2 - src/base/samples/TCPTunnelTest.crt | 29 +++++++++ src/base/samples/TCPTunnelTest.key | 51 +++++++++++++++ .../client_try_tls_while_there_is_no_tls.rs | 8 +-- src/test/dummy_tcp_sockets.rs | 4 +- src/test/invalid_token_file.rs | 2 +- src/test/invalid_with_token_auth.rs | 6 +- src/test/mod.rs | 10 ++- src/test/pki.rs | 53 ++++++++++++++++ src/test/test_files_utils.rs | 7 +++ src/test/test_pki/ExpiredClient.crt | 25 ++++++++ src/test/test_pki/ExpiredClient.key | 27 ++++++++ src/test/test_pki/OtherCA.crl | 16 +++++ src/test/test_pki/OtherCA.crt | 29 +++++++++ src/test/test_pki/OtherCA.key | 51 +++++++++++++++ src/test/test_pki/RevokedClient.crt | 25 ++++++++ src/test/test_pki/RevokedClient.key | 27 ++++++++ src/test/test_pki/TCPTunnelTestCA.crl | 17 +++++ src/test/test_pki/TCPTunnelTestCA.crt | 29 +++++++++ src/test/test_pki/TCPTunnelTestCA.key | 51 +++++++++++++++ src/test/test_pki/ValidClient.crt | 25 ++++++++ src/test/test_pki/ValidClient.key | 27 ++++++++ src/test/test_pki/localhost.crt | 25 ++++++++ src/test/test_pki/localhost.key | 27 ++++++++ src/test/valid_token_with_custom_increment.rs | 8 +-- src/test/valid_with_multiple_token_auth.rs | 6 +- src/test/valid_with_token_auth.rs | 6 +- .../valid_with_token_auth_and_server_tls.rs | 62 +++++++++++++++++++ .../valid_with_token_auth_multiple_ports.rs | 8 +-- src/test/valid_with_token_file.rs | 6 +- ...oken_auth_and_invalid_server_tls_bad_ca.rs | 54 ++++++++++++++++ ...d_invalid_server_tls_expired_and_bad_cn.rs | 54 ++++++++++++++++ 32 files changed, 747 insertions(+), 30 deletions(-) create mode 100644 src/base/samples/TCPTunnelTest.crt create mode 100644 src/base/samples/TCPTunnelTest.key create mode 100644 src/test/pki.rs create mode 100644 src/test/test_files_utils.rs create mode 100644 src/test/test_pki/ExpiredClient.crt create mode 100644 src/test/test_pki/ExpiredClient.key create mode 100644 src/test/test_pki/OtherCA.crl create mode 100644 src/test/test_pki/OtherCA.crt create mode 100644 src/test/test_pki/OtherCA.key create mode 100644 src/test/test_pki/RevokedClient.crt create mode 100644 src/test/test_pki/RevokedClient.key create mode 100644 src/test/test_pki/TCPTunnelTestCA.crl create mode 100644 src/test/test_pki/TCPTunnelTestCA.crt create mode 100644 src/test/test_pki/TCPTunnelTestCA.key create mode 100644 src/test/test_pki/ValidClient.crt create mode 100644 src/test/test_pki/ValidClient.key create mode 100644 src/test/test_pki/localhost.crt create mode 100644 src/test/test_pki/localhost.key create mode 100644 src/test/valid_with_token_auth_and_server_tls.rs create mode 100644 src/test/with_token_auth_and_invalid_server_tls_bad_ca.rs create mode 100644 src/test/with_token_auth_and_invalid_server_tls_expired_and_bad_cn.rs diff --git a/.gitignore b/.gitignore index 0cab0fc..de6b1ab 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ target .idea -*.crt -*.key pki diff --git a/src/base/samples/TCPTunnelTest.crt b/src/base/samples/TCPTunnelTest.crt new file mode 100644 index 0000000..46c4a05 --- /dev/null +++ b/src/base/samples/TCPTunnelTest.crt @@ -0,0 +1,29 @@ +-----BEGIN CERTIFICATE----- +MIIE8DCCAtigAwIBAgIBATANBgkqhkiG9w0BAQsFADAYMRYwFAYDVQQDEw1UQ1BU +dW5uZWxUZXN0MB4XDTIyMDkwMTA2MzMyMFoXDTI0MDMwMTA2MzMxOFowGDEWMBQG +A1UEAxMNVENQVHVubmVsVGVzdDCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC +ggIBALqh3EXg3TYq5TwZPjOX35bM7kol+fLlwjLaXCTx/lTXU0hTFsIa0kFCiPsT +Vhm5nwhDLxnAARagc74gUHfhr6meMbsje2NzylmCpW1As1s1x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RMKjUJ6MgQ7/JOwtaHyu8jBuJWUNEE47hpHGUrIxmLUi2AWlxxQZdPic+Rxf +LKWoNlGx5OrzcIuIc3lb11zinRdaawOjVV0yCKWIlSkb77Flp8WJIlZ6ZHLtqwsU +8D9zN4EXefc9dXYMLyWvRHmHOTr8430PebYc/G5BA+XjOgpFQ3vu8trIA/3Dbuyc +ggz1abiDnBmp+I66AYV+Ker81maM6CQU+03WKHbHZyJWr74SKuILY1knys/fXJvT +UZRMhmaQqxc1QcWVOkWLv0RcAhEjwIX0+36NUC1W35JfrRpHtmqIiJH9kjcjr94w +5sjM2EUFmMC5z0zjF9cSYKSHLSI= +-----END CERTIFICATE----- diff --git a/src/base/samples/TCPTunnelTest.key b/src/base/samples/TCPTunnelTest.key new file mode 100644 index 0000000..5afb737 --- /dev/null +++ b/src/base/samples/TCPTunnelTest.key @@ -0,0 +1,51 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIJKAIBAAKCAgEAuqHcReDdNirlPBk+M5fflszuSiX58uXCMtpcJPH+VNdTSFMW +whrSQUKI+xNWGbmfCEMvGcABFqBzviBQd+GvqZ4xuyN7Y3PKWYKlbUCzWzXGjafy +g2LZiyogD0AdZBayKF/t8+XJk6AEjBRAGwt3q6OnBu9oSHAECtL6l5Vi4HfMNu40 +EnaWp28Pl9rxoLKg/Kx5olxowwndHZb/w5itSwkQIqCDboDzPEXnlF2+MlwE40bS +RGU2yvFLq4712dDyTK9RF6W4+BMR9mb8znh0KL1W8pVEoD/mZ3/5JBbBCE/IiKDf +5dd5hA2hQ3phe+VbDvThUGD+EMGqtjjYuOlL8XIwaynhwdUIxcEvBE0dY9+KTrDe +s1OkWnuHgyZ59/FfZX/G4GvchyJVyyZ4PheZ+nSjqDejlU8rgohHn9v5op7u4vz/ +2FNMtKpambz6TRugTv3r+Bvx6DIQvAGs+yt0ZAiIg/YBzqbneJO0S1x4g6YwH63u +ZQ+RAeyIugIt5GbZ1s9YQrPaY7x85WNVhP2fFj3aX8C966SxO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z +D66Z0hV4gvGgbDlb/7/Edi/eGcZgRIaM9n5Zwe2ex71kZOU+cTr5liMrjxZYhJQv +vZt9ebAqLo00H7SOXFySksPHuUunniDhAoIBAFH3wC6kW3RLX7vuKqgZMLIR93ey +bJKwFFwBk7Jc4PT47sp7B8Vi58DOl4eFzktYhn5lh/YN9K/Tj1zLSEqJqxO+SBO+ +irArxdHaUzQ1lzeRpvYxP3cB5ZBBDHvZCtNkmqfnGCxQtvoxuCt9m8brpfPAmZaW +8jrLNrWqvkxJE9GFfmZ8R+pTIFCBDRC6E2RuHFrQK5NCr717zDJ/OPe5GDmWp48d +GiPu+CUqew2yt9XQw7Ol+QVY6NVyqDAZR34jIc3/TtsISfYahN0zAxUHtW3BdAOF +HOfvisKnygWsUi7efFAVfRop5UUeoxDqGh/UvFy0JsUbFfeRynTH7FIwBSA= +-----END RSA PRIVATE KEY----- diff --git a/src/test/client_try_tls_while_there_is_no_tls.rs b/src/test/client_try_tls_while_there_is_no_tls.rs index 73590eb..c4e7b60 100644 --- a/src/test/client_try_tls_while_there_is_no_tls.rs +++ b/src/test/client_try_tls_while_there_is_no_tls.rs @@ -3,7 +3,7 @@ use tokio::task; use crate::tcp_relay_client::client_config::ClientConfig; use crate::tcp_relay_server::server_config::ServerConfig; use crate::test::dummy_tcp_sockets::{wait_for_port, DummyTCPServer}; -use crate::test::{get_port_number, PortsAllocation, LOCALHOST}; +use crate::test::{get_port_number, PortsAllocation, LOCALHOST_IP}; const VALID_TOKEN: &str = "AvalidTOKEN"; @@ -12,7 +12,7 @@ fn port(index: u16) -> u16 { } #[tokio::test(flavor = "multi_thread", worker_threads = 5)] -async fn valid_with_token_auth() { +async fn test() { let _ = env_logger::builder().is_test(true).try_init(); // Start internal service @@ -43,8 +43,8 @@ async fn valid_with_token_auth() { crate::tcp_relay_client::run_app(ClientConfig { token: Some(VALID_TOKEN.to_string()), - relay_url: format!("https://{}:{}", LOCALHOST, port(0)), - listen_address: LOCALHOST.to_string(), + relay_url: format!("https://{}:{}", LOCALHOST_IP, port(0)), + listen_address: LOCALHOST_IP.to_string(), root_certificate: None, ..Default::default() }) diff --git a/src/test/dummy_tcp_sockets.rs b/src/test/dummy_tcp_sockets.rs index 8b36ee2..69cfd36 100644 --- a/src/test/dummy_tcp_sockets.rs +++ b/src/test/dummy_tcp_sockets.rs @@ -5,13 +5,13 @@ use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::net::{TcpListener, TcpStream}; use tokio::time; -use crate::test::LOCALHOST; +use crate::test::LOCALHOST_IP; pub struct DummyTCPServer(TcpListener); impl DummyTCPServer { pub async fn start(port: u16) -> Self { - let addr = format!("{}:{}", LOCALHOST, port); + let addr = format!("{}:{}", LOCALHOST_IP, port); println!("[DUMMY TCP] Listen on {}", addr); let listener = TcpListener::bind(addr) .await diff --git a/src/test/invalid_token_file.rs b/src/test/invalid_token_file.rs index b16b7c0..b6f3564 100644 --- a/src/test/invalid_token_file.rs +++ b/src/test/invalid_token_file.rs @@ -8,7 +8,7 @@ fn port(index: u16) -> u16 { } #[tokio::test(flavor = "multi_thread", worker_threads = 5)] -async fn invalid_with_token_auth() { +async fn test() { let _ = env_logger::builder().is_test(true).try_init(); crate::tcp_relay_server::run_app(ServerConfig { diff --git a/src/test/invalid_with_token_auth.rs b/src/test/invalid_with_token_auth.rs index 75ed953..3b87aa0 100644 --- a/src/test/invalid_with_token_auth.rs +++ b/src/test/invalid_with_token_auth.rs @@ -3,7 +3,7 @@ use tokio::task; use crate::tcp_relay_client::client_config::ClientConfig; use crate::tcp_relay_server::server_config::ServerConfig; use crate::test::dummy_tcp_sockets::{wait_for_port, DummyTCPServer}; -use crate::test::{get_port_number, PortsAllocation, LOCALHOST}; +use crate::test::{get_port_number, PortsAllocation, LOCALHOST_IP}; const VALID_TOKEN: &str = "AvalidTOKEN"; const INVALID_TOKEN: &str = "AnInvalidTOKEN"; @@ -45,8 +45,8 @@ async fn invalid_with_token_auth() { // Start client relay crate::tcp_relay_client::run_app(ClientConfig { token: Some(INVALID_TOKEN.to_string()), - relay_url: format!("http://{}:{}", LOCALHOST, port(0)), - listen_address: LOCALHOST.to_string(), + relay_url: format!("http://{}:{}", LOCALHOST_IP, port(0)), + listen_address: LOCALHOST_IP.to_string(), root_certificate: None, ..Default::default() }) diff --git a/src/test/mod.rs b/src/test/mod.rs index 9135a92..c0f132d 100644 --- a/src/test/mod.rs +++ b/src/test/mod.rs @@ -9,15 +9,20 @@ enum PortsAllocation { ClientTryTLSWhileThereIsNoTLS, ValidTokenWithCustomIncrement, ValidWithTokenAuthMultiplePorts, + ValidWithTokenAuthAndServerTLS, + WithTokenAuthAndInvalidServerTLSBadCA, + WithTokenAuthAndInvalidServerTLSExpiredAndBadCN, } fn get_port_number(alloc: PortsAllocation, index: u16) -> u16 { 2100 + 20 * (alloc as u16) + index } -const LOCALHOST: &str = "127.0.0.1"; +const LOCALHOST_IP: &str = "127.0.0.1"; mod dummy_tcp_sockets; +mod pki; +mod test_files_utils; mod client_try_tls_while_there_is_no_tls; mod invalid_token_file; @@ -25,5 +30,8 @@ mod invalid_with_token_auth; mod valid_token_with_custom_increment; mod valid_with_multiple_token_auth; mod valid_with_token_auth; +mod valid_with_token_auth_and_server_tls; mod valid_with_token_auth_multiple_ports; mod valid_with_token_file; +mod with_token_auth_and_invalid_server_tls_bad_ca; +mod with_token_auth_and_invalid_server_tls_expired_and_bad_cn; diff --git a/src/test/pki.rs b/src/test/pki.rs new file mode 100644 index 0000000..cd0bfa7 --- /dev/null +++ b/src/test/pki.rs @@ -0,0 +1,53 @@ +use mktemp::Temp; + +use crate::test::test_files_utils::create_temp_file_with_content; + +pub struct PemHolder(Temp); + +impl PemHolder { + fn new(b: &[u8]) -> Self { + Self(create_temp_file_with_content(b)) + } + + pub fn file_path(&self) -> String { + self.0.to_str().unwrap().to_string() + } +} + +pub struct Pki { + pub expired_client_key: PemHolder, + pub expired_client_crt: PemHolder, + pub localhost_crt: PemHolder, + pub localhost_key: PemHolder, + pub other_ca_crl: PemHolder, + pub other_ca_crt: PemHolder, + pub other_ca_key: PemHolder, + pub revoked_client_crt: PemHolder, + pub revoked_client_key: PemHolder, + pub root_ca_crl: PemHolder, + pub root_ca_crt: PemHolder, + pub root_ca_key: PemHolder, + pub valid_client_crt: PemHolder, + pub valid_client_key: PemHolder, +} + +impl Pki { + pub fn load() -> Self { + Self { + expired_client_key: PemHolder::new(include_bytes!("test_pki/ExpiredClient.key")), + expired_client_crt: PemHolder::new(include_bytes!("test_pki/ExpiredClient.crt")), + localhost_crt: PemHolder::new(include_bytes!("test_pki/localhost.crt")), + localhost_key: PemHolder::new(include_bytes!("test_pki/localhost.key")), + other_ca_crl: PemHolder::new(include_bytes!("test_pki/OtherCA.crl")), + other_ca_crt: PemHolder::new(include_bytes!("test_pki/OtherCA.crt")), + other_ca_key: PemHolder::new(include_bytes!("test_pki/OtherCA.key")), + revoked_client_crt: PemHolder::new(include_bytes!("test_pki/RevokedClient.crt")), + revoked_client_key: PemHolder::new(include_bytes!("test_pki/RevokedClient.key")), + root_ca_crl: PemHolder::new(include_bytes!("test_pki/TCPTunnelTestCA.crl")), + root_ca_crt: PemHolder::new(include_bytes!("test_pki/TCPTunnelTestCA.crt")), + root_ca_key: PemHolder::new(include_bytes!("test_pki/TCPTunnelTestCA.key")), + valid_client_crt: PemHolder::new(include_bytes!("test_pki/ValidClient.crt")), + valid_client_key: PemHolder::new(include_bytes!("test_pki/ValidClient.key")), + } + } +} diff --git a/src/test/test_files_utils.rs b/src/test/test_files_utils.rs new file mode 100644 index 0000000..e7d305d --- /dev/null +++ b/src/test/test_files_utils.rs @@ -0,0 +1,7 @@ +use mktemp::Temp; + +pub fn create_temp_file_with_content(content: &[u8]) -> Temp { + let temp = Temp::new_file().unwrap(); + std::fs::write(&temp, content).unwrap(); + temp +} diff --git a/src/test/test_pki/ExpiredClient.crt b/src/test/test_pki/ExpiredClient.crt new file mode 100644 index 0000000..beb54f6 --- /dev/null +++ b/src/test/test_pki/ExpiredClient.crt @@ -0,0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4cwydEwoI0OvoDXezKcjo8bj8Dna4+UqBz85PFQFZKT23gYBuz4/A +8/G/3pvXKf8DTnIo9370qU9Ce0UlohCu0U3rRQDEiMiTxQgkhHn7CXe0quOem9yt +RUOXymAUz/IdB/Xu0jfuZUF4e6ObF9yULb1SzmHmsxUD7i2h+453KmsYpSDWp2CP +R9UOrhINirSOr1qRm5PCnMO8b+Th7TlhfQBY3u8VTn1l5F4fdzGiIGV5IZmGb1fV +b47WC7y3TdJ6i5fWVt2XtKQBQOjOLgPfZs5qW8GFHWrW1Z2otn6vrNMgquhV/9kd +9TzSFgbymCFKvGkHXZQ70Rqkb8Q5v3dz3VSFfqdE728hvp3GRHqZDSJhcR/FVahm +AKio0jBH1mENEttHndQhXQkE +-----END CERTIFICATE----- diff --git a/src/test/test_pki/ExpiredClient.key b/src/test/test_pki/ExpiredClient.key new file mode 100644 index 0000000..187fcbc --- /dev/null +++ b/src/test/test_pki/ExpiredClient.key @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEpAIBAAKCAQEA0NMicawMnjGr+lKel5MNIToHZn/8dp3RZCRaXrPiTpbm3v3E +XCOYxrhx8kmKN+ALW6xtXb4E/SeH50/F51OUi1SEhbwePHYEz+urU4+9g27RsHvN +yZP5Yd10Mt1+zGNIy3ndvhQxtxaxx+UuvLtXpqGhdxyc8pTK3hT5lxhqjI8B6Pfb +LlibwQHYe/2UyhFVsXTaYShNx1qcl2E//Lbw02b17MyyK/WO0KppHWKlWPtd0Jbc +r69UtbN1/Dvn4/1tLm5dwBkdVCwmTfueu17Mf/pmC6b05BhSYjFM3OETNmIp9RZr +TuXSXdILzUpV/VhUp/A7ylAoBMstpq6pchBZnwIDAQABAoIBACq3Zc5W4WXix0k3 +aVWcMQ1g726aM6yX7+NKRGom5d4ppCRtSKOIbJIJ3NUxEeMII4qnJOAOJLscQQKi +INuHD1XI/irVJmI7yhQ2Ix++wYeHPcGaMahQaq0IPeLByFRK4vMshJ2DSAAp1kgL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VwJwSBb3zjaPPTR/ZZ+LI3k8wStXlOMiQ== +-----END RSA PRIVATE KEY----- diff --git a/src/test/test_pki/OtherCA.crl b/src/test/test_pki/OtherCA.crl new file mode 100644 index 0000000..497387b --- /dev/null +++ b/src/test/test_pki/OtherCA.crl @@ -0,0 +1,16 @@ +-----BEGIN X509 CRL----- +MIICgTBrAgEBMA0GCSqGSIb3DQEBCwUAMBIxEDAOBgNVBAMTB090aGVyQ0EXDTIy +MDkwMjA3MTI0MloXDTQyMDkwMjA3MTI0MFowAKAjMCEwHwYDVR0jBBgwFoAUIdv7 +GAAmusKCN710x76ODIzpFDswDQYJKoZIhvcNAQELBQADggIBAJ6PEWN9ZdK6V1Z+ +qb1lE6UpDwee7Gvu+WmYLc/ySDy8zpt3er5bfJFEI5zLYRvR7C8I77QuHfm6ytny +AcjdZoqLoYn6JkEnbZFj9yddcYfwmo1bxc7YsGKqitQPwUA+Ou2mq9q8pSyAIAY3 +d1cAKEqHZgnWm/7D4NZZ8lWGjjFz9hlwhP8jWKqRcGsL/RGylNW9wyroECGRg18R +YiFIqgXiWAG1CAZcbcv2yKlijSm2q8OgBG5mFMClm5yHEmyju4ZyRowySraSkMkc +1lZqOpxRFn59FNE278bm4RJfWFtprvO/1UONq46VIi49q3iykjowGS9enFhd2pDX +JGRiMze5+Y9+MRqB7CkpgWr85a6VB/eZHt1klZDXHVviTPBwf7Sps0u2j63ZgMKl +NZCG4oTyPguyNF+PF76xqwhGqJJB1zK63wizC+1go4It9vn22tg3/C2X1riWiKjN +XimlHyumq1DkRoulwo716m3/DgVbAQD+dfTmGA80QnCMAEpRG0rjBwwrsbuz7TSX +38YiBCBAbgM/L/XhVXzuki0Q5xrrcvH8bhxG6/j+gpAFdI3on2R3rHgWMXS8c9tw +4gqXuPr4Th3Rb3pwZEsWvUXG3vY/5d2Pq9gCGcEUo36CCaZzMCDh7yrJHd1zY5gT +e5zdMjCWD7b5jfM0GpSthrfh7cya +-----END X509 CRL----- diff --git a/src/test/test_pki/OtherCA.crt b/src/test/test_pki/OtherCA.crt new file mode 100644 index 0000000..f2221c9 --- /dev/null +++ b/src/test/test_pki/OtherCA.crt @@ -0,0 +1,29 @@ +-----BEGIN CERTIFICATE----- +MIIE5DCCAsygAwIBAgIBATANBgkqhkiG9w0BAQsFADASMRAwDgYDVQQDEwdPdGhl +ckNBMB4XDTIyMDkwMjA3MTI0MloXDTQyMDkwMjA3MTI0MFowEjEQMA4GA1UEAxMH +T3RoZXJDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAM802FZEmSvZ +A+SfJNWBJsAt7SvWQBxxpzmP8joriDkULG4XCiJGAHY7MsNm6uAk/A2f3TNEghiL +tbfQtJKfOEC2NDe8Y9H7bKo9cVep2YORGuXuDH4dkX4oAYYgKbdYSeMHyOsOkpEG +1FBlA4rw73RuO/aMqF25e1idLWXgi5fk8SUiWgH9Twse8KcYg8v3pA/SZcoZtc2S +rSsJFZJCrEOPZMJpTilW3Sd6KlZ+1niOAyEksYEy+ACQs9PU1H6edn6S+oNxpF24 +iy3Orr4u3miU40SDOtO2qtrv/6vlbXZaIju5KyEZSMyve0Vvc4v02xUfdGxNPR2y +r7IDd0lIfewLMohpE2m2g2VPkWvC+EMkW3lA/a5xyDotF6aFGKblABRjHIRwNORT +tx7/jXoX5Cg9zGmLrs3/MhNJvGsErfnNCmDvlP7J7+JbpFgDMJo1uOv1ozLu344Y +R75trQBaOglTNNNs0D2sIgfEJTdwOt4PvGMgClcYGerjRZEKFmiX6//S6JBnlfGp +d5cWDgLv67sHKk9FXbbsZpomoGOqWKF5DuPoUH+0yOEq4LSoqMmaxFIVf3LgIvD5 +G+1xV5jxkJsWv9JSY6QpYS9JDSpaOe2FqsQGF8VCd2SOnlzGxnMAISpT9xHrtYu+ +fCXnf+gXWUsy5Y01It7CMHnW6cFhP+ATAgMBAAGjRTBDMA4GA1UdDwEB/wQEAwIB +BjASBgNVHRMBAf8ECDAGAQH/AgEAMB0GA1UdDgQWBBQh2/sYACa6woI3vXTHvo4M +jOkUOzANBgkqhkiG9w0BAQsFAAOCAgEAHLGe4p4gBwn2vCotnFxNRc/4NKkRkvO7 +dlr2jKGCIFfGgU9JsgaYYUckxDzkQadOujpuqeuB4J9OfH+GmbUNG8MOuSJdhtKi +sASnYoaF17Go7cOg/6k0GfN5FuIQPjEOM8yFGhAhP4MfsWlNWxUQPh/3QewjfEUt +TNJXZ/1zyY2Bjt5hygdSJ8eDe7V8fVV+HcLj17bfgfP+ILbgxPhsc0Sqh719j0va +gptqzrLz1eSKjthwVrYh3RuJCBPJJKa51y54TKIqnDkrWEQc0YQf7K3wkJJQ7H6M +UELhZLVF2zjEltxcfDGUCHtxcWYApA6chwsDTNYoeb7KdTAmXgQS7JNTqLuvF773 +nGCKQr6JYPwnQ7QOE7oWVEeINGZtSyKBb/+DpTacK0qaw7MymkJBlaRNHAGsTzfI +U0/tKLsi6ItXi8vY/wTxRt4qvlu4mFeGFoTNdTDib6rJKS4D6HoGeRglhefOpv4r +luaJ3MwANCTa0T5H/+vDN1NQTMJa6Iul6gKzDkX1vB1duenPpExAgnjm3QeNCvQ/ +yqNCPEAyZBg83L6ZKCEHQWo3SM2nMwV6X+pS0FKCY/z+7EGH6A4FHriaksOnSNeD +HczdA3Kp8jCR9llFknwxvwvIzFbh73E0/KVifIfzmbKakIseohKRNF1kxhFaB+wR +DE1o4VTfHl8= +-----END CERTIFICATE----- diff --git a/src/test/test_pki/OtherCA.key b/src/test/test_pki/OtherCA.key new file mode 100644 index 0000000..6948213 --- /dev/null +++ b/src/test/test_pki/OtherCA.key @@ -0,0 +1,51 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIJKgIBAAKCAgEAzzTYVkSZK9kD5J8k1YEmwC3tK9ZAHHGnOY/yOiuIORQsbhcK +IkYAdjsyw2bq4CT8DZ/dM0SCGIu1t9C0kp84QLY0N7xj0ftsqj1xV6nZg5Ea5e4M +fh2RfigBhiApt1hJ4wfI6w6SkQbUUGUDivDvdG479oy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4FnoahOw2SGxNAB9LkYphKyb27v6uZt8v8 +Oy9tRntzDd+9G2ltlfe5VJvwef5YLxk/jhJ1HWTQZz6BTrA4OH4wzy4SZVkx8jqs +a+N1U4qUrZw7XkbgkiNCRSw/9liNYKqLH+FRgy2u7OBWk+JUVNM3TFlwcqEebecH +eVxWAwKCAQEAuD3EcACj/XWTO3WuZhIkC/j4IWVeDUyFgUN0SsxJxT3xrz62sFgA +tlFGqeDN8yYLpFre+iWoWppzGjpmQUfD+yENQoOkIh/3d9xL7uv0V1v9+bdhWCke +dWgYQM8bRx7n7b8yP31iVtDV592MPwQvmBWYHBo4iLuW49N7Bk4klblLz/AZIVSw +CT4jw/3qCfiK7hDsP2IAWdooCzqogc9TF1kiUnMhOyIDqxk7BXpDqjFseSWwfenE +NwN9YdVK2ynk0tRzuZfCeCrnR5nTb91MhCxZ1zu5f/YFzaTZFb3ypyQ97qaJcZBz +FZAwEbAT0MjOaeR4Yf55pbcvrm6yUR9wbQKCAQEAlwyZt/V8JM5g7vlxpvugKzpy +J7fdMY72fAWwWukSfJRkssx1LYGryzeFppEhJvoLQtAzDNHJNM4tQ0pIfb1xf0Oq +qk8hzN5d0R2ck/KqAYj4yli+Ik6upUCuiyR76CsnDd24ninZBWsro+iXAz+taF0g +0c+Rk/kxqL+k9InAAhU5Z8mxk/uKH1SnuSYnJzKtPbcex7l8I/7oBohXHsq7CcPJ +I76Hc7eiaF06MBfaxr/lJVJydo0wj0d19dKchfu6p6RgddMpPKTSVzd1T9bKY+i6 +nHaV5mRmrjqtGN7Z/MntpjjQdDPdKv0uMtG0yfNguVbDgu1q2+7lJoIWJX8/bw== +-----END RSA PRIVATE KEY----- diff --git a/src/test/test_pki/RevokedClient.crt b/src/test/test_pki/RevokedClient.crt new file mode 100644 index 0000000..27a9189 --- /dev/null +++ b/src/test/test_pki/RevokedClient.crt @@ -0,0 +1,25 @@ +-----BEGIN CERTIFICATE----- +MIIELjCCAhagAwIBAgIRAMvrVtV8eUCAihX59Tz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md+V09LbhT3sDYpHuTIYwvHcf7jOO6wUKl7JulOwEkBD2IiTs+6 +RMT2eIavlQjIObqNvLTWoVfm4b32vvBzyXdrZyr1FIlJ+VlhIpvEC1ZPq3ZLC831 +sDPtyVI+dA4KV/+ZN3NvP0BfL9+7KE20Ma1V2u8reV51nddjRzNkYt3AdAuO3B9i +CUqauhe5o7Ey7QFRAxYvT4xmg9mRjSJSlX+jwXroKymtxgG3f/14Do+5yyN0bS3O +FC1H3uV1vwQztxkpJdh8PoWoh+1OsqwrRIYSEAx9M1xSBHz5TzgHQJmot5fwLQTn +QgvMyCyS46ciaMjRILqagt6P +-----END CERTIFICATE----- diff --git a/src/test/test_pki/RevokedClient.key b/src/test/test_pki/RevokedClient.key new file mode 100644 index 0000000..126ea2e --- /dev/null +++ b/src/test/test_pki/RevokedClient.key @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEowIBAAKCAQEA4nSzS6SPoVopVBbWtnt91PsKoXIFxtDTKv2eKhoUggIkiI39 +GxNE6XAS0UFijLrxI//3D6nhzRP7VBevZPskGWNnwjRGi0+ZQv0nLp8zl0PybgYz +jgrijP4yTolpU05xjX6PrvQotEkouFf+A1OKKoV2YxestR2XYoXeqtjYmHiuLKCQ +7TEKUqIvnub/z60INcj5zJx+118swM4uQE8DscJ5V1qHHavqYeLm1KWT6wx5cQnL +uRHjDjMNRv8zA/VxCCdIzC10YThfPbNIvASTQ/zE1R7tDDDHrTmzJ39j+UUNqyg9 +4aAKoW/D/OBkTYP7pTw1vLBkECpr8135QDS/5wIDAQABAoIBAEtCJWP6KJGi+SEt +BeZXXBYv5/SHhEvyknszFiE/0ZjzRVjsdzVMThaWXGqWpD3I0uL36g+Wkagp/9iO +loekvvaBBraP0PHzXifZIfBokCixOBxAi1mlXG0m/WkEWbCJ3Ur8yJuIIQ7pUVMS +SySn2r8O461C7O60Ct9/ReTZdAIXWRj8uKiJF731RMZ/NFaOZfom5ijFyKcspyQ0 +ap6CCpx8cZ3M8IUwHZJFgoET8tJX+6LftYKTKhE2LjBBzmGw1xFDuOEXmkrb62Fd +1HHUOdkgT3+2SLR3Mz8piWdhhvlg57+WTIKsA5Kx9GTDjIUUTXK5s3PsgxObEpc2 +JWLhuaECgYEA695jleVohwX1z/I3idmZpSJK1MJOi09Pj4IvR+RXtKN5DpGhQGRO +x5TLGxJ9F2nQMErW8+oVBotl39iaFAlT77+CShBtBS7JfDX76whAvLwnouy8Winz +YV9IBOFl9XT4hVhvkR7BAzm5CsKAiT9OJRPxX0uHdmsWbnTjMwcG0csCgYEA9cil +Pes5ZOQ9Yn+M9wufrOJZ5FnC9NYvgre89OZTQhjISZmX0iW6McVkqEc7Av1S4IGC +t8+jVgq4f2XWle83GYrnWxwItGADJdL/X2YWWqzzEvTeyLs3zuLtZUt4wG5MDJJ/ +XJaTiuA+a9r6/fsQto+0LI43R6Ge5UERi91qVtUCgYABvQLY4PbzP8z++lcEchEa +0XThuojfp/b7JMd6bSlkUGwc+l/I3LRj7inNCkbXvFTndjW9WHVNNgvLKYqBKUxw +EOZB63sSNbUQcElqAwaPHYfhQINm2rZLemtKderNc049lVhFJoffoTZG6QYPfOLz +jQETZbga3FEvATeHcb7QHwKBgH0DPzkNSbYNeUN+SP7nBKJ0xvAkz8qknqnINu4B +sNtvq3/0BYq38cqa8iW9hUByBRN4DDrd++Apt8nkzI6ai9YMFrz6t1q3cyJr/cRS +MpCQY1qC/kXvI+Ww+rqI9rQ55aiHYwx+8jCy+kz1prBEYS3aTfRTqb5fcGh+/iO7 +zPi5AoGBANvsVAjy0HJxJom8yfCPw2tzMPh7o9v1jMblKN1xX8B249i27S5UOifO +Viy0OR6uiNGT6YLA7Q7esGavkiuK0bWa0M9ezWbGoNh4DmOzn9Q8yEbDz9VF23Pw +fc52Ehiq9zS9cqIXc+cQJe/o2J6YziUnBcJc2Ld7d75TISkkdYrN +-----END RSA PRIVATE KEY----- diff --git a/src/test/test_pki/TCPTunnelTestCA.crl b/src/test/test_pki/TCPTunnelTestCA.crl new file mode 100644 index 0000000..d72bf3a --- /dev/null +++ b/src/test/test_pki/TCPTunnelTestCA.crl @@ -0,0 +1,17 @@ +-----BEGIN X509 CRL----- +MIICrjCBlwIBATANBgkqhkiG9w0BAQsFADAaMRgwFgYDVQQDEw9UQ1BUdW5uZWxU +ZXN0Q0EXDTIyMDkwMjA3MDgwNFoXDTIyMDkwMjA3MDgwNFowJDAiAhEAy+tW1Xx5 +QICKFfn1PPDJXBcNMjIwOTAyMDcwODA0WqAjMCEwHwYDVR0jBBgwFoAU+53PiQbh +7KSQGc797M71fZg+JDUwDQYJKoZIhvcNAQELBQADggIBAAT08Q5BJIU+yvPSsNdE +yMBQZSUfTyFOxWYeUiqohpRkCBdhWYAnrZiZN83GArW7rFi1D9p0Cdg5ayDgY1A3 +4SsnXklwcEdYxIzaLskN1bRY7Idmu9TXdDssPWCyawTfWfV5AfqnqnuKx71gradf +jMixrOoOWiBqMp3kHO6F2Q5gKGTQcvjYAe9yVeOF/tchMiHEHBw59HigiHmkX4od +7GNbyWyqJlMaVoK13hOt/qnjOFKITsUSzIZ1pI8NY44sBFSIM1SzklfZZ3vBNaeC +gA6JBrBm/vEvbZ/WsfCI0uVJwLgCoY4tupocKCLwyN2tyGFhvPwlv4UFEEkabYuo +9F7/5CG3JO2yJPHMuflebLawyyfXlbjH9fqvjNRnyry3MXsdphU5OV/xavrSNgLW +i8HItaFThCvnMdlMn38UYeGUqp/lgrpQiXEA8K+BX55lJzzNK+UPLNEkf3bROWvR +01tstOAhn0rfPKW01HjqXKU8Si2ExBR+kzdamhiZoaKcxuemK/TPd+vmNXuvwede +3o2qdXycgFddbKmKejV3gy+zptnFyEGlC3E3BgfSdQ2Tdn0BBltzhRdENB6o5SYh +ZUP4Mo3Gr0Hy7eeLGQM7wzmxUxOGmVdqDoWnbOwC2ySEzR6Tsf9id7Sl50DDUcS5 +G20W0UM0cWIOyaaHAxKl9frl +-----END X509 CRL----- diff --git a/src/test/test_pki/TCPTunnelTestCA.crt b/src/test/test_pki/TCPTunnelTestCA.crt new file mode 100644 index 0000000..7a67b36 --- /dev/null +++ b/src/test/test_pki/TCPTunnelTestCA.crt @@ -0,0 +1,29 @@ +-----BEGIN CERTIFICATE----- +MIIE9DCCAtygAwIBAgIBATANBgkqhkiG9w0BAQsFADAaMRgwFgYDVQQDEw9UQ1BU +dW5uZWxUZXN0Q0EwHhcNMjIwOTAyMDcwNjE0WhcNNDIwOTAyMDcwNjEzWjAaMRgw +FgYDVQQDEw9UQ1BUdW5uZWxUZXN0Q0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw +ggIKAoICAQC5agi1SIe/1SqoBb+p3IstdnZa12IrKtTiSSANV/RtjLgFymqqlvNd +I3OJOglJr/ISSWrldh+ZRb661Ds7USLPYC+ZGUXK4jRoe+CvW+WjqUMKbZu2CrAO +YmlSy09QCARJX1kv1dLDgukfOmXCTz65uMpf6hZzTr/KNCWJImXSfsJLsuUqhRLn +M4mEV3P2TX6hrtAYa8vCVqRO4vlFOvmYdYIOT/TfLTMhmqqodVFQMoUFvl4/ZZEc +dEmJOInd+yktSCO9Ziv+A/24Zb9mY46X80NVSoUmvTYB2FEo3AMqmxq1QHo3I7/k +3NxK2uLE3xFkpXckHI+FfTjuNvYBn+EqR0FNuCiM+YsCapYBZOW2olMHZs3BI+A3 +nFS4JGWN53qno5GqKl0mm16b5jt+O7qy6997VvvKlkOgXOFGfa3L3x9lR/i4WUIS ++oK1M94xJtbhUgVSH1N8K6J52jyl1EEGCR/LbW2762Db0jIQXT2/T6k0HsF+CVVR +BLOMdV8V2JrcXCcnW6L0jGl1pXO9idgnlNlGCndjM6E2wvr6livg7Fjpxw+xJLA1 +BMhc8gaKxcVZBcHkdmK2G6q49GAO5s6DCiGuNpGgZ1YCAV6OflbKiIJWPV/sGOp9 +iLEnxYXTAaYMwM86yfBqkIpQk7dqWa5Qfwfb+o2vDhWY5e6/bHdhGwIDAQABo0Uw +QzAOBgNVHQ8BAf8EBAMCAQYwEgYDVR0TAQH/BAgwBgEB/wIBADAdBgNVHQ4EFgQU ++53PiQbh7KSQGc797M71fZg+JDUwDQYJKoZIhvcNAQELBQADggIBAFIqak9dGO/i +mMRZGu9E7fItltodw9Qphixn5SKc1Rgf6RRj/XGj10JrYiG0ULnEsMLMCu9G4GAp +IM2LKYLcirOvP+bM1sWS4ieMrldCVlbJdnhz8TnWInHb1+CNTvXKt41rc/NGsDCp +QODmj2Iwd2/QI13ABKGSxjXUvTWl4Cq9kSUvkDZjV/WFjb8nUs6Y6vNQZTc3rne2 +CUb5+xDRmgz6q/SsAtgH8Rrzt8KYhrT5r4kMkpIFssLBWUQgHGdZEaEnt89qnIVb +/mULw7l0716yTkqUBydibyDUsvhgOh1c5Xg/8ICwVptvFzzcbvWFtMjOQCuqB/ud +lBcMPIlM2CyytQ6uJjcjEfoy2O1rAlgEb2QKR7abPinlLFo2d1kx3GwPgSzdpROB +fJalW0QDLkdeSPSX2a/99KTI8GKQKriG5D2kcHVFAY57P7yjbyrLtD2dKdCTp0M5 +jPMGjWvFOJ86k8XiNB8yMtABp0K5WZLqqvPFm16sBPaJnpKGo/KUipnLOTnEOpHJ +LWDDH8P+HKjhV99s7IwBu+67sDsKO/AsZGRuLJSGh1j8nl/iKhHGgXPfGPY7oDIZ +6JyqnW0906KrIoUFZ0b8iKMwIu35aVR++rfWIdFcYqW4flNkAZI0XY5IlJ/i9d7N +0ezY2xRAYlJSvefisMIylm0OgUDg0Nv7 +-----END CERTIFICATE----- diff --git a/src/test/test_pki/TCPTunnelTestCA.key b/src/test/test_pki/TCPTunnelTestCA.key new file mode 100644 index 0000000..7970a50 --- /dev/null +++ b/src/test/test_pki/TCPTunnelTestCA.key @@ -0,0 +1,51 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIJKAIBAAKCAgEAuWoItUiHv9UqqAW/qdyLLXZ2WtdiKyrU4kkgDVf0bYy4Bcpq +qpbzXSNziToJSa/yEklq5XYfmUW+utQ7O1Eiz2AvmRlFy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wg8BK/m6V +vL0mZIGxcTvaxwuEMm710mH5VoCnLaQ9Ol8/pkP3vyFy6HI6AON7hzqpc4nv8rH1 +/qVqK5ipIBQ5d32+5gltvfzi9EpK8afNjv5IyPzEhb8Mdwlbg3uv1I60Ic4y1fel +MAzcZhKyWTcJF1F3pX0WhqGfdsmWzaSKq8Zj+FIv4v/bxDNHF1emrMTOUvh4fO+n +tgysIwKCAQAbVL2AT2vHTO43Arzdqfge9taAULhDekYL5yij6iVCoWpI2baU+Tqf +j7A+yb9Mic4Lu6Px7nI6sKW/Md+Cdaf4YeHdhR1OJI3PodgPUttnILpvNSBRpGjz +lou8LN0zRWCc1/3t8QXtiB6b7ecAcTRo8FNl7H0VPtUOtdFKeDeMlGHSencPnhlY +1nM2UpsJ6Wg+TQ8eyURnJ0oMoIwHXSP3s0hMC//BdFsxciUmNgHcv0Luz55aLmPS +vDevcCUFHcaicDrKlT59m3d06+oq9PKH90M4Yazgmiorz3JfsDGafSTYFOiIbPgT +gLcPkJ8/nqruH6ns8XVIo0RX5VmjqIoBAoIBAExWSqMKxLkiVzuZVwovmeTeS1CL ++toFkgNC8eKqfgm8lAZjtN2AFS5HWQqjoEn+sHVufun8OkpoS/5Tn2WNAoicGvLa +9wsc+p4kwXQuMrS1c9xo65CAMrHh/JL6pHjgtXFr2BH1VBL5rBaPa9NB+Mb5SKCW +ObXXmMkDEmM2sZGmXE2j1YzzxzvfPDFEP0qBOVmYDk/gaNP4SyTegC3goufsxWEt +S6xGEB9ToN24/OwY/o7jWGX3sNf4GPXGUK4dPQL1fTMqxfxSK2n+m/nlnY7wVGmB +sJQl4XWOafuKq041YU+yT/KI41m0a70rqwuc7KsAdJlYnCL7dbkXTk6o6tg= +-----END RSA PRIVATE KEY----- diff --git a/src/test/test_pki/ValidClient.crt b/src/test/test_pki/ValidClient.crt new file mode 100644 index 0000000..ca62152 --- /dev/null +++ b/src/test/test_pki/ValidClient.crt @@ -0,0 +1,25 @@ +-----BEGIN CERTIFICATE----- +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qEPyI6S1VHOUBsGru5rkY44zeRs2p +V2jHSIpcsbP04iwMDNFJV24Fio8A9hV4LFm5Nyv3O6gBgyyiRnYGvfS9R6wazGNW +LXAXQw69Wios4PxdlIX85jIJgyJ5GrjpjTTYmzkhe7fs8s3jdm4a2mFMWQcjbSia +15mF/1TdVNcKqt/M55aYY6HL3AnIc90TDIXr7UWZVJSeYicVZdI8N0Ih/1myOYw7 +3NvqUetYLw/FQ7C+763N9QLgSdPlBTMkMSyB2pkXAAzWwJ/UPJ6z5REZmTVHu8Kf +I5UD0GwVnfUpBTLEpUG4oTH39PhKlncCKtmMnaZiu0DzxMy0xeskFT7YZFj0BKQc +JXXeqkcOvTFHibpLR5lQ1Q== +-----END CERTIFICATE----- diff --git a/src/test/test_pki/ValidClient.key b/src/test/test_pki/ValidClient.key new file mode 100644 index 0000000..c8ffe2e --- /dev/null +++ b/src/test/test_pki/ValidClient.key @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEpgIBAAKCAQEAneTyMKf0FAN1FRwxywUGp5Mg0zskMUsykegmzsodoZE7P5e/ +HiNinsKL2ID+KKMEbB2FEzXGRwQSpt3xOgaGTlbkINE8NduqKSeVhDue5z6Hqp/0 +ZYnPpZvK/yDOq1AlNHLj6z9zoMxioHHpXZZ1pgWes+gj7QpYL9B9BIKb1ue/4H73 +luCXzjeMPgo1ihRcAHZOzcIMAFbqQ3kw783SuBMVmP3Bg7NzcpwEv8UvAtigVZiu +NJfXhNBzGOnBUOeITPcGFXmRWbAkPvT/98sBLXW9cbFY3A85pOVIccFRq87vRSKM +MdSt2/8yDUFYXn7AzwmvyHzMuDWjccIOuc6o2QIDAQABAoIBAQCdaZfOzFK49S1v +61j090DIJhVOoaKWhkqXTiQKe1QJNJol7yo5aLu0XW5AXXGFn+gTxWZbXXwcZsIV +nCUXXVPenB/5W8A0TZgaSX11hF8KWbu1bpyf8kGS8Hvz2IhSIKfG31e8u9iSEdGt +9YLbq9oEt4ud/qx6cJ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xgpa51hCRtEv6MGNu5qJ9QGKxb8VAFbQT3vPI +-----END RSA PRIVATE KEY----- diff --git a/src/test/test_pki/localhost.crt b/src/test/test_pki/localhost.crt new file mode 100644 index 0000000..d4239ba --- /dev/null +++ b/src/test/test_pki/localhost.crt @@ -0,0 +1,25 @@ +-----BEGIN CERTIFICATE----- +MIIERzCCAi+gAwIBAgIQAtk0UZ5qjqGgxYWL7X9GhDANBgkqhkiG9w0BAQsFADAa +MRgwFgYDVQQDEw9UQ1BUdW5uZWxUZXN0Q0EwHhcNMjIwOTAyMDcwNzUxWhcNNDIw +OTAyMDcwNjEyWjAUMRIwEAYDVQQDEwlsb2NhbGhvc3QwggEiMA0GCSqGSIb3DQEB +AQUAA4IBDwAwggEKAoIBAQDLuZElNqvAPIiTBjWJIjD1Ie+Amw1MvsWMY7UP56qC +czkvHI4wfHRJ+mCsUsbKnKR8nYDCa2CiiZpI/oWDZcQZBWmOjaoeBJajw6g+sjFl ++lft4xY6aMSXnpcU71KNelOLZsZmPYs24ZUgmjnQB1s6HZlF1niGabCaNnLtd5z2 +HBPqHno2YvvD4r41n/+kDjhKoZ0t0coZnZaBlEPMvnBOlC1Z/Cn41tORTGkgm3rT ++PY3aS8n2q7prLvMc7QD/4kaN5Ep6IydXYIB+gjwIscgSHEdLZq0rAU1Xk/PQrCc +P3ysdeXFnSq4VuvgVSgXPa4pACvY+cNjaSTzk1WRaLW1AgMBAAGjgY4wgYswDgYD +VR0PAQH/BAQDAgO4MB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAdBgNV +HQ4EFgQU2uwKZmO17EkQ8bLDVMdiTqLlyYEwHwYDVR0jBBgwFoAU+53PiQbh7KSQ +Gc797M71fZg+JDUwGgYDVR0RBBMwEYIJbG9jYWxob3N0hwR/AAABMA0GCSqGSIb3 +DQEBCwUAA4ICAQAHf8955HzEOTpmdN34O2jVKC1Riu8Zrpv19Gi1AJpi4WJN3xNv +BR6EeaelYEazf17ia5pj3mlT+95aE9wDYVWyqzrJuni5sT94Vw2wIL87qHxFnnBc +Wd2HhTbVSduYlIBOOFpaY28d1td6S2XsiTVfare7z8HESkcP/JeERtAtCnT8NCaC +vxSPdW+fEQxIXssS+PrlOH3rOcZHj8xUD8SDxgiizf0BZw15aLG4YsEhVU8w292K +mBmV0eYcsVpWTplE71zHDc1oJqmCZtLfYjPDy6gzyikkspPDCDU+MLT6y//WJC4d +onY0JZ9CA6i9DKlSsOvQN0LypcYOFdKjWPMwXD0PXy1Mrte4KqexhxlTJfc8WHNt +GhYOCMtYvScHE0T6XD9ybrFb2u+u8TFqrHCfTabJEaCGBsMMK2XwYQvtbRiTjvtB +sTSJrB4fvKfWahYUXZtM4unll752xRjQawW+/Nt7Bi4CeKlQX/6nlpAJTmKDxLCK +OWyS4oNWrcLmVUIKnPiaXA0AsnlOmwuR1Fsrgo+SYJqCeoe90+oo+GdqOmRuSZU9 +N+ry011LZMsNzaHifWqsh1jp3kUQ5XnBA4KWv1Asgg0oCpRnYmUS7GSSdBZkp9a2 +0TEp4yh/gUZ+YO3/XQmpDa1/3kojfhD+WcRQoZ5lwMrlwxtvmiOit4JJQA== +-----END CERTIFICATE----- diff --git a/src/test/test_pki/localhost.key b/src/test/test_pki/localhost.key new file mode 100644 index 0000000..87ef87d --- /dev/null +++ b/src/test/test_pki/localhost.key @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEpAIBAAKCAQEAy7mRJTarwDyIkwY1iSIw9SHvgJsNTL7FjGO1D+eqgnM5LxyO +MHx0SfpgrFLGypykfJ2AwmtgoomaSP6Fg2XEGQVpjo2qHgSWo8OoPrIxZfpX7eMW +OmjEl56XFO9SjXpTi2bGZj2LNuGVIJo50AdbOh2ZRdZ4hmmwmjZy7Xec9hwT6h56 +NmL7w+K+NZ//pA44SqGdLdHKGZ2WgZRDzL5wTpQtWfwp+NbTkUxpIJt60/j2N2kv +J9qu6ay7zHO0A/+JGjeRKeiMnV2CAfoI8CLHIEhxHS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KneU2CM0N47jNi1F6mzuvPh+THcyZJnIPiZnKVBOHX2a23 +kC57pQKBgQCchLrp2oX0q0jKVb5BqbsJiRMuBhRC96M0IABH6YRaCW372XCvgCWC +jtvXuT0XmqTYbmtpPEw1Pp9eJ3qminK4Z55N2fG+c9wtzJ+Mli8UoS3yFRSzbneD +LtbdqXEoZPYd6dLbTPTe43Pnl45o4epC+46c678nP/TrtfnKAiL1SA== +-----END RSA PRIVATE KEY----- diff --git a/src/test/valid_token_with_custom_increment.rs b/src/test/valid_token_with_custom_increment.rs index c466b74..eb27755 100644 --- a/src/test/valid_token_with_custom_increment.rs +++ b/src/test/valid_token_with_custom_increment.rs @@ -5,7 +5,7 @@ use crate::tcp_relay_server::server_config::ServerConfig; use crate::test::dummy_tcp_sockets::{ dummy_tcp_client_square_root_requests, wait_for_port, DummyTCPServer, }; -use crate::test::{get_port_number, PortsAllocation, LOCALHOST}; +use crate::test::{get_port_number, PortsAllocation, LOCALHOST_IP}; const VALID_TOKEN: &str = "AvalidTOKEN"; @@ -14,7 +14,7 @@ fn port(index: u16) -> u16 { } #[tokio::test(flavor = "multi_thread")] -async fn valid_with_token_auth() { +async fn test() { let _ = env_logger::builder().is_test(true).try_init(); // Start internal service @@ -46,8 +46,8 @@ async fn valid_with_token_auth() { // Start client relay task::spawn(crate::tcp_relay_client::run_app(ClientConfig { token: Some(VALID_TOKEN.to_string()), - relay_url: format!("http://{}:{}", LOCALHOST, port(0)), - listen_address: LOCALHOST.to_string(), + relay_url: format!("http://{}:{}", LOCALHOST_IP, port(0)), + listen_address: LOCALHOST_IP.to_string(), root_certificate: None, ..Default::default() })); diff --git a/src/test/valid_with_multiple_token_auth.rs b/src/test/valid_with_multiple_token_auth.rs index 5b03c2e..a5cf9ae 100644 --- a/src/test/valid_with_multiple_token_auth.rs +++ b/src/test/valid_with_multiple_token_auth.rs @@ -5,7 +5,7 @@ use crate::tcp_relay_server::server_config::ServerConfig; use crate::test::dummy_tcp_sockets::{ dummy_tcp_client_square_root_requests, wait_for_port, DummyTCPServer, }; -use crate::test::{get_port_number, PortsAllocation, LOCALHOST}; +use crate::test::{get_port_number, PortsAllocation, LOCALHOST_IP}; const VALID_TOKEN: &str = "AvalidTOKEN"; @@ -50,8 +50,8 @@ async fn valid_with_multiple_token_auth() { // Start client relay task::spawn(crate::tcp_relay_client::run_app(ClientConfig { token: Some(VALID_TOKEN.to_string()), - relay_url: format!("http://{}:{}", LOCALHOST, port(0)), - listen_address: LOCALHOST.to_string(), + relay_url: format!("http://{}:{}", LOCALHOST_IP, port(0)), + listen_address: LOCALHOST_IP.to_string(), root_certificate: None, ..Default::default() })); diff --git a/src/test/valid_with_token_auth.rs b/src/test/valid_with_token_auth.rs index bbdb7c9..db33b56 100644 --- a/src/test/valid_with_token_auth.rs +++ b/src/test/valid_with_token_auth.rs @@ -5,7 +5,7 @@ use crate::tcp_relay_server::server_config::ServerConfig; use crate::test::dummy_tcp_sockets::{ dummy_tcp_client_square_root_requests, wait_for_port, DummyTCPServer, }; -use crate::test::{get_port_number, PortsAllocation, LOCALHOST}; +use crate::test::{get_port_number, PortsAllocation, LOCALHOST_IP}; const VALID_TOKEN: &str = "AvalidTOKEN"; @@ -46,8 +46,8 @@ async fn valid_with_token_auth() { // Start client relay task::spawn(crate::tcp_relay_client::run_app(ClientConfig { token: Some(VALID_TOKEN.to_string()), - relay_url: format!("http://{}:{}", LOCALHOST, port(0)), - listen_address: LOCALHOST.to_string(), + relay_url: format!("http://{}:{}", LOCALHOST_IP, port(0)), + listen_address: LOCALHOST_IP.to_string(), root_certificate: None, ..Default::default() })); diff --git a/src/test/valid_with_token_auth_and_server_tls.rs b/src/test/valid_with_token_auth_and_server_tls.rs new file mode 100644 index 0000000..4f67a53 --- /dev/null +++ b/src/test/valid_with_token_auth_and_server_tls.rs @@ -0,0 +1,62 @@ +use tokio::task; + +use crate::tcp_relay_client::client_config::ClientConfig; +use crate::tcp_relay_server::server_config::ServerConfig; +use crate::test::dummy_tcp_sockets::{ + dummy_tcp_client_square_root_requests, wait_for_port, DummyTCPServer, +}; +use crate::test::pki::Pki; +use crate::test::{get_port_number, PortsAllocation, LOCALHOST_IP}; + +const VALID_TOKEN: &str = "AvalidTOKEN"; + +fn port(index: u16) -> u16 { + get_port_number(PortsAllocation::ValidWithTokenAuthAndServerTLS, index) +} + +#[tokio::test(flavor = "multi_thread", worker_threads = 5)] +async fn test() { + let _ = env_logger::builder().is_test(true).try_init(); + + // Start internal service + let local_server = DummyTCPServer::start(port(1)).await; + tokio::spawn(async move { + local_server.loop_conn_square_operations().await; + }); + + let pki = Pki::load(); + + let local_set = task::LocalSet::new(); + local_set + .run_until(async move { + wait_for_port(port(1)).await; + + // Start server relay + task::spawn_local(crate::tcp_relay_server::run_app(ServerConfig { + tokens: vec![VALID_TOKEN.to_string()], + tokens_file: None, + ports: vec![port(1)], + upstream_server: "127.0.0.1".to_string(), + listen_address: format!("127.0.0.1:{}", port(0)), + increment_ports: 1, + tls_cert: Some(pki.localhost_crt.file_path()), + tls_key: Some(pki.localhost_key.file_path()), + tls_client_auth_root_cert: None, + tls_revocation_list: None, + })); + wait_for_port(port(0)).await; + + // Start client relay + task::spawn(crate::tcp_relay_client::run_app(ClientConfig { + token: Some(VALID_TOKEN.to_string()), + relay_url: format!("https://localhost:{}", port(0)), + listen_address: LOCALHOST_IP.to_string(), + root_certificate: Some(pki.root_ca_crt.file_path()), + ..Default::default() + })); + wait_for_port(port(2)).await; + + dummy_tcp_client_square_root_requests(port(2), 10).await; + }) + .await; +} diff --git a/src/test/valid_with_token_auth_multiple_ports.rs b/src/test/valid_with_token_auth_multiple_ports.rs index fc68f4f..e79e6be 100644 --- a/src/test/valid_with_token_auth_multiple_ports.rs +++ b/src/test/valid_with_token_auth_multiple_ports.rs @@ -6,7 +6,7 @@ use crate::test::dummy_tcp_sockets::{ dummy_tcp_client_additions_requests, dummy_tcp_client_square_root_requests, wait_for_port, DummyTCPServer, }; -use crate::test::{get_port_number, PortsAllocation, LOCALHOST}; +use crate::test::{get_port_number, PortsAllocation, LOCALHOST_IP}; const VALID_TOKEN: &str = "AvalidTOKEN"; const NUM_INC: i32 = 5; @@ -16,7 +16,7 @@ fn port(index: u16) -> u16 { } #[tokio::test(flavor = "multi_thread", worker_threads = 5)] -async fn valid_with_token_auth() { +async fn test() { let _ = env_logger::builder().is_test(true).try_init(); // Start internal services @@ -53,8 +53,8 @@ async fn valid_with_token_auth() { // Start client relay task::spawn(crate::tcp_relay_client::run_app(ClientConfig { token: Some(VALID_TOKEN.to_string()), - relay_url: format!("http://{}:{}", LOCALHOST, port(0)), - listen_address: LOCALHOST.to_string(), + relay_url: format!("http://{}:{}", LOCALHOST_IP, port(0)), + listen_address: LOCALHOST_IP.to_string(), root_certificate: None, ..Default::default() })); diff --git a/src/test/valid_with_token_file.rs b/src/test/valid_with_token_file.rs index e411afe..09bb6af 100644 --- a/src/test/valid_with_token_file.rs +++ b/src/test/valid_with_token_file.rs @@ -5,7 +5,7 @@ use crate::tcp_relay_server::server_config::ServerConfig; use crate::test::dummy_tcp_sockets::{ dummy_tcp_client_square_root_requests, wait_for_port, DummyTCPServer, }; -use crate::test::{get_port_number, PortsAllocation, LOCALHOST}; +use crate::test::{get_port_number, PortsAllocation, LOCALHOST_IP}; const VALID_TOKEN: &str = "AvalidTOKEN"; @@ -49,8 +49,8 @@ async fn valid_with_token_file() { // Start client relay task::spawn(crate::tcp_relay_client::run_app(ClientConfig { token: Some(VALID_TOKEN.to_string()), - relay_url: format!("http://{}:{}", LOCALHOST, port(0)), - listen_address: LOCALHOST.to_string(), + relay_url: format!("http://{}:{}", LOCALHOST_IP, port(0)), + listen_address: LOCALHOST_IP.to_string(), root_certificate: None, ..Default::default() })); diff --git a/src/test/with_token_auth_and_invalid_server_tls_bad_ca.rs b/src/test/with_token_auth_and_invalid_server_tls_bad_ca.rs new file mode 100644 index 0000000..8e3a3cd --- /dev/null +++ b/src/test/with_token_auth_and_invalid_server_tls_bad_ca.rs @@ -0,0 +1,54 @@ +use tokio::task; + +use crate::tcp_relay_client::client_config::ClientConfig; +use crate::tcp_relay_server::server_config::ServerConfig; +use crate::test::dummy_tcp_sockets::wait_for_port; +use crate::test::pki::Pki; +use crate::test::{get_port_number, PortsAllocation, LOCALHOST_IP}; + +const VALID_TOKEN: &str = "AvalidTOKEN"; + +fn port(index: u16) -> u16 { + get_port_number( + PortsAllocation::WithTokenAuthAndInvalidServerTLSBadCA, + index, + ) +} + +#[tokio::test(flavor = "multi_thread", worker_threads = 5)] +async fn test() { + let _ = env_logger::builder().is_test(true).try_init(); + + let pki = Pki::load(); + + let local_set = task::LocalSet::new(); + local_set + .run_until(async move { + // Start server relay + task::spawn_local(crate::tcp_relay_server::run_app(ServerConfig { + tokens: vec![VALID_TOKEN.to_string()], + tokens_file: None, + ports: vec![port(1)], + upstream_server: "127.0.0.1".to_string(), + listen_address: format!("127.0.0.1:{}", port(0)), + increment_ports: 1, + tls_cert: Some(pki.localhost_crt.file_path()), + tls_key: Some(pki.localhost_key.file_path()), + tls_client_auth_root_cert: None, + tls_revocation_list: None, + })); + wait_for_port(port(0)).await; + + // Start client relay + crate::tcp_relay_client::run_app(ClientConfig { + token: Some(VALID_TOKEN.to_string()), + relay_url: format!("https://localhost:{}", port(0)), + listen_address: LOCALHOST_IP.to_string(), + root_certificate: Some(pki.other_ca_crt.file_path()), + ..Default::default() + }) + .await + .unwrap_err(); + }) + .await; +} diff --git a/src/test/with_token_auth_and_invalid_server_tls_expired_and_bad_cn.rs b/src/test/with_token_auth_and_invalid_server_tls_expired_and_bad_cn.rs new file mode 100644 index 0000000..2ed2a91 --- /dev/null +++ b/src/test/with_token_auth_and_invalid_server_tls_expired_and_bad_cn.rs @@ -0,0 +1,54 @@ +use tokio::task; + +use crate::tcp_relay_client::client_config::ClientConfig; +use crate::tcp_relay_server::server_config::ServerConfig; +use crate::test::dummy_tcp_sockets::wait_for_port; +use crate::test::pki::Pki; +use crate::test::{get_port_number, PortsAllocation, LOCALHOST_IP}; + +const VALID_TOKEN: &str = "AvalidTOKEN"; + +fn port(index: u16) -> u16 { + get_port_number( + PortsAllocation::WithTokenAuthAndInvalidServerTLSExpiredAndBadCN, + index, + ) +} + +#[tokio::test(flavor = "multi_thread", worker_threads = 5)] +async fn test() { + let _ = env_logger::builder().is_test(true).try_init(); + + let pki = Pki::load(); + + let local_set = task::LocalSet::new(); + local_set + .run_until(async move { + // Start server relay + task::spawn_local(crate::tcp_relay_server::run_app(ServerConfig { + tokens: vec![VALID_TOKEN.to_string()], + tokens_file: None, + ports: vec![port(1)], + upstream_server: "127.0.0.1".to_string(), + listen_address: format!("127.0.0.1:{}", port(0)), + increment_ports: 1, + tls_cert: Some(pki.expired_client_crt.file_path()), + tls_key: Some(pki.expired_client_key.file_path()), + tls_client_auth_root_cert: None, + tls_revocation_list: None, + })); + wait_for_port(port(0)).await; + + // Start client relay + crate::tcp_relay_client::run_app(ClientConfig { + token: Some(VALID_TOKEN.to_string()), + relay_url: format!("https://localhost:{}", port(0)), + listen_address: LOCALHOST_IP.to_string(), + root_certificate: Some(pki.root_ca_crt.file_path()), + ..Default::default() + }) + .await + .unwrap_err(); + }) + .await; +}