Documentation ¶
Index ¶
- func Hash(salter *salt.Salt, raw interface{}) error
- func HashString(salter *salt.Salt, data string) string
- func HashStructure(s interface{}, cb HashCallback) (interface{}, error)
- type AuditAuth
- type AuditFormatWriter
- type AuditFormatter
- type AuditRequest
- type AuditRequestEntry
- type AuditResponse
- type AuditResponseEntry
- type AuditSecret
- type AuditWrapInfo
- type Backend
- type BackendConfig
- type Factory
- type Formatter
- type FormatterConfig
- type HashCallback
- type JSONFormatWriter
- type JSONxFormatWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Hash ¶
Hash will hash the given type. This has built-in support for auth, requests, and responses. If it is a type that isn't recognized, then it will be passed through.
The structure is modified in-place.
func HashString ¶ added in v0.4.0
HashString hashes the given opaque string and returns it
func HashStructure ¶
func HashStructure(s interface{}, cb HashCallback) (interface{}, error)
HashStructure takes an interface and hashes all the values within the structure. Only _values_ are hashed: keys of objects are not.
For the HashCallback, see the built-in HashCallbacks below.
Types ¶
type AuditFormatWriter ¶ added in v0.6.2
type AuditFormatWriter interface { WriteRequest(io.Writer, *AuditRequestEntry) error WriteResponse(io.Writer, *AuditResponseEntry) error }
type AuditFormatter ¶ added in v0.6.2
type AuditFormatter struct {
AuditFormatWriter
}
AuditFormatter implements the Formatter interface, and allows the underlying marshaller to be swapped out
func (*AuditFormatter) FormatRequest ¶ added in v0.6.2
func (f *AuditFormatter) FormatRequest( w io.Writer, config FormatterConfig, auth *logical.Auth, req *logical.Request, err error) error
func (*AuditFormatter) FormatResponse ¶ added in v0.6.2
type AuditRequest ¶ added in v0.6.2
type AuditRequestEntry ¶ added in v0.6.2
type AuditRequestEntry struct { Time string `json:"time,omitempty"` Type string `json:"type"` Auth AuditAuth `json:"auth"` Request AuditRequest `json:"request"` Error string `json:"error"` }
AuditRequest is the structure of a request audit log entry in Audit.
type AuditResponse ¶ added in v0.6.2
type AuditResponse struct { Auth *AuditAuth `json:"auth,omitempty"` Secret *AuditSecret `json:"secret,omitempty"` Data map[string]interface{} `json:"data,omitempty"` Redirect string `json:"redirect,omitempty"` WrapInfo *AuditWrapInfo `json:"wrap_info,omitempty"` }
type AuditResponseEntry ¶ added in v0.6.2
type AuditResponseEntry struct { Time string `json:"time,omitempty"` Type string `json:"type"` Error string `json:"error"` Auth AuditAuth `json:"auth"` Request AuditRequest `json:"request"` Response AuditResponse `json:"response"` }
AuditResponseEntry is the structure of a response audit log entry in Audit.
type AuditSecret ¶ added in v0.6.2
type AuditSecret struct {
LeaseID string `json:"lease_id"`
}
type AuditWrapInfo ¶ added in v0.6.2
type Backend ¶
type Backend interface { // LogRequest is used to synchronously log a request. This is done after the // request is authorized but before the request is executed. The arguments // MUST not be modified in anyway. They should be deep copied if this is // a possibility. LogRequest(*logical.Auth, *logical.Request, error) error // LogResponse is used to synchronously log a response. This is done after // the request is processed but before the response is sent. The arguments // MUST not be modified in anyway. They should be deep copied if this is // a possibility. LogResponse(*logical.Auth, *logical.Request, *logical.Response, error) error // GetHash is used to return the given data with the backend's hash, // so that a caller can determine if a value in the audit log matches // an expected plaintext value GetHash(string) string // Reload is called on SIGHUP for supporting backends. Reload() error }
Backend interface must be implemented for an audit mechanism to be made available. Audit backends can be enabled to sink information to different backends such as logs, file, databases, or other external services.
type BackendConfig ¶ added in v0.3.0
type Factory ¶
type Factory func(*BackendConfig) (Backend, error)
Factory is the factory function to create an audit backend.
type Formatter ¶
type Formatter interface { FormatRequest(io.Writer, FormatterConfig, *logical.Auth, *logical.Request, error) error FormatResponse(io.Writer, FormatterConfig, *logical.Auth, *logical.Request, *logical.Response, error) error }
Formatter is an interface that is responsible for formating a request/response into some format. Formatters write their output to an io.Writer.
It is recommended that you pass data through Hash prior to formatting it.
type FormatterConfig ¶ added in v0.6.2
type HashCallback ¶
HashCallback is the callback called for HashStructure to hash a value.
type JSONFormatWriter ¶ added in v0.6.2
type JSONFormatWriter struct{}
JSONFormatWriter is an AuditFormatWriter implementation that structures data into a JSON format.
func (*JSONFormatWriter) WriteRequest ¶ added in v0.6.2
func (f *JSONFormatWriter) WriteRequest(w io.Writer, req *AuditRequestEntry) error
func (*JSONFormatWriter) WriteResponse ¶ added in v0.6.2
func (f *JSONFormatWriter) WriteResponse(w io.Writer, resp *AuditResponseEntry) error
type JSONxFormatWriter ¶ added in v0.6.2
type JSONxFormatWriter struct{}
JSONxFormatWriter is an AuditFormatWriter implementation that structures data into a XML format.
func (*JSONxFormatWriter) WriteRequest ¶ added in v0.6.2
func (f *JSONxFormatWriter) WriteRequest(w io.Writer, req *AuditRequestEntry) error
func (*JSONxFormatWriter) WriteResponse ¶ added in v0.6.2
func (f *JSONxFormatWriter) WriteResponse(w io.Writer, resp *AuditResponseEntry) error