aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Swiecki <robert@swiecki.net>2023-06-24 21:04:29 +0200
committerRobert Swiecki <robert@swiecki.net>2023-06-24 21:04:29 +0200
commite736d554385f7ffe31694b8ace5b0c1c9358f640 (patch)
tree0d2bd24a4d55c4f7a4db4c6503f7097b38098d78
parent14f1e6852dccafc70e0747078df1d8832ec79da9 (diff)
downloadnsjail-e736d554385f7ffe31694b8ace5b0c1c9358f640.tar.gz
configs/telegram: a new config for the telegram-desktop
-rw-r--r--configs/telegram.cfg150
1 files changed, 150 insertions, 0 deletions
diff --git a/configs/telegram.cfg b/configs/telegram.cfg
new file mode 100644
index 0000000..365f45b
--- /dev/null
+++ b/configs/telegram.cfg
@@ -0,0 +1,150 @@
+# Example config for nsjail
+
+name: "telegram-with-net"
+
+description: "This policy allows to run telegram inside a jail. Access to networking is"
+description: "permitted with this setup (clone_newnet: false)."
+description: ""
+description: "The only permitted home directory is $HOME/.local/share/TelegramDesktop/"
+description: "The rest of available on the FS files/dires are libs and wayland-related files/dirs."
+description: ""
+description: "Run as:"
+description: "./nsjail --config configs/telegram.cfg"
+
+mode: ONCE
+hostname: "TELEGRAM"
+cwd: "/user"
+daemon: true
+
+time_limit: 0
+max_cpus: 2
+
+envar: "HOME=/user"
+envar: "WAYLAND_DISPLAY"
+envar: "TMP=/tmp"
+envar: "LANG"
+envar: "XDG_RUNTIME_DIR=/run/user/1000"
+envar: "QT_QPA_PLATFORM=wayland"
+
+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: "/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: "/.local/share/TelegramDesktop/"
+ dst: "/user/.local/share/TelegramDesktop/"
+ is_bind: true
+ rw: true
+ mandatory: false
+}
+
+mount {
+ dst: "/run/user/1000"
+ fstype: "tmpfs"
+ rw: true
+ is_bind: false
+}
+
+mount {
+ src: "/run/user/1000/wayland-0"
+ dst: "/run/user/1000/wayland-0"
+ is_bind: true
+ rw: false
+ mandatory: true
+}
+
+mount {
+ src: "/run/user/1000/pulse/native"
+ dst: "/run/user/1000/pulse/native"
+ is_bind: true
+ rw: false
+ 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 {
+ path: "/usr/bin/telegram-desktop"
+ exec_fd: true
+}