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

[OPS-1161] Harden systemd service #33

Open
wants to merge 1 commit into
base: release
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
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
}))

{
module = import ./service.nix;
module = import ./service.nix { inherit serokell-nix; };

# Deployment expressions
deploy.magicRollback = false;
Expand Down
5 changes: 3 additions & 2 deletions service.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# SPDX-FileCopyrightText: 2020-2023 Serokell <https://serokell.io/>
#
# SPDX-License-Identifier: MPL-2.0

{ serokell-nix }:
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.hackage-search;
inherit (serokell-nix.lib.systemd) hardeningProfiles withHardeningProfile;
in {
options.services.hackage-search = {
enable = mkEnableOption "Hackage search server";
Expand Down Expand Up @@ -81,7 +82,7 @@ in {
startLimitBurst = mkDefault 5;
startLimitIntervalSec = mkDefault 300;

serviceConfig = {
serviceConfig = withHardeningProfile hardeningProfiles.backend {
DynamicUser = true;
User = "hackage-search";

Expand Down