def rootdn_setup(topology_st):
    """Initialize our setup to test the Root DN Access Control Plugin

    Test the following access control type:

    - Allowed IP address *
    - Denied IP address *
    - Specific time window
    - Days allowed access
    - Allowed host *
    - Denied host *

    * means multiple valued
    """

    log.info('Initializing root DN test suite...')

    # Enable dynamic plugins
    topology_st.standalone.config.set('nsslapd-dynamic-plugins', 'on')

    # Enable the plugin
    global plugin
    plugin = RootDNAccessControlPlugin(topology_st.standalone)
    plugin.enable()

    log.info('test_rootdn_init: Initialized root DN test suite.')
Beispiel #2
0
def topology(request):
    topology = default_topology(request)

    plugin = RootDNAccessControlPlugin(topology.standalone)
    if not plugin.exists():
        plugin.create()

    # we need to restart the server after enabling the plugin
    plugin.enable()
    topology.standalone.restart()
    topology.logcap.flush()

    return topology
Beispiel #3
0
def rootdn_setup(topology_st):
    """Initialize our setup to test the Root DN Access Control Plugin

    Test the following access control type:

    - Allowed IP address *
    - Denied IP address *
    - Specific time window
    - Days allowed access
    - Allowed host *
    - Denied host *

    * means mulitple valued
    """

    log.info('Initializing root DN test suite...')
    global inst
    inst = topology_st.standalone

    #
    # Set an aci so we can modify the plugin after we deny the Root DN
    #
    ACI = ('(target ="ldap:///cn=config")(targetattr = "*")(version 3.0' +
           ';acl "all access";allow (all)(userdn="ldap:///anyone");)')
    assert inst.config.set('aci', ACI)

    #
    # Create a user to modify the config
    #
    users = UserAccounts(inst, DEFAULT_SUFFIX)
    TEST_USER_PROPERTIES['userpassword'] = PASSWORD
    global user
    user = users.create(properties=TEST_USER_PROPERTIES)

    #
    # Enable dynamic plugins
    #
    assert inst.config.set('nsslapd-dynamic-plugins', 'on')

    #
    # Enable the plugin (after enabling dynamic plugins)
    #
    global plugin
    plugin = RootDNAccessControlPlugin(inst)
    plugin.enable()

    log.info('test_rootdn_init: Initialized root DN test suite.')