2021-05-05 19:50:51 +08:00
|
|
|
# Example config for nsjail
|
|
|
|
|
2017-05-28 03:43:56 +08:00
|
|
|
name: "firefox-with-net"
|
|
|
|
|
2017-09-14 04:03:21 +08:00
|
|
|
description: "This policy allows to run firefox inside a jail. Access to networking is"
|
|
|
|
description: "permitted with this setup (clone_newnet: false)."
|
|
|
|
description: ""
|
|
|
|
description: "The only permitted home directory is $HOME/.mozilla 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: ""
|
|
|
|
description: "./nsjail --config configs/firefox-with-net.cfg"
|
|
|
|
description: ""
|
|
|
|
description: "You can then go to https://uploadfiles.io/ and try to upload a file in order"
|
|
|
|
description: "to see how your local directory (also, all system directories) look like."
|
2017-05-28 03:43:56 +08:00
|
|
|
|
|
|
|
mode: ONCE
|
|
|
|
hostname: "FIREFOX"
|
2017-05-28 06:15:53 +08:00
|
|
|
cwd: "/user"
|
2017-05-28 03:43:56 +08:00
|
|
|
|
|
|
|
time_limit: 0
|
|
|
|
|
2018-06-01 18:19:35 +08:00
|
|
|
clone_newnet: false
|
|
|
|
|
2017-05-28 06:15:53 +08:00
|
|
|
envar: "HOME=/user"
|
2018-10-29 00:15:55 +08:00
|
|
|
envar: "DISPLAY"
|
2017-05-28 07:30:26 +08:00
|
|
|
envar: "TMP=/tmp"
|
2019-03-30 23:19:30 +08:00
|
|
|
envar: "FONTCONFIG_FILE=/etc/fonts/fonts.conf"
|
|
|
|
envar: "FC_CONFIG_FILE=/etc/fonts/fonts.conf"
|
2017-05-28 03:43:56 +08:00
|
|
|
|
|
|
|
rlimit_as: 4096
|
|
|
|
rlimit_cpu: 1000
|
|
|
|
rlimit_fsize: 1024
|
2017-10-26 08:43:40 +08:00
|
|
|
rlimit_nofile: 512
|
2017-05-28 03:43:56 +08:00
|
|
|
|
2018-06-01 18:17:27 +08:00
|
|
|
uidmap {
|
|
|
|
inside_id: "9999999"
|
|
|
|
}
|
|
|
|
|
|
|
|
gidmap {
|
|
|
|
inside_id: "9999999"
|
|
|
|
}
|
2017-05-28 03:43:56 +08:00
|
|
|
|
|
|
|
mount {
|
|
|
|
dst: "/proc"
|
|
|
|
fstype: "proc"
|
2018-06-01 18:17:27 +08:00
|
|
|
rw: true
|
2017-05-28 03:43:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
mount {
|
|
|
|
src: "/lib"
|
|
|
|
dst: "/lib"
|
|
|
|
is_bind: true
|
|
|
|
}
|
|
|
|
|
|
|
|
mount {
|
2017-05-28 08:55:50 +08:00
|
|
|
src: "/usr/lib"
|
|
|
|
dst: "/usr/lib"
|
2017-05-28 03:43:56 +08:00
|
|
|
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: "/usr/lib/firefox"
|
|
|
|
dst: "/usr/lib/firefox"
|
|
|
|
is_bind: true
|
|
|
|
}
|
|
|
|
|
2017-05-28 09:30:27 +08:00
|
|
|
mount {
|
|
|
|
src: "/usr/bin/firefox"
|
|
|
|
dst: "/usr/bin/firefox"
|
|
|
|
is_bind: true
|
|
|
|
}
|
|
|
|
|
2017-05-28 08:55:50 +08:00
|
|
|
mount {
|
|
|
|
src: "/usr/share"
|
|
|
|
dst: "/usr/share"
|
|
|
|
is_bind: true
|
|
|
|
}
|
|
|
|
|
2018-06-01 18:17:27 +08:00
|
|
|
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"
|
|
|
|
}
|
|
|
|
|
2017-05-28 03:43:56 +08:00
|
|
|
mount {
|
|
|
|
src: "/dev/urandom"
|
|
|
|
dst: "/dev/urandom"
|
|
|
|
is_bind: true
|
2017-05-28 07:24:55 +08:00
|
|
|
rw: true
|
2017-05-28 03:43:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
mount {
|
2018-06-01 18:17:27 +08:00
|
|
|
src: "/dev/null"
|
|
|
|
dst: "/dev/null"
|
2017-05-28 03:43:56 +08:00
|
|
|
is_bind: true
|
2018-06-01 18:17:27 +08:00
|
|
|
rw: true
|
|
|
|
}
|
|
|
|
|
|
|
|
mount {
|
|
|
|
src_content: "nameserver 8.8.8.8"
|
|
|
|
dst: "/etc/resolv.conf"
|
2017-05-28 03:43:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
mount {
|
|
|
|
dst: "/tmp"
|
|
|
|
fstype: "tmpfs"
|
2017-05-28 07:24:55 +08:00
|
|
|
rw: true
|
2017-05-28 03:43:56 +08:00
|
|
|
is_bind: false
|
|
|
|
}
|
|
|
|
|
2017-06-20 09:14:09 +08:00
|
|
|
mount {
|
|
|
|
dst: "/dev/shm"
|
|
|
|
fstype: "tmpfs"
|
|
|
|
rw: true
|
|
|
|
is_bind: false
|
|
|
|
}
|
|
|
|
|
2017-05-28 04:01:46 +08:00
|
|
|
mount {
|
2017-05-28 06:15:53 +08:00
|
|
|
dst: "/user"
|
2017-05-28 04:01:46 +08:00
|
|
|
fstype: "tmpfs"
|
2017-05-28 07:24:55 +08:00
|
|
|
rw: true
|
2017-05-28 04:01:46 +08:00
|
|
|
}
|
|
|
|
|
2017-05-28 03:43:56 +08:00
|
|
|
mount {
|
2017-05-28 06:15:53 +08:00
|
|
|
prefix_src_env: "HOME"
|
|
|
|
src: "/Documents"
|
|
|
|
dst: "/user/Documents"
|
2017-05-28 07:24:55 +08:00
|
|
|
rw: true
|
2017-05-28 04:01:46 +08:00
|
|
|
is_bind: true
|
|
|
|
mandatory: false
|
2017-05-28 03:43:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
mount {
|
2017-05-28 06:15:53 +08:00
|
|
|
prefix_src_env: "HOME"
|
|
|
|
src: "/.mozilla"
|
|
|
|
dst: "/user/.mozilla"
|
2017-05-28 03:43:56 +08:00
|
|
|
is_bind: true
|
2017-05-28 07:24:55 +08:00
|
|
|
rw: true
|
2017-05-28 04:01:46 +08:00
|
|
|
mandatory: false
|
2017-05-28 03:43:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
mount {
|
|
|
|
src: "/tmp/.X11-unix/X0"
|
|
|
|
dst: "/tmp/.X11-unix/X0"
|
|
|
|
is_bind: true
|
|
|
|
}
|
|
|
|
|
2018-09-06 17:14:24 +08:00
|
|
|
seccomp_string: "KILL {"
|
|
|
|
seccomp_string: " ptrace,"
|
|
|
|
seccomp_string: " process_vm_readv,"
|
|
|
|
seccomp_string: " process_vm_writev"
|
2017-09-27 21:49:12 +08:00
|
|
|
seccomp_string: "}"
|
2018-09-06 17:14:24 +08:00
|
|
|
seccomp_string: "DEFAULT ALLOW"
|
2017-05-28 03:43:56 +08:00
|
|
|
|
|
|
|
exec_bin {
|
2017-12-07 22:06:31 +08:00
|
|
|
path: "/usr/lib/firefox/firefox"
|
2017-05-28 03:43:56 +08:00
|
|
|
}
|