|
@@ -18,25 +18,12 @@ pub enum Allow {
|
|
|
Mprotect,
|
|
|
UnixConnect,
|
|
|
UnixListen,
|
|
|
- Open,
|
|
|
+ TcpAccept,
|
|
|
Read,
|
|
|
Write,
|
|
|
- Stat,
|
|
|
- Listdir,
|
|
|
Recv,
|
|
|
Send,
|
|
|
- Sendfile,
|
|
|
- Futex,
|
|
|
- Signal,
|
|
|
- SignalMask,
|
|
|
SignalReturn,
|
|
|
- Threading,
|
|
|
- Inotify,
|
|
|
- Prctl,
|
|
|
- Timer,
|
|
|
- ClockGet,
|
|
|
- ClockSet,
|
|
|
- Sleep,
|
|
|
}
|
|
|
|
|
|
#[derive(Clone, Debug)]
|
|
@@ -69,6 +56,8 @@ pub fn seccomp_compile_for_arch(
|
|
|
(libc::SYS_munmap, vec![]),
|
|
|
(libc::SYS_sched_getaffinity, vec![]),
|
|
|
(libc::SYS_sigaltstack, vec![]),
|
|
|
+ (libc::SYS_nanosleep, vec![]),
|
|
|
+ (libc::SYS_clock_nanosleep, vec![]),
|
|
|
]
|
|
|
.into();
|
|
|
|
|
@@ -95,17 +84,19 @@ pub fn seccomp_compile_for_arch(
|
|
|
Allow::UnixConnect => {
|
|
|
rules.insert(libc::SYS_connect, vec![]);
|
|
|
rules.insert(libc::SYS_socket, vec![]); //TODO: Restrict to AF_UNIX
|
|
|
+ rules.insert(libc::SYS_getsockopt, vec![]);
|
|
|
}
|
|
|
Allow::UnixListen => {
|
|
|
rules.insert(libc::SYS_accept4, vec![]);
|
|
|
rules.insert(libc::SYS_bind, vec![]);
|
|
|
rules.insert(libc::SYS_listen, vec![]);
|
|
|
rules.insert(libc::SYS_socket, vec![]); //TODO: Restrict to AF_UNIX
|
|
|
+ rules.insert(libc::SYS_getsockopt, vec![]);
|
|
|
}
|
|
|
- Allow::Open => {
|
|
|
- //TODO: This should be restricted
|
|
|
- rules.insert(libc::SYS_open, vec![]);
|
|
|
- rules.insert(libc::SYS_openat, vec![]);
|
|
|
+ Allow::TcpAccept => {
|
|
|
+ rules.insert(libc::SYS_accept4, vec![]);
|
|
|
+ rules.insert(libc::SYS_socket, vec![]); //TODO: Restrict to AF_UNIX
|
|
|
+ rules.insert(libc::SYS_getsockopt, vec![]);
|
|
|
}
|
|
|
Allow::Read => {
|
|
|
rules.insert(libc::SYS_pread64, vec![]);
|
|
@@ -123,13 +114,6 @@ pub fn seccomp_compile_for_arch(
|
|
|
rules.insert(libc::SYS_writev, vec![]);
|
|
|
add_read_write_rules(&mut rules);
|
|
|
}
|
|
|
- Allow::Stat => {
|
|
|
- rules.insert(libc::SYS_statx, vec![]);
|
|
|
- rules.insert(libc::SYS_newfstatat, vec![]);
|
|
|
- }
|
|
|
- Allow::Listdir => {
|
|
|
- rules.insert(libc::SYS_getdents64, vec![]);
|
|
|
- }
|
|
|
Allow::Recv => {
|
|
|
rules.insert(libc::SYS_recvfrom, vec![]);
|
|
|
rules.insert(libc::SYS_recvmsg, vec![]);
|
|
@@ -140,55 +124,9 @@ pub fn seccomp_compile_for_arch(
|
|
|
rules.insert(libc::SYS_sendmsg, vec![]);
|
|
|
rules.insert(libc::SYS_sendmmsg, vec![]);
|
|
|
}
|
|
|
- Allow::Sendfile => {
|
|
|
- rules.insert(libc::SYS_sendfile, vec![]);
|
|
|
- }
|
|
|
- Allow::Futex => {
|
|
|
- rules.insert(libc::SYS_futex, vec![]);
|
|
|
- rules.insert(libc::SYS_get_robust_list, vec![]);
|
|
|
- rules.insert(libc::SYS_set_robust_list, vec![]);
|
|
|
- }
|
|
|
- Allow::Signal => {
|
|
|
- rules.insert(libc::SYS_rt_sigaction, vec![]);
|
|
|
- rules.insert(libc::SYS_rt_sigprocmask, vec![]);
|
|
|
- }
|
|
|
- Allow::SignalMask => {
|
|
|
- rules.insert(libc::SYS_rt_sigprocmask, vec![]);
|
|
|
- }
|
|
|
Allow::SignalReturn => {
|
|
|
rules.insert(libc::SYS_rt_sigreturn, vec![]);
|
|
|
}
|
|
|
- Allow::Threading => {
|
|
|
- rules.insert(libc::SYS_clone3, vec![]); //TODO restrict to threads
|
|
|
- rules.insert(libc::SYS_rseq, vec![]);
|
|
|
- }
|
|
|
- Allow::Inotify => {
|
|
|
- rules.insert(libc::SYS_inotify_init, vec![]);
|
|
|
- rules.insert(libc::SYS_inotify_add_watch, vec![]);
|
|
|
- rules.insert(libc::SYS_inotify_rm_watch, vec![]);
|
|
|
- }
|
|
|
- Allow::Prctl => {
|
|
|
- //TODO: This should be restricted
|
|
|
- rules.insert(libc::SYS_prctl, vec![]);
|
|
|
- }
|
|
|
- Allow::Timer => {
|
|
|
- rules.insert(libc::SYS_timer_create, vec![]);
|
|
|
- rules.insert(libc::SYS_timer_settime, vec![]);
|
|
|
- rules.insert(libc::SYS_timer_gettime, vec![]);
|
|
|
- rules.insert(libc::SYS_timer_getoverrun, vec![]);
|
|
|
- rules.insert(libc::SYS_timer_delete, vec![]);
|
|
|
- }
|
|
|
- Allow::ClockGet => {
|
|
|
- rules.insert(libc::SYS_clock_gettime, vec![]);
|
|
|
- rules.insert(libc::SYS_clock_getres, vec![]);
|
|
|
- }
|
|
|
- Allow::ClockSet => {
|
|
|
- rules.insert(libc::SYS_clock_settime, vec![]);
|
|
|
- }
|
|
|
- Allow::Sleep => {
|
|
|
- rules.insert(libc::SYS_nanosleep, vec![]);
|
|
|
- rules.insert(libc::SYS_clock_nanosleep, vec![]);
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
|