sandbox-linux: include exile.hpp
This commit is contained in:
parent
761471f243
commit
d17e596563
@ -12,18 +12,13 @@
|
|||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
#include <sys/capability.h>
|
#include <sys/capability.h>
|
||||||
#define HAVE_LANDLOCK 0
|
#include <exile.hpp>
|
||||||
#include <exile.h>
|
|
||||||
#include "../logger.h"
|
#include "../logger.h"
|
||||||
#include "../utils.h"
|
#include "../utils.h"
|
||||||
#include "../random.h"
|
#include "../random.h"
|
||||||
|
|
||||||
#include "sandbox-linux.h"
|
#include "sandbox-linux.h"
|
||||||
|
|
||||||
/* TODO: make a whitelist approach. So far we simply blacklist
|
|
||||||
* obvious systemcalls. To whitelist, we need to analyse our
|
|
||||||
* dependencies (http library, sqlite wrapper, sqlite lib etc.) */
|
|
||||||
|
|
||||||
bool SandboxLinux::supported()
|
bool SandboxLinux::supported()
|
||||||
{
|
{
|
||||||
std::fstream stream;
|
std::fstream stream;
|
||||||
@ -54,7 +49,7 @@ bool SandboxLinux::enable(std::vector<std::string> fsPaths)
|
|||||||
}
|
}
|
||||||
for(unsigned int i = 0; i < fsPaths.size(); i++)
|
for(unsigned int i = 0; i < fsPaths.size(); i++)
|
||||||
{
|
{
|
||||||
exile_append_path_policy(policy, EXILE_FS_ALLOW_ALL_READ | EXILE_FS_ALLOW_ALL_WRITE, fsPaths[i].c_str());
|
exile_append_path_policies(policy, EXILE_FS_ALLOW_ALL_READ | EXILE_FS_ALLOW_ALL_WRITE, fsPaths[i].c_str());
|
||||||
}
|
}
|
||||||
policy->drop_caps = 1;
|
policy->drop_caps = 1;
|
||||||
policy->not_dumpable = 1;
|
policy->not_dumpable = 1;
|
||||||
@ -66,7 +61,7 @@ bool SandboxLinux::enable(std::vector<std::string> fsPaths)
|
|||||||
|
|
||||||
if(exile_enable_policy(policy) != 0)
|
if(exile_enable_policy(policy) != 0)
|
||||||
{
|
{
|
||||||
Logger::error() << "Sandbox: Activation of seccomp blacklist failed!";
|
Logger::error() << "Sandbox: Activation of exile failed!";
|
||||||
exile_free_policy(policy);
|
exile_free_policy(policy);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 4824c6eaa9043878daaba7b3778338f5bf913f06
|
Subproject commit f2ca26010a2bb6d9e270d6ade2e8789c02ac3b31
|
Loading…
Reference in New Issue
Block a user