namecoind nixos module: security enhancements
This commit is contained in:
parent
13e2d2245e
commit
8db7c14e56
@ -437,7 +437,7 @@
|
|||||||
riak = 205;
|
riak = 205;
|
||||||
#shout = 206; #unused
|
#shout = 206; #unused
|
||||||
gateone = 207;
|
gateone = 207;
|
||||||
#namecoin = 208; #unused
|
namecoin = 208;
|
||||||
|
|
||||||
# When adding a gid, make sure it doesn't match an existing
|
# When adding a gid, make sure it doesn't match an existing
|
||||||
# uid. Users and groups with the same name should have equal
|
# uid. Users and groups with the same name should have equal
|
||||||
|
@ -45,7 +45,8 @@ in
|
|||||||
type = types.path;
|
type = types.path;
|
||||||
example = "/etc/namecoin/wallet.dat";
|
example = "/etc/namecoin/wallet.dat";
|
||||||
description = ''
|
description = ''
|
||||||
Wallet file.
|
Wallet file. The ownership of the file has to be
|
||||||
|
namecoin:namecoin, and the permissions must be 0640.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -61,6 +62,8 @@ in
|
|||||||
USER=namecoin
|
USER=namecoin
|
||||||
PASSWORD=secret
|
PASSWORD=secret
|
||||||
</literal>
|
</literal>
|
||||||
|
The ownership of the file has to be namecoin:namecoin,
|
||||||
|
and the permissions must be 0640.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -107,10 +110,29 @@ in
|
|||||||
createHome = true;
|
createHome = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
users.extraGroups = singleton
|
||||||
|
{ name = "namecoin";
|
||||||
|
gid = config.ids.gids.namecoin;
|
||||||
|
};
|
||||||
|
|
||||||
systemd.services.namecoind = {
|
systemd.services.namecoind = {
|
||||||
description = "Namecoind Daemon";
|
description = "Namecoind Daemon";
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
preStart = ''
|
||||||
|
if [ "$(stat --printf '%u' ${cfg.userFile})" != "${toString config.ids.uids.namecoin}" \
|
||||||
|
-o "$(stat --printf '%g' ${cfg.userFile})" != "${toString config.ids.gids.namecoin}" \
|
||||||
|
-o "$(stat --printf '%a' ${cfg.userFile})" != "640" ]; then
|
||||||
|
echo "ERROR: bad ownership or rights on ${cfg.userFile}" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ "$(stat --printf '%u' ${cfg.wallet})" != "${toString config.ids.uids.namecoin}" \
|
||||||
|
-o "$(stat --printf '%g' ${cfg.wallet})" != "${toString config.ids.gids.namecoin}" \
|
||||||
|
-o "$(stat --printf '%a' ${cfg.wallet})" != "640" ]; then
|
||||||
|
echo "ERROR: bad ownership or rights on ${cfg.wallet}" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
'';
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
User = "namecoin";
|
User = "namecoin";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user