mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-22 05:20:05 +00:00
Compare commits
5 Commits
dd62273273
...
1f5ac83c03
Author | SHA1 | Date | |
---|---|---|---|
1f5ac83c03 | |||
7c66041a6f | |||
2c822e210b | |||
37386b857a | |||
19dbf7abeb |
6
Makefile
6
Makefile
@ -134,6 +134,8 @@ all: $(SERVER)
|
|||||||
|
|
||||||
windows: $(SERVER)
|
windows: $(SERVER)
|
||||||
|
|
||||||
|
nosandbox: $(SERVER)
|
||||||
|
|
||||||
# assign Windows-specific values if targeting Windows
|
# assign Windows-specific values if targeting Windows
|
||||||
windows : CC=$(WIN_CC)
|
windows : CC=$(WIN_CC)
|
||||||
windows : CXX=$(WIN_CXX)
|
windows : CXX=$(WIN_CXX)
|
||||||
@ -142,6 +144,8 @@ windows : CXXFLAGS=$(WIN_CXXFLAGS)
|
|||||||
windows : LDFLAGS=$(WIN_LDFLAGS)
|
windows : LDFLAGS=$(WIN_LDFLAGS)
|
||||||
windows : SERVER=$(WIN_SERVER)
|
windows : SERVER=$(WIN_SERVER)
|
||||||
|
|
||||||
|
nosandbox : CFLAGS+=-DCONFIG_NOSANDBOX=1
|
||||||
|
|
||||||
.SUFFIXES: .o .c .cpp .h .hpp
|
.SUFFIXES: .o .c .cpp .h .hpp
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
@ -163,7 +167,7 @@ version.h:
|
|||||||
|
|
||||||
src/main.o: version.h
|
src/main.o: version.h
|
||||||
|
|
||||||
.PHONY: all windows clean nuke
|
.PHONY: all windows nosandbox clean nuke
|
||||||
|
|
||||||
# only gets rid of OpenFusion objects, so we don't need to
|
# only gets rid of OpenFusion objects, so we don't need to
|
||||||
# recompile the libs every time
|
# recompile the libs every time
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_ERRNO|(_errno))
|
BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_ERRNO|(_errno))
|
||||||
|
|
||||||
#define KILL_PROCESS \
|
#define KILL_PROCESS \
|
||||||
BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_KILL_PROCESS)
|
BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_TRAP)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Macros adapted from openssh's sandbox-seccomp-filter.c
|
* Macros adapted from openssh's sandbox-seccomp-filter.c
|
||||||
@ -302,6 +302,18 @@ int seccomp(unsigned int operation, unsigned int flags, void *args) {
|
|||||||
return syscall(__NR_seccomp, operation, flags, args);
|
return syscall(__NR_seccomp, operation, flags, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sig_sys_handler(int signo, siginfo_t *info, void *context)
|
||||||
|
{
|
||||||
|
// report the unhandled syscall
|
||||||
|
std::cout << "[FATAL] Unhandled syscall: " << info->si_syscall << std::endl;
|
||||||
|
|
||||||
|
std::cout << "If you're unsure why this is happening, please read https://openfusion.dev/docs/development/the-sandbox/" << std::endl
|
||||||
|
<< "for more information and possibly open an issue at https://github.com/OpenFusionProject/OpenFusion/issues to report"
|
||||||
|
<< " needed changes in our seccomp filter." << std::endl;
|
||||||
|
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
void sandbox_start() {
|
void sandbox_start() {
|
||||||
if (!settings::SANDBOX) {
|
if (!settings::SANDBOX) {
|
||||||
std::cout << "[WARN] Running without a sandbox" << std::endl;
|
std::cout << "[WARN] Running without a sandbox" << std::endl;
|
||||||
@ -310,6 +322,15 @@ void sandbox_start() {
|
|||||||
|
|
||||||
std::cout << "[INFO] Starting seccomp-bpf sandbox..." << std::endl;
|
std::cout << "[INFO] Starting seccomp-bpf sandbox..." << std::endl;
|
||||||
|
|
||||||
|
// we listen to SIGSYS to report unhandled syscalls
|
||||||
|
struct sigaction sa = {};
|
||||||
|
sa.sa_flags = SA_SIGINFO;
|
||||||
|
sa.sa_sigaction = sig_sys_handler;
|
||||||
|
if (sigaction(SIGSYS, &sa, NULL) < 0) {
|
||||||
|
perror("sigaction");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) < 0) {
|
if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) < 0) {
|
||||||
perror("prctl");
|
perror("prctl");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
3
vendor/bcrypt/bcrypt.c
vendored
3
vendor/bcrypt/bcrypt.c
vendored
@ -38,9 +38,10 @@ typedef __int64 ssize_t;
|
|||||||
#include <wincrypt.h> /* CryptAcquireContext, CryptGenRandom */
|
#include <wincrypt.h> /* CryptAcquireContext, CryptGenRandom */
|
||||||
#else
|
#else
|
||||||
#include "bcrypt.h"
|
#include "bcrypt.h"
|
||||||
#include "ow-crypt.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "ow-crypt.h"
|
||||||
|
|
||||||
#define RANDBYTES (16)
|
#define RANDBYTES (16)
|
||||||
|
|
||||||
static int try_close(int fd)
|
static int try_close(int fd)
|
||||||
|
Loading…
Reference in New Issue
Block a user