mirror of
https://github.com/AsgardEternal/Squad.nix.git
synced 2025-01-02 14:29:25 -06:00
fix: allow server configs to writeable by service user
This allows secrets to be correctly written to the files
This commit is contained in:
parent
53c6e91089
commit
4334ac281a
@ -983,16 +983,16 @@ in
|
|||||||
cp -f "${path}" ./"${name}.cfg"
|
cp -f "${path}" ./"${name}.cfg"
|
||||||
'') "" cfgs}
|
'') "" cfgs}
|
||||||
|
|
||||||
|
# Correct the permissions for the Squad Server cfgs. When the Squad Server is first
|
||||||
|
# installed it will include the configs by default with an overly open CHMOD.
|
||||||
|
chmod 0600 *.cfg
|
||||||
|
|
||||||
${lib.optionalString (cfg.config.server.passwordFile != null) ''
|
${lib.optionalString (cfg.config.server.passwordFile != null) ''
|
||||||
## Handle secrets for the `Server.cfg` file ##
|
## Handle secrets for the `Server.cfg` file ##
|
||||||
# Safely load the server password outside of the nix store
|
# Safely load the server password outside of the nix store
|
||||||
sed -i -e 's/^ServerPassword=.*$/ServerPassword='"$(${pkgs.systemd}/bin/systemd-creds cat SQUAD_SERVER_PASSWORD_FILE)"'/g' ./Server.cfg
|
sed -i -e 's/^ServerPassword=.*$/ServerPassword='"$(${pkgs.systemd}/bin/systemd-creds cat SQUAD_SERVER_PASSWORD_FILE)"'/g' ./Server.cfg
|
||||||
''}
|
''}
|
||||||
|
|
||||||
# Correct the permissions for the Squad Server cfgs. When the Squad Server is first
|
|
||||||
# installed it will include the configs by default with an overly open CHMOD.
|
|
||||||
chmod 0400 *.cfg
|
|
||||||
|
|
||||||
${lib.optionalString (cfg.config.rcon.passwordFile != null) ''
|
${lib.optionalString (cfg.config.rcon.passwordFile != null) ''
|
||||||
## Handle secrets for the `Rcon.cfg` file ##
|
## Handle secrets for the `Rcon.cfg` file ##
|
||||||
# Safely load the rcon password outside of the nix store
|
# Safely load the rcon password outside of the nix store
|
||||||
@ -1005,6 +1005,10 @@ in
|
|||||||
printf "%s" "$(${pkgs.systemd}/bin/systemd-creds cat SQUAD_LICENSE_FILE)" > ./License.cfg
|
printf "%s" "$(${pkgs.systemd}/bin/systemd-creds cat SQUAD_LICENSE_FILE)" > ./License.cfg
|
||||||
''}
|
''}
|
||||||
|
|
||||||
|
# Correct the permissions for the Squad Server cfgs. When the Squad Server is first
|
||||||
|
# installed it will include the configs by default with an overly open CHMOD.
|
||||||
|
chmod 0600 *.cfg
|
||||||
|
|
||||||
popd >/dev/null 2>&1
|
popd >/dev/null 2>&1
|
||||||
|
|
||||||
cat <<-__EOS__
|
cat <<-__EOS__
|
||||||
|
Loading…
Reference in New Issue
Block a user