Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

espanso: add sandboxing for systemd service #5957

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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";
rycee marked this conversation as resolved.
Show resolved Hide resolved
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