Classes | |
| struct | Options |
Functions | |
| void | fail (const std::string &message) |
| std::uint64_t | parseUnsigned (const std::string &value, const char *label, const int base=10) |
| Options | parseOptions (const int argc, char *argv[]) |
| bool | pathStartsWith (const fs::path &path, const fs::path &prefix) |
| fs::path | normalizedAbsolute (const fs::path &path) |
| bool | isIgnoredPath (const Policy &policy, const fs::path &requested) |
| bool | isProtectedPath (const Policy &policy, const fs::path &requested) |
| void | requireProtectedPath (const Policy &policy, const fs::path &path) |
| std::string | timestamp () |
| void | copyString (char *destination, const std::size_t size, const std::string &source) |
| void | logAction (const Policy &policy, const fs::path &path, const std::uint32_t eventType, const std::uint32_t verdict, const struct stat *before=nullptr, const struct stat *after=nullptr) |
| Policy | loadPolicy (const fs::path &path) |
| std::string | trim (std::string value) |
| void | rewriteProtectionPolicy (const fs::path &policyPath, const bool enabled) |
| std::vector< fs::path > | normalizeApplicationEntries (const std::vector< fs::path > &entries, const char *label) |
| void | writePolicyAtomically (const fs::path &policyPath, const std::vector< std::string > &lines, const struct stat &metadata) |
| void | rewriteApplicationRules (const Options &options) |
| void | restoreFile (const Options &options, const Policy &policy) |
| void | quarantineFile (const Options &options, const Policy &policy) |
Variables | |
| constexpr const char * | kDefaultPolicy = "/etc/bastionguard/rootguard.conf" |
| constexpr const char * | kQuarantineDir = "/var/lib/bastionguard/rootguard/quarantine" |
| void anonymous_namespace{ActionHelper.cpp}::copyString | ( | char * | destination, |
| const std::size_t | size, | ||
| const std::string & | source ) |
Definition at line 169 of file ActionHelper.cpp.
References copyString().
Referenced by copyString(), and logAction().
| void anonymous_namespace{ActionHelper.cpp}::fail | ( | const std::string & | message | ) |
Definition at line 52 of file ActionHelper.cpp.
References fail().
Referenced by fail(), main(), normalizeApplicationEntries(), normalizedAbsolute(), parseOptions(), parseUnsigned(), quarantineFile(), requireProtectedPath(), restoreFile(), rewriteApplicationRules(), rewriteProtectionPolicy(), and writePolicyAtomically().
| bool anonymous_namespace{ActionHelper.cpp}::isIgnoredPath | ( | const Policy & | policy, |
| const fs::path & | requested ) |
Definition at line 125 of file ActionHelper.cpp.
References bastionguard::rootguard::Policy::ignoredPaths, isIgnoredPath(), normalizedAbsolute(), and pathStartsWith().
Referenced by isIgnoredPath(), and isProtectedPath().
| bool anonymous_namespace{ActionHelper.cpp}::isProtectedPath | ( | const Policy & | policy, |
| const fs::path & | requested ) |
Definition at line 137 of file ActionHelper.cpp.
References isIgnoredPath(), isProtectedPath(), normalizedAbsolute(), pathStartsWith(), and bastionguard::rootguard::Policy::protectedPaths.
Referenced by isProtectedPath(), and requireProtectedPath().
| Policy anonymous_namespace{ActionHelper.cpp}::loadPolicy | ( | const fs::path & | path | ) |
Definition at line 223 of file ActionHelper.cpp.
References bastionguard::rootguard::PolicyLoader::loadFromText(), loadPolicy(), and bastionguard::rootguard::PolicySecurity::read().
Referenced by loadPolicy(), and main().
| void anonymous_namespace{ActionHelper.cpp}::logAction | ( | const Policy & | policy, |
| const fs::path & | path, | ||
| const std::uint32_t | eventType, | ||
| const std::uint32_t | verdict, | ||
| const struct stat * | before = nullptr, | ||
| const struct stat * | after = nullptr ) |
Definition at line 179 of file ActionHelper.cpp.
References copyString(), bastionguard::rootguard::Policy::eventLog, bastionguard::rootguard::FileIdentityResolver::kernelDeviceNumber(), logAction(), bastionguard::rootguard::JsonEventSink::onEvent(), rg_event::pid, and RG_PATH_PROTECTED_BASELINE.
Referenced by logAction(), main(), quarantineFile(), and restoreFile().
| std::vector< fs::path > anonymous_namespace{ActionHelper.cpp}::normalizeApplicationEntries | ( | const std::vector< fs::path > & | entries, |
| const char * | label ) |
Definition at line 316 of file ActionHelper.cpp.
References fail(), normalizeApplicationEntries(), and normalizedAbsolute().
Referenced by normalizeApplicationEntries(), and rewriteApplicationRules().
| fs::path anonymous_namespace{ActionHelper.cpp}::normalizedAbsolute | ( | const fs::path & | path | ) |
Definition at line 113 of file ActionHelper.cpp.
References fail(), and normalizedAbsolute().
Referenced by isIgnoredPath(), isProtectedPath(), main(), normalizeApplicationEntries(), normalizedAbsolute(), quarantineFile(), and restoreFile().
| Options anonymous_namespace{ActionHelper.cpp}::parseOptions | ( | const int | argc, |
| char * | argv[] ) |
Definition at line 72 of file ActionHelper.cpp.
References anonymous_namespace{ActionHelper.cpp}::Options::command, anonymous_namespace{ActionHelper.cpp}::Options::deniedExecutables, anonymous_namespace{ActionHelper.cpp}::Options::device, fail(), anonymous_namespace{ActionHelper.cpp}::Options::gid, anonymous_namespace{ActionHelper.cpp}::Options::inode, anonymous_namespace{ActionHelper.cpp}::Options::mode, parseOptions(), parseUnsigned(), anonymous_namespace{ActionHelper.cpp}::Options::path, anonymous_namespace{ActionHelper.cpp}::Options::policy, anonymous_namespace{ActionHelper.cpp}::Options::protection, anonymous_namespace{ActionHelper.cpp}::Options::trustedApplications, anonymous_namespace{ActionHelper.cpp}::Options::trustedExecutables, and anonymous_namespace{ActionHelper.cpp}::Options::uid.
Referenced by main(), and parseOptions().
| std::uint64_t anonymous_namespace{ActionHelper.cpp}::parseUnsigned | ( | const std::string & | value, |
| const char * | label, | ||
| const int | base = 10 ) |
Definition at line 57 of file ActionHelper.cpp.
References fail(), and parseUnsigned().
Referenced by parseOptions(), and parseUnsigned().
| bool anonymous_namespace{ActionHelper.cpp}::pathStartsWith | ( | const fs::path & | path, |
| const fs::path & | prefix ) |
Definition at line 100 of file ActionHelper.cpp.
References pathStartsWith().
Referenced by isIgnoredPath(), isProtectedPath(), and pathStartsWith().
| void anonymous_namespace{ActionHelper.cpp}::quarantineFile | ( | const Options & | options, |
| const Policy & | policy ) |
Definition at line 533 of file ActionHelper.cpp.
References bastionguard::rootguard::blockSystemService(), anonymous_namespace{ActionHelper.cpp}::Options::device, fail(), bastionguard::rootguard::identifySystemService(), anonymous_namespace{ActionHelper.cpp}::Options::inode, bastionguard::rootguard::FileIdentityResolver::kernelDeviceNumber(), kQuarantineDir, logAction(), normalizedAbsolute(), bastionguard::rootguard::OpenRC, anonymous_namespace{ActionHelper.cpp}::Options::path, quarantineFile(), requireProtectedPath(), RG_EVENT_FILE_QUARANTINED, RG_VERDICT_BLOCKED, bastionguard::rootguard::SysVInit, and timestamp().
Referenced by main(), and quarantineFile().
| void anonymous_namespace{ActionHelper.cpp}::requireProtectedPath | ( | const Policy & | policy, |
| const fs::path & | path ) |
Definition at line 152 of file ActionHelper.cpp.
References fail(), isProtectedPath(), and requireProtectedPath().
Referenced by main(), quarantineFile(), requireProtectedPath(), and restoreFile().
| void anonymous_namespace{ActionHelper.cpp}::restoreFile | ( | const Options & | options, |
| const Policy & | policy ) |
Definition at line 481 of file ActionHelper.cpp.
References anonymous_namespace{ActionHelper.cpp}::Options::device, fail(), anonymous_namespace{ActionHelper.cpp}::Options::gid, anonymous_namespace{ActionHelper.cpp}::Options::inode, bastionguard::rootguard::FileIdentityResolver::kernelDeviceNumber(), logAction(), anonymous_namespace{ActionHelper.cpp}::Options::mode, normalizedAbsolute(), anonymous_namespace{ActionHelper.cpp}::Options::path, requireProtectedPath(), restoreFile(), RG_EVENT_FILE_RESTORED, RG_VERDICT_RESTORED, anonymous_namespace{ActionHelper.cpp}::Options::uid, and bastionguard::rootguard::unblockSystemService().
Referenced by main(), and restoreFile().
| void anonymous_namespace{ActionHelper.cpp}::rewriteApplicationRules | ( | const Options & | options | ) |
Definition at line 391 of file ActionHelper.cpp.
References anonymous_namespace{ActionHelper.cpp}::Options::deniedExecutables, fail(), normalizeApplicationEntries(), anonymous_namespace{ActionHelper.cpp}::Options::policy, rewriteApplicationRules(), trim(), anonymous_namespace{ActionHelper.cpp}::Options::trustedApplications, anonymous_namespace{ActionHelper.cpp}::Options::trustedExecutables, and writePolicyAtomically().
Referenced by main(), and rewriteApplicationRules().
| void anonymous_namespace{ActionHelper.cpp}::rewriteProtectionPolicy | ( | const fs::path & | policyPath, |
| const bool | enabled ) |
Definition at line 237 of file ActionHelper.cpp.
References fail(), rewriteProtectionPolicy(), and trim().
Referenced by main(), and rewriteProtectionPolicy().
| std::string anonymous_namespace{ActionHelper.cpp}::timestamp | ( | ) |
Definition at line 158 of file ActionHelper.cpp.
References timestamp().
Referenced by quarantineFile(), and timestamp().
| std::string anonymous_namespace{ActionHelper.cpp}::trim | ( | std::string | value | ) |
Definition at line 228 of file ActionHelper.cpp.
References trim().
Referenced by rewriteApplicationRules(), rewriteProtectionPolicy(), and trim().
| void anonymous_namespace{ActionHelper.cpp}::writePolicyAtomically | ( | const fs::path & | policyPath, |
| const std::vector< std::string > & | lines, | ||
| const struct stat & | metadata ) |
Definition at line 350 of file ActionHelper.cpp.
References fail(), bastionguard::rootguard::PolicyLoader::loadFromText(), and writePolicyAtomically().
Referenced by rewriteApplicationRules(), and writePolicyAtomically().
|
constexpr |
Definition at line 34 of file ActionHelper.cpp.
|
constexpr |
Definition at line 35 of file ActionHelper.cpp.
Referenced by quarantineFile().