diff --git a/roles/xmpp_server/molecule/default/tests/test_default.py b/roles/xmpp_server/molecule/default/tests/test_default.py index e0a567a9bf3262985e13a1810a19423ff978604e..a01a89747d7492345a3362c8d3739694b7f6b997 100644 --- a/roles/xmpp_server/molecule/default/tests/test_default.py +++ b/roles/xmpp_server/molecule/default/tests/test_default.py @@ -129,30 +129,6 @@ def test_certificate_validity_check_configuration(host): assert config.content_string == "/etc/ssl/certs/%s_xmpp.pem" % hostname -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() - - # Use first defined domain for testing. - domain = host.ansible.get_variables()['xmpp_domains'][0] - - 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 %s", domain) - - 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 diff --git a/roles/xmpp_server/molecule/default/tests/test_mandatory.py b/roles/xmpp_server/molecule/default/tests/test_mandatory.py index b8cf083d3bb140fe603701f65bfe3719f4998f44..047f851531495d449253f93ff5371c9a1367ba02 100644 --- a/roles/xmpp_server/molecule/default/tests/test_mandatory.py +++ b/roles/xmpp_server/molecule/default/tests/test_mandatory.py @@ -39,6 +39,30 @@ Component "proxy.domain1" "proxy65" proxy65_acl = { "domain1" }""" in config.content_string +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() + + # Use first defined domain for testing. + domain = host.ansible.get_variables()['xmpp_domains'][0] + + 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 %s", domain) + + 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 + + @pytest.mark.parametrize("port", [ 5222, 5223