diff --git a/roles/xmpp_server/molecule/default/tests/test_mandatory.py b/roles/xmpp_server/molecule/default/tests/test_mandatory.py index f8137e8e00fa3d91b7aae42f355fedac38cacf3b..7379225b420a8c002bdb3b3909342df1fee2f2a5 100644 --- a/roles/xmpp_server/molecule/default/tests/test_mandatory.py +++ b/roles/xmpp_server/molecule/default/tests/test_mandatory.py @@ -11,22 +11,6 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('parameters-mandatory') -def test_certificate_validity_check_configuration(host): - """ - Tests if certificate validity check configuration file has been deployed - correctly. - """ - - hostname = host.run('hostname').stdout.strip() - - config = host.file('/etc/check_certificate/%s_xmpp.conf' % hostname) - assert config.is_file - assert config.user == 'root' - assert config.group == 'root' - assert config.mode == 0o644 - assert config.content_string == "/etc/ssl/certs/%s_xmpp.pem" % hostname - - def test_prosody_configuration_file_content(host): """ Tests if Prosody configuration file has correct content. @@ -62,49 +46,6 @@ def test_correct_prosody_package_installed(host): assert host.package('prosody-0.10').is_installed -def test_xmpp_server_uses_correct_dh_parameters(host): - """ - Tests if the HTTP server uses the generated Diffie-Hellman parameter. - """ - - fqdn = host.run('hostname -f').stdout.strip() - - with host.sudo(): - expected_dhparam = host.file('/etc/ssl/private/%s_xmpp.dh.pem' % fqdn).content_string.rstrip() - - connection = host.run("gnutls-cli --no-ca-verification --starttls-proto=xmpp --port 5222 " - "--priority 'NONE:+VERS-TLS1.2:+CTYPE-X509:+COMP-NULL:+SIGN-RSA-SHA384:+DHE-RSA:+SHA384:+AEAD:+AES-256-GCM' --verbose domain1") - - output = connection.stdout - begin_marker = "-----BEGIN DH PARAMETERS-----" - end_marker = "-----END DH PARAMETERS-----" - used_dhparam = output[output.find(begin_marker):output.find(end_marker) + len(end_marker)] - - assert used_dhparam == expected_dhparam - - -def test_tls_connectivity(host): - """ - Tests if it is possible to connect to the XMPP server using - STARTTLS/TLS. - """ - - starttls = host.run('echo "test" | openssl s_client -quiet -starttls xmpp -xmpphost domain1 -connect localhost:5222') - assert starttls.rc == 0 - assert 'jabber:client' in starttls.stdout - assert 'not-well-formed' in starttls.stdout - - tls = host.run('echo "test" | openssl s_client -quiet -connect domain1:5223') - assert tls.rc == 0 - assert 'jabber:client' in starttls.stdout - assert 'not-well-formed' in starttls.stdout - - s2s = host.run('echo "test" | openssl s_client -quiet -starttls xmpp-server -xmpphost domain1 -connect localhost:5222') - assert s2s.rc == 0 - assert 'jabber:client' in s2s.stdout - assert 'not-well-formed' in s2s.stdout - - @pytest.mark.parametrize("port", [ 5222, 5223