2021-09-12 12:40:34 -07:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <pthread.h>
|
|
|
|
#include <string_view>
|
|
|
|
#include <functional>
|
|
|
|
#include <map>
|
2021-09-16 05:27:34 -07:00
|
|
|
#include <atomic>
|
2021-09-12 12:40:34 -07:00
|
|
|
|
|
|
|
#include <daemon.hpp>
|
|
|
|
|
|
|
|
#define ISOLATED_MAGIC "isolated"
|
|
|
|
|
2022-03-01 02:13:18 -08:00
|
|
|
namespace DenyRequest {
|
|
|
|
enum : int {
|
2022-02-12 23:43:36 +08:00
|
|
|
ENFORCE,
|
|
|
|
DISABLE,
|
|
|
|
ADD,
|
|
|
|
REMOVE,
|
|
|
|
LIST,
|
|
|
|
STATUS,
|
|
|
|
|
|
|
|
END
|
|
|
|
};
|
2022-03-01 02:13:18 -08:00
|
|
|
}
|
2022-02-12 23:43:36 +08:00
|
|
|
|
2022-03-01 02:13:18 -08:00
|
|
|
namespace DenyResponse {
|
|
|
|
enum : int {
|
2022-02-12 23:43:36 +08:00
|
|
|
OK,
|
|
|
|
ENFORCED,
|
|
|
|
NOT_ENFORCED,
|
|
|
|
ITEM_EXIST,
|
|
|
|
ITEM_NOT_EXIST,
|
|
|
|
INVALID_PKG,
|
|
|
|
NO_NS,
|
|
|
|
ERROR,
|
|
|
|
|
|
|
|
END
|
|
|
|
};
|
2022-03-01 02:13:18 -08:00
|
|
|
}
|
2022-02-12 23:43:36 +08:00
|
|
|
|
2021-09-12 12:40:34 -07:00
|
|
|
// CLI entries
|
2022-03-01 02:13:18 -08:00
|
|
|
int enable_deny();
|
|
|
|
int disable_deny();
|
|
|
|
int add_list(int client);
|
|
|
|
int rm_list(int client);
|
2021-09-12 12:40:34 -07:00
|
|
|
void ls_list(int client);
|
|
|
|
|
|
|
|
// Utility functions
|
|
|
|
bool is_deny_target(int uid, std::string_view process);
|
2021-10-27 03:54:48 -07:00
|
|
|
void revert_unmount();
|
2021-09-12 12:40:34 -07:00
|
|
|
|
2022-01-17 19:54:33 -08:00
|
|
|
extern std::atomic<bool> denylist_enforced;
|