Skip to content

Commit

Permalink
espanso: add sandboxing for systemd service
Browse files Browse the repository at this point in the history
  • Loading branch information
talal committed Oct 18, 2024
1 parent 2b13611 commit 0678a95
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions modules/services/espanso.nix
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,15 @@ in {
Type = "exec";
ExecStart = "${cfg.package}/bin/espanso daemon";
Restart = "on-failure";

# Sandboxing.
LockPersonality = true;
MemoryDenyWriteExecute = true;
NoNewPrivileges = true;
PrivateUsers = true;
RestrictNamespaces = true;
SystemCallArchitectures = "native";
SystemCallFilter = "@system-service";
};
Install = { WantedBy = [ "default.target" ]; };
};
Expand Down
7 changes: 7 additions & 0 deletions tests/modules/services/espanso/basic-configuration.service
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@ WantedBy=default.target

[Service]
ExecStart=@espanso@/bin/espanso daemon
LockPersonality=true
MemoryDenyWriteExecute=true
NoNewPrivileges=true
PrivateUsers=true
Restart=on-failure
RestrictNamespaces=true
SystemCallArchitectures=native
SystemCallFilter=@system-service
Type=exec

[Unit]
Expand Down

0 comments on commit 0678a95

Please sign in to comment.