Skip to content

Commit

Permalink
Merge pull request #123941 from mweinelt/matrix-synapse
Browse files Browse the repository at this point in the history
nixos/matrix-synapse: protect created files
  • Loading branch information
Ma27 authored May 22, 2021
2 parents bec3a44 + 79e6754 commit 278bcdc
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions nixos/modules/services/misc/matrix-synapse.nix
Original file line number Diff line number Diff line change
Expand Up @@ -699,12 +699,12 @@ in {
];

users.users.matrix-synapse = {
group = "matrix-synapse";
home = cfg.dataDir;
createHome = true;
shell = "${pkgs.bash}/bin/bash";
uid = config.ids.uids.matrix-synapse;
};
group = "matrix-synapse";
home = cfg.dataDir;
createHome = true;
shell = "${pkgs.bash}/bin/bash";
uid = config.ids.uids.matrix-synapse;
};

users.groups.matrix-synapse = {
gid = config.ids.gids.matrix-synapse;
Expand All @@ -726,13 +726,18 @@ in {
User = "matrix-synapse";
Group = "matrix-synapse";
WorkingDirectory = cfg.dataDir;
ExecStartPre = [ ("+" + (pkgs.writeShellScript "matrix-synapse-fix-permissions" ''
chown matrix-synapse:matrix-synapse ${cfg.dataDir}/homeserver.signing.key
chmod 0600 ${cfg.dataDir}/homeserver.signing.key
'')) ];
ExecStart = ''
${cfg.package}/bin/homeserver \
${ concatMapStringsSep "\n " (x: "--config-path ${x} \\") ([ configFile ] ++ cfg.extraConfigFiles) }
--keys-directory ${cfg.dataDir}
'';
ExecReload = "${pkgs.util-linux}/bin/kill -HUP $MAINPID";
Restart = "on-failure";
UMask = "0077";
};
};
};
Expand Down

0 comments on commit 278bcdc

Please sign in to comment.