Skip to content
API Documentation
BastionGuard™
bastionguard::rootguard::anonymous_namespace{AutomaticResponseSink.cpp} Namespace Reference

Functions

bool isActionableMetadataEvent (const rg_event &event) noexcept
void copyString (char *destination, const std::size_t size, const std::string &source) noexcept

Function Documentation

◆ copyString()

void bastionguard::rootguard::anonymous_namespace{AutomaticResponseSink.cpp}::copyString ( char * destination,
const std::size_t size,
const std::string & source )
noexcept

Definition at line 36 of file AutomaticResponseSink.cpp.

38{
39 if (!destination || size == 0)
40 return;
41 const auto count = std::min(size - 1, source.size());
42 std::memcpy(destination, source.data(), count);
43 destination[count] = '\0';
44}

References copyString().

Referenced by copyString().

◆ isActionableMetadataEvent()

bool bastionguard::rootguard::anonymous_namespace{AutomaticResponseSink.cpp}::isActionableMetadataEvent ( const rg_event & event)
noexcept

Definition at line 12 of file AutomaticResponseSink.cpp.

13{
14 switch (event.event_type) {
23 break;
24 default:
25 return false;
26 }
27
28 /*
29 * Automatic containment is a state-changing operation and must never run
30 * for audit/alert events. It is allowed only after the kernel has denied
31 * the metadata change and reported RG_VERDICT_BLOCKED.
32 */
33 return event.verdict == RG_VERDICT_BLOCKED;
34}
@ RG_EVENT_PROTECTED_RENAME
@ RG_EVENT_OWNER_CHANGE
@ RG_EVENT_ACL_CHANGE
@ RG_EVENT_PROTECTED_UNLINK
@ RG_EVENT_INTEGRITY_DRIFT
@ RG_EVENT_PROTECTED_HARDLINK
@ RG_EVENT_XATTR_CHANGE
@ RG_EVENT_PERMISSION_CHANGE
@ RG_VERDICT_BLOCKED

References isActionableMetadataEvent(), RG_EVENT_ACL_CHANGE, RG_EVENT_INTEGRITY_DRIFT, RG_EVENT_OWNER_CHANGE, RG_EVENT_PERMISSION_CHANGE, RG_EVENT_PROTECTED_HARDLINK, RG_EVENT_PROTECTED_RENAME, RG_EVENT_PROTECTED_UNLINK, RG_EVENT_XATTR_CHANGE, and RG_VERDICT_BLOCKED.

Referenced by isActionableMetadataEvent().