How to use bless - 10 common examples

To help you get started, we’ve selected a few bless examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Netflix / bless / tests / aws_lambda / test_bless_lambda.py View on Github external
def test_invalid_request_with_mismatched_bastion_and_remote():
    '''
    Test default kmsauth behavior, that a bastion_user and remote_usernames must match
    :return: 
    '''
    output = lambda_handler(INVALID_TEST_KMSAUTH_REQUEST_USERNAME_DOESNT_MATCH_REMOTE, context=Context,
                            ca_private_key_password=RSA_CA_PRIVATE_KEY_PASSWORD,
                            entropy_check=False,
                            config_file=os.path.join(os.path.dirname(__file__),
                                                     'bless-test-kmsauth.cfg'))
    assert output['errorType'] == 'KMSAuthValidationError'
github Netflix / bless / tests / aws_lambda / test_bless_lambda.py View on Github external
def test_invalid_uncompressed_with_bz2(monkeypatch):
    extra_environment_variables = {
        'bless_ca_default_password': '',
        'bless_ca_ca_private_key_file': 'tests/aws_lambda/only-use-for-unit-tests.pem',
        'bless_ca_ca_private_key_compression': 'bz2',
        'bless_options_username_validation': 'email',
        'bless_options_remote_usernames_validation': 'useradd',
    }

    for k, v in extra_environment_variables.items():
        monkeypatch.setenv(k, v)

    with pytest.raises(OSError):
        lambda_handler(VALID_TEST_REQUEST_USERNAME_VALIDATION_EMAIL_REMOTE_USERNAMES_USERADD, context=Context,
                       ca_private_key_password=RSA_CA_PRIVATE_KEY_PASSWORD,
                       entropy_check=False,
                       config_file=os.path.join(os.path.dirname(__file__), ''))
github Netflix / bless / tests / aws_lambda / test_bless_lambda.py View on Github external
def test_basic_ca_private_key_env_zlib(monkeypatch):
    extra_environment_variables = {
        'bless_ca_default_password': '',
        'bless_ca_ca_private_key': 'eJxtl7XOxYqOhfs8xelzj8J0u3Cywwxddphhh59+/pl63FqyLOtby/a///4FJ8qq+Y/rsf/YrhqyvviPJib/m/gXsLc5/9d/lvK//+D/EU3eTWxfFABB1P5Vp2r+7z+s6P2LoPS/PMf/hycwHGEIikYlVBAonCNR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wckg3Jim+fdIcyTKKuwuNxnxEiXD4Mtu7LsLGEPB/X4xoCv//d/M/z4BBFQ==',
        'bless_ca_ca_private_key_compression': 'zlib',
        'bless_options_username_validation': 'email',
        'bless_options_remote_usernames_validation': 'useradd',
    }

    for k, v in extra_environment_variables.items():
        monkeypatch.setenv(k, v)

    output = lambda_handler(VALID_TEST_REQUEST_USERNAME_VALIDATION_EMAIL_REMOTE_USERNAMES_USERADD, context=Context,
                            ca_private_key_password=RSA_CA_PRIVATE_KEY_PASSWORD,
                            entropy_check=False,
                            config_file=os.path.join(os.path.dirname(__file__), ''))
    assert output['certificate'].startswith('ssh-rsa-cert-v01@openssh.com ')
github Netflix / bless / tests / aws_lambda / test_bless_lambda.py View on Github external
def test_local_request_with_multiple_principals():
    output = lambda_handler(VALID_TEST_REQUEST_MULTIPLE_PRINCIPALS, context=Context,
                            ca_private_key_password=RSA_CA_PRIVATE_KEY_PASSWORD,
                            entropy_check=False,
                            config_file=os.path.join(os.path.dirname(__file__),
                                                     'bless-test.cfg'))
    assert output['certificate'].startswith('ssh-rsa-cert-v01@openssh.com ')
github Netflix / bless / tests / aws_lambda / test_bless_lambda.py View on Github external
def test_basic_local_unused_kmsauth_request():
    output = lambda_handler(VALID_TEST_REQUEST_KMSAUTH, context=Context,
                            ca_private_key_password=RSA_CA_PRIVATE_KEY_PASSWORD,
                            entropy_check=False,
                            config_file=os.path.join(os.path.dirname(__file__), 'bless-test.cfg'))
    assert output['certificate'].startswith('ssh-rsa-cert-v01@openssh.com ')
github Netflix / bless / tests / aws_lambda / test_bless_lambda.py View on Github external
def test_invalid_request_with_unallowed_remote():
    output = lambda_handler(INVALID_TEST_KMSAUTH_REQUEST_DIFFERENT_REMOTE_USER, context=Context,
                            ca_private_key_password=RSA_CA_PRIVATE_KEY_PASSWORD,
                            entropy_check=False,
                            config_file=os.path.join(os.path.dirname(__file__),
                                                     'bless-test-kmsauth-different-remote.cfg'))
    assert output['errorType'] == 'KMSAuthValidationError'
github Netflix / bless / tests / aws_lambda / test_bless_lambda.py View on Github external
def test_local_request_config_not_found():
    with pytest.raises(ValueError):
        lambda_handler(VALID_TEST_REQUEST, context=Context,
                       ca_private_key_password=RSA_CA_PRIVATE_KEY_PASSWORD,
                       entropy_check=False,
                       config_file=os.path.join(os.path.dirname(__file__), 'none'))
github Netflix / bless / tests / aws_lambda / test_bless_lambda.py View on Github external
def test_basic_local_username_validation_disabled(monkeypatch):
    extra_environment_variables = {
        'bless_ca_default_password': '',
        'bless_ca_ca_private_key_file': 'tests/aws_lambda/only-use-for-unit-tests.pem',
        'bless_options_username_validation': 'disabled',
        'bless_options_remote_usernames_validation': 'disabled',
    }

    for k, v in extra_environment_variables.items():
        monkeypatch.setenv(k, v)

    output = lambda_handler(VALID_TEST_REQUEST_USERNAME_VALIDATION_DISABLED, context=Context,
                            ca_private_key_password=RSA_CA_PRIVATE_KEY_PASSWORD,
                            entropy_check=False,
                            config_file=os.path.join(os.path.dirname(__file__), ''))
    assert output['certificate'].startswith('ssh-rsa-cert-v01@openssh.com ')
github Netflix / bless / tests / aws_lambda / test_bless_lambda.py View on Github external
def test_invalid_username_request():
    output = lambda_handler(INVALID_TEST_REQUEST_USERNAME_INVALID, context=Context,
                            ca_private_key_password=RSA_CA_PRIVATE_KEY_PASSWORD,
                            entropy_check=False,
                            config_file=os.path.join(os.path.dirname(__file__),
                                                     'bless-test.cfg'))
    assert output['errorType'] == 'InputValidationError'
github Netflix / bless / tests / aws_lambda / test_bless_lambda.py View on Github external
def test_basic_ca_private_key_file_zlib(monkeypatch):
    extra_environment_variables = {
        'bless_ca_default_password': '',
        'bless_ca_ca_private_key_file': 'tests/aws_lambda/only-use-for-unit-tests.zlib',
        'bless_ca_ca_private_key_compression': 'zlib',
        'bless_options_username_validation': 'email',
        'bless_options_remote_usernames_validation': 'useradd',
    }

    for k, v in extra_environment_variables.items():
        monkeypatch.setenv(k, v)

    output = lambda_handler(VALID_TEST_REQUEST_USERNAME_VALIDATION_EMAIL_REMOTE_USERNAMES_USERADD, context=Context,
                            ca_private_key_password=RSA_CA_PRIVATE_KEY_PASSWORD,
                            entropy_check=False,
                            config_file=os.path.join(os.path.dirname(__file__), ''))
    assert output['certificate'].startswith('ssh-rsa-cert-v01@openssh.com ')