Debian Codegraph @

dirsrvtests/tests/suites/password/pbkdf2_upgrade_plugin_test.py

raw
1 # --- BEGIN COPYRIGHT BLOCK ---
2 # Copyright (C) 2018 Red Hat, Inc.
3 # All rights reserved.
4 #
5 # License: GPL (version 3 or any later version).
6 # See LICENSE for details.
7 # --- END COPYRIGHT BLOCK ---
8 #
9 import pytest
10 from test389.topologies import topology_st
11 from lib389.password_plugins import PBKDF2SHA256Plugin
12 from lib389.utils import ds_is_older
13
14 pytestmark = pytest.mark.tier1
15
16 @pytest.mark.skipif(ds_is_older('1.4.1'), reason="Not implemented")
17 def test_pbkdf2_upgrade(topology_st):
18 """On upgrade pbkdf2 doesn't ship. We need to be able to
19 provide this on upgrade to make sure default hashes work.
20 However, password plugins are special - they need really
21 early bootstap so that setting the default has specs work.
22
23 This tests that the removal of the pbkdf2 plugin causes
24 it to be re-bootstrapped and added.
25
26 :id: c2198692-7c02-433b-af5b-3be54920571a
27 :setup: Single instance
28 :steps: 1. Remove the PBKDF2 plugin
29 2. Restart the server
30 3. Restart the server
31 :expectedresults:
32 1. Plugin is removed (IE pre-upgrade state)
33 2. The plugin is bootstrapped and added
34 3. No change (already bootstrapped)
35
36 """
37 # Remove the pbkdf2 plugin config
38 p1 = PBKDF2SHA256Plugin(topology_st.standalone)
39 assert(p1.exists())
40 p1._protected = False
41 p1.delete()
42 # Restart
43 topology_st.standalone.restart()
44 # check it's been readded.
45 p2 = PBKDF2SHA256Plugin(topology_st.standalone)
46 assert(p2.exists())
47 # Now restart to make sure we still work from the non-bootstrap form
48 topology_st.standalone.restart()
49 p3 = PBKDF2SHA256Plugin(topology_st.standalone)
50 assert(p3.exists())
51
52