Audit grpc requests #1184
No reviewers
Labels
No labels
P0
P1
P2
P3
badger
frostfs-adm
frostfs-cli
frostfs-ir
frostfs-lens
frostfs-node
good first issue
triage
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-node#1184
Loading…
Reference in a new issue
No description provided.
Delete branch "dstepanov-yadro/frostfs-node:feat/op_logging"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Added config option to enable audit event logging, SIGHUP supported.
Audit logs for all handlers have the same structure: operation (grpc handler), object (containerID, treeID, objectID, nodeID, ownerID; it depends on handler), subject (client's public key), success (true or false).
e7650d0be6
toefeb766356
efeb766356
toa11b93df64
WIP: Audit grpc requeststo Audit grpc requests@ -0,0 +24,4 @@
func LogRequestWithKey(log *logger.Logger, operation string, key []byte, target Target, status bool) {
object, subject := NotDefined, NotDefined
publicKey := crypto.UnmarshalPublicKey(key)
keys.NewPublicKeyFromBytes
does essentially the same and returnskeys.PublicKey
type. Why not use it?This method is used for signature verification (see
frostfs-api-go
).frostfs-crypto
looks closer tofrosfst-node
thanneo-go
.This method is simpler: it returns public key or nil.
@ -0,0 +26,4 @@
func TargetFromRefs[T any](refs []*T, model ModelType[T]) Target {
if len(refs) == 0 {
return &stringTarget{s: NotDefined}
Why does
String
method have pointer receiver? We could save an allocation here withtype stringTarget string
, as I understand it is only used as nice stringer.Fixed
@ -0,0 +73,4 @@
if len(v) == 0 {
sb.WriteString(Empty)
} else {
sb.WriteString(string(v))
string(v)
seems unnecessary,v
is already string, no?Fixed
a11b93df64
to462539b94f
@ -0,0 +145,4 @@
a.failed = true
}
a.objectID = resp.GetBody().GetObjectID()
audit.LogRequestWithKey(a.log, objectGRPC.ObjectService_Put_FullMethodName, a.key,
How about to use string constant here as it is done for
tracing
:objectGRPC.ObjectService_Put_FullMethodName
->putv2.streamer.CloseAndRecv
.And do the same for
auditPutStream.Send()
.I didn't get the idea...
Instead of logging with the same value for
operation
(CloseAndRecv
andSend
are usingobjectGRPC.ObjectService_Put_FullMethodName
constant) useputv2.streamer.CloseAndRecv
andputv2.streamer.Send
, for example.Send
logs only on an error, whenCloseAndRecv
will not call. So log will containe only one log record.462539b94f
tofd28461def