Open MunsMan opened 3 months ago
I had a look and the Nextcloud module and found lots of quoting (good). However:
mkExport = { arg, value }: "export ${arg}=${value}";
, should ${value}
be quoted?I think that ${value}
might need some quotes as well. I just found this PR, which describes the quotation off occ commands. It might be, that many special characters need to be escaped. In the Nextcloud docs are no mention, of special password formats.
From the logs, it looks like that the occ install command is not escaped properly because in the end, Nextcloud can't be installed.
what you probably want to do is change how installFlags
are handled; currently these are simply concatenated with whitespace. Changing that to use -adminpass=...
syntax instead ought to fix the issue.
eyeballing it (i have not tested this, nor do i intend to spend much time on this),
installFlags = concatStringsSep " \\\n "
- (mapAttrsToList (k: v: "${k} ${toString v}") {
+ (mapAttrsToList (k: v: "${k}=${toString v}") {
"--database" = ''"${c.dbtype}"'';
ought to be enough (I'm honestly not sure why these arguments are handled with this much abstraction on top, but I won't question it).
The thing is, while this command runs, everybody can read the admin password since the cmdline is world-readable (also it's only read on the very first install because Nextcloud demands it and ignored later). So I think it's better anyways to immediately change the password in the UI after provisioning.
If @stuebinm's fix works, I'm happy to accept a PR (preferably with a test) for this.
'm honestly not sure why these arguments are handled with this much abstraction on top, but I won't question it
Probably just grown historically :shrug:
Describe the bug
Unable to build the Nextcloud Service, if the password starts with a “-”. Similar issue reported by NextCloud issue. I guess the password was not properly escaped, but it took me hours to figure out, why my service wasn't work.
Steps To Reproduce
Steps to reproduce the behavior:
adminPassFile
Expected behavior
Should escape the password properly and just work.
Additional context
Notify maintainers
Sadly, there are no active maintainers listed, resulting in pinging randomly using git-blame… @Ma27 @bachp @pennae @stuebinm
Metadata
Add a :+1: reaction to issues you find important.