From c8df2a6ab517d96645ba58791dad985447aca897 Mon Sep 17 00:00:00 2001 From: Benjamin Dweck Date: Thu, 15 Oct 2020 16:08:38 +0200 Subject: [PATCH] Created integration test that can run local test broker and publish a message --- requirements.txt | 1 + torch_sub/__init__.py | 0 torch_sub/test/__init__.py | 0 torch_sub/test/agent-config/ca.crt | 23 +++++++ torch_sub/test/agent-config/torch.conf | 16 +++++ torch_sub/test/agent-config/vagrant.crt | 21 +++++++ torch_sub/test/agent-config/vagrant.key | 27 ++++++++ torch_sub/test/broker-config/ca.crt | 23 +++++++ torch_sub/test/broker-config/mosquitto.conf | 9 +++ .../test/broker-config/mqtt.example.com.crt | 22 +++++++ .../test/broker-config/mqtt.example.com.key | 27 ++++++++ torch_sub/test/hosts_test | 1 + torch_sub/test/integration_pub_sub.py | 61 +++++++++++++++++++ torch_sub/test/pki/ca.crt | 23 +++++++ torch_sub/test/pki/ca.key | 27 ++++++++ torch_sub/test/pki/ca.srl | 1 + torch_sub/test/pki/mqtt.example.com.crt | 22 +++++++ torch_sub/test/pki/mqtt.example.com.key | 27 ++++++++ torch_sub/test/pki/subscriber.crt | 21 +++++++ torch_sub/test/pki/subscriber.key | 27 ++++++++ torch_sub/test/pki/vagrant.crt | 21 +++++++ torch_sub/test/pki/vagrant.key | 27 ++++++++ torch_sub/test/run-broker.bat | 1 + torch_sub/test/run-broker.sh | 3 + torch_sub/test/subscriber-config/ca.crt | 23 +++++++ .../test/subscriber-config/subscriber.crt | 21 +++++++ .../test/subscriber-config/subscriber.key | 27 ++++++++ torch_sub/torch_sub.py | 2 + 28 files changed, 504 insertions(+) create mode 100644 requirements.txt create mode 100644 torch_sub/__init__.py create mode 100644 torch_sub/test/__init__.py create mode 100644 torch_sub/test/agent-config/ca.crt create mode 100644 torch_sub/test/agent-config/torch.conf create mode 100644 torch_sub/test/agent-config/vagrant.crt create mode 100644 torch_sub/test/agent-config/vagrant.key create mode 100644 torch_sub/test/broker-config/ca.crt create mode 100644 torch_sub/test/broker-config/mosquitto.conf create mode 100644 torch_sub/test/broker-config/mqtt.example.com.crt create mode 100644 torch_sub/test/broker-config/mqtt.example.com.key create mode 100644 torch_sub/test/hosts_test create mode 100644 torch_sub/test/integration_pub_sub.py create mode 100644 torch_sub/test/pki/ca.crt create mode 100644 torch_sub/test/pki/ca.key create mode 100644 torch_sub/test/pki/ca.srl create mode 100644 torch_sub/test/pki/mqtt.example.com.crt create mode 100644 torch_sub/test/pki/mqtt.example.com.key create mode 100644 torch_sub/test/pki/subscriber.crt create mode 100644 torch_sub/test/pki/subscriber.key create mode 100644 torch_sub/test/pki/vagrant.crt create mode 100644 torch_sub/test/pki/vagrant.key create mode 100644 torch_sub/test/run-broker.bat create mode 100644 torch_sub/test/run-broker.sh create mode 100644 torch_sub/test/subscriber-config/ca.crt create mode 100644 torch_sub/test/subscriber-config/subscriber.crt create mode 100644 torch_sub/test/subscriber-config/subscriber.key create mode 100644 torch_sub/torch_sub.py diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..748c26e --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +paho-mqtt~=1.5.1 \ No newline at end of file diff --git a/torch_sub/__init__.py b/torch_sub/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/torch_sub/test/__init__.py b/torch_sub/test/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/torch_sub/test/agent-config/ca.crt b/torch_sub/test/agent-config/ca.crt new file mode 100644 index 0000000..8e79f74 --- /dev/null +++ b/torch_sub/test/agent-config/ca.crt @@ -0,0 +1,23 @@ +-----BEGIN CERTIFICATE----- +MIID6zCCAtOgAwIBAgIUQJye5MbZVMpOpu87TmmlN/KOBj0wDQYJKoZIhvcNAQEL +BQAwgYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJOWTERMA8GA1UEBwwITmV3IFlv +cmsxFTATBgNVBAoMDEV4YW1wbGUgSW5jLjEcMBoGA1UEAwwTY2EubXF0dC5leGFt +cGxlLmNvbTEgMB4GCSqGSIb3DQ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N4+zWiLRCDXO +6wapOhkmTOXuZY/NcMMwTmdJKTEQBD6XIQamv91Ne2bT89LHpcp1LjbaCz+UAxg= +-----END CERTIFICATE----- diff --git a/torch_sub/test/agent-config/torch.conf b/torch_sub/test/agent-config/torch.conf new file mode 100644 index 0000000..c6d8051 --- /dev/null +++ b/torch_sub/test/agent-config/torch.conf @@ -0,0 +1,16 @@ +[tor] +ControllerPort = 9051 + +[ssh] +Port = 22 + +[mqtt] +BrokerHost = mqtt.example.com +BrokerPort = 8883 +ClientID = vagrant +Topic = it/torch/vagrant/ssh_onion +RequireCertificate = true +CaFile = ca.crt +CertFile = vagrant.crt +KeyFile = vagrant.key + diff --git a/torch_sub/test/agent-config/vagrant.crt b/torch_sub/test/agent-config/vagrant.crt new file mode 100644 index 0000000..b58e5d3 --- /dev/null +++ b/torch_sub/test/agent-config/vagrant.crt @@ -0,0 +1,21 @@ +-----BEGIN CERTIFICATE----- +MIIDhDCCAmwCFFfe134gzLKm3ieNbeoxCvOhwsGxMA0GCSqGSIb3DQEBCwUAMIGE +MQswCQYDVQQGEwJVUzELMAkGA1UECAwCTlkxETAPBgNVBAcMCE5ldyBZb3JrMRUw +EwYDVQQKDAxFeGFtcGxlIEluYy4xHDAaBgNVBAMME2NhLm1xdHQuZXhhbXBsZS5j +b20xIDAeBgkqhkiG9w0BCQEWEWFkbWluQGV4YW1wbGUuY29tMB4XDTIwMTAwNjEx +MDQxMVoXDTMwMTAwNDExMDQxMVoweDELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAk5Z +MREwDwYDVQQHDAhOZXcgWW9yazEVMBMGA1UECgwMRXhhbXBsZSBJbmMuMRAwDgYD +VQQDDAd2YWdyYW50MSAwHgYJKoZIhvcNAQkBFhFhZG1pbkBleGFtcGxlLmNvbTCC +ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALBR3WYBUoSM9taDBWn8MSU3 +WW7z9EmutaWRKlNCf8rAVXrEGf3shtBb6MWdRjAKHcBDZaTtmW6o0XoXkKdGeWcm +6X0o4TwaROPE7HR8OtKsmPTxQ09gKfkwB+sb8+fIPrKq6VLWiSJqvc6RbZvoKXIa +WU/BV4q3HG9MvFB2AMNx9pmzLeeP/m323pAEU28oR/kGvuDJHSLO3cNd1U5ZKFFt +J1hHYugKM3uHlyQ44ozu6l2AexGgIYjA5/y1D/RuWaybdpppLS3RerhKDrvTkwWD +UALgTdxHnIT90NFCtGsZTzwmbqs/ibq1NtkHGiS0tGhJjftIiPJZfuNArVsoYF0C +AwEAATANBgkqhkiG9w0BAQsFAAOCAQEAeOEgOA8dJZGo/bT+2vnKm7VnJYrNgAax +B/X2kG3vLiayFgPYarQq8AjlqQCr8Dm1EqbUtnAhzSbQTX+v3oQBd7sRdlwfTYKa +bFEjhMeXhBgp/bWobq9FcwAL02wsAZh/gcbHAVrIwWmb42sbHTmrWY2jgJbX65jg +ameIn9p1j2CSJnC4Ju3B+btaCmksHI6uhuJVef/+pL53hs1z5MfehNvJaBkUzsya +nYAiCvrEQIzKlxROdBApZeQs0WFv0ktu6itzA3YsCMct1p3TNGwDUZ+cQqkTPhkB +KNT0VcmDNdavD59WsEfrgZe5/DXY+Q1yHzGmaq70y0U6SgTfOsslmQ== +-----END CERTIFICATE----- diff --git a/torch_sub/test/agent-config/vagrant.key b/torch_sub/test/agent-config/vagrant.key new file mode 100644 index 0000000..9e71686 --- /dev/null +++ b/torch_sub/test/agent-config/vagrant.key @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEpAIBAAKCAQEAsFHdZgFShIz21oMFafwxJTdZbvP0Sa61pZEqU0J/ysBVesQZ +/eyG0FvoxZ1GMAodwENlpO2ZbqjReheQp0Z5ZybpfSjhPBpE48TsdHw60qyY9PFD +T2Ap+TAH6xvz58g+sqrpUtaJImq9zpFtm+gpchpZT8FXirccb0y8UHYAw3H2mbMt +54/+bfbekARTbyhH+Qa+4MkdIs7dw13VTlkoUW0nWEdi6Aoze4eXJDjijO7qXYB7 +EaA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nl+l3i2C/Dg7QUZbt0A5f0JdXTGa9IStx8n6 +KTd7arDRMB67jr+86/YJJwMkfAuGl5zd4jDRC6Qrbzzkjq2mHLOuDpuOUPufSl/9 +O6Im5GkCgYA4zFE3ztSV6nq5EH3A7VmAsLiyRXBJfOlLXIBApv46/t4ivS4C3Esu +8LR+Vvx2XLWkpkrm9kR1wIutNx6x1pRkSGDKyRXn5+cU4A2Lw9y2BbwDhj+WiHkM +zCuL+8l2px2f3K1YPE3oGWHZZJScDwa03yjVzrSPDr766XBtH7W4vg== +-----END RSA PRIVATE KEY----- diff --git a/torch_sub/test/broker-config/ca.crt b/torch_sub/test/broker-config/ca.crt new file mode 100644 index 0000000..8e79f74 --- /dev/null +++ b/torch_sub/test/broker-config/ca.crt @@ -0,0 +1,23 @@ +-----BEGIN CERTIFICATE----- +MIID6zCCAtOgAwIBAgIUQJye5MbZVMpOpu87TmmlN/KOBj0wDQYJKoZIhvcNAQEL +BQAwgYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJOWTERMA8GA1UEBwwITmV3IFlv +cmsxFTATBgNVBAoMDEV4YW1wbGUgSW5jLjEcMBoGA1UEAwwTY2EubXF0dC5leGFt +cGxlLmNvbTEgMB4GCSqGSIb3DQEJARYRYWRtaW5AZXhhbXBsZS5jb20wHhcNMjAx +MDA2MTA1OTE4WhcNMzAxMDA0MTA1OTE4WjCBhDELMAkGA1UEBhMCVVMxCzAJBgNV +BAgMAk5ZMREwDwYDVQQHDAhOZXcgWW9yazEVMBMGA1UECgwMRXhhbXBsZSBJbmMu +MRwwGgYDVQQDDBNjYS5tcXR0LmV4YW1wbGUuY29tMSAwHgYJKoZIhvcNAQkBFhFh +ZG1pbkBleGFtcGxlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB +ALVndltaj3SX1zuJB0F5woIMUZCHopkgiO027/qE10IgM6SN4lFhR7wR0B/9PXrf +zn1xTC63w9xd3GbnlJvcWhWbh/m1t2Qx2mIvOmoELY8wlY6/V6NzjSgju7mZi0u6 +aitU+LXINNuGS+JhVpc54QQ8M9o0jKlnNGnEmPjv6uhbNXx3f8lw3eqSr1ZqmpGd +UQVYKsNYBVzSqsnh/sn/KnGYn/nmpsKRWeLhoslJ3zDjaM/Y4NYol11nWFIPYCk5 +7rzzxES/WdWLLnZ2W59YCT54YOGFqXE7oYgReD+Og2YwnGVQQpDcvb2HyIZL/2pa +oC6avMo/eC8HbSxwUKCnj1cCAwEAAaNTMFEwHQYDVR0OBBYEFEC8a9l0rpIdUqCS +i4NJwXlqUoLeMB8GA1UdIwQYMBaAFEC8a9l0rpIdUqCSi4NJwXlqUoLeMA8GA1Ud +EwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAGzxJWZdVozskr5yie2uetpL +aAReCaHEdWudRN3wVW1Dpm2sE23x4VFiJ+Uow9k21GgtGUsAIFqRgb3/QO+ipODC +GRwZmVopkuOaHfCz+tO8xqjvGHCidhhhNFdR9uVkWHoPKsQsvap0SSk12KMtFBRo +3rmeQwPP4qEPFEwc2U0hCUMsIUvMSt3KrA/j+aMRzOXU7QIMFbcYEF1IaGJz1RMh +h1VCXaUlL2liVTWU4XgudB8rMOuETec7un9hzoBVOWHxXdRrGPaoN4+zWiLRCDXO +6wapOhkmTOXuZY/NcMMwTmdJKTEQBD6XIQamv91Ne2bT89LHpcp1LjbaCz+UAxg= +-----END CERTIFICATE----- diff --git a/torch_sub/test/broker-config/mosquitto.conf b/torch_sub/test/broker-config/mosquitto.conf new file mode 100644 index 0000000..212ee44 --- /dev/null +++ b/torch_sub/test/broker-config/mosquitto.conf @@ -0,0 +1,9 @@ +listener 8883 +connection_messages true +log_type all +websockets_log_level 9 +cafile /mosquitto/config/ca.crt +keyfile /mosquitto/config/mqtt.example.com.key +certfile /mosquitto/config/mqtt.example.com.crt +require_certificate true +use_identity_as_username true diff --git a/torch_sub/test/broker-config/mqtt.example.com.crt b/torch_sub/test/broker-config/mqtt.example.com.crt new file mode 100644 index 0000000..2156446 --- /dev/null +++ b/torch_sub/test/broker-config/mqtt.example.com.crt @@ -0,0 +1,22 @@ +-----BEGIN CERTIFICATE----- +MIIDjjCCAnYCFFfe134gzLKm3ieNbeoxCvOhwsGwMA0GCSqGSIb3DQEBCwUAMIGE +MQswCQYDVQQGEwJVUzELMAkGA1UECAwCTlkxETAPBgNVBAcMCE5ldyBZb3JrMRUw +EwYDVQQKDAxFeGFtcGxlIEluYy4xHDAaBgNVBAMME2NhLm1xdHQuZXhhbXBsZS5j +b20xIDAeBgkqhkiG9w0BCQEWEWFkbWluQGV4YW1wbGUuY29tMB4XDTIwMTAwNjEx +MDE1M1oXDTMwMTAwNDExMDE1M1owgYExCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJO +WTERMA8GA1UEBwwITmV3IFlvcmsxFTATBgNVBAoMDEV4YW1wbGUgSW5jLjEZMBcG +A1UEAwwQbXF0dC5leGFtcGxlLmNvbTEgMB4GCSqGSIb3DQEJARYRYWRtaW5AZXhh +bXBsZS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC8/EqoeDGr +42rM2rkEhV8Qrv8aihCKurDcE+e8OXM5GTSP+1NomatGXLWAfF6PY5N8sA3NxlRG +gnPhpX9O+NrCMrSHZIfBoU+6GwcPBrn1zD9Le1kRDYZhOQ4Ofj5atxUwePqZo2rx +F+BK7D1+GEi1nFiVRmPOVNGI3J96i0KlC4EsVG9aNPwDRpnRB/rP/dersgpu4oFV +xUKx2n09vEEKVBwaT6oYilwoM8mw5Q0YBKIolQGIErYj9oFqimXH1e9Wit+551tr +T8+ipDhJW8a/CdlbV/8HFLg62542X5sXusTePhPUgU6StRxENf/2Q2ppVQAWgnQo +EkWKrVNNJNdbAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAAOowXrxWHpjtrfdkpwG +gG4HJD79gkIHYjnXYKaH/RrmlEwdDnjG6OQHsXc9eKAJ1WHaJBUz1fwNCFz3E0Ry +cUTATZIBBXlqxZhbZXdBjQslEIvgjlkEcO29iJ5N3aTH92iuGrXgYYZl+c1d0RGo +1bXkj7G5AFRGBFGY7PPIjtMmTYE7DB4bZ7HcxYbmXC7IqLXQoUN2A2ITuAdUcK2T +5pMZzkQGpUiHFIR3NUiDf2jYx7YTTt16I73TVlXHtb0qzo5oNLZKeogrKWlpb6uy +71wRdbgTtRpbdMDu+D65G5aZYVN36a223K7xiR5b75V6PeFgPQXhkLSJjCBBapct +mEo= +-----END CERTIFICATE----- diff --git a/torch_sub/test/broker-config/mqtt.example.com.key b/torch_sub/test/broker-config/mqtt.example.com.key new file mode 100644 index 0000000..40228dc --- /dev/null +++ b/torch_sub/test/broker-config/mqtt.example.com.key @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEpAIBAAKCAQEAvPxKqHgxq+NqzNq5BIVfEK7/GooQirqw3BPnvDlzORk0j/tT +aJmrRly1gHxej2OTfLANzcZURoJz4aV/TvjawjK0h2SHwaFPuhsHDwa59cw/S3tZ +EQ2GYTkODn4+WrcVMHj6maNq8RfgSuw9fhhItZxYlUZjzlTRiNyfeotCpQuBLFRv +WjT8A0aZ0Qf6z/3Xq7IKbuKBVcVCsdp9PbxBClQcGk+qGIpcKDPJsOUNGASiKJUB +iBK2I/aBaoplx9XvVorfuedba0/PoqQ4SVvGvwnZW1f/BxS4OtueNl+bF7rE3j4T +1IFOkrUcRDX/9kNqaVUAFoJ0KBJFiq1TTSTXWwIDAQABAoIBAGm/wwcCOsk0OE7p +FR6ygr+TLKxtFVSLouuDN+jbPN52fDMVL1cYpf55YhbDgSY7Ugwzd4XttLq/xJg/ +Qz2tgruoI9yfJFf1K+e3t/twiB5CbCiQnQYty0Qb6QGzIrEgQXseNxxBlVXTRm6m +QsKMVCNLmUXuXWrXi2hKC/NGecRf9WcYQeh3FjpWRPqXxK+vw2gD+ls8vG90BcTa +/bByZZCnbMEEwL6TSoJa7nVm61lOtSltmODJYzpnsbvGBy2DaF0lhiId7Gl5G/8K +QqeDp7m9QfrhgE6iRWzJJs4yer2D3y9n4b47o2YGC6L9sl+/sbCgPsV1fl/jMqK6 +sCEo5AECgYEA4ha5aF1yBo8HhUjA4LtUyRMSnaTNlvzEBR0JVB3goMu1o2O3JrPG +/z3sdG9SVzsytzaUXEi93KZ7V14aJk8NziVPWVkUEelbqRMLzlyE+30Xky0uDrow +4mb4SFCMjKLeJg20XK00SFKMd5Go03VeDQkClW5M5B4dimXVkIO4eukCgYEA1fzw +EwuNzViuxx+IVeViHEe0oUpeBUrREIHS7hIefO2pqK6nsPDo1A1P7X287NBaFP8p +u3xMx5fDrguaOU3RW/BajXklZEMkz37MOjhMop6d3T5yWWcCE2CE7hVz1O9Jbqbw +Wmfgq8SPgDj26NXhONm38xschEYJJzihkeTyzaMCgYEAw0rhyNa/Ag9WbbkUcose +h7mj4OxUclHQeKJGRpSwTfTo50PhFts/z4aL01+9foAyJLROnxBugESGUkeEywaK +ZEEyM3mQrpAmjvtWvWCJtjqtvIHQQQRv6YEMglqhrXGZ9sDrxQoQGVDE6Ru2+0Fs +hlH8G1v1qy6gUcX5HiXJmtECgYAz9VOxvCd1Seg+T0jCWo0lAsA4PZ9wt4bl9C/s +QJgIi4ibfbUYAJb4DjdvGg3Kjpig6ogOjxLxj8citox/B4cjRMwn99d9bdQ9UbNz +G4J4Jf184BHR5XIalGASk0Dp3iQ9aumHehuSeYrCfpJtXKlwLWU98UJOV9cXH+gT +Tb0q8wKBgQCh61d7FfhtUbKQbd8lQMrxXUDDd8tP9NkmZJ0y1Qg10s5Pl80wZo6H +3PS0ivyxDWBygcxrHOFV26kfMiBrPNtA3HY5ZWFAq1JZ7Yajseg83KSbli6V/+dE +BekdMwQk9MrLELEc1IgqgZU46yrRcKB+6Zh5MJM3bH3qzWpVCXIKCw== +-----END RSA PRIVATE KEY----- diff --git a/torch_sub/test/hosts_test b/torch_sub/test/hosts_test new file mode 100644 index 0000000..9a95b8e --- /dev/null +++ b/torch_sub/test/hosts_test @@ -0,0 +1 @@ +127.0.0.1 mqtt.example.com diff --git a/torch_sub/test/integration_pub_sub.py b/torch_sub/test/integration_pub_sub.py new file mode 100644 index 0000000..a78b48e --- /dev/null +++ b/torch_sub/test/integration_pub_sub.py @@ -0,0 +1,61 @@ +import json +import ssl +import unittest +from datetime import datetime + +import paho.mqtt.client as mqtt + +from torch_sub import torch_sub + +host = "mqtt.example.com" +port = 8883 +configPath = "agent-config/" +mqttCaFile = configPath + "ca.crt" +mqttCertFile = configPath + "vagrant.crt" +mqttKeyFile = configPath + "vagrant.key" + + +def agent_connect(): + client = mqtt.Client() + client.tls_set( + ca_certs=mqttCaFile, + certfile=mqttCertFile, + keyfile=mqttKeyFile, + cert_reqs=ssl.CERT_REQUIRED) + client.connect(host, port, 60) + return client + + +def agent_publish(client_id, onion_hostname): + payload = { + 'clientId': client_id, + 'timestamp': datetime.now().strftime("%d-%b-%Y (%H:%M:%S.%f)"), + 'onionAddress': onion_hostname, + 'sshPort': 22 + } + + client = agent_connect() + + topic = "torch/" + client_id + "/wake" + + client.publish(topic, json.dumps(payload)) + print("Log: Connected to MQTT Broker at %s://%s:%s/%s" % ("mqtts", host, port, topic)) + print("Log: Published payload: " + json.dumps(payload)) + + client.disconnect() + print("Log: Disconnected from MQTT Broker") + + pass + + +class MyTestCase(unittest.TestCase): + def test_something(self): + torch_sub.attach(host, port) + + agent_publish("client1", "crazyonion.onion") + + self.assertEqual(True, False) + + +if __name__ == '__main__': + unittest.main() diff --git a/torch_sub/test/pki/ca.crt b/torch_sub/test/pki/ca.crt new file mode 100644 index 0000000..8e79f74 --- /dev/null +++ b/torch_sub/test/pki/ca.crt @@ -0,0 +1,23 @@ +-----BEGIN CERTIFICATE----- +MIID6zCCAtOgAwIBAgIUQJye5MbZVMpOpu87TmmlN/KOBj0wDQYJKoZIhvcNAQEL +BQAwgYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJOWTERMA8GA1UEBwwITmV3IFlv +cmsxFTATBgNVBAoMDEV4YW1wbGUgSW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F1IaGJz1RMh +h1VCXaUlL2liVTWU4XgudB8rMOuETec7un9hzoBVOWHxXdRrGPaoN4+zWiLRCDXO +6wapOhkmTOXuZY/NcMMwTmdJKTEQBD6XIQamv91Ne2bT89LHpcp1LjbaCz+UAxg= +-----END CERTIFICATE----- diff --git a/torch_sub/test/pki/ca.key b/torch_sub/test/pki/ca.key new file mode 100644 index 0000000..57ea8d0 --- /dev/null +++ b/torch_sub/test/pki/ca.key @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEpQIBAAKCAQEAtWd2W1qPdJfXO4kHQXnCggxRkIeimSCI7Tbv+oTXQiAzpI3i +UWFHvBHQH/09et/OfXFMLrfD3F3cZueUm9xaFZuH+bW3ZDHaYi86agQtjzCVjr9X +o3ONKCO7uZmLS7pqK1T4tcg024ZL4mFWlznhBDwz2jSMqWc0acSY+O/q6Fs1fHd/ +yXDd6pKvVmqakZ1RBVgqw1gFXNKqyeH+yf8qcZif+eamwpFZ4uGiyUnfMONoz9jg +1iiXXWdYUg9gKTnuvPPERL9Z1YsudnZbn1gJPnhg4YWpcTuhiBF4P46DZjCcZVBC +kNy9vYfIhkv/alqgLpq8yj94LwdtLHBQoKePVwIDAQABAoIBAQCOcqNPU0rJLJ74 +Aj9vW/SweInoK4o0IodDd1t05rG+HFlRQ5VPgEt7VKWRKSQJBAw7FyfSm70yo4X6 +TKm2xo763rolDVvoUvmBFkMRkxxPj8AxavGfyZIzzfOQ6BCpM8ZBJqVy4bcYF1op +d3QupmWbFMdG9vLp58ARui7BdGyLbhlpsPbgAalq4+w3wO4w98wVCaUx7X6OZJS4 +8FjsI2L1iWzytjmJirpZnwBN90APf/SnYQPORocFd2a1xVcb2BwNoJfTIFC29G/J +hwjIrvIp/PV3TEIhUbs3TVtBKpkqtW5qbqoBpW9Bh5NSOPucG63K/P9ZXm8UXGiB +K7sj0KKZAoGBAN8LzwhGPHw/p1tQ3Jc0xmnTqyVotB9sgsNB/tzq/kphbCfC/P3e +SRlluEE7FYy6apY3WYsx2ctwuE0ToRRuP+Jiqyk4kAj7aFq8D3tyr0dzKWP0iCcq +bsPmyVpsRPRBEdvkHFeoA7J+tRNA89ayMkeJczQEaPMnGdOGI9NnA0wFAoGBANA0 +pPtezxMkrBFPnRN3J4OG3p62o6MaRBRfdF838zHtlFk7ozmsl4uOex3ZM40LCeqj ++FobgPy+ahE+ALbdOEJbSQVxRlz9B/JJTb+J21kP/r91zxC400KduN1UOxEiv9Lv +imazvk/NrNVY3NLM3WMGA1BKhcHcCob7i3L+tyirAoGAMY5tHFiGndCCvY40xL+s +Cd1GnFQsGQNB9mIWXz0y7JHCtv7iuQEHWsY37v5SpmbQwblggsW7rzDHMhDXbDOm +rATiJJF1pxk8sVQxWGs9uHFE0/mDurf5zjrbp+SAWYiPkDyZc3xX/fObBcEbrCsB +ctV+LCOCseuRGGcoVJMBr4UCgYEAhc/P2N5uJ9eB3v5T7Za/BoE/wrGPKdxPtOhE +Wo4S9xvCJDd4CDEslLzV07EsuJFHpk4L552VoNqgQMSgoOY8qikRHTZYCpt05/rE +xT1MhEkLaPHGSvD+lenYTic8bx7uOhtJ0AflYFTHp7ac9b5E6seKiafbn2RUP7yb +OyUJglECgYEAzHWHob3wvZxJeqDDSySEhiam4VcnVSRQDRVcZVX8rM1SlE294vZk +vR3DJWahlZdaLF7F7zqzSFKeTdj3rPz/rbi+bYuhjKhBpYmrACEbbFJ3atPuOF3d +7tV54kVpEnlK7FqU3DHTwU/PWJB+4VpRgJS99SW6OMGvfbLtq9G8+hk= +-----END RSA PRIVATE KEY----- diff --git a/torch_sub/test/pki/ca.srl b/torch_sub/test/pki/ca.srl new file mode 100644 index 0000000..394ce15 --- /dev/null +++ b/torch_sub/test/pki/ca.srl @@ -0,0 +1 @@ +57DED77E20CCB2A6DE278D6DEA310AF3A1C2C1B2 diff --git a/torch_sub/test/pki/mqtt.example.com.crt b/torch_sub/test/pki/mqtt.example.com.crt new file mode 100644 index 0000000..2156446 --- /dev/null +++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5N3aTH92iuGrXgYYZl+c1d0RGo +1bXkj7G5AFRGBFGY7PPIjtMmTYE7DB4bZ7HcxYbmXC7IqLXQoUN2A2ITuAdUcK2T +5pMZzkQGpUiHFIR3NUiDf2jYx7YTTt16I73TVlXHtb0qzo5oNLZKeogrKWlpb6uy +71wRdbgTtRpbdMDu+D65G5aZYVN36a223K7xiR5b75V6PeFgPQXhkLSJjCBBapct +mEo= +-----END CERTIFICATE----- diff --git a/torch_sub/test/pki/mqtt.example.com.key b/torch_sub/test/pki/mqtt.example.com.key new file mode 100644 index 0000000..40228dc --- /dev/null +++ b/torch_sub/test/pki/mqtt.example.com.key @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEpAIBAAKCAQEAvPxKqHgxq+NqzNq5BIVfEK7/GooQirqw3BPnvDlzORk0j/tT +aJmrRly1gHxej2OTfLANzcZURoJz4aV/TvjawjK0h2SHwaFPuhsHDwa59cw/S3tZ +EQ2GYTkODn4+WrcVMHj6maNq8RfgSuw9fhhItZxYlUZjzlTRiNyfeotCpQuBLFRv +WjT8A0aZ0Qf6z/3Xq7IKbuKBVcVCsdp9PbxBClQcGk+qGIpcKDPJsOUNGASiKJUB +iBK2I/aBaoplx9XvVorfuedba0/PoqQ4SVvGvwnZW1f/BxS4OtueNl+bF7rE3j4T +1IFOkrUcRDX/9kNqaVUAFoJ0KBJFiq1TTSTXWwIDAQABAoIBAGm/wwcCOsk0OE7p +FR6ygr+TLKxtFVSLouuDN+jbPN52fDMVL1cYpf55YhbDgSY7Ugwzd4XttLq/xJg/ +Qz2tgruoI9yfJFf1K+e3t/twiB5CbCiQnQYty0Qb6QGzIrEgQXseNxxBlVXTRm6m +QsKMVCNLmUXuXWrXi2hKC/NGecRf9WcYQeh3FjpWRPqXxK+vw2gD+ls8vG90BcTa +/bByZZCnbMEEwL6TSoJa7nVm61lOtSltmODJYzpnsbvGBy2DaF0lhiId7Gl5G/8K +QqeDp7m9QfrhgE6iRWzJJs4yer2D3y9n4b47o2YGC6L9sl+/sbCgPsV1fl/jMqK6 +sCEo5AECgYEA4ha5aF1yBo8HhUjA4LtUyRMSnaTNlvzEBR0JVB3goMu1o2O3JrPG +/z3sdG9SVzsytzaUXEi93KZ7V14aJk8NziVPWVkUEelbqRMLzlyE+30Xky0uDrow +4mb4SFCMjKLeJg20XK00SFKMd5Go03VeDQkClW5M5B4dimXVkIO4eukCgYEA1fzw +EwuNzViuxx+IVeViHEe0oUpeBUrREIHS7hIefO2pqK6nsPDo1A1P7X287NBaFP8p +u3xMx5fDrguaOU3RW/BajXklZEMkz37MOjhMop6d3T5yWWcCE2CE7hVz1O9Jbqbw +Wmfgq8SPgDj26NXhONm38xschEYJJzihkeTyzaMCgYEAw0rhyNa/Ag9WbbkUcose +h7mj4OxUclHQeKJGRpSwTfTo50PhFts/z4aL01+9foAyJLROnxBugESGUkeEywaK +ZEEyM3mQrpAmjvtWvWCJtjqtvIHQQQRv6YEMglqhrXGZ9sDrxQoQGVDE6Ru2+0Fs +hlH8G1v1qy6gUcX5HiXJmtECgYAz9VOxvCd1Seg+T0jCWo0lAsA4PZ9wt4bl9C/s +QJgIi4ibfbUYAJb4DjdvGg3Kjpig6ogOjxLxj8citox/B4cjRMwn99d9bdQ9UbNz +G4J4Jf184BHR5XIalGASk0Dp3iQ9aumHehuSeYrCfpJtXKlwLWU98UJOV9cXH+gT +Tb0q8wKBgQCh61d7FfhtUbKQbd8lQMrxXUDDd8tP9NkmZJ0y1Qg10s5Pl80wZo6H +3PS0ivyxDWBygcxrHOFV26kfMiBrPNtA3HY5ZWFAq1JZ7Yajseg83KSbli6V/+dE +BekdMwQk9MrLELEc1IgqgZU46yrRcKB+6Zh5MJM3bH3qzWpVCXIKCw== +-----END RSA PRIVATE KEY----- diff --git a/torch_sub/test/pki/subscriber.crt b/torch_sub/test/pki/subscriber.crt new file mode 100644 index 0000000..56cad15 --- /dev/null +++ b/torch_sub/test/pki/subscriber.crt @@ -0,0 +1,21 @@ +-----BEGIN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rbGD2GB4ADhohhMx5NL3h/7wge4qhvBIVEoa093hV +0rzctNrP0bDsZIei3RV6mat6teR4MUK7PQSmiwTPoFmbNB+T+sl/hT22B7utooQT +h5H39zpLiorQEUMF7qJff/7+KXs7YUGUFyAQyGnxhMhAQ7zWrkrR50sFwg== +-----END CERTIFICATE----- diff --git a/torch_sub/test/pki/subscriber.key b/torch_sub/test/pki/subscriber.key new file mode 100644 index 0000000..5217b66 --- /dev/null +++ b/torch_sub/test/pki/subscriber.key @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEpQIBAAKCAQEA+4T1e9Wma+cUCPZkIy9RakTjJ5rr1/he1nrgHD4qnYH00X7W +VTs5Omc/7Ve5vHsZfYXLgTvD6MrCsLj5H5mq1mH1QIuPsgSKfo2hoqAtJd3vkD1Q +Vlsj1W6DtVLGbnzUnyoPNU2d+VPBEE++cLrUHWehdlFkZRtWO0LtyIgnfdseS2VM +FtW9nB1kgHS6ld7eIN5cTwjWLNT4UHQRsKuCad6jeY9b/kg8MYYnLVgj0c1r+HeC +dnm6iZDb+uFQHjpmvb739sZAeScgEwhJbHpRHQWWR0K7h7ObfvsiMEBMFdoSiqhZ +/JFK4sOCQACIdu2n4hCkgv6yg5zMyNSG+GAXIQIDAQABAoIBAQDHKe6VQ4XHlbBo +tGpw7gwjAS96chNk7fhzD9OcqaFnHbv1k+E2lnHnjFCzqS6bUELMAYE28VNdaAko +lSA35J/BqMnidWCwzyW3toESXJHDlW0Yo2SVLRA/9oX2s/gLD2/yJQTr6W05PBf5 +yZt8eoRyUFgrb6H26eGrhYDytNXIsoL5Si7Q3/gc11jW5HLOqUhSE2oFQ9+xqq7B +HvD6a6nTF8upM2sTkyy9+n5RRuaqRfNTZmVzjNQOnnG+QyRyI0pdhipO77/+2JSl +8Db4F195wbZlxGsW7NwkJGCM0O9Fyaa2z7J/Je1KTuoTu+fCUhLwiojVLsQq10kO +ZZWm65+dAoGBAP6mi6K9H9LTzZ93XIOfmK9Q7S5SyOKQWLnSHMNyIsrtnZBWATEO +u16FNSOzdieOjY0rKptChUiqaTMavUEmk6aRLfkUqbrJygc8M+RH6xnb0Z1VXtM5 +bEvPgYu0mm550AvEFsnu77fr194GAIhabdvzMz7b7EvDzPO86iXwGRWPAoGBAPza +Km38aH+Ccpk2084H47v783fUXyS2ScbtccVZxqtn0sxEFVnwESYQjz9QovTNlqyN +Y6t6mr1M8nM8MmPwBXFa3D654xtew8zpiA/MvCDbqlXB87BeTSMJWPAERVw2XqAm +wYFg0yJXlRRgQDiiCZCxsVzppSwct/Aa6euGXpBPAoGBAPhSKDCWBIZujEFJACpK +Y3XykJdvmv10jVEHF41vq4X/mHq7o4XXO9e8Rkl+I2YHmPlkcrPcdmSZ6OQw2wTB +PZJcWFxgTfMb+6p6ho/Bof0hYpLuQP3xLS3wN/+oKkA5ASu4GBDqs1DC50pWyAYv +SJoH2p0dkJuBYEb+ncZJD+z5AoGAD6UUEQAYGyOgIZjB3DKixaPeOaDbTjM1N2jD +rFlUsJBY+6iOxaTT+s31fw5nNsxtsTmCXD7WyjWznquv1n0oaQ4dKIhp4+ymIsyk +TY32afYNgQbiJByBm1Rdu2QYQo9epXwgZvftuGdA4yTddGOaQeist7oBLUyNmP6h +UKBcw4MCgYEArWhvqZUvklgmTJi8bSyJaCuZrd7l4HxoajceQ7ujyl/N2zX+HAio +8uw46NUvsiyIk3OCI/59G5BrBtOIYq5KUTNhDdz6q0HMz1MSDRCH5Zt0Cokam+jX +j7QGOQnhTHkGv8Mabo6gmLPifPuYboFzivFGMJH8ur+38YOyGxbwvqI= +-----END RSA PRIVATE KEY----- diff --git a/torch_sub/test/pki/vagrant.crt b/torch_sub/test/pki/vagrant.crt new file mode 100644 index 0000000..b58e5d3 --- /dev/null +++ b/torch_sub/test/pki/vagrant.crt @@ -0,0 +1,21 @@ +-----BEGIN CERTIFICATE----- +MIIDhDCCAmwCFFfe134gzLKm3ieNbeoxCvOhwsGxMA0GCSqGSIb3DQEBCwUAM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u6itzA3YsCMct1p3TNGwDUZ+cQqkTPhkB +KNT0VcmDNdavD59WsEfrgZe5/DXY+Q1yHzGmaq70y0U6SgTfOsslmQ== +-----END CERTIFICATE----- diff --git a/torch_sub/test/pki/vagrant.key b/torch_sub/test/pki/vagrant.key new file mode 100644 index 0000000..9e71686 --- /dev/null +++ b/torch_sub/test/pki/vagrant.key @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEpAIBAAKCAQEAsFHdZgFShIz21oMFafwxJTdZbvP0Sa61pZEqU0J/ysBVesQZ +/eyG0FvoxZ1GMAodwENlpO2ZbqjReheQp0Z5ZybpfSjhPBpE48TsdHw60qyY9PFD +T2Ap+TAH6xvz58g+sqrpUtaJImq9zpFtm+gpchpZT8FXirccb0y8UHYAw3H2mbMt +54/+bfbekARTbyhH+Qa+4MkdIs7dw13VTlkoUW0nWEdi6Aoze4eXJDjijO7qXYB7 +EaAhiMDn/LUP9G5ZrJt2mmktLdF6uEoOu9OTBYNQAuBN3EechP3Q0UK0axlPPCZu +qz+JurU22QcaJLS0aEmN+0iI8ll+40CtWyhgXQIDAQABAoIBAQCYYtiHbYMk3jQD +p49JT1YmRRT9aMhr2hxR8Ql0lheeYuY9yThxljfZ4mVmTYw4vrWB0n4JsfQWiL8q +1y0E9Uq9lQrdSjSH3mhFto9qCWhJZjR4FgBHnOQJ4rIlR65gV1eg0UgAeTxiS4Cq +BFSIF3mijRU9ces4DxP7OYXTwHjecLQXWzsENhlcowTCYOfxLM/8YvVRCv2cxPJh +/TL3qn1LD5/15lUb58+SqNAOREGACB+YG6rFShvUrxkq3ShtZdPUOzM5z+9xS8yO +Uh2aZDmxtMB6GnYbQNhfM274i71aVhf0++7s8VsiVo3C61+qKIYcX0LK8t2PnQ1H +cFn20hKhAoGBANfyLB5T+nZUGBysZSe76SoZUFWM0OsLixLq0+CqHvnTmIVMLQpv +k8RV2/g7rKCcaKghSENI2gwWy+EDfVGi/nGc+uJ+n4FX92F98MmmzFvuQXOp1AuY +Qvqr2XquFu5B6Jz5aOniOMHHSRl9JmZOLc+rs7COH7s/o5OPBT+1OpHJAoGBANEG +HBnAuxZ0XJtB7TvA9wW3GCRidCisRH8rG0cN4dE3UuCC+DQq1AV03NwM6pycwz15 +ljpkb+WtbE6iKG3sfj3vWhwkakcEnJKXGCVbKmMXI0L2sMnQB4bJ4TtXGDRJlLKg +XuwBsEmN8pM8IqRmnSpTrVbpCo4vZ/29c8l9+YP1AoGAcgIBGOHtUZuEP18k6J1k +tD05FHGLuwwVGJ+xzOMEB5GW7IkTHndZ5EYQJDYdJY5uEpW/uQY1WDyQ1vMornkH +LKRcMEf5nif7CxWaklvleIOJOq9mq9hvRDiGUSaoJJHXZUioAxLUNDoqdbKFG24a +8ZENBSGDzzACBF11v/TGP0ECgYEAp+WCeOUo4jaBlGx2RIMRaNPTXpZ+u5T0SDm1 +5XMvKkCIH7LT8ANe3ysppM/zO+1nnl+l3i2C/Dg7QUZbt0A5f0JdXTGa9IStx8n6 +KTd7arDRMB67jr+86/YJJwMkfAuGl5zd4jDRC6Qrbzzkjq2mHLOuDpuOUPufSl/9 +O6Im5GkCgYA4zFE3ztSV6nq5EH3A7VmAsLiyRXBJfOlLXIBApv46/t4ivS4C3Esu +8LR+Vvx2XLWkpkrm9kR1wIutNx6x1pRkSGDKyRXn5+cU4A2Lw9y2BbwDhj+WiHkM +zCuL+8l2px2f3K1YPE3oGWHZZJScDwa03yjVzrSPDr766XBtH7W4vg== +-----END RSA PRIVATE KEY----- diff --git a/torch_sub/test/run-broker.bat b/torch_sub/test/run-broker.bat new file mode 100644 index 0000000..93db891 --- /dev/null +++ b/torch_sub/test/run-broker.bat @@ -0,0 +1 @@ +docker run -it --rm --name mosquitto -p 8883:8883 -v %cd%\broker-config:/mosquitto/config eclipse-mosquitto diff --git a/torch_sub/test/run-broker.sh b/torch_sub/test/run-broker.sh new file mode 100644 index 0000000..c5a6fa8 --- /dev/null +++ b/torch_sub/test/run-broker.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +docker run -it --rm --user $(echo $UID) --name mosquitto -p 8883:8883 -v $(pwd)/broker-config:/mosquitto/config eclipse-mosquitto diff --git a/torch_sub/test/subscriber-config/ca.crt b/torch_sub/test/subscriber-config/ca.crt new file mode 100644 index 0000000..8e79f74 --- /dev/null +++ b/torch_sub/test/subscriber-config/ca.crt @@ -0,0 +1,23 @@ +-----BEGIN CERTIFICATE----- +MIID6zCCAtOgAwIBAgIUQJye5MbZVMpOpu87TmmlN/KOBj0wDQYJKoZIhvcNAQEL +BQAwgYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJOWTERMA8GA1UEBwwITmV3IFlv +cmsxFTATBgNVBAoMDEV4YW1wbGUgSW5jLjEcMBoGA1UEAwwTY2EubXF0dC5leGFt +cGxlLmNvbTEgMB4GCSqGSIb3DQEJARYRYWRtaW5AZXhhbXBsZS5jb20wHhcNMjAx +MDA2MTA1OTE4WhcNMzAxMDA0MTA1OTE4WjCBhDELMAkGA1UEBhMCVVMxCzAJBgNV +BAgMAk5ZMREwDwYDVQQHDAhOZXcgWW9yazEVMBMGA1UECgwMRXhhbXBsZSBJbmMu +MRwwGgYDVQQDDBNjYS5tcXR0LmV4YW1wbGUuY29tMSAwHgYJKoZIhvcNAQkBFhFh +ZG1pbkBleGFtcGxlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB +ALVndltaj3SX1zuJB0F5woIMUZCHopkgiO027/qE10IgM6SN4lFhR7wR0B/9PXrf +zn1xTC63w9xd3GbnlJvcWhWbh/m1t2Qx2mIvOmoELY8wlY6/V6NzjSgju7mZi0u6 +aitU+LXINNuGS+JhVpc54QQ8M9o0jKlnNGnEmPjv6uhbNXx3f8lw3eqSr1ZqmpGd +UQVYKsNYBVzSqsnh/sn/KnGYn/nmpsKRWeLhoslJ3zDjaM/Y4NYol11nWFIPYCk5 +7rzzxES/WdWLLnZ2W59YCT54YOGFqXE7oYgReD+Og2YwnGVQQpDcvb2HyIZL/2pa +oC6avMo/eC8HbSxwUKCnj1cCAwEAAaNTMFEwHQYDVR0OBBYEFEC8a9l0rpIdUqCS +i4NJwXlqUoLeMB8GA1UdIwQYMBaAFEC8a9l0rpIdUqCSi4NJwXlqUoLeMA8GA1Ud +EwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAGzxJWZdVozskr5yie2uetpL +aAReCaHEdWudRN3wVW1Dpm2sE23x4VFiJ+Uow9k21GgtGUsAIFqRgb3/QO+ipODC +GRwZmVopkuOaHfCz+tO8xqjvGHCidhhhNFdR9uVkWHoPKsQsvap0SSk12KMtFBRo +3rmeQwPP4qEPFEwc2U0hCUMsIUvMSt3KrA/j+aMRzOXU7QIMFbcYEF1IaGJz1RMh +h1VCXaUlL2liVTWU4XgudB8rMOuETec7un9hzoBVOWHxXdRrGPaoN4+zWiLRCDXO +6wapOhkmTOXuZY/NcMMwTmdJKTEQBD6XIQamv91Ne2bT89LHpcp1LjbaCz+UAxg= +-----END CERTIFICATE----- diff --git a/torch_sub/test/subscriber-config/subscriber.crt b/torch_sub/test/subscriber-config/subscriber.crt new file mode 100644 index 0000000..56cad15 --- /dev/null +++ b/torch_sub/test/subscriber-config/subscriber.crt @@ -0,0 +1,21 @@ +-----BEGIN CERTIFICATE----- +MIIDhzCCAm8CFFfe134gzLKm3ieNbeoxCvOhwsGyMA0GCSqGSIb3DQEBCwUAMIGE +MQswCQYDVQQGEwJVUzELMAkGA1UECAwCTlkxETAPBgNVBAcMCE5ldyBZb3JrMRUw +EwYDVQQKDAxFeGFtcGxlIEluYy4xHDAaBgNVBAMME2NhLm1xdHQuZXhhbXBsZS5j +b20xIDAeBgkqhkiG9w0BCQEWEWFkbWluQGV4YW1wbGUuY29tMB4XDTIwMTAwNjEx +MDYwM1oXDTMwMTAwNDExMDYwM1owezELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAk5Z +MREwDwYDVQQHDAhOZXcgWW9yazEVMBMGA1UECgwMRXhhbXBsZSBJbmMuMRMwEQYD +VQQDDApzdWJzY3JpYmVyMSAwHgYJKoZIhvcNAQkBFhFhZG1pbkBleGFtcGxlLmNv +bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAPuE9XvVpmvnFAj2ZCMv +UWpE4yea69f4XtZ64Bw+Kp2B9NF+1lU7OTpnP+1Xubx7GX2Fy4E7w+jKwrC4+R+Z +qtZh9UCLj7IEin6NoaKgLSXd75A9UFZbI9Vug7VSxm581J8qDzVNnflTwRBPvnC6 +1B1noXZRZGUbVjtC7ciIJ33bHktlTBbVvZwdZIB0upXe3iDeXE8I1izU+FB0EbCr +gmneo3mPW/5IPDGGJy1YI9HNa/h3gnZ5uomQ2/rhUB46Zr2+9/bGQHknIBMISWx6 +UR0FlkdCu4ezm377IjBATBXaEoqoWfyRSuLDgkAAiHbtp+IQpIL+soOczMjUhvhg +FyECAwEAATANBgkqhkiG9w0BAQsFAAOCAQEACFy4ioFB5jeW+vMrTGfcwbq0qFW4 +9zupWVKG4H+l4N/bjiwTpKy8oP7STBS94BbA6fYE8Y+Jcibas1zX78HFIk/A9Dh1 +q9lysu7Biv4JbaXVPHxy9SzadUPym3bYAJtVRWsC1N2siI1NlalttDU1y+RnllUL +jixHf2/EghYgJydN7yoTWD7rbGD2GB4ADhohhMx5NL3h/7wge4qhvBIVEoa093hV +0rzctNrP0bDsZIei3RV6mat6teR4MUK7PQSmiwTPoFmbNB+T+sl/hT22B7utooQT +h5H39zpLiorQEUMF7qJff/7+KXs7YUGUFyAQyGnxhMhAQ7zWrkrR50sFwg== +-----END CERTIFICATE----- diff --git a/torch_sub/test/subscriber-config/subscriber.key b/torch_sub/test/subscriber-config/subscriber.key new file mode 100644 index 0000000..5217b66 --- /dev/null +++ b/torch_sub/test/subscriber-config/subscriber.key @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEpQIBAAKCAQEA+4T1e9Wma+cUCPZkIy9RakTjJ5rr1/he1nrgHD4qnYH00X7W +VTs5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kl+I2YHmPlkcrPcdmSZ6OQw2wTB +PZJcWFxgTfMb+6p6ho/Bof0hYpLuQP3xLS3wN/+oKkA5ASu4GBDqs1DC50pWyAYv +SJoH2p0dkJuBYEb+ncZJD+z5AoGAD6UUEQAYGyOgIZjB3DKixaPeOaDbTjM1N2jD +rFlUsJBY+6iOxaTT+s31fw5nNsxtsTmCXD7WyjWznquv1n0oaQ4dKIhp4+ymIsyk +TY32afYNgQbiJByBm1Rdu2QYQo9epXwgZvftuGdA4yTddGOaQeist7oBLUyNmP6h +UKBcw4MCgYEArWhvqZUvklgmTJi8bSyJaCuZrd7l4HxoajceQ7ujyl/N2zX+HAio +8uw46NUvsiyIk3OCI/59G5BrBtOIYq5KUTNhDdz6q0HMz1MSDRCH5Zt0Cokam+jX +j7QGOQnhTHkGv8Mabo6gmLPifPuYboFzivFGMJH8ur+38YOyGxbwvqI= +-----END RSA PRIVATE KEY----- diff --git a/torch_sub/torch_sub.py b/torch_sub/torch_sub.py new file mode 100644 index 0000000..d37b906 --- /dev/null +++ b/torch_sub/torch_sub.py @@ -0,0 +1,2 @@ +def attach(host, port): + return None \ No newline at end of file