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

nixos/wordpress: prefer 'umask' over 'chmod' #290018

Closed
wants to merge 1 commit into from
Closed
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
13 changes: 6 additions & 7 deletions nixos/modules/services/web-apps/wordpress.nix
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,11 @@ let
# The match in this line is not a typo, see https://github.com/NixOS/nixpkgs/pull/124839
grep -q "LOOGGED_IN_KEY" "${hostStateDir}/secret-keys.php" && rm "${hostStateDir}/secret-keys.php"
if ! test -e "${hostStateDir}/secret-keys.php"; then
umask 0177
echo "<?php" >> "${hostStateDir}/secret-keys.php"
${concatMapStringsSep "\n" (var: ''
echo "define('${var}', '`tr -dc a-zA-Z0-9 </dev/urandom | head -c 64`');" >> "${hostStateDir}/secret-keys.php"
'') secretsVars}
echo "?>" >> "${hostStateDir}/secret-keys.php"
chmod 440 "${hostStateDir}/secret-keys.php"
install -m 0440 /dev/stdin "${hostStateDir}/secret-keys.php" << EOF
<?php
${concatMapStringsSep "\n" (var: ''define('${var}', "$(tr -dc a-zA-Z0-9 </dev/urandom | head -c 64)");'') secretsVars}
?>
EOF
fi
'';

Expand Down Expand Up @@ -468,6 +466,7 @@ in
Type = "oneshot";
User = user;
Group = webserver.group;
UMask = "0117";
};
})) eachSite)

Expand Down