On Tue, 2015-02-03 at 15:52 +0100, Marek Marczykowski-Górecki wrote:
> The current script does not use preset file because it wasn't available
> at the time of adding systemd support to qubes-core-vm package. But
> since it is supported now, IMO it is good idea for using it. "systemctl
> preset" should be called at both install and upgrade, as the list
> changes over the time (see #909 for example). This will
> greatly reduce that %post script, which (always?) good.
FWIW, not really: the only changes are to replace "disable" with
"preset" and remove the "forcibly disable" case (it's unnecessary
according to my test with systemd-208-29.fc20.x86_64, although this
reduction is arguably unrelated to the use of a present file).
> One thing to take care of - when Qubes provides overridden .service file
> (NetworkManager, crond, cups etc), it is required to disable+enable the
> service, to change the symlink from /usr/lib/systemd/system/... to
> /etc/systemd/system/... This is currently implemented as
> installOverridenServices macro called from triggerss. So this part needs
> to be left intact.
Sounds good, I'll probably get to this in a few days.
> > Separately, I may look into solving the original problem of opening a
> > bidirectional stream to a command running in another AppVM via Qubes RPC
> > instead of sshd. After reading
> >
https://groups.google.com/d/topic/qubes-devel/U259lZZYDJI/discussion, I
> > think what I'd do is write an RPC service that starts "sshd -i" with
> > dummy authentication parameters and then rig /etc/ssh/ssh_config so that
> > a command like "ssh my-other-appvm.qubes git-receive-pack ..." results
> > in the correct ProxyCommand. This gives us all the features of ssh
> > without having to reimplement the ones we want one at a time; of course,
> > some of them are dangerous to the client, as the type of people who use
> > Qubes will likely know. Maintainers, would you be interested in
> > including this functionality in qubes-core-vm?
>
> I don't think sshd is a good idea here - sounds like an overkill.
> Perhaps it would be enough to just change /usr/lib/qubes/qrun-in-vm, to
> use socat instead of unidirectional cat. Something like:
> socat stdio "fd:$SAVED_FD_0!!fd:$SAVED_FD_1"
What specifically do you see as the downside of ssh? Attack surface on
the client (which I suppose would be consistent with the philosophy of
the rest of Qubes)? Performance? Ease of use?
Replacing the cat in /usr/lib/qubes/qrun-in-vm by socat is the easy
part. The less trivial part is delimiting the command from the standard
input. A newline might be adequate for reasonable users; a null byte
might be a little better. I'll try the null byte.
This is probably fine for my git use case. For more complex scripting,
users may very reasonably want separate stderr and an exit code. Dom0's
qvm-run does those somehow. It might be reasonable to replicate that
implementation; otherwise, I've used the ssh solution before and I think
it's quite convenient for users who are willing to have the ssh client
in their TCB. I suppose we can wait until someone asks.
> Once it will work for qvm-run, you can add your own service, which will
> call predefined command (instead of anything as in sshd or qvm-run),
> then for the git case, you can use git-remote-ext(1) to call
> qrexec-client-vm with proper arguments. I'm not sure about git
> internals, but it looks like in the worst case, you'll need 3 services:
> git-receive-pack, git-upload-pack and git-upload-archive.
>
> Regarding qubes-core-vm - I don't think it is a good place for such
> specific implementations (with exception for making qvm-run
> bi-directional). But if you succeed with "git over Qubes RPC", it would
> be nice to have some instructions how to achieve it. You can just sent
> them here (to be copied/linked to our wiki).
At this time, I'm willing to give the client AppVM the equivalent of
full VMShell access to the target AppVM and am not interested in setting
up services for individual commands. Either way, I'm of the opinion
that it's appropriate for the Qubes wiki to describe how to allow
execution of either arbitrary commands or a specific command, but
application-specific options to use an alternate remote shell are out of
scope.
Matt