mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-24 14:01:05 +00:00
Compare commits
4 Commits
8b693e564e
...
cd6aee2fae
Author | SHA1 | Date | |
---|---|---|---|
cd6aee2fae | |||
|
68b56e7c25 | ||
37386b857a | |||
19dbf7abeb |
10
Dockerfile
10
Dockerfile
@ -1,5 +1,5 @@
|
|||||||
# build
|
# build
|
||||||
FROM debian:stable-slim as build
|
FROM debian:stable-slim AS build
|
||||||
|
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ COPY vendor ./vendor
|
|||||||
COPY .git ./.git
|
COPY .git ./.git
|
||||||
COPY Makefile CMakeLists.txt version.h.in ./
|
COPY Makefile CMakeLists.txt version.h.in ./
|
||||||
|
|
||||||
RUN make -j8
|
RUN make nosandbox -j$(nproc)
|
||||||
|
|
||||||
# prod
|
# prod
|
||||||
FROM debian:stable-slim
|
FROM debian:stable-slim
|
||||||
@ -29,4 +29,8 @@ COPY sql ./sql
|
|||||||
|
|
||||||
CMD ["/bin/fusion"]
|
CMD ["/bin/fusion"]
|
||||||
|
|
||||||
LABEL Name=openfusion Version=0.0.2
|
EXPOSE 23000/tcp
|
||||||
|
EXPOSE 23001/tcp
|
||||||
|
EXPOSE 8001/tcp
|
||||||
|
|
||||||
|
LABEL Name=openfusion Version=1.6.0
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
version: '3.4'
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
openfusion:
|
openfusion:
|
||||||
image: openfusion
|
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: ./Dockerfile
|
dockerfile: ./Dockerfile
|
||||||
|
image: openfusion/openfusion:latest
|
||||||
volumes:
|
volumes:
|
||||||
- ./config.ini:/usr/src/app/config.ini
|
- ./config.ini:/usr/src/app/config.ini
|
||||||
- ./database.db:/usr/src/app/database.db
|
- ./database.db:/usr/src/app/database.db
|
||||||
|
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user