Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nixos: Fix timesyncd test for systemd >= 257.1
Version 257.1 of systemd changed[1] the PrivateTmp setting for the systemd-timesyncd service from "yes" to "disconnected", which broke our systemd-timesyncd test. The reason for this is because the systemd-tmpfiles-setup.service is *only*[2] added as a dependency of systemd-timesyncd.service if PrivateTmp is set to "yes" but not when it is set to "disconnected" (which would make sense given that the tmpfiles.d mechanism was originally designed for temporary files). Commit 339a866 switched the activation script to using systemd-tmpfiles, but the commit in question doesn't provide an explanation why this was necessary in this particular case. However the pull request[3] lists an ongoing effort to get rid of Perl and in the future get also rid of BASH for activation. The reasons for doing this are outlined in the document[4]: > The simple presence of interpreters on a system pose a security risk. > An attacker that gains access to a system can abuse them to execute > arbitrary commands. Mitre lists this as technique T1059. The most > radical yet simple solution to mitigate this exploit is to remove all > interpreters from a system (Mitre M1042). This radical solution is > only really feasible and/or interesting for appliances (i.e. > non-interactive) systems. Especially for high-security solutions this > mitigtation is interesting. I personally don't think this is a very compelling reason, at least for our activation scripts, since an attacker could simply drop an executable binary. Nevertheless, getting rid of additional dependencies on eg. Perl or BASH is something worth pursuing to trim down moving parts. To address this, I decided to implement this as a normal systemd service unit, since we need to guarantee that it's started before systemd-timesyncd.service and with a dedicated unit we can ensure explicit ordering. This has the advantage that we don't interfere with the effort of getting rid of Perl/BASH for activation/boot and also don't risk running into race conditions (again) because it's very unlikely that systemd will change/deprecate explicit unit ordering in the near future. [1]: systemd/systemd@1f6e192 [2]: https://github.com/systemd/systemd/blob/30675a6ee98540a02bd1d6afcf80f0c0aa8c0910/src/core/unit.c#L1274 [3]: #263203 [4]: https://pad.lassul.us/nixos-perlless-activation Signed-off-by: aszlig <aszlig@nix.build>
- Loading branch information