Skip to content
API Documentation
BastionGuard™
Policy.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <filesystem>
5#include <string>
6#include <vector>
7
9
10enum class Mode : std::uint32_t {
11 Audit = 0,
13};
14
15enum class Action : std::uint32_t {
16 Audit = 0,
17 Block = 1,
18};
19
20struct PolicyPath {
21 std::uint32_t id{};
22 std::filesystem::path path;
23 bool required{};
24 bool recursive{};
25};
26
27struct Policy {
28 std::uint32_t version{2};
37 // Direct privilege primitives stay visible, but the eBPF source samples them
38 // per execution domain so backup/restore work cannot fill the ring buffer.
40 // Count only destructive unprotected permission/ownership patterns inside the
41 // kernel and emit one aggregate signal instead of one popup per file.
43 std::uint32_t globalMetadataSampleLimit{3};
44 std::uint32_t metadataBurstThreshold{32};
45 std::uint32_t metadataBurstWindowMs{5000};
46 std::uint32_t metadataBurstCooldownMs{300000};
47 // Suppress unprotected global metadata noise below /run. Protected identities
48 // and credential/privilege-transition checks always take precedence.
50 bool logTrusted{true};
52 bool blockUserHome{false};
53 std::uint32_t integrityPollSeconds{5};
54 std::filesystem::path eventLog{"/var/log/bastionguard/rootguard-events.jsonl"};
55 std::vector<PolicyPath> trustedApplications;
56 std::vector<PolicyPath> trustedExecutables;
57 std::vector<PolicyPath> deniedExecutables;
58 std::vector<PolicyPath> protectedPaths;
59 std::vector<PolicyPath> ignoredPaths;
60};
61
62[[nodiscard]] const char* toString(Mode mode) noexcept;
63[[nodiscard]] const char* toString(Action action) noexcept;
64
65} // namespace bastionguard::rootguard
const char * toString(Mode mode) noexcept
Definition Policy.cpp:6
std::filesystem::path path
Definition Policy.hpp:22
std::vector< PolicyPath > trustedExecutables
Definition Policy.hpp:56
std::vector< PolicyPath > deniedExecutables
Definition Policy.hpp:57
std::uint32_t metadataBurstThreshold
Definition Policy.hpp:44
std::vector< PolicyPath > ignoredPaths
Definition Policy.hpp:59
std::uint32_t globalMetadataSampleLimit
Definition Policy.hpp:43
std::filesystem::path eventLog
Definition Policy.hpp:54
std::uint32_t integrityPollSeconds
Definition Policy.hpp:53
std::uint32_t metadataBurstCooldownMs
Definition Policy.hpp:46
std::vector< PolicyPath > protectedPaths
Definition Policy.hpp:58
std::uint32_t metadataBurstWindowMs
Definition Policy.hpp:45
std::vector< PolicyPath > trustedApplications
Definition Policy.hpp:55