Firejail to sandbox online games

This commit is contained in:
Emmet 2023-07-31 09:45:45 -05:00
parent 2459f01634
commit a81aecff5c
7 changed files with 79 additions and 3 deletions

View file

@ -11,6 +11,7 @@
( import ../../system/app/docker.nix {storageDriver = "btrfs"; inherit username pkgs config lib;} )
../../system/app/gamemode.nix
../../system/app/steam.nix
../../system/app/prismlauncher.nix
../../system/security/doas.nix
../../system/security/gpg.nix
../../system/security/blocklist.nix

View file

@ -16,6 +16,7 @@
../../system/security/gpg.nix
../../system/security/blocklist.nix
../../system/security/firewall.nix
../../system/security/firejail.nix
../../system/security/openvpn.nix
../../system/style/stylix.nix
];

View file

@ -0,0 +1,5 @@
{ config, lib, pkgs, ... }:
{
environment.systemPackages = [ pkgs.prismlauncher ];
}

View file

@ -3,4 +3,5 @@
{
hardware.opengl.driSupport32Bit = true;
programs.steam.enable = true;
environment.systemPackages = [ pkgs.steam ];
}

View file

@ -0,0 +1,51 @@
# Firejail profile for prismlauncher
# Description: An Open Source Minecraft launcher that can manage multiple instances
# This file is overwritten after every install/update
# Persistent global definitions
include globals.local
ignore noexec ${HOME}
noblacklist ${HOME}/.local/share/PrismLauncher
include allow-java.inc
include disable-common.inc
include disable-devel.inc
include disable-interpreters.inc
include disable-programs.inc
include disable-shell.inc
include disable-xdg.inc
mkdir ${HOME}/.local/share/PrismLauncher
whitelist ${HOME}/.local/share/PrismLauncher
include whitelist-common.inc
include whitelist-runuser-common.inc
include whitelist-usr-share-common.inc
include whitelist-var-common.inc
caps.drop all
netfilter
nodvd
nogroups
noinput
nonewprivs
noroot
notv
nou2f
novideo
protocol unix,inet,inet6,netlink
seccomp
tracelog
disable-mnt
private-bin java,java-config,minecraft-launcher,prismlauncher
private-cache
private-dev
# If multiplayer or realms break, add 'private-etc <your-own-java-folder-from-/etc>'
# or 'ignore private-etc' to your minecraft-launcher.local.
private-tmp
dbus-system none
restrict-namespaces

View file

@ -0,0 +1,20 @@
{ config, lib, pkgs, ... }:
{
environment.systemPackages = with pkgs; [ firejail ];
programs.firejail.enable = true;
programs.firejail.wrappedBinaries = {
prismlauncher = {
executable = "${pkgs.prismlauncher}/bin/prismlauncher";
profile = ./firejail-profiles/prismlauncher.profile;
};
steam = {
executable = "${pkgs.steam}/bin/steam";
profile = "${pkgs.firejail}/etc/firejail/steam.profile";
};
steam-run = {
executable = "${pkgs.steam}/bin/steam-run";
profile = "${pkgs.firejail}/etc/firejail/steam.profile";
};
};
}

View file

@ -14,13 +14,10 @@ in
{
home.packages = with pkgs; [
# Games
steam # also requires system-level steam.nix to run
gamehub
myRetroarch
airshipper
qjoypad
prismlauncher
#TODO need flatpak steam - I don't have this declaratively yet
];
# The following 2 declarations allow retroarch to be imported into gamehub
# Set retroarch core directory to ~/.local/bin/libretro