Skip to content

Latest commit

 

History

History
132 lines (87 loc) · 2.47 KB

audit.rst

File metadata and controls

132 lines (87 loc) · 2.47 KB

Audit

Examples

sys_audit

audit_devices = client.sys.list_enabled_audit_devices()

options = {

'path': '/tmp/vault.log', 'log_raw': True,

}

client.sys.enable_audit_device('file', options=options, path='somefile') client.sys.disable_audit_device('oldfile')

List Enabled Audit Devices

hvac.api.system_backend.Audit.list_enabled_audit_devices

Examples

sys_audit

import hvac client = hvac.Client(url='https://127.0.0.1:8200')

enabled_audit_devices = client.sys.list_enabled_audit_devices() print('The following audit devices are enabled: {audit_devices_list}'.format( audit_devices_list=', '.join(enabled_audit_devices['data'].keys()), ))

Example output:

sys_audit

The following audit devices are enabled: somefile/

Enable Audit Device

hvac.api.system_backend.Audit.enable_audit_device

Examples

sys_audit

import hvac client = hvac.Client(url='https://127.0.0.1:8200')

options = {

'path': '/tmp/vault.audit.log'

}

client.sys.enable_audit_device(

device_type='file', options=options, path='tmp-file-audit',

)

Disable Audit Device

hvac.api.system_backend.Audit.disable_audit_device

Examples

sys_audit

import hvac client = hvac.Client(url='https://127.0.0.1:8200')

client.sys.disable_audit_device(

path='tmp-file-audit',

)

Calculate Hash

hvac.api.system_backend.Audit.calculate_hash

Examples

sys_audit_calculate_hash

options = {

'path': '/tmp/vault.audit.log'

}

client.sys.enable_audit_device(

device_type='file', options=options, path='tmp-file-audit',

)

sys_audit_calculate_hash

import hvac client = hvac.Client(url='https://127.0.0.1:8200')

input_to_hash = 'some sort of string thinger'

audit_hash = client.sys.calculate_hash(

path='tmp-file-audit', input_to_hash=input_to_hash,

)

print('The hash for the provided input is: %s' % audit_hash['data']['hash'])

Example output:

sys_audit_calculate_hash

The hash for the provided input is: hmac-sha256:...