From 9b04178496f062a7b112c43e38273cbb3bf2bb85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edu=20G=C3=B3mez=20Escandell?= Date: Tue, 10 Oct 2023 12:22:39 +0200 Subject: [PATCH] Update fixtures and golden files --- .../certificates/bad-certificate.pem | 1 + .../TestConnect/certificates/cert.pem | 32 ++++++++++++ .../certificates/generate-certificate.sh | 2 + .../testdata/TestConnect/certificates/key.pem | 52 +++++++++++++++++++ .../landscape.conf | 6 +++ .../landscape.conf | 2 + .../landscape.conf | 2 + .../landscape.conf | 2 + .../landscape.conf | 3 ++ 9 files changed, 102 insertions(+) create mode 100644 windows-agent/internal/proservices/landscape/testdata/TestConnect/certificates/bad-certificate.pem create mode 100644 windows-agent/internal/proservices/landscape/testdata/TestConnect/certificates/cert.pem create mode 100644 windows-agent/internal/proservices/landscape/testdata/TestConnect/certificates/key.pem create mode 100644 windows-agent/internal/proservices/landscape/testdata/TestConnect/error_when_the_config_cannot_be_parsed/landscape.conf create mode 100644 windows-agent/internal/proservices/landscape/testdata/TestConnect/error_when_the_ssl_certificate_cannot_be_read/landscape.conf create mode 100644 windows-agent/internal/proservices/landscape/testdata/TestConnect/error_when_the_ssl_certificate_is_not_valid/landscape.conf create mode 100644 windows-agent/internal/proservices/landscape/testdata/TestConnect/success_with_an_ssl_certificate/landscape.conf create mode 100644 windows-agent/internal/proservices/landscape/testdata/TestConnect/success_with_non-empty_config/landscape.conf diff --git a/windows-agent/internal/proservices/landscape/testdata/TestConnect/certificates/bad-certificate.pem b/windows-agent/internal/proservices/landscape/testdata/TestConnect/certificates/bad-certificate.pem new file mode 100644 index 000000000..13f344e2e --- /dev/null +++ b/windows-agent/internal/proservices/landscape/testdata/TestConnect/certificates/bad-certificate.pem @@ -0,0 +1 @@ +This is not a valid certificate diff --git a/windows-agent/internal/proservices/landscape/testdata/TestConnect/certificates/cert.pem b/windows-agent/internal/proservices/landscape/testdata/TestConnect/certificates/cert.pem new file mode 100644 index 000000000..7214408e8 --- /dev/null +++ b/windows-agent/internal/proservices/landscape/testdata/TestConnect/certificates/cert.pem @@ -0,0 +1,32 @@ +-----BEGIN CERTIFICATE----- +MIIFdDCCA1ygAwIBAgIUQ2XcjKTRgC0xuZMtwMAa0OvDxRswDQYJKoZIhvcNAQEL +BQAwQTELMAkGA1UEBhMCVVMxEjAQBgNVBAoMCUNhbm9uaWNhbDEeMBwGA1UEAwwV +Q2Fub25pY2FsR3JvdXBMaW1pdGVkMB4XDTIzMTAxMDEwMDcyM1oXDTIzMTEwOTEw +MDcyM1owQTELMAkGA1UEBhMCVVMxEjAQBgNVBAoMCUNhbm9uaWNhbDEeMBwGA1UE +AwwVQ2Fub25pY2FsR3JvdXBMaW1pdGVkMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A +MIICCgKCAgEAzfI1KuyZgkgrIc48UMN5cHNEchOQlWrP9eo9+s2wTb56U7zyIdlq +4azsDXVpdL9ObhI1aLOoIMogRF1ZPgXvCH1JlGTnfjAGtChLUF2+rraUf6HGGESG +A09qFWB+JfeBrYNzRAL3rGFlttuNpW59WQIKAZ9hgKZTmBInjTNFrxMvjrAF9cYX +ebQqN6u29/+c8gH6Rf0mpPYSMahvdRT5IKZvLyaQNwQaT1UxsxSTsxAqsrXQ/o+G +UQcJpUnG3rc49B6jIDdTpiptF5Ey/f9maOjY/txQEKqLO5N04PuW7mDq17i625yJ +HAGI7ukNHQcMhcG475EUJuMLWNooozL0zBp/WAZs1cOSg0MH0TY6Oj2xET8HXoUW +T2gM/XkmWpeX9WmQBfkegbVALuKzDNnUWUYpIfCpvBL8u+9Rew+Dq7vIwmbPUAAf +0KssF+9KSRpDkmqDKZiGwbA6sAKXkLk47JDneeQ9SvANCox4fE0+qh+O2yJGygcO +T8CI0+fVZXdbS6Db5yzn8ZwbNpDw2lBahwpq1aCIwBmJ3P1ksEQXnTsyv3UKQz/F +x/zgSSqZWqgSwqKERYHxjSjSjjAORSNN+XTcKzK9Q9eA2exzw7mI1cR5mztPIRz2 +r2DVTFwLAE/ykR2t31wse5wCLiXno9I0Zm/M2Be9xw0+A4VTbFz1nwkCAwEAAaNk +MGIwHQYDVR0OBBYEFAUAonELhcOl0sZfHnTLTZNkKzmaMB8GA1UdIwQYMBaAFAUA +onELhcOl0sZfHnTLTZNkKzmaMA8GA1UdEwEB/wQFMAMBAf8wDwYDVR0RBAgwBocE +fwAAATANBgkqhkiG9w0BAQsFAAOCAgEAbmUCtPUY9KoEucjLcf3bMmk4asWKTJIr +5kkJL/s7E1WaMudNHovunk4Zx3X62FzJHR6Z04zJjdWxhmdDbE+bO2LrkwsXJNxX +NBbdP7qkSgRUvgigSTu2kc7nAQgDS7dIxyCZyQTC1opaj8t0uuxzqHpG82zzrmQ1 +8Guz1sWpBeBKgwyBM+okFvo4OcZV905hR1+sHzE1aLhoOnpX3uNwFgGh8z8jXc7p +e5FrgoEzaHYZfriioU+Lqf+92nAmtdFtNTP/g2OWunuOhEvYUI+EfPpjqSB19hvi +vD5qnV/euuWbP9mnoGVXmRcg5ZWVqgm6Yh+syRXYDEf8zwkpjod5DOKHVA0oK4hy +1zp5ufVwVETB/rdfUUS8cPXx8HqqtZienHauH/BO5OZTwSNmLrie7l/v1WUgvXBP +5k8p8wxtvXf0JNdTtNFPL82Q5W0f/4GE6PGAet4TxjNVLs9DolnTdBN7isntm9iI +d6BuuQLzNcd9J2p+7qm0Uu8gh7TeNbnBgaJnJiwCtogYMsOGFiimrF3ce3vJz/Qq +tN/od94ffjun+hWgCGQUIPZNFNNOAx7oUQmjQi0ubm/XiCEvNJHBNkvSImTidrrn +sHTu/FLkntCWzHTA8MfA3eZmqsNNUojQvVcSxs01Bwy/UKgYhcpuijRve5HsloSz +IT0QVhzpIdM= +-----END CERTIFICATE----- diff --git a/windows-agent/internal/proservices/landscape/testdata/TestConnect/certificates/generate-certificate.sh b/windows-agent/internal/proservices/landscape/testdata/TestConnect/certificates/generate-certificate.sh index ecf27cce6..4c30a2ce8 100644 --- a/windows-agent/internal/proservices/landscape/testdata/TestConnect/certificates/generate-certificate.sh +++ b/windows-agent/internal/proservices/landscape/testdata/TestConnect/certificates/generate-certificate.sh @@ -9,3 +9,5 @@ openssl req \ -nodes \ -addext 'subjectAltName = IP:127.0.0.1' \ -subj "/C=US/O=Canonical/CN=CanonicalGroupLimited" + +echo This is not a valid certificate > bad-certificate.pem \ No newline at end of file diff --git a/windows-agent/internal/proservices/landscape/testdata/TestConnect/certificates/key.pem b/windows-agent/internal/proservices/landscape/testdata/TestConnect/certificates/key.pem new file mode 100644 index 000000000..542bfb686 --- /dev/null +++ b/windows-agent/internal/proservices/landscape/testdata/TestConnect/certificates/key.pem @@ -0,0 +1,52 @@ +-----BEGIN PRIVATE KEY----- +MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQDN8jUq7JmCSCsh +zjxQw3lwc0RyE5CVas/16j36zbBNvnpTvPIh2WrhrOwNdWl0v05uEjVos6ggyiBE +XVk+Be8IfUmUZOd+MAa0KEtQXb6utpR/ocYYRIYDT2oVYH4l94Gtg3NEAvesYWW2 +242lbn1ZAgoBn2GAplOYEieNM0WvEy+OsAX1xhd5tCo3q7b3/5zyAfpF/Sak9hIx +qG91FPkgpm8vJpA3BBpPVTGzFJOzECqytdD+j4ZRBwmlScbetzj0HqMgN1OmKm0X +kTL9/2Zo6Nj+3FAQqos7k3Tg+5buYOrXuLrbnIkcAYju6Q0dBwyFwbjvkRQm4wtY +2iijMvTMGn9YBmzVw5KDQwfRNjo6PbERPwdehRZPaAz9eSZal5f1aZAF+R6BtUAu +4rMM2dRZRikh8Km8Evy771F7D4Oru8jCZs9QAB/QqywX70pJGkOSaoMpmIbBsDqw +ApeQuTjskOd55D1K8A0KjHh8TT6qH47bIkbKBw5PwIjT59Vld1tLoNvnLOfxnBs2 +kPDaUFqHCmrVoIjAGYnc/WSwRBedOzK/dQpDP8XH/OBJKplaqBLCooRFgfGNKNKO +MA5FI035dNwrMr1D14DZ7HPDuYjVxHmbO08hHPavYNVMXAs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O8i7Wqrde4w8EFrI +0wKCAQEA4+MpvYBaECc+OtVQNN9AuPtFNj/REkdhJAj4aunqnPSyMaS77//v6BBa +OGoUrF6DObNI5H3S8YXNEqNgX2ybq7VWVk4DJMylzDlreejeK0WqORJ/ra7ieG8n +5uRW2Xlu1YjBdlNoWkoxRT26zUMvcu1wS/P/ge26C9VlMWFq7T2jMwWZnG4kLFG5 +KU8AzRBzQObAHdPeKid6jHnH363W7UA4DO7I8E5hwoCcphKW3La+/MYrHUCDcBB4 +edQhWOM01Y13u9PJO2x7AuLxW5h3NHlBZB1XFeBzaa9sRO0kzQmqXhSND7TXctkg +V4lfPNzmMvwoXBp3kxjmSCzEy6TPDQ== +-----END PRIVATE KEY----- diff --git a/windows-agent/internal/proservices/landscape/testdata/TestConnect/error_when_the_config_cannot_be_parsed/landscape.conf b/windows-agent/internal/proservices/landscape/testdata/TestConnect/error_when_the_config_cannot_be_parsed/landscape.conf new file mode 100644 index 000000000..699784501 --- /dev/null +++ b/windows-agent/internal/proservices/landscape/testdata/TestConnect/error_when_the_config_cannot_be_parsed/landscape.conf @@ -0,0 +1,6 @@ +{ + "client": { + "tags": "wsl", + }, + "problem": "This should be an ini file" +} \ No newline at end of file diff --git a/windows-agent/internal/proservices/landscape/testdata/TestConnect/error_when_the_ssl_certificate_cannot_be_read/landscape.conf b/windows-agent/internal/proservices/landscape/testdata/TestConnect/error_when_the_ssl_certificate_cannot_be_read/landscape.conf new file mode 100644 index 000000000..e3d102467 --- /dev/null +++ b/windows-agent/internal/proservices/landscape/testdata/TestConnect/error_when_the_ssl_certificate_cannot_be_read/landscape.conf @@ -0,0 +1,2 @@ +[client] +ssl_public_key = testdata/TestConnect/this_path_does_not_exist/certificate.pem \ No newline at end of file diff --git a/windows-agent/internal/proservices/landscape/testdata/TestConnect/error_when_the_ssl_certificate_is_not_valid/landscape.conf b/windows-agent/internal/proservices/landscape/testdata/TestConnect/error_when_the_ssl_certificate_is_not_valid/landscape.conf new file mode 100644 index 000000000..fa967798f --- /dev/null +++ b/windows-agent/internal/proservices/landscape/testdata/TestConnect/error_when_the_ssl_certificate_is_not_valid/landscape.conf @@ -0,0 +1,2 @@ +[client] +ssl_public_key = testdata/TestConnect/certificates/bad-certificate.pem \ No newline at end of file diff --git a/windows-agent/internal/proservices/landscape/testdata/TestConnect/success_with_an_ssl_certificate/landscape.conf b/windows-agent/internal/proservices/landscape/testdata/TestConnect/success_with_an_ssl_certificate/landscape.conf new file mode 100644 index 000000000..9e0521ef5 --- /dev/null +++ b/windows-agent/internal/proservices/landscape/testdata/TestConnect/success_with_an_ssl_certificate/landscape.conf @@ -0,0 +1,2 @@ +[client] +ssl_public_key = testdata/TestConnect/certificates/cert.pem \ No newline at end of file diff --git a/windows-agent/internal/proservices/landscape/testdata/TestConnect/success_with_non-empty_config/landscape.conf b/windows-agent/internal/proservices/landscape/testdata/TestConnect/success_with_non-empty_config/landscape.conf new file mode 100644 index 000000000..a8a807a95 --- /dev/null +++ b/windows-agent/internal/proservices/landscape/testdata/TestConnect/success_with_non-empty_config/landscape.conf @@ -0,0 +1,3 @@ +[client] +hello=world +tags=wsl \ No newline at end of file