Some details:
https://github.com/QubesOS/qubes-issues/issues/1354
Also Qubes already start new VMs paused first, exactly for the reason
mentioned on the blog - to setup some configuration entries (previously
in XenStore, now in QubesDB). This can be reused for some additional
settings for such unikernel. That code can launch additional hooks for
some extensions.
Those hooks will substantially change in Qubes 4.0, but since this part
of the integration isn't much work, it will probably not hurt to simply
do it again for new API in Qubes 4.0. All other parts should work the
same in Qubes 3.x and 4.x.
> > What's the effort? What's the best course of action? Is it viable in
> > practice?
The first think would be just starting some unikernel, just to have
testing environment. This would probably include that xenstore
modifications. Take a look here:
https://github.com/QubesOS/qubes-core-admin/blob/master/core-modules/000QubesVm.py#L1045-L1094
Example of hooks usage:
https://github.com/QubesOS/qubes-core-admin-linux/blob/master/appmenus-scripts/qubes-core-appmenus.py#L352-L360
For first you can ignore qrexec and gui - simply hit Ctrl-C when
qvm-start tries to connect qrexec. Then access VM console using sudo xl
console (or virsh -c xen:/// console).
Then it would come to porting vchan (easy),
Where can I get ocaml version of GnuPG ;) That would make
mirage-keys-vault.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
On Sun, Nov 22, 2015 at 10:53:25PM +0000, Thomas Leonard wrote:
http://lists.xenproject.org/archives/html/mirageos-devel/2015-11/msg00144.html
> A few points where I found the documentation a little unclear:
>
> - In addition to "exec_cmdline", I found I had to implement
> "just_exec" too (for use without "-p"). It seems that you must still
> set up a vchan for the session, but only use it to return the exit
> status.
Yes. Generally qrexec protocol documentation should be improved:
https://github.com/QubesOS/qubes-issues/issues/1392
> - The exit status message is defined to be the size of an int. I think
> it would be better to specify a size, rather than requiring programs
> to change the format depending on the platform. For now, I used
> (https://github.com/talex5/mirage-qubes/blob/229c4f9678cf871d5adff412827eafedee7b1c1b/qrexec_protocol.ml#L16):
>
> cstruct exit_status {
> uint64_t return_code;
> } as little_endian
Yes, that's a bug. And I think it should be uint32_t... (it's int, not
long).
> - It appears that exec commands have a trailing \0. I assume this is a
> convenience for C programs, but it seems risky to rely on it.
qrexec control channel comes from dom0, so can be trusted. Anyway will
add some safeguard.
> My qrexec module should be reusable. If other people want to try it,
> the API is at https://github.com/talex5/mirage-qubes/blob/master/qrexec.mli
> and the example code is here:
>
> https://github.com/talex5/mirage-qubes/blob/master/unikernel.ml
Currently they are in iptables syntax, so probably not the most
convenient one... This will be improved in Qubes 4.0 (or even 4.1).
But for now, it still should be possible to handle that format - there
are only few of iptables options combination, so you should be able to
parse that.
Quick request:
Can you document your learnings in some form of markdown in some repo so
that people can follow in your footsteps?
It's time to turn this thing into the future of computing, and the more
people can learn the ropes without having to do digging and fishing, the
better.
Good idea. I've written up my notes on how I replaced sys-firewall with a unikernel here:
http://roscidus.com/blog/blog/2016/01/01/a-unikernel-firewall-for-qubesos/
Hopefully that's a useful starting point for other people.
On Fri, 1 Jan 2016 11:20:05 -0800 (PST), Thomas Leonard <tal...@gmail.com> said:
> Good idea. I've written up my notes on how I replaced
> sys-firewall with a unikernel here:
> http://roscidus.com/blog/blog/2016/01/01/a-unikernel-firewall-for-qubesos/
> Hopefully that's a useful starting point for other people.
This is brilliant! I've just followed and apart from a very minor
documentation issue (need to install patch(1) otherwise opam is
unhappy) I've just done the same. It took about 20 minutes and I'm
watching streaming video through it as a test. So far so good.
initramfs and modules.img files.- I (newbie) wonder if it'd make sense to construct a unikernel NetVM as
well - for all of the performance and security reasons justifying the
FirewallVM?
- Is there a mechanism which would facilitate using net/firewall
unikernel VMs as Qubes presently uses DispVMs - i.e. at session end or
restart, they are each discarded (or perhaps reinitialized to a "clean"
condition), rather than having the possibly compromised contents saved
and used again?
For allowing inter-VM communication, editing rules.ml should be very easy.
For port forwarding, you'll need some way to identify the target client. The rule will probably be something like:
| { dst = `Firewall_uplink; proto = `TCP { dport = 80 } } -> `Nat_to (my_server, 8080)
For allowing inter-VM communication, editing rules.ml should be very easy.
For port forwarding, you'll need some way to identify the target client. The rule will probably be something like:
| { dst = `Firewall_uplink; proto = `TCP { dport = 80 } } -> `Nat_to (my_server, 8080)
This looks cooler than I though, but it still requires VM reboot. Which is undesired, because Qubes has some issues with reattaching NetVMs, so it would probably also require reboot of relevant AppVMs.
http://roscidus.com/blog/blog/2016/01/01/a-unikernel-firewall-for-qubesos/
Hopefully that's a useful starting point for other people.
On 01/01/2016 02:20 PM, Thomas Leonard wrote:
> On Monday, December 28, 2015 at 7:56:59 PM UTC, Manuel Amador (Rudd-O)
> wrote:
>> Quick request:
>>
>> Can you document your learnings in some form of markdown in some repo so
>> that people can follow in your footsteps?
>>
>> It's time to turn this thing into the future of computing, and the more
>> people can learn the ropes without having to do digging and fishing, the
>> better.
>>
> Good idea. I've written up my notes on how I replaced sys-firewall with a
> unikernel here:
>
>
> http://roscidus.com/blog/blog/2016/01/01/a-unikernel-firewall-for-qubesos/
>
> Hopefully that's a useful starting point for other people.
>
THANK YOU for your work, and this wonderful write up!!
- I (newbie) wonder if it'd make sense to construct a unikernel NetVM as
well - for all of the performance and security reasons justifying the
FirewallVM?
- Is there a mechanism which would facilitate using net/firewall
unikernel VMs as Qubes presently uses DispVMs - i.e. at session end or
restart, they are each discarded (or perhaps reinitialized to a "clean"
condition), rather than having the possibly compromised contents saved
and used again?
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
On Sun, Jan 03, 2016 at 03:06:33AM -0800, Vít Šesták wrote:
> On Friday, January 1, 2016 at 8:20:06 PM UTC+1, Thomas Leonard wrote:
> >
> >
> >
> > http://roscidus.com/blog/blog/2016/01/01/a-unikernel-firewall-for-qubesos/
> >
> > Hopefully that's a useful starting point for other people.
> >
>
> Few comments on your article:
>
> * Startup time includes creation of volatile.img, which is not needed for
> the unikernel. It takes about 0.5s on my laptop. If you want to cut the
> time even further, you might try to modify
> /usr/lib/qubes/prepare-volatile-img.sh to do nothing for the particular VM.
> Maybe the automatic volatile.img creation will be removed in Qubes 4.0
> thanks to the refactoring.
It is already moved into initramfs in Qubes 3.1. So in case of
unikernel, it isn't executed.
BTW This is the reason why kernel package from 3.0 isn't compatible with
3.1...
(...)
> * I remember being able to run Linux-based sys-firewall with 200MiB of RAM
> (the actual usage, not just he minimum). So, the RAM saving is not as
> significant as you suggest, but it is still notable.
I think I've seen someone on 32c3 with sys-firewall trimmed to 150MB.
Anyway still five times bigger than unikernel-based.
On Saturday, January 2, 2016 at 8:00:14 PM UTC, William Waites wrote:(trimming the Cc list)
On Sat, 2 Jan 2016 11:38:17 -0800 (PST), Vít Šesták said:
> Looks great! However, there are two unlisted features I use in
> the Linux FW and I probably can't use in the Mirage one:
> * explicitly allowed port forwarding to AppVM
> * explicitly allowed inter-VM communication
From what I can tell these "by hand" cases are handled easily
enough. Just modify the `rules.ml' file and rebuild the
image. Approximately as easy as editing a config file (apart from the
slight bump of getting the image to dom0, but I hear that is being
worked on).
For people planning to update regularly - which is to say, anyone using version 0.1 ;-) - I'd sugggest using these scripts:
https://github.com/talex5/qubes-test-mirage
Then the process is:
1. vi rules.ml
2. make
3. test-mirage mir-qubes-firewall.xen mirage-firewall
(of course, you'll need to stop the clients first and restart them afterwards)
I've already pushed some code to drop the NAT table if it runs out of memory and/or ports, so you might want to try updating already ("git pull && make").
The idea of unikernels in Qubes is not entirely new; it's come up on the
lists a few times. This doesn't seem to have been posted to the list
yet, though: https://northox.github.io/qubes-rumprun/
The above blog post makes some arguments for integrating some unikernels
into Qubes for various things: TCP/IP stack vulnerability mitigation,
in-line filters on communication channels between VMs (I always imagined
using a MirageOS TLS wrap/unrwap unikernel to avoid OpenSSL exploits),
secure file conversion, and generally promoting increased disaggregation
and finer-grained isolation.
This post asks for feedback and poses a few questions to be answered.
> Now, I'm looking for constructive feedback from Qubes' community and
> will try to answer a few questions: What exactly would need to be
> modified on Qubes' side to be part of the default installation?
> What's the effort? What's the best course of action? Is it viable in
> practice? Does it make sense?
I don't have the answers to these questions, but maybe others can chime
in to help answer them.
Andrew
Hi, I'm running Qubes 3.1rc2
Is it only me or since few update we can't start mirage-fw?
qvm-start seems to wait qrexec-daemon...
"Waiting for VM's qrexec agent.failed"
ERROR: Cannot excecute qrexec-daemon
I have try to set qrexec_timeout to 0 but this change nothing.
Here:
.[32;1mMirageOS booting....[0m
Initialising timer interface
Initialising console ... done.
getenv(OCAMLRUNPARAM) -> null
getenv(CAMLRUNPARAM) -> null
getenv(PATH) -> null
Unsupported function lseek called in Mini-OS kernel
Unsupported function lseek called in Mini-OS kernel
Unsupported function lseek called in Mini-OS kernel
getenv(OCAMLRUNPARAM) -> null
getenv(CAMLRUNPARAM) -> null
getenv(TMPDIR) -> null
getenv(TEMP) -> null
Netif: add resume hook
gnttab_stubs.c: initialised mini-os gntmap
Fatal error: exception Not_found
Mirage exiting with status 2
Do_exit called!
Has anyone got a Mirage-VPN ProxyVM running?
I use very many different VPN connections simultaneously. I am constantly running out of RAM to open any more VMs.
I am already maxed out at 16GB, so I need to find ways to cut back on RAM. (And disk space).
Is it possible to run OpenVPN? (Sorry for necro)