Description of problem:
Take a file /foo, that defines:
The following is rejected by systemd:
The following works:
ExecStart=/bin/bash -c "exec $COMMAND"
It would be nice to be able to use the simpler version.
Version-Release number of selected component (if applicable):
Hmm, we currently do env var substitution only for the command line (i.e. argv), not the binary we actually execute (i.e. the first param to execv).
Hmm, what concerns me a bit here is that this might be really hard to fix due to the SELinux logic: SELinux requires us to label the listening sockets correctly according to the binary we might eventually run for it. And that means we'd have to do the variable substitution at the time we initialize the socket and not delay it until the time we actually spawn the process. That would be a fairly significant change because it'd require us to calculate the execution env block far in advance, which is really messy since it could change all the time.
Example: somebody changes the default env block for systemd via "systemctl set-environment". This would then have the effect that we might have to relabel some sockets we listen on. And that would be ugly.
This would be certainly doable, however it sounds like a major headache to me. Not only code-wise, but also security-wise.
So, before I burn more brain cells on this: do you have a convincing use case for this?
I have a single use case for this. I can work around it, assuming my second command as posted continues to work in future versions.
That said, this restriction should probably be documented (it may be and I just didn't see it.)
This behaviour is now documented in git upstream.