spotify opensnitch rules

This commit is contained in:
Grimmauld 2024-10-05 13:15:32 +02:00
parent 722c6f8e86
commit 0b73857ec4
Signed by: Grimmauld
GPG Key ID: C2946668769F91FB
3 changed files with 103 additions and 11 deletions

View File

@ -26,7 +26,7 @@ in
./wine.nix ./wine.nix
./c.nix ./c.nix
./java.nix ./java.nix
./opensnitch.nix ./opensnitch
./ranger.nix ./ranger.nix
]; ];

View File

@ -76,19 +76,115 @@ in
type = "simple"; type = "simple";
operand = "dest.port"; operand = "dest.port";
data = "53"; data = "53";
list = null;
} }
{ {
type = "lists"; type = "lists";
operand = "lists.nets"; operand = "lists.nets";
data = pkgs.writeTextDir "cidr_dns.list" (concatLines ((map (ip: "${ip}/32") config.networking.nameservers) ++ local_network)); data = pkgs.writeTextDir "cidr_dns.list" (concatLines ((map (ip: "${ip}/32") config.networking.nameservers) ++ local_network));
list = null;
} }
{ {
type = "simple"; type = "simple";
operand = "user.id"; operand = "user.id";
data = "998"; data = "998";
list = null; }
];
};
};
spotify_deny = mkIf (config.grimmShared.spotify.enable && graphical) {
name = "spotify-deny";
enabled = true;
action = "deny";
precedence = false;
duration = "always";
operator = {
type ="simple";
sensitive = false;
operand = "process.path";
data = "${lib.getBin pkgs.spotify}/share/spotify/.spotify-wrapped";
};
};
ncspot = mkIf (config.grimmShared.spotify.enable) {
name = "ncspot";
enabled = true;
action = "allow";
duration = "always";
operator = {
type = "list";
operand = "list";
list = [
{
type = "regexp";
operand = "dest.port";
data = "443|4070";
}
{
type ="simple";
sensitive = false;
operand = "process.path";
data = lib.getExe pkgs.ncspot;
}
{
type = "lists";
operand = "lists.domains_regexp";
data = ./spotify_hosts;
}
];
};
};
spotify_allow = mkIf (config.grimmShared.spotify.enable && graphical) {
name = "spotify-allow";
enabled = true;
action = "allow";
duration = "always";
precedence = true;
operator = {
type = "list";
operand = "list";
list = [
{
type = "regexp";
operand = "dest.port";
data = "443|4070";
}
{
type ="simple";
sensitive = false;
operand = "process.path";
data = "${lib.getBin pkgs.spotify}/share/spotify/.spotify-wrapped";
}
{
type = "lists";
operand = "lists.domains_regexp";
data = ./spotify_hosts;
}
];
};
};
spotify_allow_local = mkIf (config.grimmShared.spotify.enable && graphical) {
name = "spotify-allow-local";
enabled = true;
action = "allow";
duration = "always";
precedence = true;
operator = {
type = "list";
operand = "list";
list = [
{
type ="simple";
sensitive = false;
operand = "process.path";
data = "${lib.getBin pkgs.spotify}/share/spotify/.spotify-wrapped";
}
{
type = "lists";
operand = "lists.nets";
data = local_ips;
} }
]; ];
}; };
@ -113,13 +209,11 @@ in
type = "simple"; type = "simple";
operand = "dest.port"; operand = "dest.port";
data = "5353"; data = "5353";
list = null;
} }
{ {
type = "simple"; type = "simple";
operand = "user.id"; operand = "user.id";
data = "996"; data = "996";
list = null;
} }
]; ];
}; };
@ -138,20 +232,17 @@ in
type ="simple"; type ="simple";
sensitive = false; sensitive = false;
operand = "process.path"; operand = "process.path";
list = null;
data = lib.getExe' pkgs.cups-filters "cups-browsed"; data = lib.getExe' pkgs.cups-filters "cups-browsed";
} }
{ {
type ="regexp"; type ="regexp";
operand = "dest.port"; operand = "dest.port";
data = "53"; data = "53";
list = null;
} }
{ {
type = "lists"; type = "lists";
operand = "lists.nets"; operand = "lists.nets";
data = local_ips; data = local_ips;
list = null;
} }
]; ];
}; };
@ -170,13 +261,11 @@ in
type ="simple"; type ="simple";
sensitive = false; sensitive = false;
operand = "process.path"; operand = "process.path";
list = null;
data = "${lib.getBin pkgs.systemd}/lib/systemd/systemd-timesyncd"; } data = "${lib.getBin pkgs.systemd}/lib/systemd/systemd-timesyncd"; }
{ {
type ="regexp"; type ="regexp";
operand = "dest.port"; operand = "dest.port";
data = "123|37"; data = "123|37";
list = null;
} }
]; ];
}; };

View File

@ -0,0 +1,3 @@
scdn.co
spotifycdn.com
spotify.com