示例#1
0
def check_config_values(config, toolbox):
    """
    Validates the values for provided config in the [radius_server_challenge]
    section

    Args:
        config (ConfigDict): The config object to check the optional config for
        toolbox (ConfigTestToolbox): Toolbox used to execute the tests

    Returns:
        list of ConfigResult
    """
    problems = []
    config_test_resolver = base.get_basic_radius_server_resolver(
        config, toolbox)

    # Add radius server challenge specific keys
    config_test_resolver.update({
        'enroll_challenge':
        toolbox.test_is_bool,
        'prompt_format':
        functools.partial(toolbox.test_valid_enum,
                          enum=RADIUS_CHALLENGE_PROMPT_FORMATS,
                          transform=str.lower),
    })

    problems += base.run_config_value_checks(config, config_test_resolver)
    problems += base.check_for_unexpected_keys(config, toolbox,
                                               config_test_resolver)
    problems += base.check_basic_radius_server_protected_usage(config, toolbox)
    return problems
示例#2
0
def check_config_values(config, toolbox):
    """ Validates the values for provided config in the [radius_server_iframe] section

    Args:
        config (ConfigDict): The config object to check the optional config for
        toolbox (ConfigTestToolbox): Toolbox used to execute the tests

    Returns:
        list of ConfigResults
    """

    problems = []
    config_test_resolver = base.get_basic_radius_server_resolver(
        config, toolbox)

    # Add radius server iframe specific keys
    config_test_resolver.update({
        'type':
        functools.partial(toolbox.test_valid_enum,
                          enum=JS_TYPES,
                          transform=str.lower),
        'iframe_script_uri':
        toolbox.test_is_string,
        'script_inject':
        toolbox.test_is_string,
    })

    problems += base.run_config_value_checks(config, config_test_resolver)

    problems += base.check_for_unexpected_keys(config, toolbox,
                                               config_test_resolver)

    problems += base.check_basic_radius_server_protected_usage(config, toolbox)

    return problems
示例#3
0
def check_config_values(config, toolbox):
    """
    Validates the values for provided config in the [radius_server_concat]
    section

    Args:
        config (ConfigDict): The config object to check the optional config for
        toolbox (ConfigTestToolbox): Toolbox used to execute the tests

    Returns:
        list of ConfigResult
    """
    problems = []
    config_test_resolver = base.get_basic_radius_server_resolver(
        config, toolbox)

    # Add radius server concat specific keys
    config_test_resolver.update({
        'delimiter':
        toolbox.test_is_string,
        'delimited_password_length':
        toolbox.test_is_positive_int,
    })

    problems += base.run_config_value_checks(config, config_test_resolver)
    problems += base.check_for_unexpected_keys(config, toolbox,
                                               config_test_resolver)
    problems += base.check_basic_radius_server_protected_usage(config, toolbox)
    return problems
def check_config_values(config, toolbox):
    """ Validates the values for provided config in the [radius_server_auto] section

    Args:
        config (ConfigDict): The config object to check the optional config for
        toolbox (ConfigTestToolbox): Toolbox used to execute the tests

    Returns:
        list of BaseResult
    """

    problems = []
    config_test_resolver = base.get_basic_radius_server_resolver(config, toolbox)

    # Add radius server auto specific keys
    config_test_resolver.update({
        'factors': functools.partial(toolbox.test_valid_permutation,
                                     enum=['auto', 'push', 'phone', 'passcode'], separator=',', repeats=False),
        'delimiter': toolbox.test_is_string,
        'delimited_password_length': toolbox.test_is_positive_int,
        'allow_concat': toolbox.test_is_bool,
    })

    problems += base.run_config_value_checks(config, config_test_resolver)

    problems += base.check_for_unexpected_keys(config, toolbox, config_test_resolver)

    problems += base.check_basic_radius_server_protected_usage(config, toolbox)

    return problems
def check_config_values(config, toolbox):
    """
    Validates the values for provided config in the [radius_server_duo_only]
    section

    Args:
        config (ConfigDict): The config object to check the optional config for
        toolbox (ConfigTestToolbox): Toolbox used to execute the tests

    Returns:
        list of ConfigResult
    """
    problems = []
    config_test_resolver = base.get_basic_radius_server_resolver(
        config, toolbox)

    problems += base.run_config_value_checks(config, config_test_resolver)
    problems += base.check_for_unexpected_keys(config, toolbox,
                                               config_test_resolver)
    problems += base.check_basic_radius_server_protected_usage(config, toolbox)
    return problems
def check_config_values(config, toolbox):
    """
    Validates the values for provided config in the [radius_server_eap]
    section

    Args:
        config (ConfigDict): The config object to check the optional config for
        toolbox (ConfigTestToolbox): Toolbox used to execute the tests

    Returns:
        list of ConfigResult
    """
    problems = []
    config_test_resolver = base.get_basic_config_resolver(toolbox)

    # Add radius server eap specific keys
    config_test_resolver.update({
        'ikey':
        toolbox.test_is_ikey,
        'skey':
        toolbox.test_is_skey,
        'skey_protected':
        toolbox.test_is_string,
        'api_host':
        toolbox.test_is_string,
        'client':
        toolbox.test_is_string,
        'certs':
        toolbox.test_file_readable,
        'pkey':
        toolbox.test_file_readable,
        'port':
        toolbox.test_valid_port,
        'interface':
        toolbox.test_is_valid_single_ip,
        'factors':
        functools.partial(toolbox.test_valid_permutation,
                          enum=['auto', 'push', 'phone', 'passcode'],
                          separator=',',
                          repeats=False),
        'failmode':
        functools.partial(toolbox.test_valid_enum,
                          enum=['safe', 'secure'],
                          transform=str.lower),
        'minimum_tls_version':
        toolbox.test_is_tls_version,
        'cipher_list':
        toolbox.test_is_cipher_list,
        'prompt':
        toolbox.test_is_string,
        'allow_concat':
        toolbox.test_is_bool,
        'delimiter':
        toolbox.test_is_string,
        'delimited_password_length':
        toolbox.test_is_positive_int,
        'pass_through_attr_names':
        toolbox.test_is_string,
        'pw_codec':
        toolbox.test_is_codec,
        'client_ip_attr':
        toolbox.test_is_string,
        'http_proxy_host':
        toolbox.test_is_string,
        'http_proxy_port':
        toolbox.test_valid_port,
        'pass_through_all':
        toolbox.test_is_bool,
    })

    dynamic_test_resolver = {
        'radius_ip': toolbox.test_is_valid_ip,
        'radius_secret': toolbox.test_is_string,
        'radius_secret_protected': toolbox.test_is_string,
    }

    base.add_dynamic_keys_to_test_resolver(config, config_test_resolver,
                                           dynamic_test_resolver)
    problems += base.run_config_value_checks(config, config_test_resolver)
    problems += base.check_for_unexpected_keys(config, toolbox,
                                               config_test_resolver)
    problems += base.check_basic_radius_server_protected_usage(config, toolbox)
    return problems