|
|
f92ce9 |
From d15c48e4041d3d7ccde3e791c9ee517af42b7447 Mon Sep 17 00:00:00 2001
|
|
|
f92ce9 |
From: Noriko Hosoi <nhosoi@redhat.com>
|
|
|
f92ce9 |
Date: Wed, 10 Sep 2014 18:48:07 -0700
|
|
|
f92ce9 |
Subject: [PATCH 5/7] Ticket 47838,47895 - CI test: add test cases for ticket
|
|
|
f92ce9 |
47838 and 47895
|
|
|
f92ce9 |
|
|
|
f92ce9 |
Description:
|
|
|
f92ce9 |
Ticket #47838: harden the list of ciphers available by default
|
|
|
f92ce9 |
Adding test cases for default behaviour change of allowWeakCipher.
|
|
|
f92ce9 |
|
|
|
f92ce9 |
Ticket #47895 - If no effective ciphers are available, disable security setting.
|
|
|
f92ce9 |
Test case for "Even if no cipher is available, the server starts
|
|
|
f92ce9 |
without SSL" is added.
|
|
|
f92ce9 |
|
|
|
f92ce9 |
https://fedorahosted.org/389/ticket/47838
|
|
|
f92ce9 |
(cherry picked from commit 4fb1a04ceb9631680a9bcff844250afb4b6e5b7d)
|
|
|
f92ce9 |
(cherry picked from commit 3877981d63fb82716b60cd1294008b2d272197c9)
|
|
|
f92ce9 |
---
|
|
|
f92ce9 |
dirsrvtests/tickets/ticket47838_test.py | 221 +++++++++++++++++++++++---------
|
|
|
f92ce9 |
1 file changed, 163 insertions(+), 58 deletions(-)
|
|
|
f92ce9 |
|
|
|
f92ce9 |
diff --git a/dirsrvtests/tickets/ticket47838_test.py b/dirsrvtests/tickets/ticket47838_test.py
|
|
|
f92ce9 |
index dedd61d..0e406f3 100644
|
|
|
f92ce9 |
--- a/dirsrvtests/tickets/ticket47838_test.py
|
|
|
f92ce9 |
+++ b/dirsrvtests/tickets/ticket47838_test.py
|
|
|
f92ce9 |
@@ -201,6 +201,7 @@ def test_ticket47838_init(topology):
|
|
|
f92ce9 |
topology.standalone.simple_bind_s(DN_DM, PASSWORD)
|
|
|
f92ce9 |
topology.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3', 'on'),
|
|
|
f92ce9 |
(ldap.MOD_REPLACE, 'nsSSLClientAuth', 'allowed'),
|
|
|
f92ce9 |
+ (ldap.MOD_REPLACE, 'allowWeakCipher', 'on'),
|
|
|
f92ce9 |
(ldap.MOD_REPLACE, 'nsSSL3Ciphers', '+all')])
|
|
|
f92ce9 |
|
|
|
f92ce9 |
topology.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE, 'nsslapd-security', 'on'),
|
|
|
f92ce9 |
@@ -217,6 +218,7 @@ def test_ticket47838_run_0(topology):
|
|
|
f92ce9 |
"""
|
|
|
f92ce9 |
Check nsSSL3Ciphers: +all
|
|
|
f92ce9 |
All ciphers are enabled except null.
|
|
|
f92ce9 |
+ Note: allowWeakCipher: on
|
|
|
f92ce9 |
"""
|
|
|
f92ce9 |
_header(topology, 'Test Case 1 - Check the ciphers availability for "+all"')
|
|
|
f92ce9 |
|
|
|
f92ce9 |
@@ -226,42 +228,78 @@ def test_ticket47838_run_0(topology):
|
|
|
f92ce9 |
log.info("\n######################### Restarting the server ######################\n")
|
|
|
f92ce9 |
topology.standalone.restart(timeout=120)
|
|
|
f92ce9 |
|
|
|
f92ce9 |
- enabled = os.popen('egrep "SSL alert:" %s | egrep enabled | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
- disabled = os.popen('egrep "SSL alert:" %s | egrep disabled | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
+ enabled = os.popen('egrep "SSL alert:" %s | egrep \": enabled\" | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
+ disabled = os.popen('egrep "SSL alert:" %s | egrep \": disabled\" | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
ecount = int(enabled.readline().rstrip())
|
|
|
f92ce9 |
dcount = int(disabled.readline().rstrip())
|
|
|
f92ce9 |
|
|
|
f92ce9 |
log.info("Enabled ciphers: %d" % ecount)
|
|
|
f92ce9 |
log.info("Disabled ciphers: %d" % dcount)
|
|
|
f92ce9 |
- assert ecount >= 60
|
|
|
f92ce9 |
- assert dcount <= 7
|
|
|
f92ce9 |
+ assert ecount >= 31
|
|
|
f92ce9 |
+ assert dcount <= 36
|
|
|
f92ce9 |
global plus_all_ecount
|
|
|
f92ce9 |
global plus_all_dcount
|
|
|
f92ce9 |
plus_all_ecount = ecount
|
|
|
f92ce9 |
plus_all_dcount = dcount
|
|
|
f92ce9 |
- weak = os.popen('egrep "SSL alert:" %s | egrep "WEAK CIPHER" | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
+ weak = os.popen('egrep "SSL alert:" %s | egrep "WEAK CIPHER" | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
wcount = int(weak.readline().rstrip())
|
|
|
f92ce9 |
log.info("Weak ciphers: %d" % wcount)
|
|
|
f92ce9 |
assert wcount <= 29
|
|
|
f92ce9 |
|
|
|
f92ce9 |
def test_ticket47838_run_1(topology):
|
|
|
f92ce9 |
"""
|
|
|
f92ce9 |
+ Check nsSSL3Ciphers: +all
|
|
|
f92ce9 |
+ All ciphers are enabled except null.
|
|
|
f92ce9 |
+ Note: allowWeakCipher: off for +all
|
|
|
f92ce9 |
+ """
|
|
|
f92ce9 |
+ _header(topology, 'Test Case 2 - Check the ciphers availability for "+all" with not allowing WeakCiphers')
|
|
|
f92ce9 |
+
|
|
|
f92ce9 |
+ topology.standalone.simple_bind_s(DN_DM, PASSWORD)
|
|
|
f92ce9 |
+ topology.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', '64')])
|
|
|
f92ce9 |
+ # Make sure allowWeakCipher is not set.
|
|
|
f92ce9 |
+ topology.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_DELETE, 'allowWeakCipher', None)])
|
|
|
f92ce9 |
+
|
|
|
f92ce9 |
+ log.info("\n######################### Restarting the server ######################\n")
|
|
|
f92ce9 |
+ log.info("\n######################### Restarting the server ######################\n")
|
|
|
f92ce9 |
+ topology.standalone.stop(timeout=10)
|
|
|
f92ce9 |
+ os.system('mv %s %s.47838_0' % (topology.standalone.errlog, topology.standalone.errlog))
|
|
|
f92ce9 |
+ os.system('touch %s' % (topology.standalone.errlog))
|
|
|
f92ce9 |
+ topology.standalone.start(timeout=120)
|
|
|
f92ce9 |
+
|
|
|
f92ce9 |
+ enabled = os.popen('egrep "SSL alert:" %s | egrep \": enabled\" | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
+ disabled = os.popen('egrep "SSL alert:" %s | egrep \": disabled\" | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
+ ecount = int(enabled.readline().rstrip())
|
|
|
f92ce9 |
+ dcount = int(disabled.readline().rstrip())
|
|
|
f92ce9 |
+
|
|
|
f92ce9 |
+ log.info("Enabled ciphers: %d" % ecount)
|
|
|
f92ce9 |
+ log.info("Disabled ciphers: %d" % dcount)
|
|
|
f92ce9 |
+ assert ecount >= 31
|
|
|
f92ce9 |
+ assert dcount <= 36
|
|
|
f92ce9 |
+ weak = os.popen('egrep "SSL alert:" %s | egrep "WEAK CIPHER" | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
+ wcount = int(weak.readline().rstrip())
|
|
|
f92ce9 |
+ log.info("Weak ciphers: %d" % wcount)
|
|
|
f92ce9 |
+ assert wcount <= 29
|
|
|
f92ce9 |
+
|
|
|
f92ce9 |
+def test_ticket47838_run_2(topology):
|
|
|
f92ce9 |
+ """
|
|
|
f92ce9 |
Check nsSSL3Ciphers: +rsa_aes_128_sha,+rsa_aes_256_sha
|
|
|
f92ce9 |
rsa_aes_128_sha, tls_rsa_aes_128_sha, rsa_aes_256_sha, tls_rsa_aes_256_sha are enabled.
|
|
|
f92ce9 |
"""
|
|
|
f92ce9 |
- _header(topology, 'Test Case 2 - Check the ciphers availability for "+rsa_aes_128_sha,+rsa_aes_256_sha"')
|
|
|
f92ce9 |
+ _header(topology, 'Test Case 3 - Check the ciphers availability for "+rsa_aes_128_sha,+rsa_aes_256_sha"')
|
|
|
f92ce9 |
|
|
|
f92ce9 |
topology.standalone.simple_bind_s(DN_DM, PASSWORD)
|
|
|
f92ce9 |
+ #topology.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', '+rsa_aes_128_sha,+rsa_aes_256_sha'),
|
|
|
f92ce9 |
+ # (ldap.MOD_REPLACE, 'allowWeakCipher', 'on')])
|
|
|
f92ce9 |
topology.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', '+rsa_aes_128_sha,+rsa_aes_256_sha')])
|
|
|
f92ce9 |
|
|
|
f92ce9 |
log.info("\n######################### Restarting the server ######################\n")
|
|
|
f92ce9 |
topology.standalone.stop(timeout=10)
|
|
|
f92ce9 |
- os.system('mv %s %s.47838_0' % (topology.standalone.errlog, topology.standalone.errlog))
|
|
|
f92ce9 |
+ os.system('mv %s %s.47838_1' % (topology.standalone.errlog, topology.standalone.errlog))
|
|
|
f92ce9 |
os.system('touch %s' % (topology.standalone.errlog))
|
|
|
f92ce9 |
topology.standalone.start(timeout=120)
|
|
|
f92ce9 |
|
|
|
f92ce9 |
- enabled = os.popen('egrep "SSL alert:" %s | egrep enabled | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
- disabled = os.popen('egrep "SSL alert:" %s | egrep disabled | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
+ enabled = os.popen('egrep "SSL alert:" %s | egrep \": enabled\" | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
+ disabled = os.popen('egrep "SSL alert:" %s | egrep \": disabled\" | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
ecount = int(enabled.readline().rstrip())
|
|
|
f92ce9 |
dcount = int(disabled.readline().rstrip())
|
|
|
f92ce9 |
|
|
|
f92ce9 |
@@ -272,24 +310,24 @@ def test_ticket47838_run_1(topology):
|
|
|
f92ce9 |
assert ecount == 2
|
|
|
f92ce9 |
assert dcount == (plus_all_ecount + plus_all_dcount - ecount)
|
|
|
f92ce9 |
|
|
|
f92ce9 |
-def test_ticket47838_run_2(topology):
|
|
|
f92ce9 |
+def test_ticket47838_run_3(topology):
|
|
|
f92ce9 |
"""
|
|
|
f92ce9 |
Check nsSSL3Ciphers: -all
|
|
|
f92ce9 |
All ciphers are disabled.
|
|
|
f92ce9 |
"""
|
|
|
f92ce9 |
- _header(topology, 'Test Case 3 - Check the ciphers availability for "-all"')
|
|
|
f92ce9 |
+ _header(topology, 'Test Case 4 - Check the ciphers availability for "-all"')
|
|
|
f92ce9 |
|
|
|
f92ce9 |
topology.standalone.simple_bind_s(DN_DM, PASSWORD)
|
|
|
f92ce9 |
topology.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', '-all')])
|
|
|
f92ce9 |
|
|
|
f92ce9 |
log.info("\n######################### Restarting the server ######################\n")
|
|
|
f92ce9 |
topology.standalone.stop(timeout=10)
|
|
|
f92ce9 |
- os.system('mv %s %s.47838_1' % (topology.standalone.errlog, topology.standalone.errlog))
|
|
|
f92ce9 |
+ os.system('mv %s %s.47838_2' % (topology.standalone.errlog, topology.standalone.errlog))
|
|
|
f92ce9 |
os.system('touch %s' % (topology.standalone.errlog))
|
|
|
f92ce9 |
topology.standalone.start(timeout=120)
|
|
|
f92ce9 |
|
|
|
f92ce9 |
- enabled = os.popen('egrep "SSL alert:" %s | egrep enabled | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
- disabled = os.popen('egrep "SSL alert:" %s | egrep disabled | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
+ enabled = os.popen('egrep "SSL alert:" %s | egrep \": enabled\" | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
+ disabled = os.popen('egrep "SSL alert:" %s | egrep \": disabled\" | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
ecount = int(enabled.readline().rstrip())
|
|
|
f92ce9 |
dcount = int(disabled.readline().rstrip())
|
|
|
f92ce9 |
|
|
|
f92ce9 |
@@ -300,24 +338,24 @@ def test_ticket47838_run_2(topology):
|
|
|
f92ce9 |
assert ecount == 0
|
|
|
f92ce9 |
assert dcount == (plus_all_ecount + plus_all_dcount)
|
|
|
f92ce9 |
|
|
|
f92ce9 |
-def test_ticket47838_run_3(topology):
|
|
|
f92ce9 |
+def test_ticket47838_run_4(topology):
|
|
|
f92ce9 |
"""
|
|
|
f92ce9 |
Check no nsSSL3Ciphers
|
|
|
f92ce9 |
Default ciphers are enabled.
|
|
|
f92ce9 |
"""
|
|
|
f92ce9 |
- _header(topology, 'Test Case 4 - Check no nssSSL3Chiphers (default setting)')
|
|
|
f92ce9 |
+ _header(topology, 'Test Case 5 - Check no nssSSL3Chiphers (default setting)')
|
|
|
f92ce9 |
|
|
|
f92ce9 |
topology.standalone.simple_bind_s(DN_DM, PASSWORD)
|
|
|
f92ce9 |
topology.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_DELETE, 'nsSSL3Ciphers', '-all')])
|
|
|
f92ce9 |
|
|
|
f92ce9 |
log.info("\n######################### Restarting the server ######################\n")
|
|
|
f92ce9 |
topology.standalone.stop(timeout=10)
|
|
|
f92ce9 |
- os.system('mv %s %s.47838_2' % (topology.standalone.errlog, topology.standalone.errlog))
|
|
|
f92ce9 |
+ os.system('mv %s %s.47838_3' % (topology.standalone.errlog, topology.standalone.errlog))
|
|
|
f92ce9 |
os.system('touch %s' % (topology.standalone.errlog))
|
|
|
f92ce9 |
topology.standalone.start(timeout=120)
|
|
|
f92ce9 |
|
|
|
f92ce9 |
- enabled = os.popen('egrep "SSL alert:" %s | egrep enabled | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
- disabled = os.popen('egrep "SSL alert:" %s | egrep disabled | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
+ enabled = os.popen('egrep "SSL alert:" %s | egrep \": enabled\" | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
+ disabled = os.popen('egrep "SSL alert:" %s | egrep \": disabled\" | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
ecount = int(enabled.readline().rstrip())
|
|
|
f92ce9 |
dcount = int(disabled.readline().rstrip())
|
|
|
f92ce9 |
|
|
|
f92ce9 |
@@ -327,29 +365,29 @@ def test_ticket47838_run_3(topology):
|
|
|
f92ce9 |
global plus_all_dcount
|
|
|
f92ce9 |
assert ecount == 12
|
|
|
f92ce9 |
assert dcount == (plus_all_ecount + plus_all_dcount - ecount)
|
|
|
f92ce9 |
- weak = os.popen('egrep "SSL alert:" %s | egrep enabled | egrep "WEAK CIPHER" | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
+ weak = os.popen('egrep "SSL alert:" %s | egrep \": enabled\" | egrep "WEAK CIPHER" | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
wcount = int(weak.readline().rstrip())
|
|
|
f92ce9 |
log.info("Weak ciphers in the default setting: %d" % wcount)
|
|
|
f92ce9 |
assert wcount == 0
|
|
|
f92ce9 |
|
|
|
f92ce9 |
-def test_ticket47838_run_4(topology):
|
|
|
f92ce9 |
+def test_ticket47838_run_5(topology):
|
|
|
f92ce9 |
"""
|
|
|
f92ce9 |
Check nsSSL3Ciphers: default
|
|
|
f92ce9 |
Default ciphers are enabled.
|
|
|
f92ce9 |
"""
|
|
|
f92ce9 |
- _header(topology, 'Test Case 5 - Check default nssSSL3Chiphers (default setting)')
|
|
|
f92ce9 |
+ _header(topology, 'Test Case 6 - Check default nssSSL3Chiphers (default setting)')
|
|
|
f92ce9 |
|
|
|
f92ce9 |
topology.standalone.simple_bind_s(DN_DM, PASSWORD)
|
|
|
f92ce9 |
topology.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', 'default')])
|
|
|
f92ce9 |
|
|
|
f92ce9 |
log.info("\n######################### Restarting the server ######################\n")
|
|
|
f92ce9 |
topology.standalone.stop(timeout=10)
|
|
|
f92ce9 |
- os.system('mv %s %s.47838_3' % (topology.standalone.errlog, topology.standalone.errlog))
|
|
|
f92ce9 |
+ os.system('mv %s %s.47838_4' % (topology.standalone.errlog, topology.standalone.errlog))
|
|
|
f92ce9 |
os.system('touch %s' % (topology.standalone.errlog))
|
|
|
f92ce9 |
topology.standalone.start(timeout=120)
|
|
|
f92ce9 |
|
|
|
f92ce9 |
- enabled = os.popen('egrep "SSL alert:" %s | egrep enabled | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
- disabled = os.popen('egrep "SSL alert:" %s | egrep disabled | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
+ enabled = os.popen('egrep "SSL alert:" %s | egrep \": enabled\" | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
+ disabled = os.popen('egrep "SSL alert:" %s | egrep \": disabled\" | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
ecount = int(enabled.readline().rstrip())
|
|
|
f92ce9 |
dcount = int(disabled.readline().rstrip())
|
|
|
f92ce9 |
|
|
|
f92ce9 |
@@ -359,29 +397,29 @@ def test_ticket47838_run_4(topology):
|
|
|
f92ce9 |
global plus_all_dcount
|
|
|
f92ce9 |
assert ecount == 12
|
|
|
f92ce9 |
assert dcount == (plus_all_ecount + plus_all_dcount - ecount)
|
|
|
f92ce9 |
- weak = os.popen('egrep "SSL alert:" %s | egrep enabled | egrep "WEAK CIPHER" | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
+ weak = os.popen('egrep "SSL alert:" %s | egrep \": enabled\" | egrep "WEAK CIPHER" | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
wcount = int(weak.readline().rstrip())
|
|
|
f92ce9 |
log.info("Weak ciphers in the default setting: %d" % wcount)
|
|
|
f92ce9 |
assert wcount == 0
|
|
|
f92ce9 |
|
|
|
f92ce9 |
-def test_ticket47838_run_5(topology):
|
|
|
f92ce9 |
+def test_ticket47838_run_6(topology):
|
|
|
f92ce9 |
"""
|
|
|
f92ce9 |
Check nssSSL3Chiphers: +all,-rsa_rc4_128_md5
|
|
|
f92ce9 |
All ciphers are disabled.
|
|
|
f92ce9 |
"""
|
|
|
f92ce9 |
- _header(topology, 'Test Case 6 - Check nssSSL3Chiphers: +all,-rsa_rc4_128_md5')
|
|
|
f92ce9 |
+ _header(topology, 'Test Case 7 - Check nssSSL3Chiphers: +all,-tls_dhe_rsa_aes_128_gcm_sha')
|
|
|
f92ce9 |
|
|
|
f92ce9 |
topology.standalone.simple_bind_s(DN_DM, PASSWORD)
|
|
|
f92ce9 |
- topology.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', '+all,-rsa_rc4_128_md5')])
|
|
|
f92ce9 |
+ topology.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', '+all,-tls_dhe_rsa_aes_128_gcm_sha')])
|
|
|
f92ce9 |
|
|
|
f92ce9 |
log.info("\n######################### Restarting the server ######################\n")
|
|
|
f92ce9 |
topology.standalone.stop(timeout=10)
|
|
|
f92ce9 |
- os.system('mv %s %s.47838_4' % (topology.standalone.errlog, topology.standalone.errlog))
|
|
|
f92ce9 |
+ os.system('mv %s %s.47838_5' % (topology.standalone.errlog, topology.standalone.errlog))
|
|
|
f92ce9 |
os.system('touch %s' % (topology.standalone.errlog))
|
|
|
f92ce9 |
topology.standalone.start(timeout=120)
|
|
|
f92ce9 |
|
|
|
f92ce9 |
- enabled = os.popen('egrep "SSL alert:" %s | egrep enabled | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
- disabled = os.popen('egrep "SSL alert:" %s | egrep disabled | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
+ enabled = os.popen('egrep "SSL alert:" %s | egrep \": enabled\" | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
+ disabled = os.popen('egrep "SSL alert:" %s | egrep \": disabled\" | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
ecount = int(enabled.readline().rstrip())
|
|
|
f92ce9 |
dcount = int(disabled.readline().rstrip())
|
|
|
f92ce9 |
|
|
|
f92ce9 |
@@ -389,27 +427,29 @@ def test_ticket47838_run_5(topology):
|
|
|
f92ce9 |
log.info("Disabled ciphers: %d" % dcount)
|
|
|
f92ce9 |
global plus_all_ecount
|
|
|
f92ce9 |
global plus_all_dcount
|
|
|
f92ce9 |
+ log.info("ALL Ecount: %d" % plus_all_ecount)
|
|
|
f92ce9 |
+ log.info("ALL Dcount: %d" % plus_all_dcount)
|
|
|
f92ce9 |
assert ecount == (plus_all_ecount - 1)
|
|
|
f92ce9 |
assert dcount == (plus_all_dcount + 1)
|
|
|
f92ce9 |
|
|
|
f92ce9 |
-def test_ticket47838_run_6(topology):
|
|
|
f92ce9 |
+def test_ticket47838_run_7(topology):
|
|
|
f92ce9 |
"""
|
|
|
f92ce9 |
Check nssSSL3Chiphers: -all,+rsa_rc4_128_md5
|
|
|
f92ce9 |
All ciphers are disabled.
|
|
|
f92ce9 |
"""
|
|
|
f92ce9 |
- _header(topology, 'Test Case 7 - Check nssSSL3Chiphers: -all,+rsa_rc4_128_md5')
|
|
|
f92ce9 |
+ _header(topology, 'Test Case 8 - Check nssSSL3Chiphers: -all,+rsa_rc4_128_md5')
|
|
|
f92ce9 |
|
|
|
f92ce9 |
topology.standalone.simple_bind_s(DN_DM, PASSWORD)
|
|
|
f92ce9 |
topology.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', '-all,+rsa_rc4_128_md5')])
|
|
|
f92ce9 |
|
|
|
f92ce9 |
log.info("\n######################### Restarting the server ######################\n")
|
|
|
f92ce9 |
topology.standalone.stop(timeout=10)
|
|
|
f92ce9 |
- os.system('mv %s %s.47838_5' % (topology.standalone.errlog, topology.standalone.errlog))
|
|
|
f92ce9 |
+ os.system('mv %s %s.47838_6' % (topology.standalone.errlog, topology.standalone.errlog))
|
|
|
f92ce9 |
os.system('touch %s' % (topology.standalone.errlog))
|
|
|
f92ce9 |
topology.standalone.start(timeout=120)
|
|
|
f92ce9 |
|
|
|
f92ce9 |
- enabled = os.popen('egrep "SSL alert:" %s | egrep enabled | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
- disabled = os.popen('egrep "SSL alert:" %s | egrep disabled | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
+ enabled = os.popen('egrep "SSL alert:" %s | egrep \": enabled\" | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
+ disabled = os.popen('egrep "SSL alert:" %s | egrep \": disabled\" | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
ecount = int(enabled.readline().rstrip())
|
|
|
f92ce9 |
dcount = int(disabled.readline().rstrip())
|
|
|
f92ce9 |
|
|
|
f92ce9 |
@@ -420,25 +460,59 @@ def test_ticket47838_run_6(topology):
|
|
|
f92ce9 |
assert ecount == 1
|
|
|
f92ce9 |
assert dcount == (plus_all_ecount + plus_all_dcount - ecount)
|
|
|
f92ce9 |
|
|
|
f92ce9 |
-def test_ticket47838_run_7(topology):
|
|
|
f92ce9 |
+def test_ticket47838_run_8(topology):
|
|
|
f92ce9 |
+ """
|
|
|
f92ce9 |
+ Check nsSSL3Ciphers: default + allowWeakCipher: off
|
|
|
f92ce9 |
+ Strong Default ciphers are enabled.
|
|
|
f92ce9 |
+ """
|
|
|
f92ce9 |
+ _header(topology, 'Test Case 9 - Check default nssSSL3Chiphers (default setting + allowWeakCipher: off)')
|
|
|
f92ce9 |
+
|
|
|
f92ce9 |
+ topology.standalone.simple_bind_s(DN_DM, PASSWORD)
|
|
|
f92ce9 |
+ topology.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', 'default'),
|
|
|
f92ce9 |
+ (ldap.MOD_REPLACE, 'allowWeakCipher', 'off')])
|
|
|
f92ce9 |
+
|
|
|
f92ce9 |
+ log.info("\n######################### Restarting the server ######################\n")
|
|
|
f92ce9 |
+ topology.standalone.stop(timeout=10)
|
|
|
f92ce9 |
+ os.system('mv %s %s.47838_7' % (topology.standalone.errlog, topology.standalone.errlog))
|
|
|
f92ce9 |
+ os.system('touch %s' % (topology.standalone.errlog))
|
|
|
f92ce9 |
+ topology.standalone.start(timeout=120)
|
|
|
f92ce9 |
+
|
|
|
f92ce9 |
+ enabled = os.popen('egrep "SSL alert:" %s | egrep \": enabled\" | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
+ disabled = os.popen('egrep "SSL alert:" %s | egrep \": disabled\" | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
+ ecount = int(enabled.readline().rstrip())
|
|
|
f92ce9 |
+ dcount = int(disabled.readline().rstrip())
|
|
|
f92ce9 |
+
|
|
|
f92ce9 |
+ log.info("Enabled ciphers: %d" % ecount)
|
|
|
f92ce9 |
+ log.info("Disabled ciphers: %d" % dcount)
|
|
|
f92ce9 |
+ global plus_all_ecount
|
|
|
f92ce9 |
+ global plus_all_dcount
|
|
|
f92ce9 |
+ assert ecount == 12
|
|
|
f92ce9 |
+ assert dcount == (plus_all_ecount + plus_all_dcount - ecount)
|
|
|
f92ce9 |
+ weak = os.popen('egrep "SSL alert:" %s | egrep \": enabled\" | egrep "WEAK CIPHER" | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
+ wcount = int(weak.readline().rstrip())
|
|
|
f92ce9 |
+ log.info("Weak ciphers in the default setting: %d" % wcount)
|
|
|
f92ce9 |
+ assert wcount == 0
|
|
|
f92ce9 |
+
|
|
|
f92ce9 |
+def test_ticket47838_run_9(topology):
|
|
|
f92ce9 |
"""
|
|
|
f92ce9 |
Check no nsSSL3Ciphers
|
|
|
f92ce9 |
Default ciphers are enabled.
|
|
|
f92ce9 |
"""
|
|
|
f92ce9 |
- _header(topology, 'Test Case 8 - Check no nssSSL3Chiphers (default setting) with no errorlog-level')
|
|
|
f92ce9 |
+ _header(topology, 'Test Case 10 - Check no nssSSL3Chiphers (default setting) with no errorlog-level')
|
|
|
f92ce9 |
|
|
|
f92ce9 |
topology.standalone.simple_bind_s(DN_DM, PASSWORD)
|
|
|
f92ce9 |
- topology.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', None)])
|
|
|
f92ce9 |
+ topology.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', None),
|
|
|
f92ce9 |
+ (ldap.MOD_REPLACE, 'allowWeakCipher', 'on')])
|
|
|
f92ce9 |
topology.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', None)])
|
|
|
f92ce9 |
|
|
|
f92ce9 |
log.info("\n######################### Restarting the server ######################\n")
|
|
|
f92ce9 |
topology.standalone.stop(timeout=10)
|
|
|
f92ce9 |
- os.system('mv %s %s.47838_6' % (topology.standalone.errlog, topology.standalone.errlog))
|
|
|
f92ce9 |
+ os.system('mv %s %s.47838_8' % (topology.standalone.errlog, topology.standalone.errlog))
|
|
|
f92ce9 |
os.system('touch %s' % (topology.standalone.errlog))
|
|
|
f92ce9 |
topology.standalone.start(timeout=120)
|
|
|
f92ce9 |
|
|
|
f92ce9 |
- enabled = os.popen('egrep "SSL alert:" %s | egrep enabled | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
- disabled = os.popen('egrep "SSL alert:" %s | egrep disabled | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
+ enabled = os.popen('egrep "SSL alert:" %s | egrep \": enabled\" | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
+ disabled = os.popen('egrep "SSL alert:" %s | egrep \": disabled\" | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
ecount = int(enabled.readline().rstrip())
|
|
|
f92ce9 |
dcount = int(disabled.readline().rstrip())
|
|
|
f92ce9 |
|
|
|
f92ce9 |
@@ -446,12 +520,12 @@ def test_ticket47838_run_7(topology):
|
|
|
f92ce9 |
log.info("Disabled ciphers: %d" % dcount)
|
|
|
f92ce9 |
assert ecount == 12
|
|
|
f92ce9 |
assert dcount == 0
|
|
|
f92ce9 |
- weak = os.popen('egrep "SSL alert:" %s | egrep enabled | egrep "WEAK CIPHER" | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
+ weak = os.popen('egrep "SSL alert:" %s | egrep \": enabled\" | egrep "WEAK CIPHER" | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
wcount = int(weak.readline().rstrip())
|
|
|
f92ce9 |
log.info("Weak ciphers in the default setting: %d" % wcount)
|
|
|
f92ce9 |
assert wcount == 0
|
|
|
f92ce9 |
|
|
|
f92ce9 |
-def test_ticket47838_run_8(topology):
|
|
|
f92ce9 |
+def test_ticket47838_run_10(topology):
|
|
|
f92ce9 |
"""
|
|
|
f92ce9 |
Check nssSSL3Chiphers: -TLS_RSA_WITH_NULL_MD5,+TLS_RSA_WITH_RC4_128_MD5,
|
|
|
f92ce9 |
+TLS_RSA_EXPORT_WITH_RC4_40_MD5,+TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5,
|
|
|
f92ce9 |
@@ -462,7 +536,7 @@ def test_ticket47838_run_8(topology):
|
|
|
f92ce9 |
-SSL_CK_RC2_128_CBC_WITH_MD5,-SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5,
|
|
|
f92ce9 |
-SSL_CK_DES_64_CBC_WITH_MD5,-SSL_CK_DES_192_EDE3_CBC_WITH_MD5
|
|
|
f92ce9 |
"""
|
|
|
f92ce9 |
- _header(topology, 'Test Case 9 - Check nssSSL3Chiphers: long list using the NSS Cipher Suite name')
|
|
|
f92ce9 |
+ _header(topology, 'Test Case 11 - Check nssSSL3Chiphers: long list using the NSS Cipher Suite name')
|
|
|
f92ce9 |
|
|
|
f92ce9 |
topology.standalone.simple_bind_s(DN_DM, PASSWORD)
|
|
|
f92ce9 |
topology.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers',
|
|
|
f92ce9 |
@@ -470,12 +544,12 @@ def test_ticket47838_run_8(topology):
|
|
|
f92ce9 |
|
|
|
f92ce9 |
log.info("\n######################### Restarting the server ######################\n")
|
|
|
f92ce9 |
topology.standalone.stop(timeout=10)
|
|
|
f92ce9 |
- os.system('mv %s %s.47838_7' % (topology.standalone.errlog, topology.standalone.errlog))
|
|
|
f92ce9 |
+ os.system('mv %s %s.47838_9' % (topology.standalone.errlog, topology.standalone.errlog))
|
|
|
f92ce9 |
os.system('touch %s' % (topology.standalone.errlog))
|
|
|
f92ce9 |
topology.standalone.start(timeout=120)
|
|
|
f92ce9 |
|
|
|
f92ce9 |
- enabled = os.popen('egrep "SSL alert:" %s | egrep enabled | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
- disabled = os.popen('egrep "SSL alert:" %s | egrep disabled | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
+ enabled = os.popen('egrep "SSL alert:" %s | egrep \": enabled\" | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
+ disabled = os.popen('egrep "SSL alert:" %s | egrep \": disabled\" | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
ecount = int(enabled.readline().rstrip())
|
|
|
f92ce9 |
dcount = int(disabled.readline().rstrip())
|
|
|
f92ce9 |
|
|
|
f92ce9 |
@@ -485,32 +559,56 @@ def test_ticket47838_run_8(topology):
|
|
|
f92ce9 |
global plus_all_dcount
|
|
|
f92ce9 |
assert ecount == 9
|
|
|
f92ce9 |
assert dcount == 0
|
|
|
f92ce9 |
- weak = os.popen('egrep "SSL alert:" %s | egrep enabled | egrep "WEAK CIPHER" | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
+ weak = os.popen('egrep "SSL alert:" %s | egrep \": enabled\" | egrep "WEAK CIPHER" | wc -l' % topology.standalone.errlog)
|
|
|
f92ce9 |
wcount = int(weak.readline().rstrip())
|
|
|
f92ce9 |
log.info("Weak ciphers in the default setting: %d" % wcount)
|
|
|
f92ce9 |
|
|
|
f92ce9 |
-def test_ticket47838_run_9(topology):
|
|
|
f92ce9 |
+ topology.standalone.log.info("ticket47838 was successfully verified.");
|
|
|
f92ce9 |
+
|
|
|
f92ce9 |
+def test_ticket47838_run_11(topology):
|
|
|
f92ce9 |
+ """
|
|
|
f92ce9 |
+ Check nssSSL3Chiphers: +fortezza
|
|
|
f92ce9 |
+ SSL_GetImplementedCiphers does not return this as a secuire cipher suite
|
|
|
f92ce9 |
+ """
|
|
|
f92ce9 |
+ _header(topology, 'Test Case 12 - Check nssSSL3Chiphers: +fortezza, which is not supported')
|
|
|
f92ce9 |
+
|
|
|
f92ce9 |
+ topology.standalone.simple_bind_s(DN_DM, PASSWORD)
|
|
|
f92ce9 |
+ topology.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', '+fortezza')])
|
|
|
f92ce9 |
+
|
|
|
f92ce9 |
+ log.info("\n######################### Restarting the server ######################\n")
|
|
|
f92ce9 |
+ topology.standalone.stop(timeout=10)
|
|
|
f92ce9 |
+ os.system('mv %s %s.47838_10' % (topology.standalone.errlog, topology.standalone.errlog))
|
|
|
f92ce9 |
+ os.system('touch %s' % (topology.standalone.errlog))
|
|
|
f92ce9 |
+ topology.standalone.start(timeout=120)
|
|
|
f92ce9 |
+
|
|
|
f92ce9 |
+ errmsg = os.popen('egrep "SSL alert:" %s | egrep "is not available in NSS"' % topology.standalone.errlog)
|
|
|
f92ce9 |
+ if errmsg != "":
|
|
|
f92ce9 |
+ log.info("Expected error message:")
|
|
|
f92ce9 |
+ log.info("%s" % errmsg.readline())
|
|
|
f92ce9 |
+ else:
|
|
|
f92ce9 |
+ log.info("Expected error message was not found")
|
|
|
f92ce9 |
+ assert False
|
|
|
f92ce9 |
+
|
|
|
f92ce9 |
+def test_ticket47838_run_last(topology):
|
|
|
f92ce9 |
"""
|
|
|
f92ce9 |
- NOTE: Currently, this test case is commented out since if the server fails to start,
|
|
|
f92ce9 |
- it repeatedly restarted.
|
|
|
f92ce9 |
Check nssSSL3Chiphers: all <== invalid value
|
|
|
f92ce9 |
All ciphers are disabled.
|
|
|
f92ce9 |
"""
|
|
|
f92ce9 |
- _header(topology, 'Test Case 10 - Check nssSSL3Chiphers: all, which is invalid')
|
|
|
f92ce9 |
+ _header(topology, 'Test Case 13 - Check nssSSL3Chiphers: all, which is invalid')
|
|
|
f92ce9 |
|
|
|
f92ce9 |
topology.standalone.simple_bind_s(DN_DM, PASSWORD)
|
|
|
f92ce9 |
topology.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', 'all')])
|
|
|
f92ce9 |
|
|
|
f92ce9 |
log.info("\n######################### Restarting the server ######################\n")
|
|
|
f92ce9 |
topology.standalone.stop(timeout=10)
|
|
|
f92ce9 |
- os.system('mv %s %s.47838_7' % (topology.standalone.errlog, topology.standalone.errlog))
|
|
|
f92ce9 |
+ os.system('mv %s %s.47838_10' % (topology.standalone.errlog, topology.standalone.errlog))
|
|
|
f92ce9 |
os.system('touch %s' % (topology.standalone.errlog))
|
|
|
f92ce9 |
topology.standalone.start(timeout=120)
|
|
|
f92ce9 |
|
|
|
f92ce9 |
- errmsg = os.popen('egrep "SSL alert:" %s | egrep "invalid ciphers"' % topology.standalone.errlog)
|
|
|
f92ce9 |
+ errmsg = os.popen('egrep "SSL alert:" %s | egrep "invalid ciphers"' % topology.standalone.errlog)
|
|
|
f92ce9 |
if errmsg != "":
|
|
|
f92ce9 |
log.info("Expected error message:")
|
|
|
f92ce9 |
- log.info("%s" % errmsg)
|
|
|
f92ce9 |
+ log.info("%s" % errmsg.readline())
|
|
|
f92ce9 |
else:
|
|
|
f92ce9 |
log.info("Expected error message was not found")
|
|
|
f92ce9 |
assert False
|
|
|
f92ce9 |
@@ -519,6 +617,9 @@ def test_ticket47838_run_9(topology):
|
|
|
f92ce9 |
|
|
|
f92ce9 |
def test_ticket47838_final(topology):
|
|
|
f92ce9 |
topology.standalone.simple_bind_s(DN_DM, PASSWORD)
|
|
|
f92ce9 |
+ topology.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', None)])
|
|
|
f92ce9 |
+ topology.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', 'default'),
|
|
|
f92ce9 |
+ (ldap.MOD_REPLACE, 'allowWeakCipher', 'on')])
|
|
|
f92ce9 |
topology.standalone.stop(timeout=10)
|
|
|
f92ce9 |
|
|
|
f92ce9 |
def run_isolated():
|
|
|
f92ce9 |
@@ -544,7 +645,11 @@ def run_isolated():
|
|
|
f92ce9 |
test_ticket47838_run_6(topo)
|
|
|
f92ce9 |
test_ticket47838_run_7(topo)
|
|
|
f92ce9 |
test_ticket47838_run_8(topo)
|
|
|
f92ce9 |
- # test_ticket47838_run_9(topo)
|
|
|
f92ce9 |
+ test_ticket47838_run_9(topo)
|
|
|
f92ce9 |
+ test_ticket47838_run_10(topo)
|
|
|
f92ce9 |
+ test_ticket47838_run_11(topo)
|
|
|
f92ce9 |
+
|
|
|
f92ce9 |
+ test_ticket47838_run_last(topo)
|
|
|
f92ce9 |
|
|
|
f92ce9 |
test_ticket47838_final(topo)
|
|
|
f92ce9 |
|
|
|
f92ce9 |
--
|
|
|
f92ce9 |
1.9.3
|
|
|
f92ce9 |
|