2023-05-26 14:42:52 +08:00
|
|
|
# Example config for nsjail
|
|
|
|
|
|
|
|
name: "hexchat-with-net"
|
|
|
|
|
|
|
|
description: "This policy allows to run hexchat inside a jail. Access to networking is"
|
|
|
|
description: "permitted with this setup (clone_newnet: false)."
|
|
|
|
description: ""
|
|
|
|
description: "The only permitted home directory is $HOME/.hexchat and $HOME/Documents."
|
|
|
|
description: "The rest of available on the FS files/dires are libs and X-related files/dirs."
|
|
|
|
description: ""
|
|
|
|
description: "Run as:"
|
|
|
|
description: "./nsjail --config configs/hexchat-with-net.cfg"
|
|
|
|
|
|
|
|
mode: ONCE
|
|
|
|
hostname: "HEXCHAT"
|
|
|
|
cwd: "/user"
|
|
|
|
daemon: true
|
|
|
|
|
|
|
|
time_limit: 0
|
|
|
|
max_cpus: 2
|
|
|
|
|
|
|
|
envar: "HOME=/user"
|
|
|
|
envar: "DISPLAY"
|
|
|
|
envar: "TMP=/tmp"
|
|
|
|
envar: "FONTCONFIG_FILE=/etc/fonts/fonts.conf"
|
|
|
|
envar: "FC_CONFIG_FILE=/etc/fonts/fonts.conf"
|
|
|
|
envar: "LANG"
|
|
|
|
|
|
|
|
rlimit_as: 4096
|
|
|
|
rlimit_cpu_type: INF
|
|
|
|
rlimit_fsize: 4096
|
|
|
|
rlimit_nofile: 128
|
|
|
|
|
|
|
|
clone_newnet: false
|
|
|
|
|
|
|
|
mount {
|
|
|
|
dst: "/proc"
|
|
|
|
fstype: "proc"
|
|
|
|
}
|
|
|
|
|
|
|
|
mount {
|
|
|
|
src: "/lib"
|
|
|
|
dst: "/lib"
|
|
|
|
is_bind: true
|
|
|
|
}
|
|
|
|
|
|
|
|
mount {
|
|
|
|
src: "/usr/lib"
|
|
|
|
dst: "/usr/lib"
|
|
|
|
is_bind: true
|
|
|
|
}
|
|
|
|
|
|
|
|
mount {
|
|
|
|
src: "/lib64"
|
|
|
|
dst: "/lib64"
|
|
|
|
is_bind: true
|
|
|
|
mandatory: false
|
|
|
|
}
|
|
|
|
|
|
|
|
mount {
|
|
|
|
src: "/lib32"
|
|
|
|
dst: "/lib32"
|
|
|
|
is_bind: true
|
|
|
|
mandatory: false
|
|
|
|
}
|
|
|
|
|
|
|
|
mount {
|
|
|
|
src_content: "<?xml version=\"1.0\"?>\n<!DOCTYPE fontconfig SYSTEM \"fonts.dtd\">\n<fontconfig><dir>/usr/share/fonts</dir><cachedir>/tmp/fontconfig</cachedir></fontconfig>"
|
|
|
|
dst: "/etc/fonts/fonts.conf"
|
|
|
|
}
|
|
|
|
|
|
|
|
mount {
|
|
|
|
src: "/usr/share"
|
|
|
|
dst: "/usr/share"
|
|
|
|
is_bind: true
|
|
|
|
}
|
|
|
|
|
|
|
|
mount {
|
|
|
|
src: "/dev/urandom"
|
|
|
|
dst: "/dev/urandom"
|
|
|
|
is_bind: true
|
|
|
|
rw: true
|
|
|
|
}
|
|
|
|
|
|
|
|
mount {
|
|
|
|
src_content: "nameserver 8.8.8.8"
|
|
|
|
dst: "/etc/resolv.conf"
|
|
|
|
}
|
|
|
|
|
|
|
|
mount {
|
|
|
|
dst: "/tmp"
|
|
|
|
fstype: "tmpfs"
|
|
|
|
rw: true
|
|
|
|
is_bind: false
|
|
|
|
}
|
|
|
|
|
|
|
|
mount {
|
|
|
|
dst: "/dev/shm"
|
|
|
|
fstype: "tmpfs"
|
|
|
|
rw: true
|
|
|
|
is_bind: false
|
|
|
|
}
|
|
|
|
|
|
|
|
mount {
|
|
|
|
dst: "/user"
|
|
|
|
fstype: "tmpfs"
|
|
|
|
rw: true
|
|
|
|
}
|
|
|
|
|
|
|
|
mount {
|
|
|
|
prefix_src_env: "HOME"
|
|
|
|
src: "/Documents"
|
|
|
|
dst: "/user/Documents"
|
|
|
|
rw: true
|
|
|
|
is_bind: true
|
|
|
|
mandatory: false
|
|
|
|
}
|
|
|
|
|
|
|
|
mount {
|
|
|
|
prefix_src_env: "HOME"
|
|
|
|
src: "/.config/hexchat"
|
|
|
|
dst: "/user/.config/hexchat"
|
|
|
|
is_bind: true
|
|
|
|
rw: true
|
|
|
|
mandatory: false
|
|
|
|
}
|
|
|
|
|
|
|
|
mount {
|
|
|
|
prefix_src_env: "XAUTHORITY"
|
|
|
|
src: ""
|
|
|
|
dst: "/user/.Xauthority"
|
|
|
|
is_bind: true
|
|
|
|
rw: false
|
|
|
|
mandatory: false
|
|
|
|
}
|
|
|
|
|
|
|
|
mount {
|
|
|
|
src: "/tmp/.X11-unix"
|
|
|
|
dst: "/tmp/.X11-unix"
|
|
|
|
is_bind: true
|
|
|
|
mandatory: false
|
|
|
|
}
|
|
|
|
|
|
|
|
seccomp_string: "KILL_PROCESS { "
|
|
|
|
seccomp_string: " ptrace, "
|
|
|
|
seccomp_string: " process_vm_readv, "
|
|
|
|
seccomp_string: " process_vm_writev "
|
|
|
|
seccomp_string: "}, "
|
|
|
|
seccomp_string: "ERRNO(1) { "
|
|
|
|
seccomp_string: " sched_setaffinity "
|
|
|
|
seccomp_string: "} "
|
|
|
|
seccomp_string: "DEFAULT ALLOW "
|
|
|
|
|
|
|
|
exec_bin {
|
2023-06-25 18:36:47 +08:00
|
|
|
path: "/usr/bin/hexchat"
|
|
|
|
exec_fd: true
|
2023-05-26 14:42:52 +08:00
|
|
|
}
|