updated from main (commit 2e42a836c4)

This commit is contained in:
Canopy bot 2022-11-05 15:14:01 +00:00
commit f4a8902a19
67 changed files with 7546 additions and 0 deletions

88
About Normal file
View file

@ -0,0 +1,88 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>About</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="About" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="post"><h2>About</h2><span class="author">Written by hannes</span><br/><div class="tags">Classified under: <a href="/tags/overview" class="tag">overview</a><a href="/tags/myself" class="tag">myself</a><a href="/tags/background" class="tag">background</a></div><span class="date">Published: 2016-04-01 (last updated: 2021-11-19)</span><article><h2>What is a &quot;full stack engineer&quot;?</h2>
<p>Analysing the word literally, we should start with silicon and some electrons,
maybe a soldering iron, and build everything all the way up to our favourite
communication system.</p>
<p>While I know how to solder, I don't plan to write about hardware in here. I'll
assume that off-the-shelf hardware (arm/amd64) is available and trustworthy.
Read the <a href="http://blog.invisiblethings.org/papers/2015/x86_harmful.pdf">Intel x86 considered
harmful</a> paper in
case you're interested in trustworthiness of hardware.</p>
<p>My current obsession is to enable people to take back control over their data:
simple to setup, secure, decentralised infrastructure. We're not there yet,
which also means I've plenty of projects :).</p>
<p>I will write about my projects, which cover topics on various software layers.</p>
<h3>Myself</h3>
<p>I'm Hannes Mehnert, a <a href="http://www.catb.org/jargon/html/H/hacker.html">hacker</a>
(in the original sense of the word), 3X years old. In my spare time, I'm not
only a hacker, but also a barista. I like to travel and repair my recumbent
bicycle.</p>
<p>Back in 199X, my family bought a PC. It came
with MS-DOS installed, I also remember Windows 3.1 (likely on a later computer).
This didn't really hook me into computers, but over the years I started with
friends to modify some computer games (e.g. modifying text of Civilization). I
first encountered programming in high school around 1995: Borland's Turbo Pascal
(which chased me for several years).</p>
<p>Fast forwarding a bit, I learned about the operating system Linux (starting with
SUSE 6.4) and got hooked (by providing basic network services (NFS/YP/Samba)) to
UNIX. In 2000 I joined the <a href="https://www.ccc.de">Chaos Computer Club</a>.
Over the years I learned various things, from Linux kernel modifications,
Perl, PHP, basic network and security. I use <a href="https://www.FreeBSD.org">FreeBSD</a> since 4.5, FreeBSD-CURRENT
on my laptop. I helped to <a href="http://wijvertrouwenstemcomputersniet.nl">reverse engineer and analyse the security of a voting
computer</a> in the Netherlands, and some
<a href="http://blinkenlights.net/">art installations</a> in Berlin and Paris. There were
several annual Chaos Communication Congresses where I co-setup the network
(backbone, access layer, wireless, network services such as DHCP/DNS), struggling with
Cisco hardware from their demo pool, and also amongst others HP, Force10, Lucent, Juniper
equipment.</p>
<p>In the early 200X I started to program <a href="https://opendylan.org">Dylan</a>, a LISP
dialect (dynamic, multiple inheritance, object-oriented), which even resulted in
a <a href="https://github.com/dylan-hackers/network-night-vision/">TCP/IP
implementation</a>
including a wireshark-like GTK based user interface with a shell similar to IOS for configuring the stack.</p>
<p>I got excited about programming languages and type theory (thanks to
<a href="https://www.cis.upenn.edu/~bcpierce/tapl/">types and programming languages</a>, an
excellent book); a key event for me was the <a href="http://cs.au.dk/~danvy/icfp05/">international conference on functional programming (ICFP)</a>. I wondered how a
<a href="http://homes.soic.indiana.edu/jsiek/what-is-gradual-typing/">gradually typed</a>
Dylan would look like, leading to my master thesis. Gradual typing is the idea to evolve untyped programs into typed ones, and runtime type errors must be in the dynamic part. To me, this sounded like a great idea, to start with some random code, and add types later.
My result was not too convincing (too slow, unsound type system).
Another problem with Dylan is that the community is very small, without sufficient time and energy to maintain the
self-hosted compiler(s) and the graphical IDE.</p>
<p>During my studies I met <a href="http://www.itu.dk/people/sestoft/">Peter Sestoft</a>.
After half a year off in New Zealand (working on formalising some type systems),
I did a PhD in the ambitious research project &quot;<a href="https://itu.dk/research/tomeso/">Tools and methods for
scalable software verification</a>&quot;, where we mechanised proofs of the functional correctness
of imperative code (PIs: Peter and <a href="http://cs.au.dk/~birke/">Lars Birkedal</a>).
The idea was great, the project was fun, but we ended with 3000 lines of proof
script for a 100 line Java program. The Java program was taken off-the-shelf,
several times refactored, and most of its shared mutable state was removed. The
proof script was in <a href="https://coq.inria.fr">Coq</a>, using our higher-order separation logic.</p>
<p>I concluded two things: formal verification is hard and usually not applicable
for off-the-shelf software. <em>Since we have to rewrite the software anyways, why
not do it in a declarative way?</em></p>
<p>Some artefacts from that time are still around: an <a href="https://coqoon.github.io/">eclipse plugin for
Coq</a>, I also started (with David) the <a href="https://github.com/idris-hackers/idris-mode">idris-mode for
emacs</a>. Idris is a dependently
typed programming language (you can express richer types), actively being
researched (I would not consider it production ready yet, needs more work on a
faster runtime, and libraries).</p>
<p>After I finished my PhD, I decided to slack off for some time to make decent
espresso. I ended up spending the winter (beginning of 2014) in Mirleft,
Morocco. A good friend of mine pointed me to <a href="https://mirage.io">MirageOS</a>, a
clean-slate operating system written in the high-level language <a href="https://ocaml.org">OCaml</a>. I got
hooked pretty fast, after some experience with LISP machines I imagined a modern
OS written in a single functional programming language.</p>
<p>From summer 2014 until end of 2017 I worked as a postdoctoral researcher at University of Cambridge (in the <a href="https://www.cl.cam.ac.uk/~pes20/rems">rigorous engineering of mainstream systems</a> project) with <a href="https://www.cl.cam.ac.uk/~pes20/">Peter Sewell</a>. I primarily worked on TLS, MirageOS, opam signing, and network semantics. In 2018 I relocated back to Berlin and am working on <a href="http://robur.io">robur</a>.</p>
<p>MirageOS had various bits and pieces into place, including infrastructure for
building and testing (and a neat self-hosted website). A big gap was security.
No access control, no secure sockets layer, nothing. This will be the topic of
another post.</p>
<p>OCaml is <a href="http://compcert.inria.fr/">academically</a> and <a href="https://blogs.janestreet.com/">commercially</a> used, compiles to native code (arm/amd64/likely more), is
fast enough (&quot;Reassuring, because our blanket performance statement 'OCaml
delivers at least 50% of the performance of a decent C compiler' is
not invalidated :-)&quot; <a href="https://lwn.net/Articles/19378/">Xavier Leroy</a>), and the <a href="https://opam.ocaml.org/packages/">community</a> is sufficiently large.</p>
<h3>Me on the intertubes</h3>
<p>You can find me on <a href="https://twitter.com/h4nnes">twitter</a> and on
<a href="https://github.com/hannesm">GitHub</a>.</p>
<p>The data of this blog is <a href="https://git.robur.io/hannes/hannes.robur.coop">stored in a git repository</a>.</p>
</article></div></div></main></body></html>

54
Posts/ARP Normal file
View file

@ -0,0 +1,54 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Re-engineering ARP</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="Re-engineering ARP" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="post"><h2>Re-engineering ARP</h2><span class="author">Written by hannes</span><br/><div class="tags">Classified under: <a href="/tags/mirageos" class="tag">mirageos</a><a href="/tags/protocol" class="tag">protocol</a></div><span class="date">Published: 2016-07-12 (last updated: 2021-11-19)</span><article><h2>What is ARP?</h2>
<p>ARP is the <em>A</em>ddress <em>R</em>esolution <em>P</em>rotocol, widely used in legacy IP networks (which support only IPv4). It is responsible to translate an IPv4 address to an Ethernet address. It is strictly more general, abstracting over protocol and hardware addresses. It is basically DNS (the domain name system) on a different layer.</p>
<p>ARP is link-local: ARP frames are not routed into other networks, all stay in the same broadcast domain. Thus there is no need for a hop limit (time-to-live). A reverse lookup mechanism (hardware address to protocol) is also available, named reverse ARP ;).</p>
<p>I will focus on ARP in this article, as used widely to translate IPv4 addresses into Ethernet addresses. There are two operations in ARP: request and response. A request is usually broadcasted to all hosts (by setting the destination to the broadcast Ethernet address, <code>ff:ff:ff:ff:ff:ff</code>), while a reply is send via unicast (to the host which requested that information).</p>
<p>The frame format is pretty straightforward: 2 bytes hardware address type, 2 bytes protocol type, 1 byte length for both types, 2 bytes operation, followed by source addresses (hardware and protocol), and target addresses. In total 28 bytes, considering 48 bit Ethernet addresses and 32 bit IPv4 addresses.</p>
<p>It was initially specified in <a href="https://tools.ietf.org/html/rfc826">RFC 826</a>, but reading through <a href="https://tools.ietf.org/html/rfc1122">RFC 1122</a> (requirements for Internet Hosts - Communication layer), and maybe the newer <a href="https://tools.ietf.org/html/rfc5227">RFC 5227</a> (IPv4 address conflict detection) does not hurt.</p>
<p>On UNIX systems, you can investigate your arp table, also called arp cache, using the <code>arp</code> command line utility.</p>
<h3>Protocol logic</h3>
<p>Let us look what our ARP handler actually needs to do? Translating IPv4 addresses to Ethernet addresses, but where does it learn new information?</p>
<p>First of all, our ARP handler needs to know its own IPv4 address and its Ethernet address. It will even broadcast them on startup, so-called gratuitous ARP. The purpose of this is to inform all other hosts on the same network that we are here now. And if another host, let's name it barf, has the same IPv4 address, some sort of conflict resolution needs to happen (otherwise all hosts on the network are confused to whether to send us or barf packets).</p>
<p>Once initialisation is over, our ARP handler needs to wait for ARP requests from other hosts on the network, and if addresses to our IPv4 address, issue a reply. The other event which might happen is that a user wants to send an IPv4 packet to another host on the network. In this case, we either already have the Ethernet address in our cache, or we need to send an ARP request to the network and wait for a reply. Since packets might get lost, we actually need to retry sending ARP requests until a limit is reached. To keep the cache in a reasonable size, old entries should be dropped if unused. Also, the Ethernet address of hosts may change, due to hardware replacement or failover.</p>
<p>That's it. Pretty straightforward.</p>
<h2>Design</h2>
<p>Back in 2008, together with Andreas Bogk, we just used a hash table and installed expiration and retransmission timers when needed. Certainly timers sometimes needed to be cancelled, and testing the code was cumbersome. It were only <a href="https://github.com/dylan-hackers/network-night-vision/blob/master/network/ip-stack/layers/network/arp/arp.dylan">250 lines of Dylan code</a> plus some <a href="https://github.com/dylan-hackers/network-night-vision/blob/master/protocols/ipv4.dylan">wire format definition</a>.</p>
<p>Nowadays, after some years of doing formal verification and typed functional programming, I try to have effects, including mutable state, isolated and explicitly annotated. The code should not contain surprises, but straightforward to understand. The core protocol logic should not be convoluted with side effects, rather a small wrapper around it should. Once this is achieved, testing is straightforward. If the fashion of the asynchronous task library changes (likely with OCaml multicore), the core logic can be reused. It can also be repurposed to run as a test oracle. You can read more marketing of this style in our <a href="https://usenix15.nqsb.io">Usenix security paper</a>.</p>
<p>My proposed style and hash tables are not good friends, since hash tables in OCaml are imperative structures. Instead, a <em>Map</em> (<a href="http://caml.inria.fr/pub/docs/manual-ocaml/libref/Map.html">documentation</a>) is a functional data structure for associating keys with values. Its underlying data structure is a balanced binary tree.</p>
<p>Our ARP handler certainly has some <em>state</em>, at least its IPv4 address, its Ethernet address, and the map containing entries.</p>
<p>We have to deal with the various effects mentioned earlier:</p>
<ul>
<li><em>Network</em> we provide a function taking a state and a packet, transforming to successor state, potentially output on the network, and potentially waking up tasks which are awaiting the mac address.
</li>
<li><em>Timer</em> we need to rely on an external periodic event calling our function <code>tick</code>, which transforms a state to a successor state, a list of ARP requests to be send out (retransmission), and a list of tasks to be informed that a timeout occurred.
</li>
<li><em>Query</em> a query for an IPv4 address using some state leads to a successor state, and either an immediate answer with the Ethernet address, or an ARP request to be sent and waiting for an answer, or just waiting for an answer in the case another task has already requested that IPv4 address. Since we don't want to convolute the protocol core with tasks, we'll let the effectful layer decide how to achieve that by abstracting over some alpha to store, and requiring a <code>merge : alpha option -&gt; alpha</code> function.
</li>
</ul>
<h3>Excursion: security</h3>
<p>ARP is a link-local protocol, thus attackers have to have access to the same link-layer: either a cable in the same switch or hub, or in the same wireless network (if you're into modern technology).</p>
<p>A very common attack vector for protocols is the so called person in the middle attack, where the attacker sits between you and the remote host. An attacker can achieve this using ARP spoofing: if they can convince your computer that the attacker is the gateway, your computer will send all packets to the attacker, who either forwards them to the remote host, or modifies them, or drops them.</p>
<p>ARP does not employ any security mechanism, it is more a question of receiving the first answer (depending on the implementation). A common countermeasure is to manually fill the cache with the gateway statically. This only needs updates if the gateway is replaced, or gets a new network card.</p>
<p>Denial of service attacks are also possible using ARP: if the implementation preserves all replies, the cache might expand immensely. This happens sometimes in switch hardware, which have a limited cache, and once it is full, they go into hub mode. This means all frames are broadcasted on all ports. This enables an attacker to passively sniff all traffic in the local network.</p>
<p>One denial of service attack vector is due to choosing a hash table as underlying store. Its hash function should be collision-resistant, one way, and its output should be fixed length. A good choice would be a cryptographic hash function (like SHA-256), but these are too expensive and thus rarely used for hash tables. <a href="https://www.usenix.org/conference/12th-usenix-security-symposium/denial-service-algorithmic-complexity-attacks">Denial of Service via Algorithmic Complexity Attacks</a> and <a href="https://events.ccc.de/congress/2011/Fahrplan/attachments/2007_28C3_Effective_DoS_on_web_application_platforms.pdf">Efficient Denial of Service Attacks on Web Application Platforms</a> are worth studying. If you expose your hash function to user input (and don't use a private seed), you might accidentally open your attack surface.</p>
<h3>Back to our design</h3>
<p>To mitigate person in the middle attacks, we provide an API to add static entries, which are never overwritten by network input. While our own IPv4 addresses are advertised if a matching ARP request was received, other static entries are not advertised (neither are dynamic entries). We do only insert entries to our cache if we have an outstanding request or already an entry. To provide low latency, just before a dynamic entry would timeout, we send another request for this IPv4 address to the network.</p>
<h3>Implementation</h3>
<p>I have the <a href="https://github.com/hannesm/arp">source</a>, its <a href="https://hannesm.github.io/arp">documentation</a>, a test suite and a <a href="https://hannesm.github.io/arp/coverage">coverage report</a> online.</p>
<p>The implementation of the core logic still fits in less than 250 lines of code. Below 100 more lines are needed for decoding and encoding byte buffers. And another 140 lines to implement the Mirage ARP interface. Tests are available which cover the protocol logic and decoding/encoding to 100%.</p>
<p>The effectful layer is underspecified (especially regarding conflicts: what happens if there is an outstanding request for an IPv4 address and I add a static entry for this?). There is an implementation based on hash tables, which I used to benchmark a bit.</p>
<p>Correctness aside, the performance should be in the same ballpark. I am mainly interested in how much input can be processed, being it invalid input, random valid input, random requests, random replies, and a mix of all that above plus some valid requests which should be answered. I ran the tests in two modes, one with accelerated time (where a minute passed in a second) to increase the pressure on the cache (named fast), one in real time. The results are in the table below (bigger numbers are better). It shows that neither approach is slower by design (of course there is still room for improvement).</p>
<pre><code>| Test | Hashtable | fast | Map | fast |
| ------------- | --------- | ------- | ------- | ------- |
| invalid | 2813076 | 2810684 | 2806899 | 2835905 |
| valid | 1126805 | 1320737 | 1770123 | 1785630 |
| request | 2059550 | 2044507 | 2109540 | 2119289 |
| replies | 1293293 | 1313405 | 1432225 | 1449860 |
| mixed | 2158481 | 2191617 | 2196092 | 2213530 |
| queries | 42058 | 45258 | 44803 | 44379 |
</code></pre>
<p>I ran each benchmark 3 times on a single core (used <code>cpuset -l 3</code> to pin it to one specific core) and picked the best set of results. The measure is number of packets processed over 5 seconds, using the Mirage ARP API. The full source code is in the <code>bench</code> subdirectory. As always, take benchmarks with a grain of salt: everybody will always find the right parameters for their microbenchmarks.</p>
<p>There was even a bug in the MirageOS ARP code: <a href="https://github.com/mirage/mirage-tcpip/issues/225">its definition of gratuitous ARP is wrong</a>.</p>
<p>I'm interested in feedback, either via
<a href="https://twitter.com/h4nnes">twitter</a> or via eMail.</p>
</article></div></div></main></body></html>

59
Posts/BadRecordMac Normal file
View file

@ -0,0 +1,59 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Catch the bug, walking through the stack</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="Catch the bug, walking through the stack" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="post"><h2>Catch the bug, walking through the stack</h2><span class="author">Written by hannes</span><br/><div class="tags">Classified under: <a href="/tags/mirageos" class="tag">mirageos</a><a href="/tags/security" class="tag">security</a></div><span class="date">Published: 2016-05-03 (last updated: 2021-11-19)</span><article><h2>BAD RECORD MAC</h2>
<p>Roughly 2 weeks ago, <a href="https://github.com/Engil">Engil</a> informed me that a TLS alert pops up in his browser sometimes when he reads this website. His browser reported that the <a href="https://en.wikipedia.org/wiki/Message_authentication_code">message authentication code</a> was wrong. From <a href="https://tools.ietf.org/html/rfc5246">RFC 5246</a>: This message is always fatal and should never be observed in communication between proper implementations (except when messages were corrupted in the network).</p>
<p>I tried hard, but could not reproduce, but was very worried and was eager to find the root cause (some little fear remained that it was in our TLS stack). I setup this website with some TLS-level tracing (extending the code from our <a href="https://tls.openmirage.org">TLS handshake server</a>). We tried to reproduce the issue with traces and packet captures (both on client and server side) in place from our computer labs office with no success. Later, Engil tried from his home and after 45MB of wire data, ran into this issue. Finally, evidence! Isolating the TCP flow with the alert resulted in just about 200KB of packet capture data (TLS ASCII trace around 650KB).</p>
<p><img src="/static/img/encrypted-alert.png" alt="encrypted alert" /></p>
<p>What is happening on the wire? After some data is successfully transferred, at some point the client sends an encrypted alert (see above). The TLS session used a RSA key exchange and I could decrypt the TLS stream with Wireshark, which revealed that the alert was indeed a bad record MAC. Wireshark's &quot;follow SSL stream&quot; showed all client requests, but not all server responses. The TLS level trace from the server showed properly encrypted data. I tried to spot the TCP payload which caused the bad record MAC, starting from the alert in the client capture (the offending TCP frame should be closely before the alert).</p>
<p><img src="/static/img/tcp-frame-client.png" alt="client TCP frame" /></p>
<p>There is plaintext data which looks like a HTTP request in the TCP frame sent by the server to the client? WTF? This should never happen! The same TCP frame on the server side looked even more strange: it had an invalid checksum.</p>
<p><img src="/static/img/tcp-frame-server.png" alt="server TCP frame" /></p>
<p>What do we have so far? We spotted some plaintext data in a TCP frame which is part of a TLS session. The TCP checksum is invalid.</p>
<p>This at least explains why we were not able to reproduce from our office: usually, TCP frames with invalid checksums are dropped by the receiving TCP stack, and the sender will retransmit TCP frames which have not been acknowledged by the recipient. However, this mechanism only works if the checksums haven't been changed by a well-meaning middleman to be correct! Our traces are from a client behind a router doing <a href="https://en.wikipedia.org/wiki/Network_address_translation">network address translation</a>, which has to recompute the <a href="https://en.wikipedia.org/wiki/Transmission_Control_Protocol#Checksum_computation">TCP checksum</a> because it modifies destination IP address and port. It seems like this specific router does not validate the TCP checksum before recomputing it, so it replaced the invalid TCP checksum with a valid one.</p>
<p>Next steps are: what did the TLS layer intended to send? Why is there a TCP frame with an invalid checksum emitted?</p>
<p>Looking into the TLS trace, the TCP payload in question should have started with the following data:</p>
<pre><code>0000 0B C9 E5 F3 C5 32 43 6F 53 68 ED 42 F8 67 DA 8B .....2Co Sh.B.g..
0010 17 87 AB EA 3F EC 99 D4 F3 38 88 E6 E3 07 D5 6E ....?... .8.....n
0020 94 9A 81 AF DD 76 E2 7C 6F 2A C6 98 BA 70 1A AD .....v.| o*...p..
0030 95 5E 13 B0 F7 A3 8C 25 6B 3D 59 CE 30 EC 56 B8 .^.....% k=Y.0.V.
0040 0E B9 E7 20 80 FA F1 AC 78 52 66 1E F1 F8 CC 0D ........ xRf.....
0050 6C CD F0 0B E4 AD DA BA 40 55 D7 40 7C 56 32 EE l....... @U.@|V2.
0060 9D 0B A8 DE 0D 1B 0A 1F 45 F1 A8 69 3A C3 4B 47 ........ E..i:.KG
0070 45 6D 7F A6 1D B7 0F 43 C4 D0 8C CF 52 77 9F 06 Em.....C ....Rw..
0080 59 31 E0 9D B2 B5 34 BD A4 4B 3F 02 2E 56 B9 A9 Y1....4. .K?..V..
0090 95 38 FD AD 4A D6 35 E4 66 86 6E 03 AF 2C C9 00 .8..J.5. f.n..,..
</code></pre>
<p>The ethernet, IP, and TCP headers are in total 54 bytes, thus we have to compare starting at 0x0036 in the screenshot above. The first 74 bytes (till 0x007F in the screenshot, 0x0049 in the text dump) are very much the same, but then they diverge (for another 700 bytes).</p>
<p>I manually computed the TCP checksum using the TCP/IP payload from the TLS trace, and it matches the one reported as invalid. Thus, a big relief: both the TLS and the TCP/IP stack have used the correct data. Our memory disclosure issue must be after the <a href="https://github.com/mirage/mirage-tcpip/blob/1617953b4674c9c832786c1ab3236b91d00f5c25/tcp/wire.ml#L78">TCP checksum is computed</a>. After this:</p>
<ul>
<li>the <a href="https://github.com/mirage/mirage-tcpip/blob/1617953b4674c9c832786c1ab3236b91d00f5c25/lib/ipv4.ml#L98">IP frame header is filled</a>
</li>
<li>the <a href="https://github.com/mirage/mirage-tcpip/blob/1617953b4674c9c832786c1ab3236b91d00f5c25/lib/ipv4.ml#L126">mac addresses are put</a> into the ethernet frame
</li>
<li>the frame is then passed to <a href="https://github.com/mirage/mirage-net-xen/blob/541e86f53cb8cf426aabdd7f090779fc5ea9fe93/lib/netif.ml#L538">mirage-net-xen for sending</a> via the Xen hypervisor.
</li>
</ul>
<p>As mentioned <a href="/Posts/OCaml">earlier</a> I'm still using mirage-net-xen release 1.4.1.</p>
<p>Communication with the Xen hypervisor is done via shared memory. The memory is allocated by mirage-net-xen, which then grants access to the hypervisor using <a href="http://wiki.xen.org/wiki/Grant_Table">Xen grant tables</a>. The TX protocol is implemented <a href="https://github.com/mirage/mirage-net-xen/blob/541e86f53cb8cf426aabdd7f090779fc5ea9fe93/lib/netif.ml#L84-L132">here in mirage-net-xen</a>, which includes allocation of a <a href="https://github.com/mirage/shared-memory-ring/blob/2955bf502c79bc963a02d090481b0e8958cc0c49/lwt/lwt_ring.mli">ring buffer</a>. The TX protocol also has implementations for writing requests and waiting for responses, both of which are identified using a 16bit integer. When a response has arrived from the hypervisor, the respective page is returned into the pool of <a href="https://github.com/mirage/mirage-net-xen/blob/541e86f53cb8cf426aabdd7f090779fc5ea9fe93/lib/netif.ml#L134-L213">shared pages</a>, to be reused by the next packet to be transmitted.</p>
<p>Instead of a whole page (4096 byte) per request/response, each page is <a href="https://github.com/mirage/mirage-net-xen/blob/541e86f53cb8cf426aabdd7f090779fc5ea9fe93/lib/netif.ml#L194-L198">split into two blocks</a> (since the most common <a href="https://en.wikipedia.org/wiki/Maximum_transmission_unit">MTU</a> for ethernet is 1500 bytes). The <a href="https://github.com/mirage/mirage-net-xen/blob/541e86f53cb8cf426aabdd7f090779fc5ea9fe93/lib/netif.ml#L489-L490">identifier in use</a> is the grant reference, which might be unique per page, but not per block.</p>
<p>Thus, when two blocks are requested to be sent, the first <a href="https://github.com/mirage/mirage-net-xen/blob/541e86f53cb8cf426aabdd7f090779fc5ea9fe93/lib/netif.ml#L398">polled response</a> will immediately <a href="https://github.com/mirage/mirage-net-xen/blob/541e86f53cb8cf426aabdd7f090779fc5ea9fe93/lib/netif.ml#L182-L185">release</a> both into the list of free blocks. When another packet is sent, the block still waiting to be sent in the ringbuffer can be reused. This leads to corrupt data being sent.</p>
<p>The fix was already done <a href="https://github.com/mirage/mirage-net-xen/commit/47de2edfad9c56110d98d0312c1a7e0b9dcc8fbf">back in December</a> to the master branch of mirage-net-xen, and has now been <a href="https://github.com/mirage/mirage-net-xen/pull/40/commits/ec9b1046b75cba5ae3473b2d3b223c3d1284489d">backported to the 1.4 branch</a>. In addition, a patch to <a href="https://github.com/mirage/mirage-net-xen/commit/0b1e53c0875062a50e2d5823b7da0d8e0a64dc37">avoid collisions on the receiving side</a> has been applied to both branches (and released in versions 1.4.2 resp. 1.6.1).</p>
<p>What can we learn from this? Read the interface documentation (if there is any), and make sure unique identifiers are really unique. Think about the lifecycle of pieces of memory. Investigation of high level bugs pays off, you might find some subtle error on a different layer. There is no perfect security, and code only gets better if more people read and understand it.</p>
<p>The issue was in mirage-net-xen since its initial release, but only occured under load, and thanks to reliable protocols, was silently discarded (an invalid TCP checksum leads to a dropped frame and retransmission of its payload).</p>
<p>We have seen plain data in a TLS encrypted stream. The plain data was intended to be sent to the dom0 for logging access to the webserver. The <a href="https://github.com/mirleft/btc-pinata/blob/master/logger.ml">same code</a> is used in our <a href="http://ownme.ipredator.se">Piñata</a>, thus it could have been yours (although I tried hard and couldn't get the Piñata to leak data).</p>
<p>Certainly, interfacing the outside world is complex. The <a href="https://github.com/mirage/mirage-block-xen">mirage-block-xen</a> library uses a similar protocol to access block devices. From a brief look, that library seems to be safe (using 64bit identifiers).</p>
<p>I'm interested in feedback, either via
<a href="https://twitter.com/h4nnes">twitter</a> or via eMail.</p>
<h2>Other updates in the MirageOS ecosystem</h2>
<ul>
<li>Canopy uses a <a href="https://github.com/Engil/Canopy/issues/30#issuecomment-215010365">map instead of a hashtable</a>, <a href="https://hannes.nqsb.io/tags">tags</a> now contains a list of tags (<a href="https://github.com/Engil/Canopy/pull/39">PR here</a>), both thanks to voila! I also use the <a href="https://github.com/Engil/Canopy/pull/38">new CSS</a> from Engil
</li>
<li>There is a <a href="http://www.openwall.com/lists/oss-security/2016/04/29/1">CVE for OCaml &lt;=4.03</a>
</li>
<li><a href="https://github.com/mirage/mirage/pull/534">Mirage 2.9.0</a> was released, which integrates support of the logs library (now already used in <a href="https://github.com/mirage/mirage-net-xen/pull/43">mirage-net-xen</a> and <a href="https://github.com/mirage/mirage-tcpip/pull/199">mirage-tcpip</a>)
</li>
<li>This blog post has an accompanied <a href="https://mirage.io/blog/MSA00">MirageOS security advisory</a>
</li>
<li>cfcs documented some <a href="https://github.com/cfcs/mirage-examples">basic unikernels</a>
</li>
</ul>
</article></div></div></main></body></html>

61
Posts/BottomUp Normal file
View file

@ -0,0 +1,61 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Counting Bytes</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="Counting Bytes" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="post"><h2>Counting Bytes</h2><span class="author">Written by hannes</span><br/><div class="tags">Classified under: <a href="/tags/mirageos" class="tag">mirageos</a><a href="/tags/background" class="tag">background</a></div><span class="date">Published: 2016-06-11 (last updated: 2021-11-19)</span><article><p>I was busy writing code, text, talks, and also spend a week without Internet, where I ground and brewed 15kg espresso.</p>
<h2>Size of a MirageOS unikernel</h2>
<p>There have been lots of claims and myths around the concrete size of MirageOS unikernels. In this article I'll apply some measurements which overapproximate the binary sizes. The tools used for the visualisations are available online, and soon hopefully upstreamed into the mirage tool. This article uses mirage-2.9.0 (which might be outdated at the time of reading).</p>
<p>Let us start with a very minimal unikernel, consisting of a <code>unikernel.ml</code>:</p>
<pre><code class="language-OCaml">module Main (C: V1_LWT.CONSOLE) = struct
let start c = C.log_s c &quot;hello world&quot;
end
</code></pre>
<p>and the following <code>config.ml</code>:</p>
<pre><code class="language-OCaml">open Mirage
let () =
register &quot;console&quot; [
foreign &quot;Unikernel.Main&quot; (console @-&gt; job) $ default_console
]
</code></pre>
<p>If we <code>mirage configure --unix</code> and <code>mirage build</code>, we end up (at least on a 64bit FreeBSD-11 system with OCaml 4.02.3) with a 2.8MB <code>main.native</code>, dynamically linked against <code>libthr</code>, <code>libm</code> and <code>libc</code> (<code>ldd</code> ftw), or a 4.5MB Xen virtual image (built on a 64bit Linux computer).</p>
<p>In the <code>_build</code> directory, we can find some object files and their byte sizes:</p>
<pre><code class="language-bash"> 7144 key_gen.o
14568 main.o
3552 unikernel.o
</code></pre>
<p>These do not sum up to 2.8MB ;)</p>
<p>We did not specify any dependencies ourselves, thus all bits have been injected automatically by the <code>mirage</code> tool. Let us dig a bit deeper what we actually used. <code>mirage configure</code> generates a <code>Makefile</code> which includes the dependent OCaml libraries, and the packages which are used:</p>
<pre><code class="language-Makefile">LIBS = -pkgs functoria.runtime, mirage-clock-unix, mirage-console.unix, mirage-logs, mirage-types.lwt, mirage-unix, mirage.runtime
PKGS = functoria lwt mirage-clock-unix mirage-console mirage-logs mirage-types mirage-types-lwt mirage-unix
</code></pre>
<p>I explained bits of our configuration DSL <a href="/Posts/Functoria">Functoria</a> earlier. The <a href="https://github.com/mirage/mirage-clock">mirage-clock</a> device is automatically injected by mirage, providing an implementation of the <code>CLOCK</code> device. We use a <a href="https://github.com/mirage/mirage-console">mirage-console</a> device, where we print the <code>hello world</code>. Since <code>mirage-2.9.0</code> the logging library (and its reporter, <a href="https://github.com/mirage/mirage-logs">mirage-logs</a>) is automatically injected as well, which actually uses the clock. Also, the <a href="https://github.com/mirage/mirage/tree/master/types">mirage type signatures</a> are required. The <a href="https://github.com/mirage/mirage-platform/tree/master/unix">mirage-unix</a> contains a <code>sleep</code>, a <code>main</code>, and provides the argument vector <code>argv</code> (all symbols in the <code>OS</code> module).</p>
<p>Looking into the archive files of those libraries, we end up with ~92KB (NB <code>mirage-types</code> only contains types, and thus no runtime data):</p>
<pre><code class="language-bash">15268 functoria/functoria-runtime.a
3194 mirage-clock-unix/mirage-clock.a
12514 mirage-console/mirage_console_unix.a
24532 mirage-logs/mirage_logs.a
14244 mirage-unix/OS.a
21964 mirage/mirage-runtime.a
</code></pre>
<p>This still does not sum up to 2.8MB since we're missing the transitive dependencies.</p>
<h3>Visualising recursive dependencies</h3>
<p>Let's use a different approach: first recursively find all dependencies. We do this by using <code>ocamlfind</code> to read <code>META</code> files which contain a list of dependent libraries in their <code>requires</code> line. As input we use <code>LIBS</code> from the Makefile snippet above. The code (OCaml script) is <a href="https://gist.github.com/hannesm/bcbe54c5759ed5854f05c8f8eaee4c79">available here</a>. The colour scheme is red for pieces of the OCaml distribution, yellow for input packages, and orange for the dependencies.</p>
<p><a href="/static/img/mirage-console.svg"><img src="/static/img/mirage-console.svg" title="UNIX dependencies of hello world" width="700" /></a></p>
<p>This is the UNIX version only, the Xen version looks similar (but worth mentioning).</p>
<p><a href="/static/img/mirage-console-xen.svg"><img src="/static/img/mirage-console-xen.svg" title="Xen dependencies of hello world" width="700" /></a></p>
<p>You can spot at the right that <code>mirage-bootvar</code> uses <code>re</code>, which provoked me to <a href="https://github.com/mirage/mirage-bootvar-xen/pull/19">open a PR</a>, but Jon Ludlam <a href="https://github.com/mirage/mirage-bootvar-xen/pull/18">already had a nicer PR</a> which is now merged (and a <a href="https://github.com/mirage/mirage-bootvar-xen/pull/20">new release is in preparation</a>).</p>
<h3>Counting bytes</h3>
<p>While a dependency graphs gives a big picture of what the composed libraries of a MirageOS unikernel, we also want to know how many bytes they contribute to the unikernel. The dependency graph only contains the OCaml-level dependencies, but MirageOS has in addition to that a <code>pkg-config</code> universe of the libraries written in C (such as mini-os, openlibm, ...).</p>
<p>We overapproximate the sizes here by assuming that a linker simply concatenates all required object files. This is not true, since the sum of all objects is empirically factor two of the actual size of the unikernel.</p>
<p>I developed a pie chart visualisation, but a friend of mine reminded me that such a chart is pretty useless for comparing slices for the human brain. I spent some more time to develop a treemap visualisation to satisfy the brain. The implemented algorithm is based on <a href="http://www.win.tue.nl/~vanwijk/stm.pdf">squarified treemaps</a>, but does not use implicit mutable state. In addition, the <a href="https://gist.github.com/hannesm/c8a9b2e75bb4f98b5100a838ea125f3b">provided script</a> parses common linker flags (<code>-o -L -l</code>) and collects arguments to be linked in. It can be passed to <code>ocamlopt</code> as the C linker, more instructions at the end of <code>treemap.ml</code> (which should be cleaned up and integrated into the mirage tool, as mentioned earlier).</p>
<p><a href="/static/img/mirage-console-bytes.svg"><img src="/static/img/mirage-console-bytes.svg" title="byte sizes of hello-world (UNIX)" width="700" /></a></p>
<p><a href="/static/img/mirage-console-xen-bytes-full.svg"><img src="/static/img/mirage-console-xen-bytes-full.svg" title="byte sizes of hello-world (Xen)" width="700" /></a></p>
<p>As mentioned above, this is an overapproximation. The <code>libgcc.a</code> is only needed on Xen (see <a href="https://github.com/mirage/mirage/commit/c17f2f60a6309322ba45cecb00a808f62f05cf82#commitcomment-17573123">this comment</a>), I have not yet tracked down why there is a <code>libasmrun.a</code> and a <code>libxenasmrun.a</code>.</p>
<h3>More complex examples</h3>
<p>Besides the hello world, I used the same tools on our <a href="http://ownme.ipredator.se">BTC Piñata</a>.</p>
<p><a href="/static/img/pinata-deps.svg"><img src="/static/img/pinata-deps.svg" title="Piñata dependencies" width="700" /></a></p>
<p><a href="/static/img/pinata-bytes.svg"><img src="/static/img/pinata-bytes.svg" title="Piñata byte sizes" width="700" /></a></p>
<h3>Conclusion</h3>
<p>OCaml does not yet do dead code elimination, but there <a href="https://github.com/ocaml/ocaml/pull/608">is a PR</a> based on the flambda middle-end which does so. I haven't yet investigated numbers using that branch.</p>
<p>Those counting statistics could go into more detail (e.g. using <code>nm</code> to count the sizes of concrete symbols - which opens the possibility to see which symbols are present in the objects, but not in the final binary). Also, collecting the numbers for each module in a library would be great to have. In the end, it would be great to easily spot the source fragments which are responsible for a huge binary size (and getting rid of them).</p>
<p>I'm interested in feedback, either via
<a href="https://twitter.com/h4nnes">twitter</a> or via eMail.</p>
</article></div></div></main></body></html>

317
Posts/Conex Normal file
View file

@ -0,0 +1,317 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Conex, establish trust in community repositories</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="Conex, establish trust in community repositories" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="post"><h2>Conex, establish trust in community repositories</h2><span class="author">Written by hannes</span><br/><div class="tags">Classified under: <a href="/tags/package signing" class="tag">package signing</a><a href="/tags/security" class="tag">security</a><a href="/tags/overview" class="tag">overview</a></div><span class="date">Published: 2017-02-16 (last updated: 2021-11-19)</span><article><p>Less than two years after the initial proposal, we're happy to present conex
0.9.2. Pleas note that this is still work in progress, to be deployed with opam
2.0 and the <a href="https://github.com/ocaml/opam-repository">opam repository</a>.</p>
<p><img src="/static/img/conex.png" alt="screenshot" /></p>
<p><a href="https://github.com/hannesm/conex">Conex</a> is a library to verify and attest release integrity and
authenticity of a community repository through the use of cryptographic signatures.</p>
<p>Packages are collected in a community repository to provide an index and
allowing cross-references. Authors submit their packages to the repository. which
is curated by a team of janitors. Information
about a package stored in a repository includes: license, author, releases,
their dependencies, build instructions, url, tarball checksum. When someone
publishes a new package, the janitors integrate it into the repository, if it
compiles and passes some validity checks. For example, its name must not be misleading,
nor may it be too general.</p>
<p>Janitors keep an eye on the repository and fix emergent failures. A new
compiler release, or a release of a package on which other packages depend, might break the compilation of
a package. Janitors usually fix these problems by adding a patch to the build script, or introducing
a version constraint in the repository.</p>
<p><em>Conex</em> ensures that every release of each package has been approved by its author or a quorum of janitors.
A conex-aware client initially verifies the repository using janitor key fingerprints as anchor.
Afterwards, the on-disk repository is trusted, and every update is verified (as a patch) individually.
This incremental verification is accomplished by ensuring all resources
that the patch modifies result in a valid repository with
sufficient approvals. Additionally, monotonicity is preserved by
embedding counters in each resource, and enforcing a counter
increment after modification.
This mechanism avoids rollback attacks, when an
attacker presents you an old version of the repository.</p>
<p>A timestamping service (NYI) will periodically approve a global view of the
verified repository, together with a timestamp. This is then used by the client
to prevent mix-and-match attacks, where an attacker mixes some old packages and
some new ones. Also, the client is able to detect freeze attacks, since at
least every day there should be a new signature done by the timestamping service.</p>
<p>The trust is rooted in digital signatures by package authors. The server which
hosts the repository does not need to be trusted. Neither does the host serving
release tarballs.</p>
<p>If a single janitor would be powerful enough to approve a key for any author,
compromising one janitor would be sufficient to enroll any new identities,
modify dependencies, build scripts, etc. In conex, a quorum of janitors (let's
say 3) have to approve such changes. This is different from current workflows,
where a single janitor with access to the repository can merge fixes.</p>
<p>Conex adds metadata, in form of resources, to the repository to ensure integrity and
authenticity. There are different kinds of resources:</p>
<ul>
<li><em>Authors</em>, consisting of a unique identifier, public key(s), accounts.
</li>
<li><em>Teams</em>, sharing the same namespace as authors, containing a set of members.
</li>
<li><em>Authorisation</em>, one for each package, describing which identities are authorised for the package.
</li>
<li><em>Package index</em>, for each package, listing all releases.
</li>
<li><em>Release</em>, for each release, listing checksums of all data files.
</li>
</ul>
<p>Modifications to identities and authorisations need to be approved by a quorum
of janitors, package index and release files can be modified either by an authorised
id or by a quorum of janitors.</p>
<h2>Documentation</h2>
<p><a href="https://hannesm.github.io/conex/doc/">API documentation</a> is
available online, also a <a href="https://hannesm.github.io/conex/coverage/">coverage
report</a>.</p>
<p>We presented an <a href="https://github.com/hannesm/conex-paper/raw/master/paper.pdf">abstract at OCaml
2016</a> about an
earlier design.</p>
<p>Another article on an <a href="http://opam.ocaml.org/blog/Signing-the-opam-repository/">earlier design (from
2015)</a> is also
available.</p>
<p>Conex is inspired by <a href="https://theupdateframework.github.io/">the update
framework</a>, especially on their <a href="https://isis.poly.edu/~jcappos/papers/samuel_tuf_ccs_2010.pdf">CCS 2010
paper</a>, and
adapted to the opam repository.</p>
<p>The <a href="https://github.com/theupdateframework/tuf/blob/develop/docs/tuf-spec.txt">TUF
spec</a>
has a good overview of attacks and threat model, both of which are shared by conex.</p>
<h2>What's missing</h2>
<ul>
<li>See <a href="https://github.com/hannesm/conex/issues/7">issue 7</a> for a laundry list
</li>
<li>Timestamping service
</li>
<li>Key revocation and rollover
</li>
<li>Tool to approve a PR (for janitors)
</li>
<li>Camelus like opam-repository check bot
</li>
<li>Integration into release management systems
</li>
</ul>
<h2>Getting started</h2>
<p>At the moment, our <a href="https://github.com/ocaml/opam-repository">opam repository</a>
does not include any metadata needed for signing. We're in a bootstrap phase:
we need you to generate a keypair, claim your packages, and approve your releases.</p>
<p>We cannot verify the main opam repository yet, but opam2 has support for a
<a href="http://opam.ocaml.org/doc/2.0/Manual.html#configfield-repository-validation-command"><code>repository validation command</code></a>,
builtin, which should then call out to <code>conex_verify</code> (there is a <code>--nostrict</code>
flag for the impatient). There is also an <a href="https://github.com/hannesm/testrepo">example repository</a> which uses the opam validation command.</p>
<p>To reduce the manual work, we analysed 7000 PRs of the opam repository within
the last 4.5 years (more details <a href="/Posts/Maintainers">here</a>.
This resulted in an educated guess who are the people
modifying each package, which we use as a basis whom to authorise for
which packages. Please check with <code>conex_author status</code> below whether your team
membership and authorised packages were inferred correctly.</p>
<p>Each individual author - you - need to generate their private key, submit
their public key and starts approving releases (and old ones after careful
checking that the build script, patches, and tarball checksum are valid).
Each resource can be approved in multiple versions at the same time.</p>
<h3>Installation</h3>
<p>TODO: remove clone once <a href="https://github.com/ocaml/opam-repository/pull/8494">PR 8494</a> is merged.</p>
<pre><code class="language-bash">$ git clone -b auth https://github.com/hannesm/opam-repository.git repo
$ opam install conex
$ cd repo
</code></pre>
<p>This will install conex, namely command line utilities, <code>conex_author</code> and
<code>conex_verify_nocrypto</code>/<code>conex_verify_openssl</code>. All files read and written by conex are in the usual
opam file format. This means can always manually modify them (but be careful,
modifications need to increment counters, add checksums, and be signed). Conex
does not deal with git, you have to manually <code>git add</code> files and open pull
requests.</p>
<h3>Author enrollment</h3>
<p>For the opam repository, we will use GitHub ids as conex ids. Thus, your conex
id and your GitHub id should match up.</p>
<pre><code class="language-bash">repo$ conex_author init --repo ~/repo --id hannesm
Created keypair hannesm. Join teams, claim your packages, sign your approved resources and open a PR :)
</code></pre>
<p>This attempts to parse <code>~/repo/id/hannesm</code>, errors if it is a team or an author
with a publickey. Otherwise it generates a keypair, writes the private part as
<code>home.hannes.repo.hannesm.private</code> (the absolute path separated by dots,
followed by your id, and <code>private</code> - if you move your repository, rename your
private key) into <code>~/.conex/</code>, the checksums of the public part and your
accounts into <code>~/repo/id/hannesm</code>. See <code>conex_author help init</code> for more
options (esp. additional verbosity <code>-v</code> can be helpful).</p>
<pre><code class="language-bash">repo$ git status -s
M id/hannesm
repo$ git diff //abbreviated output
- [&quot;counter&quot; 0x0]
+ [&quot;counter&quot; 0x1]
- [&quot;resources&quot; []]
+ [
+ &quot;resources&quot;
+ [
+ [
+ [&quot;typ&quot; &quot;key&quot;]
+ [&quot;name&quot; &quot;hannesm&quot;]
+ [&quot;index&quot; 0x1]
+ [&quot;digest&quot; [&quot;SHA256&quot; &quot;ht9ztjjDwWwD/id6LSVi7nKqVyCHQuQu9ORpr8Zo2aY=&quot;]]
+ ]
+ [
+ [&quot;typ&quot; &quot;account&quot;]
+ [&quot;name&quot; &quot;hannesm&quot;]
+ [&quot;index&quot; 0x2]
+ [&quot;digest&quot; [&quot;SHA256&quot; &quot;aCsktJ5M9PI6T+m1NIQtuIFYILFkqoHKwBxwvuzpuzg=&quot;]]
+ ]
+
+keys: [
+ [
+ [
+ &quot;RSA&quot;
+ &quot;&quot;&quot;
+-----BEGIN PUBLIC KEY-----
+MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAyUhArwt4XcxLanARyH9S
...
+9KQdg6QnLsQh/j74QKLOZacCAwEAAQ==
+-----END PUBLIC KEY-----&quot;&quot;&quot;
+ 0x58A3419F
+ ]
+ [
+ 0x58A79A1D
+ &quot;RSA-PSS-SHA256&quot;
+ &quot;HqqicsDx4hG9pFM5E7&quot;
+ ]
+ ]
+]
</code></pre>
<h3>Status</h3>
<p>If you have a single identity and contribute to a single signed opam repository,
you don't need to specify <code>--id</code> or <code>--repo</code> from now on.</p>
<p>The <code>status</code> subcommand presents an author-specific view on the repository. It
lists the own public keys, team membership, queued resources, and authorised
packages.</p>
<p>The opam repository is in a transitionary state, we explicitly pass <code>--quorum 0</code>, which means that every checksum is valid (approved by a quorum of 0
janitors).</p>
<pre><code class="language-bash">repo$ conex_author status --quorum 0 arp
author hannesm #1 (created 0) verified 3 resources, 0 queued
4096 bit RSA key created 1487094175 approved, SHA256: ht9ztjjDwWwD/id6LSVi7nKqVyCHQuQu9ORpr8Zo2aY=
account GitHub hannesm approved
account email hannes@mehnert.org approved
package arp authorisation approved
conex_author: [ERROR] package index arp was not found in repository
</code></pre>
<p>This shows your key material and accounts, team membership and packages you are
authorised to modify (inferred as described
<a href="/Posts/Maintainers">here</a>.</p>
<p>The <code>--noteam</code> argument limits the package list to only these you are personally
authorised for. The <code>--id</code> argument presents you with a view of another author,
or from a team perspective. The positional argument is a prefix matching on
package names (leave empty for all).</p>
<h3>Resource approval</h3>
<p>Each resource needs to be approved individually. Each author has a local queue
for to-be-signed resources, which is extended with <code>authorisation</code>, <code>init</code>,
<code>key</code>, <code>release</code>, and <code>team</code> (all have a <code>--dry-run</code> flag). The queue can be
dropped using <code>conex_author reset</code>. Below shown is <code>conex_author sign</code>, which
let's you interactively approve queued resources and cryptopgraphically signs
your approved resources afterwards.</p>
<p>The output of <code>conex_author status</code> listed an authorisation for <code>conf-gsl</code>,
which I don't feel responsible for. Let's drop my privileges:</p>
<pre><code class="language-bash">repo$ conex_author authorisation conf-gsl --remove -m hannesm
modified authorisation and added resource to your queue.
</code></pre>
<p>I checked my arp release careful (checksums of tarballs are correct, opam files
do not execute arbitrary shell code, etc.), and approve this package and its
single release:</p>
<pre><code class="language-bash">repo$ conex_author release arp
conex_author.native: [WARNING] package index arp was not found in repository
conex_author.native: [WARNING] release arp.0.1.1 was not found in repository
wrote release and added resources to your queue.
</code></pre>
<p>Once finished with joining and leaving teams (using the <code>team</code> subcommand),
claiming packages (using the <code>authorisation</code> subcommand), and approve releases
(using the <code>release</code> subcommand), you have to cryprographically sign your queued
resource modifications:</p>
<pre><code class="language-bash">repo$ conex_author sign
release arp.0.1.1 #1 (created 1487269425)
[descr: SHA256: aCsNvcj3cBKO0GESWG4r3AzoUEnI0pHGSyEDYNPouoE=;
opam: SHA256: nqy6lD1UP+kXj3+oPXLt2VMUIENEuHMVlVaG2V4z3p0=;
url: SHA256: FaUPievda6cEMjNkWdi0kGVK7t6EpWGfQ4q2NTSTcy0=]
approved (yes/No)?
package arp #1 (created 1487269425) [arp.0.1.1]
approved (yes/No)?y
authorisation conf-gsl #1 (created 0) empty
approved (yes/No)?y
wrote hannesm to disk
repo$ conex_author status --quorum 0 arp
author hannesm #1 (created 0) verified 7 resources, 0 queued
4096 bit RSA key created 1487094175 approved, SHA256: ht9ztjjDwWwD/id6LSVi7nKqVyCHQuQu9ORpr8Zo2aY=
account GitHub hannesm approved
account email hannes@mehnert.org approved
package arp authorisation approved package index approved
release arp.0.1.1: approved
</code></pre>
<p>If you now modify anything in <code>packages/arp</code> (add subdirectories, modify opam,
etc.), this will not be automatically approved (see below for how to do this).</p>
<p>You manually need to <code>git add</code> some created files.</p>
<pre><code class="language-bash">repo$ git status -s
M id/hannesm
M packages/conf-gsl/authorisation
?? packages/arp/arp.0.1.1/release
?? packages/arp/package
repo$ git add packages/arp/arp.0.1.1/release packages/arp/package
repo$ git commit -m &quot;hannesm key enrollment and some fixes&quot; id packages
</code></pre>
<p>Now push this to your fork, and open a PR on opam-repository!</p>
<h3>Editing a package</h3>
<p>If you need to modify a released package, you modify the opam file (as before,
e.g. introducing a conflict with a dependency), and then approve the
modifications. After your local modifications, <code>conex_author status</code> will
complain:</p>
<pre><code class="language-bash">repo$ conex_author status arp --quorum 0
package arp authorisation approved package index approved
release arp.0.1.1: checksums for arp.0.1.1 differ, missing on disk: empty, missing in checksums file: empty, checksums differ: [have opam: SHA256: QSGUU9HdPOrwoRs6XJka4cZpd8h+8NN1Auu5IMN8ew4= want opam: SHA256: nqy6lD1UP+kXj3+oPXLt2VMUIENEuHMVlVaG2V4z3p0=]
repo$ conex_author release arp.0.1.1
released and added resources to your resource list.
repo$ conex_author sign
release arp.0.1.1 #1 (created 1487269943)
[descr: SHA256: aCsNvcj3cBKO0GESWG4r3AzoUEnI0pHGSyEDYNPouoE=;
opam: SHA256: QSGUU9HdPOrwoRs6XJka4cZpd8h+8NN1Auu5IMN8ew4=;
url: SHA256: FaUPievda6cEMjNkWdi0kGVK7t6EpWGfQ4q2NTSTcy0=]
approved (yes/No)? y
wrote hannesm to disk
</code></pre>
<p>The <code>release</code> subcommand recomputed the checksums, incremented the counter, and
added it to your queue. The <code>sign</code> command signed the approved resource.</p>
<pre><code class="language-bash">repo$ git status -s
M id/hannesm
M packages/arp/arp.0.1.1/opam
M packages/arp/arp.0.1.1/package
repo$ git commit -m &quot;fixed broken arp package&quot; id packages
</code></pre>
<h3>Janitor tools</h3>
<p>Janitors need to approve teams, keys, accounts, and authorisations.</p>
<p>To approve resources which are already in the repository on disk,
the <code>key</code> subcommand queues approval of keys and accounts of the provided author:</p>
<pre><code class="language-bash">repo$ conex_author key avsm
added keys and accounts to your resource list.
</code></pre>
<p>The <code>authorisation</code> subcommand, and <code>team</code> subcommand behave similarly for
authorisations and teams.</p>
<p>Bulk operations are supported as well:</p>
<pre><code class="language-bash">conex_author authorisation all
</code></pre>
<p>This will approve all authorisations of the repository which are not yet
approved by you. Similar for the <code>key</code> and <code>team</code> subcommands, which also
accept <code>all</code>.</p>
<p>Don't forget to <code>conex_author sign</code> afterwards (or <code>yes | conex_author sign</code>).</p>
<h3>Verification</h3>
<p>The two command line utlities, <code>conex_verify_openssl</code> and
<code>conex_verify_nocrypto</code> contain the same logic and same command line arguments.</p>
<p>For bootstrapping purposes (<code>nocrypto</code> is an opam package with dependencies),
<code>conex_verify_openssl</code> relies on the openssl command line tool (version 1.0.0
and above) for digest computation and verification of the RSA-PSS signature.</p>
<p>The goal is to use the opam2 provided hooks, but before we have signatures we
cannot enable them.</p>
<p>See the <a href="https://github.com/hannesm/testrepo">example repository</a> for initial
verification experiments, and opam2 integration.</p>
<p>I'm interested in feedback, please open an issue on the <a href="https://github.com/hannesm/conex">conex
repository</a>. This article itself is stored as
Markdown <a href="https://git.robur.io/hannes/hannes.robur.coop">in a different repository</a>.</p>
</article></div></div></main></body></html>

266
Posts/DNS Normal file
View file

@ -0,0 +1,266 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>My 2018 contains robur and starts with re-engineering DNS</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="My 2018 contains robur and starts with re-engineering DNS" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="post"><h2>My 2018 contains robur and starts with re-engineering DNS</h2><span class="author">Written by hannes</span><br/><div class="tags">Classified under: <a href="/tags/mirageos" class="tag">mirageos</a><a href="/tags/protocol" class="tag">protocol</a></div><span class="date">Published: 2018-01-11 (last updated: 2021-11-19)</span><article><h2>2018</h2>
<p>At the end of 2017, I resigned from my PostDoc position at University of
Cambridge (in the <a href="https://www.cl.cam.ac.uk/~pes20/rems/">rems</a> project). Early
December 2017 I organised the <a href="https://mirage.io/blog/2017-winter-hackathon-roundup">4th MirageOS hack
retreat</a>, with which I'm
very satisfied. In March 2018 the <a href="http://retreat.mirage.io">5th retreat</a> will
happen (please sign up!).</p>
<p>In 2018 I moved to Berlin and started to work for the (non-profit) <a href="https://techcultivation.org">Center for
the cultivation of technology</a> with our
<a href="http://robur.io">robur.io</a> project &quot;At robur, we build performant bespoke
minimal operating systems for high-assurance services&quot;. robur is only possible
by generous donations in autumn 2017, enthusiastic collaborateurs, supportive
friends, and a motivated community, thanks to all. We will receive funding from
the <a href="https://prototypefund.de/project/robur-io/">prototypefund</a> to work on a
<a href="https://robur.io/Our%20Work/Projects#CalDAV-Server">CalDAV server</a> implementation in OCaml
targeting MirageOS. We're still looking for donations and further funding,
please get in touch. Apart from CalDAV, I want to start the year by finishing
several projects which I discovered on my hard drive. This includes DNS, <a href="/Posts/Conex">opam
signing</a>, TCP, ... . My personal goal for 2018 is to develop a
flexible <code>mirage deploy</code>, because after configuring and building a unikernel, I
want to get it smoothly up and running (spoiler: I already use
<a href="/Posts/VMM">albatross</a> in production).</p>
<p>To kick off (3% of 2018 is already used) this year, I'll talk in more detail
about <a href="https://github.com/roburio/udns">µDNS</a>, an opinionated from-scratch
re-engineered DNS library, which I've been using since Christmas 2017 in production for
<a href="https://github.com/hannesm/ns.nqsb.io">ns.nqsb.io</a> and
<a href="https://git.robur.io/?p=ns.robur.io.git;a=summary">ns.robur.io</a>. The
development started in March 2017, and continued over several evenings and long
weekends. My initial motivation was to implement a recursive resolver to run on
my laptop. I had a working prototype in use on my laptop over 4 months in the
summer 2017, but that code was not in a good shape, so I went down the rabbit
hole and (re)wrote a server (and learned more about GADT). A configurable
resolver needs a server, as local overlay, usually anyways. Furthermore,
dynamic updates are standardised and thus a configuration interface exists
inside the protocol, even with hmac-signatures for authentication!
Coincidentally, I started to solve another issue, namely automated management of let's
encrypt certificates (see <a href="https://github.com/hannesm/ocaml-letsencrypt/tree/nsupdate">this
branch</a> for an
initial hack). On my journey, I also reported a cache poisoning vulnerability,
which was fixed in <a href="https://docs.docker.com/docker-for-windows/release-notes/#docker-community-edition-17090-ce-win32-2017-10-02-stable">Docker for
Windows</a>.</p>
<p>But let's get started with some content. Please keep in mind that while the
code is publicly available, it is not yet released (mainly since the test
coverage is not high enough, and the lack of documentation). I appreciate early
adopters, please let me know if you find any issues or find a use case which is
not straightforward to solve. This won't be the last article about DNS this
year - persistent storage, resolver, let's encrypt support are still missing.</p>
<h2>What is DNS?</h2>
<p>The <a href="https://en.wikipedia.org/wiki/DNS">domain name system</a> is a core Internet
protocol, which translates domain names to IP addresses. A domain name is
easier to memorise for human beings than an IP address. DNS is hierarchical and
decentralised. It was initially &quot;specified&quot; in Nov 1987 in <a href="https://tools.ietf.org/html/rfc1034">RFC
1034</a> and <a href="https://tools.ietf.org/html/rfc1035">RFC
1035</a>. Nowadays it spans over more than 20
technical RFCs, 10 security related, 5 best current practises and another 10
informational. The basic encoding and mechanisms did not change.</p>
<p>On the Internet, there is a set of root servers (administrated by IANA) which
provide the information about which name servers are authoritative for which top level
domain (such as &quot;.com&quot;). They provide the information about which name servers are
responsible for which second level domain name (such as &quot;example.com&quot;), and so
on. There are at least two name servers for each domain name in separate
networks - in case one is unavailable the other can be reached.</p>
<p>The building blocks for DNS are: the resolver, a stub (<code>gethostbyname</code> provided
by your C library) or caching forwarding resolver (at your ISP), which send DNS
packets to another resolver, or a recursive resolver which, once seeded with the
root servers, finds out the IP address of a requested domain name. The other
part are authoritative servers, which reply to requests for their configured
domain.</p>
<p>To get some terminology, a DNS client sends a query, consisting of a domain
name and a query type, and expects a set of answers, which are called resource
records, and contain: name, time to live, type, and data. The resolver
iteratively requests resource records from authoritative servers, until the requested
domain name is resolved or fails (name does not exist, server
failure, server offline).</p>
<p>DNS usually uses UDP as transport which is not reliable and limited to 512 byte
payload on the Internet (due to various middleboxes). DNS can also be
transported via TCP, and even via TLS over UDP or TCP. If a DNS packet
transferred via UDP is larger than 512 bytes, it is cut at the 512 byte mark,
and a bit in its header is set. The receiver can decide whether to use the 512
bytes of information, or to throw it away and attempt a TCP connection.</p>
<h3>DNS packet</h3>
<p>The packet encoding starts with a 16bit identifier followed by a 16bit header
(containing operation, flags, status code), and four counters, each 16bit,
specifying the amount of resource records in the body: questions, answers,
authority records, and additional records. The header starts with one bit
operation (query or response), four bits opcode, various flags (recursion,
authoritative, truncation, ...), and the last four bit encode the response code.</p>
<p>A question consists of a domain name, a query type, and a query class. A
resource record additionally contains a 32bit time to live, a length, and the
data.</p>
<p>Each domain name is a case sensitive string of up to 255 bytes, separated by <code>.</code>
into labels of up to 63 bytes each. A label is either encoded by its length
followed by the content, or by an offset to the start of a label in the current
DNS frame (poor mans compression). Care must be taken during decoding to avoid
cycles in offsets. Common operations on domain names are comparison: equality,
ordering, and also whether some domain name is a subdomain of another domain
name, should be efficient. My initial representation naïvely was a list of
strings, now it is an array of strings in reverse order. This speeds up common
operations by a factor of 5 (see test/bench.ml).</p>
<p>The only really used class is <code>IN</code> (for Internet), as mentioned in <a href="https://tools.ietf.org/html/rfc6895">RFC
6895</a>. Various query types (<code>MD</code>, <code>MF</code>,
<code>MB</code>, <code>MG</code>, <code>MR</code>, <code>NULL</code>, <code>AFSDB</code>, ...) are barely or never used. There is no
need to convolute the implementation and its API with these legacy options (if
you have a use case and see those in the wild, please tell me).</p>
<p>My implemented packet decoding does decompression, only allows valid internet
domain names, and may return a partial parse - to use as many resource records
in truncated packets as possible. There are no exceptions raised, the parsing
uses a monadic style error handling. Since label decompression requires the
parser to know absolute offsets, the original buffer and the offset is manually
passed around at all times, instead of using smaller views on the buffer. The
decoder does not allow for gaps, when the outer resource data length specifies a
byte length which is not completely consumed by the specific resource data
subparser (an A record must always consume four bytes). Failing to check this can
lead to a way to exfiltrate data without getting noticed.</p>
<p>Each zone (a served domain name) contains a SOA &quot;start of authority&quot; entry,
which includes the primary nameserver name, the hostmaster's email address (both
encoded as domain name), a serial number of the zone, a refresh, retry, expiry,
and minimum interval (all encoded as 32bit unsigned number in seconds). Common
resource records include A, which payload is 32bit IPv4 address. A nameserver
(NS) record carries a domain name as payload. A mail exchange (MX) whose
payload is a 16bit priority and a domain name. A CNAME record is an alias to
another domain name. These days, there are even records to specify the
certificate authority authorisation (CAA) records containing a flag (critical),
a tag (&quot;issue&quot;) and a value (&quot;letsencrypt.org&quot;).</p>
<h2>Server</h2>
<p>The operation of a DNS server is to listen for a request and serve a reply.
Data to be served can be canonically encoded (the RFC describes the format) in a
zone file. Apart from insecurity in DNS server implementations, another attack
vector are amplification attacks where an attacker crafts a small UDP frame
with a fake source IP address, and the server answers with a large response to
that address which may lead to a DoS attack. Various mitigations exist
including rate limiting, serving large replies only via TCP, ...</p>
<p>Internally, the zone file data is stored in a tree (module
<a href="https://github.com/roburio/udns/blob/master/server/dns_trie.mli">Dns_trie</a>
<a href="https://github.com/roburio/udns/blob/master/server/dns_trie.ml">implementation</a>),
where each node contains two maps: <code>sub</code>, which key is a label and value is a
subtree and <code>dns_map</code> (module Dns_map), which key is a resource record type and
value is the resource record. Both use the OCaml
<a href="http://caml.inria.fr/pub/docs/manual-ocaml/libref/Map.html">Map</a> (&quot;also known
as finite maps or dictionaries, given a total ordering function over the
keys. All operations over maps are purely applicative (no side-effects). The
implementation uses balanced binary trees, and therefore searching and insertion
take time logarithmic in the size of the map&quot;).</p>
<p>The server looks up the queried name, and in the returned Dns_map the queried
type. The found resource records are sent as answer, which also includes the
question and authority information (NS records of the zone) and additional glue
records (IP addresses of names mentioned earlier in the same zone).</p>
<h3>Dns_map</h3>
<p>The data structure which contains resource record types as key, and a collection
of matching resource records as values. In OCaml the value type must be
homogenous - using a normal sum type leads to an unneccessary unpacking step
(or lacking type information):</p>
<pre><code class="language-OCaml">let lookup_ns t =
match Map.find NS t with
| None -&gt; Error `NotFound
| Some (NS nameservers) -&gt; Ok nameservers
| Some _ -&gt; Error `NotFound
</code></pre>
<p>Instead, I use in my current rewrite <a href="https://en.wikipedia.org/wiki/Generalized_algebraic_data_type">generalized algebraic data
types</a> (read
<a href="http://caml.inria.fr/pub/docs/manual-ocaml/extn.html#sec251">OCaml manual</a> and
<a href="http://mads-hartmann.com/ocaml/2015/01/05/gadt-ocaml.html">Mads Hartmann blog post about use cases for
GADTs</a>, <a href="https://andreas.github.io/2018/01/05/modeling-graphql-type-modifiers-with-gadts/">Andreas
Garnæs about using GADTs for GraphQL type
modifiers</a>)
to preserve a relation between key and value (and A record has a list of IPv4
addresses and a ttl as value) - similar to
<a href="http://erratique.ch/software/hmap">hmap</a>, but different: a closed key-value
mapping (the GADT), no int for each key and mutable state. Thanks to Justus
Matthiesen for helping me with GADTs and this code. Look into the
<a href="https://github.com/roburio/udns/blob/master/src/dns_map.mli">interface</a> and
<a href="https://github.com/roburio/udns/blob/master/src/dns_map.ml">implementation</a>.</p>
<pre><code class="language-OCaml">(* an ordering relation, I dislike using int for that *)
module Order = struct
type (_,_) t =
| Lt : ('a, 'b) t
| Eq : ('a, 'a) t
| Gt : ('a, 'b) t
end
module Key = struct
(* The key and its value type *)
type _ t =
| Soa : (int32 * Dns_packet.soa) t
| A : (int32 * Ipaddr.V4.t list) t
| Ns : (int32 * Dns_name.DomSet.t) t
| Cname : (int32 * Dns_name.t) t
(* we need a total order on our keys *)
let compare : type a b. a t -&gt; b t -&gt; (a, b) Order.t = fun t t' -&gt;
let open Order in
match t, t' with
| Cname, Cname -&gt; Eq | Cname, _ -&gt; Lt | _, Cname -&gt; Gt
| Ns, Ns -&gt; Eq | Ns, _ -&gt; Lt | _, Ns -&gt; Gt
| Soa, Soa -&gt; Eq | Soa, _ -&gt; Lt | _, Soa -&gt; Gt
| A, A -&gt; Eq
end
type 'a key = 'a Key.t
(* our OCaml Map with an encapsulated constructor as key *)
type k = K : 'a key -&gt; k
module M = Map.Make(struct
type t = k
(* the price I pay for not using int as three-state value *)
let compare (K a) (K b) = match Key.compare a b with
| Order.Lt -&gt; -1
| Order.Eq -&gt; 0
| Order.Gt -&gt; 1
end)
(* v contains a key and value pair, wrapped by a single constructor *)
type v = V : 'a key * 'a -&gt; v
(* t is the main type of a Dns_map, used by clients *)
type t = v M.t
(* retrieve a typed value out of the store *)
let get : type a. a Key.t -&gt; t -&gt; a = fun k t -&gt;
match M.find (K k) t with
| V (k', v) -&gt;
(* this comparison is superfluous, just for the types *)
match Key.compare k k' with
| Order.Eq -&gt; v
| _ -&gt; assert false
</code></pre>
<p>This helps me to programmaticaly retrieve tightly typed values from the cache,
important when code depends on concrete values (i.e. when there are domain
names, look these up as well and add as additional records). Look into <a href="https://github.com/roburio/udns/blob/master/server/dns_server.ml">server/dns_server.ml</a></p>
<h3>Dynamic updates, notifications, and authentication</h3>
<p><a href="https://tools.ietf.org/html/rfc2136">Dynamic updates</a> specify in-protocol
record updates (supported for example by <code>nsupdate</code> from ISC bind-tools),
<a href="https://tools.ietf.org/html/rfc1996">notifications</a> are used by primary servers
to notify secondary servers about updates, which then initiate a <a href="https://tools.ietf.org/html/rfc5936">zone
transfer</a> to retrieve up to date
data. <a href="https://tools.ietf.org/html/rfc2845">Shared hmac secrets</a> are used to
ensure that the transaction (update, zone transfer) was authorised. These are
all protocol extensions, there is no need to use out-of-protocol solutions.</p>
<p>The server logic for update and zone transfer frames is slightly more complex,
and includes a dependency upon an authenticator (implemented using the
<a href="https://github.com/mirleft/ocaml-nocrypto">nocrypto</a> library, and
<a href="http://erratique.ch/software/ptime">ptime</a>).</p>
<h3>Deployment and Let's Encrypt</h3>
<p>To deploy servers without much persistent data, an authentication schema is
hardcoded in the dns-server: shared secrets are also stored as DNS entries
(DNSKEY), and <code>_transfer.zone</code>, <code>_update.zone</code>, and <code>_key-management.zone</code> names
are introduced to encode the permissions. A <code>_transfer</code> key also needs to
encode the IP address of the primary (to know where to request zone transfers)
and secondary IP (to know where to send notifications).</p>
<p>Please have a look at
<a href="https://git.robur.io/?p=ns.robur.io.git;a=summary">ns.robur.io</a> and the <a href="https://github.com/roburio/udns/blob/master/mirage/examples">examples</a> for more details. The shared secrets are provided as boot parameter of the unikernel.</p>
<p>I hacked maker's
<a href="https://github.com/hannesm/ocaml-letsencrypt/tree/nsupdate">ocaml-letsencrypt</a>
library to use µDNS and sending update frames to the given IP address. I
already used this to have letsencrypt issue various certificates for my domains.</p>
<p>There is no persistent storage of updates yet, but this can be realised by
implementing a secondary (which is notified on update) that writes every new
zone to persistent storage (e.g. <a href="https://github.com/mirage/mirage-block">disk</a>
or <a href="https://github.com/mirage/ocaml-git">git</a>). I also plan to have an
automated Let's Encrypt certificate unikernel which listens for certificate
signing requests and stores signed certificates in DNS. Luckily the year only
started and there's plenty of time left.</p>
<p>I'm interested in feedback, either via <strike><a href="https://twitter.com/h4nnes">twitter</a></strike>
hannesm@mastodon.social or via eMail.</p>
</article></div></div></main></body></html>

59
Posts/Deploy Normal file
View file

@ -0,0 +1,59 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Deploying binary MirageOS unikernels</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="Deploying binary MirageOS unikernels" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="post"><h2>Deploying binary MirageOS unikernels</h2><span class="author">Written by hannes</span><br/><div class="tags">Classified under: <a href="/tags/mirageos" class="tag">mirageos</a><a href="/tags/deployment" class="tag">deployment</a></div><span class="date">Published: 2021-06-30 (last updated: 2021-11-15)</span><article><h2>Introduction</h2>
<p>MirageOS development focus has been a lot on tooling and the developer experience, but to accomplish <a href="https://robur.coop">our</a> goal to &quot;get MirageOS into production&quot;, we need to lower the barrier. This means for us to release binary unikernels. As described <a href="/Posts/NGI">earlier</a>, we received a grant for &quot;Deploying MirageOS&quot; from <a href="https://pointer.ngi.eu">NGI Pointer</a> to work on the required infrastructure. This is joint work with <a href="https://reynir.dk/">Reynir</a>.</p>
<p>We provide at <a href="https://builds.robur.coop">builds.robur.coop</a> binary unikernel images (and supplementary software). Doing binary releases of MirageOS unikernels is challenging in two aspects: firstly to be useful for everyone, a binary unikernel should not contain any configuration (such as private keys, certificates, etc.). Secondly, the binaries should be <a href="https://reproducible-builds.org">reproducible</a>. This is crucial for security; everyone can reproduce the exact same binary and verify that our build service did only use the sources. No malware or backdoors included.</p>
<p>This post describes how you can deploy MirageOS unikernels without compiling it from source, then dives into the two issues outlined above - configuration and reproducibility - and finally describes how to setup your own reproducible build infrastructure for MirageOS, and how to bootstrap it.</p>
<h2>Deploying MirageOS unikernels from binary</h2>
<p>To execute a MirageOS unikernel, apart from a hypervisor (Xen/KVM/Muen), a tender (responsible for allocating host system resources and passing these to the unikernel) is needed. Using virtio, this is conventionally done with qemu on Linux, but its code size (and attack surface) is huge. For MirageOS, we develop <a href="https://github.com/solo5/solo5">Solo5</a>, a minimal tender. It supports <em>hvt</em> - hardware virtualization (Linux KVM, FreeBSD BHyve, OpenBSD VMM), <em>spt</em> - sandboxed process (a tight seccomp ruleset (only a handful of system calls allowed, no hardware virtualization needed), Linux only). Apart from that, <a href="https://muen.sk"><em>muen</em></a> (a hypervisor developed in Ada), <em>virtio</em> (for some cloud deployments), and <em>xen</em> (PVHv2 or Qubes 4.0) - <a href="https://github.com/Solo5/solo5/blob/master/docs/building.md">read more</a>. We deploy our unikernels as hvt with FreeBSD BHyve as hypervisor.</p>
<p>On <a href="https://builds.robur.coop">builds.robur.coop</a>, next to the unikernel images, <a href="https://builds.robur.coop/job/solo5-hvt/"><em>solo5-hvt</em> packages</a> are provided - download the binary and install it. A <a href="https://github.com/NixOS/nixpkgs/tree/master/pkgs/os-specific/solo5">NixOS package</a> is already available - please note that <a href="https://github.com/Solo5/solo5/pull/494">soon</a> packaging will be much easier (and we will work on packages merged into distributions).</p>
<p>When the tender is installed, download a unikernel image (e.g. the <a href="https://builds.robur.coop/job/traceroute/build/latest/">traceroute</a> described in <a href="/Posts/Traceroute">an earlier post</a>), and execute it:</p>
<pre><code>$ solo5-hvt --net:service=tap0 -- traceroute.hvt --ipv4=10.0.42.2/24 --ipv4-gateway=10.0.42.1
</code></pre>
<p>If you plan to orchestrate MirageOS unikernels, you may be interested in <a href="https://github.com/roburio/albatross">albatross</a> - we provide <a href="https://builds.robur.coop/job/albatross/">binary packages as well for albatross</a>. An upcoming post will go into further details of how to setup albatross.</p>
<h2>MirageOS configuration</h2>
<p>A MirageOS unikernel has a specific purpose - composed of OCaml libraries - selected at compile time, which allows to only embed the required pieces. This reduces the attack surface drastically. At the same time, to be widely useful to multiple organisations, no configuration data must be embedded into the unikernel.</p>
<p>Early MirageOS unikernels such as <a href="https://github.com/mirage/mirage-www">mirage-www</a> embed content (blog posts, ..) and TLS certificates and private keys in the binary (using <a href="https://github.com/mirage/ocaml-crunch">crunch</a>). The <a href="https://github.com/mirage/qubes-mirage-firewall">Qubes firewall</a> (read the <a href="http://roscidus.com/blog/blog/2016/01/01/a-unikernel-firewall-for-qubesos/">blog post by Thomas</a> for more information) used to include the firewall rules until <a href="https://github.com/mirage/qubes-mirage-firewall/releases/tag/v0.6">v0.6</a> in the binary, since <a href="https://github.com/mirage/qubes-mirage-firewall/tree/v0.7">v0.7</a> the rules are read dynamically from QubesDB. This is big usability improvement.</p>
<p>We have several possibilities to provide configuration information in MirageOS, on the one hand via boot parameters (can be pre-filled at development time, and further refined at configuration time, but those passed at boot time take precedence). Boot parameters have a length limitation.</p>
<p>Another option is to <a href="https://github.com/roburio/tlstunnel/">use a block device</a> - where the TLS reverse proxy stores the configuration, modifiable via a TCP control socket (authentication using a shared hmac secret).</p>
<p>Several other unikernels, such as <a href="https://github.com/Engil/Canopy">this website</a> and <a href="https://github.com/roburio/caldav">our CalDAV server</a>, store the content in a remote git repository. The git URI and credentials (private key seed, host key fingerprint) are passed via boot parameter.</p>
<p>Finally, another option that we take advantage of is to introduce a post-link step that rewrites the binary to embed configuration. The tool <a href="https://github.com/dinosaure/caravan">caravan</a> developed by Romain that does this rewrite is used by our <a href="https://github.com/roburio/openvpn/tree/robur/mirage-router">openvpn router</a> (<a href="https://builds.robur.coop/job/openvpn-router/build/latest/">binary</a>).</p>
<p>In the future, some configuration information - such as monitoring system, syslog sink, IP addresses - may be done via DHCP on one of the private network interfaces - this would mean that the DHCP server has some global configuration option, and the unikernels no longer require that many boot parameters. Another option we want to investigate is where the tender shares a file as read-only memory-mapped region from the host system to the guest system - but this is tricky considering all targets above (especially virtio and muen).</p>
<h2>Behind the scenes: reproducible builds</h2>
<p>To provide a high level of assurance and trust, if you distribute binaries in 2021, you should have a recipe how they can be reproduced in a bit-by-bit identical way. This way, different organisations can run builders and rebuilders, and a user can decide to only use a binary if it has been reproduced by multiple organisations in different jurisdictions using different physical machines - to avoid malware being embedded in the binary.</p>
<p>For a reproduction to be successful, you need to collect the checksums of all sources that contributed to the built, together with other things (host system packages, environment variables, etc.). Of course, you can record the entire OS and sources as a tarball (or file system snapshot) and distribute that - but this may be suboptimal in terms of bandwidth requirements.</p>
<p>With opam, we already have precise tracking which opam packages are used, and since opam 2.1 the <code>opam switch export</code> includes <a href="https://github.com/ocaml/opam/pull/4040">extra-files (patches)</a> and <a href="https://github.com/ocaml/opam/pull/4055">records the VCS version</a>. Based on this functionality, <a href="https://github.com/roburio/orb">orb</a>, an alternative command line application using the opam-client library, can be used to collect (a) the switch export, (b) host system packages, and (c) the environment variables. Only required environment variables are kept, all others are unset while conducting a build. The only required environment variables are <code>PATH</code> (sanitized with an allow list, <code>/bin</code>, <code>/sbin</code>, with <code>/usr</code>, <code>/usr/local</code>, and <code>/opt</code> prefixes), and <code>HOME</code>. To enable Debian's <code>apt</code> to install packages, <code>DEBIAN_FRONTEND</code> is set to <code>noninteractive</code>. The <code>SWITCH_PATH</code> is recorded to allow orb to use the same path during a rebuild. The <code>SOURCE_DATE_EPOCH</code> is set to enable tools that record a timestamp to use a static one. The <code>OS*</code> variables are only used for recording the host OS and version.</p>
<p>The goal of reproducible builds can certainly be achieved in several ways, including to store all sources and used executables in a huge tarball (or docker container), which is preserved for rebuilders. The question of minimal trusted computing base and how such a container could be rebuild from sources in reproducible way are open.</p>
<p>The opam-repository is a community repository, where packages are released to on a daily basis by a lot of OCaml developers. Package dependencies usually only use lower bounds of other packages, and the continuous integration system of the opam repository takes care that upon API changes all reverse dependencies include the right upper bounds. Using the head commit of opam-repository usually leads to a working package universe.</p>
<p>For our MirageOS unikernels, we don't want to stay behind with ancient versions of libraries. That's why our automated building is done on a daily basis with the head commit of opam-repository. Since our unikernels are not part of the main opam repository (they include the configuration information which target to use, e.g. <em>hvt</em>), and we occasionally development versions of opam packages, we use <a href="https://git.robur.io/robur/unikernel-repo">the unikernel-repo</a> as overlay.</p>
<p>If no dependent package got a new release, the resulting binary has the same checksum. If any dependency was released with a newer release, this is picked up, and eventually the checksum changes.</p>
<p>Each unikernel (and non-unikernel) job (e.g. <a href="https://builds.robur.coop/job/dns-primary-git/build/latest/">dns-primary</a> outputs some artifacts:</p>
<ul>
<li>the <a href="https://builds.robur.coop/job/dns-primary-git/build/latest/f/bin/primary_git.hvt">binary image</a> (in <code>bin/</code>, unikernel image, OS package)
</li>
<li>the <a href="https://builds.robur.coop/job/dns-primary-git/build/latest/f/build-environment"><code>build-environment</code></a> containing the environment variables used for this build
</li>
<li>the <a href="https://builds.robur.coop/job/dns-primary-git/build/latest/f/system-packages"><code>system-packages</code></a> containing all packages installed on the host system
</li>
<li>the <a href="https://builds.robur.coop/job/dns-primary-git/build/latest/f/opam-switch"><code>opam-switch</code></a> that contains all opam packages, including git commit or tarball with checksum, and potentially extra patches, used for this build
</li>
<li>a job script and console output
</li>
</ul>
<p>To reproduce such a built, you need to get the same operating system (OS, OS_FAMILY, OS_DISTRIBUTION, OS_VERSION in build-environment), the same set of system packages, and then you can <code>orb rebuild</code> which sets the environment variables and installs the opam packages from the opam-switch.</p>
<p>You can <a href="https://builds.robur.coop/job/dns-primary-git/">browse</a> the different builds, and if there are checksum changes, you can browse to a diff between the opam switches to reason whether the checksum change was intentional (e.g. <a href="https://builds.robur.coop/compare/ba9ab091-9400-4e8d-ad37-cf1339114df8/23341f6b-cd26-48ab-9383-e71342455e81/opam-switch">here</a> the checksum of the unikernel changed when the x509 library was updated).</p>
<p>The opam reproducible build infrastructure is driven by:</p>
<ul>
<li><a href="https://github.com/roburio/orb">orb</a> conducting reproducible builds (<a href="https://builds.robur.coop/job/orb/">packages</a>)
</li>
<li><a href="https://github.com/roburio/builder">builder</a> scheduling builds in contained environments (<a href="https://builds.robur.coop/job/builder/">packages</a>)
</li>
<li><a href="https://git.robur.io/robur/builder-web">builder-web</a> storing builds in a database and providing a HTTP interface (<a href="https://builds.robur.coop/job/builder-web/">packages</a>)
</li>
</ul>
<p>These tools are themselves reproducible, and built on a daily basis. The infrastructure executing the build jobs installs the most recent packages of orb and builder before conducting a build. This means that our build infrastructure is reproducible as well, and uses the latest code when it is released.</p>
<h2>Conclusion</h2>
<p>Thanks to NGI funding we now have reproducible MirageOS binary builds available at <a href="https://builds.robur.coop">builds.robur.coop</a>. The underlying infrastructure is reproducible, available for multiple platforms (Ubuntu using docker, FreeBSD using jails), and can be easily bootstrapped from source (once you have OCaml and opam working, getting builder and orb should be easy). All components are open source software, mostly with permissive licenses.</p>
<p>We also have an index over sha-256 checksum of binaries - in the case you find a running unikernel image where you forgot which exact packages were used, you can do a reverse lookup.</p>
<p>We are aware that the web interface can be improved (PRs welcome). We will also work on the rebuilder setup and run some rebuilds.</p>
<p>Please reach out to us (at team AT robur DOT coop) if you have feedback and suggestions.</p>
</article></div></div></main></body></html>

276
Posts/DnsServer Normal file
View file

@ -0,0 +1,276 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Deploying authoritative OCaml-DNS servers as MirageOS unikernels</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="Deploying authoritative OCaml-DNS servers as MirageOS unikernels" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="post"><h2>Deploying authoritative OCaml-DNS servers as MirageOS unikernels</h2><span class="author">Written by hannes</span><br/><div class="tags">Classified under: <a href="/tags/mirageos" class="tag">mirageos</a><a href="/tags/protocol" class="tag">protocol</a><a href="/tags/deployment" class="tag">deployment</a></div><span class="date">Published: 2019-12-23 (last updated: 2021-11-19)</span><article><h2>Goal</h2>
<p>Have your domain served by OCaml-DNS authoritative name servers. Data is stored in a git remote, and let's encrypt certificates can be requested to DNS. This software is deployed since more than two years for several domains such as <code>nqsb.io</code> and <code>robur.coop</code>. This present the authoritative server side, and certificate library of the OCaml-DNS implementation formerly known as <a href="/Posts/DNS">µDNS</a>.</p>
<h2>Prerequisites</h2>
<p>You need to own a domain, and be able to delegate the name service to your own servers.
You also need two spare public IPv4 addresses (in different /24 networks) for your name servers.
A git server or remote repository reachable via git over ssh.
Servers which support <a href="https://github.com/solo5/solo5">solo5</a> guests, and have the corresponding tender installed.
A computer with <a href="https://opam.ocaml.org">opam</a> (&gt;= 2.0.0) installed.</p>
<h2>Data preparation</h2>
<p>Figure out a way to get the DNS entries of your domain in a <a href="https://tools.ietf.org/html/rfc1034">&quot;master file format&quot;</a>, i.e. what bind uses.</p>
<p>This is a master file for the <code>mirage</code> domain, defining <code>$ORIGIN</code> to avoid typing the domain name after each hostname (use <code>@</code> if you need the domain name only; if you need to refer to a hostname in a different domain end it with a dot (<code>.</code>), i.e. <code>ns2.foo.com.</code>). The default time to live <code>$TTL</code> is an hour (3600 seconds).
The zone contains a <a href="https://tools.ietf.org/html/rfc1035#section-3.3.13">start of authority (<code>SOA</code>) record</a> containing the nameserver, hostmaster, serial, refresh, retry, expiry, and minimum.
Also, a single <a href="https://tools.ietf.org/html/rfc1035#section-3.3.11">name server (<code>NS</code>) record</a> <code>ns1</code> is specified with an accompanying <a href="https://tools.ietf.org/html/rfc1035#section-3.4.1">address (<code>A</code>) records</a> pointing to their IPv4 address.</p>
<pre><code class="language-shell">git-repo&gt; cat mirage
$ORIGIN mirage.
$TTL 3600
@ SOA ns1 hostmaster 1 86400 7200 1048576 3600
@ NS ns1
ns1 A 127.0.0.1
www A 1.1.1.1
git-repo&gt; git add mirage &amp;&amp; git commit -m initial &amp;&amp; git push
</code></pre>
<h2>Installation</h2>
<p>On your development machine, you need to install various OCaml packages. You don't need privileged access if common tools (C compiler, make, libgmp) are already installed. You have <code>opam</code> installed.</p>
<p>Let's create a fresh <code>switch</code> for the DNS journey:</p>
<pre><code class="language-shell">$ opam init
$ opam update
$ opam switch create udns 4.09.0
# waiting a bit, a fresh OCaml compiler is getting bootstrapped
$ eval `opam env` #sets some environment variables
</code></pre>
<p>The last command set environment variables in your current shell session, please use the same shell for the commands following (or run <code>eval $(opam env)</code> in another shell and proceed in there - the output of <code>opam switch</code> sohuld point to <code>udns</code>).</p>
<h3>Validation of our zonefile</h3>
<p>First let's check that OCaml-DNS can parse our zonefile:</p>
<pre><code class="language-shell">$ opam install dns-cli #installs ~/.opam/udns/bin/ozone and other binaries
$ ozone &lt;git-repo&gt;/mirage # see ozone --help
successfully checked zone
</code></pre>
<p>Great. Error reporting is not great, but line numbers are indicated (<code>ozone: zone parse problem at line 3: syntax error</code>), <a href="https://github.com/mirage/ocaml-dns/tree/v4.2.0/zone">lexer and parser are lex/yacc style</a> (PRs welcome).</p>
<p>FWIW, <code>ozone</code> accepts <code>--old &lt;filename&gt;</code> to check whether an update from the old zone to the new is fine. This can be used as <a href="https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks">pre-commit hook</a> in your git repository to avoid bad parse states in your name servers.</p>
<h3>Getting the primary up</h3>
<p>The next step is to compile the primary server and run it to serve the domain data. Since the git-via-ssh client is not yet released, we need to add a custom opam repository to this switch.</p>
<pre><code class="language-shell"># git via ssh is not yet released, but this opam repository contains the branch information
$ opam repo add git-ssh git+https://github.com/roburio/git-ssh-dns-mirage3-repo.git
# get the `mirage` application via opam
$ opam install lwt mirage
# get the source code of the unikernels
$ git clone -b future https://github.com/roburio/unikernels.git
$ cd unikernels/primary-git
# let's build the server first as unix application
$ mirage configure --prng fortuna #--no-depext if you have all system dependencies
$ make depend
$ make
# run it
$ ./primary_git
# starts a unix process which clones https://github.com/roburio/udns.git
# attempts to parse the data as zone files, and fails on parse error
$ ./primary-git --remote=https://my-public-git-repository
# this should fail with ENOACCESS since the DNS server tries to listen on port 53
# which requires a privileged user, i.e. su, sudo or doas
$ sudo ./primary-git --remote=https://my-public-git-repository
# leave it running, run the following programs in a different shell
# test it
$ host ns1.mirage 127.0.0.1
ns1.mirage has address 127.0.0.1
$ dig any mirage @127.0.0.1
# a DNS packet printout with all records available for mirage
</code></pre>
<p>That's exciting, the DNS server serving answers from a remote git repository.</p>
<h3>Securing the git access with ssh</h3>
<p>Let's authenticate the access by using ssh, so we feel ready to push data there as well. The primary-git unikernel already includes an experimental <a href="https://github.com/haesbaert/awa-ssh">ssh client</a>, all we need to do is setting up credentials - in the following a RSA keypair and the server fingerprint.</p>
<pre><code class="language-shell"># collect the RSA host key fingerprint
$ ssh-keyscan &lt;git-server&gt; &gt; /tmp/git-server-public-keys
$ ssh-keygen -l -E sha256 -f /tmp/git-server-public-keys | grep RSA
2048 SHA256:a5kkkuo7MwTBkW+HDt4km0gGPUAX0y1bFcPMXKxBaD0 &lt;git-server&gt; (RSA)
# we're interested in the SHA256:yyy only
# generate a ssh keypair
$ awa_gen_key # installed by the make depend step above in ~/.opam/udns/bin
seed is pIKflD07VT2W9XpDvqntcmEW3OKlwZL62ak1EZ0m
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC5b2cSSkZ5/MAu7pM6iJLOaX9tJsfA8DB1RI34Zygw6FA0y8iisbqGCv6Z94ZxreGATwSVvrpqGo5p0rsKs+6gQnMCU1+sOC4PRlxy6XKgj0YXvAZcQuxwmVQlBHshuq0CraMK9FASupGrSO8/dW30Kqy1wmd/IrqW9J1Cnw+qf0C/VEhIbo7btlpzlYpJLuZboTvEk1h67lx1ZRw9bSPuLjj665yO8d0caVIkPp6vDX20EsgITdg+cFjWzVtOciy4ETLFiKkDnuzHzoQ4EL8bUtjN02UpvX2qankONywXhzYYqu65+edSpogx2TuWFDJFPHgcyO/ZIMoluXGNgQlP awa@awa.local
# please run your own awa_gen_key, don't use the numbers above
</code></pre>
<p>The public key needs is in standard OpenSSH format and needs to be added to the list of accepted keys on your server - the exact steps depend on your git server, if you're running your own with <a href="https://github.com/tv42/gitosis">gitosis</a>, add it as new public key file and grant that key access to the data repository. If you use gitlab or github, you may want to create a new user account and with the generated key.</p>
<p>The private key is not displayed, but only the seed required to re-generate it, when using the same random number generator, in our case <a href="http://mirleft.github.io/ocaml-nocrypto/doc/Nocrypto.Rng.html">fortuna implemented by nocrypto</a> - used by both <code>awa_gen_key</code> and <code>primary_git</code>. The seed is provided as command-line argument while starting <code>primary_git</code>:</p>
<pre><code class="language-shell"># execute with git over ssh, authenticator from ssh-keyscan, seed from awa_gen_key
$ ./primary_git --authenticator=SHA256:a5kkkuo7MwTBkW+HDt4km0gGPUAX0y1bFcPMXKxBaD0 --seed=pIKflD07VT2W9XpDvqntcmEW3OKlwZL62ak1EZ0m --remote=ssh://git@&lt;git-server&gt;/repo-name.git
# started up, you can try the host and dig commands from above if you like
</code></pre>
<p>To wrap up, we now have a primary authoritative name server for our zone running as Unix process, which clones a remote git repository via ssh on startup and then serves it.</p>
<h3>Authenticated data updates</h3>
<p>Our remote git repository is the source of truth, if you need to add a DNS entry to the zone, you git pull, edit the zone file, remember to increase the serial in the SOA line, run <code>ozone</code>, git commit and push to the repository.</p>
<p>So, the <code>primary_git</code> needs to be informed of git pushes. This requires a communication channel from the git server (or somewhere else, e.g. your laptop) to the DNS server. I prefer in-protocol solutions over adding yet another protocol stack, no way my DNS server will talk HTTP REST.</p>
<p>The DNS protocol has an extension for <a href="https://tools.ietf.org/html/rfc1996">notifications of zone changes</a> (as a DNS packet), usually used between the primary and secondary servers. The <code>primary_git</code> accepts these notify requests (i.e. bends the standard slightly), and upon receival pulls the remote git repository, and serves the fresh zone files. Since a git pull may be rather excessive in terms of CPU cycles and network bandwidth, only authenticated notifications are accepted.</p>
<p>The DNS protocol specifies in another extension <a href="https://tools.ietf.org/html/rfc2845">authentication (DNS TSIG)</a> with transaction signatures on DNS packets including a timestamp and fudge to avoid replay attacks. As key material hmac secrets distribued to both the communication endpoints are used.</p>
<p>To recap, the primary server is configured with command line parameters (for remote repository url and ssh credentials), and serves data from a zonefile. If the secrets would be provided via command line, a restart would be necessary for adding and removing keys. If put into the zonefile, they would be publicly served on request. So instead, we'll use another file, still in zone file format, in the top-level domain <code>_keys</code>, i.e. the <code>mirage._keys</code> file contains keys for the <code>mirage</code> zone. All files ending in <code>._keys</code> are parsed with the normal parser, but put into an authentication store instead of the domain data store, which is served publically.</p>
<p>For encoding hmac secrets into DNS zone file format, the <a href="https://tools.ietf.org/html/rfc4034#section-2"><code>DNSKEY</code></a> format is used (designed for DNSsec). The <a href="https://www.isc.org/bind/">bind</a> software comes with <code>dnssec-keygen</code> and <code>tsig-keygen</code> to generate DNSKEY output: flags is 0, protocol is 3, and algorithm identifier for SHA256 is 163 (SHA384 164, SHA512 165). This is reused by the OCaml DNS library. The key material itself is base64 encoded.</p>
<p>Access control and naming of keys follows the DNS domain name hierarchy - a key has the form name._operation.domain, and has access granted to domain and all subdomains of it. Two operations are supported: update and transfer. In the future there may be a dedicated notify operation, for now we'll use update. The name part is ignored for the update operation.</p>
<p>Since we now embedd secret information in the git repository, it is a good idea to restrict access to it, i.e. make it private and not publicly cloneable or viewable. Let's generate a first hmac secret and send a notify:</p>
<pre><code class="language-shell">$ dd if=/dev/random bs=1 count=32 | b64encode -
begin-base64 644 -
kJJqipaQHQWqZL31Raar6uPnepGFIdtpjkXot9rv2xg=
====
[..]
git-repo&gt; echo &quot;personal._update.mirage. DNSKEY 0 3 163 kJJqipaQHQWqZL31Raar6uPnepGFIdtpjkXot9rv2xg=&quot; &gt; mirage._keys
git-repo&gt; git add mirage._keys &amp;&amp; git commit -m &quot;add hmac secret&quot; &amp;&amp; git push
# now we need to restart the primary git to get the git repository with the key
$ ./primary_git --seed=... # arguments from above, remote git, host key fingerprint, private key seed
# now test that a notify results in a git pull
$ onotify 127.0.0.1 mirage --key=personal._update.mirage:SHA256:kJJqipaQHQWqZL31Raar6uPnepGFIdtpjkXot9rv2xg=
# onotify was installed by dns-cli in ~/.opam/udns/bin/onotify, see --help for options
# further changes to the hmac secrets don't require a restart anymore, a notify packet is sufficient :D
</code></pre>
<p>Ok, this onotify command line could be setup as a git post-commit hook, or run manually after each manual git push.</p>
<h3>Secondary</h3>
<p>It's time to figure out how to integrate the secondary name server. An already existing bind or something else that accepts notifications and issues zone transfers with hmac-sha256 secrets should work out of the box. If you encounter interoperability issues, please get in touch with me.</p>
<p>The <code>secondary</code> subdirectory of the cloned <code>unikernels</code> repository is another unikernel that acts as secondary server. It's only command line argument is a list of hmac secrets used for authenticating that the received data originates from the primary server. Data is initially transferred by a <a href="https://tools.ietf.org/html/rfc5936">full zone transfer (AXFR)</a>, later updates (upon refresh timer or notify request sent by the primary) use <a href="https://tools.ietf.org/html/rfc1995">incremental (IXFR)</a>. Zone transfer requests and data are authenticated with transaction signatures again.</p>
<p>Convenience by OCaml DNS is that transfer key names matter, and are of the form <primary-ip>.<secondary-ip>._transfer.domain, i.e. <code>1.1.1.1.2.2.2.2._transfer.mirage</code> if the primary server is 1.1.1.1, and the secondary 2.2.2.2. Encoding the IP address in the name allows both parties to start the communication: the secondary starts by requesting a SOA for all domains for which keys are provided on command line, and if an authoritative SOA answer is received, the AXFR is triggered. The primary server emits notification requests on startup and then on every zone change (i.e. via git pull) to all secondary IP addresses of transfer keys present for the specific zone in addition to the notifications to the NS records in the zone.</p>
<pre><code class="language-shell">$ cd ../secondary
$ mirage configure --prng fortuna
# make depend should not be needed since all packages are already installed by the primary-git
$ make
$ ./secondary
</code></pre>
<h3>IP addresses and routing</h3>
<p>Both primary and secondary serve the data on the DNS port (53) on UDP and TCP. To run both on the same machine and bind them to different IP addresses, we'll use a layer 2 network (ethernet frames) with a host system software switch (bridge interface <code>service</code>), the unikernels as virtual machines (or seccomp-sandboxed) via the <a href="https://github.com/solo5/solo5">solo5</a> backend. Using xen is possible as well. As IP address range we'll use 10.0.42.0/24, and the host system uses the 10.0.42.1.</p>
<p>The primary git needs connectivity to the remote git repository, thus on a laptop in a private network we need network address translation (NAT) from the bridge where the unikernels speak to the Internet where the git repository resides.</p>
<pre><code class="language-shell"># on FreeBSD:
# configure NAT with pf, you need to have forwarding enabled
$ sysctl net.inet.ip.forwarding: 1
$ echo 'nat pass on wlan0 inet from 10.0.42.0/24 to any -&gt; (wlan0)' &gt;&gt; /etc/pf.conf
$ service pf restart
# make tap interfaces UP on open()
$ sysctl net.link.tap.up_on_open: 1
# bridge creation, naming, and IP setup
$ ifconfig bridge create
bridge0
$ ifconfig bridge0 name service
$ ifconfig bridge0 10.0.42.1/24
# two tap interfaces for our unikernels
$ ifconfig tap create
tap0
$ ifconfig tap create
tap1
# add them to the bridge
$ ifconfig service addm tap0 addm tap1
</code></pre>
<h3>Primary and secondary setup</h3>
<p>Let's update our zone slightly to reflect the IP changes.</p>
<pre><code class="language-shell">git-repo&gt; cat mirage
$ORIGIN mirage.
$TTL 3600
@ SOA ns1 hostmaster 2 86400 7200 1048576 3600
@ NS ns1
@ NS ns2
ns1 A 10.0.42.2
ns2 A 10.0.42.3
# we also need an additional transfer key
git-repo&gt; cat mirage._keys
personal._update.mirage. DNSKEY 0 3 163 kJJqipaQHQWqZL31Raar6uPnepGFIdtpjkXot9rv2xg=
10.0.42.2.10.0.42.3._transfer.mirage. DNSKEY 0 3 163 cDK6sKyvlt8UBerZlmxuD84ih2KookJGDagJlLVNo20=
git-repo&gt; git commit -m &quot;udpates&quot; . &amp;&amp; git push
</code></pre>
<p>Ok, the git repository is ready, now we need to compile the unikernels for the virtualisation target (see <a href="https://mirage.io/wiki/hello-world#Building-for-Another-Backend">other targets</a> for further information).</p>
<pre><code class="language-shell"># back to primary
$ cd ../primary-git
$ mirage configure -t hvt --prng fortuna # or e.g. -t spt (and solo5-spt below)
# installs backend-specific opam packages, recompiles some
$ make depend
$ make
[...]
$ solo5-hvt --net:service=tap0 -- primary_git.hvt --ipv4=10.0.42.2/24 --ipv4-gateway=10.0.42.1 --seed=.. --authenticator=.. --remote=ssh+git://...
# should now run as a virtual machine (kvm, bhyve), and clone the git repository
$ dig any mirage @10.0.42.2
# should reply with the SOA and NS records, and also the name server address records in the additional section
# secondary
$ cd ../secondary
$ mirage configure -t hvt --prng fortuna
$ make
$ solo5-hvt --net:service=tap1 -- secondary.hvt --ipv4=10.0.42.3/24 --keys=10.0.42.2.10.0.42.3._transfer.mirage:SHA256:cDK6sKyvlt8UBerZlmxuD84ih2KookJGDagJlLVNo20=
# an ipv4-gateway is not needed in this setup, but in real deployment later
# it should start up and transfer the mirage zone from the primary
$ dig any mirage @10.0.42.3
# should now output the same information as from 10.0.42.2
# testing an update and propagation
# edit mirage zone, add a new record and increment the serial number
git-repo&gt; echo &quot;foo A 127.0.0.1&quot; &gt;&gt; mirage
git-repo&gt; vi mirage &lt;- increment serial
git-repo&gt; git commit -m 'add foo' . &amp;&amp; git push
$ onotify 10.0.42.2 mirage --key=personal._update.mirage:SHA256:kJJqipaQHQWqZL31Raar6uPnepGFIdtpjkXot9rv2xg=
# now check that it worked
$ dig foo.mirage @10.0.42.2 # primary
$ dig foo.mirage @10.0.42.3 # secondary got notified and transferred the zone
</code></pre>
<p>You can also check the behaviour when restarting either of the VMs, whenever the primary is available the zone is synchronised. If the primary is down, the secondary still serves the zone. When the secondary is started while the primary is down, it won't serve any data until the primary is online (the secondary polls periodically, the primary sends notifies on startup).</p>
<h3>Dynamic data updates via DNS, pushed to git</h3>
<p>DNS is a rich protocol, and it also has builtin <a href="https://tools.ietf.org/html/rfc2136">updates</a> that are supported by OCaml DNS, again authenticated with hmac-sha256 and shared secrets. Bind provides the command-line utility <code>nsupdate</code> to send these update packets, a simple <code>oupdate</code> unix utility is available as well (i.e. for integration of dynamic DNS clients). You know the drill, add a shared secret to the primary, git push, notify the primary, and voila we can dynamically in-protocol update. An update received by the primary via this way will trigger a git push to the remote git repository, and notifications to the secondary servers as described above.</p>
<pre><code class="language-shell"># being lazy, I reuse the key above
$ oupdate 10.0.42.2 personal._update.mirage:SHA256:kJJqipaQHQWqZL31Raar6uPnepGFIdtpjkXot9rv2xg= my-other.mirage 1.2.3.4
# let's observe the remote git
git-repo&gt; git pull
# there should be a new commit generated by the primary
git-repo&gt; git log
# test it, should return 1.2.3.4
$ dig my-other.mirage @10.0.42.2
$ dig my-other.mirage @10.0.42.3
</code></pre>
<p>So we can deploy further <code>oupdate</code> (or <code>nsupdate</code>) clients, distribute hmac secrets, and have the DNS zone updated. The source of truth is still the git repository, where the primary-git pushes to. Merge conflicts and timing of pushes is not yet dealt with. They are unlikely to happen since the primary is notified on pushes and should have up-to-date data in storage. Sorry, I'm unsure about the error semantics, try it yourself.</p>
<h3>Let's encrypt!</h3>
<p><a href="https://letsencrypt.org/">Let's encrypt</a> is a certificate authority (CA), which certificate is shipped as trust anchor in web browsers. They specified a protocol for <a href="https://tools.ietf.org/html/draft-ietf-acme-acme-05">automated certificate management environment (ACME)</a>, used to get X509 certificates for your services. In the protocol, a certificate signing request (publickey and hostname) is sent to let's encrypt servers, which sends a challenge to proof the ownership of the hostnames. One widely-used way to solve this challenge is running a web server, another is to serve it as text record from the authoritative DNS server.</p>
<p>Since I avoid persistent storage when possible, and also don't want to integrate a HTTP client stack in the primary server, I developed a third unikernel that acts as (hidden) secondary server, performs the tedious HTTP communication with let's encrypt servers, and stores all data in the public DNS zone.</p>
<p>For encoding of certificates, the DANE working group specified <a href="https://tools.ietf.org/html/rfc6698.html#section-7.1">TLSA</a> records in DNS. They are quadruples of usage, selector, matching type, and ASN.1 DER-encoded material. We set usage to 3 (domain-issued certificate), matching type to 0 (no hash), and selector to 0 (full certificate) or 255 (private usage) for certificate signing requests. The interaction is as follows:</p>
<ol>
<li>Primary, secondary, and let's encrypt unikernels are running
</li>
<li>A service (<code>ocertify</code>, <code>unikernels/certificate</code>, or the <code>dns-certify.mirage</code> library) demands a TLS certificate, and has a hmac-secret for the primary DNS
</li>
<li>The service generates a certificate signing request with the desired hostname(s), and performs an nsupdate with TLSA 255 <DER encoded signing-request>
</li>
<li>The primary accepts the update, pushes the new zone to git, and sends notifies to secondary and let's encrypt unikernels which (incrementally) transfer the zone
</li>
<li>The let's encrypt unikernel notices while transferring the zone a signing request without a certificate, starts HTTP interaction with let's encrypt
</li>
<li>The let's encrypt unikernel solves the challenge, sends the response as update of a TXT record to the primary nameserver
</li>
<li>The primary pushes the TXT record to git, and notifies secondaries (which transfer the zone)
</li>
<li>The let's encrypt servers request the TXT record from either or both authoritative name servers
</li>
<li>The let's encrypt unikernel polls for the issued certificate and send an update to the primary TLSA 0 <DER encoded certificate>
</li>
<li>The primary pushes the certificate to git, notifies secondaries (which transfer the zone)
</li>
<li>The service polls TLSA records for the hostname, and use it upon retrieval
</li>
</ol>
<p>Note that neither the signing request nor the certificate contain private key material, thus it is fine to serve them publically. Please also note, that the service polls for the certificate for the hostname in DNS, which is valid (start and end date) certificate and uses the same public key, this certificate is used and steps 3-10 are not executed.</p>
<p>The let's encrypt unikernel does not serve anything, it is a reactive system which acts upon notification from the primary. Thus, it can be executed in a private address space (with a NAT). Since the OCaml DNS server stack needs to push notifications to it, it preserves all incoming signed SOA requests as candidates for notifications on update. The let's encrypt unikernel ensures to always have a connection to the primary to receive notifications.</p>
<pre><code class="language-shell"># getting let's encrypt up and running
$ cd ../lets-encrypt
$ mirage configure -t hvt --prng fortuna
$ make depend
$ make
# run it
$ solo5-hvt --net:service=tap2 -- letsencrypt.hvt --keys=...
# test it
$ ocertify 10.0.42.2 foo.mirage
</code></pre>
<p>For actual testing with let's encrypt servers you need to have the primary and secondary deployed on your remote hosts, and your domain needs to be delegated to these servers. Good luck. And ensure you have backup your git repository.</p>
<p>As fine print, while this tutorial was about the <code>mirage</code> zone, you can stick any number of zones into the git repository. If you use a <code>_keys</code> file (without any domain prefix), you can configure hmac secrets for all zones, i.e. something to use in your let's encrypt unikernel and secondary unikernel. Dynamic addition of zones is supported, just create a new zonefile and notify the primary, the secondary will be notified and pick it up. The primary responds to a signed SOA for the root zone (i.e. requested by the secondary) with the SOA response (not authoritative), and additionally notifications for all domains of the primary.</p>
<h3>Conclusion and thanks</h3>
<p>This tutorial presented how to use the OCaml DNS based unikernels to run authoritative name servers for your domain, using a git repository as the source of truth, dynamic authenticated updates, and let's encrypt certificate issuing.</p>
<p>There are further steps to take, such as monitoring -- have a look at the <code>monitoring</code> branch of the opam repository above, and the <code>future-robur</code> branch of the unikernels repository above, which use a second network interface for reporting syslog and metrics to telegraf / influx / grafana. Some DNS features are still missing, most prominently DNSSec.</p>
<p>I'd like to thank all people involved in this software stack, without other key components, including <a href="https://github.com/mirage/ocaml-git">git</a>, <a href="https://irmin.io/">irmin 2.0</a>, <a href="https://github.com/mirleft/ocaml-nocrypto">nocrypto</a>, <a href="https://github.com/haesbaert/awa-ssh">awa-ssh</a>, <a href="https://github.com/mirage/ocaml-cohttp">cohttp</a>, <a href="https://github.com/solo5/sol5">solo5</a>, <a href="https://github.com/mirage/mirage">mirage</a>, <a href="https://github.com/mmaker/ocaml-letsencrypt">ocaml-letsencrypt</a>, and more.</p>
<p>If you want to support our work on MirageOS unikernels, please <a href="https://robur.coop/Donate">donate to robur</a>. I'm interested in feedback, either via <a href="https://twitter.com/h4nnes">twitter</a>, <a href="https://mastodon.social/@hannesm">hannesm@mastodon.social</a> or via eMail.</p>
</article></div></div></main></body></html>

45
Posts/EC Normal file
View file

@ -0,0 +1,45 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Cryptography updates in OCaml and MirageOS</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="Cryptography updates in OCaml and MirageOS" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="post"><h2>Cryptography updates in OCaml and MirageOS</h2><span class="author">Written by hannes</span><br/><div class="tags">Classified under: <a href="/tags/mirageos" class="tag">mirageos</a><a href="/tags/security" class="tag">security</a><a href="/tags/tls" class="tag">tls</a></div><span class="date">Published: 2021-04-23 (last updated: 2021-11-19)</span><article><h2>Introduction</h2>
<p>Tl;DR: mirage-crypto-ec, with x509 0.12.0, and tls 0.13.0, provide fast and secure elliptic curve support in OCaml and MirageOS - using the verified <a href="https://github.com/mit-plv/fiat-crypto/">fiat-crypto</a> stack (Coq to OCaml to executable which generates C code that is interfaced by OCaml). In x509, a long standing issue (countryName encoding), and archive (PKCS 12) format is now supported, in addition to EC keys. In tls, ECDH key exchanges are supported, and ECDSA and EdDSA certificates.</p>
<h2>Elliptic curve cryptography</h2>
<p><a href="https://mirage.io/blog/tls-1-3-mirageos">Since May 2020</a>, our <a href="https://usenix15.nqsb.io">OCaml-TLS</a> stack supports TLS 1.3 (since tls version 0.12.0 on opam).</p>
<p>TLS 1.3 requires elliptic curve cryptography - which was not available in <a href="https://github.com/mirage/mirage-crypto">mirage-crypto</a> (the maintained fork of <a href="https://github.com/mirleft/ocaml-nocrypto">nocrypto</a>).</p>
<p>There are two major uses of elliptic curves: <a href="https://en.wikipedia.org/wiki/Elliptic-curve_Diffie%E2%80%93Hellman">key exchange (ECDH)</a> for establishing a shared secret over an insecure channel, and <a href="https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm">digital signature (ECDSA)</a> for authentication, integrity, and non-repudiation. (Please note that the construction of digital signatures on Edwards curves (Curve25519, Ed448) is called EdDSA instead of ECDSA.)</p>
<p>Elliptic curve cryptoraphy is <a href="https://eprint.iacr.org/2020/615">vulnerable</a> <a href="https://raccoon-attack.com/">to</a> <a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-5407">various</a> <a href="https://github.com/mimoo/timing_attack_ecdsa_tls">timing</a> <a href="https://minerva.crocs.fi.muni.cz/">attacks</a> - have a read of the <a href="https://blog.trailofbits.com/2020/06/11/ecdsa-handle-with-care/">overview article on ECDSA</a>. When implementing elliptic curve cryptography, it is best to avoid these known attacks. Gladly, there are some projects which address these issues by construction.</p>
<p>In addition, to use the code in MirageOS, it should be boring C code: no heap allocations, only using a very small amount of C library functions -- the code needs to be compiled in an environment with <a href="https://github.com/mirage/ocaml-freestanding/tree/v0.6.4/nolibc">nolibc</a>.</p>
<p>Two projects started in semantics, to solve the issue from the grounds up: <a href="https://github.com/mit-plv/fiat-crypto/">fiat-crypto</a> and <a href="https://github.com/project-everest/hacl-star/">hacl-star</a>: their approach is to use a proof system (<a href="https://coq.inria.fr">Coq</a> or <a href="https://www.fstar-lang.org/">F*</a> to verify that the code executes in constant time, not depending on data input. Both projects provide as output of their proof systems C code.</p>
<p>For our initial TLS 1.3 stack, <a href="https://github.com/pascutto/">Clément</a>, <a href="https://github.com/NathanReb/">Nathan</a> and <a href="https://github.com/emillon/">Etienne</a> developed <a href="https://github.com/mirage/fiat">fiat-p256</a> and <a href="https://github.com/mirage/hacl">hacl_x5519</a>. Both were one-shot interfaces for a narrow use case (ECDH for NIST P-256 and X25519), worked well for their purpose, and allowed to gather some experience from the development side.</p>
<h3>Changed requirements</h3>
<p>Revisiting our cryptography stack with the elliptic curve perspective had several reasons, on the one side the customer project <a href="https://www.nitrokey.com/products/nethsm">NetHSM</a> asked for feasibility of ECDSA/EdDSA for various elliptic curves, on the other side <a href="https://github.com/mirage/ocaml-dns/pull/251">DNSSec</a> uses elliptic curve cryptography (ECDSA), and also <a href="https://www.wireguard.com/">wireguard</a> relies on elliptic curve cryptography. The number of X.509 certificates using elliptic curves is increasing, and we don't want to leave our TLS stack in a state where it can barely talk to a growing number of services on the Internet.</p>
<p>Looking at <a href="https://github.com/project-everest/hacl-star/"><em>hacl-star</em></a>, their <a href="https://hacl-star.github.io/Supported.html">support</a> is limited to P-256 and Curve25519, any new curve requires writing F*. Another issue with hacl-star is C code quality: their C code does neither <a href="https://github.com/mirage/hacl/issues/46">compile with older C compilers (found on Oracle Linux 7 / CentOS 7)</a>, nor when enabling all warnings (&gt; 150 are generated). We consider the C compiler as useful resource to figure out undefined behaviour (and other problems), and when shipping C code we ensure that it compiles with <code>-Wall -Wextra -Wpedantic --std=c99 -Werror</code>. The hacl project <a href="https://github.com/mirage/hacl/tree/master/src/kremlin">ships</a> a bunch of header files and helper functions to work on all platforms, which is a clunky <code>ifdef</code> desert. The hacl approach is to generate a whole algorithm solution: from arithmetic primitives, group operations, up to cryptographic protocol - everything included.</p>
<p>In contrast, <a href="https://github.com/mit-plv/fiat-crypto/"><em>fiat-crypto</em></a> is a Coq development, which as part of compilation (proof verification) generates executables (via OCaml code extraction from Coq). These executables are used to generate modular arithmetic (as C code) given a curve description. The <a href="https://github.com/mirage/mirage-crypto/tree/main/ec/native">generated C code</a> is highly portable, independent of platform (word size is taken as input) - it only requires a <code>&lt;stdint.h&gt;</code>, and compiles with all warnings enabled (once <a href="https://github.com/mit-plv/fiat-crypto/pull/906">a minor PR</a> got merged). Supporting a new curve is simple: generate the arithmetic code using fiat-crypto with the new curve description. The downside is that group operations and protocol needs to implemented elsewhere (and is not part of the proven code) - gladly this is pretty straightforward to do, especially in high-level languages.</p>
<h3>Working with fiat-crypto</h3>
<p>As mentioned, our initial <a href="https://github.com/mirage/fiat">fiat-p256</a> binding provided ECDH for the NIST P-256 curve. Also, BoringSSL uses fiat-crypto for ECDH, and developed the code for group operations and cryptographic protocol on top of it.</p>
<p>The work needed was (a) ECDSA support and (b) supporting more curves (let's focus on NIST curves). For ECDSA, the algorithm requires modular arithmetics in the field of the group order (in addition to the prime). We generate these primitives with fiat-crypto (named <code>npYYY_AA</code>) - that required <a href="https://github.com/mit-plv/fiat-crypto/commit/e31a36d5f1b20134e67ccc5339d88f0ff3cb0f86">a small fix in decoding hex</a>. Fiat-crypto also provides inversion <a href="https://github.com/mit-plv/fiat-crypto/pull/670">since late October 2020</a>, <a href="https://eprint.iacr.org/2021/549">paper</a> - which allowed to reduce our code base taken from BoringSSL. The ECDSA protocol was easy to implement in OCaml using the generated arithmetics.</p>
<p>Addressing the issue of more curves was also easy to achieve, the C code (group operations) are macros that are instantiated for each curve - the OCaml code are functors that are applied with each curve description.</p>
<p>Thanks to the test vectors (as structured data) from <a href="https://github.com/google/wycheproof/">wycheproof</a> (and again thanks to Etienne, Nathan, and Clément for their OCaml code decodin them), I feel confident that our elliptic curve code works as desired.</p>
<p>What was left is X25519 and Ed25519 - dropping the hacl dependency entirely felt appealing (less C code to maintain from fewer projects). This turned out to require more C code, which we took from BoringSSL. It may be desirable to reduce the imported C code, or to wait until a project on top of fiat-crypto which provides proven cryptographic protocols is in a usable state.</p>
<p>To avoid performance degradation, I distilled some <a href="https://github.com/mirage/mirage-crypto/pull/107#issuecomment-799701703">X25519 benchmarks</a>, turns out the fiat-crypto and hacl performance is very similar.</p>
<h3>Achievements</h3>
<p>The new opam package <a href="https://mirage.github.io/mirage-crypto/doc/mirage-crypto-ec/Mirage_crypto_ec/index.html">mirage-crypto-ec</a> is released, which includes the C code generated by fiat-crypto (including <a href="https://github.com/mit-plv/fiat-crypto/pull/670">inversion</a>), <a href="https://github.com/mirage/mirage-crypto/blob/main/ec/native/point_operations.h">point operations</a> from BoringSSL, and some <a href="https://github.com/mirage/mirage-crypto/blob/main/ec/mirage_crypto_ec.ml">OCaml code</a> for invoking these functions and doing bounds checks, and whether points are on the curve. The OCaml code are some functors that take the curve description (consisting of parameters, C function names, byte length of value) and provide Diffie-Hellman (Dh) and digital signature algorithm (Dsa) modules. The nonce for ECDSA is computed deterministically, as suggested by <a href="https://tools.ietf.org/html/rfc6979">RFC 6979</a>, to avoid private key leakage.</p>
<p>The code has been developed in <a href="https://github.com/mirage/mirage-crypto/pull/101">NIST curves</a>, <a href="https://github.com/mirage/mirage-crypto/pull/106">removing blinding</a> (since we use operations that are verified to be constant-time), <a href="https://github.com/mirage/mirage-crypto/pull/108">added missing length checks</a> (reported by <a href="https://github.com/greg42">Greg</a>), <a href="https://github.com/mirage/mirage-crypto/pull/107">curve25519</a>, <a href="https://github.com/mirage/mirage-crypto/pull/117">a fix for signatures that do not span the entire byte size (discovered while adapting X.509)</a>, <a href="https://github.com/mirage/mirage-crypto/pull/118">fix X25519 when the input has offset &lt;&gt; 0</a>. It works on x86 and arm, both 32 and 64 bit (checked by CI). The development was partially sponsored by Nitrokey.</p>
<p>What is left to do, apart from further security reviews, is <a href="https://github.com/mirage/mirage-crypto/issues/109">performance improvements</a>, <a href="https://github.com/mirage/mirage-crypto/issues/112">Ed448/X448 support</a>, and <a href="https://github.com/mirage/mirage-crypto/issues/105">investigating deterministic k for P521</a>. Pull requests are welcome.</p>
<p>When you use the code, and encounter any issues, please <a href="https://github.com/mirage/mirage-crypto/issues">report them</a>.</p>
<h2>Layer up - X.509 now with ECDSA / EdDSA and PKCS 12 support, and a long-standing issue fixed</h2>
<p>With the sign and verify primitives, the next step is to interoperate with other tools that generate and use these public and private keys. This consists of serialisation to and deserialisation from common data formats (ASN.1 DER and PEM encoding), and support for handling X.509 certificates with elliptic curve keys. Since X.509 0.12.0, it supports EC private and public keys, including certificate validation and issuance.</p>
<p>Releasing X.509 also included to go through the issue tracker and attempt to solve the existing issues. This time, the <a href="https://github.com/mirleft/ocaml-x509/issues/69">&quot;country name is encoded as UTF8String, while RFC demands PrintableString&quot;</a> filed more than 5 years ago by <a href="https://github.com/reynir">Reynir</a>, re-reported by <a href="https://github.com/paurkedal">Petter</a> in early 2017, and again by <a href="https://github.com/NightBlues">Vadim</a> in late 2020, <a href="https://github.com/mirleft/ocaml-x509/pull/140">was fixed by Vadim</a>.</p>
<p>Another long-standing pull request was support for <a href="https://tools.ietf.org/html/rfc7292">PKCS 12</a>, the archive format for certificate and private key bundles. This has <a href="https://github.com/mirleft/ocaml-x509/pull/114">been developed and merged</a>. PKCS 12 is a widely used and old format (e.g. when importing / exporting cryptographic material in your browser, used by OpenVPN, ...). Its specification uses RC2 and 3DES (see <a href="https://unmitigatedrisk.com/?p=654">this nice article</a>), which are the default algorithms used by <code>openssl pkcs12</code>.</p>
<h2>One more layer up - TLS</h2>
<p>In TLS we are finally able to use ECDSA (and EdDSA) certificates and private keys, this resulted in slightly more complex configuration - the constraints between supported groups, signature algorithms, ciphersuite, and certificates are intricate:</p>
<p>The ciphersuite (in TLS before 1.3) specifies which key exchange mechanism to use, but also which signature algorithm to use (RSA/ECDSA). The supported groups client hello extension specifies which elliptic curves are supported by the client. The signature algorithm hello extension (TLS 1.2 and above) specifies the signature algorithm. In the end, at load time the TLS configuration is validated and groups, ciphersuites, and signature algorithms are condensed depending on configured server certificates. At session initiation time, once the client reports what it supports, these parameters are further cut down to eventually find some suitable cryptographic parameters for this session.</p>
<p>From the user perspective, earlier the certificate bundle and private key was a pair of <code>X509.Certificate.t list</code> and <code>Mirage_crypto_pk.Rsa.priv</code>, now the second part is a <code>X509.Private_key.t</code> - all provided constructors have been updates (notably <code>X509_lwt.private_of_pems</code> and <code>Tls_mirage.X509.certificate</code>).</p>
<h2>Finally, conduit and mirage</h2>
<p>Thanks to <a href="https://github.com/dinosaure">Romain</a>, conduit* 4.0.0 was released which supports the modified API of X.509 and TLS. Romain also developed patches and released mirage 3.10.3 which supports the above mentioned work.</p>
<h2>Conclusion</h2>
<p>Elliptic curve cryptography is now available in OCaml using verified cryptographic primitives from the fiat-crypto project - <code>opam install mirage-crypto-ec</code>. X.509 since 0.12.0 and TLS since 0.13.0 and MirageOS since 3.10.3 support this new development which gives rise to smaller EC keys. Our old bindings, fiat-p256 and hacl_x25519 have been archived and will no longer be maintained.</p>
<p>Thanks to everyone involved on this journey: reporting issues, sponsoring parts of the work, helping with integration, developing initial prototypes, and keep motivating me to continue this until the release is done.</p>
<p>In the future, it may be possible to remove zarith and gmp from the dependency chain, and provide EC-only TLS servers and clients for MirageOS. The benefit will be much less C code (libgmp-freestanding.a is 1.5MB in size) in our trusted code base.</p>
<p>Another potential project that is very close now is a certificate authority developed in MirageOS - now that EC keys, PKCS 12, revocation lists, ... are implemented.</p>
<h2>Footer</h2>
<p>If you want to support our work on MirageOS unikernels, please <a href="https://robur.coop/Donate">donate to robur</a>. I'm interested in feedback, either via <a href="https://twitter.com/h4nnes">twitter</a>, <a href="https://mastodon.social/@hannesm">hannesm@mastodon.social</a> or via eMail.</p>
</article></div></div></main></body></html>

119
Posts/Functoria Normal file
View file

@ -0,0 +1,119 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Configuration DSL step-by-step</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="Configuration DSL step-by-step" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="post"><h2>Configuration DSL step-by-step</h2><span class="author">Written by hannes</span><br/><div class="tags">Classified under: <a href="/tags/mirageos" class="tag">mirageos</a><a href="/tags/background" class="tag">background</a></div><span class="date">Published: 2016-05-10 (last updated: 2021-11-19)</span><article><p>Sorry for being late again with this article, I had other ones planned, but am not yet satisfied with content and code, will have to wait another week.</p>
<h2>MirageOS configuration</h2>
<p>As described in an <a href="/Posts/OperatingSystem">earlier post</a>, MirageOS is a library operating system which generates single address space custom kernels (so called unikernels) for each application. The application code is (mostly) independent on the used backend. To achieve this, the language which expresses the configuration of a MirageOS unikernel is rather complex, and has to deal with package dependencies, setup of layers (network stack starting at the (virtual) ethernet device, or sockets), logging, tracing.</p>
<p>The abstraction over concrete implementation of e.g. the network stack is done by providing a module signature in the <a href="https://github.com/mirage/mirage/tree/master/types">mirage-types</a> package. The socket-based network stack, the tap device based network stack, and the Xen virtual network device based network stack implement this signature (depending on other module signatures). The unikernel contains code which applies those dependent modules to instantiate a custom-tailored network stack for the specific configuration. A developer should only describe what their requirements are, the user who wants to deploy it should provide the concrete configuration. And the developer should not need to manually instantiate the network stack for all possible configurations, this is what the mirage tool should embed.</p>
<p>Initially, MirageOS contained an adhoc system which relied on concatenation of strings representing OCaml code. This turned out to be error prone. In 2015 <a href="https://github.com/Drup">Drup</a> developed <a href="https://github.com/mirage/functoria">Functoria</a>, a domain-specific language (DSL) to organize functor applications, primarily for MirageOS. It has been introduced in <a href="https://mirage.io/blog/introducing-functoria">a blog post</a>. It is not limited to MirageOS (although this is the primary user right now).</p>
<p>Functoria has been included in MirageOS since its <a href="https://github.com/mirage/mirage/releases/tag/v2.7.0">2.7.0 release</a> at the end of February 2016. Functoria provides support for command line arguments which can then either be passed at configuration time or at boot time to the unikernel (such as IP address configuration) using the <a href="http://erratique.ch/software/cmdliner">cmdliner library</a> underneath (and includes dynamic man pages, help, sensible command line parsing, and even visualisation (<code>mirage describe</code>) of the configuration and data dependencies).</p>
<p>I won't go into details about command line arguments in here, please have a look at the <a href="https://mirage.io/blog/introducing-functoria">functoria blog post</a> in case you're interested. Instead, I'll describe how to define a Functoria device which inserts content as code at configuration time into a MirageOS unikernel (<a href="http://marrakech2016.mirage.io">running here</a>, <a href="https://github.com/mirage/marrakech2016">source</a>). Using this approach, no external data (using crunch or a file system image) is needed, while the content can still be modified using markdown. Also, no markdown to HTML converter is needed at runtime, but this step is completely done at compile time (the result is a small (still too large) unikernel, 4.6MB).</p>
<h3>Unikernel</h3>
<p>Similar to <a href="/Posts/nqsbWebsite">my nqsb.io website post</a>, this unikernel only has a single resource and thus does not need to do any parsing (or even call <code>read</code>). The main function is <code>start</code>:</p>
<pre><code class="language-OCaml">let start stack _ =
S.listen_tcpv4 stack ~port:80 (serve rendered) ;
S.listen stack
</code></pre>
<p>Where <code>S</code> is a <a href="https://github.com/mirage/mirage/blob/355edc987135aff640b240594ae4af31815922e5/types/V1.mli#L668-L765">V1_LWT.STACKV4</a>, a complete TCP/IP stack for IPv4. The functions we are using are <a href="https://github.com/mirage/mirage/blob/355edc987135aff640b240594ae4af31815922e5/types/V1.mli#L754-L759">listen_tcpv4</a>, which needs a <code>stack</code>, <code>port</code> and a <code>callback</code> (and should be called <code>register_tcp_callback</code>), and <a href="https://github.com/mirage/mirage/blob/355edc987135aff640b240594ae4af31815922e5/types/V1.mli#L761-L764">listen</a> which polls for incoming frames.</p>
<p>Our callback is <code>serve rendered</code>, where <code>serve</code> is defined as:</p>
<pre><code class="language-OCaml">let serve data tcp =
TCP.writev tcp [ header; data ] &gt;&gt;= fun _ -&gt;
TCP.close tcp
</code></pre>
<p>Upon an incoming TCP connection, the list consisting of <code>header ; data</code> is written to the connection, which is subsequently closed.</p>
<p>The function <code>header</code> is very similar to our previous one, splicing a proper HTTP header together:</p>
<pre><code class="language-OCaml">let http_header ~status xs =
let headers = List.map (fun (k, v) -&gt; k ^ &quot;: &quot; ^ v) xs in
let lines = status :: headers @ [ &quot;\r\n&quot; ] in
Cstruct.of_string (String.concat &quot;\r\n&quot; lines)
let header = http_header
~status:&quot;HTTP/1.1 200 OK&quot;
[ (&quot;Content-Type&quot;, &quot;text/html; charset=UTF-8&quot;) ;
(&quot;Connection&quot;, &quot;close&quot;) ]
</code></pre>
<p>And the <code>rendered</code> function consists of some hardcoded HTML, and references to two other modules, <code>Style.data</code> and <code>Content.data</code>:</p>
<pre><code class="language-OCaml">let rendered =
Cstruct.of_string
(String.concat &quot;&quot; [
&quot;&lt;html&gt;&lt;head&gt;&quot; ;
&quot;&lt;title&gt;1st MirageOS hackathon: 11-16th March 2016, Marrakech, Morocco&lt;/title&gt;&quot; ;
&quot;&lt;style&gt;&quot; ; Style.data ; &quot;&lt;/style&gt;&quot; ;
&quot;&lt;/head&gt;&quot; ;
&quot;&lt;body&gt;&lt;div id=\&quot;content\&quot;&gt;&quot; ;
Content.data ;
&quot;&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;&quot; ])
</code></pre>
<p>This puts together the pieces we need for a simple HTML site. This unikernel does not have any external dependencies, if we assume that the mirage toolchain, the types, and the network implementation are already provided (the latter two are implicitly added by the mirage tool depending on the configuration, the first you'll have to install manually <code>opam install mirage</code>).</p>
<p>But wait, where do <code>Style</code> and <code>Content</code> come from? There are no <code>ml</code> modules in the repository. Instead, there is a <a href="https://github.com/mirage/marrakech2016/blob/master/data/content.md">content.md</a> and <a href="https://github.com/mirage/marrakech2016/blob/master/data/style.css">style.css</a> in the <code>data</code> subdirectory.</p>
<h3>Configuration</h3>
<p>We use the builtin configuration time magic of functoria to translate these into OCaml modules, in such a way that our unikernel does not need to embed code to render markdown to HTML and carry along a markdown data file.</p>
<p>Inside of <code>config.ml</code>, let's look again at the bottom:</p>
<pre><code class="language-OCaml">let () =
register &quot;marrakech2016&quot; [
foreign
~deps:[abstract config_shell]
&quot;Unikernel.Main&quot;
( stackv4 @-&gt; job )
$ net
]
</code></pre>
<p>The function <a href="https://mirage.github.io/mirage/Mirage.html#VALregister">register</a> is provided by the mirage tool, it will execute the list of jobs using the given name. To construct a <code>job</code>, we use the <a href="https://mirage.github.io/functoria/Functoria.html#VALforeign">foreign</a> combinator, which might have dependencies (here, a list with the single element <code>config_shell</code> explained later, using the <a href="https://mirage.github.io/functoria/Functoria_key.html#VALabstract">abstract</a> combinator), the name of the main function (<code>Unikernel.main</code>), a <a href="https://mirage.github.io/functoria/Functoria.html#TYPEtyp">typ</a> (here constructed using the <a href="https://mirage.github.io/functoria/Functoria.html#VAL%28@-%3E%29">@-&gt;</a> combinator, from a <a href="https://mirage.github.io/mirage/Mirage.html#TYPEstackv4">stackv4</a> to a <a href="https://mirage.github.io/functoria/Functoria.html#TYPEjob">job</a>), and this applied (using the <a href="https://mirage.github.io/functoria/Functoria.html#VAL%28$%29">$</a> combinator) to the <code>net</code> (an actual implementation of <code>stackv4</code>).</p>
<p>The <code>net</code> implementation is as following:</p>
<pre><code class="language-OCaml">let address addr nm gw =
let f = Ipaddr.V4.of_string_exn in
{ address = f addr ; netmask = f nm ; gateways = [f gw] }
let server = address &quot;198.167.222.204&quot; &quot;255.255.255.0&quot; &quot;198.167.222.1&quot;
let net =
if_impl Key.is_xen
(direct_stackv4_with_static_ipv4 default_console tap0 server)
(socket_stackv4 default_console [Ipaddr.V4.any])
</code></pre>
<p>Depending on whether we're running on unix or xen, either a socket stack (for testing) or the concrete IP configuration for deployment (using <a href="https://mirage.github.io/functoria/Functoria.html#VALif_impl">if_impl</a> and <a href="https://mirage.github.io/mirage/Mirage_key.html#VALis_xen">is_xen</a> from our DSLs).</p>
<p>So far nothing too surprising, only some combinators of the functoria DSL which let us describe the possible configuration options.</p>
<p>Let us look into <code>config_shell</code>, which embeds the markdown and CSS into OCaml modules at configuration time:</p>
<pre><code class="language-OCaml">type sh = ShellConfig
let config_shell = impl @@ object
inherit base_configurable
method configure i =
let open Functoria_app.Cmd in
let (&gt;&gt;=) = Rresult.(&gt;&gt;=) in
let dir = Info.root i in
run &quot;echo 'let data = {___|' &gt; style.ml&quot; &gt;&gt;= fun () -&gt;
run &quot;cat data/style.css &gt;&gt; style.ml&quot; &gt;&gt;= fun () -&gt;
run &quot;echo '|___}' &gt;&gt; style.ml&quot; &gt;&gt;= fun () -&gt;
run &quot;echo 'let data = {___|' &gt; content.ml&quot; &gt;&gt;= fun () -&gt;
run &quot;omd data/content.md &gt;&gt; content.ml&quot; &gt;&gt;= fun () -&gt;
run &quot;echo '|___}' &gt;&gt; content.ml&quot;
method clean i = Functoria_app.Cmd.run &quot;rm -f style.ml content.ml&quot;
method module_name = &quot;Functoria_runtime&quot;
method name = &quot;shell_config&quot;
method ty = Type ShellConfig
end
</code></pre>
<p>Functoria uses classes internally, and we extend the <a href="https://mirage.github.io/functoria/Functoria.base_configurable-c.html">base_configurable</a> class, which extends <a href="https://mirage.github.io/functoria/Functoria.configurable-c.html">configurable</a> with some sensible defaults.</p>
<p>The important bits are what actually happens during <code>configure</code> and <code>clean</code>: execution of some shell commands (<code>echo</code>, <code>omd</code>, and <code>rm</code>) using the <a href="https://mirage.github.io/functoria/Functoria_app.html">functoria application builder</a> interface. Some information is as well exposed via the <a href="https://mirage.github.io/functoria/Functoria_info.html">Functoria_info</a> module.</p>
<h3>Wrapup</h3>
<p>We walked through the configuration magic of MirageOS, which is a domain-specific language designed for MirageOS demands. We can run arbitrary commands at compile time, and do not need to escape into external files, such as Makefile or shell scripts, but can embed them in our <code>config.ml</code>.</p>
<p>I'm interested in feedback, either via
<a href="https://twitter.com/h4nnes">twitter</a> or via eMail.</p>
<h2>Other updates in the MirageOS ecosystem</h2>
<ul>
<li>now using Html5.P.print instead of string concatenation, as suggested by Drup (both on <a href="https://github.com/mirleft/nqsb.io/commit/f16291b67d203bf6b2ebc0c5c8479b7cfd153683">nqsb.io</a> and in <a href="https://github.com/Engil/Canopy/pull/46">Canopy</a>)
</li>
<li>Canopy updated and created timestamps (for <a href="https://github.com/Engil/Canopy/pull/48">irmin-0.10</a> and <a href="https://github.com/Engil/Canopy/pull/43">irmin-0.11</a>)
</li>
<li>another <a href="https://github.com/mirage/mirage-http/pull/24">resource leak in mirage-http</a>
</li>
<li><a href="https://github.com/mirage/mirage-platform/pull/165">mirage-platform now has 4.03 support</a> and <a href="https://github.com/mirage/mirage-platform/issues/118">strtod</a> (finally :)
</li>
<li><a href="https://mirage.io/blog/2016-spring-hackathon">blog posts about retreat in marrakech</a>
</li>
<li><a href="https://github.com/Cumulus/Syndic">syndic 1.5.0 release</a> now using ptime instead of calendar
</li>
</ul>
</article></div></div></main></body></html>

337
Posts/Jackline Normal file
View file

@ -0,0 +1,337 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Jackline, a secure terminal-based XMPP client</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="Jackline, a secure terminal-based XMPP client" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="post"><h2>Jackline, a secure terminal-based XMPP client</h2><span class="author">Written by hannes</span><br/><div class="tags">Classified under: <a href="/tags/UI" class="tag">UI</a><a href="/tags/security" class="tag">security</a></div><span class="date">Published: 2017-01-30 (last updated: 2021-09-08)</span><article><p><img src="/static/img/jackline2.png" alt="screenshot" /></p>
<p>Back in 2014, when we implemented <a href="https://nqsb.io">TLS</a> in OCaml, at some point
I was bored with TLS. I usually need at least two projects (but not more than 5) at the same time to
procrastinate the one I should do with the other one - it is always more fun to
do what you're not supposed to do. I started to implement another security
protocol (<a href="https://otr.cypherpunks.ca/">Off-the-record</a>, resulted in
<a href="https://hannesm.github.io/ocaml-otr/doc/Otr.html">ocaml-otr</a>) on my own,
applying what I learned while co-developing TLS with David. I was eager to
actually deploy our TLS stack: using it with a web server (see <a href="/Posts/nqsbWebsite">this post</a>) is fun, but only using one half
of the state machine (server side) and usually short-lived connections
(discovers lots of issues with connection establishment) - not the client side
and no long living connection (which may discover other kinds of issues, such as
leaking memory).</p>
<p>To use the stack, I needed to find an application I use on a daily basis (thus
I'm eager to get it up and running if it fails to work). Mail client or web
client are just a bit too big for a spare time project (maybe not ;). Another
communication protocol I use daily is jabber, or
<a href="https://en.wikipedia.org/wiki/Xmpp">XMPP</a>. Back then I used
<a href="https://mcabber.com">mcabber</a> inside a terminal, which is a curses based client
written in C.</p>
<p>I started to develop <a href="https://github.com/hannesm/jackline">jackline</a> (first
commit is 13th November 2014), a terminal based XMPP client in
<a href="/Posts/OCaml">OCaml</a>. This is a report of a
work-in-progress (unreleased, but publicly available!) software project. I'm
not happy with the code base, but neverthelss consider it to be a successful
project: dozens of friends are using it (no exact numbers), I got <a href="https://github.com/hannesm/jackline/graphs/contributors">contributions from other people</a>
(more than 25 commits from more than 8 individuals), I use it on a daily basis
for lots of personal communication.</p>
<h2>What is XMPP?</h2>
<p>The eXtensible Messaging and Presence Protocol (previously known as Jabber)
describes (these days as <a href="https://tools.ietf.org/html/rfc6120">RFC 6120</a>) a
communication protocol based on XML fragments, which enables near real-time
exchange of structured (and extensible) data between two network entities.</p>
<p>The landscape of instant messaging used to contain ICQ, AOL instant messenger,
and MSN messenger. In 1999, people defined a completely open protocol standard,
then named Jabber, since 2011 official RFCs. It is a federated (similar to
eMail) near-real time extensible messaging system (including presence
information) used for instant messaging. Extensions include end-to-end
encryption, multi-user chat, audio transport, ... Unicode support is builtin,
everything is UTF8 encoded.</p>
<p>There are various open jabber servers where people can register accounts, as
well as closed ones. Google Talk used to federate (until 2014) into XMPP,
Facebook chat used to be based on XMPP. Those big companies wanted something
&quot;more usable&quot; (where they're more in control, reliable message delivery via
caching in the server and mandatory delivery receipts, multiple devices all
getting the same messages), and thus moved away from the open standard.</p>
<h3>XMPP Security</h3>
<p>Authentication is done via a TLS channel (where your client should authenticate
the server), and SASL that the server authenticates your client. I
<a href="https://berlin.ccc.de/~hannes/secure-instant-messaging.pdf">investigated in 2008</a> (in German)
which clients and servers use which authentication methods (I hope the state of
certificate verification improved in the last decade).</p>
<p>End-to-end encryption is achievable using OpenPGP (rarely used in my group of
friends) via XMPP, or <a href="https://otr.cypherpunks.ca/">Off-the-record</a>, which was
pioneered over XMPP, and is still in wide use - it gave rise to forward secrecy:
if your long-term (stored on disk) asymmetric keys get seized or stolen, they
are not sufficient to decrypt recorded sessions (you can't derive the session
key from the asymmetric keys) -- but the encrypted channel is still
authenticated (once you verified the public key via a different channel or a
shared secret, using the <a href="https://en.wikipedia.org/wiki/Socialist_millionaire">Socialist millionaires problem</a>).</p>
<p>OTR does not support offline messages (the session keys may already be destroyed
by the time the communication partner reconnects and receives the stored
messages), and thus recently <a href="https://conversations.im/omemo/">omemo</a> was
developed. Other messaging protocols (Signal, Threema) are not really open,
support no federation, but have good support for group encryption and offline
messaging. (There is a <a href="https://www.cypherpunks.ca/~iang/pubs/secmessaging-oakland15.pdf">nice overview over secure messaging and threats.</a>)</p>
<p>There is (AFAIK) no encrypted group messaging via XMPP; also the XMPP server
contains lots of sensible data: your address book (buddy list), together with
offline messages, nicknames you gave to your buddies, subscription information,
and information every time you connect (research of privacy preserving presence
protocols has been done, but is not widely used AFAIK,
e.g. <a href="http://cacr.uwaterloo.ca/techreports/2014/cacr2014-10.pdf">DP5</a>).</p>
<h3>XMPP client landscape</h3>
<p>See <a href="https://en.wikipedia.org/wiki/Comparison_of_XMPP_clients">wikipedia</a> for an
extensive comparison (which does not mention jackline :P).</p>
<p>A more opinionated analysis is that you were free to choose between C - where
all code has to do manual memory management and bounds checking - with ncurses
(or GTK) and OpenSSL (or GnuTLS) using libpurple (or some other barely
maintained library which tries to unify all instant messaging protocols), or
Python - where you barely know upfront what it will do at runtime - with GTK and
some OpenSSL, or even JavaScript - where external scripts can dynamically modify
the prototype of everything at runtime (and thus modify code arbitrarily,
violating invariants) - calling out to C libraries (NSS, maybe libpurple, who
knows?).</p>
<p>Due to complex APIs of transport layer security, certificate verification is
<a href="https://pidgin.im/news/security/?id=91">still not always done correctly</a> (that's just
one example, you'll find more) - even if, it may not allow custom trust anchors
or certificate fingerprint based verification - which are crucial for a
federated operations without a centralised trust authority.</p>
<p>Large old code basis usually gather dust and getting bitrot - and if you add
patch by patch from random people on the Internet, you've to deal with the most
common bug: insufficient checking of input (or output data, <a href="https://dev.gajim.org/gajim/gajim-plugins/issues/145">if you encrypt only the plain body, but not the marked up one</a>). In some
programming languages this easily <a href="https://pidgin.im/news/security/?id=64">leads to execution of remote code</a>, other programming languages steal the
work from programmers by deploying automated memory management (finally machines
take our work away! :)) - also named garbage collection, often used together
with automated bounds checking -- this doesn't mean that you're safe - there are
still logical flaws, and integer overflows (and funny things which happen at
resource starvation), etc.</p>
<h3>Goals and non-goals</h3>
<p>My upfront motivation was to write and use an XMPP client tailored to my needs.
I personally don't use many graphical applications (coding in emacs, mail via
thunderbird, firefox, mplayer, mupdf), but stick mostly to terminal
applications. I additionally don't use any terminal multiplexer (saw too many
active <code>screen</code> sessions on remote servers where people left root shells open).</p>
<p>The <a href="https://github.com/hannesm/jackline/commit/9322ceefa9a331fa92a6bf253e8d8f010da2229c">goal was from the beginning</a>
to write a &quot;minimalistic graphical user interface for a secure (fail hard)
and trustworthy XMPP client&quot;. By <em>fail hard</em> I mean exactly that: if it can't
authenticate the server, don't send the password. If there is no
end-to-end encrypted session, don't send the message.</p>
<p>As a user of (unreleased) software, there is a single property which I like to
preserve: continue to support all data written to persistent storage. Even
during large refactorings, ensure that data on the user's disk will also be
correctly parsed. There is nothing worse than having to manually configure an
application after update. The solution is straightforward: put a version in
every file you write, and keep readers for all versions ever written around.
My favourite marshalling format (human readable, structured) are still
S-expressions - luckily there is a
<a href="https://github.com/janestreet/sexplib">sexplib</a> in OCaml for handling these.
Additionally, once the initial configuration file has been created (e.g. interactively with the application), the application
does no further writes to the config file. Users can make arbitrary modifications to the file,
and restart the application (and they can make changes while the application is running).</p>
<p>I also appreciate another property of software: don't ever transmit any data or
open a network connection unless initiated by the user (this means no autoconnect on startup, or user is typing indications). Don't be obviously
fingerprintable. A more mainstream demand is surely that software should not
phone home - that's why I don't know how many people are using jackline, reports
based on friends opinions are hundreds of users, I personally know at least
several dozens.</p>
<p>As written <a href="/Posts/OperatingSystem">earlier</a>, I often take
a look at the trusted computing base of a computer system. Jackline's trusted
computing base consists of the client software itself, its OCaml dependencies
(including OTR, TLS, tty library, ...), then the OCaml runtime system, which
uses some parts of libc, and a whole UNIX kernel underneath -- one goal is to
have jackline running as a unikernel (then you connect via SSH or telnet and
TLS).</p>
<p>There are only a few features I need in an XMPP client: single account, strict
validation, delivery receipts, notification callback, being able to deal with
friends logged in multiple times with wrongly set priorities - and end-to-end
encryption. I don't need inline HTML, avatar images, my currently running
music, leaking timezone information, etc. I explicitly don't want to import any
private key material from other clients and libraries, because I want to ensure
that the key was generated by a good random number generator (read <a href="https://mirage.io/blog/mirage-entropy">David's blog article</a> on randomness and entropy).</p>
<p>The security story is crucial: always do strict certificate validation, fail
hard, make it noticable by the user if they're doing insecure communication.
Only few people are into reading out loud their OTR public key fingerprint, and
SMP is not trivial -- thus jackline records the known public keys together with
a set of resources used, a session count, and blurred timestamps (accuracy: day)
when the publickey was initially used and when it was used the last time.</p>
<p>I'm pragmatic - if there is some server (or client) deployed out there which
violates (my interpretation of) the specification, I'm happy to <a href="https://github.com/hannesm/ocaml-otr/issues/10">implement workarounds</a>. Initially I
worked roughly one day a week on jackline.</p>
<p>To not release the software for some years was something I learned from the
<a href="https://common-lisp.net/project/slime/">slime</a> project (<a href="https://www.youtube.com/watch?v=eZDWJfB9XY4">watch Luke's presentation from 2013</a>) - if
there's someone complaining about an issue, fix it within 10 minutes and ask
them to update. This only works if each user compiles the git version anyways.</p>
<h2>User interface</h2>
<p><img src="/static/img/jackline.png" alt="other screenshot" /></p>
<p>Stated goal is <em>minimalistic</em>. No heavy use of colours. Visibility on
both black and white background (btw, as a Unix process there is no way to find
out your background colour (or is there?)). The focus is also <em>security</em> - and
that's where I used colours from the beginning: red is unencrypted (non
end-to-end, there's always the transport layer encryption) communication, green
is encrypted communication. Verification status of the public key uses the same
colours: red for not verified, green for verified. Instead of colouring each
message individually, I use the encryption status of the active contact
(highlighted in the contact list, where messages you type now will be sent to)
to colour the entire frame. This results in a remarkable visual indication and
(at least I) think twice before presssing <code>return</code> in a red terminal. Messages
were initially white/black, but got a bit fancier over time: incoming messages
are bold, multi user messages mentioning your nick are underlined.</p>
<p>The graphical design is mainly inspired by mcabber, as mentioned earlier. There
are four components: the contact list in the upper left, chat window upper
right, log window on the bottom (surrounded by two status bars), and a readline
input. The sizes are configurable (via commands and key shortcuts). A
different view is having the chat window fullscreen (or only the received
messages) - useful for copy and pasting fragments. Navigation is done in the
contact list. There is a single active contact (colours are inverted in the
contact list, and the contact is mentioned in the status bar), whose chat
messages are displayed.</p>
<p>There is not much support for customisation - some people demanded to have a
7bit ASCII version (I output some unicode characters for layout). Recently I
added support to customise the colours. I tried to ensure it looks fine on both
black and white background.</p>
<h2>Code</h2>
<p>Initially I targeted GTK with OCaml, but that excursion only lasted <a href="https://github.com/hannesm/jackline/commit/17b674130f7b1fcf2542eb5e0911a40b81fc724e">two weeks</a>,
when I switched to a <a href="https://github.com/diml/lambda-term">lambda-term</a> terminal
interface.</p>
<h3>UI</h3>
<p>The lambda-term interface survived for a good year (until <a href="https://github.com/hannesm/jackline/pull/117">7th Feb 2016</a>),
when I started to use <a href="https://github.com/pqwy/notty">notty</a> - developed by
David - using a decent <a href="http://erratique.ch/software/uutf">unicode library</a>.</p>
<p>Notty back then was under heavy development, I spend several hours rebasing
jackline to updates in notty. What I got out of it is proper unicode support:
the symbol 茶 gets two characters width (see screenshot at top of page), and the layouting keeps track
how many characters are already written on the terminal.</p>
<p>I recommend to look into <a href="https://github.com/pqwy/notty">notty</a> if you want to
do terminal graphics in OCaml!</p>
<h3>Application logic and state</h3>
<p>Stepping back, an XMPP client reacts to two input sources: the user input
(including terminal resize), and network input (or failure). The output is a
screen (80x25 characters) image. Each input event can trigger output events on
the display and the network.</p>
<p>I used to use multiple threads and locking between shared data for these kinds
of applications: there can go something wrong when network and user input
happens at the same time, or what if the output is interrupted by more input
(which happens e.g. during copy and paste).</p>
<p>Initially I used lots of shared data and had hope, but this was clearly not a
good solution. Nowadays I use mailboxes, and separate tasks which wait for
receiving a message: one task which writes persistent data (session counts,
verified fingerprints) periodically to ask, another which writes on change to
disk, an error handler
(<a href="https://github.com/hannesm/jackline/blob/ec8f8c01d6503bf52be263cd319ef21f2b62ff2e/bin/jackline.ml#L3-L25"><code>init_system</code></a>)
which resets the state upon a connection failure, another task which waits for
user input
(<a href="https://github.com/hannesm/jackline/blob/ec8f8c01d6503bf52be263cd319ef21f2b62ff2e/cli/cli_input.ml#L169"><code>read_terminal</code></a>),
one waiting for network input (<a href="https://github.com/hannesm/jackline/blob/ec8f8c01d6503bf52be263cd319ef21f2b62ff2e/cli/cli_state.ml#L202"><code>Connect</code>, including reconnecting timers</a>),
one to call out the notification hooks
(<a href="https://github.com/hannesm/jackline/blob/ec8f8c01d6503bf52be263cd319ef21f2b62ff2e/cli/cli_state.ml#L100"><code>Notify</code></a>),
etc. The main task is simple: wait for input, process input (producing a new
state), render the state, and recursively call itself
(<a href="https://github.com/hannesm/jackline/blob/ec8f8c01d6503bf52be263cd319ef21f2b62ff2e/cli/cli_client.ml#L371"><code>loop</code></a>).</p>
<p>Only recently I solved the copy and paste issue by <a href="https://github.com/hannesm/jackline/commit/cab34acab004023911997ec9aee8b00a976af7e4">delaying all redraws by 40ms</a>,
and canceling if another redraw is scheduled.</p>
<p>The whole
<a href="https://github.com/hannesm/jackline/blob/ec8f8c01d6503bf52be263cd319ef21f2b62ff2e/cli/cli_state.ml#L29-L58"><code>state</code></a>
contains some user interface parameters (<code>/buddywith</code>, <code>/logheight</code>, ..), as
well as the contact map, which contain users, which have sessions, each
containing chat messages.</p>
<p>The code base is just below 6000 lines of code (way too big ;), and nowadays
supports multi-user chat, sane multi-resource interaction (press <code>enter</code> to show
all available resources of a contact and message each individually in case you
need to), configurable colours, tab completions for nicknames and commands,
per-user input history, emacs keybindings. It even works with the XMPP gateway
provided by slack (some startup doing a centralised groupchat with picture embedding and
animated cats).</p>
<h3>Road ahead</h3>
<p>Common feature requests are: <a href="https://github.com/hannesm/jackline/issues/153">omemo support</a>,
<a href="https://github.com/hannesm/jackline/issues/104">IRC support</a>,
<a href="https://github.com/hannesm/jackline/issues/115">support for multiple accounts</a>
(tbh, these are all
things I'd like to have as well).</p>
<p>But there's some mess to clean up:</p>
<ol>
<li>
<p>The <a href="https://github.com/ermine/xmpp">XMPP library</a> makes heavy use of
functors (to abstract over the concrete IO, etc.), and embeds IO deep inside it.
I do prefer (see e.g. <a href="https://usenix15.nqsb.io">our TLS paper</a>, or <a href="/Posts/ARP">my ARP post</a>) these days to have a pure interface for
the protocol implementation, providing explicit input (state, event, data), and
output (state, action, potentially data to send on network, potentially data to
process by the application). The <a href="https://github.com/hannesm/xmpp/blob/eee18bd3dd343550169969c0b45548eafd51cfe1/src/sasl.ml">sasl implementation</a>
is partial and deeply embedded. The XML parser is as well deeply embedded (and
<a href="https://github.com/hannesm/jackline/issues/8#issuecomment-67773044">has some issues</a>).
The library needs to be torn apart (something I procrastinate since more than
a year). Once it is pure, the application can have full control over when to
call IO (and esp use the same protocol implementation as well for registering a
new account - <a href="https://github.com/hannesm/jackline/issues/12">currently not supported</a>).</p>
</li>
<li>
<p>On the frontend side (the <code>cli</code> subfolder), there is too much knowledge of
XMPP. It should be more general, and be reusable (some bits and pieces are
notty utilities, such as wrapping a string to fit into a text box of specific
width, see
<a href="https://github.com/hannesm/jackline/blob/ec8f8c01d6503bf52be263cd319ef21f2b62ff2e/cli/cli_support.ml#L22"><code>split_unicode</code></a>).</p>
</li>
<li>
<p>The command processing engine itself is 1300 lines (including ad-hoc string
parsing)
(<a href="https://github.com/hannesm/jackline/blob/ec8f8c01d6503bf52be263cd319ef21f2b62ff2e/cli/cli_commands.ml"><code>Cli_commands</code></a>),
best to replaced by a more decent command abstraction.</p>
</li>
<li>
<p>A big record of functions
(<a href="https://github.com/hannesm/jackline/blob/ec8f8c01d6503bf52be263cd319ef21f2b62ff2e/src/xmpp_callbacks.ml#L46"><code>user_data</code></a>)
is passed (during <code>/connect</code> in
<a href="https://github.com/hannesm/jackline/blob/ec8f8c01d6503bf52be263cd319ef21f2b62ff2e/cli/cli_commands.ml#L221-L582"><code>handle_connect</code></a>)
from the UI to the XMPP task to inject messages and errors.</p>
</li>
<li>
<p>The global variable
<a href="https://github.com/hannesm/jackline/blob/ec8f8c01d6503bf52be263cd319ef21f2b62ff2e/cli/cli_state.ml#L200"><code>xmpp_session</code></a>
should be part of the earlier mentioned <code>cli_state</code>, also contacts should be a map, not a Hashtbl (took me some time to learn).</p>
</li>
<li>
<p>Having jackline self-hosted as a MirageOS unikernel. I've implemented a a
<a href="https://github.com/hannesm/telnet">telnet</a> server, there is a
<a href="https://github.com/pqwy/notty/tree/mirage">notty branch</a> be used with the telnet
server. But there is (right now) no good story for persistent mutable storage.</p>
</li>
<li>
<p>Jackline predates some very elegant libraries, such as
<a href="http://erratique.ch/software/logs">logs</a> and
<a href="http://erratique.ch/software/astring">astring</a>, even
<a href="http://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html#TYPEresult">result</a> - since 4.03 part of Pervasives - is not used.
Clearly, other libraries (such as TLS) do not yet use result.</p>
</li>
<li>
<p>After looking in more depths at the logs library, and at user interfaces - I
envision the graphical parts to be (mostly!?) a viewer of logs, and a command
shell (using a control interface, maybe
<a href="https://github.com/mirage/ocaml-9p/">9p</a>): Multiple layers (of a protocol),
slightly related (by <a href="http://erratique.ch/software/logs/doc/Logs.Tag.html">tags</a> - such as the OTR session), and have the layers be visible to users (see also
<a href="https://github.com/mirleft/tlstools">tlstools</a>), a slightly different interface
of similarly structured data. In jackline I'd like to e.g. see all messages of
a single OTR session (see <a href="https://github.com/hannesm/jackline/issues/111">issue</a>), or hide the presence messages in a multi-user chat,
investigate the high-level message, its XML encoded stanza, TLS encrypted
frames, the TCP flow, all down to the ethernet frames send over the wire - also
viewable as sequence diagram and other suitable (terminal) presentations (TCP
window size maybe in a size over time diagram).</p>
</li>
<li>
<p>Once the API between the sources (contacts, hosts) and the UI (what to
display, where and how to trigger notifications, where and how to handle global
changes (such as reconnect)) is clear and implemented, commands need to be
reinvented (some, such as navigation commands and emacs keybindings, are generic
to the user interface, others are specific to XMPP and/or OTR): a new transport
(IRC) or end-to-end crypto protocol (omemo) - should be easy to integrate (with
similar minimal UI features and colours).</p>
</li>
</ol>
<h3>Conclusion</h3>
<p>Jackline started as a procrastination project, and still is one. I only develop
on jackline if I enjoy it. I'm not scared to try new approaches in jackline,
and either reverting them or rewriting some chunks of code again. It is a
project where I publish early and push often. I've met several people (whom I
don't think I know personally) in the multi-user chatroom
<code>jackline@conference.jabber.ccc.de</code>, and fixed bugs, discussed features.</p>
<p>When introducing <a href="https://github.com/hannesm/jackline/commit/40bec5efba81061cc41df891cadd282120e16816">customisable colours</a>,
the proximity to a log viewer became again clear to me - configurable colours
are for severities such as <code>Success</code>, <code>Warning</code>, <code>Info</code>, <code>Error</code>, <code>Presence</code> -
maybe I really should get started on implementing a log viewer.</p>
<p>I would like to have more community contributions to jackline, but the lack of
documentation (there aren't even a lot of interface files), mixed with a
non-mainstream programming language, and a convoluted code base, makes me want
some code cleanups first, or maybe starting from scratch.</p>
<p>I'm interested in feedback, either via <a href="https://twitter.com/h4nnes">twitter</a> or
on the <a href="https://github.com/hannesm/jackline">jackline repository on GitHub</a>.</p>
</article></div></div></main></body></html>

77
Posts/Maintainers Normal file
View file

@ -0,0 +1,77 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Who maintains package X?</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="Who maintains package X?" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="post"><h2>Who maintains package X?</h2><span class="author">Written by hannes</span><br/><div class="tags">Classified under: <a href="/tags/package signing" class="tag">package signing</a><a href="/tags/security" class="tag">security</a></div><span class="date">Published: 2017-02-16 (last updated: 2017-03-09)</span><article><p>A very important data point for conex, the new opam signing utility, is who is authorised for a given package. We
could have written this manually down, or force each author to create a
pull request for their packages, but this would be a long process and not
easy: the main opam repository has around 1500 unique packages, and 350
contributors. Fortunately, it is a git repository with 5 years of history, and
over 6900 pull requests. Each opam file may also contain a <code>maintainers</code> entry,
a list of strings (usually a mail address).</p>
<p>The data sources we correlate are the <code>maintainers</code> entry in opam file, and who
actually committed in the opam repository. This is inspired by <a href="https://github.com/ocaml/opam/issues/2693">some GitHub
discussion</a>.</p>
<h3>GitHub id and email address</h3>
<p>For simplicity, since conex uses any (unique) identifier for authors, and the opam
repository is hosted on GitHub, we use a GitHub id as author identifier.
Maintainer information is an email address, thus we need a mapping between them.</p>
<p>We wrote a <a href="https://raw.githubusercontent.com/hannesm/conex/master/analysis/loop-prs.sh">shell
script</a>
to find all PR merges, their GitHub id (in a brittle way: using the name of the
git remote), and email address of the last commit. It also saves a diff of the
PR for later. This results in 6922 PRs (opam repository version 38d908dcbc58d07467fbc00698083fa4cbd94f9d).</p>
<p>The metadata output is processed by
<a href="https://github.com/hannesm/conex/blob/dbdfc5337c97d62edc74f1c546023bcb5e719343/analysis/maintainer.ml#L134-L156">github_mail</a>:
we ignore PRs from GitHub organisations <code>PR.ignore_github</code>, where commits
<code>PR.ignore_pr</code> are picked from a different author (manually), bad mail addresses,
and <a href="https://github.com/yallop">Jeremy's</a> mail address (it is added to too many GitHub ids otherwise). The
goal is to have a for an email address a single GitHub id. 329 authors with 416 mail addresses are mapped.</p>
<h3>Maintainer in opam</h3>
<p>As mentioned, lots of packages contain a <code>maintainers</code> entry. In
<a href="https://github.com/hannesm/conex/blob/dbdfc5337c97d62edc74f1c546023bcb5e719343/analysis/maintainer.ml#L40-L68"><code>maintainers</code></a>
we extract the mail addresses of the <a href="https://github.com/hannesm/conex/blob/dbdfc5337c97d62edc74f1c546023bcb5e719343/analysis/maintainer.ml#L70-L94">most recently released opam
file</a>.
Some hardcoded matches are teams which do not properly maintain the maintainers
field (such as mirage and xapi-project ;). We're open for suggestions to extend
this massaging to the needs. Additionally, the contact at ocamlpro mail address
was used for all packages before the maintainers entry was introduced (based on
a discussion with Louis Gesbert). 132 packages with empty maintainers.</p>
<h3>Fitness</h3>
<p>Combining these two data sources, we hoped to find a strict small set of whom to
authorise for which package. Turns out some people use different mail addresses
for git commits and opam maintainer entries, which <a href="https://github.com/hannesm/conex/blob/dbdfc5337c97d62edc74f1c546023bcb5e719343/analysis/maintainer.ml#L233-L269">are be easily
fixed</a>.</p>
<p>While <a href="https://github.com/hannesm/conex/blob/dbdfc5337c97d62edc74f1c546023bcb5e719343/analysis/maintainer.ml#L169-L205">processing the full diffs of each
PR</a>
(using the diff parser of conex mentioned above), ignoring the 44% done by
<a href="https://github.com/hannesm/conex/blob/dbdfc5337c97d62edc74f1c546023bcb5e719343/analysis/maintainer.ml#L158-L165">janitors</a>
(a manually created set by looking at log data, please report if wrong), we
categorise the modifications: authorised modification (the GitHub id is
authorised for the package), modification by an author to a team-owned package
(propose to add this author to the team), modification of a package where no
GitHub id is authorised, and unauthorised modification. We also ignore packages
which are no longer in the opam repository.</p>
<p>2766 modifications were authorised, 418 were team-owned, 452 were to packages
with no maintainer, and 570 unauthorised. This results in 125 unowned packages.</p>
<p>Out of the 452 modifications to packages with no maintainer, 75 are a global
one-to-one author to package relation, and are directly authorised.</p>
<p>Inference of team members is an overapproximation (everybody who committed
changes to their packages), additionally the janitors are missing. We will have
to fill these manually.</p>
<pre><code>alt-ergo -&gt; OCamlPro-Iguernlala UnixJunkie backtracking bobot nobrowser
janestreet -&gt; backtracking hannesm j0sh rgrinberg smondet
mirage -&gt; MagnusS dbuenzli djs55 hannesm hnrgrgr jonludlam mato mor1 pgj pqwy pw374 rdicosmo rgrinberg ruhatch sg2342 talex5 yomimono
ocsigen -&gt; balat benozol dbuenzli hhugo hnrgrgr jpdeplaix mfp pveber scjung slegrand45 smondet vasilisp
xapi-project -&gt; dbuenzli djs55 euanh mcclurmc rdicosmo simonjbeaumont yomimono
</code></pre>
<h3>Alternative approach: GitHub urls</h3>
<p>An alternative approach (attempted earlier) working only for GitHub hosted projects, is to authorise
<a href="https://github.com/hannesm/conex/blob/github/analysis/maintainer.ml#L37-L91">the use of the user part of the GitHub repository
URL</a>.
Results after filtering GitHub organisations are not yet satisfactory (but only
56 packages with no maintainer, <a href="https://github.com/hannesm/opam-repository/tree/github">output repo</a>. This approach
completely ignores the manually written maintainer field.</p>
<h3>Conclusion</h3>
<p>Manually maintained metadata is easily out of date, and not very useful. But
combining automatically created metadata with manually, and some manual tweaking
leads to reasonable data.</p>
<p>The resulting authorised inference is available <a href="https://github.com/hannesm/opam-repository/tree/auth">in this branch</a>.</p>
</article></div></div></main></body></html>

115
Posts/Monitoring Normal file
View file

@ -0,0 +1,115 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>All your metrics belong to influx</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="All your metrics belong to influx" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="post"><h2>All your metrics belong to influx</h2><span class="author">Written by hannes</span><br/><div class="tags">Classified under: <a href="/tags/mirageos" class="tag">mirageos</a><a href="/tags/monitoring" class="tag">monitoring</a><a href="/tags/deployment" class="tag">deployment</a></div><span class="date">Published: 2022-03-08 (last updated: 2022-03-08)</span><article><h1>Introduction to monitoring</h1>
<p>At <a href="https://robur.coop">robur</a> we use a range of MirageOS unikernels. Recently, we worked on improving the operations story thereof. One part is shipping binaries using our <a href="https://builds.robur.coop">reproducible builds infrastructure</a>. Another part is, once deployed we want to observe what is going on.</p>
<p>I first got into touch with monitoring - collecting and graphing metrics - with <a href="https://oss.oetiker.ch/mrtg/">MRTG</a> and <a href="https://munin-monitoring.org/">munin</a> - and the simple network management protocol <a href="https://en.wikipedia.org/wiki/Simple_Network_Management_Protocol">SNMP</a>. From the whole system perspective, I find it crucial that the monitoring part of a system does not add pressure. This favours a push-based design, where reporting is done at the disposition of the system.</p>
<p>The rise of monitoring where graphs are done dynamically (such as <a href="https://grafana.com/">Grafana</a>) and can be programmed (with a query language) by the operator are very neat, it allows to put metrics in relation after they have been recorded - thus if there's a thesis why something went berserk, you can graph the collected data from the past and prove or disprove the thesis.</p>
<h1>Monitoring a MirageOS unikernel</h1>
<p>From the operational perspective, taking security into account - either the data should be authenticated and integrity-protected, or being transmitted on a private network. We chose the latter, there's a private network interface only for monitoring. Access to that network is only granted to the unikernels and metrics collector.</p>
<p>For MirageOS unikernels, we use the <a href="https://github.com/mirage/metrics">metrics</a> library - which design shares the idea of <a href="https://erratique.ch/software/logs">logs</a> that only if there's a reporter registered, work is performed. We use the Influx line protocol via TCP to report via <a href="https://www.influxdata.com/time-series-platform/telegraf/">Telegraf</a> to <a href="https://www.influxdata.com/">InfluxDB</a>. But due to the design of <a href="https://github.com/mirage/metrics">metrics</a>, other reporters can be developed and used -- prometheus, SNMP, your-other-favourite are all possible.</p>
<p>Apart from monitoring metrics, we use the same network interface for logging via syslog. Since the logs library separates the log message generation (in the OCaml libraries) from the reporting, we developed <a href="https://github.com/hannesm/logs-syslog">logs-syslog</a>, which registers a log reporter sending each log message to a syslog sink.</p>
<p>We developed a small library for metrics reporting of a MirageOS unikernel into the <a href="https://github.com/roburio/monitoring-experiments">monitoring-experiments</a> package - which also allows to dynamically adjust log level and disable or enable metrics sources.</p>
<h2>Required components</h2>
<p>Install from your operating system the packages providing telegraf, influxdb, and grafana.</p>
<p>Setup telegraf to contain a socket listener:</p>
<pre><code>[[inputs.socket_listener]]
service_address = &quot;tcp://192.168.42.14:8094&quot;
keep_alive_period = &quot;5m&quot;
data_format = &quot;influx&quot;
</code></pre>
<p>Use a unikernel that reports to Influx (below the heading &quot;Unikernels (with metrics reported to Influx)&quot; on <a href="https://builds.robur.coop">builds.robur.coop</a>) and provide <code>--monitor=192.168.42.14</code> as boot parameter. Conventionally, these unikernels expect a second network interface (on the &quot;management&quot; bridge) where telegraf (and a syslog sink) are running. You'll need to pass <code>--net=management</code> and <code>--arg='--management-ipv4=192.168.42.x/24'</code> to albatross-client-local.</p>
<p>Albatross provides a <code>albatross-influx</code> daemon that reports information from the host system about the unikernels to influx. Start it with <code>--influx=192.168.42.14</code>.</p>
<h2>Adding monitoring to your unikernel</h2>
<p>If you want to extend your own unikernel with metrics, follow along these lines.</p>
<p>An example is the <a href="https://github.com/roburio/dns-primary-git">dns-primary-git</a> unikernel, where on the branch <code>future</code> we have a single commit ahead of main that adds monitoring. The difference is in the unikernel configuration and the main entry point. See the <a href="https://builds.robur.coop/job/dns-primary-git-monitoring/build/latest/">binary builts</a> in contrast to the <a href="https://builds.robur.coop/job/dns-primary-git/build/latest/">non-monitoring builts</a>.</p>
<p>In config, three new command line arguments are added: <code>--monitor=IP</code>, <code>--monitor-adjust=PORT</code> <code>--syslog=IP</code> and <code>--name=STRING</code>. In addition, the package <code>monitoring-experiments</code> is required. And a second network interface <code>management_stack</code> using the prefix <code>management</code> is required and passed to the unikernel. Since the syslog reporter requires a console (to report when logging fails), also a console is passed to the unikernel. Each reported metrics includes a tag <code>vm=&lt;name&gt;</code> that can be used to distinguish several unikernels reporting to the same InfluxDB.</p>
<p>Command line arguments:</p>
<pre><code class="language-patch"> let doc = Key.Arg.info ~doc:&quot;The fingerprint of the TLS certificate.&quot; [ &quot;tls-cert-fingerprint&quot; ] in
Key.(create &quot;tls_cert_fingerprint&quot; Arg.(opt (some string) None doc))
+let monitor =
+ let doc = Key.Arg.info ~doc:&quot;monitor host IP&quot; [&quot;monitor&quot;] in
+ Key.(create &quot;monitor&quot; Arg.(opt (some ip_address) None doc))
+
+let monitor_adjust =
+ let doc = Key.Arg.info ~doc:&quot;adjust monitoring (log level, ..)&quot; [&quot;monitor-adjust&quot;] in
+ Key.(create &quot;monitor_adjust&quot; Arg.(opt (some int) None doc))
+
+let syslog =
+ let doc = Key.Arg.info ~doc:&quot;syslog host IP&quot; [&quot;syslog&quot;] in
+ Key.(create &quot;syslog&quot; Arg.(opt (some ip_address) None doc))
+
+let name =
+ let doc = Key.Arg.info ~doc:&quot;Name of the unikernel&quot; [&quot;name&quot;] in
+ Key.(create &quot;name&quot; Arg.(opt string &quot;ns.nqsb.io&quot; doc))
+
let mimic_impl random stackv4v6 mclock pclock time =
let tcpv4v6 = tcpv4v6_of_stackv4v6 $ stackv4v6 in
let mhappy_eyeballs = mimic_happy_eyeballs $ random $ time $ mclock $ pclock $ stackv4v6 in
</code></pre>
<p>Requiring <code>monitoring-experiments</code>, registering command line arguments:</p>
<pre><code class="language-patch"> package ~min:&quot;3.7.0&quot; ~max:&quot;3.8.0&quot; &quot;git-mirage&quot;;
package ~min:&quot;3.7.0&quot; &quot;git-paf&quot;;
package ~min:&quot;0.0.8&quot; ~sublibs:[&quot;mirage&quot;] &quot;paf&quot;;
+ package &quot;monitoring-experiments&quot;;
+ package ~sublibs:[&quot;mirage&quot;] ~min:&quot;0.3.0&quot; &quot;logs-syslog&quot;;
] in
foreign
- ~keys:[Key.abstract remote_k ; Key.abstract axfr]
+ ~keys:[
+ Key.abstract remote_k ; Key.abstract axfr ;
+ Key.abstract name ; Key.abstract monitor ; Key.abstract monitor_adjust ; Key.abstract syslog
+ ]
~packages
</code></pre>
<p>Added console and a second network stack to <code>foreign</code>:</p>
<pre><code class="language-patch"> &quot;Unikernel.Main&quot;
- (random @-&gt; pclock @-&gt; mclock @-&gt; time @-&gt; stackv4v6 @-&gt; mimic @-&gt; job)
+ (console @-&gt; random @-&gt; pclock @-&gt; mclock @-&gt; time @-&gt; stackv4v6 @-&gt; mimic @-&gt; stackv4v6 @-&gt; job)
+
</code></pre>
<p>Passing a console implementation (<code>default_console</code>) and a second network stack (with <code>management</code> prefix) to <code>register</code>:</p>
<pre><code class="language-patch">+let management_stack = generic_stackv4v6 ~group:&quot;management&quot; (netif ~group:&quot;management&quot; &quot;management&quot;)
let () =
register &quot;primary-git&quot;
- [dns_handler $ default_random $ default_posix_clock $ default_monotonic_clock $
- default_time $ net $ mimic_impl]
+ [dns_handler $ default_console $ default_random $ default_posix_clock $ default_monotonic_clock $
+ default_time $ net $ mimic_impl $ management_stack]
</code></pre>
<p>Now, in the unikernel module the functor changes (console and second network stack added):</p>
<pre><code class="language-patch">@@ -4,17 +4,48 @@
open Lwt.Infix
-module Main (R : Mirage_random.S) (P : Mirage_clock.PCLOCK) (M : Mirage_clock.MCLOCK) (T : Mirage_time.S) (S : Mirage_stack.V4V6) (_ : sig e
nd) = struct
+module Main (C : Mirage_console.S) (R : Mirage_random.S) (P : Mirage_clock.PCLOCK) (M : Mirage_clock.MCLOCK) (T : Mirage_time.S) (S : Mirage
_stack.V4V6) (_ : sig end) (Management : Mirage_stack.V4V6) = struct
module Store = Irmin_mirage_git.Mem.KV(Irmin.Contents.String)
module Sync = Irmin.Sync(Store)
</code></pre>
<p>And in the <code>start</code> function, the command line arguments are processed and used to setup syslog and metrics monitoring to the specified addresses. Also, a TCP listener is waiting for monitoring and logging adjustments if <code>--monitor-adjust</code> was provided:</p>
<pre><code class="language-patch"> module D = Dns_server_mirage.Make(P)(M)(T)(S)
+ module Monitoring = Monitoring_experiments.Make(T)(Management)
+ module Syslog = Logs_syslog_mirage.Udp(C)(P)(Management)
- let start _rng _pclock _mclock _time s ctx =
+ let start c _rng _pclock _mclock _time s ctx management =
+ let hostname = Key_gen.name () in
+ (match Key_gen.syslog () with
+ | None -&gt; Logs.warn (fun m -&gt; m &quot;no syslog specified, dumping on stdout&quot;)
+ | Some ip -&gt; Logs.set_reporter (Syslog.create c management ip ~hostname ()));
+ (match Key_gen.monitor () with
+ | None -&gt; Logs.warn (fun m -&gt; m &quot;no monitor specified, not outputting statistics&quot;)
+ | Some ip -&gt; Monitoring.create ~hostname ?listen_port:(Key_gen.monitor_adjust ()) ip management);
connect_store ctx &gt;&gt;= fun (store, upstream) -&gt;
load_git None store upstream &gt;&gt;= function
| Error (`Msg msg) -&gt;
</code></pre>
<p>Once you compiled the unikernel (or downloaded a binary with monitoring), and start that unikernel by passing <code>--net:service=tap0</code> and <code>--net:management=tap10</code> (or whichever your <code>tap</code> interfaces are), and as unikernel arguments <code>--ipv4=&lt;my-ip-address&gt;</code> and <code>--management-ipv4=192.168.42.2/24</code> for IPv4 configuration, <code>--monitor=192.168.42.14</code>, <code>--syslog=192.168.42.10</code>, <code>--name=my.unikernel</code>, <code>--monitor-adjust=12345</code>.</p>
<p>With this, your unikernel will report metrics using the influx protocol to 192.168.42.14 on port 8094 (every 10 seconds), and syslog messages via UDP to 192.168.0.10 (port 514). You should see your InfluxDB getting filled and syslog server receiving messages.</p>
<p>When you configure <a href="https://grafana.com/docs/grafana/latest/getting-started/getting-started-influxdb/">Grafana to use InfluxDB</a>, you'll be able to see the data in the data sources.</p>
<p>Please reach out to us (at team AT robur DOT coop) if you have feedback and suggestions.</p>
</article></div></div></main></body></html>

67
Posts/NGI Normal file
View file

@ -0,0 +1,67 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>The road ahead for MirageOS in 2021</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="The road ahead for MirageOS in 2021" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="post"><h2>The road ahead for MirageOS in 2021</h2><span class="author">Written by hannes</span><br/><div class="tags">Classified under: <a href="/tags/mirageos" class="tag">mirageos</a></div><span class="date">Published: 2021-01-25 (last updated: 2021-11-19)</span><article><h2>Introduction</h2>
<p>2020 was an intense year. I hope you're healthy and keep being healthy. I am privileged (as lots of software engineers and academics are) to be able to work from home during the pandemic. Let's not forget people in less privileged situations, and lets try to give them as much practical, psychological and financial support as we can these days. And as much joy as possible to everyone around :)</p>
<p>I cancelled the autumn MirageOS retreat due to the pandemic. Instead I collected donations for our hosts in Marrakech - they were very happy to receive our financial support, since they had a difficult year, since their income is based on tourism. I hope that in autumn 2021 we'll have an on-site retreat again.</p>
<p>For 2021, we (at <a href="https://robur.coop">robur</a>) got a grant from the EU (via <a href="https://pointer.ngi.eu">NGI pointer</a>) for &quot;Deploying MirageOS&quot; (more details below), and another grant from <a href="https://ocaml-sf.org">OCaml software foundation</a> for securing the opam supply chain (using <a href="https://github.com/hannesm/conex">conex</a>). Some long-awaited releases for MirageOS libraries, namely a <a href="https://discuss.ocaml.org/t/ann-first-release-of-awa-ssh">ssh implementation</a> and a rewrite of our <a href="https://discuss.ocaml.org/t/ann-release-of-ocaml-git-v3-0-duff-encore-decompress-etc/">git implementation</a> have already been published.</p>
<p>With my MirageOS view, 2020 was a pretty successful year, where we managed to add more features, fixed lots of bugs, and paved the road ahead. I want to thank <a href="https://ocamllabs.io/">OCamlLabs</a> for funding work on MirageOS maintenance.</p>
<h2>Recap 2020</h2>
<p>Here is a very subjective random collection of accomplishments in 2020, where I was involved with some degree.</p>
<h3>NetHSM</h3>
<p><a href="https://www.nitrokey.com/products/nethsm">NetHSM</a> is a hardware security module in software. It is a product that uses MirageOS for security, and is based on the <a href="https://muen.sk">muen</a> separation kernel. We at <a href="https://robur.coop">robur</a> were heavily involved in this product. It already has been security audited by an external team. You can pre-order it from Nitrokey.</p>
<h3>TLS 1.3</h3>
<p>Dating back to 2016, at the <a href="https://www.ndss-symposium.org/ndss2016/tron-workshop-programme/">TRON</a> (TLS 1.3 Ready or NOt), we developed a first draft of a 1.3 implementation of <a href="https://github.com/mirleft/ocaml-tls">OCaml-TLS</a>. Finally in May 2020 we got our act together, including ECC (ECDH P256 from <a href="https://github.com/mit-plv/fiat-crypto/">fiat-crypto</a>, X25519 from <a href="https://project-everest.github.io/">hacl</a>) and testing with <a href="https://github.com/tlsfuzzer/tlsfuzzer">tlsfuzzer</a>, and release tls 0.12.0 with TLS 1.3 support. Later we added <a href="https://github.com/mirleft/ocaml-tls/pull/414">ECC ciphersuites to TLS version 1.2</a>, implemented <a href="https://github.com/mirleft/ocaml-tls/pull/414">ChaCha20/Poly1305</a>, and fixed an <a href="https://github.com/mirleft/ocaml-tls/pull/424">interoperability issue with Go's implementation</a>.</p>
<p><a href="https://github.com/mirage/mirage-crypto">Mirage-crypto</a> provides the underlying cryptographic primitives, initially released in March 2020 as a fork of <a href="https://github.com/mirleft/ocaml-nocrypto">nocrypto</a> -- huge thanks to <a href="https://github.com/pqwy">pqwy</a> for his great work. Mirage-crypto detects <a href="https://github.com/mirage/mirage-crypto/pull/53">CPU features at runtime</a> (thanks to <a href="https://github.com/Julow">Julow</a>) (<a href="https://github.com/mirage/mirage-crypto/pull/96">bugfix for bswap</a>), using constant time modular exponentation (powm_sec) and hardens against Lenstra's CRT attack, supports <a href="https://github.com/mirage/mirage-crypto/pull/39">compilation on Windows</a> (thanks to <a href="https://github.com/avsm">avsm</a>), <a href="https://github.com/mirage/mirage-crypto/pull/90">async entropy harvesting</a> (thanks to <a href="https://github.com/seliopou">seliopou</a>), <a href="https://github.com/mirage/mirage-crypto/pull/65">32 bit support</a>, <a href="https://github.com/mirage/mirage-crypto/pull/72">chacha20/poly1305</a> (thanks to <a href="https://github.com/abeaumont">abeaumont</a>), <a href="https://github.com/mirage/mirage-crypto/pull/84">cross-compilation</a> (thanks to <a href="https://github.com/EduardoRFS">EduardoRFS</a>) and <a href="https://github.com/mirage/mirage-crypto/pull/78">various</a> <a href="https://github.com/mirage/mirage-crypto/pull/81">bug</a> <a href="https://github.com/mirage/mirage-crypto/pull/83">fixes</a>, even <a href="https://github.com/mirage/mirage-crypto/pull/95">memory leak</a> (thanks to <a href="https://github.com/talex5">talex5</a> for reporting several of these issues), and <a href="https://github.com/mirage/mirage-crypto/pull/99">RSA</a> <a href="https://github.com/mirage/mirage-crypto/pull/100">interoperability</a> (thanks to <a href="https://github.com/psafont">psafont</a> for investigation and <a href="https://github.com/mattjbray">mattjbray</a> for reporting). This library feels very mature now - being used by multiple stakeholders, and lots of issues have been fixed in 2020.</p>
<h3>Qubes Firewall</h3>
<p>The <a href="https://github.com/mirage/qubes-mirage-firewall/">MirageOS based Qubes firewall</a> is the most widely used MirageOS unikernel. And it got major updates: in May <a href="https://github.com/linse">Steffi</a> <a href="https://groups.google.com/g/qubes-users/c/Xzplmkjwa5Y">announced</a> her and <a href="https://github.com/yomimono">Mindy's</a> work on improving it for Qubes 4.0 - including <a href="https://www.qubes-os.org/doc/vm-interface/#firewall-rules-in-4x">dynamic firewall rules via QubesDB</a>. Thanks to <a href="https://prototypefund.de/project/portable-firewall-fuer-qubesos/">prototypefund</a> for sponsoring.</p>
<p>In October 2020, we released <a href="https://mirage.io/blog/announcing-mirage-39-release">Mirage 3.9</a> with PVH virtualization mode (thanks to <a href="https://github.com/mato">mato</a>). There's still a <a href="https://github.com/mirage/qubes-mirage-firewall/issues/120">memory leak</a> to be investigated and fixed.</p>
<h3>IPv6</h3>
<p>In December, with <a href="https://mirage.io/blog/announcing-mirage-310-release">Mirage 3.10</a> we got the IPv6 code up and running. Now MirageOS unikernels have a dual stack available, besides IPv4-only and IPv6-only network stacks. Thanks to <a href="https://github.com/nojb">nojb</a> for the initial code and <a href="https://github.com/MagnusS">MagnusS</a>.</p>
<p>Turns out this blog, but also robur services, are now available via IPv6 :)</p>
<h3>Albatross</h3>
<p>Also in December, I pushed an initial release of <a href="https://github.com/roburio/albatross">albatross</a>, a unikernel orchestration system with remote access. <em>Deploy your unikernel via a TLS handshake -- the unikernel image is embedded in the TLS client certificates.</em></p>
<p>Thanks to <a href="https://github.com/reynir">reynir</a> for statistics support on Linux and improvements of the systemd service scripts. Also thanks to <a href="https://github.com/cfcs">cfcs</a> for the initial Linux port.</p>
<h3>CA certs</h3>
<p>For several years I postponed the problem of how to actually use the operating system trust anchors for OCaml-TLS connections. Thanks to <a href="https://github.com/emillon">emillon</a> for initial code, there are now <a href="https://github.com/mirage/ca-certs">ca-certs</a> and <a href="https://github.com/mirage/ca-certs-nss">ca-certs-nss</a> opam packages (see <a href="https://discuss.ocaml.org/t/ann-ca-certs-and-ca-certs-nss">release announcement</a>) which fills this gap.</p>
<h2>Unikernels</h2>
<p>I developed several useful unikernels in 2020, and also pushed <a href="https://mirage.io/wiki/gallery">a unikernel gallery</a> to the Mirage website:</p>
<h3>Traceroute in MirageOS</h3>
<p>I already wrote about <a href="/Posts/Traceroute">traceroute</a> which traces the routing to a given remote host.</p>
<h3>Unipi - static website hosting</h3>
<p><a href="https://github.com/roburio/unipi">Unipi</a> is a static site webserver which retrieves the content from a remote git repository. Let's encrypt certificate provisioning and dynamic updates via a webhook to be executed for every push.</p>
<h4>TLSTunnel - TLS demultiplexing</h4>
<p>The physical machine this blog and other robur infrastructure runs on has been relocated from Sweden to Germany mid-December. Thanks to UPS! Fewer IPv4 addresses are available in the new data center, which motivated me to develop <a href="https://github.com/roburio/tlstunnel">tlstunnel</a>.</p>
<p>The new behaviour is as follows (see the <code>monitoring</code> branch):</p>
<ul>
<li>listener on TCP port 80 which replies with a permanent redirect to <code>https</code>
</li>
<li>listener on TCP port 443 which forwards to a backend host if the requested server name is configured
</li>
<li>its configuration is stored on a block device, and can be dynamically changed (with a custom protocol authenticated with a HMAC)
</li>
<li>it is setup to hold a wildcard TLS certificate and in DNS a wildcard entry is pointing to it
</li>
<li>setting up a new service is very straightforward: only the new name needs to be registered with tlstunnel together with the TCP backend, and everything will just work
</li>
</ul>
<h2>2021</h2>
<p>The year started with a release of <a href="https://discuss.ocaml.org/t/ann-first-release-of-awa-ssh">awa</a>, a SSH implementation in OCaml (thanks to <a href="https://github.com/haesbaert">haesbaert</a> for initial code). This was followed by a <a href="https://discuss.ocaml.org/t/ann-release-of-ocaml-git-v3-0-duff-encore-decompress-etc/">git 3.0 release</a> (thanks to <a href="https://github.com/dinosaure">dinosaure</a>).</p>
<h3>Deploying MirageOS - NGI Pointer</h3>
<p>For 2021 we at robur received funding from the EU (via <a href="https://pointer.ngi.eu/">NGI pointer</a>) for &quot;Deploying MirageOS&quot;, which boils down into three parts:</p>
<ul>
<li>reproducible binary releases of MirageOS unikernels,
</li>
<li>monitoring (and other devops features: profiling) and integration into existing infrastructure,
</li>
<li>and further documentation and advertisement.
</li>
</ul>
<p>Of course this will all be available open source. Please get in touch via eMail (team aT robur dot coop) if you're eager to integrate MirageOS unikernels into your infrastructure.</p>
<p>We discovered at an initial meeting with an infrastructure provider that a DNS resolver is of interest - even more now that dnsmasq suffered from <a href="https://www.jsof-tech.com/wp-content/uploads/2021/01/DNSpooq_Technical-Whitepaper.pdf">dnspooq</a>. We are already working on an <a href="https://github.com/mirage/ocaml-dns/pull/251">implementation of DNSSec</a>.</p>
<p>MirageOS unikernels are binary reproducible, and <a href="https://github.com/rjbou/orb/pull/1">infrastructure tools are available</a>. We are working hard on a web interface (and REST API - think of it as &quot;Docker Hub for MirageOS unikernels&quot;), and more tooling to verify reproducibility.</p>
<h3>Conex - securing the supply chain</h3>
<p>Another funding from the <a href="http://ocaml-sf.org/">OCSF</a> is to continue development and deploy <a href="https://github.com/hannesm/conex">conex</a> - to bring trust into opam-repository. This is a great combination with the reproducible build efforts, and will bring much more trust into retrieving OCaml packages and using MirageOS unikernels.</p>
<h3>MirageOS 4.0</h3>
<p>Mirage so far still uses ocamlbuild and ocamlfind for compiling the virtual machine binary. But the switch to dune is <a href="https://github.com/mirage/mirage/issues/1195">close</a>, a lot of effort has been done. This will make the developer experience of MirageOS much more smooth, with a per-unikernel monorepo workflow where you can push your changes to the individual libraries.</p>
<h2>Footer</h2>
<p>If you want to support our work on MirageOS unikernels, please <a href="https://robur.coop/Donate">donate to robur</a>. I'm interested in feedback, either via <a href="https://twitter.com/h4nnes">twitter</a>, <a href="https://mastodon.social/@hannesm">hannesm@mastodon.social</a> or via eMail.</p>
</article></div></div></main></body></html>

121
Posts/OCaml Normal file
View file

@ -0,0 +1,121 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Why OCaml</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="Why OCaml" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="post"><h2>Why OCaml</h2><span class="author">Written by hannes</span><br/><div class="tags">Classified under: <a href="/tags/overview" class="tag">overview</a><a href="/tags/background" class="tag">background</a></div><span class="date">Published: 2016-04-17 (last updated: 2021-11-19)</span><article><h2>Programming</h2>
<p>For me, programming is fun. I enjoy doing it, every single second. All the way
from designing over experimenting to debugging why it does not do what I want.
In the end, the computer is dumb and executes only what you (or code from
someone else which you rely on) tell it to do.</p>
<p>To abstract from assembly code, which is not portable, programming languages were
developed. Different flavoured languages vary in
expressive power and static guarantees. Many claim to be general purpose or
systems languages; depending on the choices of
the language designer and tooling around the language, it is a language which lets you conveniently develop programs in.</p>
<p>A language designer decides on the builtin abstraction mechanisms, each of which
is both a burden and a blessing: it might be interfering (which to use? <code>for</code> or <code>while</code>, <code>trait</code> or <code>object</code>),
orthogonal (one way to do it), or even synergistic (higher order functions and anonymous functions). Another choice is whether the language includes a type
system, and if the developer can cheat on it (by allowing arbitrary type casts, a <em>weak</em> type system). A strong static type system
allows a developer to encode invariants, without the need to defer to runtime
assertions. Type systems differ in their expressive power (<a href="https://en.wikipedia.org/wiki/Dependent_type">dependent typing</a> are the hot research area at the moment). Tooling depends purely
on the community size, natural selection will prevail the useful tools
(community size gives inertia to other factors: demand for libraries, package manager, activity on stack overflow, etc.).</p>
<h2>Why OCaml?</h2>
<p>As already mentioned in <a href="/Posts/About">other</a>
<a href="/Posts/OperatingSystem">articles</a> here, it is a
combination of sufficiently large community, runtime stability and performance, modularity,
carefully thought out abstraction mechanisms, maturity (OCaml recently turned 20), and functional features.</p>
<p>The latter is squishy, I'll try to explain it a bit: you define your concrete
<em>data types</em> as <em>products</em> (<code>int * int</code>, a tuple of integers), <em>records</em> (<code>{ foo : int ; bar : int }</code> to name fields), sums (<code>type state = Initial | WaitingForKEX | Established</code>, or variants, or tagged union in C).
These are called <a href="https://en.wikipedia.org/wiki/Algebraic_data_type"><em>algebraic data types</em></a>. Whenever you have a
state machine, you can encode the state as a variant and use a
pattern match to handle the different cases. The compiler checks whether your pattern match is complete
(contains a line for each member of the variant). Another important aspect of
functional programming is that you can pass functions to other functions
(<em>higher-order functions</em>). Also, <em>recursion</em> is fundamental for functional
programming: a function calls itself -- combined with a variant type (such as
<code>type 'a list = Nil | Cons of 'a * 'a list</code>) it is trivial to show termination.</p>
<p><em>Side effects</em> make the program interesting, because they
communicate with other systems or humans. Side effects should be isolated and
explicitly stated (in the type!). Algorithm and protocol
implementations should not deal with side effects internally, but leave this to an
effectful layer on top of it. The internal pure functions
(which receive arguments and return values, no other way of communication) inside
preserve <a href="https://en.wikipedia.org/wiki/Referential_transparency_%28computer_science%29"><em>referential
transparency</em></a>.
Modularity helps to separate the concerns.</p>
<p>The holy grail is <a href="https://en.wikipedia.org/wiki/Declarative_programming">declarative programing</a>, write <em>what</em>
a program should achieve, not <em>how to</em> achieve it (like often done in an imperative language).</p>
<p>OCaml has a object and class system, which I do not use. OCaml also contains
exceptions (and annoyingly the standard library (e.g. <code>List.find</code>) is full of
them), which I avoid as well. Libraries should not expose any exception (apart from out of memory, a really exceptional situation). If your
code might end up in an error state (common for parsers which process input
from the network), return a variant type as value (<code>type ('a, 'b) result = Ok of 'a | Error of 'b</code>).
That way, the caller has to handle
both the success and failure case explicitly.</p>
<h2>Where to start?</h2>
<p>The <a href="https://ocaml.org">OCaml website</a> contains a <a href="https://ocaml.org/learn/tutorials/">variety of
tutorials</a> and examples, including
<a href="https://ocaml.org/learn/tutorials/get_up_and_running.html">introductionary
material</a> how to get
started with a new library. Editor integration (at least for emacs, vim, and
atom) is via <a href="https://github.com/the-lambda-church/merlin/wiki">merlin</a>
available.</p>
<p>A very good starting book is <a href="http://ocaml-book.com/">OCaml from the very
beginning</a> to learn the functional ideas in OCaml (also
its successor <a href="http://ocaml-book.com/more-ocaml-algorithms-methods-diversions/">More
OCaml</a>).
Another good book is <a href="https://realworldocaml.org">real world OCaml</a>, though it
is focussed around the &quot;core&quot; library (which I do not recommend due to its
huge size).</p>
<p>There are <a href="https://ocaml.org/learn/tutorials/guidelines.html">programming
guidelines</a>, best to re-read
on a regular schedule. Daniel wrote <a href="http://erratique.ch/software/rresult/doc/Rresult.html#usage">guidelines</a> how to handle with errors and results.</p>
<p><a href="https://opam.ocaml.org">Opam</a> is the OCaml package manager.
The <a href="https://opam.ocaml.org/packages/">opam repository</a> contains over 1000
libraries. The quality varies, I personally like the small libraries done by
<a href="http://erratique.ch/software">Daniel Bünzli</a>, as well as our
<a href="https://nqsb.io">nqsb</a> libraries (see <a href="https://github.com/mirleft">mirleft org</a>),
<a href="https://github.com/pqwy/notty">notty</a>.
A concise library (not much code),
including tests, documentation, etc. is
<a href="https://github.com/hannesm/ocaml-hkdf">hkdf</a>. For testing I currently prefer
<a href="https://github.com/mirage/alcotest">alcotest</a>. For cooperative tasks,
<a href="https://github.com/ocsigen/lwt">lwt</a> is decent (though it is a bit convoluted by
integrating too many features).</p>
<p>I try to stay away from big libraries such as ocamlnet, core, extlib, batteries.
When I develop a library I do not want to force anyone into using such large
code bases. Since opam is widely used, distributing libraries became easier,
thus the trend is towards small libraries (such as
<a href="http://erratique.ch/software/astring">astring</a>,
<a href="http://erratique.ch/software/ptime">ptime</a>,
<a href="https://github.com/abeaumont/ocaml-pbkdf">PBKDF</a>, <a href="https://github.com/abeaumont/ocaml-scrypt-kdf">scrypt</a>).</p>
<p>What is needed? This depends on your concrete goal. There are lots of
issues in lots of libraries, the MirageOS project also has a <a href="https://github.com/mirage/mirage-www/wiki/Pioneer-Projects">list of
Pioneer projects</a> which
would be useful to have. I personally would like to have a native <a href="https://tools.ietf.org/html/rfc4422">simple
authentication and security layer (SASL)</a>
implementation in OCaml soon (amongst other things, such as using an <a href="https://github.com/mirage/mirage/issues/489">ELF section for
data</a>,
<a href="https://github.com/mirage/mirage-platform/issues/118">strtod</a>).</p>
<p>A <a href="https://github.com/rudenoise/mirage-dashboard">dashboard</a> for MirageOS is
under development, which will hopefully ease tracking of what is being actively
developed within MirageOS. Because I'm impatient, I setup an <a href="https://github.com/miragebot.private.atom?token=ARh4hnusZ1kC_bQ_Q6_HUzQteEEGTqy8ks61Fm2LwA==">atom
feed</a>
which watches lots of MirageOS-related repositories.</p>
<p>I hope I gave some insight into OCaml, and why I currently enjoy it. A longer read on applicability of OCaml is our Usenix 2015 paper
<a href="https://nqsb.io/nqsbtls-usenix-security15.pdf">Not-quite-so-broken TLS: lessons in re-engineering a security protocol
specification and
implementation</a>. I'm interested in feedback, either via
<a href="https://twitter.com/h4nnes">twitter</a> or via eMail.</p>
<h2>Other updates in the MirageOS ecosystem</h2>
<ul>
<li>Canopy now sends out appropriate <a href="https://github.com/Engil/Canopy/pull/23">content type</a> HTTP headers
</li>
<li><a href="https://github.com/mirage/mirage-http/releases/tag/v2.5.2">mirage-http 2.5.2</a> was released to <a href="https://opam.ocaml.org/packages/mirage-http/mirage-http.2.5.2/">opam</a> which fixes the resource leak
</li>
<li>regression in <a href="https://github.com/mirage/mirage-net-xen/issues/39">mirage-net-xen 1.6.0</a>, I'm back on 1.4.1
</li>
<li>I stumbled upon <a href="https://github.com/mirage/mirage/issues/396">too large crunch for MirageOS</a>, no solution apart from using a FAT image (<a href="https://github.com/mirage/mirage/issues/489">putting the data into an ELF section</a> would solve the issue, if anyone is interested in MirageOS, that'd be a great project to start with)
</li>
<li>unrelated, <a href="https://opam.ocaml.org/packages/x509/x509.0.5.2/">X.509 0.5.2</a> fixes <a href="https://github.com/mirleft/ocaml-x509/commit/1a1476308d24bdcc49d45c4cd9ef539ca57461d2">this bug</a> in certificate chain construction
</li>
</ul>
</article></div></div></main></body></html>

32
Posts/OpamMirror Normal file
View file

@ -0,0 +1,32 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Mirroring the opam repository and all tarballs</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="Mirroring the opam repository and all tarballs" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="post"><h2>Mirroring the opam repository and all tarballs</h2><span class="author">Written by hannes</span><br/><div class="tags">Classified under: <a href="/tags/mirageos" class="tag">mirageos</a><a href="/tags/deployment" class="tag">deployment</a><a href="/tags/opam" class="tag">opam</a></div><span class="date">Published: 2022-09-29 (last updated: 2022-10-11)</span><article><p>We at <a href="https://robur.coop">robur</a> developed <a href="https://git.robur.io/robur/opam-mirror">opam-mirror</a> in the last month and run a public opam mirror at https://opam.robur.coop (updated hourly).</p>
<h1>What is opam and why should I care?</h1>
<p><a href="https://opam.ocaml.org">Opam</a> is the OCaml package manager (also used by other projects such as <a href="https://coq.inria.fr">coq</a>). It is a source based system: the so-called repository contains the metadata (url to source tarballs, build dependencies, author, homepage, development repository) of all packages. The main repository is hosted on GitHub as <a href="https://github.com/ocaml/opam-repository">ocaml/opam-repository</a>, where authors of OCaml software can contribute (as pull request) their latest releases.</p>
<p>When opening a pull request, automated systems attempt to build not only the newly released package on various platforms and OCaml versions, but also all reverse dependencies, and also with dependencies with the lowest allowed version numbers. That's crucial since neither semantic versioning has been adapted across the OCaml ecosystem (which is tricky, for example due to local opens any newly introduced binding will lead to a major version bump), neither do many people add upper bounds of dependencies when releasing a package (nobody is keen to state &quot;my package will not work with <a href="https://erratique.ch/software/cmdliner">cmdliner</a> in version 1.2.0&quot;).</p>
<p>So, the opam-repository holds the metadata of lots of OCaml packages (around 4000 at the moment this article was written) with lots of versions (in total 25000) that have been released. It is used by the opam client to figure out which packages to install or upgrade (using a solver that takes the version bounds into consideration).</p>
<p>Of course, opam can use other repositories (overlays) or forks thereof. So nothing stops you from using any other opam repository. The url to the source code of each package may be a tarball, or a git repository or other version control systems.</p>
<p>The vast majority of opam packages released to the opam-repository include a link to the source tarball and a cryptographic hash of the tarball. This is crucial for security (under the assumption the opam-repository has been downloaded from a trustworthy source - check back later this year for updates on <a href="/Posts/Conex">conex</a>). At the moment, there are some weak spots in respect to security: md5 is still allowed, and the hash and the tarball are downloaded from the same server: anyone who is in control of that server can inject arbitrary malicious data. As outlined above, we're working on infrastructure which fixes the latter issue.</p>
<h1>How does the opam client work?</h1>
<p>Opam, after initialisation, downloads the <code>index.tar.gz</code> from <code>https://opam.ocaml.org/index.tar.gz</code>, and uses this as the local opam universe. An <code>opam install cmdliner</code> will resolve the dependencies, and download all required tarballs. The download is first tried from the cache, and if that failed, the URL in the package file is used. The download from the cache uses the base url, appends the archive-mirror, followed by the hash algorithm, the first two characters of the has of the tarball, and the hex encoded hash of the archive, i.e. for cmdliner 1.1.1 which specifies its sha512: <code>https://opam.ocaml.org/cache/sha512/54/5478ad833da254b5587b3746e3a8493e66e867a081ac0f653a901cc8a7d944f66e4387592215ce25d939be76f281c4785702f54d4a74b1700bc8838a62255c9e</code>.</p>
<h1>How does the opam repository work?</h1>
<p>According to DNS, opam.ocaml.org is a machine at amazon. It likely, apart from the website, uses <code>opam admin index</code> periodically to create the index tarball and the cache. There's an observable delay between a package merge in the opam-repository and when it shows up at opam.ocaml.org. Recently, there was <a href="https://discuss.ocaml.org/t/opam-ocaml-org-is-currently-down-is-that-where-indices-are-kept-still/">a reported downtime</a>.</p>
<p>Apart from being a single point of failure, if you're compiling a lot of opam projects (e.g. a continuous integration / continuous build system), it makes sense from a network usage (and thus sustainability perspective) to move the cache closer to where you need the source archives. We're also organising the MirageOS <a href="http://retreat.mirage.io">hack retreats</a> in a northern African country with poor connectivity - so if you gather two dozen camels you better bring your opam repository cache with you to reduce the bandwidth usage (NB: this requires at the moment cooperation of all participants to configure their default opam repository accordingly).</p>
<h1>Re-developing &quot;opam admin create&quot; as MirageOS unikernel</h1>
<p>The need for a local opam cache at our <a href="https://builds.robur.coop">reproducible build infrastructure</a> and the retreats, we decided to develop <a href="https://git.robur.io/robur/opam-mirror">opam-mirror</a> as a <a href="https://mirage.io">MirageOS unikernel</a>. Apart from a useful showcase using persistent storage (that won't fit into memory), and having fun while developing it, our aim was to reduce our time spent on system administration (the <code>opam admin index</code> is only one part of the story, it needs a Unix system and a webserver next to it - plus remote access for doing software updates - which has quite some attack surface.</p>
<p>Another reason for re-developing the functionality was that the opam code (what opam admin index actually does) is part of the opam source code, which totals to 50_000 lines of code -- looking up whether one or all checksums are verified before adding the tarball to the cache, was rather tricky.</p>
<p>In earlier years, we avoided persistent storage and block devices in MirageOS (by embedding it into the source code with <a href="https://github.com/mirage/ocaml-crunch">crunch</a>, or using a remote git repository), but recent development, e.g. of <a href="https://somerandomidiot.com/blog/2022/03/04/chamelon/">chamelon</a> sparked some interest in actually using file systems and figuring out whether MirageOS is ready in that area. A month ago we started the opam-mirror project.</p>
<p>Opam-mirror takes a remote repository URL, and downloads all referenced archives. It serves as a cache and opam-repository - and does periodic updates from the remote repository. The idea is to validate all available checksums and store the tarballs only once, and store overlays (as maps) from the other hash algorithms.</p>
<h1>Code development and improvements</h1>
<p>Initially, our plan was to use <a href="https://github.com/mirage/ocaml-git">ocaml-git</a> for pulling the repository, <a href="https://github.com/yomimono/chamelon">chamelon</a> for persistent storage, and <a href="https://github.com/inhabitedtype/httpaf">httpaf</a> as web server. With <a href="https://github.com/mirage/ocaml-tar">ocaml-tar</a> recent support of <a href="https://github.com/mirage/ocaml-tar/pull/88">gzip</a> we should be all set, and done within a few days.</p>
<p>There is already a gap in the above plan: which http client to use - in the best case something similar to our <a href="https://github.com/roburio/http-lwt-client">http-lwt-client</a> - in MirageOS: it should support HTTP 1.1 and HTTP 2, TLS (with certificate validation), and using <a href="https://github.com/roburio/happy-eyeballs">happy-eyeballs</a> to seemlessly support both IPv6 and legacy IPv4. Of course it should follow redirect, without that we won't get far in the current Internet.</p>
<p>On the path (over the last month), we fixed file descriptor leaks (memory leaks) in <a href="https://github.com/dinosaure/paf-le-chien">paf</a> -- which is used as a runtime for httpaf and h2.</p>
<p>Then we ran into some trouble with chamelon (<a href="https://github.com/yomimono/chamelon/issues/11">out of memory</a>, some degraded peformance, it reporting out of disk space), and re-thought our demands for opam-mirror. Since the cache is only ever growing (new packages are released), there's no need to ever remove anything: it is append-only. Once we figured that out, we investigated what needs to be done in ocaml-tar (where tar is in fact a tape archive, and was initially designed as file format to be appended to) to support appending to an archive.</p>
<p>We also re-thought our bandwidth usage, and instead of cloning the git remote at startup, we developed <a href="https://git.robur.io/robur/git-kv">git-kv</a> which can dump and restore the git state.</p>
<p>Also, initially we computed all hashes of all tarballs, but with the size increasing (all archives are around 7.5GB) this lead to a major issue of startup time (around 5 minutes on a laptop), so we wanted to save and restore the maps as well.</p>
<p>Since neither git state nor the maps are suitable for tar's append-only semantics, and we didn't want to investigate yet another file system - such as <a href="https://github.com/mirage/ocaml-fat">fat</a> may just work fine, but the code looks slightly bitrot, and the reported issues and non-activity doesn't make this package very trustworthy from our point of view. Instead, we developed <a href="https://github.com/reynir/mirage-block-partition">mirage-block-partition</a> to partition a block device into two. Then we just store the maps and the git state at the end - the end of a tar archive is 2 blocks of zeroes, so stuff at the far end aren't considered by any tooling. Extending the tar archive is also possible, only the maps and git state needs to be moved to the end (or recomputed). As file system, we developed <a href="https://git.robur.io/reynir/oneffs">oneffs</a> which stores a single value on the block device.</p>
<p>We observed a high memory usage, since each requested archive was first read from the block device into memory, and then sent out. Thanks to Pierre Alains <a href="https://github.com/mirage/mirage-kv/pull/28">recent enhancements</a> of the mirage-kv API, there is a <code>get_partial</code>, that we use to chunk-wise read the archive and send it via HTTP. Now, the memory usage is around 20MB (the git repository and the generated tarball are kept in memory).</p>
<p>What is next? Downloading and writing to the tar archive could be done chunk-wise as well; also dumping and restoring the git state is quite CPU intensive, we would like to improve that. Adding the TLS frontend (currently done on our site by our TLS termination proxy <a href="https://github.com/roburio/tlstunnel">tlstunnel</a>) similar to how <a href="https://github.com/roburio/unipi">unipi</a> does it, including let's encrypt provisioning -- should be straightforward (drop us a note if you'd be interesting in that feature).</p>
<h1>Conclusion</h1>
<p>To conclude, we managed within a month to develop this opam-mirror cache from scratch. It has a reasonable footprint (CPU and memory-wise), is easy to maintain and easy to update - if you want to use it, we also provide <a href="https://builds.robur.coop/job/opam-mirror">reproducible binaries</a> for solo5-hvt. You can use our opam mirror with <code>opam repository set-url default https://opam.robur.coop</code> (revert to the other with <code>opam repository set-url default https://opam.ocaml.org</code>) or use it as a backup with <code>opam repository add robur --rank 2 https://opam.robur.coop</code>.</p>
<p>Please reach out to us (at team AT robur DOT coop) if you have feedback and suggestions. We are a non-profit company, and rely on <a href="https://robur.coop/Donate">donations</a> for doing our work - everyone can contribute.</p>
</article></div></div></main></body></html>

161
Posts/OperatingSystem Normal file
View file

@ -0,0 +1,161 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Operating systems</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="Operating systems" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="post"><h2>Operating systems</h2><span class="author">Written by hannes</span><br/><div class="tags">Classified under: <a href="/tags/overview" class="tag">overview</a><a href="/tags/operating system" class="tag">operating system</a><a href="/tags/mirageos" class="tag">mirageos</a></div><span class="date">Published: 2016-04-09 (last updated: 2021-11-19)</span><article><p>Sorry to be late with this entry, but I had to fix some issues.</p>
<h2>What is an operating system?</h2>
<p>Wikipedia says: &quot;An operating system (OS) is system software that manages
computer hardware and software resources and provides common services for
computer programs.&quot; Great. In other terms, it is an abstraction layer.
Applications don't need to deal with the low-level bits (device drivers) of the
computer.</p>
<p>But if we look at the landscape of deployed operating systems, there is a lot
more going on than abstracting devices: usually this includes process management (scheduler),
memory management (virtual memory), <a href="https://en.wikipedia.org/wiki/C_standard_library">C
library</a>, user management
(including access control), persistent storage (file system), network stack,
etc. all being part of the kernel, and executed in kernel space. A
counterexample is <a href="http://www.minix3.org/">Minix</a>, which consists of a tiny
microkernel, and executes the above mentioned services as user-space processes.</p>
<p>We are (or at least I am) interested in robust systems. Development is done
by humans, thus will always be error-prone. Even a proof of its functional
correctness can be flawed if the proof system is inconsistent or the
specification is wrong. We need to have damage control in place by striving
for the <a href="https://en.wikipedia.org/wiki/Principle_of_least_privilege">principle of least authority</a>.
The goods to guard is the user data (passwords, personal information, private
mails, ...), which lives in memory.</p>
<p>A CPU contains <a href="https://en.wikipedia.org/wiki/Protection_ring">protection rings</a>,
where the kernel runs in ring 0 and thus has full access to the hardware,
including memory. A flaw in the kernel is devastating for the security of the
entire system, it is part of the <a href="https://en.wikipedia.org/wiki/Trusted_computing_base">trusted computing base</a>).
Every byte of kernel code should be carefully developed and audited. If we
can contain code into areas with less authority, we should do so. Obviously,
the mechanism to contain code needs to be carefully audited as well, since
it will likely need to run in privileged mode.</p>
<p>In a virtualised world, we run a
<a href="https://en.wikipedia.org/wiki/Hypervisor">hypervisor</a> in ring -1, on top of
which we run an operating system kernel. The hypervisor gives access to memory
and hardware to virtual machines, schedules those virtual machines on
processors, and should isolate the virtual machines from each other (by using
the MMU).</p>
<p><img src="https://fsfe.org/contribute/promopics/thereisnocloud-v2-preview.png" alt="there's no cloud, just other people's computers" /></p>
<p>This ominous &quot;cloud&quot; uses hypervisors on huge amount of physical machines, and
executes off-the-shelf operating systems as virtual machines on top. Accounting
is done by resource usage (time, bandwidth, storage).</p>
<h2>From scratch</h2>
<p>Ok, now we have hypervisors which already deals with memory and scheduling. Why
should we have the very same functionality again in the (general purpose) operating
system running as virtual machine?</p>
<p>Additionally, earlier in my life (back in 2005 at the Dutch hacker camp &quot;What
the hack&quot;) I proposed (together with Andreas Bogk) to <a href="https://berlin.ccc.de/~hannes/wth.pdf">phase out UNIX before
2038-01-19</a> (this is when <code>time_t</code>
overflows, unless promoted to 64 bit), and replace it with Dylan. A <a href="http://www.citizen428.net/blog/2005/08/03/what-the-hack-recap/">random
comment</a> about
our talk on the Internet is &quot;the proposal that rewriting an entire OS in a
language with obscure syntax was somewhat original. However, I now somewhat feel
a strange urge to spend some time on Dylan, which is really weird...&quot;</p>
<p>Being without funding back then, we didn't get far (hugest success was a
<a href="https://github.com/dylan-hackers/network-night-vision/">TCP/IP</a> stack in
Dylan), and as mentioned earlier I went into formal methods and mechanised
proofs of full functional correctness properties.</p>
<h3>MirageOS</h3>
<p>At the end of 2013, David pointed me to
<a href="https://mirage.io">MirageOS</a>, an operating system developed from scratch in the
functional and statically typed language <a href="https://ocaml.org">OCaml</a>. I've not
used much OCaml before, but some other functional programming languages.
Since then, I spend nearly every day on developing OCaml libraries (with varying success on being happy
with my code). In contrast to Dylan, there are more than two people developing MirageOS.</p>
<p>The idea is straightforward: use a hypervisor, and its hardware
abstractions (virtualised input/output and network device), and execute the
OCaml runtime directly on it. No C library included (since May 2015, see <a href="http://lists.xenproject.org/archives/html/mirageos-devel/2014-05/msg00070.html">this
thread</a>).
The virtual machine, based on the OCaml runtime and composed of OCaml libraries,
uses a single address space and runs in ring 0.</p>
<p>As mentioned above, all code which runs in ring 0 needs to be carefully
developed and checked since a flaw in it can jeopardise the security properties
of the entire system: the TCP/IP library should not have access to the private
key used for the TLS handshake. If we trust the OCaml runtime, especially its
memory management, there is no way for the TCP/IP library to access the memory
of the TLS subsystem: the TLS API does not expose the private key via an API
call, and being in a memory safe language, a library cannot read arbitrary
memory. There is no real need to isolate each library into a separate address
spaces. In my opinion, using capabilities for memory access would be a great
improvement, similar to <a href="http://www.barrelfish.org">barrelfish</a>. OCaml has a C
foreign function call interface which can be used to read arbitrary memory --
you have to take care that all C bits of the system are not malicious (it is
fortunately difficult to embed C code into MirageOS, thus only few bits written
in C are in MirageOS (such as (loop and allocation free) <a href="https://github.com/mirleft/ocaml-nocrypto/tree/f076d4e75c56054d79b876e00b6bded06d90df86/src/native">crypto
primitives</a>).
To further read up on the topic, there is a <a href="https://matildah.github.io/posts/2016-01-30-unikernel-security.html">nice article about the
security</a>.</p>
<p>This website is 12MB in size (and I didn't even bother to strip yet), which
includes the static CSS and JavaScript (bootstrap, jquery, fonts), <a href="https://github.com/mirage/ocaml-cohttp">HTTP</a>, <a href="https://github.com/mirleft/ocaml-tls">TLS</a> (also <a href="https://github.com/mirleft/ocaml-x509">X.509</a>, <a href="https://github.com/mirleft/ocaml-asn1-combinators">ASN.1</a>, <a href="https://github.com/mirleft/ocaml-nocrypto">crypto</a>), <a href="https://github.com/mirage/ocaml-git/">git</a> (and <a href="https://github.com/mirage/irmin">irmin</a>), <a href="https://github.com/mirage/mirage-tcpip">TCP/IP</a> libraries.
The memory management in MirageOS is
straightforward: the hypervisor provides the OCaml runtime with a chunk of memory, which
immediately takes all of it.</p>
<p>This is much simpler to configure and deploy than a UNIX operating system:
There is no virtual memory, no process management, no file
system (the markdown content is held in memory with irmin!), no user management in the image.</p>
<p>At compile (configuration) time, the TLS keys are baked into the image, in addition to the url of the remote
git repository, the IPv4 address and ports the image should use:
The full command line for configuring this website is: <code>mirage configure --no-opam --xen -i Posts -n &quot;full stack engineer&quot; -r git://git.robur.io/hannes/hannes.robur.coop.git --dhcp false --network 0 --ip 198.167.222.205 --netmask 255.255.255.0 --gateways 198.167.222.1 --tls 443 --port 80</code>.
It relies on the fact that the TLS certificate chain and private key are in the <code>tls/</code> subdirectory, which is transformed to code and included in the image (using <a href="https://github.com/mirage/ocaml-crunch">crunch</a>). An improvement would be to <a href="https://github.com/mirage/mirage/issues/489">use an ELF section</a>, but there is no code yet.
After configuring and installing the required dependencies, a <code>make</code> builds the statically linked image.</p>
<p>Deployment is done via <code>xl create canopy.xl</code>. The file <code>canopy.xl</code> is automatically generated by <code>mirage --configure</code> (but might need modifications). It contains the full path to the image, the name of the bridge
interface, and how much memory the image can use:</p>
<pre><code>name = 'canopy'
kernel = 'mir-canopy.xen'
builder = 'linux'
memory = 256
on_crash = 'preserve'
vif = [ 'bridge=br0' ]
</code></pre>
<p>To rephrase: instead of running on a multi-purpose operating system including processes, file system, etc., this website uses a
set of libraries, which are compiled and statically
linked into the virtual machine image.</p>
<p>MirageOS uses the module system of OCaml to define how interfaces should be, thus an
application developer does not need to care whether they are using the TCP/IP
stack written in OCaml, or the sockets API of a UNIX operating system. This
also allows to compile and debug your library on UNIX using off-the-shelf tools
before deploying it as a virtual machine (NB: this is a lie, since there is code
which is only executed when running on Xen, and this code can be buggy) ;).</p>
<p>Most of the MirageOS ecosystem is developed under MIT/ISC/BSD license, which
allows everybody to use it for whichever project they want.</p>
<p>Did I mention that by using less code the attack vector shrinks? In
addition to that, using a memory safe programming language, where the developer
does not need to care about memory management and bounds checks, immediately removes
several classes of security problems (namely spatial and temporal memory
issues), once the runtime is trusted.
The OCaml runtime was reviewed by the French <a href="http://www.ssi.gouv.fr/agence/publication/lafosec-securite-et-langages-fonctionnels/">Agence nationale de la sécurité des systèmes dinformation</a> in 2013,
leading to some changes, such as separation of immutable strings (<code>String</code>) from mutable byte vectors (<code>Bytes</code>).</p>
<p>The attack surface is still big enough: logical issues, resource management, and there is no access
control. This website does not need access control, publishing of content is protected by relying on GitHub's
access control.</p>
<p>I hope I gave some insight into what the purpose of an operating systems is, and
how MirageOS fits into the picture. I'm interested in feedback, either via
<a href="https://twitter.com/h4nnes">twitter</a> or via eMail.</p>
<h2>Other updates in the MirageOS ecosystem</h2>
<ul>
<li>this website is based on <a href="https://github.com/Engil/Canopy">Canopy</a>, the content is stored as markdown in a <a href="https://git.robur.io/hannes/hannes.robur.coop">git repository</a>
</li>
<li>it was running in a <a href="https://FreeBSD.org">FreeBSD</a> jail, but when I compiled too much the underlying <a href="https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/zfs.html">zfs file system</a> wasn't happy (and is now hanging in kernel space in a read)
</li>
<li>no remote power switch (borrowed to a friend 3 weeks ago), nobody was willing to go to the data centre and reboot
</li>
<li>I wanted to move it anyways to a host where I can deploy <a href="http://www.xenproject.org/">Xen</a> guest VMs
</li>
<li>turns out the Xen compilation and deployment mode needed some love:
<ul>
<li>I ported a newer <a href="https://github.com/hannesm/bin_prot/tree/113.33.00+xen">bin_prot</a> to xen
</li>
<li>I wrote a clean patch to <a href="https://github.com/Engil/Canopy/pull/15">serve via TLS</a> (including <a href="https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security">HSTS header</a> and redirecting HTTP (moved permanently) to HTTPS)
</li>
<li>I found a memory leak in the <a href="https://github.com/mirage/mirage-http/pull/23">mirage-http</a> library
</li>
</ul>
</li>
<li>I was travelling
</li>
<li>good news: it now works on Xen, and there is <a href="https://hannes.nqsb.io/atom">an atom feed</a>
</li>
<li>life of an &quot;eat your own dogfood&quot; full stack engineer ;)
</li>
</ul>
</article></div></div></main></body></html>

45
Posts/Pinata Normal file
View file

@ -0,0 +1,45 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>The Bitcoin Piñata - no candy for you</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="The Bitcoin Piñata - no candy for you" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="post"><h2>The Bitcoin Piñata - no candy for you</h2><span class="author">Written by hannes</span><br/><div class="tags">Classified under: <a href="/tags/mirageos" class="tag">mirageos</a><a href="/tags/security" class="tag">security</a><a href="/tags/bitcoin" class="tag">bitcoin</a></div><span class="date">Published: 2018-04-18 (last updated: 2021-11-19)</span><article><h2>History</h2>
<p>On February 10th 2015 David Kaloper-Meršinjak and Hannes Mehnert
<a href="https://mirage.io/announcing-bitcoin-pinata">launched</a> (read also <a href="http://amirchaudhry.com/bitcoin-pinata">Amir's
description</a>) our <a href="https://en.wikipedia.org/wiki/Bug_bounty_program">bug bounty
program</a> in the form of our
<a href="http://ownme.ipredator.se">Bitcoin Piñata</a> MirageOS unikernel. Thanks again to
<a href="https://ipredator.se">IPredator</a> for both hosting our services and lending us
the 10 Bitcoins! We <a href="https://mirage.io/blog/bitcoin-pinata-results">analysed</a> a
bit more in depth after running it for five months. Mindy recently wrote about
<a href="https://somerandomidiot.com/blog/2018/04/17/whacking-the-bitcoin-pinata/">whacking the Bitcoin
Piñata</a>.</p>
<p>On March 18th 2018, after more than three years, IPredator, the lender of the Bitcoins, repurposed the 10 Bitcoins for other projects. Initially, we thought that the Piñata would maybe run for a month or two, but IPredator, David, and I decided to keep it running. The update of the Piñata's bounty is a good opportunity to reflect on the project.</p>
<p>The 10 Bitcoin in the Piñata were fluctuating in price over time, at peak worth 165000€.</p>
<p>From the start of the Piñata project, we published the <a href="https://github.com/mirleft/btc-pinata">source code</a>, the virtual machine image, and the versions of the used libraries in a git repository. Everybody could develop their exploits locally before launching them against our Piñata. The Piñata provides TLS endpoints, which require private keys and certificates. These are generated by the Piñata at startup, and the secret for the Bitcoin wallet is provided as a command line argument.</p>
<p>Initially the Piñata was deployed on a Linux/Xen machine, later it was migrated to a FreeBSD host using BHyve and VirtIO with <a href="https://github.com/solo5/solo5">solo5</a>, and in December 2017 it was migrated to native BHyve (<a href="/Posts/Solo5">using <code>ukvm-bin</code> and solo5</a>). We also changed the Piñata code to accomodate for updates, such as the <a href="https://mirage.io/blog/announcing-mirage-30-release">MirageOS 3.0 release</a>, and the discontinuation of floating point numbers for timestamps (asn1-combinators 0.2.0, x509 0.6.0, tls 0.9.0).</p>
<h2>Motivation</h2>
<p>We built the Piñata for many purposes: to attract security professionals to evaluate our <a href="https://mirage.io/blog/introducing-ocaml-tls">from-scratch developed TLS stack</a>, to gather empirical data for our <a href="https://usenix15.nqsb.io">Usenix Security 15 paper</a>, and as an improvement to current bug bounty programs.</p>
<p>Most bug bounty programs require communication via forms and long wait times for
human experts to evaluate the potential bug. This evaluation is subjective,
intransparent, and often requires signing of non-disclosure agreements (NDA),
even before the evaluation starts.</p>
<p>Our Piñata <em>automates</em> these parts, getting rid of wait times and NDAs. To get
the private wallet key that holds the bounty, you need to successfully establish
an authenticated TLS session or find a flaw elsewhere in the stack, which allows
to read arbitrary memory. Everyone can track transactions of the blockchain and
see if the wallet still contains the bounty.</p>
<p>Of course, the Piñata can't prove that our stack is secure, and it can't prove
that the access to the wallet is actually inside. But trust us, it is!</p>
<h2>Observations</h2>
<p>I still remember vividly the first nights in February 2015, being so nervous that I woke up every two hours and checked the blockchain. Did the Piñata still have the Bitcoins? I was familiar with the code of the Piñata and was afraid there might be a bug which allows to bypass authentication or leak the private key. So far, this doesn't seem to be the case.</p>
<p>In April 2016 we stumbled upon an <a href="/Posts/BadRecordMac">information disclosure in the virtual network
device driver for Xen in MirageOS</a>. Given enough
bandwidth, this could have been used to access the private wallet key. We
upgraded the Piñata and released the <a href="https://mirage.io/blog/MSA00">MirageOS Security Advisory
00</a>.</p>
<p>We analysed the Piñata's access logs to the and bucketed them into website traffic and bounty connections. We are still wondering what happened in July 2015 and July 2017 where the graph shows spikes. Could it be a presentation mentioning the Piñata, or a new automated tool which tests for TLS vulnerabilities, or an increase in market price for Bitcoins?</p>
<p><img src="/static/img/pinata_access_20180403.png" alt="Piñata access" /> <img src="/static/img/pinata_access_cumulative_20180403.png" alt="Piñata access cumulative" /></p>
<p>The cumulative graph shows that more than 500,000 accesses to the Piñata website, and more than 150,000 attempts at connecting to the Piñata bounty.</p>
<p>You can short-circuit the client and server Piñata endpoint and observe the private wallet key being transferred on your computer, TLS encrypted with the secret exchanged by client and server, using <code>socat -x TCP:ownme.ipredator.se:10000 TCP:ownme.ipredator.se:10002</code>.</p>
<p>If you attempted to exploit the Piñata, please let us know what you tried! Via
<strike><a href="https://twitter.com/h4nnes">twitter</a></strike>
<a href="http://mastodon.social/@hannesm">hannesm@mastodon.social</a> or via eMail.</p>
<p>Since <a href="/Posts/DNS">the start of 2018</a> we are developing robust software and systems at <a href="http://robur.io">robur</a>. If you like our work and want to support us with donations or development contracts, please get in touch with <code>team@robur.io</code>. Robur is a project of the German non-profit <a href="https://techcultivation.org">Center for the cultivation of technology</a>. Donations to robur are tax-deductible in Europe.</p>
</article></div></div></main></body></html>

43
Posts/ReproducibleOPAM Normal file
View file

@ -0,0 +1,43 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Reproducible MirageOS unikernel builds</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="Reproducible MirageOS unikernel builds" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="post"><h2>Reproducible MirageOS unikernel builds</h2><span class="author">Written by hannes</span><br/><div class="tags">Classified under: <a href="/tags/mirageos" class="tag">mirageos</a><a href="/tags/security" class="tag">security</a><a href="/tags/package signing" class="tag">package signing</a></div><span class="date">Published: 2019-12-16 (last updated: 2021-11-19)</span><article><h2>Reproducible builds summit</h2>
<p>I'm just back from the <a href="https://reproducible-builds.org/events/Marrakesh2019/">Reproducible builds summit 2019</a>. In 2018, several people developing <a href="https://ocaml.org">OCaml</a> and <a href="https://opam.ocaml.org">opam</a> and <a href="https://mirage.io">MirageOS</a>, attended <a href="https://reproducible-builds.org/events/paris2018/">the Reproducible builds summit in Paris</a>. The notes from last year on <a href="https://reproducible-builds.org/events/paris2018/report/#Toc11410_331763073">opam reproducibility</a> and <a href="https://reproducible-builds.org/events/paris2018/report/#Toc11681_331763073">MirageOS reproducibility</a> are online. After last years workshop, Raja started developing the opam reproducibilty builder <a href="https://github.com/rjbou/orb">orb</a>, which I extended at and after this years summit. This year before and after the facilitated summit there were hacking days, which allowed further interaction with participants, writing some code and conduct experiments. I had this year again an exciting time at the summit and hacking days, thanks to our hosts, organisers, and all participants.</p>
<h2>Goal</h2>
<p>Stepping back a bit, first look on the <a href="https://reproducible-builds.org/">goal of reproducible builds</a>: when compiling source code multiple times, the produced binaries should be identical. It should be sufficient if the binaries are behaviourally equal, but this is pretty hard to check. It is much easier to check <strong>bit-wise identity of binaries</strong>, and relaxes the burden on the checker -- checking for reproducibility is reduced to computing the hash of the binaries. Let's stick to the bit-wise identical binary definition, which also means software developers have to avoid non-determinism during compilation in their toolchains, dependent libraries, and developed code.</p>
<p>A <a href="https://reproducible-builds.org/docs/test-bench/">checklist</a> of potential things leading to non-determinism has been written up by the reproducible builds project. Examples include recording the build timestamp into the binary, ordering of code and embedded data. The reproducible builds project also developed <a href="https://packages.debian.org/sid/disorderfs">disorderfs</a> for testing reproducibility and <a href="https://diffoscope.org/">diffoscope</a> for comparing binaries with file-dependent readers, falling back to <code>objdump</code> and <code>hexdump</code>. A giant <a href="https://tests.reproducible-builds.org/">test infrastructure</a> with <a href="https://tests.reproducible-builds.org/debian/index_variations.html">lots of variations</a> between the builds, mostly using Debian, has been setup over the years.</p>
<p>Reproducibility is a precondition for trustworthy binaries. See <a href="https://reproducible-builds.org/#why-does-it-matter">why does it matter</a>. If there are no instructions how to get from the published sources to the exact binary, why should anyone trust and use the binary which claims to be the result of the sources? It may as well contain different code, including a backdoor, bitcoin mining code, outputting the wrong results for specific inputs, etc. Reproducibility does not imply the software is free of security issues or backdoors, but instead of a audit of the binary - which is tedious and rarely done - the source code can be audited - but the toolchain (compiler, linker, ..) used for compilation needs to be taken into account, i.e. trusted or audited to not be malicious. <strong>I will only ever publish binaries if they are reproducible</strong>.</p>
<p>My main interest at the summit was to enhance existing tooling and conduct some experiments about the reproducibility of <a href="https://mirage.io">MirageOS unikernels</a> -- a unikernel is a statically linked ELF binary to be run as Unix process or <a href="https://github.com/solo5/solo5">virtual machine</a>. MirageOS heavily uses <a href="https://ocaml.org">OCaml</a> and <a href="https://opam.ocaml.org">opam</a>, the OCaml package manager, and is an opam package itself. Thus, <em>checking reproducibility of a MirageOS unikernel is the same problem as checking reproducibility of an opam package</em>.</p>
<h2>Reproducible builds with opam</h2>
<p>Testing for reproducibility is achieved by taking the sources and compile them twice independently. Afterwards the equality of the resulting binaries can be checked. In trivial projects, the sources is just a single file, or originate from a single tarball. In OCaml, opam uses <a href="https://github.com/ocaml/opam-repository">a community repository</a> where OCaml developers publish their package releases to, but can also use custom repositores, and in addition pin packages to git remotes (url including branch or commit), or a directory on the local filesystem. Manually tracking and updating all dependent packages of a MirageOS unikernel is not feasible: our hello-world compiled for hvt (kvm/BHyve) already has 79 opam dependencies, including the OCaml compiler which is distribued as opam package. The unikernel serving this website depends on 175 opam packages.</p>
<p>Conceptually there should be two tools, the <em>initial builder</em>, which takes the latest opam packages which do not conflict, and exports exact package versions used during the build, as well as hashes of binaries. The other tool is a <em>rebuilder</em>, which imports the export, conducts a build, and outputs the hashes of the produced binaries.</p>
<p>Opam has the concept of a <code>switch</code>, which is an environment where a package set is installed. Switches are independent of each other, and can already be exported and imported. Unfortunately the export is incomplete: if a package includes additional patches as part of the repository -- sometimes needed for fixing releases where the actual author or maintainer of a package responds slowly -- these package neither the patches end up in the export. Also, if a package is pinned to a git branch, the branch appears in the export, but this may change over time by pushing more commits or even force-pushing to that branch. In <a href="https://github.com/ocaml/opam/pull/4040">PR #4040</a> (under discussion and review), also developed during the summit, I propose to embed the additional files as base64 encoded values in the opam file. To solve the latter issue, I modified the export mechanism to <a href="https://github.com/ocaml/opam/pull/4055">embed the git commit hash (PR #4055)</a>, and avoid sources from a local directory and which do not have a checksum.</p>
<p>So the opam export contains the information required to gather the exact same sources and build instructions of the opam packages. If the opam repository would be self-contained (i.e. not depend on any other tools), this would be sufficient. But opam does not run in thin air, it requires some system utilities such as <code>/bin/sh</code>, <code>sed</code>, a GNU make, commonly <code>git</code>, a C compiler, a linker, an assembler. Since opam is available on various operating systems, the plugin <code>depext</code> handles host system dependencies, e.g. if your opam package requires <code>gmp</code> to be installed, this requires slightly different names depending on host system or distribution, take a look at <a href="https://github.com/ocaml/opam-repository/blob/master/packages/conf-gmp/conf-gmp.1/opam">conf-gmp</a>. This also means, opam has rather good information about both the opam dependencies and the host system dependencies for each package. Please note that the host system packages used during compilation are not yet recorded (i.e. which <code>gmp</code> package was installed and used during the build, only that a <code>gmp</code> package has to be installed). The base utilities mentioned above (C compiler, linker, shell) are also not recorded yet.</p>
<p>Operating system information available in opam (such as architecture, distribution, version), which in some cases maps to exact base utilities, is recorded in the build-environment, a separate artifact. The environment variable <a href="https://reproducible-builds.org/specs/source-date-epoch/"><code>SOURCE_DATE_EPOCH</code></a>, used for communicating the same timestamp when software is required to record a timestamp into the resulting binary, is also captured in the build environment.</p>
<p>Additional environment variables may be captured or used by opam packages to produce different output. To avoid this, both the initial builder and the rebuilder are run with minimal environment variables: only <code>PATH</code> (normalised to a whitelist of <code>/bin</code>, <code>/usr/bin</code>, <code>/usr/local/bin</code> and <code>/opt/bin</code>) and <code>HOME</code> are defined. Missing information at the moment includes CPU features: some libraries (gmp?, nocrypto) emit different code depending on the CPU feature.</p>
<h2>Tooling</h2>
<p><em>TL;DR: A <strong>build</strong> builds an opam package, and outputs <code>.opam-switch</code>, <code>.build-hashes.N</code>, and <code>.build-environment.N</code>. A <strong>rebuild</strong> uses these artifacts as input, builds the package and outputs another <code>.build-hashes.M</code> and <code>.build-environment.M</code>.</em></p>
<p>The command-line utility <code>orb</code> can be installed and used:</p>
<pre><code class="language-sh">$ opam pin add orb git+https://github.com/hannesm/orb.git#active
$ orb build --twice --keep-build-dir --diffoscope &lt;your-favourite-opam-package&gt;
</code></pre>
<p>It provides two subcommands <code>build</code> and <code>rebuild</code>. The <code>build</code> command takes a list of local opam <code>--repos</code> where to take opam packages from (defaults to <code>default</code>), a compiler (either a variant <code>--compiler=4.09.0+flambda</code>, a version <code>--compiler=4.06.0</code>, or a pin to a local development version <code>--compiler-pin=~/ocaml</code>), and optionally an existing switch <code>--use-switch</code>. It creates a switch, builds the packages, and emits the opam export, hashes of all files installed by these packages, and the build environment. The flags <code>--keep-build</code> retains the build products, opam's <code>--keep-build-dir</code> in addition temporary build products and generated source code. If <code>--twice</code> is provided, a rebuild (described next) is executed after the initial build.</p>
<p>The <code>rebuild</code> command takes a directory with the opam export and build environment to build the opam package. It first compares the build-environment with the host system, sets the <code>SOURCE_DATE_EPOCH</code> and switch location accordingly and executes the import. Once the build is finished, it compares the hashes of the resulting files with the previous run. On divergence, if build directories were kept in the previous build, and if diffoscope is available and <code>--diffoscope</code> was provided, diffoscope is run on the diverging files. If <code>--keep-build-dir</code> was provided as well, <code>diff -ur</code> can be used to compare the temporary build and sources, including build logs.</p>
<p>The builds are run in parallel, as opam does, this parallelism does not lead to different binaries in my experiments.</p>
<h2>Results and discussion</h2>
<p><strong>All MirageOS unikernels I have deployed are reproducible \o/</strong>. Also, several binaries such as <code>orb</code> itself, <code>opam</code>, <code>solo5-hvt</code>, and all <code>albatross</code> utilities are reproducible.</p>
<p>The unikernel range from hello world, web servers (e.g. this blog, getting its data on startup via a git clone to memory), authoritative DNS servers, CalDAV server. They vary in size between 79 and 200 opam packages, resulting in 2MB - 16MB big ELF binaries (including debug symbols). The <a href="https://github.com/roburio/reproducible-unikernel-repo">unikernel opam repository</a> contains some reproducible unikernels used for testing. Some work-in-progress enhancements are needed to achieve this:</p>
<p>At the moment, the opam package of a MirageOS unikernel is automatically generated by <code>mirage configure</code>, but only used for tracking opam dependencies. I worked on <a href="https://github.com/mirage/mirage/pull/1022">mirage PR #1022</a> to extend the generated opam package with build and install instructions.</p>
<p>As mentioned above, if locale is set, ocamlgraph needs to be patched to emit a (locale-dependent) timestamp.</p>
<p>The OCaml program <a href="https://github.com/mirage/ocaml-crunch"><code>crunch</code></a> embeds a subdirectory as OCaml code into a binary, which we use in MirageOS quite regularly for static assets, etc. This plays in several ways into reproducibility: on the one hand, it needs a timestamp for its <code>last_modified</code> functionality (and adheres since <a href="https://github.com/mirage/ocaml-crunch/pull/45">June 2018</a> to the <code>SOURCE_DATE_EPOCH</code> spec, thanks to Xavier Clerc). On the other hand, it used before version 3.2.0 (released Dec 14th) hashtables for storing the file contents, where iteration is not deterministic (the insertion is not sorted), <a href="https://github.com/mirage/ocaml-crunch/pull/51">fixed in PR #51</a> by using a Map instead.</p>
<p>In functoria, a tool used to configure MirageOS devices and their dependencies, can emit a list of opam packages which were required to build the unikernel. This uses <code>opam list --required-by --installed --rec &lt;pkgs&gt;</code>, which uses the cudf graph (<a href="https://github.com/mirage/functoria/pull/189#issuecomment-566696426">thanks to Raja for explanation</a>), that is during the rebuild dropping some packages. The <a href="https://github.com/mirage/functoria/pull/189">PR #189</a> avoids by not using the <code>--rec</code> argument, but manually computing the fixpoint.</p>
<p>Certainly, the choice of environment variables, and whether to vary them (as <a href="https://tests.reproducible-builds.org/debian/index_variations.html">debian does</a>) or to not define them (or normalise) while building, is arguably. Since MirageOS does neither support time zone nor internationalisation, there is no need to prematurely solving this issue. On related note, even with different locale settings, MirageOS unikernels are reproducible apart from an <a href="https://github.com/backtracking/ocamlgraph/pull/90">issue in ocamlgraph #90</a> embedding the output of <a href="https://pubs.opengroup.org/onlinepubs/9699919799/utilities/date.html"><code>date</code></a>, which is different depending on <code>LANG</code> and locale (<code>LC_*</code>) settings.</p>
<p>Prior art in reproducible MirageOS unikernels is the <a href="https://github.com/mirage/qubes-mirage-firewall/">mirage-qubes-firewall</a>. Since <a href="https://github.com/mirage/qubes-mirage-firewall/commit/07ff3d61477383860216c69869a1ffee59145e45">early 2017</a> it is reproducible. Their approach is different by building in a docker container with the opam repository pinned to an exact git commit.</p>
<h2>Further work</h2>
<p>I only tested a certain subset of opam packages and MirageOS unikernels, mainly on a single machine (my laptop) running FreeBSD, and am happy if others will test reproducibility of their OCaml programs with the tools provided. There could as well be CI machines rebuilding opam packages and reporting results to a central repository. I'm pretty sure there are more reproducibility issues in the opam ecosystem. I developed an <a href="https://github.com/roburio/reproducible-testing-repo">reproducible testing opam repository</a> with opam packages that do not depend on OCaml, mainly for further tooling development. Some tests were also conducted on a Debian system with the same result. The variations, apart from build time, were using a different user, and different locale settings.</p>
<p>As mentioned above, more environment, such as the CPU features, and external system packages, should be captured in the build environment.</p>
<p>When comparing OCaml libraries, some output files (cmt / cmti / cma / cmxa) are not deterministic, but contain minimal diverge where I was not able to spot the root cause. It would be great to fix this, likely in the OCaml compiler distribution. Since the final result, the binary I'm interested in, is not affected by non-identical intermediate build products, I hope someone (you?) is interested in improving on this side. OCaml bytecode output also seems to be non-deterministic. There is <a href="https://github.com/coq/coq/issues/11229">a discussion on the coq issue tracker</a> which may be related.</p>
<p>In contrast to initial plans, I did not used the <a href="https://reproducible-builds.org/specs/build-path-prefix-map/"><code>BUILD_PATH_PREFIX_MAP</code></a> environment variable, which is implemented in OCaml by <a href="https://github.com/ocaml/ocaml/pull/1515">PR #1515</a> (and followups). The main reasons are that something in the OCaml toolchain (I suspect the bytecode interpreter) needed absolute paths to find libraries, thus I'd need a symlink from the left-hand side to the current build directory, which was tedious. Also, my installed assembler does not respect the build path prefix map, and BUILD_PATH_PREFIX_MAP is not widely supported. See e.g. the Debian <a href="https://tests.reproducible-builds.org/debian/rb-pkg/unstable/amd64/diffoscope-results/ocaml-zarith.html">zarith</a> package with different build paths and its effects on the binary.</p>
<p>I'm fine with recording the build path (switch location) in the build environment for now - it turns out to end up only once in MirageOS unikernels, likely by the last linking step, which <a href="http://blog.llvm.org/2019/11/deterministic-builds-with-clang-and-lld.html">hopefully soon be solved by llvm 9.0</a>.</p>
<p>What was fun was to compare the unikernel when built on Linux with gcc against a built on FreeBSD with clang and lld - spoiler: they emit debug sections with different dwarf versions, it is pretty big. Other fun differences were between OCaml compiler versions: the difference between minor versions (4.08.0 vs 4.08.1) is pretty small (~100kB as human-readable output), while the difference between major version (4.08.1 vs 4.09.0) is rather big (~900kB as human-readable diff).</p>
<p>An item on my list for the future is to distribute the opam export, build hashes and build environment artifacts in a authenticated way. I want to integrate this as <a href="https://in-toto.io/">in-toto</a> style into <a href="https://github.com/hannesm/conex">conex</a>, my not-yet-deployed implementation of <a href="https://theupdateframework.github.io/">tuf</a> for opam that needs further development and a test installation, hopefully in 2020.</p>
<p>If you want to support our work on MirageOS unikernels, please <a href="https://robur.coop/Donate">donate to robur</a>. I'm interested in feedback, either via <a href="https://twitter.com/h4nnes">twitter</a>, <a href="https://mastodon.social/@hannesm">hannesm@mastodon.social</a> or via eMail.</p>
</article></div></div></main></body></html>

66
Posts/Solo5 Normal file
View file

@ -0,0 +1,66 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Minimising the virtual machine monitor</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="Minimising the virtual machine monitor" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="post"><h2>Minimising the virtual machine monitor</h2><span class="author">Written by hannes</span><br/><div class="tags">Classified under: <a href="/tags/future" class="tag">future</a><a href="/tags/mirageos" class="tag">mirageos</a><a href="/tags/security" class="tag">security</a></div><span class="date">Published: 2016-07-02 (last updated: 2021-11-19)</span><article><ul>
<li>Update (2016-10-19): all has been merged upstream now!
</li>
<li>Update (2016-10-30): <code>static_website_tls</code> works (TLS,HTTP,network via tap device)!
</li>
<li>Update (2017-02-23): no more extra remotes, Mirage3 is released!
</li>
</ul>
<h2>What?</h2>
<p>As described <a href="/Posts/OperatingSystem">earlier</a>, MirageOS is a library operating system developed in <a href="/Posts/OCaml">OCaml</a>. The code size is already pretty small, deployments are so far either as a UNIX binary or as a Xen virtual machine.</p>
<p>Xen is a hypervisor, providing concrete device drivers for the actual hardware of a physical machine, memory management, scheduling, etc. The initial release of Xen was done in 2003, since then the code size and code complexity of Xen is growing. It also has various different mechanisms for virtualisation, hardware assisted ones or purely software based ones, some where the guest operating system needs to cooperate others where it does not need to cooperate.</p>
<p>Since 2005, Intel CPUs (as well as AMD CPUs) provide hardware assistance for virtualisation (the VT-x extension), since 2008 extended page tables (EPT) are around which allow a guest to safely access the MMU. Those features gave rise to much smaller hypervisors, such as KVM (mainly Linux), <a href="http://bhyve.org">bhyve</a> (FreeBSD), <a href="http://xhyve.org">xhyve</a> (MacOSX), <a href="http://undeadly.org/cgi?action=article&amp;sid=20150831183826">vmm</a> (OpenBSD), which do not need to emulate the MMU and other things in software. The boot sequence in those hypervisors uses kexec or multiboot, instead of doing all the 16 bit, 32 bit, 64 bit mode changes manually.</p>
<p>MirageOS initially targeted only Xen, in 2015 there was a port to use rumpkernel (a modularised NetBSD), and 2016 <a href="https://github.com/Solo5/solo5">solo5</a> emerged where you can run MirageOS on. Solo5 comes in two shapes, either as <code>ukvm</code> on top of KVM, or as a multiboot image using <code>virtio</code> interfaces (block and network, plus a serial console). Solo5 is only ~1000 lines of code (plus dlmalloc), and ISC-licensed.</p>
<p>A recent <a href="https://www.usenix.org/system/files/conference/hotcloud16/hotcloud16_williams.pdf">paper</a> describes the advantages of a tiny virtual machine monitor in detail, namely no more <a href="http://venom.crowdstrike.com/">venom</a> like security issues since there is no legacy hardware emulated. Also, each virtual machine monitor can be customised to the unikernel running on top of it: if the unikernel does not need a block device, the monitor shouldn't contain code for it. The idea is to have one customised monitor for each unikernel.</p>
<p>While lots of people seem to like KVM and Linux, I still prefer FreeBSD, their jails, and nowadays bhyve. I finally found some time, thanks to various cleanups to the solo5 code base, to finally look into porting solo5 to FreeBSD/bhyve. It runs and can output to console.</p>
<h2>How?</h2>
<p>These instructions are still slightly bumpy. If you've a FreeBSD with bhyve (I use FreeBSD-CURRENT), and OCaml and opam (&gt;=1.2.2) installed, it is pretty straightforward to get solo5 running. First, I'd suggest to use a fresh opam switch in case you work on other OCaml projects: <code>opam switch -A 4.04.0 solo5</code> (followed by <code>eval `opam config env` </code> to setup some environment variables).</p>
<p>You need some software from the ports: <code>devel/pkgconf</code>, <code>devel/gmake</code>, <code>devel/binutils</code>, and <code>sysutils/grub2-bhyve</code>.</p>
<p>An <code>opam install mirage mirage-logs solo5-kernel-virtio mirage-bootvar-solo5 mirage-solo5</code> should provide you with a basic set of libraries.</p>
<p>Now you can get the <a href="https://github.com/mirage/mirage-skeleton">mirage-skeleton</a> repository, and inside of <code>device-usage/console</code>, run <code>mirage configure --no-opam --virtio</code> followed by <code>make</code>. There should be a resulting <code>mir-console.virtio</code>.</p>
<p>Once that is in place, start your VM:</p>
<pre><code class="language-bash">sudo grub-bhyve -M 128M console
&gt; multiboot (host)/home/hannes/mirage-skeleton/console/mir-console.virtio
&gt; boot
sudo bhyve -A -H -P -s 0:0,hostbridge -s 1:0,lpc -l com1,stdio -m 128M console
</code></pre>
<p>The following output will appear on your controlling terminal:</p>
<pre><code class="language-bash"> | ___|
__| _ \ | _ \ __ \
\__ \ ( | | ( | ) |
____/\___/ _|\___/____/
multiboot: Using memory: 0x100000 - 0x8000000
TSC frequency estimate is 2593803000 Hz
Solo5: new bindings
STUB: getenv() called
hello
world
hello
world
hello
world
hello
world
solo5_app_main() returned with 0
Kernel done.
Goodbye!
</code></pre>
<p>Network and TLS stack works as well (tested 30th October).</p>
<h2>Open issues</h2>
<ul>
<li>I'm not happy to require <code>ld</code> from the ports (but the one in base does not produce sensible binaries with <code>-z max-page-size=0x1000</code> <a href="https://github.com/Solo5/solo5/pull/56">related</a>)
</li>
<li>Via <a href="https://twitter.com/bhyve_dev/status/748930600581492736">twitter</a>, bhyve devs suggested to port ukvm to ubhyve. This is a great idea, to no longer depend on virtio, and get more speed. Any takers?
</li>
<li>Debugging via gdb should be doable somehow, bhyve has <a href="https://wiki.freebsd.org/bhyve/DebuggingWithGdb">some support for gdb</a>, but it is unclear to me what I need to do to enter the debugger (busy looping in the VM and a gdb remote to the port opened by bhyve does not work).
</li>
</ul>
<h2>Conclusion</h2>
<p>I managed to get solo5 to work with bhyve. I even use clang instead of gcc and don't need to link <code>libgcc.a</code>. :) It is great to see further development in hypervisors and virtual machine monitors. Especially thanks to <a href="https://lucina.net">Martin Lucina</a> for getting things sorted.</p>
<p>I'm interested in feedback, either via
<a href="https://twitter.com/h4nnes">twitter</a> or via eMail.</p>
<h2>Other updates in the MirageOS ecosystem</h2>
<p>There were some busy times, several pull requests are still waiting to get merged (e.g. some cosmetics in <a href="https://github.com/mirage/mirage/pull/544">mirage</a> as preconditions for treemaps and dependency diagrams), I <a href="https://github.com/mirage/mirage/pull/547">proposed</a> to use <code>sleep_ns : int64 -&gt; unit io</code> instead of the <code>sleep : float -&gt; unit io</code> (nobody wants floating point numbers); also an RFC for <a href="https://github.com/mirage/mirage/pull/551">random</a>, Matt Gray <a href="https://github.com/mirage/mirage/pull/548">proposed</a> to get rid of <code>CLOCK</code> (and have a <code>PCLOCK</code> and a <code>MCLOCK</code> instead). Soon there will be a major MirageOS release which breaks all the previous unikernels! :)</p>
</article></div></div></main></body></html>

31
Posts/Summer2019 Normal file
View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Summer 2019</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="Summer 2019" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="post"><h2>Summer 2019</h2><span class="author">Written by hannes</span><br/><div class="tags">Classified under: <a href="/tags/mirageos" class="tag">mirageos</a><a href="/tags/security" class="tag">security</a><a href="/tags/package signing" class="tag">package signing</a><a href="/tags/tls" class="tag">tls</a><a href="/tags/monitoring" class="tag">monitoring</a><a href="/tags/deployment" class="tag">deployment</a></div><span class="date">Published: 2019-07-08 (last updated: 2021-11-19)</span><article><h2>Working at <a href="https://robur.io">robur</a></h2>
<p>As announced <a href="/Posts/DNS">previously</a>, I started to work at robur early 2018. We're a collective of five people, distributed around Europe and the US, with the goal to deploy MirageOS unikernels. We do this by developing bespoke MirageOS unikernels which provide useful services, and deploy them for ourselves. We also develop new libraries and enhance existing ones and other components of MirageOS. Example unikernels include <a href="https://robur.io">our website</a> which uses <a href="https://github.com/Engil/Canopy">Canopy</a>, a <a href="https://robur.io/Our%20Work/Projects#CalDAV-Server">CalDAV server that stores entries in a git remote</a>, and <a href="https://github.com/roburio/unikernels">DNS servers</a> (the latter two are further described below).</p>
<p>Robur is part of the non-profit company <a href="https://techcultivation.org">Center for the Cultivation of Technology</a>, who are managing the legal and administrative sides for us. We're ourselves responsible to acquire funding to pay ourselves reasonable salaries. We received funding for CalDAV from <a href="https://prototypefund.de">prototypefund</a> and further funding from <a href="https://tarides.com">Tarides</a>, for TLS 1.3 from <a href="http://ocamllabs.io/">OCaml Labs</a>; security-audited an OCaml codebase, and received <a href="https://robur.io/Donate">donations</a>, also in the form of Bitcoins. We're looking for further funded collaborations and also contracting, mail us at <code>team@robur.io</code>. Please <a href="https://robur.io/Donate">donate</a> (tax-deductible in EU), so we can accomplish our goal of putting robust and sustainable MirageOS unikernels into production, replacing insecure legacy system that emit tons of CO<span style="vertical-align: baseline; position: relative;bottom: -0.4em;">2</span>.</p>
<h2>Deploying MirageOS unikernels</h2>
<p>While several examples are running since years (the <a href="https://mirage.io">MirageOS website</a>, <a href="http://ownme.ipredator.se">Bitcoin Piñata</a>, <a href="https://tls.nqsb.io">TLS demo server</a>, etc.), and some shell-scripts for cloud providers are floating around, it is not (yet) streamlined.</p>
<p>Service deployment is complex: you have to consider its configuration, exfiltration of logs and metrics, provisioning with valid key material (TLS certificate, hmac shared secret) and authenticators (CA certificate, ssh key fingerprint). Instead of requiring millions lines of code during orchestration (such as Kubernetes), creating the images (docker), or provisioning (ansible), why not minimise the required configuration and dependencies?</p>
<p><a href="/Posts/VMM">Earlier in this blog I introduced Albatross</a>, which serves in an enhanced version as our deployment platform on a physical machine (running 15 unikernels at the moment), I won't discuss more detail thereof in this article.</p>
<h2>CalDAV</h2>
<p><a href="https://linse.me/">Steffi</a> and I developed in 2018 a CalDAV server. Since November 2018 we have a test installation for robur, initially running as a Unix process on a virtual machine and persisting data to files on the disk. Mid-June 2019 we migrated it to a MirageOS unikernel, thanks to great efforts in <a href="https://github.com/mirage/ocaml-git">git</a> and <a href="https://github.com/mirage/irmin">irmin</a>, unikernels can push to a remote git repository. We <a href="https://github.com/haesbaert/awa-ssh/pull/8">extended the ssh library</a> with a ssh client and <a href="https://github.com/mirage/ocaml-git/pull/362">use this in git</a>. This also means our CalDAV server is completely immutable (does not carry state across reboots, apart from the data in the remote repository) and does not have persistent state in the form of a block device. Its configuration is mainly done at compile time by the selection of libraries (syslog, monitoring, ...), and boot arguments passed to the unikernel at startup.</p>
<p>We monitored the resource usage when migrating our CalDAV server from Unix process to a MirageOS unikernel. The unikernel size is just below 10MB. The workload is some clients communicating with the server on a regular basis. We use <a href="https://grafana.com/">Grafana</a> with a <a href="https://www.influxdata.com/">influx</a> time series database to monitor virtual machines. Data is collected on the host system (<code>rusage</code> sysctl, <code>kinfo_mem</code> sysctl, <code>ifdata</code> sysctl, <code>vm_get_stats</code> BHyve statistics), and our unikernels these days emit further metrics (mostly counters: gc statistics, malloc statistics, tcp sessions, http requests and status codes).</p>
<p><a href="/static/img/crobur-june-2019.png"><img src="/static/img/crobur-june-2019.png" width="700" /></a></p>
<p>Please note that memory usage (upper right) and vm exits (lower right) use logarithmic scale. The CPU usage reduced by more than a factor of 4. The memory usage dropped by a factor of 25, and the network traffic increased - previously we stored log messages on the virtual machine itself, now we send them to a dedicated log host.</p>
<p>A MirageOS unikernel, apart from a smaller attack surface, indeed uses fewer resources and actually emits less CO<span style="vertical-align: baseline; position: relative;bottom: -0.4em;">2</span> than the same service on a Unix virtual machine. So we're doing something good for the environment! :)</p>
<p>Our calendar server contains at the moment 63 events, the git repository had around 500 commits in the past month: nearly all of them from the CalDAV server itself when a client modified data via CalDAV, and two manual commits: the initial data imported from the file system, and one commit for fixing a bug of the encoder in our <a href="https://github.com/roburio/icalendar/pull/2">icalendar library</a>.</p>
<p>Our CalDAV implementation is very basic, scheduling, adding attendees (which requires sending out eMail), is not supported. But it works well for us, we have individual calendars and a shared one which everyone can write to. On the client side we use macOS and iOS iCalendar, Android DAVdroid, and Thunderbird. If you like to try our CalDAV server, have a look <a href="https://github.com/roburio/caldav/tree/future/README.md">at our installation instructions</a>. Please <a href="https://github.com/roburio/caldav/issues">report issues</a> if you find issues or struggle with the installation.</p>
<h2>DNS</h2>
<p>There has been more work on our DNS implementation, now <a href="https://github.com/mirage/ocaml-dns">here</a>. We included a DNS client library, and some <a href="https://github.com/roburio/unikernels/tree/future">example unikernels</a> are available. They as well require our <a href="https://github.com/roburio/git-ssh-dns-mirage3-repo">opam repository overlay</a>. Please report issues if you run into trouble while experimenting with that.</p>
<p>Most prominently is <code>primary-git</code>, a unikernel which acts as a primary authoritative DNS server (UDP and TCP). On startup, it fetches a remote git repository that contains zone files and shared hmac secrets. The zones are served, and secondary servers are notified with the respective serial numbers of the zones, authenticated using TSIG with the shared secrets. The primary server provides dynamic in-protocol updates of DNS resource records (<code>nsupdate</code>), and after successful authentication pushes the change to the remote git. To change the zone, you can just edit the zonefile and push to the git remote - with the proper pre- and post-commit-hooks an authenticated notify is send to the primary server which then pulls the git remote.</p>
<p>Another noteworthy unikernel is <code>letsencrypt</code>, which acts as a secondary server, and whenever a TLSA record with custom type (0xFF) and a DER-encoded certificate signing request is observed, it requests a signature from letsencrypt by solving the DNS challenge. The certificate is pushed to the DNS server as TLSA record as well. The DNS implementation provides <code>ocertify</code> and <code>dns-mirage-certify</code> which use the above mechanism to retrieve valid let's encrypt certificates. The caller (unikernel or Unix command-line utility) either takes a private key directly or generates one from a (provided) seed and generates a certificate signing request. It then looks in DNS for a certificate which is still valid and matches the public key and the hostname. If such a certificate is not present, the certificate signing request is pushed to DNS (via the nsupdate protocol), authenticated using TSIG with a given secret. This way our public facing unikernels (website, this blog, TLS demo server, ..) block until they got a certificate via DNS on startup - we avoid embedding of the certificate into the unikernel image.</p>
<h2>Monitoring</h2>
<p>We like to gather statistics about the resource usage of our unikernels to find potential bottlenecks and observe memory leaks ;) The base for the setup is the <a href="https://github.com/mirage/metrics">metrics</a> library, which is similarly in design to the <a href="https://erratique.ch/software/logs">logs</a> library: libraries use the core to gather metrics. A different aspect is the reporter, which is globally registered and responsible for exfiltrating the data via their favourite protocol. If no reporter is registered, the work overhead is negligible.</p>
<p><a href="/static/img/crobur-june-2019-unikernel.png"><img src="/static/img/crobur-june-2019-unikernel.png" width="700" /></a></p>
<p>This is a dashboard which combines both statistics gathered from the host system and various metrics from the MirageOS unikernel. The <code>monitoring</code> branch of our opam repository overlay is used together with <a href="https://github.com/hannesm/monitoring-experiments">monitoring-experiments</a>. The logs errors counter (middle right) was the icalendar parser which tried to parse its badly emitted ics (the bug is now fixed, the dashboard is from last month).</p>
<h2>OCaml libraries</h2>
<p>The <a href="https://github.com/hannesm/domain-name">domain-name</a> library was developed to handle RFC 1035 domain names and host names. It initially was part of the DNS code, but is now freestanding to be used in other core libraries (such as ipaddr) with a small dependency footprint.</p>
<p>The <a href="https://github.com/hannesm/gmap">GADT map</a> is a normal OCaml Map structure, but takes key-dependent value types by using a GADT. This library also was part of DNS, but is more broadly useful, we already use it in our icalendar (the data format for calendar entries in CalDAV) library, our <a href="https://git.robur.io/?p=openvpn.git;a=summary">OpenVPN</a> configuration parser uses it as well, and also <a href="https://github.com/mirleft/ocaml-x509/pull/115">x509</a> - which got reworked quite a bit recently (release pending), and there's preliminary PKCS12 support (which deserves its own article). <a href="https://github.com/hannesm/ocaml-tls">TLS 1.3</a> is available on a branch, but is not yet merged. More work is underway, hopefully with sufficient time to write more articles about it.</p>
<h2>Conclusion</h2>
<p>More projects are happening as we speak, it takes time to upstream all the changes, such as monitoring, new core libraries, getting our DNS implementation released, pushing Conex into production, more features such as DNSSec, ...</p>
<p>I'm interested in feedback, either via <strike><a href="https://twitter.com/h4nnes">twitter</a></strike> <a href="https://mastodon.social/@hannesm">hannesm@mastodon.social</a> or via eMail.</p>
</article></div></div></main></body></html>

152
Posts/Syslog Normal file
View file

@ -0,0 +1,152 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Exfiltrating log data using syslog</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="Exfiltrating log data using syslog" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="post"><h2>Exfiltrating log data using syslog</h2><span class="author">Written by hannes</span><br/><div class="tags">Classified under: <a href="/tags/mirageos" class="tag">mirageos</a><a href="/tags/protocol" class="tag">protocol</a><a href="/tags/logging" class="tag">logging</a></div><span class="date">Published: 2016-11-05 (last updated: 2021-11-19)</span><article><p>It has been a while since my last entry... I've been busy working on too many
projects in parallel, and was also travelling on several continents. I hope to
get back to a biweekly cycle.</p>
<h2>What is syslog?</h2>
<p>According to <a href="https://en.wikipedia.org/wiki/Syslog">Wikipedia</a>, syslog is a
standard for message logging. Syslog permits separation of the software which
generates, stores, reports, and analyses the message. A syslog message contains
at least a timestamp, a facility, and a severity. It was initially specified in
<a href="https://tools.ietf.org/html/rfc3164">RFC 3164</a>, though usage predates this RFC.</p>
<p>For a unikernel, which likely won't have any persistent storage, syslog is a way
to emit log messages (HTTP access log, debug messages, ...) via the network, and
defer the persistency problem to some other service.</p>
<p>Lots of programming languages have logger libraries, which reflect the different
severity of syslog roughly as log levels (debug, informational, warning, error,
fatal). So does OCaml since the beginning of 2016, there is the
<a href="http://erratique.ch/software/logs">Logs</a> library which separates log message
generation from reporting: the closure producing the log string is only
evaluated if there is a reporter which needs to send it out. Additionally, the
reporter can extend the message with the log source name, a timestamp, etc.</p>
<p>The Logs library is slowly getting adopted by the MirageOS community (you can
see an incomplete list
<a href="https://opam.ocaml.org/packages/logs/logs.0.6.2/">here</a>), there are reporters
available which integrate into <a href="https://github.com/mirage/ocaml-asl">Apple System
Log</a>, <a href="https://github.com/djs55/ocaml-win-eventlog">Windows event
log</a>, and also for <a href="https://github.com/mirage/mirage-logs">MirageOS
console</a>. There is a command-line
argument interface to set the log levels of your individual sources, which is
pretty neat. For debugging and running on Unix, console output is usually
sufficient, but for production usage having a console in some <code>screen</code> or <code>tmux</code>
or dumped to a file is usually annoying.</p>
<p>Gladly there was already the
<a href="https://github.com/verbosemode/syslog-message">syslog-message</a> library, which
encodes and decodes syslog messages from the wire format to a typed
representation. I plugged those together and <a href="https://hannesm.github.io/logs-syslog/doc/Logs_syslog.html">implemented a
reporter</a>. The
<a href="https://github.com/hannesm/logs-syslog/blob/e35ffe704e998d9a6867f3f504c103861a4408ef/src/logs_syslog_unix.ml#L4-L32">simplest
one</a>
emits each log message via UDP to a log collector. All reporters contain a
socket and handle socket errors themselves (trying to recover) - your
application (or unikernel) shouldn't fail just because the log collector is
currently offline.</p>
<p>The setup for Unix is straightforward:</p>
<pre><code class="language-OCaml">Logs.set_reporter (udp_reporter (Unix.inet_addr_of_string &quot;127.0.0.1&quot;) ())
</code></pre>
<p>It will report all log messages (you have to set the Log level yourself,
defaults to warning) to your local syslog. You might have already listening a
collector on your host, look in <code>netstat -an</code> for UDP port 514 (and in your
<code>/etc/syslog.conf</code> to see where log messages are routed to).</p>
<p>You can even do this from the OCaml toplevel (after <code>opam install logs-syslog</code>):</p>
<pre><code class="language-OCaml">$ utop
# #require &quot;logs-syslog.unix&quot;;;
# Logs.set_reporter (Logs_syslog_unix.udp_reporter (Unix.inet_addr_of_string &quot;127.0.0.1&quot;) ());;
# Logs.app (fun m -&gt; m &quot;hello, syslog world&quot;);;
</code></pre>
<p>I configured my syslog to have all <code>informational</code> messages routed to
<code>/var/log/info.log</code>, you can also try <code>Logs.err (fun m -&gt; m &quot;err&quot;);;</code> and look
into your <code>/var/log/messages</code>.</p>
<p>This is a good first step, but we want more: on the one side integration into
MirageOS, and a more reliable log stream (what about authentication and
encryption?). I'll cover both topics in the rest of this article.</p>
<h3>MirageOS integration</h3>
<p>Since Mirage3, syslog is integrated (see
<a href="http://docs.mirage.io/mirage/Mirage/index.html#type-syslog_config">documentation</a>).
Some additions to your <code>config.ml</code> are needed, see <a href="https://github.com/hannesm/ns.nqsb.io/blob/master/config.ml">ns
example</a> or
<a href="https://github.com/mirage/marrakech2017/blob/master/config.ml">marrakech
example</a>.</p>
<pre><code class="language-OCaml">let logger =
syslog_udp (* or _tcp or _tls *)
(syslog_config ~truncate:1484 &quot;my_first_unikernel&quot;
(Ipaddr.V4.of_string_exn &quot;10.0.0.1&quot;)) (* your log host *)
stack
let () =
register &quot;my_first_unikernel&quot; [
foreign ~deps:[abstract logger]
...
</code></pre>
<h3>Reliable syslog</h3>
<p>The old BSD syslog RFC is obsoleted by <a href="https://tools.ietf.org/html/rfc5424">RFC
5424</a>, which describes a new wire format,
and also a transport over TCP, and <a href="https://tools.ietf.org/html/rfc5425">TLS</a> in
a subsequent RFC. Unfortunately the <code>syslog-message</code> library does not yet
support the new format (which supports user-defined structured data (key/value
fields), and unicode encoding), but I'm sure one day it will.</p>
<p>Another competing syslog <a href="https://tools.ietf.org/html/rfc3195">RFC 3195</a> uses
XML encoding, but I have not bothered to look deeper into that one.</p>
<p>I implemented both the transport via TCP and via TLS. There are various
solutions used for framing (as described in <a href="https://tools.ietf.org/html/rfc6587">RFC
6587</a>): either prepend a decimal encoded
length (also specified in RFC6524, but obviously violates streaming
characteristics: the log source needs to have the full message in memory before
sending it out), or have a special delimiter between messages (0 byte, line
feed, CR LN, a custom byte sequence).</p>
<p>The <a href="https://hannesm.github.io/logs-syslog/doc/Logs_syslog_lwt_tls.html">TLS
reporter</a>
uses our TLS library written entirely in OCaml, and requires mutual
authentication, both the log reporter has a private key and certificate, and the
log collector needs to present a certificate chain rooted in a provided CA
certificate.</p>
<p>Logs supports synchronous and asynchronous logging (where the latter is the
default, please read the <a href="http://erratique.ch/software/logs/doc/Logs.html#sync">note on synchronous
logging</a>). In logs-syslog
this behaviour is not altered. There is no buffer or queue and single writer
task to emit log messages, but a mutex and error recovery which tries to
reconnect once for each log message (of course only if there is not already a
working connection). It is still not clear to me what the desired behaviour
should be, but when introducing buffers I'd loose the synchronous logging (or
will have to write rather intricate code).</p>
<p>To rewrap, <code>logs-syslog</code> implements the old BSD syslog protocol via UDP, TCP,
and TLS. There are reporters available using only the Caml
<a href="https://hannesm.github.io/logs-syslog/doc/Logs_syslog_unix.html">Unix</a> module
(dependency-free!), using
<a href="https://hannesm.github.io/logs-syslog/doc/Logs_syslog_lwt.html">Lwt</a> (also
<a href="https://hannesm.github.io/logs-syslog/doc/Logs_syslog_lwt_tls.html">lwt-tls</a>,
and using <a href="https://hannesm.github.io/logs-syslog/doc/Logs_syslog_mirage.html">MirageOS
interface</a>
(also
<a href="https://hannesm.github.io/logs-syslog/doc/Logs_syslog_mirage_tls.html">TLS</a>).
The code size is below 500 lines in total.</p>
<h3>MirageOS syslog in production</h3>
<p>As collector I use syslog-ng, which is capable of receiving both the new and the
old syslog messages on all three transports. The configuration snippet for a
BSD syslog TLS collector is as following:</p>
<pre><code>source s_tls {
tcp(port(6514)
tls(peer-verify(require-trusted)
cert-file(&quot;/etc/log/server.pem&quot;)
key-file(&quot;/etc/log/server.key&quot;)
ca-dir(&quot;/etc/log/certs&quot;))); };
destination d_tls { file(&quot;/var/log/ng-tls.log&quot;); };
log { source(s_tls); destination(d_tls); };
</code></pre>
<p>The <code>&quot;/etc/log/certs&quot;</code> directory contains the CA certificates, together with
links to their hashes (with a 0 appended: <code>ln -s cacert.pem `openssl x509 -noout -hash -in cacert.pem`.0</code>). I used
<a href="https://github.com/yomimono/ocaml-certify">certify</a> to generate the CA
infrastructure (CA cert, a server certificate for syslog-ng, and a client
certificate for my MirageOS unikernel).</p>
<p>It is running since a week like a
charm (already collected 700KB of HTTP access log), and feels much better than
previous ad-hoc solutions to exfiltrate log data.</p>
<p>The downside of syslog is obviously that it only works when the network is up --
thus it does not work while booting, or when a persistent network failure
occured.</p>
<p><a href="https://github.com/hannesm/logs-syslog">Code is on GitHub</a>, <a href="https://hannesm.github.io/logs-syslog/doc">documentation is
online</a>, released in opam.</p>
<p>I'm interested in feedback, either via
<a href="https://twitter.com/h4nnes">twitter</a> or via eMail.</p>
</article></div></div></main></body></html>

346
Posts/Traceroute Normal file
View file

@ -0,0 +1,346 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Traceroute</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="Traceroute" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="post"><h2>Traceroute</h2><span class="author">Written by hannes</span><br/><div class="tags">Classified under: <a href="/tags/mirageos" class="tag">mirageos</a><a href="/tags/protocol" class="tag">protocol</a></div><span class="date">Published: 2020-06-24 (last updated: 2021-11-19)</span><article><h2>Traceroute</h2>
<p>Is a diagnostic utility which displays the route and measures transit delays of
packets across an Internet protocol (IP) network.</p>
<pre><code class="language-bash">$ doas solo5-hvt --net:service=tap0 -- traceroute.hvt --ipv4=10.0.42.2/24 --ipv4-gateway=10.0.42.1 --host=198.167.222.207
| ___|
__| _ \ | _ \ __ \
\__ \ ( | | ( | ) |
____/\___/ _|\___/____/
Solo5: Bindings version v0.6.5
Solo5: Memory map: 512 MB addressable:
Solo5: reserved @ (0x0 - 0xfffff)
Solo5: text @ (0x100000 - 0x212fff)
Solo5: rodata @ (0x213000 - 0x24bfff)
Solo5: data @ (0x24c000 - 0x317fff)
Solo5: heap &gt;= 0x318000 &lt; stack &lt; 0x20000000
2020-06-22 15:41:25 -00:00: INF [netif] Plugging into service with mac 76:9b:36:e0:e5:74 mtu 1500
2020-06-22 15:41:25 -00:00: INF [ethernet] Connected Ethernet interface 76:9b:36:e0:e5:74
2020-06-22 15:41:25 -00:00: INF [ARP] Sending gratuitous ARP for 10.0.42.2 (76:9b:36:e0:e5:74)
2020-06-22 15:41:25 -00:00: INF [udp] UDP interface connected on 10.0.42.2
2020-06-22 15:41:25 -00:00: INF [application] 1 10.0.42.1 351us
2020-06-22 15:41:25 -00:00: INF [application] 2 192.168.42.1 1.417ms
2020-06-22 15:41:25 -00:00: INF [application] 3 192.168.178.1 1.921ms
2020-06-22 15:41:25 -00:00: INF [application] 4 88.72.96.1 16.716ms
2020-06-22 15:41:26 -00:00: INF [application] 5 *
2020-06-22 15:41:27 -00:00: INF [application] 6 92.79.215.112 16.794ms
2020-06-22 15:41:27 -00:00: INF [application] 7 145.254.2.215 21.305ms
2020-06-22 15:41:27 -00:00: INF [application] 8 145.254.2.217 22.05ms
2020-06-22 15:41:27 -00:00: INF [application] 9 195.89.99.1 21.088ms
2020-06-22 15:41:27 -00:00: INF [application] 10 62.115.9.133 20.105ms
2020-06-22 15:41:27 -00:00: INF [application] 11 213.155.135.82 30.861ms
2020-06-22 15:41:27 -00:00: INF [application] 12 80.91.246.200 30.716ms
2020-06-22 15:41:27 -00:00: INF [application] 13 80.91.253.163 28.315ms
2020-06-22 15:41:27 -00:00: INF [application] 14 62.115.145.27 30.436ms
2020-06-22 15:41:27 -00:00: INF [application] 15 80.67.4.239 42.826ms
2020-06-22 15:41:27 -00:00: INF [application] 16 80.67.10.147 47.213ms
2020-06-22 15:41:27 -00:00: INF [application] 17 198.167.222.207 48.598ms
Solo5: solo5_exit(0) called
</code></pre>
<p>This means with a traceroute utility you can investigate which route is taken
to a destination host, and what the round trip time(s) on the path are. The
sample output above is taken from a virtual machine on my laptop to the remote
host 198.167.222.207. You can see there are 17 hops between us, with the first
being my laptop with a tiny round trip time of 351us, the second and third are
using private IP addresses, and are my home network. The round trip time of the
fourth hop is much higher, this is the first hop on the other side of my DSL
modem. You can see various hops on the public Internet: the packets pass from
my Internet provider's backbone across some exchange points to the destination
Internet provider somewhere in Sweden.</p>
<p>The implementation of traceroute relies mainly on the time-to-live (ttl) field
(in IPv6 lingua it is &quot;hop limit&quot;) of IP packets, which is meant to avoid route
cycles that would infinitely forward IP packets in circles. Every router, when
forwarding an IP packet, first checks that the ttl field is greater than zero,
and then forwards the IP packet where the ttl is decreased by one. If the ttl
field is zero, instead of forwarding, an ICMP time exceeded packet is sent back
to the source.</p>
<p>Traceroute works by exploiting this mechanism: a series of IP packets with
increasing ttls is sent to the destination. Since upfront the length of the
path is unknown, it is a reactive system: first send an IP packet with a ttl of
one, if a ICMP time exceeded packet is returned, send an IP packet with a ttl of
two, etc. -- until an ICMP packet of type destination unreachable is received.
Since some hosts do not reply with a time exceeded message, it is crucial for
not getting stuck to use a timeout for each packet: when the timeout is reached,
an IP packet with an increased ttl is sent and an unknown for the ttl is
printed (see the fifth hop in the example above).</p>
<p>The packets send out are conventionally UDP packets without payload. From a
development perspective, one question is how to correlate the ICMP packet
with the sent UDP packet. Conveniently, ICMP packets contain the IP header and
the first eight bytes of the next protocol - the UDP header containing source
port, destination port, checksum, and payload length (each fields of size two
bytes). This means when we record the outgoing ports together with the sent
timestamp, and correlate the later received ICMP packet to the sent packet.
Great.</p>
<p>But as a functional programmer, let's figure whether we can abolish the
(globally shared) state. Since the ICMP packet contains the original IP
header and the first eight bytes of the UDP header, this is where we will
embed data. As described above, the data is the sent timestamp and the value
of the ttl field. For the latter, we can arbitrarily restrict it to 31 (5 bits).
For the timestamp, it is mainly a question about precision and maximum expected
round trip time. Taking the source and destination port are 32 bits, using 5 for
ttl, remaining are 27 bits (an unsigned value up to 134217727). Looking at the
decimal representation, 1 second is likely too small, 13 seconds are sufficient
for the round trip time measurement. This implies our precision is 100ns, by
counting the digits.</p>
<p>Finally to the code. First we need forth and back conversions between ports
and ttl, timestamp:</p>
<pre><code class="language-OCaml">(* takes a time-to-live (int) and timestamp (int64, nanoseconda), encodes them
into 16 bit source port and 16 bit destination port:
- the timestamp precision is 100ns (thus, it is divided by 100)
- use the bits 27-11 of the timestamp as source port
- use the bits 11-0 as destination port, and 5 bits of the ttl
*)
let ports_of_ttl_ts ttl ts =
let ts = Int64.div ts 100L in
let src_port = 0xffff land (Int64.(to_int (shift_right ts 11)))
and dst_port = 0xffe0 land (Int64.(to_int (shift_left ts 5))) lor (0x001f land ttl)
in
src_port, dst_port
(* inverse operation of ports_of_ttl_ts for the range (src_port and dst_port
are 16 bit values) *)
let ttl_ts_of_ports src_port dst_port =
let ttl = 0x001f land dst_port in
let ts =
let low = Int64.of_int (dst_port lsr 5)
and high = Int64.(shift_left (of_int src_port) 11)
in
Int64.add low high
in
let ts = Int64.mul ts 100L in
ttl, ts
</code></pre>
<p>They should be inverse over the range of valid input: ports are 16 bit numbers,
ttl expected to be at most 31, ts a int64 expressed in nanoseconds.</p>
<p>Related is the function to print out one hop and round trip measurement:</p>
<pre><code class="language-OCaml">(* write a log line of a hop: the number, IP address, and round trip time *)
let log_one now ttl sent ip =
let now = Int64.(mul (logand (div now 100L) 0x7FFFFFFL) 100L) in
let duration = Mtime.Span.of_uint64_ns (Int64.sub now sent) in
Logs.info (fun m -&gt; m &quot;%2d %a %a&quot; ttl Ipaddr.V4.pp ip Mtime.Span.pp duration)
</code></pre>
<p>The most logic is when a ICMP packet is received:</p>
<pre><code class="language-OCaml">module Icmp = struct
type t = {
send : int -&gt; unit Lwt.t ;
log : int -&gt; int64 -&gt; Ipaddr.V4.t -&gt; unit ;
task_done : unit Lwt.u ;
}
let connect send log task_done =
let t = { send ; log ; task_done } in
Lwt.return t
(* This is called for each received ICMP packet. *)
let input t ~src ~dst buf =
let open Icmpv4_packet in
(* Decode the received buffer (the IP header has been cut off already). *)
match Unmarshal.of_cstruct buf with
| Error s -&gt;
Lwt.fail_with (Fmt.strf &quot;ICMP: error parsing message from %a: %s&quot; Ipaddr.V4.pp src s)
| Ok (message, payload) -&gt;
let open Icmpv4_wire in
(* There are two interesting cases: Time exceeded (-&gt; send next packet),
and Destination (port) unreachable (-&gt; we reached the final host and can exit) *)
match message.ty with
| Time_exceeded -&gt;
(* Decode the payload, which should be an IPv4 header and a protocol header *)
begin match Ipv4_packet.Unmarshal.header_of_cstruct payload with
| Ok (pkt, off) when
(* Ensure this packet matches our sent packet: the protocol is UDP
and the destination address is the host we're tracing *)
pkt.Ipv4_packet.proto = Ipv4_packet.Marshal.protocol_to_int `UDP &amp;&amp;
Ipaddr.V4.compare pkt.Ipv4_packet.dst (Key_gen.host ()) = 0 -&gt;
let src_port = Cstruct.BE.get_uint16 payload off
and dst_port = Cstruct.BE.get_uint16 payload (off + 2)
in
(* Retrieve ttl and sent timestamp, encoded in the source port and
destination port of the UDP packet we sent, and received back as
ICMP payload. *)
let ttl, sent = ttl_ts_of_ports src_port dst_port in
(* Log this hop. *)
t.log ttl sent src;
(* Sent out the next UDP packet with an increased ttl. *)
let ttl' = succ ttl in
Logs.debug (fun m -&gt; m &quot;ICMP time exceeded from %a to %a, now sending with ttl %d&quot;
Ipaddr.V4.pp src Ipaddr.V4.pp dst ttl');
t.send ttl'
| Ok (pkt, _) -&gt;
(* Some stray ICMP packet. *)
Logs.debug (fun m -&gt; m &quot;unsolicited time exceeded from %a to %a (proto %X dst %a)&quot;
Ipaddr.V4.pp src Ipaddr.V4.pp dst pkt.Ipv4_packet.proto Ipaddr.V4.pp pkt.Ipv4_packet.dst);
Lwt.return_unit
| Error e -&gt;
(* Decoding error. *)
Logs.warn (fun m -&gt; m &quot;couldn't parse ICMP time exceeded payload (IPv4) (%a -&gt; %a) %s&quot;
Ipaddr.V4.pp src Ipaddr.V4.pp dst e);
Lwt.return_unit
end
| Destination_unreachable when Ipaddr.V4.compare src (Key_gen.host ()) = 0 -&gt;
(* We reached the final host, and the destination port was not listened to *)
begin match Ipv4_packet.Unmarshal.header_of_cstruct payload with
| Ok (_, off) -&gt;
let src_port = Cstruct.BE.get_uint16 payload off
and dst_port = Cstruct.BE.get_uint16 payload (off + 2)
in
(* Retrieve ttl and sent timestamp. *)
let ttl, sent = ttl_ts_of_ports src_port dst_port in
(* Log the final hop. *)
t.log ttl sent src;
(* Wakeup the waiter task to exit the unikernel. *)
Lwt.wakeup t.task_done ();
Lwt.return_unit
| Error e -&gt;
(* Decoding error. *)
Logs.warn (fun m -&gt; m &quot;couldn't parse ICMP unreachable payload (IPv4) (%a -&gt; %a) %s&quot;
Ipaddr.V4.pp src Ipaddr.V4.pp dst e);
Lwt.return_unit
end
| ty -&gt;
Logs.debug (fun m -&gt; m &quot;ICMP unknown ty %s from %a to %a: %a&quot;
(ty_to_string ty) Ipaddr.V4.pp src Ipaddr.V4.pp dst
Cstruct.hexdump_pp payload);
Lwt.return_unit
end
</code></pre>
<p>Now, the remaining main unikernel is the module <code>Main</code>:</p>
<pre><code class="language-OCaml">module Main (R : Mirage_random.S) (M : Mirage_clock.MCLOCK) (Time : Mirage_time.S) (N : Mirage_net.S) = struct
module ETH = Ethernet.Make(N)
module ARP = Arp.Make(ETH)(Time)
module IPV4 = Static_ipv4.Make(R)(M)(ETH)(ARP)
module UDP = Udp.Make(IPV4)(R)
(* Global mutable state: the timeout task for a sent packet. *)
let to_cancel = ref None
(* Send a single packet with the given time to live. *)
let rec send_udp udp ttl =
(* This is called by the ICMP handler which successfully received a
time exceeded, thus we cancel the timeout task. *)
(match !to_cancel with
| None -&gt; ()
| Some t -&gt; Lwt.cancel t ; to_cancel := None);
(* Our hop limit is 31 - 5 bit - should be sufficient for most networks. *)
if ttl &gt; 31 then
Lwt.return_unit
else
(* Create a timeout task which:
- sleeps for --timeout interval
- logs an unknown hop
- sends another packet with increased ttl
*)
let cancel =
Lwt.catch (fun () -&gt;
Time.sleep_ns (Duration.of_ms (Key_gen.timeout ())) &gt;&gt;= fun () -&gt;
Logs.info (fun m -&gt; m &quot;%2d *&quot; ttl);
send_udp udp (succ ttl))
(function Lwt.Canceled -&gt; Lwt.return_unit | exc -&gt; Lwt.fail exc)
in
(* Assign this timeout task. *)
to_cancel := Some cancel;
(* Figure out which source and destination port to use, based on ttl
and current timestamp. *)
let src_port, dst_port = ports_of_ttl_ts ttl (M.elapsed_ns ()) in
(* Send packet via UDP. *)
UDP.write ~ttl ~src_port ~dst:(Key_gen.host ()) ~dst_port udp Cstruct.empty &gt;&gt;= function
| Ok () -&gt; Lwt.return_unit
| Error e -&gt; Lwt.fail_with (Fmt.strf &quot;while sending udp frame %a&quot; UDP.pp_error e)
(* The main unikernel entry point. *)
let start () () () net =
let cidr = Key_gen.ipv4 ()
and gateway = Key_gen.ipv4_gateway ()
in
let log_one = fun port ip -&gt; log_one (M.elapsed_ns ()) port ip
(* Create a task to wait on and a waiter to wakeup. *)
and t, w = Lwt.task ()
in
(* Setup network stack: ethernet, ARP, IPv4, UDP, and ICMP. *)
ETH.connect net &gt;&gt;= fun eth -&gt;
ARP.connect eth &gt;&gt;= fun arp -&gt;
IPV4.connect ~cidr ~gateway eth arp &gt;&gt;= fun ip -&gt;
UDP.connect ip &gt;&gt;= fun udp -&gt;
let send = send_udp udp in
Icmp.connect send log_one w &gt;&gt;= fun icmp -&gt;
(* The callback cascade for an incoming network packet. *)
let ethif_listener =
ETH.input
~arpv4:(ARP.input arp)
~ipv4:(
IPV4.input
~tcp:(fun ~src:_ ~dst:_ _ -&gt; Lwt.return_unit)
~udp:(fun ~src:_ ~dst:_ _ -&gt; Lwt.return_unit)
~default:(fun ~proto ~src ~dst buf -&gt;
match proto with
| 1 -&gt; Icmp.input icmp ~src ~dst buf
| _ -&gt; Lwt.return_unit)
ip)
~ipv6:(fun _ -&gt; Lwt.return_unit)
eth
in
(* Start the callback in a separate asynchronous task. *)
Lwt.async (fun () -&gt;
N.listen net ~header_size:Ethernet_wire.sizeof_ethernet ethif_listener &gt;|= function
| Ok () -&gt; ()
| Error e -&gt; Logs.err (fun m -&gt; m &quot;netif error %a&quot; N.pp_error e));
(* Send the initial UDP packet with a ttl of 1. This entails the domino
effect to receive ICMP packets, send out another UDP packet with ttl
increased by one, etc. - until a destination unreachable is received,
or the hop limit is reached. *)
send 1 &gt;&gt;= fun () -&gt;
t
end
</code></pre>
<p>The configuration (<code>config.ml</code>) for this unikernel is as follows:</p>
<pre><code class="language-OCaml">open Mirage
let host =
let doc = Key.Arg.info ~doc:&quot;The host to trace.&quot; [&quot;host&quot;] in
Key.(create &quot;host&quot; Arg.(opt ipv4_address (Ipaddr.V4.of_string_exn &quot;141.1.1.1&quot;) doc))
let timeout =
let doc = Key.Arg.info ~doc:&quot;Timeout (in millisecond)&quot; [&quot;timeout&quot;] in
Key.(create &quot;timeout&quot; Arg.(opt int 1000 doc))
let ipv4 =
let doc = Key.Arg.info ~doc:&quot;IPv4 address&quot; [&quot;ipv4&quot;] in
Key.(create &quot;ipv4&quot; Arg.(required ipv4 doc))
let ipv4_gateway =
let doc = Key.Arg.info ~doc:&quot;IPv4 gateway&quot; [&quot;ipv4-gateway&quot;] in
Key.(create &quot;ipv4-gateway&quot; Arg.(required ipv4_address doc))
let main =
let packages = [
package ~sublibs:[&quot;ipv4&quot;; &quot;udp&quot;; &quot;icmpv4&quot;] &quot;tcpip&quot;;
package &quot;ethernet&quot;;
package &quot;arp-mirage&quot;;
package &quot;mirage-protocols&quot;;
package &quot;mtime&quot;;
] in
foreign
~keys:[Key.abstract ipv4 ; Key.abstract ipv4_gateway ; Key.abstract host ; Key.abstract timeout]
~packages
&quot;Unikernel.Main&quot;
(random @-&gt; mclock @-&gt; time @-&gt; network @-&gt; job)
let () =
register &quot;traceroute&quot;
[ main $ default_random $ default_monotonic_clock $ default_time $ default_network ]
</code></pre>
<p>And voila, that's all the code. If you copy it together (or download the two
files from <a href="https://github.com/roburio/traceroute">the GitHub repository</a>),
and have OCaml, opam, and <a href="https://mirage.io/wiki/install">mirage (&gt;= 3.8.0)</a> installed,
you should be able to:</p>
<pre><code class="language-bash">$ mirage configure -t hvt
$ make depend
$ make
$ solo5-hvt --net:service=tap0 -- traceroute.hvt ...
... get the output shown at top ...
</code></pre>
<p>Enhancements may be to use a different protocol (TCP? or any other protocol ID (may be used to encode more information), encode data into IPv4 ID, or the full 8 bytes of the upper protocol), encrypt/authenticate the data transmitted (and verify it has not been tampered with in the ICMP reply), improve error handling and recovery, send multiple packets for improved round trip time measurements, ...</p>
<p>If you develop enhancements you'd like to share, please sent a pull request to the git repository.</p>
<p>Motivation for this traceroute unikernel was while talking with <a href="https://twitter.com/networkservice">Aaron</a> and <a href="https://github.com/phaer">Paul</a>, who contributed several patches to the IP stack which pass the ttl through.</p>
<p>If you want to support our work on MirageOS unikernels, please <a href="https://robur.coop/Donate">donate to robur</a>. I'm interested in feedback, either via <a href="https://twitter.com/h4nnes">twitter</a>, <a href="https://mastodon.social/@hannesm">hannesm@mastodon.social</a> or via eMail.</p>
</article></div></div></main></body></html>

279
Posts/VMM Normal file
View file

@ -0,0 +1,279 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Albatross - provisioning, deploying, managing, and monitoring virtual machines</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="Albatross - provisioning, deploying, managing, and monitoring virtual machines" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="post"><h2>Albatross - provisioning, deploying, managing, and monitoring virtual machines</h2><span class="author">Written by hannes</span><br/><div class="tags">Classified under: <a href="/tags/mirageos" class="tag">mirageos</a><a href="/tags/deployment" class="tag">deployment</a><a href="/tags/provisioning" class="tag">provisioning</a></div><span class="date">Published: 2017-07-10 (last updated: 2021-11-19)</span><article><h2>How to deploy unikernels?</h2>
<p>MirageOS has a pretty good story on how to compose your OCaml libraries into a
virtual machine image. The <code>mirage</code> command line utility contains all the
knowledge about which backend requires which library. This enables it to write a
unikernel using abstract interfaces (such as a network device). Additionally the
<code>mirage</code> utility can compile for any backend. (It is still unclear whether this
is a sustainable idea, since the <code>mirage</code> tool needs to be adjusted for every
new backend, but also for additional implementations of an interface.)</p>
<p>Once a virtual machine image has been created, it needs to be deployed. I run
my own physical hardware, with all the associated upsides and downsides.
Specifically I run several physical <a href="https://freebsd.org">FreeBSD</a> machines on
the Internet, and use the <a href="http://bhyve.org">bhyve</a> hypervisor with MirageOS as
described <a href="/Posts/Solo5">earlier</a>. Recently, Martin
Lucina
<a href="https://github.com/Solo5/solo5/pull/171/commits/e67a007b75fa3fcee5c082aab04c9fe9e897d779">developed</a>
a
<a href="https://svnweb.freebsd.org/base/head/sys/amd64/include/vmm.h?view=markup"><code>vmm</code></a>
backend for <a href="https://github.com/solo5/solo5">Solo5</a>. This means there is no
need to use virtio anymore, or grub2-bhyve, or the bhyve binary (which links
<code>libvmmapi</code> that already had a <a href="https://www.freebsd.org/security/advisories/FreeBSD-SA-16:38.bhyve.asc">security
advisory</a>).
Instead of the bhyve binary, a ~70kB small <code>ukvm-bin</code> binary (dynamically
linking libc) can be used which is the solo5 virtual machine monitor on the host
side.</p>
<p>Until now, I manually created and deployed virtual machines using shell scripts,
ssh logins, and a network file system shared with the FreeBSD virtual machine
which builds my MirageOS unikernels.</p>
<p>But there are several drawbacks with this approach, the biggest is that sharing
resources is hard - to enable a friend to run their unikernel on my server,
they'll need to have a user account, and even privileged permissions to
create virtual network interfaces and execute virtual machines.</p>
<p>To get rid of these ad-hoc shell scripts and copying of virtual machine images,
I developed an UNIX daemon which accomplishes the required work. This daemon
waits for (mutually!) authenticated network connections, and provides the
desired commands; to create a new virtual machine, to acquire a block device of
a given size, to destroy a virtual machine, to stream the console output of a
virtual machine.</p>
<h2>System design</h2>
<p>The system bears minimalistic characteristics. The single interface to the
outside world is a TLS stream over TCP. Internally, there is a family of
processes, one of which has superuser privileges, communicating via unix domain
sockets. The processes do not need any persistent storage (apart from the
revocation lists). A brief enumeration of the processes is provided below:</p>
<ul>
<li><code>vmmd</code> (superuser privileges), which terminates TLS sessions, proxies messages, and creates and destroys virtual machines (including setup and teardown of network interfaces and virtual block devices)
</li>
<li><code>vmm_stats</code> periodically gathers resource usage and network interface statistics
</li>
<li><code>vmm_console</code> reads console output of every provided fifo, and stores this in a ringbuffer, replaying to a client on demand
</li>
<li><code>vmm_log</code> consumes the event log (login, starting, and stopping of virtual machines)
</li>
</ul>
<p>The system uses X.509 certificates as tokens. These are authenticated key value
stores. There are four shapes of certificates: a <em>virtual machine certificate</em>
which embeds the entire virtual machine image, together with configuration
information (resource usage, how many and which network interfaces, block device
access); a <em>command certificate</em> (for interactive use, allowing (a subset of)
commands such as attaching to console output); a <em>revocation certificate</em> which
contains a list of revoked certificates; and a <em>delegation certificate</em> to
distribute resources to someone else (an intermediate CA certificate).</p>
<p>The resources which can be controlled are CPUs, memory consumption, block
storage, and access to bridge interfaces (virtual switches) - encoded in the
virtual machine and delegation certificates. Additionally, delegation
certificates can limit the number of virtual machines.</p>
<p>Leveraging the X.509 system ensures that the client always has to present a
certificate chain from the root certificate. Each intermediate certificate is a
delegation certificate, which may further restrict resources. The serial
numbers of the chain is used as unique identifier for each virtual machine and
other certificates. The chain restricts access of the leaf certificate as well:
only the subtree of the chain can be viewed. E.g. if there are delegations to
both Alice and Bob from the root certificate, they can not see each other
virtual machines.</p>
<p>Connecting to the vmmd requires a TLS client, a CA certificate, a leaf
certificate (and the delegation chain) and its private key. In the background,
it is a multi-step process using TLS: first, the client establishes a TLS
connection where it authenticates the server using the CA certificate, then the
server demands a TLS renegotiation where it requires the client to authenticate
with its leaf certificate and private key. Using renegotiation over the
encrypted channel prevents passive observers to see the client certificate in
clear.</p>
<p>Depending on the leaf certificate, the server logic is slightly different. A
command certificate opens an interactive session where - depending on
permissions encoded in the certificate - different commands can be issued: the
console output can be streamed, the event log can be viewed, virtual machines
can be destroyed, statistics can be collected, and block devices can be managed.</p>
<p>When a virtual machine certificate is presented, the desired resource usage is
checked against the resource policies in the delegation certificate chain and
the currently running virtual machines. If sufficient resources are free, the
embedded virtual machine is started. In addition to other resource information,
a delegation certificate may embed IP usage, listing the network configuration
(gateway and netmask), and which addresses you're supposed to use. Boot
arguments can be encoded in the certificate as well, they are just passed to the
virtual machine (for easy deployment of off-the-shelf systems).</p>
<p>If a revocation certificate is presented, the embodied revocation list is
verified, and stored on the host system. Revocation is enforced by destroying
any revoked virtual machines and terminating any revoked interactive sessions.
If a delegation certificate is revoked, additionally the connected block devices
are destroyed.</p>
<p>The maximum size of a virtual machine image embedded into a X.509 certificate
transferred over TLS is 2 ^ 24 - 1 bytes, roughly 16 MB. If this turns out to
be not sufficient, compression may help. Or staging of deployment.</p>
<h2>An example</h2>
<p>Instructions on how to setup <code>vmmd</code> and the certificate authority are in the
README file of the <a href="https://github.com/hannesm/albatross"><code>albatross</code> git repository</a>. Here
is some (stripped) terminal output:</p>
<pre><code class="language-bash">&gt; openssl x509 -text -noout -in admin.pem
Certificate:
Data:
Serial Number: b7:aa:77:f6:ca:08:ee:6a
Signature Algorithm: sha256WithRSAEncryption
Issuer: CN=dev
Subject: CN=admin
X509v3 extensions:
1.3.6.1.4.1.49836.42.42: ....
1.3.6.1.4.1.49836.42.0: ...
&gt; openssl asn1parse -in admin.pem
403:d=4 hl=2 l= 18 cons: SEQUENCE
405:d=5 hl=2 l= 10 prim: OBJECT :1.3.6.1.4.1.49836.42.42
417:d=5 hl=2 l= 4 prim: OCTET STRING [HEX DUMP]:03020780
423:d=4 hl=2 l= 17 cons: SEQUENCE
425:d=5 hl=2 l= 10 prim: OBJECT :1.3.6.1.4.1.49836.42.0
437:d=5 hl=2 l= 3 prim: OCTET STRING [HEX DUMP]:020100
&gt; openssl asn1parse -in hello.pem
410:d=4 hl=2 l= 18 cons: SEQUENCE
412:d=5 hl=2 l= 10 prim: OBJECT :1.3.6.1.4.1.49836.42.42
424:d=5 hl=2 l= 4 prim: OCTET STRING [HEX DUMP]:03020520
430:d=4 hl=2 l= 18 cons: SEQUENCE
432:d=5 hl=2 l= 10 prim: OBJECT :1.3.6.1.4.1.49836.42.5
444:d=5 hl=2 l= 4 prim: OCTET STRING [HEX DUMP]:02020200
450:d=4 hl=2 l= 17 cons: SEQUENCE
452:d=5 hl=2 l= 10 prim: OBJECT :1.3.6.1.4.1.49836.42.6
464:d=5 hl=2 l= 3 prim: OCTET STRING [HEX DUMP]:020101
469:d=4 hl=5 l=3054024 cons: SEQUENCE
474:d=5 hl=2 l= 10 prim: OBJECT :1.3.6.1.4.1.49836.42.9
486:d=5 hl=5 l=3054007 prim: OCTET STRING [HEX DUMP]:A0832E99B204832E99AD7F454C46
</code></pre>
<p>The MirageOS private enterprise number is 1.3.6.1.4.1.49836, I use the arc 42
here. I use 0 as version (an integer), where 0 is the current version.</p>
<p>42 is a bit string representing the permissions. 5 the amount of memory, 6 the
CPU id, and 9 finally the virtual machine image (as ELF binary). If you're
eager to see more, look into the <code>Vmm_asn</code> module.</p>
<p>Using a command certificate establishes an interactive session where you can
review the event log, see all currently running virtual machines, or attach to
the console (which is then streamed, if new console output appears while the
interactive session is active, you'll be notified). The <code>db</code> file is used to
translate between the internal names (mentioned above, hashed serial numbers) to
common names of the certificates - both on command input (<code>attach hello</code>) and
output.</p>
<pre><code class="language-bash">&gt; vmm_client cacert.pem admin.bundle admin.key localhost:1025 --db dev.db
$ info
info sn.nqsb.io: 'cpuset' '-l' '7' '/tmp/vmm/ukvm-bin.net' '--net=tap27' '--' '/tmp/81363f.0237f3.img' 91540 taps tap27
info nqsbio: 'cpuset' '-l' '5' '/tmp/vmm/ukvm-bin.net' '--net=tap26' '--' '/tmp/81363f.43a0ff.img' 91448 taps tap26
info marrakesh: 'cpuset' '-l' '4' '/tmp/vmm/ukvm-bin.net' '--net=tap25' '--' '/tmp/81363f.cb53e2.img' 91368 taps tap25
info tls.nqsb.io: 'cpuset' '-l' '9' '/tmp/vmm/ukvm-bin.net' '--net=tap28' '--' '/tmp/81363f.ec692e.img' 91618 taps tap28
$ log
log: 2017-07-10 09:43:39 +00:00: marrakesh LOGIN 128.232.110.109:43142
log: 2017-07-10 09:43:39 +00:00: marrakesh STARTED 91368 (tap tap25, block no)
log: 2017-07-10 09:43:51 +00:00: nqsbio LOGIN 128.232.110.109:44663
log: 2017-07-10 09:43:51 +00:00: nqsbio STARTED 91448 (tap tap26, block no)
log: 2017-07-10 09:44:07 +00:00: sn.nqsb.io LOGIN 128.232.110.109:38182
log: 2017-07-10 09:44:07 +00:00: sn.nqsb.io STARTED 91540 (tap tap27, block no)
log: 2017-07-10 09:44:21 +00:00: tls.nqsb.io LOGIN 128.232.110.109:11178
log: 2017-07-10 09:44:21 +00:00: tls.nqsb.io STARTED 91618 (tap tap28, block no)
log: 2017-07-10 09:44:25 +00:00: hannes LOGIN 128.232.110.109:24207
success
$ attach hello
console hello: 2017-07-09 18:44:52 +00:00 | ___|
console hello: 2017-07-09 18:44:52 +00:00 __| _ \ | _ \ __ \
console hello: 2017-07-09 18:44:52 +00:00 \__ \ ( | | ( | ) |
console hello: 2017-07-09 18:44:52 +00:00 ____/\___/ _|\___/____/
console hello: 2017-07-09 18:44:52 +00:00 Solo5: Memory map: 512 MB addressable:
console hello: 2017-07-09 18:44:52 +00:00 Solo5: unused @ (0x0 - 0xfffff)
console hello: 2017-07-09 18:44:52 +00:00 Solo5: text @ (0x100000 - 0x1e4fff)
console hello: 2017-07-09 18:44:52 +00:00 Solo5: rodata @ (0x1e5000 - 0x217fff)
console hello: 2017-07-09 18:44:52 +00:00 Solo5: data @ (0x218000 - 0x2cffff)
console hello: 2017-07-09 18:44:52 +00:00 Solo5: heap &gt;= 0x2d0000 &lt; stack &lt; 0x20000000
console hello: 2017-07-09 18:44:52 +00:00 STUB: getenv() called
console hello: 2017-07-09 18:44:52 +00:00 2017-07-09 18:44:52 -00:00: INF [application] hello
console hello: 2017-07-09 18:44:53 +00:00 2017-07-09 18:44:53 -00:00: INF [application] hello
console hello: 2017-07-09 18:44:54 +00:00 2017-07-09 18:44:54 -00:00: INF [application] hello
console hello: 2017-07-09 18:44:55 +00:00 2017-07-09 18:44:55 -00:00: INF [application] hello
</code></pre>
<p>If you use a virtual machine certificate, depending on allowed resource the
virtual machine is started or not:</p>
<pre><code class="language-bash">&gt; vmm_client cacert.pem hello.bundle hello.key localhost:1025
success VM started
</code></pre>
<h2>Sharing is caring</h2>
<p>Deploying unikernels is now easier for myself on my physical machine. That's
fine. Another aspect comes <em>for free</em> by reusing X.509: further delegation (and
limiting thereof). Within a delegation certificate, the basic constraints
extension must be present which marks this certificate as a CA certificate.
This may as well contain a path length - how many other delegations may follow -
or whether the resources may be shared further.</p>
<p>If I delegate 2 virtual machines and 2GB of memory to Alice, and allow an
arbitrary path length, she can issue tokens to her friend Carol and Dan, each up
to 2 virtual machines and 2 GB memory (but also less -- within the X.509 system
even more, but vmmd will reject any resource increase in the chain) - who can
further delegate to Eve, .... Carol and Dan won't know of each other,
and vmmd will only start up to 2 virtual machines using 2GB of memory in total
(sum of Alice, Carol, and Dan deployed virtual machines). Alice may revoke any
issued delegation (using a revocation certificate described above) to free up
some resources for herself. I don't need to interact when Alice or Dan share
their delegated resources further.</p>
<h2>Security</h2>
<p>There are several security properties preserved by <code>vmmd</code>, such as the virtual
machine image is never transmitted in clear. Only properly authenticated
clients can create, destroy, gather statistics of <em>their</em> virtual machines.</p>
<p>Two disjoint paths in the delegation tree are not able to discover anything
about each other (apart from caches, which depend on how CPUs are delegated and
their concrete physical layout). Only smaller amounts of resources can be
delegated further down. Each running virtual machine image is strongly isolated
from all other virtual machines.</p>
<p>As mentioned in the last section, delegations of delegations may end up in the
hands of malicious people. Vmmd limits delegations to allocate resources on the
host system, namely bridges and file systems. Only top delegations - directly
signed by the certificate authority - create bridge interfaces (which are
explicitly named in the certificate) and file systems (one zfs for each top
delegation (to allow easy snapshots and backups)).</p>
<p>The threat model is that clients have layer 2 access to the hosts network
interface card, and all guests share a single bridge (if this turns out to be a
problem, there are ways to restrict to a point-to-point interface with routed IP
addresses). A malicious virtual machine can try to hijack ethernet and IP
addresses.</p>
<p>Possible DoS scenarios include also to spawn VMs very fast (which immediately
crash) or generating a lot of console output. Both is indirectly handled by the
control channel: to create a virtual machine image, you need to setup a TLS
connection (with two handshakes) and transfer the virtual machine image (there
is intentionally no &quot;respawn on quit&quot; option). The console output is read by a
single process with user privileges (in the future there may be one console
reading process for each top delegation). It may further be rate limited as
well. The console stream is only ever sent to a single session, as soon as
someone attaches to the console in one session, all other sessions have this
console detached (and are notified about that).</p>
<p>The control channel itself can be rate limited using the host system firewall.</p>
<p>The only information persistently stored on a block device are the certificate
revocation lists - virtual machine images, FIFOs, unix domain sockets are all
stored in a memory-backed file system. A virtual machine with a lots of disk
operation may only delay or starve revocation list updates - if this turns out
to be a problem, the solution may be to use separate physical block devices for
the revocation lists and virtual block devices for clients.</p>
<h2>Conclusion</h2>
<p>I showed a minimalistic system to provision, deploy, and manage virtual machine
images. It also allows to delegate resources (CPU, disk, ..) further. I'm
pretty satisfied with the security properties of the system.</p>
<p>The system embeds all data (configuration, resource policies, virtual machine
images) into X.509 certificates, and does not rely on an external file transfer
protocol. An advantage thereof is that all deployed images have been signed
with a private key.</p>
<p>All communication between the processes and between the client and the server
use a wire protocol, with structured input and output - this enables more
advanced algorithms (e.g. automated scaling) and fancier user interfaces than
the currently provided terminal based one.</p>
<p>The delegation mechanism allows to actually share computing resources in a
decentralised way - without knowing the final recipient. Revocation is builtin,
which can at any point delete access of a subtree or individual virtual machine
to the system. Instead of requesting revocation lists during the handshake,
they are pushed explicitly by the (sub)CA revoking a certificate.</p>
<p>While this system was designed for a physical server, it should be
straightforward to develop a Google compute engine / EC2 backend which extracts
the virtual machine image, commands, etc. from the certificate and deploys it to
your favourite cloud provider. A virtual machine image itself is only
processor-specific, and should be portable between different hypervisors - being
it FreeBSD and VMM, Linux and KVM, or MacOSX and Hypervisor.Framework.</p>
<p>The code is available <a href="https://github.com/hannesm/albatross">on GitHub</a>. If you want
to deploy your unikernel on my hardware, please send me a certificate signing
request. I'm interested in feedback, either via
<a href="https://twitter.com/h4nnes">twitter</a> or open issues in the repository. This
article itself is stored <a href="https://git.robur.io/hannes/hannes.robur.coop">in a different
repository</a> (in case you have typo or
grammatical corrections).</p>
<p>I'm very thankful to people who gave feedback on earlier versions of this
article, and who discussed the system design with me. These are Addie, Chris,
Christiano, Joe, mato, Mindy, Mort, and sg.</p>
</article></div></div></main></body></html>

54
Posts/X50907 Normal file
View file

@ -0,0 +1,54 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>X509 0.7</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="X509 0.7" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="post"><h2>X509 0.7</h2><span class="author">Written by hannes</span><br/><div class="tags">Classified under: <a href="/tags/mirageos" class="tag">mirageos</a><a href="/tags/security" class="tag">security</a><a href="/tags/tls" class="tag">tls</a></div><span class="date">Published: 2019-08-15 (last updated: 2021-11-19)</span><article><h2>Cryptographic material</h2>
<p>Once a private and public key pair is generated (doesn't matter whether it is plain RSA, DSA, ECC on any curve), this is fine from a scientific point of view, and can already be used for authenticating and encrypting. From a practical point of view, the public parts need to be exchanged and verified (usually a fingerprint or hash thereof). This leads to the struggle how to encode this cryptographic material, and how to embed an identity (or multiple), capabilities, and other information into it. <a href="https://en.wikipedia.org/wiki/X.509">X.509</a> is a standard to solve this encoding and embedding, and provides more functionality, such as establishing chains of trust and revocation of invalidated or compromised material. X.509 uses certificates, which contain the public key, and additional information (in a extensible key-value store), and are signed by an issuer, either the private key corresponding to the public key - a so-called self-signed certificate - or by a different private key, an authority one step up the chain. A rather long, but very good introduction to certificates by Mike Malone is <a href="https://smallstep.com/blog/everything-pki.html">available here</a>.</p>
<h2>OCaml ecosystem evolving</h2>
<p>More than 5 years ago David Kaloper and I <a href="https://mirage.io/blog/introducing-x509">released the initial ocaml-x509</a> package as part of our <a href="https://nqsb.io">TLS stack</a>, which contained code for decoding and encoding certificates, and path validation of a certificate chain (as described in <a href="https://tools.ietf.org/html/rfc6125">RFC 5280</a>). The validation logic and the decoder/encoder, based on the ASN.1 grammar specified in the RFC, implemented using David's <a href="https://github.com/mirleft/ocaml-asn1-combinators">asn1-combinators</a> library changed much over time.</p>
<p>The OCaml ecosystem evolved over the years, which lead to some changes:</p>
<ul>
<li>Camlp4 deprecation - we used camlp4 for stream parsers of PEM-encoded certificates, and sexplib.syntax to derive s-expression decoders and encoders;
</li>
<li>Avoiding brittle ppx converters - which we used for s-expression decoders and encoders of certificates after camlp4 was deprecated;
</li>
<li>Build and release system iterations - initially oasis and a packed library, then topkg and ocamlbuild, now dune;
</li>
<li>Introduction of the <code>result</code> type in the standard library - we used to use <code>[ `Ok of certificate option | `Fail of failure ]</code>;
</li>
<li>No more leaking exceptions in the public API;
</li>
<li>Usage of pretty-printers, esp with the <a href="https://erratique.ch/software/fmt">fmt</a> library <code>val pp : Format.formatter -&gt; 'a -&gt; unit</code>, instead of <code>val to_string : t -&gt; string</code> functions;
</li>
<li>Release of <a href="https://erratique.ch/software/ptime">ptime</a>, a platform-independent POSIX time support;
</li>
<li>Release of <a href="https://erratique.ch/software/rresult">rresult</a>, which includes combinators for computation <code>result</code>s;
</li>
<li>Release of <a href="https://github.com/hannesm/gmap">gmap</a>, a <code>Map</code> whose value types depend on the key, used for X.509 extensions, GeneralName, DistinguishedName, etc.;
</li>
<li>Release of <a href="https://github.com/hannesm/domain-name">domain-name</a>, a library for domain name operations (as specified in <a href="https://tools.ietf.org/html/rfc1035">RFC 1035</a>) - used for name validation;
</li>
<li>Usage of the <a href="https://github.com/mirage/alcotest">alcotest</a> unit testing framework (instead of oUnit).
</li>
</ul>
<h2>More use cases for X.509</h2>
<p>Initially, we designed and used ocaml-x509 for providing TLS server endpoints and validation in TLS clients - mostly on the public web, where each operating system ships a set of ~100 trust anchors to validate any web server certificate against. But once you have a X.509 implementation, every authentication problem can be solved by applying it.</p>
<h3>Authentication with path building</h3>
<p>It turns out that the trust anchor sets are not equal across operating systems and versions, thus some web servers serve sets, instead of chains, of certificates - as described in <a href="https://tools.ietf.org/html/rfc4158">RFC 4158</a>, where the client implementation needs to build valid paths and accept a connection if any path can be validated. The path building was initially in 0.5.2 slightly wrong, but fixed quickly in <a href="https://github.com/mirleft/ocaml-x509/commit/1a1476308d24bdcc49d45c4cd9ef539ca57461d2">0.5.3</a>.</p>
<h3>Fingerprint authentication</h3>
<p>The chain of trust validation is useful for the open web, where you as software developer don't know to which remote endpoint your software will ever connect to - as long as the remote has a certificate signed (via intermediates) by any of the trust anchors. In the early days, before <a href="https://letsencrypt.org/">let's encrypt</a> was launched and embedded as trust anchors (or cross-signed by already deployed trust anchors), operators needed to pay for a certificate - a business model where some CAs did not bother to check the authenticity of a certificate signing request, and thus random people owning valid certificates for microsoft.com or google.com.</p>
<p>Instead of using the set of trust anchors, the fingerprint of the server certificate, or preferably the fingerprint of the public key of the certificate, can be used for authentication, as optionally done since some years in <a href="https://github.com/hannesm/jackline/commit/a1e6f3159be1e45e6b690845e1b29366c41239a2">jackline</a>, an XMPP client. Support for this certificate / public key pinning was added in x509 0.2.1 / 0.5.0.</p>
<h3>Certificate signing requests</h3>
<p>Until x509 0.4.0 there was no support for generating certificate signing requests (CSR), as defined in PKCS 10, which are self-signed blobs containing a public key, an identity, and possibly extensions. Such as CSR is sent to the certificate authority, and after validation of ownership of the identity and paying a fee, the certificate is issued. Let's encrypt specified the ACME protocol which automates the proof of ownership: they provide a HTTP API for requesting a challenge, providing the response (the proof of ownership) via HTTP or DNS, and then allow the submission of a CSR and downloading the signed certificate. The ocaml-x509 library provides operations for creating such a CSR, and also for signing a CSR to generate a certificate.</p>
<p>Mindy developed the command-line utility <a href="https://github.com/yomimono/ocaml-certify/">certify</a> which uses these operations from the ocaml-x509 library and acts as a swiss-army knife purely in OCaml for these required operations.</p>
<p>Maker developed a <a href="https://github.com/mmaker/ocaml-letsencrypt">let's encrypt library</a> which implements the above mentioned ACME protocol for provisioning CSR to certificates, also using our ocaml-x509 library.</p>
<p>To complete the required certificate authority functionality, in x509 0.6.0 certificate revocation lists, both validation and signing, was implemented.</p>
<h3>Deploying unikernels</h3>
<p>As <a href="/Posts/VMM">described in another post</a>, I developed <a href="https://github.com/hannesm/albatross">albatross</a>, an orchestration system for MirageOS unikernels. This uses ASN.1 for internal socket communication and allows remote management via a TLS connection which is mutually authenticated with a X.509 client certificate. To encrypt the X.509 client certificate, first a TLS handshake where the server authenticates itself to the client is established, and over that connection another TLS handshake is established where the client certificate is requested. Note that this mechanism can be dropped with TLS 1.3, since there the certificates are transmitted over an already encrypted channel.</p>
<p>The client certificate already contains the command to execute remotely - as a custom extension, being it &quot;show me the console output&quot;, or &quot;destroy the unikernel with name = YYY&quot;, or &quot;deploy the included unikernel image&quot;. The advantage is that the commands are already authenticated, and there is no need for developing an ad-hoc protocol on top of the TLS session. The resource limits, assigned by the authority, are also part of the certificate chain - i.e. the number of unikernels, access to network bridges, available accumulated memory, accumulated size for block devices, are constrained by the certificate chain presented to the server, and currently running unikernels. The names of the chain are used for access control - if Alice and Bob have intermediate certificates from the same CA, neither Alice may manage Bob's unikernels, nor Bob may manage Alice's unikernels. I'm using albatross since 2.5 years in production on two physical machines with ~20 unikernels total (multiple users, multiple administrative domains), and it works stable and is much nicer to deal with than <code>scp</code> and custom hacked shell scripts.</p>
<h2>Why 0.7?</h2>
<p>There are still some missing pieces in our ocaml-x509 implementation, namely modern ECC certificates (depending on elliptic curve primitives not yet available in OCaml), RSA-PSS signing (should be straightforward), PKCS 12 (there is a <a href="https://github.com/mirleft/ocaml-x509/pull/114">pull request</a>, but this should wait until asn1-combinators supports the <code>ANY defined BY</code> construct to cleanup the code), ...
Once these features are supported, the library should likely be named PKCS since it supports more than X.509, and released as 1.0.</p>
<p>The 0.7 release series moved a lot of modules and function names around, thus it is a major breaking release. By using a map instead of lists for extensions, GeneralName, ..., the API was further revised - invariants that each extension key (an ASN.1 object identifier) may occur at most once are now enforced. By not leaking exceptions through the public interface, the API is easier to use safely - see <a href="https://github.com/mmaker/ocaml-letsencrypt/commit/dc53518f46310f384c9526b1d96a8e8f815a09c7">let's encrypt</a>, <a href="https://git.robur.io/?p=openvpn.git;a=commitdiff;h=929c53116c1438ba1214f53df7506d32da566ccc">openvpn</a>, <a href="https://github.com/yomimono/ocaml-certify/pull/17">certify</a>, <a href="https://github.com/mirleft/ocaml-tls/pull/394">tls</a>, <a href="https://github.com/mirage/capnp-rpc/pull/158">capnp</a>, <a href="https://github.com/hannesm/albatross/commit/50ed6a8d1ead169b3e322aaccb469e870ad72acc">albatross</a>.</p>
<p>I intended in 0.7.0 to have much more precise types, esp. for the SubjectAlternativeName (SAN) extension that uses a GeneralName, but it turns out the GeneralName is as well used for NameConstraints (NC) in a different way -- IP in SAN is an IPv4 or IPv6 address, in CN it is the IP/netmask; DNS is a domain name in SAN, in CN it is a name starting with a leading dot (i.e. &quot;.example.com&quot;), which is not a valid domain name. In 0.7.1, based on a bug report, I had to revert these variants and use less precise types.</p>
<h2>Conclusion</h2>
<p>The work on X.509 was sponsored by <a href="http://ocamllabs.io/">OCaml Labs</a>. You can support our work at robur by a <a href="https://robur.io/Donate">donation</a>, which we will use to work on our OCaml and MirageOS projects. You can also reach out to us to realize commercial products.</p>
<p>I'm interested in feedback, either via <strike><a href="https://twitter.com/h4nnes">twitter</a></strike> <a href="https://mastodon.social/@hannesm">hannesm@mastodon.social</a> or via eMail.</p>
</article></div></div></main></body></html>

27
Posts/index.html Normal file
View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>full stack engineer</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="full stack engineer" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="flex-container"><div class="list-group listing"><a href="/Posts/OpamMirror" class="list-group-item"><h2 class="list-group-item-heading">Mirroring the opam repository and all tarballs</h2><span class="author">Written by hannes</span> <time>2022-09-29</time><br/><p class="list-group-item-text abstract"><p>Re-developing an opam cache from scratch, as a MirageOS unikernel</p>
</p></a><a href="/Posts/Monitoring" class="list-group-item"><h2 class="list-group-item-heading">All your metrics belong to influx</h2><span class="author">Written by hannes</span> <time>2022-03-08</time><br/><p class="list-group-item-text abstract"><p>How to monitor your MirageOS unikernel with albatross and monitoring-experiments</p>
</p></a><a href="/Posts/Deploy" class="list-group-item"><h2 class="list-group-item-heading">Deploying binary MirageOS unikernels</h2><span class="author">Written by hannes</span> <time>2021-06-30</time><br/><p class="list-group-item-text abstract"><p>Finally, we provide reproducible binary MirageOS unikernels together with packages to reproduce them and setup your own builder</p>
</p></a><a href="/Posts/EC" class="list-group-item"><h2 class="list-group-item-heading">Cryptography updates in OCaml and MirageOS</h2><span class="author">Written by hannes</span> <time>2021-04-23</time><br/><p class="list-group-item-text abstract"><p>Elliptic curves (ECDSA/ECDH) are supported in a maintainable and secure way.</p>
</p></a><a href="/Posts/NGI" class="list-group-item"><h2 class="list-group-item-heading">The road ahead for MirageOS in 2021</h2><span class="author">Written by hannes</span> <time>2021-01-25</time><br/><p class="list-group-item-text abstract"><p>Home office, MirageOS unikernels, 2020 recap, 2021 tbd</p>
</p></a><a href="/Posts/Traceroute" class="list-group-item"><h2 class="list-group-item-heading">Traceroute</h2><span class="author">Written by hannes</span> <time>2020-06-24</time><br/><p class="list-group-item-text abstract"><p>A MirageOS unikernel which traces the path between itself and a remote host.</p>
</p></a><a href="/Posts/DnsServer" class="list-group-item"><h2 class="list-group-item-heading">Deploying authoritative OCaml-DNS servers as MirageOS unikernels</h2><span class="author">Written by hannes</span> <time>2019-12-23</time><br/><p class="list-group-item-text abstract"><p>A tutorial how to deploy authoritative name servers, let's encrypt, and updating entries from unix services.</p>
</p></a><a href="/Posts/ReproducibleOPAM" class="list-group-item"><h2 class="list-group-item-heading">Reproducible MirageOS unikernel builds</h2><span class="author">Written by hannes</span> <time>2019-12-16</time><br/><p class="list-group-item-text abstract"><p>MirageOS unikernels are reproducible :)</p>
</p></a><a href="/Posts/X50907" class="list-group-item"><h2 class="list-group-item-heading">X509 0.7</h2><span class="author">Written by hannes</span> <time>2019-08-15</time><br/><p class="list-group-item-text abstract"><p>Five years since ocaml-x509 initial release, it has been reworked and used more widely</p>
</p></a><a href="/Posts/Summer2019" class="list-group-item"><h2 class="list-group-item-heading">Summer 2019</h2><span class="author">Written by hannes</span> <time>2019-07-08</time><br/><p class="list-group-item-text abstract"><p>Bringing MirageOS into production, take IV monitoring, CalDAV, DNS</p>
</p></a><a href="/Posts/Pinata" class="list-group-item"><h2 class="list-group-item-heading">The Bitcoin Piñata - no candy for you</h2><span class="author">Written by hannes</span> <time>2018-04-18</time><br/><p class="list-group-item-text abstract"><p>More than three years ago we launched our Bitcoin Piñata as a transparent security bait. It is still up and running!</p>
</p></a><a href="/Posts/DNS" class="list-group-item"><h2 class="list-group-item-heading">My 2018 contains robur and starts with re-engineering DNS</h2><span class="author">Written by hannes</span> <time>2018-01-11</time><br/><p class="list-group-item-text abstract"><p>New year brings new possibilities and a new environment. I've been working on the most Widely deployed key-value store, the domain name system. Primary and secondary name services are available, including dynamic updates, notify, and tsig authentication.</p>
</p></a><a href="/Posts/VMM" class="list-group-item"><h2 class="list-group-item-heading">Albatross - provisioning, deploying, managing, and monitoring virtual machines</h2><span class="author">Written by hannes</span> <time>2017-07-10</time><br/><p class="list-group-item-text abstract"><p>all we need is X.509</p>
</p></a><a href="/Posts/Conex" class="list-group-item"><h2 class="list-group-item-heading">Conex, establish trust in community repositories</h2><span class="author">Written by hannes</span> <time>2017-02-16</time><br/><p class="list-group-item-text abstract"><p>Conex is a library to verify and attest package release integrity and authenticity through the use of cryptographic signatures.</p>
</p></a><a href="/Posts/Maintainers" class="list-group-item"><h2 class="list-group-item-heading">Who maintains package X?</h2><span class="author">Written by hannes</span> <time>2017-02-16</time><br/><p class="list-group-item-text abstract"><p>We describe why manual gathering of metadata is out of date, and version control systems are awesome.</p>
</p></a><a href="/Posts/Jackline" class="list-group-item"><h2 class="list-group-item-heading">Jackline, a secure terminal-based XMPP client</h2><span class="author">Written by hannes</span> <time>2017-01-30</time><br/><p class="list-group-item-text abstract"><p>implement it once to know you can do it. implement it a second time and you get readable code. implementing it a third time from scratch may lead to useful libraries.</p>
</p></a><a href="/Posts/Syslog" class="list-group-item"><h2 class="list-group-item-heading">Exfiltrating log data using syslog</h2><span class="author">Written by hannes</span> <time>2016-11-05</time><br/><p class="list-group-item-text abstract"><p>sometimes preservation of data is useful</p>
</p></a><a href="/Posts/ARP" class="list-group-item"><h2 class="list-group-item-heading">Re-engineering ARP</h2><span class="author">Written by hannes</span> <time>2016-07-12</time><br/><p class="list-group-item-text abstract"><p>If you want it as you like, you've to do it yourself</p>
</p></a><a href="/Posts/Solo5" class="list-group-item"><h2 class="list-group-item-heading">Minimising the virtual machine monitor</h2><span class="author">Written by hannes</span> <time>2016-07-02</time><br/><p class="list-group-item-text abstract"><p>MirageOS solo5 multiboot native on bhyve</p>
</p></a><a href="/Posts/BottomUp" class="list-group-item"><h2 class="list-group-item-heading">Counting Bytes</h2><span class="author">Written by hannes</span> <time>2016-06-11</time><br/><p class="list-group-item-text abstract"><p>looking into dependencies and their sizes</p>
</p></a><a href="/Posts/Functoria" class="list-group-item"><h2 class="list-group-item-heading">Configuration DSL step-by-step</h2><span class="author">Written by hannes</span> <time>2016-05-10</time><br/><p class="list-group-item-text abstract"><p>how to actually configure the system</p>
</p></a><a href="/Posts/BadRecordMac" class="list-group-item"><h2 class="list-group-item-heading">Catch the bug, walking through the stack</h2><span class="author">Written by hannes</span> <time>2016-05-03</time><br/><p class="list-group-item-text abstract"><p>10BTC could've been yours</p>
</p></a><a href="/Posts/nqsbWebsite" class="list-group-item"><h2 class="list-group-item-heading">Fitting the things together</h2><span class="author">Written by hannes</span> <time>2016-04-24</time><br/><p class="list-group-item-text abstract"><p>building a simple website</p>
</p></a><a href="/Posts/OCaml" class="list-group-item"><h2 class="list-group-item-heading">Why OCaml</h2><span class="author">Written by hannes</span> <time>2016-04-17</time><br/><p class="list-group-item-text abstract"><p>a gentle introduction into OCaml</p>
</p></a><a href="/Posts/OperatingSystem" class="list-group-item"><h2 class="list-group-item-heading">Operating systems</h2><span class="author">Written by hannes</span> <time>2016-04-09</time><br/><p class="list-group-item-text abstract"><p>Operating systems and MirageOS</p>
</p></a></div></div></div></main></body></html>

194
Posts/nqsbWebsite Normal file
View file

@ -0,0 +1,194 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Fitting the things together</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="Fitting the things together" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="post"><h2>Fitting the things together</h2><span class="author">Written by hannes</span><br/><div class="tags">Classified under: <a href="/tags/mirageos" class="tag">mirageos</a><a href="/tags/http" class="tag">http</a><a href="/tags/tls" class="tag">tls</a><a href="/tags/protocol" class="tag">protocol</a></div><span class="date">Published: 2016-04-24 (last updated: 2021-11-19)</span><article><h2>Task</h2>
<p>Our task is to build a small unikernel which provides a project website. On our way we will wade through various layers using code examples. The website itself contains a few paragraphs of text, some link lists, and our published papers in pdf form.</p>
<p><em>Spoiler alert</em> final result can be seen <a href="https://nqsb.io">here</a>, the full code <a href="https://github.com/mirleft/nqsb.io">here</a>.</p>
<h2>A first idea</h2>
<p>We could go all the way to use <a href="https://github.com/mirage/ocaml-conduit">conduit</a> for wrapping connections, and <a href="https://github.com/mirage/mirage-http">mirage-http</a> (using <a href="https://github.com/mirage/ocaml-cohttp">cohttp</a>, a very lightweight HTTP server). We'd just need to write routing code which in the end reads from a virtual file system, and some HTML and CSS for the actual site.</p>
<p>Turns out, the conduit library is already 1.7 MB in size and depends on 34 libraries, cohttp is another 3.7 MB and 40 dependent libraries.
Both libraries are actively developed, combined there were 25 releases within the last year.</p>
<h2>Plan</h2>
<p>Let me state our demands more clearly:</p>
<ul>
<li>easy to maintain
</li>
<li>updates roughly 3 times a year
</li>
<li>reasonable performance
</li>
</ul>
<p>To achieve easy maintenance we keep build and run time dependencies small, use a single virtual machine image to ease deployment. We try to develop only little new code. Our general approach to performance is to do as little work as we can on each request, and precompute at compile time or once at startup as much as we can.</p>
<h3>HTML code</h3>
<p>From the <a href="http://ocsigen.org/tyxml/">tyxml description</a>: &quot;Tyxml provides a set of combinators to build Html5 and Svg documents. These combinators use the OCaml type-system to ensure the validity of the generated Html5 and Svg.&quot; A <a href="http://ocsigen.org/tyxml/dev/manual/intro">tutorial</a> is available.</p>
<p>You can plug elements (or attributes) inside each other only if the HTML specification allows this (no <code>&lt;body&gt;</code> inside of a <code>&lt;body&gt;</code>). An example that can be rendered to a <code>div</code> with <code>pcdata</code> inside.</p>
<p>If you use <code>utop</code> (as interactive read-eval-print-loop), you first need to load tyxml by <code>#require &quot;tyxml&quot;</code>.</p>
<pre><code class="language-OCaml">open Html5.M
let mycontent =
div ~a:[ a_class [&quot;content&quot;] ]
[ pcdata &quot;This is a fabulous content.&quot; ]
</code></pre>
<p>In the end, our web server will deliver the page as a string, tyxml provides the function <code>Html5.P.print : output:(string -&gt; unit) -&gt; doc -&gt; unit</code>. We use a temporary <code>Buffer</code> to print the document into.</p>
<pre><code class="language-OCaml"># let buf = Buffer.create 100
# Html5.P.print ~output:(Buffer.add_string buf) mycontent
Error: This expression has type ([&gt; Html5_types.div ] as 'a) elt but an expression was expected of type doc = [ `Html ] elt Type 'a = [&gt; `Div ] is not compatible with type [ `Html ]
The second variant type does not allow tag(s) `Div
</code></pre>
<p>This is pretty nice, we can only print complete HTML5 documents this way (there are printers for standalone elements as well), and will not be able to serve an incomplete page fragment!</p>
<p>To get it up and running, we wrap it inside of a <code>html</code> which has a <code>header</code> and a <code>body</code>:</p>
<pre><code class="language-OCaml"># Html5.P.print ~output:(Buffer.add_string buf) (html (head (title (pcdata &quot;title&quot;)) []) (body [ mycontent ]))
# Buffer.contents buf
&quot;&lt;!DOCTYPE html&gt;\n&lt;html xmlns=\&quot;http://www.w3.org/1999/xhtml\&quot;&gt;&lt;head&gt;&lt;title&gt;title&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;div class=\&quot;content\&quot;&gt;This is a fabulous content.&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;&quot;
</code></pre>
<p>The HTML content is done (in a pure way, no effects!), let's work on the binary pdfs.
Our full page source (CSS embedding is done via a string, no fancy types there (yet!?)) is <a href="https://github.com/mirleft/nqsb.io/blob/master/page.ml">on GitHub</a>. Below we will use the <code>render</code> function for our content:</p>
<pre><code class="language-OCaml">let render =
let buf = Buffer.create 500 in
Html5.P.print ~output:(Buffer.add_string buf) @@
html
(header &quot;not quite so broken&quot;)
(body [ mycontent ]) ;
Cstruct.of_string @@ Buffer.contents buf
</code></pre>
<h3>Binary data</h3>
<p>There are various ways how to embed binary data into MirageOS:</p>
<ul>
<li>connect an external (FAT) disk image; upside: works for large data, independent, can be shared with other systems; downside: an extra file to distribute onto the production machine, lots of code (block storage and file system access) which can contain directory traversals and other issues
</li>
<li>embed as a <a href="https://github.com/mirage/mirage/issues/489">special ELF section</a>; downside: not yet implemented
</li>
<li>embed strings in the code; upside: no deployment hassle, works everywhere for small files; downside: need to encode binary to string chunks during build and decode in the MirageOS unikernel, <a href="https://github.com/mirage/mirage/issues/396">it breaks with large files</a>
</li>
<li>likely others such as use a tar image, read it during build or runtime; wait during bootup on a network socket (or connect somewhere) to receive the static data; use a remote git repository
</li>
</ul>
<p>We'll use the embedding. There is support for this built in the mirage tool via <a href="https://github.com/mirage/ocaml-crunch">crunch</a>. If you <code>crunch &quot;foo&quot;</code> in <code>config.ml</code>, it will create a <a href="https://github.com/mirage/mirage/blob/54736660606ca06aad1a061ac4276cc45ead1815/types/V1.mli#L931">read-only key value store</a> (<code>KV_RO</code>) named <code>static1.ml</code> containing everything in the local <code>&quot;foo&quot;</code> directory during <code>mirage configure</code>.
Each file is encoded as a list of chunks, each 4096 bytes in size in ASCII (octal escaping <code>\000</code> of control characters).</p>
<p>The API is:</p>
<pre><code class="language-OCaml">val read : t -&gt; string -&gt; int -&gt; int -&gt; [ `Ok of page_aligned_buffer list | `UnknownKey of string ]
val size : t -&gt; string -&gt; [ `Ok of int64 | `UnknownKey of string ]
</code></pre>
<p>The lookup needs to retrieve first the chunk list for the given filename, and then splice the fragments together and return the requested offset and length as page aligned structures. Since this is not for free, we will read our pdfs only once during startup, and then keep a reference to the full pdfs which we deliver upon request:</p>
<pre><code class="language-OCaml">let read_full_kv kv name =
KV.size kv name &gt;&gt;= function
| `Error (KV.Unknown_key e) -&gt; Lwt.fail (Invalid_argument e)
| `Ok size -&gt;
KV.read kv name 0 (Int64.to_int size) &gt;&gt;= function
| `Error (KV.Unknown_key e) -&gt; Lwt.fail (Invalid_argument e)
| `Ok bufs -&gt; Lwt.return (Cstruct.concat bufs)
let start kv =
let d_nqsb = Page.render in
read_full_kv kv &quot;nqsbtls-usenix-security15.pdf&quot; &gt;&gt;= fun d_usenix -&gt;
read_full_kv kv &quot;tron.pdf&quot; &gt;&gt;= fun d_tron -&gt;
...
</code></pre>
<p>The funny <code>&gt;&gt;=</code> syntax notes that something is doing input/output, which might be blocking or interrupted or failing. It composes effects using an imperative style (semicolon in other languages, another term is monadic bind). The <code>Page.render</code> function is described above, and is pure, thus no <code>&gt;&gt;=</code>.</p>
<p>We now have all the resources we wanted available inside our MirageOS unikernel. There is some cost during configuration (converting binary into code), and startup (concatenating lists, lookups, rendering HTML into string representation).</p>
<h3>Building a HTTP response</h3>
<p>HTTP consists of headers and data, we already have the data. A HTTP header contains of an initial status line (<code>HTTP/1.1 200 OK</code>), and a list of keys-values, each of the form <code>key + &quot;: &quot; + value + &quot;\r\n&quot;</code> (<code>+</code> is string concatenation). The header is separated with <code>&quot;\r\n\r\n&quot;</code> from the data:</p>
<pre><code class="language-OCaml">let http_header ~status xs =
let headers = List.map (fun (k, v) -&gt; k ^ &quot;: &quot; ^ v) xs in
let lines = status :: headers @ [ &quot;\r\n&quot; ] in
String.concat &quot;\r\n&quot; lines
let header content_type =
http_header ~status:&quot;HTTP/1.1 200 OK&quot; [ (&quot;content-type&quot;, content_type) ]
</code></pre>
<p>We also know statically (at compile time) which headers to send: <code>content-type</code> should be <code>text/html</code> for our main page, and <code>application/pdf</code> for the pdf files. The status code <code>200</code> is used in HTTP to signal that the request is successful. We can combine the headers and the data during startup, because our single communication channel is HTTP, and thus we don't need access to the data or headers separately (support for HTTP caching etc. is out of scope).</p>
<p>We are now finished with the response side of HTTP, and can emit three different resources. Now, we need to handle incoming HTTP requests and dispatch them to the resource. Let's first to a brief detour to HTTPS (and thus TLS).</p>
<h3>Security via HTTPS</h3>
<p>Transport layer security is a protocol on top of TCP providing an end-to-end encrypted and authenticated channel. In our setting, our web server has a certificate and a private key to authenticate itself to the clients.</p>
<p>A certificate is a token containing a public key, a name, a validity period, and a signature from the authority which issued the certificate. The authority is crucial here: this infrastructure only works if the client trusts the public key of the authority (and thus can verify their signature on our certificate). I used <a href="https://letsencrypt.org/">let's encrypt</a> (actually the <a href="https://github.com/lukas2511/letsencrypt.sh/">letsencrypt.sh</a> client (would be great to have one natively in OCaml) to get a signed certificate, which is widely accepted by web browsers.</p>
<p>The MirageOS interface for TLS is that it takes a <a href="https://github.com/mirage/mirage/blob/54736660606ca06aad1a061ac4276cc45ead1815/types/V1.mli#L108"><code>FLOW</code></a> (byte stream, e.g. TCP) and provides a <code>FLOW</code>. Libraries can be written to be agnostic whether they use a TCP stream or a TLS session to carry data.</p>
<p>We need to setup our unikernel that on new connections to the HTTPS port, it should first do a TLS handshake, and afterwards talk the HTTP protocol. For a TLS handshake we need to put the certificate and private key into the unikernel, using yet another key value store (<code>crunch &quot;tls&quot;</code>).</p>
<p>On startup we read the certificate and private key, and use that to create a <a href="https://mirleft.github.io/ocaml-tls/Config.html#VALserver">TLS server config</a>:</p>
<pre><code class="language-OCaml">let start stack kv keys =
read_cert keys &quot;nqsb&quot; &gt;&gt;= fun c_nqsb -&gt;
let config = Tls.Config.server ~certificates:(`Single c_nqsb) () in
S.listen_tcpv4 stack ~port:443 (tls_accept config)
</code></pre>
<p>The <code>listen_tcpv4</code> is provided by the <a href="https://github.com/mirage/mirage/blob/54736660606ca06aad1a061ac4276cc45ead1815/types/V1.mli#L754">stackv4 module</a>, and gets a stack, a port number (HTTPS uses 443), and a function which receives a flow instance.</p>
<pre><code class="language-OCaml">let tls_accept cfg tcp =
TLS.server_of_flow cfg tcp &gt;&gt;= function
| `Error _ | `Eof -&gt; TCP.close tcp
| `Ok tls -&gt; ...
</code></pre>
<p>The <code>server_of_flow</code> is provided by the <a href="https://mirleft.github.io/ocaml-tls/Tls_mirage.Make.html#VALserver_of_flow">Mirage TLS layer</a>. It can fail, if the client and server do not speak a common protocol suite, ciphersuite, or if one of the sides behaves non-protocol compliant.</p>
<p>To wrap up, we managed to listen on the HTTPS port and establish TLS sessions for each incoming request. We have our resources available, and now need to dispatch the request onto the resource.</p>
<h3>HTTP request handling</h3>
<p>HTTP is a string based protocol, the first line of the request contains the method and resource which the client wants to access, <code>GET / HTTP/1.1</code>. We could read a single line from the client, and cut the part between <code>GET</code> and <code>HTTP/1.1</code> to deliver the resource.</p>
<p>This would either need some (brittle?) string processing, or a full-blown HTTP library on our side. &quot;I'm sorry Dave, I can't do that&quot;. There is no way we'll do string processing on data received from the network for this.</p>
<p>Looking a bit deeper into TLS, there is a specification for <a href="https://tools.ietf.org/html/rfc3546#section-3.1">server name indication</a> from 2003. The main purpose is to run on a single IP(v4) address multiple TLS services. The client indicates in the TLS handshake what the server name is it wants to talk to. This extension looks <a href="https://en.wikipedia.org/wiki/Server_Name_Indication">in wikipedia</a> widely enough deployed.</p>
<p>During the TLS handshake there is already some server name information exposed, and we have a very small set of available resources. Thanks to let's encrypt, generating certificates is easy and free of cost.</p>
<p>And, if we're down to a single resource, we can use the same technique used by <a href="https://github.com/pqwy">David</a> in
the <a href="http://ownme.ipredator.se">BTC Piñata</a>: just send the resource back without waiting for a request.</p>
<h3>Putting it all together</h3>
<p>What we need is a hostname for each resource, and certificates and private keys for them, or a single certificate with all hostnames as alternative names.</p>
<p>Our TLS library supports to select a certificate chain based on the requested name (look <a href="https://mirleft.github.io/ocaml-tls/Config.html#TYPEown_cert">here</a>). The following snippet is a setup to use the <code>nqsb.io</code> certificate chain by default (if no SNI is provided, or none matches), and also have a <code>usenix15</code> and a <code>tron</code> certificate chain.</p>
<pre><code class="language-OCaml">let start stack keys kv =
read_cert keys &quot;nqsb&quot; &gt;&gt;= fun c_nqsb -&gt;
read_cert keys &quot;usenix15&quot; &gt;&gt;= fun c_usenix -&gt;
read_cert keys &quot;tron&quot; &gt;&gt;= fun c_tron -&gt;
let config = Tls.Config.server ~certificates:(`Multiple_default (c_nqsb, [ c_usenix ; c_tron])) () in
S.listen_tcpv4 stack ~port:443 (tls_accept config) ;
</code></pre>
<p>Back to dispatching code. We can extract the hostname information from an opaque <code>tls</code> value (the epoch data is fully described <a href="https://mirleft.github.io/ocaml-tls/Core.html#TYPEepoch_data">here</a>:</p>
<pre><code class="language-OCaml">let extract_name tls =
match TLS.epoch tls with
| `Error -&gt; None
| `Ok e -&gt; e.Tls.Core.own_name
</code></pre>
<p>Since this TLS extension is optional, the return type will be a string option.</p>
<p>Now, putting the dispatch together we need a function that gets all resources and the tls state value, and returns the data to send out:</p>
<pre><code class="language-OCaml">let dispatch nqsb usenix tron tls =
match extract_name tls with
| Some &quot;usenix15.nqsb.io&quot; -&gt; usenix
| Some &quot;tron.nqsb.io&quot; -&gt; tron
| Some &quot;nqsb.io&quot; -&gt; nqsb
| _ -&gt; nqsb
</code></pre>
<p>This is again pure code, we need to put it now into the handler, our <code>tls_accept</code> calls the provided function with the tls flow:</p>
<pre><code class="language-OCaml">let tls_accept f cfg tcp =
TLS.server_of_flow cfg tcp &gt;&gt;= function
| `Error _ | `Eof -&gt; TCP.close tcp
| `Ok tls -&gt; Tls.writev tls (f tls) &gt;&gt;= fun _ -&gt; TLS.close tls
</code></pre>
<p>And our full startup code:</p>
<pre><code class="language-OCaml">let start stack keys kv =
let d_nqsb = [ header &quot;text/html;charset=utf-8&quot; ; Page.render ] in
read_pdf kv &quot;nqsbtls-usenix-security15.pdf&quot; &gt;&gt;= fun d_usenix -&gt;
read_pdf kv &quot;tron.pdf&quot; &gt;&gt;= fun d_tron -&gt;
let f = dispatch d_nqsb d_usenix d_tron in
read_cert keys &quot;nqsb&quot; &gt;&gt;= fun c_nqsb -&gt;
read_cert keys &quot;usenix15&quot; &gt;&gt;= fun c_usenix -&gt;
read_cert keys &quot;tron&quot; &gt;&gt;= fun c_tron -&gt;
let config = Tls.Config.server ~certificates:(`Multiple_default (c_nqsb, [ c_usenix ; c_tron])) () in
S.listen_tcpv4 stack ~port:443 (tls_accept f config) ;
S.listen stack
</code></pre>
<p>That's it, the <a href="https://nqsb.io">nqsb.io</a> contains slightly more code to log onto a console, and to redirect requests on port 80 (HTTP) to port 443 (by signaling a <code>301 Moved permanently</code> HTTP status code).</p>
<h2>Conclusion</h2>
<p>A comparison using Firefox builtin network diagnostics shows that the waiting before receiving data is minimal (3ms, even spotted 0ms).</p>
<p><a href="/static/img/performance-nqsbio.png"><img src="/static/img/performance-nqsbio.png" title="latency of our website" width="50%" /></a></p>
<p>We do not render HTML for each request, we do not splice data together, we <em>don't even read the client request</em>. And I'm sure we can improve the performance even more by profiling.</p>
<p>We saw a journey from typed XML over key value stores, HTTP, TLS, and HTTPS. The actual application code of our unikernel serving <a href="https://nqsb.io">nqsb,io</a> is less than 100 lines of OCaml. We used MirageOS for our minimal HTTPS website, serving a <em>single resource per hostname</em>. We depend (directly) on the tyxml library, the mirage tool and network stack, and the tls library. That's it.</p>
<p>There is a long list of potential features, such as full HTTP protocol compliance (caching, favicon, ...), logging, natively getting let's encrypt certificates -- but in the web out there it is sufficient to get picked up by search engines, and the maintenance is marginal.</p>
<p>For a start in MirageOS unikernels, look into our <a href="https://github.com/mirage/mirage-skeleton">mirage-skeleton</a> project, and into the <a href="https://github.com/mattgray/devwinter2016/">/dev/winter</a> presentation by Matt Gray.</p>
<p>I'm interested in feedback, either via
<a href="https://twitter.com/h4nnes">twitter</a> or via eMail.</p>
<h2>Other updates in the MirageOS ecosystem</h2>
<ul>
<li><a href="https://github.com/Engil/Canopy">Canopy</a> improvements: <a href="https://github.com/Engil/Canopy/pull/26">no bower anymore</a>, <a href="https://github.com/Engil/Canopy/pull/27">HTTP caching support (via etags)</a>, <a href="https://github.com/Engil/Canopy/pull/31">listings now include dates</a>, <a href="https://github.com/Engil/Canopy/pull/32">dates are now in big-endian (y-m-d)</a>
</li>
<li><a href="http://canopy.mirage.io/irclogs/20-04-2016">MirageOS call irclog from 2014-04-20</a>
</li>
<li>blog article about <a href="https://abailly.github.io/posts/mirage-os-newbie.html">naive authentication service using MirageOS</a>
</li>
<li><a href="https://lwn.net/SubscriberLink/684128/1436601f401c1f09/">OCaml 4.03 post</a>
</li>
</ul>
</article></div></div></main></body></html>

1059
atom Normal file

File diff suppressed because it is too large Load diff

28
index.html Normal file
View file

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>full stack engineer</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="full stack engineer" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="flex-container"><div class="list-group listing"><a href="/Posts/OpamMirror" class="list-group-item"><h2 class="list-group-item-heading">Mirroring the opam repository and all tarballs</h2><span class="author">Written by hannes</span> <time>2022-09-29</time><br/><p class="list-group-item-text abstract"><p>Re-developing an opam cache from scratch, as a MirageOS unikernel</p>
</p></a><a href="/Posts/Monitoring" class="list-group-item"><h2 class="list-group-item-heading">All your metrics belong to influx</h2><span class="author">Written by hannes</span> <time>2022-03-08</time><br/><p class="list-group-item-text abstract"><p>How to monitor your MirageOS unikernel with albatross and monitoring-experiments</p>
</p></a><a href="/Posts/Deploy" class="list-group-item"><h2 class="list-group-item-heading">Deploying binary MirageOS unikernels</h2><span class="author">Written by hannes</span> <time>2021-06-30</time><br/><p class="list-group-item-text abstract"><p>Finally, we provide reproducible binary MirageOS unikernels together with packages to reproduce them and setup your own builder</p>
</p></a><a href="/Posts/EC" class="list-group-item"><h2 class="list-group-item-heading">Cryptography updates in OCaml and MirageOS</h2><span class="author">Written by hannes</span> <time>2021-04-23</time><br/><p class="list-group-item-text abstract"><p>Elliptic curves (ECDSA/ECDH) are supported in a maintainable and secure way.</p>
</p></a><a href="/Posts/NGI" class="list-group-item"><h2 class="list-group-item-heading">The road ahead for MirageOS in 2021</h2><span class="author">Written by hannes</span> <time>2021-01-25</time><br/><p class="list-group-item-text abstract"><p>Home office, MirageOS unikernels, 2020 recap, 2021 tbd</p>
</p></a><a href="/Posts/Traceroute" class="list-group-item"><h2 class="list-group-item-heading">Traceroute</h2><span class="author">Written by hannes</span> <time>2020-06-24</time><br/><p class="list-group-item-text abstract"><p>A MirageOS unikernel which traces the path between itself and a remote host.</p>
</p></a><a href="/Posts/DnsServer" class="list-group-item"><h2 class="list-group-item-heading">Deploying authoritative OCaml-DNS servers as MirageOS unikernels</h2><span class="author">Written by hannes</span> <time>2019-12-23</time><br/><p class="list-group-item-text abstract"><p>A tutorial how to deploy authoritative name servers, let's encrypt, and updating entries from unix services.</p>
</p></a><a href="/Posts/ReproducibleOPAM" class="list-group-item"><h2 class="list-group-item-heading">Reproducible MirageOS unikernel builds</h2><span class="author">Written by hannes</span> <time>2019-12-16</time><br/><p class="list-group-item-text abstract"><p>MirageOS unikernels are reproducible :)</p>
</p></a><a href="/Posts/X50907" class="list-group-item"><h2 class="list-group-item-heading">X509 0.7</h2><span class="author">Written by hannes</span> <time>2019-08-15</time><br/><p class="list-group-item-text abstract"><p>Five years since ocaml-x509 initial release, it has been reworked and used more widely</p>
</p></a><a href="/Posts/Summer2019" class="list-group-item"><h2 class="list-group-item-heading">Summer 2019</h2><span class="author">Written by hannes</span> <time>2019-07-08</time><br/><p class="list-group-item-text abstract"><p>Bringing MirageOS into production, take IV monitoring, CalDAV, DNS</p>
</p></a><a href="/Posts/Pinata" class="list-group-item"><h2 class="list-group-item-heading">The Bitcoin Piñata - no candy for you</h2><span class="author">Written by hannes</span> <time>2018-04-18</time><br/><p class="list-group-item-text abstract"><p>More than three years ago we launched our Bitcoin Piñata as a transparent security bait. It is still up and running!</p>
</p></a><a href="/Posts/DNS" class="list-group-item"><h2 class="list-group-item-heading">My 2018 contains robur and starts with re-engineering DNS</h2><span class="author">Written by hannes</span> <time>2018-01-11</time><br/><p class="list-group-item-text abstract"><p>New year brings new possibilities and a new environment. I've been working on the most Widely deployed key-value store, the domain name system. Primary and secondary name services are available, including dynamic updates, notify, and tsig authentication.</p>
</p></a><a href="/Posts/VMM" class="list-group-item"><h2 class="list-group-item-heading">Albatross - provisioning, deploying, managing, and monitoring virtual machines</h2><span class="author">Written by hannes</span> <time>2017-07-10</time><br/><p class="list-group-item-text abstract"><p>all we need is X.509</p>
</p></a><a href="/Posts/Conex" class="list-group-item"><h2 class="list-group-item-heading">Conex, establish trust in community repositories</h2><span class="author">Written by hannes</span> <time>2017-02-16</time><br/><p class="list-group-item-text abstract"><p>Conex is a library to verify and attest package release integrity and authenticity through the use of cryptographic signatures.</p>
</p></a><a href="/Posts/Maintainers" class="list-group-item"><h2 class="list-group-item-heading">Who maintains package X?</h2><span class="author">Written by hannes</span> <time>2017-02-16</time><br/><p class="list-group-item-text abstract"><p>We describe why manual gathering of metadata is out of date, and version control systems are awesome.</p>
</p></a><a href="/Posts/Jackline" class="list-group-item"><h2 class="list-group-item-heading">Jackline, a secure terminal-based XMPP client</h2><span class="author">Written by hannes</span> <time>2017-01-30</time><br/><p class="list-group-item-text abstract"><p>implement it once to know you can do it. implement it a second time and you get readable code. implementing it a third time from scratch may lead to useful libraries.</p>
</p></a><a href="/Posts/Syslog" class="list-group-item"><h2 class="list-group-item-heading">Exfiltrating log data using syslog</h2><span class="author">Written by hannes</span> <time>2016-11-05</time><br/><p class="list-group-item-text abstract"><p>sometimes preservation of data is useful</p>
</p></a><a href="/Posts/ARP" class="list-group-item"><h2 class="list-group-item-heading">Re-engineering ARP</h2><span class="author">Written by hannes</span> <time>2016-07-12</time><br/><p class="list-group-item-text abstract"><p>If you want it as you like, you've to do it yourself</p>
</p></a><a href="/Posts/Solo5" class="list-group-item"><h2 class="list-group-item-heading">Minimising the virtual machine monitor</h2><span class="author">Written by hannes</span> <time>2016-07-02</time><br/><p class="list-group-item-text abstract"><p>MirageOS solo5 multiboot native on bhyve</p>
</p></a><a href="/Posts/BottomUp" class="list-group-item"><h2 class="list-group-item-heading">Counting Bytes</h2><span class="author">Written by hannes</span> <time>2016-06-11</time><br/><p class="list-group-item-text abstract"><p>looking into dependencies and their sizes</p>
</p></a><a href="/Posts/Functoria" class="list-group-item"><h2 class="list-group-item-heading">Configuration DSL step-by-step</h2><span class="author">Written by hannes</span> <time>2016-05-10</time><br/><p class="list-group-item-text abstract"><p>how to actually configure the system</p>
</p></a><a href="/Posts/BadRecordMac" class="list-group-item"><h2 class="list-group-item-heading">Catch the bug, walking through the stack</h2><span class="author">Written by hannes</span> <time>2016-05-03</time><br/><p class="list-group-item-text abstract"><p>10BTC could've been yours</p>
</p></a><a href="/Posts/nqsbWebsite" class="list-group-item"><h2 class="list-group-item-heading">Fitting the things together</h2><span class="author">Written by hannes</span> <time>2016-04-24</time><br/><p class="list-group-item-text abstract"><p>building a simple website</p>
</p></a><a href="/Posts/OCaml" class="list-group-item"><h2 class="list-group-item-heading">Why OCaml</h2><span class="author">Written by hannes</span> <time>2016-04-17</time><br/><p class="list-group-item-text abstract"><p>a gentle introduction into OCaml</p>
</p></a><a href="/Posts/OperatingSystem" class="list-group-item"><h2 class="list-group-item-heading">Operating systems</h2><span class="author">Written by hannes</span> <time>2016-04-09</time><br/><p class="list-group-item-text abstract"><p>Operating systems and MirageOS</p>
</p></a><a href="/About" class="list-group-item"><h2 class="list-group-item-heading">About</h2><span class="author">Written by hannes</span> <time>2016-04-01</time><br/><p class="list-group-item-text abstract"><p>introduction (myself, this site)</p>
</p></a></div></div></div></main></body></html>

101
static/css/highlight.css Normal file
View file

@ -0,0 +1,101 @@
/*
grayscale style (c) MY Sun <simonmysun@gmail.com>
*/
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
color: #333;
background: #fff;
}
.hljs-comment,
.hljs-quote {
color: #777;
font-style: italic;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-subst {
color: #333;
font-weight: bold;
}
.hljs-number,
.hljs-literal {
color: #777;
}
.hljs-string,
.hljs-doctag,
.hljs-formula {
color: #333;
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAJ0lEQVQIW2O8e/fufwYGBgZBQUEQxcCIIfDu3Tuwivfv30NUoAsAALHpFMMLqZlPAAAAAElFTkSuQmCC) repeat;
}
.hljs-title,
.hljs-section,
.hljs-selector-id {
color: #000;
font-weight: bold;
}
.hljs-subst {
font-weight: normal;
}
.hljs-class .hljs-title,
.hljs-type,
.hljs-name {
color: #333;
font-weight: bold;
}
.hljs-tag {
color: #333;
}
.hljs-regexp {
color: #333;
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAICAYAAADA+m62AAAAPUlEQVQYV2NkQAN37979r6yszIgujiIAU4RNMVwhuiQ6H6wQl3XI4oy4FMHcCJPHcDS6J2A2EqUQpJhohQDexSef15DBCwAAAABJRU5ErkJggg==) repeat;
}
.hljs-symbol,
.hljs-bullet,
.hljs-link {
color: #000;
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAKElEQVQIW2NkQAO7d+/+z4gsBhJwdXVlhAvCBECKwIIwAbhKZBUwBQA6hBpm5efZsgAAAABJRU5ErkJggg==) repeat;
}
.hljs-built_in,
.hljs-builtin-name {
color: #000;
text-decoration: underline;
}
.hljs-meta {
color: #999;
font-weight: bold;
}
.hljs-deletion {
color: #fff;
background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAADCAYAAABS3WWCAAAAE0lEQVQIW2MMDQ39zzhz5kwIAQAyxweWgUHd1AAAAABJRU5ErkJggg==) repeat;
}
.hljs-addition {
color: #000;
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAALUlEQVQYV2N89+7dfwYk8P79ewZBQUFkIQZGOiu6e/cuiptQHAPl0NtNxAQBAM97Oejj3Dg7AAAAAElFTkSuQmCC) repeat;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: bold;
}

152
static/css/style.css Normal file
View file

@ -0,0 +1,152 @@
html {
background-color: #fafafa;
font-family: medium-content-serif-font,Georgia,Cambria,"Times New Roman",Times,serif;
font-size: 21px;
}
html a {
text-decoration-line: underline;
text-decoration-style: dotted;
text-decoration-color: #1a1a1a;
color: black;
}
html a:visited {
text-decoration-line: underline;
text-decoration-style: dotted;
text-decoration-color: #1a1a1a;
color: black;
}
li {
margin: 0.5em 0;
line-height: 1.6;
}
p {
line-height: 1.6;
}
.navbar {
box-sizing: border-box;
box-shadow: 0 2px 2px -2px rgba(0,0,0,.15);
position: fixed;
top: 0;
right: 0;
left: 0;
z-index: 1030;
background-color: white;
}
.container {
margin: 0 auto;
max-width: 800px;
}
blockquote {
font-style: italic;
padding: 0px 20px;
margin: 0 0 20px;
border-left: 5px solid #eee;
}
main {
margin-top: 100px;
}
.flex-container {
display: flex;
width: 100%;
justify-content: center;
}
article {
margin-top: 30px;
}
footer {
margin-top: 20px;
}
pre {
padding: 0px;
line-height: 1.3;
}
body h2 {
margin-bottom: 3px;
font-weight: 700;
font-size: 40px;
line-height: 1.04;
letter-spacing: -.028em;
font-family: medium-content-sans-serif-font,"Lucida Grande","Lucida Sans Unicode","Lucida Sans",Geneva,Arial,sans-serif;
}
p > code {
word-wrap: break-word;
}
.post-title {
}
.author {
font-size: 13px;
}
.date {
font-size: 13px;
}
time {
font-size: 13px;
}
footer {
font-size: 13px;
}
.tags {
font-size: 13px;
}
.post,
.listing {
width: 90%;
max-width: 800px;
}
a.list-group-item {
border: 0;
}
.extract {
margin-top: 10px;
}
.tag {
font-size: 13px;
margin-right: 4px;
}
.navbar-nav {
clear:both;
margin-left: 0px;
padding-left: 0px;
font-family: medium-content-sans-serif-font,"Lucida Grande","Lucida Sans Unicode","Lucida Sans",Geneva,Arial,sans-serif;
font-size: 15px;
}
.navbar-default li a, .navbar-default li a:visited {
color: #777;
}
.navbar-default li a:hover {
color: black;
}
.navbar-default li {
list-style-type: none;
font-size: 21px;
color: #777;
display: inline-block;
padding-right: 15px;
}
.navbar-header {
background-color: #9B111E;
}
.navbar-brand {
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-weight: 700;
font-size: 40px;
background-color: #9B111E;
}

BIN
static/img/conex.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
static/img/jackline.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

BIN
static/img/jackline2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View file

@ -0,0 +1,40 @@
<svg width="1000" height="800" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g><rect x="0" y="0" height="561" width="373" style="stroke:#006000; fill: #D95B43"/> <text x="10" y="280">stdlib.a</text><title>/home/hannes/.opam/4.03.0/lib/ocaml/stdlib.a (1588982)</title></g>
<g><rect x="0" y="561" height="238" width="373" style="stroke:#006000; fill: #C02942"/> <text x="10" y="680">sexplib.a</text><title>/home/hannes/.opam/4.03.0/lib/sexplib/sexplib.a (673124)</title></g>
<g><rect x="373" y="0" height="247" width="350" style="stroke:#006000; fill: #542437"/> <text x="383" y="123">lwt-unix.a</text><title>/home/hannes/.opam/4.03.0/lib/lwt/lwt-unix.a (657552)</title></g>
<g><rect x="724" y="0" height="247" width="275" style="stroke:#006000; fill: #53777A"/> <text x="734" y="123">liblwt-unix_stubs.a</text><title>/home/hannes/.opam/4.03.0/lib/lwt/liblwt-unix_stubs.a (515632)</title></g>
<g><rect x="373" y="247" height="229" width="249" style="stroke:#006000; fill: #ECD078"/> <text x="383" y="362">libasmrun.a</text><title>/home/hannes/.opam/4.03.0/lib/ocaml/libasmrun.a (433626)</title></g>
<g><rect x="373" y="477" height="175" width="249" style="stroke:#006000; fill: #D95B43"/> <text x="383" y="565">lwt.a</text><title>/home/hannes/.opam/4.03.0/lib/lwt/lwt.a (331998)</title></g>
<g><rect x="373" y="653" height="146" width="249" style="stroke:#006000; fill: #C02942"/> <text x="383" y="726">cmdliner.a</text><title>/home/hannes/.opam/4.03.0/lib/cmdliner/cmdliner.a (276850)</title></g>
<g><rect x="623" y="247" height="159" width="204" style="stroke:#006000; fill: #542437"/> <text x="633" y="327">astring.a</text><title>/home/hannes/.opam/4.03.0/lib/astring/astring.a (246538)</title></g>
<g><rect x="828" y="247" height="159" width="171" style="stroke:#006000; fill: #53777A"/> <text x="838" y="327">libunix.a</text><title>/home/hannes/.opam/4.03.0/lib/ocaml/libunix.a (207120)</title></g>
<g><rect x="623" y="406" height="162" width="164" style="stroke:#006000; fill: #ECD078"/> <text x="633" y="488">ipaddr.a</text><title>/home/hannes/.opam/4.03.0/lib/ipaddr/ipaddr.a (202720)</title></g>
<g><rect x="788" y="406" height="162" width="116" style="stroke:#006000; fill: #D95B43"/> <text x="798" y="488">unix.a</text><title>/home/hannes/.opam/4.03.0/lib/ocaml/unix.a (143632)</title></g>
<g><rect x="904" y="406" height="162" width="95" style="stroke:#006000; fill: #C02942"/> <text x="914" y="488">camlstartup800193.o</text><title>/tmp/camlstartup800193.o (117440)</title></g>
<g><rect x="623" y="569" height="118" width="104" style="stroke:#006000; fill: #542437"/> <text x="633" y="629">ocplib_endian.a</text><title>/home/hannes/.opam/4.03.0/lib/ocplib-endian/ocplib_endian.a (93778)</title></g>
<g><rect x="623" y="688" height="111" width="104" style="stroke:#006000; fill: #53777A"/> <text x="633" y="744">fmt.a</text><title>/home/hannes/.opam/4.03.0/lib/fmt/fmt.a (88008)</title></g>
<g><rect x="727" y="569" height="115" width="80" style="stroke:#006000; fill: #ECD078"/> <text x="737" y="627">cstruct.a</text><title>/home/hannes/.opam/4.03.0/lib/cstruct/cstruct.a (70122)</title></g>
<g><rect x="727" y="685" height="114" width="80" style="stroke:#006000; fill: #D95B43"/> <text x="737" y="742">lwt-log.a</text><title>/home/hannes/.opam/4.03.0/lib/lwt/lwt-log.a (69738)</title></g>
<g><rect x="808" y="569" height="64" width="97" style="stroke:#006000; fill: #C02942"/> <text x="818" y="602">bigstring.a</text><title>/home/hannes/.opam/4.03.0/lib/ocplib-endian/bigstring.a (47622)</title></g>
<g><rect x="905" y="569" height="64" width="94" style="stroke:#006000; fill: #542437"/> <text x="915" y="602">logs.a</text><title>/home/hannes/.opam/4.03.0/lib/logs/logs.a (46250)</title></g>
<g><rect x="808" y="634" height="61" width="69" style="stroke:#006000; fill: #53777A"/> <text x="818" y="665">libbigarray.a</text><title>/home/hannes/.opam/4.03.0/lib/ocaml/libbigarray.a (32488)</title></g>
<g><rect x="808" y="696" height="57" width="69" style="stroke:#006000; fill: #ECD078"/> <text x="818" y="724">bigarray.a</text><title>/home/hannes/.opam/4.03.0/lib/ocaml/bigarray.a (30248)</title></g>
<g><rect x="808" y="753" height="46" width="69" style="stroke:#006000; fill: #D95B43"/> <text x="818" y="776">mirage_logs.a</text><title>/home/hannes/.opam/4.03.0/lib/mirage-logs/mirage_logs.a (24602)</title></g>
<g><rect x="877" y="634" height="56" width="50" style="stroke:#006000; fill: #C02942"/> <text x="887" y="662">mirage-runtime.a</text><title>/home/hannes/.opam/4.03.0/lib/mirage/mirage-runtime.a (21882)</title></g>
<g><rect x="928" y="634" height="56" width="36" style="stroke:#006000; fill: #542437"/> <text x="938" y="662">functoria-runtime.a</text><title>/home/hannes/.opam/4.03.0/lib/functoria/functoria-runtime.a (15698)</title></g>
<g><rect x="965" y="634" height="56" width="34" style="stroke:#006000; fill: #53777A"/> <text x="975" y="662">OS.a</text><title>/home/hannes/.opam/4.03.0/lib/mirage-unix/OS.a (15004)</title></g>
<g><rect x="877" y="691" height="38" width="49" style="stroke:#006000; fill: #ECD078"/> <text x="887" y="710">main.o</text><title>main.o (14624)</title></g>
<g><rect x="877" y="730" height="35" width="49" style="stroke:#006000; fill: #D95B43"/> <text x="887" y="748">io_page.a</text><title>/home/hannes/.opam/4.03.0/lib/io-page/io_page.a (13424)</title></g>
<g><rect x="877" y="766" height="33" width="49" style="stroke:#006000; fill: #C02942"/> <text x="887" y="783">mirage_console_unix.a</text><title>/home/hannes/.opam/4.03.0/lib/mirage-console/mirage_console_unix.a (12746)</title></g>
<g><rect x="927" y="691" height="37" width="39" style="stroke:#006000; fill: #542437"/> <text x="937" y="710">mProf.a</text><title>/home/hannes/.opam/4.03.0/lib/mirage-profile/mProf.a (11358)</title></g>
<g><rect x="967" y="691" height="37" width="32" style="stroke:#006000; fill: #53777A"/> <text x="977" y="710">libcstruct_stubs.a</text><title>/home/hannes/.opam/4.03.0/lib/cstruct/libcstruct_stubs.a (9468)</title></g>
<g><rect x="927" y="729" height="35" width="27" style="stroke:#006000; fill: #ECD078"/> <text x="937" y="747">libio_page_unix_stubs.a</text><title>/home/hannes/.opam/4.03.0/lib/io-page/libio_page_unix_stubs.a (7530)</title></g>
<g><rect x="927" y="765" height="34" width="27" style="stroke:#006000; fill: #D95B43"/> <text x="937" y="782">key_gen.o</text><title>key_gen.o (7256)</title></g>
<g><rect x="955" y="729" height="34" width="25" style="stroke:#006000; fill: #C02942"/> <text x="965" y="746">lwt_cstruct.a</text><title>/home/hannes/.opam/4.03.0/lib/cstruct/lwt_cstruct.a (6696)</title></g>
<g><rect x="980" y="729" height="34" width="19" style="stroke:#006000; fill: #542437"/> <text x="990" y="746">unikernel.o</text><title>unikernel.o (5032)</title></g>
<g><rect x="955" y="764" height="18" width="23" style="stroke:#006000; fill: #53777A"/> <text x="965" y="773">mirage-clock.a</text><title>/home/hannes/.opam/4.03.0/lib/mirage-clock-unix/mirage-clock.a (3330)</title></g>
<g><rect x="955" y="783" height="16" width="23" style="stroke:#006000; fill: #ECD078"/> <text x="965" y="791">std_exit.o</text><title>/home/hannes/.opam/4.03.0/lib/ocaml/std_exit.o (2984)</title></g>
<g><rect x="978" y="764" height="12" width="21" style="stroke:#006000; fill: #D95B43"/> <text x="988" y="770">io_page_unix.a</text><title>/home/hannes/.opam/4.03.0/lib/io-page/io_page_unix.a (2046)</title></g>
<g><rect x="978" y="776" height="11" width="21" style="stroke:#006000; fill: #C02942"/> <text x="988" y="782">result.a</text><title>/home/hannes/.opam/4.03.0/lib/result/result.a (1950)</title></g>
<g><rect x="978" y="788" height="11" width="21" style="stroke:#006000; fill: #542437"/> <text x="988" y="794">mirage-console.a</text><title>/home/hannes/.opam/4.03.0/lib/mirage-console/mirage-console.a (1870)</title></g>
</svg>

After

Width:  |  Height:  |  Size: 7.7 KiB

View file

@ -0,0 +1,55 @@
<svg width="1000" height="800" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g><rect x="0" y="0" height="546" width="471" style="stroke:#006000; fill: #D95B43"/> <text x="10" y="273">libgcc.a</text><title>/usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc.a (3027014)</title></g>
<g><rect x="0" y="546" height="253" width="471" style="stroke:#006000; fill: #C02942"/> <text x="10" y="673">stdlib.a</text><title>/home/hannes/.opam/4.02.3/lib/ocaml/stdlib.a (1400328)</title></g>
<g><rect x="471" y="0" height="208" width="271" style="stroke:#006000; fill: #542437"/> <text x="481" y="104">sexplib.a</text><title>/home/hannes/.opam/4.02.3/lib/sexplib/sexplib.a (665768)</title></g>
<g><rect x="742" y="0" height="208" width="257" style="stroke:#006000; fill: #53777A"/> <text x="752" y="104">libopenlibm.a</text><title>/home/hannes/.opam/4.02.3/lib/libopenlibm.a (629620)</title></g>
<g><rect x="471" y="208" height="161" width="181" style="stroke:#006000; fill: #ECD078"/> <text x="481" y="289">libxenasmrun.a</text><title>/home/hannes/.opam/4.02.3/lib/pkgconfig/../../lib/mirage-xen-ocaml/libxenasmrun.a (343920)</title></g>
<g><rect x="652" y="208" height="161" width="174" style="stroke:#006000; fill: #D95B43"/> <text x="662" y="289">libasmrun.a</text><title>/home/hannes/.opam/4.02.3/lib/ocaml/libasmrun.a (331260)</title></g>
<g><rect x="827" y="208" height="161" width="172" style="stroke:#006000; fill: #C02942"/> <text x="837" y="289">lwt.a</text><title>/home/hannes/.opam/4.02.3/lib/lwt/lwt.a (328130)</title></g>
<g><rect x="471" y="370" height="150" width="156" style="stroke:#006000; fill: #542437"/> <text x="481" y="445">cmdliner.a</text><title>/home/hannes/.opam/4.02.3/lib/cmdliner/cmdliner.a (277042)</title></g>
<g><rect x="471" y="520" height="147" width="156" style="stroke:#006000; fill: #53777A"/> <text x="481" y="594">libminios.a</text><title>/home/hannes/.opam/4.02.3/lib/pkgconfig/../../lib/minios-xen/libminios.a (271372)</title></g>
<g><rect x="471" y="667" height="132" width="156" style="stroke:#006000; fill: #ECD078"/> <text x="481" y="733">astring.a</text><title>/home/hannes/.opam/4.02.3/lib/astring/astring.a (243240)</title></g>
<g><rect x="627" y="370" height="126" width="156" style="stroke:#006000; fill: #D95B43"/> <text x="637" y="433">re.a</text><title>/home/hannes/.opam/4.02.3/lib/re/re.a (233148)</title></g>
<g><rect x="784" y="370" height="126" width="133" style="stroke:#006000; fill: #C02942"/> <text x="794" y="433">ipaddr.a</text><title>/home/hannes/.opam/4.02.3/lib/ipaddr/ipaddr.a (198636)</title></g>
<g><rect x="918" y="370" height="126" width="81" style="stroke:#006000; fill: #542437"/> <text x="928" y="433">camlstartup873580.o</text><title>/tmp/camlstartup873580.o (121544)</title></g>
<g><rect x="627" y="496" height="118" width="85" style="stroke:#006000; fill: #53777A"/> <text x="637" y="556">xenstore.a</text><title>/home/hannes/.opam/4.02.3/lib/xenstore/xenstore.a (119916)</title></g>
<g><rect x="627" y="615" height="98" width="85" style="stroke:#006000; fill: #ECD078"/> <text x="637" y="664">ocplib_endian.a</text><title>/home/hannes/.opam/4.02.3/lib/ocplib-endian/ocplib_endian.a (99350)</title></g>
<g><rect x="627" y="714" height="85" width="85" style="stroke:#006000; fill: #D95B43"/> <text x="637" y="757">fmt.a</text><title>/home/hannes/.opam/4.02.3/lib/fmt/fmt.a (86522)</title></g>
<g><rect x="713" y="496" height="80" width="82" style="stroke:#006000; fill: #C02942"/> <text x="723" y="536">OS.a</text><title>/home/hannes/.opam/4.02.3/lib/mirage-xen/OS.a (77252)</title></g>
<g><rect x="795" y="496" height="80" width="72" style="stroke:#006000; fill: #542437"/> <text x="805" y="536">cstruct.a</text><title>/home/hannes/.opam/4.02.3/lib/cstruct/cstruct.a (68448)</title></g>
<g><rect x="868" y="496" height="80" width="66" style="stroke:#006000; fill: #53777A"/> <text x="878" y="536">xenstore_client_lwt.a</text><title>/home/hannes/.opam/4.02.3/lib/xenstore/xenstore_client_lwt.a (62488)</title></g>
<g><rect x="934" y="496" height="80" width="65" style="stroke:#006000; fill: #ECD078"/> <text x="944" y="536">libxenposix.a</text><title>/home/hannes/.opam/4.02.3/lib/pkgconfig/../../lib/mirage-xen-posix/libxenposix.a (61286)</title></g>
<g><rect x="713" y="576" height="78" width="55" style="stroke:#006000; fill: #D95B43"/> <text x="723" y="615">mirage_console_xen.a</text><title>/home/hannes/.opam/4.02.3/lib/mirage-console/mirage_console_xen.a (51346)</title></g>
<g><rect x="713" y="655" height="76" width="55" style="stroke:#006000; fill: #C02942"/> <text x="723" y="693">bigstring.a</text><title>/home/hannes/.opam/4.02.3/lib/ocplib-endian/bigstring.a (50380)</title></g>
<g><rect x="713" y="731" height="68" width="55" style="stroke:#006000; fill: #542437"/> <text x="723" y="765">logs.a</text><title>/home/hannes/.opam/4.02.3/lib/logs/logs.a (44770)</title></g>
<g><rect x="769" y="576" height="57" width="64" style="stroke:#006000; fill: #53777A"/> <text x="779" y="605">libxencamlbindings.a</text><title>/home/hannes/.opam/4.02.3/lib/pkgconfig/../../lib/mirage-xen/libxencamlbindings.a (43158)</title></g>
<g><rect x="769" y="634" height="56" width="64" style="stroke:#006000; fill: #ECD078"/> <text x="779" y="662">xen_gnt.a</text><title>/home/hannes/.opam/4.02.3/lib/xen-gnt/xen_gnt.a (42476)</title></g>
<g><rect x="769" y="690" height="55" width="64" style="stroke:#006000; fill: #D95B43"/> <text x="779" y="717">libx86_64.a</text><title>/home/hannes/.opam/4.02.3/lib/pkgconfig/../../lib/minios-xen/libx86_64.a (41790)</title></g>
<g><rect x="769" y="745" height="54" width="64" style="stroke:#006000; fill: #C02942"/> <text x="779" y="772">shared_memory_ring.a</text><title>/home/hannes/.opam/4.02.3/lib/shared-memory-ring/shared_memory_ring.a (41024)</title></g>
<g><rect x="833" y="576" height="55" width="58" style="stroke:#006000; fill: #542437"/> <text x="843" y="604">re_str.a</text><title>/home/hannes/.opam/4.02.3/lib/re/re_str.a (37994)</title></g>
<g><rect x="892" y="576" height="55" width="57" style="stroke:#006000; fill: #53777A"/> <text x="902" y="604">libxenotherlibs.a</text><title>/home/hannes/.opam/4.02.3/lib/pkgconfig/../../lib/mirage-xen-ocaml/libxenotherlibs.a (37666)</title></g>
<g><rect x="950" y="576" height="55" width="49" style="stroke:#006000; fill: #ECD078"/> <text x="960" y="604">mirage_console_proto.a</text><title>/home/hannes/.opam/4.02.3/lib/mirage-console/mirage_console_proto.a (32550)</title></g>
<g><rect x="833" y="632" height="51" width="45" style="stroke:#006000; fill: #D95B43"/> <text x="843" y="658">libbigarray.a</text><title>/home/hannes/.opam/4.02.3/lib/ocaml/libbigarray.a (27760)</title></g>
<g><rect x="879" y="632" height="51" width="43" style="stroke:#006000; fill: #C02942"/> <text x="889" y="658">bigarray.a</text><title>/home/hannes/.opam/4.02.3/lib/ocaml/bigarray.a (26228)</title></g>
<g><rect x="922" y="632" height="51" width="40" style="stroke:#006000; fill: #542437"/> <text x="932" y="658">mirage_logs.a</text><title>/home/hannes/.opam/4.02.3/lib/mirage-logs/mirage_logs.a (24604)</title></g>
<g><rect x="963" y="632" height="51" width="36" style="stroke:#006000; fill: #53777A"/> <text x="973" y="658">xen_evtchn.a</text><title>/home/hannes/.opam/4.02.3/lib/xen-evtchn/xen_evtchn.a (22362)</title></g>
<g><rect x="833" y="684" height="40" width="46" style="stroke:#006000; fill: #ECD078"/> <text x="843" y="704">mirage-runtime.a</text><title>/home/hannes/.opam/4.02.3/lib/mirage/mirage-runtime.a (22140)</title></g>
<g><rect x="833" y="724" height="38" width="46" style="stroke:#006000; fill: #D95B43"/> <text x="843" y="743">lwt_shared_memory_ring.a</text><title>/home/hannes/.opam/4.02.3/lib/shared-memory-ring/lwt_shared_memory_ring.a (21432)</title></g>
<g><rect x="833" y="763" height="36" width="46" style="stroke:#006000; fill: #C02942"/> <text x="843" y="781">re_emacs.a</text><title>/home/hannes/.opam/4.02.3/lib/re/re_emacs.a (20354)</title></g>
<g><rect x="880" y="684" height="41" width="41" style="stroke:#006000; fill: #542437"/> <text x="890" y="704">xenstore_ring.a</text><title>/home/hannes/.opam/4.02.3/lib/shared-memory-ring/xenstore_ring.a (19818)</title></g>
<g><rect x="880" y="725" height="40" width="41" style="stroke:#006000; fill: #53777A"/> <text x="890" y="745">console_ring.a</text><title>/home/hannes/.opam/4.02.3/lib/shared-memory-ring/console_ring.a (19722)</title></g>
<g><rect x="880" y="766" height="33" width="41" style="stroke:#006000; fill: #ECD078"/> <text x="890" y="783">mirage-bootvar.a</text><title>/home/hannes/.opam/4.02.3/lib/mirage-bootvar/mirage-bootvar.a (16280)</title></g>
<g><rect x="921" y="684" height="32" width="40" style="stroke:#006000; fill: #D95B43"/> <text x="931" y="700">functoria-runtime.a</text><title>/home/hannes/.opam/4.02.3/lib/functoria/functoria-runtime.a (15444)</title></g>
<g><rect x="962" y="684" height="32" width="37" style="stroke:#006000; fill: #C02942"/> <text x="972" y="700">main.o</text><title>main.o (14112)</title></g>
<g><rect x="921" y="716" height="27" width="40" style="stroke:#006000; fill: #542437"/> <text x="931" y="730">io_page.a</text><title>/home/hannes/.opam/4.02.3/lib/io-page/io_page.a (13208)</title></g>
<g><rect x="962" y="716" height="27" width="37" style="stroke:#006000; fill: #53777A"/> <text x="972" y="730">libcstruct_stubs.a</text><title>/home/hannes/.opam/4.02.3/lib/cstruct/libcstruct_stubs.a (12016)</title></g>
<g><rect x="921" y="743" height="31" width="29" style="stroke:#006000; fill: #ECD078"/> <text x="931" y="759">mProf.a</text><title>/home/hannes/.opam/4.02.3/lib/mirage-profile/mProf.a (11084)</title></g>
<g><rect x="921" y="775" height="24" width="29" style="stroke:#006000; fill: #D95B43"/> <text x="931" y="787">libio_page_xen_stubs.a</text><title>/home/hannes/.opam/4.02.3/lib/io-page/libio_page_xen_stubs.a (8430)</title></g>
<g><rect x="951" y="743" height="27" width="25" style="stroke:#006000; fill: #C02942"/> <text x="961" y="757">libshared_memory_ring_stubs.a</text><title>/home/hannes/.opam/4.02.3/lib/shared-memory-ring/libshared_memory_ring_stubs.a (8220)</title></g>
<g><rect x="977" y="743" height="27" width="22" style="stroke:#006000; fill: #542437"/> <text x="987" y="757">key_gen.o</text><title>key_gen.o (7184)</title></g>
<g><rect x="951" y="770" height="29" width="18" style="stroke:#006000; fill: #53777A"/> <text x="961" y="785">mirage-clock.a</text><title>/home/hannes/.opam/4.02.3/lib/mirage-clock-xen/mirage-clock.a (6476)</title></g>
<g><rect x="970" y="770" height="16" width="19" style="stroke:#006000; fill: #ECD078"/> <text x="980" y="778">unikernel.o</text><title>unikernel.o (3592)</title></g>
<g><rect x="970" y="786" height="13" width="19" style="stroke:#006000; fill: #D95B43"/> <text x="980" y="793">std_exit.o</text><title>/home/hannes/.opam/4.02.3/lib/ocaml/std_exit.o (2944)</title></g>
<g><rect x="989" y="770" height="14" width="10" style="stroke:#006000; fill: #C02942"/> <text x="999" y="778">result.a</text><title>/home/hannes/.opam/4.02.3/lib/result/result.a (1852)</title></g>
<g><rect x="989" y="785" height="14" width="10" style="stroke:#006000; fill: #542437"/> <text x="999" y="792">mirage-console.a</text><title>/home/hannes/.opam/4.02.3/lib/mirage-console/mirage-console.a (1778)</title></g>
</svg>

After

Width:  |  Height:  |  Size: 11 KiB

View file

@ -0,0 +1,669 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.38.0 (20140413.2041)
-->
<!-- Title: mirage&#45;console&#45;xen Pages: 1 -->
<svg width="2165pt" height="744pt"
viewBox="0.00 0.00 2164.97 744.18" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 740.181)">
<title>mirage&#45;console&#45;xen</title>
<polygon fill="white" stroke="none" points="-4,4 -4,-740.181 2160.97,-740.181 2160.97,4 -4,4"/>
<!-- xenstore.client -->
<g id="node1" class="node"><title>xenstore.client</title>
<ellipse fill="#d95b43" stroke="black" cx="909.569" cy="-529.831" rx="70.0071" ry="26.7407"/>
<text text-anchor="middle" x="909.569" y="-533.631" font-family="Times,serif" font-size="14.00">xenstore.client</text>
<text text-anchor="middle" x="909.569" y="-518.631" font-family="Times,serif" font-size="14.00">1.3.0</text>
</g>
<!-- xenstore -->
<g id="node2" class="node"><title>xenstore</title>
<ellipse fill="#d95b43" stroke="black" cx="828.569" cy="-440.09" rx="45.9239" ry="26.7407"/>
<text text-anchor="middle" x="828.569" y="-443.89" font-family="Times,serif" font-size="14.00">xenstore</text>
<text text-anchor="middle" x="828.569" y="-428.89" font-family="Times,serif" font-size="14.00">1.3.0</text>
</g>
<!-- xenstore.client&#45;&gt;xenstore -->
<g id="edge40" class="edge"><title>xenstore.client&#45;&gt;xenstore</title>
<path fill="none" stroke="black" d="M887.006,-504.39C877.664,-494.271 866.727,-482.424 856.857,-471.732"/>
<polygon fill="black" stroke="black" points="859.252,-469.167 849.897,-464.193 854.108,-473.915 859.252,-469.167"/>
</g>
<!-- lwt -->
<g id="node28" class="node"><title>lwt</title>
<ellipse fill="#d95b43" stroke="black" cx="1336.57" cy="-350.35" rx="30.3115" ry="26.7407"/>
<text text-anchor="middle" x="1336.57" y="-354.15" font-family="Times,serif" font-size="14.00">lwt</text>
<text text-anchor="middle" x="1336.57" y="-339.15" font-family="Times,serif" font-size="14.00">2.5.2</text>
</g>
<!-- xenstore.client&#45;&gt;lwt -->
<g id="edge39" class="edge"><title>xenstore.client&#45;&gt;lwt</title>
<path fill="none" stroke="black" d="M967.677,-514.845C986.403,-510.644 1007.3,-506.276 1026.57,-502.96 1090.79,-491.914 1270.59,-512.109 1317.57,-466.96 1338.45,-446.893 1341.98,-413.385 1341,-387.595"/>
<polygon fill="black" stroke="black" points="1344.48,-387.195 1340.37,-377.43 1337.5,-387.627 1344.48,-387.195"/>
</g>
<!-- cstruct.ppx -->
<g id="node34" class="node"><title>cstruct.ppx</title>
<ellipse fill="#d95b43" stroke="black" cx="912.569" cy="-350.35" rx="55.3091" ry="26.7407"/>
<text text-anchor="middle" x="912.569" y="-354.15" font-family="Times,serif" font-size="14.00">cstruct.ppx</text>
<text text-anchor="middle" x="912.569" y="-339.15" font-family="Times,serif" font-size="14.00">1.7.0</text>
</g>
<!-- xenstore&#45;&gt;cstruct.ppx -->
<g id="edge38" class="edge"><title>xenstore&#45;&gt;cstruct.ppx</title>
<path fill="none" stroke="black" d="M850.639,-416.038C860.433,-405.807 872.11,-393.61 882.671,-382.579"/>
<polygon fill="black" stroke="black" points="885.38,-384.81 889.768,-375.166 880.324,-379.969 885.38,-384.81"/>
</g>
<!-- cstruct -->
<g id="node35" class="node"><title>cstruct</title>
<ellipse fill="#d95b43" stroke="black" cx="829.569" cy="-260.61" rx="38.7821" ry="26.7407"/>
<text text-anchor="middle" x="829.569" y="-264.41" font-family="Times,serif" font-size="14.00">cstruct</text>
<text text-anchor="middle" x="829.569" y="-249.41" font-family="Times,serif" font-size="14.00">1.9.0</text>
</g>
<!-- xenstore&#45;&gt;cstruct -->
<g id="edge37" class="edge"><title>xenstore&#45;&gt;cstruct</title>
<path fill="none" stroke="black" d="M828.716,-412.903C828.888,-382.405 829.173,-331.854 829.365,-297.662"/>
<polygon fill="black" stroke="black" points="832.866,-297.636 829.422,-287.616 825.866,-297.596 832.866,-297.636"/>
</g>
<!-- xen&#45;gnt -->
<g id="node3" class="node"><title>xen&#45;gnt</title>
<ellipse fill="#d95b43" stroke="black" cx="475.569" cy="-529.831" rx="41.9398" ry="26.7407"/>
<text text-anchor="middle" x="475.569" y="-533.631" font-family="Times,serif" font-size="14.00">xen&#45;gnt</text>
<text text-anchor="middle" x="475.569" y="-518.631" font-family="Times,serif" font-size="14.00">2.2.1</text>
</g>
<!-- unix -->
<g id="node5" class="node"><title>unix</title>
<ellipse fill="#c02942" stroke="black" cx="416.569" cy="-18" rx="27" ry="18"/>
<text text-anchor="middle" x="416.569" y="-14.3" font-family="Times,serif" font-size="14.00">unix</text>
</g>
<!-- xen&#45;gnt&#45;&gt;unix -->
<g id="edge48" class="edge"><title>xen&#45;gnt&#45;&gt;unix</title>
<path fill="none" stroke="black" d="M472.562,-502.847C462.485,-415.775 429.969,-134.799 419.704,-46.0966"/>
<polygon fill="black" stroke="black" points="423.166,-45.5603 418.539,-36.029 416.212,-46.365 423.166,-45.5603"/>
</g>
<!-- mirage&#45;profile -->
<g id="node21" class="node"><title>mirage&#45;profile</title>
<ellipse fill="#d95b43" stroke="black" cx="1240.57" cy="-440.09" rx="67.7647" ry="26.7407"/>
<text text-anchor="middle" x="1240.57" y="-443.89" font-family="Times,serif" font-size="14.00">mirage&#45;profile</text>
<text text-anchor="middle" x="1240.57" y="-428.89" font-family="Times,serif" font-size="14.00">0.6.1</text>
</g>
<!-- xen&#45;gnt&#45;&gt;mirage&#45;profile -->
<g id="edge52" class="edge"><title>xen&#45;gnt&#45;&gt;mirage&#45;profile</title>
<path fill="none" stroke="black" d="M511.943,-516.267C527.9,-511.276 546.97,-506.008 564.569,-502.96 827.361,-457.457 901.771,-517.873 1163.57,-466.96 1169.84,-465.741 1176.3,-464.144 1182.68,-462.341"/>
<polygon fill="black" stroke="black" points="1184.05,-465.585 1192.62,-459.362 1182.04,-458.88 1184.05,-465.585"/>
</g>
<!-- xen&#45;gnt&#45;&gt;lwt -->
<g id="edge51" class="edge"><title>xen&#45;gnt&#45;&gt;lwt</title>
<path fill="none" stroke="black" d="M512.026,-516.709C527.997,-511.797 547.055,-506.467 564.569,-502.96 704.469,-474.946 750.235,-517.746 883.569,-466.96 922.228,-452.235 921.291,-428.913 959.569,-413.22 1075.15,-365.837 1224.71,-354.686 1295.7,-352.101"/>
<polygon fill="black" stroke="black" points="1296.11,-355.59 1305.99,-351.767 1295.89,-348.594 1296.11,-355.59"/>
</g>
<!-- io&#45;page -->
<g id="node31" class="node"><title>io&#45;page</title>
<ellipse fill="#d95b43" stroke="black" cx="598.569" cy="-440.09" rx="39.6962" ry="26.7407"/>
<text text-anchor="middle" x="598.569" y="-443.89" font-family="Times,serif" font-size="14.00">io&#45;page</text>
<text text-anchor="middle" x="598.569" y="-428.89" font-family="Times,serif" font-size="14.00">1.6.0</text>
</g>
<!-- xen&#45;gnt&#45;&gt;io&#45;page -->
<g id="edge50" class="edge"><title>xen&#45;gnt&#45;&gt;io&#45;page</title>
<path fill="none" stroke="black" d="M502.866,-509.358C520.745,-496.604 544.279,-479.817 563.535,-466.081"/>
<polygon fill="black" stroke="black" points="565.662,-468.863 571.77,-460.206 561.597,-463.164 565.662,-468.863"/>
</g>
<!-- bigarray -->
<g id="node38" class="node"><title>bigarray</title>
<ellipse fill="#c02942" stroke="black" cx="511.569" cy="-90" rx="40.0939" ry="18"/>
<text text-anchor="middle" x="511.569" y="-86.3" font-family="Times,serif" font-size="14.00">bigarray</text>
</g>
<!-- xen&#45;gnt&#45;&gt;bigarray -->
<g id="edge49" class="edge"><title>xen&#45;gnt&#45;&gt;bigarray</title>
<path fill="none" stroke="black" d="M479.597,-503.039C484.624,-468.566 492.569,-405.519 492.569,-351.35 492.569,-351.35 492.569,-351.35 492.569,-259.61 492.569,-209.372 501.001,-151.24 506.63,-118.028"/>
<polygon fill="black" stroke="black" points="510.081,-118.613 508.345,-108.162 503.184,-117.414 510.081,-118.613"/>
</g>
<!-- xen&#45;evtchn -->
<g id="node4" class="node"><title>xen&#45;evtchn</title>
<ellipse fill="#d95b43" stroke="black" cx="56.5685" cy="-440.09" rx="56.6372" ry="26.7407"/>
<text text-anchor="middle" x="56.5685" y="-443.89" font-family="Times,serif" font-size="14.00">xen&#45;evtchn</text>
<text text-anchor="middle" x="56.5685" y="-428.89" font-family="Times,serif" font-size="14.00">1.0.6</text>
</g>
<!-- xen&#45;evtchn&#45;&gt;unix -->
<g id="edge53" class="edge"><title>xen&#45;evtchn&#45;&gt;unix</title>
<path fill="none" stroke="black" d="M93.5052,-419.617C141.038,-391.58 217.569,-335.037 217.569,-261.61 217.569,-261.61 217.569,-261.61 217.569,-169.87 217.569,-88.2757 325.119,-45.1121 382.087,-27.9721"/>
<polygon fill="black" stroke="black" points="383.139,-31.3114 391.767,-25.1635 381.188,-24.5887 383.139,-31.3114"/>
</g>
<!-- xen&#45;evtchn&#45;&gt;lwt -->
<g id="edge54" class="edge"><title>xen&#45;evtchn&#45;&gt;lwt</title>
<path fill="none" stroke="black" d="M96.7592,-420.911C105.134,-417.816 114.019,-415.023 122.569,-413.22 308.427,-374.024 786.93,-388.029 976.569,-377.22 1092.66,-370.604 1229.61,-359.986 1296.18,-354.645"/>
<polygon fill="black" stroke="black" points="1296.56,-358.125 1306.25,-353.834 1296,-351.148 1296.56,-358.125"/>
</g>
<!-- xen&#45;evtchn&#45;&gt;bigarray -->
<g id="edge55" class="edge"><title>xen&#45;evtchn&#45;&gt;bigarray</title>
<path fill="none" stroke="black" d="M99.0438,-422.048C106.84,-419.032 114.928,-415.977 122.569,-413.22 170.558,-395.905 188.281,-404.221 231.569,-377.22 349.42,-303.712 453.878,-170.588 494.055,-115.69"/>
<polygon fill="black" stroke="black" points="496.905,-117.722 499.944,-107.572 491.239,-113.611 496.905,-117.722"/>
</g>
<!-- shared&#45;memory&#45;ring.xenstore -->
<g id="node6" class="node"><title>shared&#45;memory&#45;ring.xenstore</title>
<ellipse fill="#d95b43" stroke="black" cx="1164.57" cy="-529.831" rx="128.887" ry="26.7407"/>
<text text-anchor="middle" x="1164.57" y="-533.631" font-family="Times,serif" font-size="14.00">shared&#45;memory&#45;ring.xenstore</text>
<text text-anchor="middle" x="1164.57" y="-518.631" font-family="Times,serif" font-size="14.00">1.3.0</text>
</g>
<!-- shared&#45;memory&#45;ring -->
<g id="node9" class="node"><title>shared&#45;memory&#45;ring</title>
<ellipse fill="#d95b43" stroke="black" cx="1061.57" cy="-440.09" rx="92.7622" ry="26.7407"/>
<text text-anchor="middle" x="1061.57" y="-443.89" font-family="Times,serif" font-size="14.00">shared&#45;memory&#45;ring</text>
<text text-anchor="middle" x="1061.57" y="-428.89" font-family="Times,serif" font-size="14.00">1.3.0</text>
</g>
<!-- shared&#45;memory&#45;ring.xenstore&#45;&gt;shared&#45;memory&#45;ring -->
<g id="edge32" class="edge"><title>shared&#45;memory&#45;ring.xenstore&#45;&gt;shared&#45;memory&#45;ring</title>
<path fill="none" stroke="black" d="M1134.78,-503.452C1123.37,-493.737 1110.23,-482.542 1098.25,-472.341"/>
<polygon fill="black" stroke="black" points="1100.47,-469.627 1090.58,-465.806 1095.93,-474.955 1100.47,-469.627"/>
</g>
<!-- shared&#45;memory&#45;ring.lwt -->
<g id="node7" class="node"><title>shared&#45;memory&#45;ring.lwt</title>
<ellipse fill="#d95b43" stroke="black" cx="1456.57" cy="-529.831" rx="107.46" ry="26.7407"/>
<text text-anchor="middle" x="1456.57" y="-533.631" font-family="Times,serif" font-size="14.00">shared&#45;memory&#45;ring.lwt</text>
<text text-anchor="middle" x="1456.57" y="-518.631" font-family="Times,serif" font-size="14.00">1.3.0</text>
</g>
<!-- shared&#45;memory&#45;ring.lwt&#45;&gt;shared&#45;memory&#45;ring -->
<g id="edge33" class="edge"><title>shared&#45;memory&#45;ring.lwt&#45;&gt;shared&#45;memory&#45;ring</title>
<path fill="none" stroke="black" d="M1374.6,-512.442C1315.74,-500.45 1234.59,-483.459 1163.57,-466.96 1155.51,-465.089 1147.11,-463.07 1138.75,-461.014"/>
<polygon fill="black" stroke="black" points="1139.51,-457.597 1128.96,-458.591 1137.83,-464.392 1139.51,-457.597"/>
</g>
<!-- shared&#45;memory&#45;ring.lwt&#45;&gt;mirage&#45;profile -->
<g id="edge35" class="edge"><title>shared&#45;memory&#45;ring.lwt&#45;&gt;mirage&#45;profile</title>
<path fill="none" stroke="black" d="M1401.78,-506.577C1369.48,-493.453 1328.7,-476.89 1296.24,-463.705"/>
<polygon fill="black" stroke="black" points="1297.47,-460.426 1286.89,-459.905 1294.83,-466.911 1297.47,-460.426"/>
</g>
<!-- shared&#45;memory&#45;ring.lwt&#45;&gt;lwt -->
<g id="edge34" class="edge"><title>shared&#45;memory&#45;ring.lwt&#45;&gt;lwt</title>
<path fill="none" stroke="black" d="M1439.12,-503.023C1417.52,-471.076 1380.76,-416.707 1357.62,-382.479"/>
<polygon fill="black" stroke="black" points="1360.26,-380.139 1351.76,-373.816 1354.46,-384.06 1360.26,-380.139"/>
</g>
<!-- shared&#45;memory&#45;ring.console -->
<g id="node8" class="node"><title>shared&#45;memory&#45;ring.console</title>
<ellipse fill="#d95b43" stroke="black" cx="697.569" cy="-529.831" rx="124.402" ry="26.7407"/>
<text text-anchor="middle" x="697.569" y="-533.631" font-family="Times,serif" font-size="14.00">shared&#45;memory&#45;ring.console</text>
<text text-anchor="middle" x="697.569" y="-518.631" font-family="Times,serif" font-size="14.00">1.3.0</text>
</g>
<!-- shared&#45;memory&#45;ring.console&#45;&gt;shared&#45;memory&#45;ring -->
<g id="edge29" class="edge"><title>shared&#45;memory&#45;ring.console&#45;&gt;shared&#45;memory&#45;ring</title>
<path fill="none" stroke="black" d="M778.598,-509.345C829.192,-497.173 895.68,-481.168 954.569,-466.96 963.437,-464.821 972.718,-462.58 981.95,-460.349"/>
<polygon fill="black" stroke="black" points="983.028,-463.69 991.927,-457.939 981.384,-456.885 983.028,-463.69"/>
</g>
<!-- shared&#45;memory&#45;ring.console&#45;&gt;cstruct.ppx -->
<g id="edge31" class="edge"><title>shared&#45;memory&#45;ring.console&#45;&gt;cstruct.ppx</title>
<path fill="none" stroke="black" d="M780.214,-509.671C822.803,-498.217 868.846,-482.837 883.569,-466.96 903.267,-445.718 910.094,-413.134 912.236,-387.966"/>
<polygon fill="black" stroke="black" points="915.747,-387.891 912.89,-377.688 908.761,-387.445 915.747,-387.891"/>
</g>
<!-- shared&#45;memory&#45;ring.console&#45;&gt;cstruct -->
<g id="edge30" class="edge"><title>shared&#45;memory&#45;ring.console&#45;&gt;cstruct</title>
<path fill="none" stroke="black" d="M710.466,-502.722C734.516,-454.033 786.185,-349.435 812.865,-295.424"/>
<polygon fill="black" stroke="black" points="816.098,-296.782 817.389,-286.266 809.822,-293.682 816.098,-296.782"/>
</g>
<!-- shared&#45;memory&#45;ring&#45;&gt;cstruct -->
<g id="edge36" class="edge"><title>shared&#45;memory&#45;ring&#45;&gt;cstruct</title>
<path fill="none" stroke="black" d="M1048.15,-413.403C1033.57,-387.636 1008.07,-348.312 976.569,-323.48 946.548,-299.814 906.155,-283.679 875.307,-273.836"/>
<polygon fill="black" stroke="black" points="876.24,-270.461 865.652,-270.86 874.177,-277.151 876.24,-270.461"/>
</g>
<!-- sexplib -->
<g id="node10" class="node"><title>sexplib</title>
<ellipse fill="#d95b43" stroke="black" cx="829.569" cy="-170.87" rx="49.4949" ry="26.7407"/>
<text text-anchor="middle" x="829.569" y="-174.67" font-family="Times,serif" font-size="14.00">sexplib</text>
<text text-anchor="middle" x="829.569" y="-159.67" font-family="Times,serif" font-size="14.00">113.33.03</text>
</g>
<!-- sexplib&#45;&gt;bigarray -->
<g id="edge56" class="edge"><title>sexplib&#45;&gt;bigarray</title>
<path fill="none" stroke="black" d="M793.534,-152.344C786.366,-149.273 778.813,-146.323 771.569,-144 699.394,-120.855 612.596,-105.568 559.784,-97.599"/>
<polygon fill="black" stroke="black" points="560.095,-94.1069 549.69,-96.1026 559.068,-101.031 560.095,-94.1069"/>
</g>
<!-- result -->
<g id="node11" class="node"><title>result</title>
<ellipse fill="#d95b43" stroke="black" cx="1698.57" cy="-170.87" rx="33.8824" ry="26.7407"/>
<text text-anchor="middle" x="1698.57" y="-174.67" font-family="Times,serif" font-size="14.00">result</text>
<text text-anchor="middle" x="1698.57" y="-159.67" font-family="Times,serif" font-size="14.00">1.0</text>
</g>
<!-- re.str -->
<g id="node12" class="node"><title>re.str</title>
<ellipse fill="#d95b43" stroke="black" cx="2052.57" cy="-619.571" rx="32.5538" ry="26.7407"/>
<text text-anchor="middle" x="2052.57" y="-623.371" font-family="Times,serif" font-size="14.00">re.str</text>
<text text-anchor="middle" x="2052.57" y="-608.371" font-family="Times,serif" font-size="14.00">1.5.0</text>
</g>
<!-- re.emacs -->
<g id="node13" class="node"><title>re.emacs</title>
<ellipse fill="#d95b43" stroke="black" cx="2052.57" cy="-529.831" rx="45.9239" ry="26.7407"/>
<text text-anchor="middle" x="2052.57" y="-533.631" font-family="Times,serif" font-size="14.00">re.emacs</text>
<text text-anchor="middle" x="2052.57" y="-518.631" font-family="Times,serif" font-size="14.00">1.5.0</text>
</g>
<!-- re.str&#45;&gt;re.emacs -->
<g id="edge27" class="edge"><title>re.str&#45;&gt;re.emacs</title>
<path fill="none" stroke="black" d="M2052.57,-592.246C2052.57,-584.279 2052.57,-575.388 2052.57,-566.9"/>
<polygon fill="black" stroke="black" points="2056.07,-566.834 2052.57,-556.835 2049.07,-566.835 2056.07,-566.834"/>
</g>
<!-- re -->
<g id="node14" class="node"><title>re</title>
<ellipse fill="#d95b43" stroke="black" cx="2126.57" cy="-440.09" rx="30.3115" ry="26.7407"/>
<text text-anchor="middle" x="2126.57" y="-443.89" font-family="Times,serif" font-size="14.00">re</text>
<text text-anchor="middle" x="2126.57" y="-428.89" font-family="Times,serif" font-size="14.00">1.5.0</text>
</g>
<!-- re.str&#45;&gt;re -->
<g id="edge26" class="edge"><title>re.str&#45;&gt;re</title>
<path fill="none" stroke="black" d="M2074.69,-599.557C2086.33,-588.291 2099.78,-573.047 2107.57,-556.701 2119.41,-531.861 2124.04,-500.99 2125.78,-477.398"/>
<polygon fill="black" stroke="black" points="2129.29,-477.308 2126.39,-467.119 2122.3,-476.894 2129.29,-477.308"/>
</g>
<!-- re.emacs&#45;&gt;re -->
<g id="edge25" class="edge"><title>re.emacs&#45;&gt;re</title>
<path fill="none" stroke="black" d="M2072.4,-505.318C2081.58,-494.43 2092.58,-481.392 2102.26,-469.916"/>
<polygon fill="black" stroke="black" points="2104.94,-472.168 2108.71,-462.267 2099.59,-467.655 2104.94,-472.168"/>
</g>
<!-- bytes -->
<g id="node37" class="node"><title>bytes</title>
<ellipse fill="#c02942" stroke="black" cx="1162.57" cy="-90" rx="29.4969" ry="18"/>
<text text-anchor="middle" x="1162.57" y="-86.3" font-family="Times,serif" font-size="14.00">bytes</text>
</g>
<!-- re&#45;&gt;bytes -->
<g id="edge28" class="edge"><title>re&#45;&gt;bytes</title>
<path fill="none" stroke="black" d="M2132.42,-413.515C2144.21,-354.542 2163.21,-209.107 2081.57,-144 2012.07,-88.5792 1369.28,-89.4573 1202.14,-90.6375"/>
<polygon fill="black" stroke="black" points="1202.02,-87.1382 1192.05,-90.7133 1202.08,-94.138 1202.02,-87.1382"/>
</g>
<!-- ocplib&#45;endian.bigstring -->
<g id="node15" class="node"><title>ocplib&#45;endian.bigstring</title>
<ellipse fill="#d95b43" stroke="black" cx="660.569" cy="-170.87" rx="101.647" ry="26.7407"/>
<text text-anchor="middle" x="660.569" y="-174.67" font-family="Times,serif" font-size="14.00">ocplib&#45;endian.bigstring</text>
<text text-anchor="middle" x="660.569" y="-159.67" font-family="Times,serif" font-size="14.00">0.8</text>
</g>
<!-- ocplib&#45;endian.bigstring&#45;&gt;bytes -->
<g id="edge58" class="edge"><title>ocplib&#45;endian.bigstring&#45;&gt;bytes</title>
<path fill="none" stroke="black" d="M733.207,-151.907C745.948,-149.052 759.113,-146.29 771.569,-144 899.735,-120.432 1053.33,-102.624 1123.79,-95.0301"/>
<polygon fill="black" stroke="black" points="1124.4,-98.4852 1133.97,-93.9419 1123.65,-91.5248 1124.4,-98.4852"/>
</g>
<!-- ocplib&#45;endian.bigstring&#45;&gt;bigarray -->
<g id="edge57" class="edge"><title>ocplib&#45;endian.bigstring&#45;&gt;bigarray</title>
<path fill="none" stroke="black" d="M616.267,-146.42C593.551,-134.395 566.325,-119.984 545.331,-108.872"/>
<polygon fill="black" stroke="black" points="546.931,-105.758 536.455,-104.173 543.656,-111.945 546.931,-105.758"/>
</g>
<!-- ocplib&#45;endian -->
<g id="node16" class="node"><title>ocplib&#45;endian</title>
<ellipse fill="#d95b43" stroke="black" cx="999.569" cy="-170.87" rx="65.1077" ry="26.7407"/>
<text text-anchor="middle" x="999.569" y="-174.67" font-family="Times,serif" font-size="14.00">ocplib&#45;endian</text>
<text text-anchor="middle" x="999.569" y="-159.67" font-family="Times,serif" font-size="14.00">0.8</text>
</g>
<!-- ocplib&#45;endian&#45;&gt;bytes -->
<g id="edge59" class="edge"><title>ocplib&#45;endian&#45;&gt;bytes</title>
<path fill="none" stroke="black" d="M1040.7,-149.968C1068.63,-136.453 1105.03,-118.842 1130.75,-106.397"/>
<polygon fill="black" stroke="black" points="1132.57,-109.405 1140.04,-101.899 1129.52,-103.104 1132.57,-109.405"/>
</g>
<!-- mirage.runtime -->
<g id="node17" class="node"><title>mirage.runtime</title>
<ellipse fill="#ecd078" stroke="black" cx="2016.57" cy="-350.35" rx="72.6644" ry="26.7407"/>
<text text-anchor="middle" x="2016.57" y="-354.15" font-family="Times,serif" font-size="14.00">mirage.runtime</text>
<text text-anchor="middle" x="2016.57" y="-339.15" font-family="Times,serif" font-size="14.00">2.9.0</text>
</g>
<!-- logs -->
<g id="node29" class="node"><title>logs</title>
<ellipse fill="#d95b43" stroke="black" cx="1698.57" cy="-260.61" rx="30.3115" ry="26.7407"/>
<text text-anchor="middle" x="1698.57" y="-264.41" font-family="Times,serif" font-size="14.00">logs</text>
<text text-anchor="middle" x="1698.57" y="-249.41" font-family="Times,serif" font-size="14.00">0.5.0</text>
</g>
<!-- mirage.runtime&#45;&gt;logs -->
<g id="edge7" class="edge"><title>mirage.runtime&#45;&gt;logs</title>
<path fill="none" stroke="black" d="M1962.51,-332.33C1951.65,-329.181 1940.29,-326.072 1929.57,-323.48 1845.18,-303.08 1818.02,-320.128 1737.57,-287.48 1735.04,-286.456 1732.51,-285.256 1730.02,-283.944"/>
<polygon fill="black" stroke="black" points="1731.63,-280.833 1721.23,-278.817 1728.1,-286.879 1731.63,-280.833"/>
</g>
<!-- ipaddr -->
<g id="node30" class="node"><title>ipaddr</title>
<ellipse fill="#d95b43" stroke="black" cx="1783.57" cy="-260.61" rx="36.5405" ry="26.7407"/>
<text text-anchor="middle" x="1783.57" y="-264.41" font-family="Times,serif" font-size="14.00">ipaddr</text>
<text text-anchor="middle" x="1783.57" y="-249.41" font-family="Times,serif" font-size="14.00">2.7.0</text>
</g>
<!-- mirage.runtime&#45;&gt;ipaddr -->
<g id="edge5" class="edge"><title>mirage.runtime&#45;&gt;ipaddr</title>
<path fill="none" stroke="black" d="M1961.73,-332.496C1915.62,-318.085 1853.5,-298.05 1829.57,-287.48 1826.55,-286.148 1823.47,-284.678 1820.41,-283.137"/>
<polygon fill="black" stroke="black" points="1821.83,-279.926 1811.35,-278.361 1818.56,-286.119 1821.83,-279.926"/>
</g>
<!-- functoria.runtime -->
<g id="node32" class="node"><title>functoria.runtime</title>
<ellipse fill="#ecd078" stroke="black" cx="2016.57" cy="-260.61" rx="82.0488" ry="26.7407"/>
<text text-anchor="middle" x="2016.57" y="-264.41" font-family="Times,serif" font-size="14.00">functoria.runtime</text>
<text text-anchor="middle" x="2016.57" y="-249.41" font-family="Times,serif" font-size="14.00">1.1.0</text>
</g>
<!-- mirage.runtime&#45;&gt;functoria.runtime -->
<g id="edge4" class="edge"><title>mirage.runtime&#45;&gt;functoria.runtime</title>
<path fill="none" stroke="black" d="M2016.57,-323.025C2016.57,-315.059 2016.57,-306.168 2016.57,-297.679"/>
<polygon fill="black" stroke="black" points="2020.07,-297.614 2016.57,-287.614 2013.07,-297.614 2020.07,-297.614"/>
</g>
<!-- astring -->
<g id="node39" class="node"><title>astring</title>
<ellipse fill="#d95b43" stroke="black" cx="1877.57" cy="-260.61" rx="38.7821" ry="26.7407"/>
<text text-anchor="middle" x="1877.57" y="-264.41" font-family="Times,serif" font-size="14.00">astring</text>
<text text-anchor="middle" x="1877.57" y="-249.41" font-family="Times,serif" font-size="14.00">0.8.1</text>
</g>
<!-- mirage.runtime&#45;&gt;astring -->
<g id="edge6" class="edge"><title>mirage.runtime&#45;&gt;astring</title>
<path fill="none" stroke="black" d="M1980.77,-326.755C1960.36,-313.871 1934.83,-297.756 1914.27,-284.778"/>
<polygon fill="black" stroke="black" points="1916.12,-281.805 1905.79,-279.427 1912.38,-287.724 1916.12,-281.805"/>
</g>
<!-- mirage&#45;xen -->
<g id="node18" class="node"><title>mirage&#45;xen</title>
<ellipse fill="#ecd078" stroke="black" cx="909.569" cy="-619.571" rx="56.6372" ry="26.7407"/>
<text text-anchor="middle" x="909.569" y="-623.371" font-family="Times,serif" font-size="14.00">mirage&#45;xen</text>
<text text-anchor="middle" x="909.569" y="-608.371" font-family="Times,serif" font-size="14.00">2.6.0</text>
</g>
<!-- mirage&#45;xen&#45;&gt;xenstore.client -->
<g id="edge70" class="edge"><title>mirage&#45;xen&#45;&gt;xenstore.client</title>
<path fill="none" stroke="black" d="M909.569,-592.246C909.569,-584.279 909.569,-575.388 909.569,-566.9"/>
<polygon fill="black" stroke="black" points="913.069,-566.834 909.569,-556.835 906.069,-566.835 913.069,-566.834"/>
</g>
<!-- mirage&#45;xen&#45;&gt;xen&#45;gnt -->
<g id="edge69" class="edge"><title>mirage&#45;xen&#45;&gt;xen&#45;gnt</title>
<path fill="none" stroke="black" d="M854.043,-614.213C779.391,-607.293 643.146,-590.91 531.569,-556.701 526.702,-555.208 521.712,-553.379 516.812,-551.388"/>
<polygon fill="black" stroke="black" points="518.126,-548.143 507.557,-547.408 515.361,-554.574 518.126,-548.143"/>
</g>
<!-- mirage&#45;xen&#45;&gt;xen&#45;evtchn -->
<g id="edge68" class="edge"><title>mirage&#45;xen&#45;&gt;xen&#45;evtchn</title>
<path fill="none" stroke="black" d="M853.176,-616.52C687.878,-610.156 212.274,-589.197 150.569,-556.701 116.433,-538.723 90.167,-502.454 74.1871,-475.308"/>
<polygon fill="black" stroke="black" points="77.156,-473.448 69.1657,-466.491 71.0734,-476.913 77.156,-473.448"/>
</g>
<!-- mirage&#45;xen&#45;&gt;shared&#45;memory&#45;ring.xenstore -->
<g id="edge73" class="edge"><title>mirage&#45;xen&#45;&gt;shared&#45;memory&#45;ring.xenstore</title>
<path fill="none" stroke="black" d="M954.57,-603.086C992.134,-590.161 1046.44,-571.476 1090.42,-556.344"/>
<polygon fill="black" stroke="black" points="1091.6,-559.638 1099.92,-553.075 1089.33,-553.019 1091.6,-559.638"/>
</g>
<!-- mirage&#45;xen&#45;&gt;shared&#45;memory&#45;ring.lwt -->
<g id="edge72" class="edge"><title>mirage&#45;xen&#45;&gt;shared&#45;memory&#45;ring.lwt</title>
<path fill="none" stroke="black" d="M963.888,-611.856C1045.04,-601.56 1202.61,-580.542 1335.57,-556.701 1346.17,-554.799 1357.26,-552.65 1368.25,-550.423"/>
<polygon fill="black" stroke="black" points="1369.19,-553.802 1378.29,-548.361 1367.79,-546.945 1369.19,-553.802"/>
</g>
<!-- mirage&#45;xen&#45;&gt;shared&#45;memory&#45;ring.console -->
<g id="edge74" class="edge"><title>mirage&#45;xen&#45;&gt;shared&#45;memory&#45;ring.console</title>
<path fill="none" stroke="black" d="M867.937,-601.341C838.067,-588.978 797.221,-572.073 763.012,-557.915"/>
<polygon fill="black" stroke="black" points="764.132,-554.591 753.553,-554.001 761.455,-561.059 764.132,-554.591"/>
</g>
<!-- mirage&#45;xen&#45;&gt;shared&#45;memory&#45;ring -->
<g id="edge71" class="edge"><title>mirage&#45;xen&#45;&gt;shared&#45;memory&#45;ring</title>
<path fill="none" stroke="black" d="M941.673,-597.314C956.925,-586.289 974.786,-571.953 988.569,-556.701 1000.79,-543.173 1024.63,-504.255 1041.74,-475.287"/>
<polygon fill="black" stroke="black" points="1044.77,-477.05 1046.82,-466.656 1038.73,-473.502 1044.77,-477.05"/>
</g>
<!-- mirage&#45;types -->
<g id="node20" class="node"><title>mirage&#45;types</title>
<ellipse fill="#d95b43" stroke="black" cx="364.569" cy="-440.09" rx="62.4516" ry="26.7407"/>
<text text-anchor="middle" x="364.569" y="-443.89" font-family="Times,serif" font-size="14.00">mirage&#45;types</text>
<text text-anchor="middle" x="364.569" y="-428.89" font-family="Times,serif" font-size="14.00">2.8.0</text>
</g>
<!-- mirage&#45;xen&#45;&gt;mirage&#45;types -->
<g id="edge75" class="edge"><title>mirage&#45;xen&#45;&gt;mirage&#45;types</title>
<path fill="none" stroke="black" d="M853.283,-615.462C726.218,-607.936 425.521,-587.093 391.569,-556.701 369.702,-537.127 363.807,-503.564 362.881,-477.627"/>
<polygon fill="black" stroke="black" points="366.378,-477.353 362.753,-467.398 359.379,-477.441 366.378,-477.353"/>
</g>
<!-- mirage&#45;xen&#45;&gt;mirage&#45;profile -->
<g id="edge78" class="edge"><title>mirage&#45;xen&#45;&gt;mirage&#45;profile</title>
<path fill="none" stroke="black" d="M966.35,-618.292C1064.62,-616.472 1259.99,-606.51 1302.57,-556.701 1318.09,-538.546 1311.72,-525.022 1302.57,-502.96 1297.6,-490.991 1289.07,-480.134 1279.9,-470.976"/>
<polygon fill="black" stroke="black" points="1282.16,-468.291 1272.47,-464.006 1277.37,-473.398 1282.16,-468.291"/>
</g>
<!-- mirage&#45;clock&#45;xen -->
<g id="node26" class="node"><title>mirage&#45;clock&#45;xen</title>
<ellipse fill="#ecd078" stroke="black" cx="1794.57" cy="-529.831" rx="79.8063" ry="26.7407"/>
<text text-anchor="middle" x="1794.57" y="-533.631" font-family="Times,serif" font-size="14.00">mirage&#45;clock&#45;xen</text>
<text text-anchor="middle" x="1794.57" y="-518.631" font-family="Times,serif" font-size="14.00">1.0.0</text>
</g>
<!-- mirage&#45;xen&#45;&gt;mirage&#45;clock&#45;xen -->
<g id="edge76" class="edge"><title>mirage&#45;xen&#45;&gt;mirage&#45;clock&#45;xen</title>
<path fill="none" stroke="black" d="M966.541,-618.139C1097.91,-616.277 1431.81,-606.579 1705.57,-556.701 1713.14,-555.322 1720.98,-553.555 1728.74,-551.594"/>
<polygon fill="black" stroke="black" points="1729.71,-554.958 1738.49,-549.021 1727.93,-548.189 1729.71,-554.958"/>
</g>
<!-- mirage&#45;xen&#45;&gt;lwt -->
<g id="edge66" class="edge"><title>mirage&#45;xen&#45;&gt;lwt</title>
<path fill="none" stroke="black" d="M966.189,-617.092C1169.45,-611.513 1852.01,-590.329 1883.57,-556.701 1899.91,-539.285 1898.03,-521.972 1883.57,-502.96 1820.87,-420.527 1492.39,-371.254 1376.83,-356.259"/>
<polygon fill="black" stroke="black" points="1377.01,-352.753 1366.64,-354.954 1376.12,-359.696 1377.01,-352.753"/>
</g>
<!-- mirage&#45;xen&#45;&gt;io&#45;page -->
<g id="edge77" class="edge"><title>mirage&#45;xen&#45;&gt;io&#45;page</title>
<path fill="none" stroke="black" d="M853.011,-616.896C764.773,-612.958 600.687,-599.872 564.569,-556.701 544.754,-533.017 559.09,-498.213 574.784,-472.984"/>
<polygon fill="black" stroke="black" points="577.792,-474.778 580.338,-464.493 571.934,-470.946 577.792,-474.778"/>
</g>
<!-- mirage&#45;xen&#45;&gt;cstruct -->
<g id="edge67" class="edge"><title>mirage&#45;xen&#45;&gt;cstruct</title>
<path fill="none" stroke="black" d="M853.212,-615.503C731.46,-608.3 452.546,-588.474 424.569,-556.701 371.882,-496.866 514.691,-391.074 636.569,-323.48 683.09,-297.679 741.977,-280.774 782.399,-271.256"/>
<polygon fill="black" stroke="black" points="783.294,-274.642 792.259,-268.995 781.729,-267.819 783.294,-274.642"/>
</g>
<!-- mirage&#45;types.lwt -->
<g id="node19" class="node"><title>mirage&#45;types.lwt</title>
<ellipse fill="#ecd078" stroke="black" cx="207.569" cy="-440.09" rx="76.2353" ry="26.7407"/>
<text text-anchor="middle" x="207.569" y="-443.89" font-family="Times,serif" font-size="14.00">mirage&#45;types.lwt</text>
<text text-anchor="middle" x="207.569" y="-428.89" font-family="Times,serif" font-size="14.00">2.8.0</text>
</g>
<!-- mirage&#45;profile&#45;&gt;ocplib&#45;endian.bigstring -->
<g id="edge43" class="edge"><title>mirage&#45;profile&#45;&gt;ocplib&#45;endian.bigstring</title>
<path fill="none" stroke="black" d="M1207.55,-416.441C1171.78,-392.27 1112.68,-353.414 1059.57,-323.48 981.002,-279.197 961.72,-266.178 877.569,-233.74 834.513,-217.143 785.139,-202.721 744.376,-191.986"/>
<polygon fill="black" stroke="black" points="745.036,-188.542 734.477,-189.407 743.271,-195.315 745.036,-188.542"/>
</g>
<!-- mirage&#45;profile&#45;&gt;lwt -->
<g id="edge42" class="edge"><title>mirage&#45;profile&#45;&gt;lwt</title>
<path fill="none" stroke="black" d="M1266.8,-415.115C1279.7,-403.324 1295.27,-389.1 1308.42,-377.081"/>
<polygon fill="black" stroke="black" points="1310.82,-379.624 1315.84,-370.294 1306.1,-374.457 1310.82,-379.624"/>
</g>
<!-- mirage&#45;profile&#45;&gt;cstruct.ppx -->
<g id="edge45" class="edge"><title>mirage&#45;profile&#45;&gt;cstruct.ppx</title>
<path fill="none" stroke="black" d="M1190.64,-421.65C1181.67,-418.706 1172.37,-415.779 1163.57,-413.22 1098.72,-394.369 1023.39,-376.304 972.304,-364.613"/>
<polygon fill="black" stroke="black" points="972.947,-361.17 962.42,-362.362 971.393,-367.996 972.947,-361.17"/>
</g>
<!-- mirage&#45;profile&#45;&gt;cstruct -->
<g id="edge44" class="edge"><title>mirage&#45;profile&#45;&gt;cstruct</title>
<path fill="none" stroke="black" d="M1189.66,-422.263C1148.87,-408.367 1095.31,-389.066 1075.57,-377.22 1044.59,-358.629 1045.88,-341.511 1014.57,-323.48 970.79,-298.27 915.217,-281.433 876.458,-271.77"/>
<polygon fill="black" stroke="black" points="877.035,-268.308 866.491,-269.351 875.383,-275.111 877.035,-268.308"/>
</g>
<!-- mirage&#45;logs -->
<g id="node22" class="node"><title>mirage&#45;logs</title>
<ellipse fill="#ecd078" stroke="black" cx="1639.57" cy="-529.831" rx="57.0522" ry="26.7407"/>
<text text-anchor="middle" x="1639.57" y="-533.631" font-family="Times,serif" font-size="14.00">mirage&#45;logs</text>
<text text-anchor="middle" x="1639.57" y="-518.631" font-family="Times,serif" font-size="14.00">0.2</text>
</g>
<!-- mirage&#45;logs&#45;&gt;mirage&#45;types -->
<g id="edge10" class="edge"><title>mirage&#45;logs&#45;&gt;mirage&#45;types</title>
<path fill="none" stroke="black" d="M1599.12,-510.738C1590.51,-507.594 1581.36,-504.76 1572.57,-502.96 1349.71,-457.36 776.181,-486.739 549.569,-466.96 510.46,-463.547 466.972,-457.578 431.991,-452.232"/>
<polygon fill="black" stroke="black" points="432.31,-448.74 421.893,-450.671 431.241,-455.658 432.31,-448.74"/>
</g>
<!-- mirage&#45;logs&#45;&gt;mirage&#45;profile -->
<g id="edge12" class="edge"><title>mirage&#45;logs&#45;&gt;mirage&#45;profile</title>
<path fill="none" stroke="black" d="M1597.8,-511.343C1589.53,-508.269 1580.85,-505.308 1572.57,-502.96 1485.38,-478.233 1382.45,-460.811 1314.57,-450.887"/>
<polygon fill="black" stroke="black" points="1314.8,-447.383 1304.4,-449.418 1313.8,-454.312 1314.8,-447.383"/>
</g>
<!-- mirage&#45;logs&#45;&gt;lwt -->
<g id="edge11" class="edge"><title>mirage&#45;logs&#45;&gt;lwt</title>
<path fill="none" stroke="black" d="M1604.81,-508.471C1546.23,-474.159 1428.57,-405.24 1370.53,-371.244"/>
<polygon fill="black" stroke="black" points="1372.15,-368.133 1361.75,-366.099 1368.61,-374.173 1372.15,-368.133"/>
</g>
<!-- mirage&#45;logs&#45;&gt;logs -->
<g id="edge9" class="edge"><title>mirage&#45;logs&#45;&gt;logs</title>
<path fill="none" stroke="black" d="M1645.33,-502.722C1655.98,-454.482 1678.75,-351.357 1690.77,-296.929"/>
<polygon fill="black" stroke="black" points="1694.22,-297.56 1692.95,-287.041 1687.38,-296.051 1694.22,-297.56"/>
</g>
<!-- mirage&#45;console.xen -->
<g id="node23" class="node"><title>mirage&#45;console.xen</title>
<ellipse fill="#ecd078" stroke="black" cx="280.569" cy="-709.311" rx="88.2768" ry="26.7407"/>
<text text-anchor="middle" x="280.569" y="-713.111" font-family="Times,serif" font-size="14.00">mirage&#45;console.xen</text>
<text text-anchor="middle" x="280.569" y="-698.111" font-family="Times,serif" font-size="14.00">2.1.3</text>
</g>
<!-- mirage&#45;console.xen&#45;&gt;xen&#45;gnt -->
<g id="edge22" class="edge"><title>mirage&#45;console.xen&#45;&gt;xen&#45;gnt</title>
<path fill="none" stroke="black" d="M325.739,-686.196C344.964,-675.621 366.962,-661.892 384.569,-646.441 412.389,-622.025 437.873,-588.205 454.75,-563.452"/>
<polygon fill="black" stroke="black" points="457.686,-565.359 460.351,-555.105 451.873,-561.459 457.686,-565.359"/>
</g>
<!-- mirage&#45;console.xen&#45;&gt;xen&#45;evtchn -->
<g id="edge23" class="edge"><title>mirage&#45;console.xen&#45;&gt;xen&#45;evtchn</title>
<path fill="none" stroke="black" d="M201.075,-697.374C141.92,-687.425 68.3129,-670.586 49.5685,-646.441 11.6412,-597.584 28.3007,-520.709 43.0028,-476.18"/>
<polygon fill="black" stroke="black" points="46.335,-477.253 46.2805,-466.658 39.7162,-474.974 46.335,-477.253"/>
</g>
<!-- mirage&#45;console.xen&#45;&gt;mirage&#45;xen -->
<g id="edge20" class="edge"><title>mirage&#45;console.xen&#45;&gt;mirage&#45;xen</title>
<path fill="none" stroke="black" d="M359.913,-697.243C486.065,-679.646 729.912,-645.631 845.631,-629.489"/>
<polygon fill="black" stroke="black" points="846.332,-632.926 855.752,-628.078 845.364,-625.993 846.332,-632.926"/>
</g>
<!-- mirage&#45;console.xen&#45;&gt;mirage&#45;types -->
<g id="edge19" class="edge"><title>mirage&#45;console.xen&#45;&gt;mirage&#45;types</title>
<path fill="none" stroke="black" d="M193.47,-704.448C151.962,-697.68 105.759,-681.906 79.5685,-646.441 41.686,-595.144 38.4054,-551.664 79.5685,-502.96 110.556,-466.297 246.131,-479.125 292.569,-466.96 298.166,-465.494 303.943,-463.778 309.677,-461.939"/>
<polygon fill="black" stroke="black" points="310.865,-465.233 319.246,-458.751 308.653,-458.591 310.865,-465.233"/>
</g>
<!-- mirage&#45;console.proto -->
<g id="node24" class="node"><title>mirage&#45;console.proto</title>
<ellipse fill="#d95b43" stroke="black" cx="280.569" cy="-619.571" rx="94.5053" ry="26.7407"/>
<text text-anchor="middle" x="280.569" y="-623.371" font-family="Times,serif" font-size="14.00">mirage&#45;console.proto</text>
<text text-anchor="middle" x="280.569" y="-608.371" font-family="Times,serif" font-size="14.00">2.1.3</text>
</g>
<!-- mirage&#45;console.xen&#45;&gt;mirage&#45;console.proto -->
<g id="edge24" class="edge"><title>mirage&#45;console.xen&#45;&gt;mirage&#45;console.proto</title>
<path fill="none" stroke="black" d="M280.569,-681.986C280.569,-674.019 280.569,-665.128 280.569,-656.64"/>
<polygon fill="black" stroke="black" points="284.069,-656.575 280.569,-646.575 277.069,-656.575 284.069,-656.575"/>
</g>
<!-- mirage&#45;console.xen&#45;&gt;lwt -->
<g id="edge18" class="edge"><title>mirage&#45;console.xen&#45;&gt;lwt</title>
<path fill="none" stroke="black" d="M368.708,-706.861C692.055,-700.643 1799.71,-671.085 1903.57,-556.701 1983.56,-468.601 1820.37,-430.272 1777.57,-413.22 1638.21,-357.697 1456.75,-350.798 1377.07,-350.711"/>
<polygon fill="black" stroke="black" points="1376.96,-347.211 1366.97,-350.737 1376.98,-354.211 1376.96,-347.211"/>
</g>
<!-- mirage&#45;console.xen&#45;&gt;io&#45;page -->
<g id="edge21" class="edge"><title>mirage&#45;console.xen&#45;&gt;io&#45;page</title>
<path fill="none" stroke="black" d="M228.785,-687.344C209.98,-677.438 190.06,-663.894 176.569,-646.441 136.933,-595.167 107.71,-551.573 150.569,-502.96 192.785,-455.076 372.37,-475.965 435.569,-466.96 474.219,-461.454 517.901,-454.48 550.31,-449.161"/>
<polygon fill="black" stroke="black" points="551.118,-452.576 560.416,-447.497 549.98,-445.669 551.118,-452.576"/>
</g>
<!-- mirage&#45;console.proto&#45;&gt;xenstore -->
<g id="edge16" class="edge"><title>mirage&#45;console.proto&#45;&gt;xenstore</title>
<path fill="none" stroke="black" d="M303.212,-593.291C329.44,-565.87 375.387,-523.297 424.569,-502.96 562.135,-446.078 612.577,-500.688 757.569,-466.96 765.654,-465.08 774.079,-462.548 782.183,-459.803"/>
<polygon fill="black" stroke="black" points="783.605,-463.012 791.865,-456.377 781.27,-456.413 783.605,-463.012"/>
</g>
<!-- mirage&#45;console -->
<g id="node25" class="node"><title>mirage&#45;console</title>
<ellipse fill="#d95b43" stroke="black" cx="230.569" cy="-529.831" rx="71.3357" ry="26.7407"/>
<text text-anchor="middle" x="230.569" y="-533.631" font-family="Times,serif" font-size="14.00">mirage&#45;console</text>
<text text-anchor="middle" x="230.569" y="-518.631" font-family="Times,serif" font-size="14.00">2.1.3</text>
</g>
<!-- mirage&#45;console.proto&#45;&gt;mirage&#45;console -->
<g id="edge17" class="edge"><title>mirage&#45;console.proto&#45;&gt;mirage&#45;console</title>
<path fill="none" stroke="black" d="M265.837,-592.72C260.911,-584.076 255.342,-574.303 250.108,-565.118"/>
<polygon fill="black" stroke="black" points="253.014,-563.149 245.022,-556.194 246.933,-566.615 253.014,-563.149"/>
</g>
<!-- mirage&#45;console&#45;&gt;mirage&#45;types.lwt -->
<g id="edge15" class="edge"><title>mirage&#45;console&#45;&gt;mirage&#45;types.lwt</title>
<path fill="none" stroke="black" d="M223.792,-502.98C221.659,-494.842 219.263,-485.702 216.981,-476.995"/>
<polygon fill="black" stroke="black" points="220.297,-475.845 214.376,-467.059 213.526,-477.62 220.297,-475.845"/>
</g>
<!-- mirage&#45;console&#45;&gt;mirage&#45;types -->
<g id="edge14" class="edge"><title>mirage&#45;console&#45;&gt;mirage&#45;types</title>
<path fill="none" stroke="black" d="M265.077,-506.235C282.616,-494.751 304.075,-480.7 322.567,-468.592"/>
<polygon fill="black" stroke="black" points="324.654,-471.409 331.103,-463.003 320.82,-465.553 324.654,-471.409"/>
</g>
<!-- mirage&#45;console&#45;&gt;lwt -->
<g id="edge13" class="edge"><title>mirage&#45;console&#45;&gt;lwt</title>
<path fill="none" stroke="black" d="M288.502,-514.038C305.519,-510.043 324.221,-505.993 341.569,-502.96 476.461,-479.382 515.238,-502.182 647.569,-466.96 706.401,-451.302 714.676,-428.654 773.569,-413.22 872.742,-387.231 1183.89,-362.531 1295.89,-354.263"/>
<polygon fill="black" stroke="black" points="1296.38,-357.737 1306.1,-353.515 1295.87,-350.756 1296.38,-357.737"/>
</g>
<!-- mirage&#45;bootvar -->
<g id="node27" class="node"><title>mirage&#45;bootvar</title>
<ellipse fill="#ecd078" stroke="black" cx="2015.57" cy="-709.311" rx="72.25" ry="26.7407"/>
<text text-anchor="middle" x="2015.57" y="-713.111" font-family="Times,serif" font-size="14.00">mirage&#45;bootvar</text>
<text text-anchor="middle" x="2015.57" y="-698.111" font-family="Times,serif" font-size="14.00">0.3.1</text>
</g>
<!-- mirage&#45;bootvar&#45;&gt;re.str -->
<g id="edge83" class="edge"><title>mirage&#45;bootvar&#45;&gt;re.str</title>
<path fill="none" stroke="black" d="M2026.47,-682.46C2030.14,-673.756 2034.29,-663.907 2038.19,-654.667"/>
<polygon fill="black" stroke="black" points="2041.47,-655.907 2042.13,-645.332 2035.02,-653.187 2041.47,-655.907"/>
</g>
<!-- mirage&#45;bootvar&#45;&gt;re -->
<g id="edge82" class="edge"><title>mirage&#45;bootvar&#45;&gt;re</title>
<path fill="none" stroke="black" d="M2052.19,-685.901C2066.94,-675.407 2083.14,-661.821 2094.57,-646.441 2133.72,-593.758 2131.16,-568.58 2129.57,-502.96 2129.36,-494.553 2129.01,-485.509 2128.6,-477.001"/>
<polygon fill="black" stroke="black" points="2132.1,-476.781 2128.1,-466.968 2125.11,-477.131 2132.1,-476.781"/>
</g>
<!-- mirage&#45;bootvar&#45;&gt;mirage&#45;xen -->
<g id="edge81" class="edge"><title>mirage&#45;bootvar&#45;&gt;mirage&#45;xen</title>
<path fill="none" stroke="black" d="M1945.54,-702.756C1744.95,-686.842 1170.12,-641.24 975.159,-625.774"/>
<polygon fill="black" stroke="black" points="975.309,-622.275 965.063,-624.973 974.755,-629.253 975.309,-622.275"/>
</g>
<!-- mirage&#45;bootvar&#45;&gt;lwt -->
<g id="edge80" class="edge"><title>mirage&#45;bootvar&#45;&gt;lwt</title>
<path fill="none" stroke="black" d="M2010.74,-682.254C1997.96,-616.423 1961.16,-446.301 1916.57,-413.22 1873.35,-381.16 1502.06,-359.686 1377.28,-353.321"/>
<polygon fill="black" stroke="black" points="1377.17,-349.811 1367.01,-352.803 1376.82,-356.803 1377.17,-349.811"/>
</g>
<!-- lwt&#45;&gt;bytes -->
<g id="edge79" class="edge"><title>lwt&#45;&gt;bytes</title>
<path fill="none" stroke="black" d="M1321.43,-326.875C1288.97,-278.682 1212.9,-165.726 1179.17,-115.65"/>
<polygon fill="black" stroke="black" points="1181.87,-113.4 1173.39,-107.061 1176.07,-117.311 1181.87,-113.4"/>
</g>
<!-- logs&#45;&gt;result -->
<g id="edge8" class="edge"><title>logs&#45;&gt;result</title>
<path fill="none" stroke="black" d="M1698.57,-233.285C1698.57,-225.319 1698.57,-216.428 1698.57,-207.939"/>
<polygon fill="black" stroke="black" points="1702.07,-207.874 1698.57,-197.874 1695.07,-207.874 1702.07,-207.874"/>
</g>
<!-- ipaddr&#45;&gt;sexplib -->
<g id="edge3" class="edge"><title>ipaddr&#45;&gt;sexplib</title>
<path fill="none" stroke="black" d="M1756.76,-241.8C1750.68,-238.55 1744.09,-235.603 1737.57,-233.74 1563.9,-184.118 1104.06,-225.404 925.569,-197.74 911.156,-195.506 895.8,-191.929 881.693,-188.138"/>
<polygon fill="black" stroke="black" points="882.245,-184.659 871.673,-185.357 880.372,-191.404 882.245,-184.659"/>
</g>
<!-- ipaddr&#45;&gt;bytes -->
<g id="edge2" class="edge"><title>ipaddr&#45;&gt;bytes</title>
<path fill="none" stroke="black" d="M1781.88,-233.338C1778.62,-206.312 1769.13,-165.254 1741.57,-144 1698.94,-111.136 1325.45,-96.2443 1201.99,-92.1895"/>
<polygon fill="black" stroke="black" points="1201.96,-88.6866 1191.85,-91.8624 1201.73,-95.683 1201.96,-88.6866"/>
</g>
<!-- io&#45;page&#45;&gt;cstruct -->
<g id="edge46" class="edge"><title>io&#45;page&#45;&gt;cstruct</title>
<path fill="none" stroke="black" d="M612.85,-414.511C628.779,-388.898 656.678,-349.009 689.569,-323.48 718.047,-301.376 755.659,-285.324 784.726,-275.118"/>
<polygon fill="black" stroke="black" points="785.893,-278.418 794.23,-271.88 783.636,-271.792 785.893,-278.418"/>
</g>
<!-- io&#45;page&#45;&gt;bytes -->
<g id="edge47" class="edge"><title>io&#45;page&#45;&gt;bytes</title>
<path fill="none" stroke="black" d="M627.965,-421.87C633.136,-418.933 638.488,-415.951 643.569,-413.22 737.715,-362.622 989.803,-264.126 1073.57,-197.74 1103.41,-174.087 1130.29,-139.025 1146.51,-115.614"/>
<polygon fill="black" stroke="black" points="1149.46,-117.498 1152.19,-107.26 1143.67,-113.562 1149.46,-117.498"/>
</g>
<!-- fmt -->
<g id="node33" class="node"><title>fmt</title>
<ellipse fill="#d95b43" stroke="black" cx="2042.57" cy="-170.87" rx="30.3115" ry="26.7407"/>
<text text-anchor="middle" x="2042.57" y="-174.67" font-family="Times,serif" font-size="14.00">fmt</text>
<text text-anchor="middle" x="2042.57" y="-159.67" font-family="Times,serif" font-size="14.00">0.7.1</text>
</g>
<!-- functoria.runtime&#45;&gt;fmt -->
<g id="edge85" class="edge"><title>functoria.runtime&#45;&gt;fmt</title>
<path fill="none" stroke="black" d="M2024.23,-233.76C2026.73,-225.313 2029.55,-215.786 2032.22,-206.786"/>
<polygon fill="black" stroke="black" points="2035.66,-207.514 2035.14,-196.932 2028.94,-205.526 2035.66,-207.514"/>
</g>
<!-- cmdliner -->
<g id="node36" class="node"><title>cmdliner</title>
<ellipse fill="#d95b43" stroke="black" cx="1946.57" cy="-170.87" rx="47.2526" ry="26.7407"/>
<text text-anchor="middle" x="1946.57" y="-174.67" font-family="Times,serif" font-size="14.00">cmdliner</text>
<text text-anchor="middle" x="1946.57" y="-159.67" font-family="Times,serif" font-size="14.00">0.9.8</text>
</g>
<!-- functoria.runtime&#45;&gt;cmdliner -->
<g id="edge84" class="edge"><title>functoria.runtime&#45;&gt;cmdliner</title>
<path fill="none" stroke="black" d="M1996.32,-234.232C1988.68,-224.648 1979.88,-213.622 1971.83,-203.532"/>
<polygon fill="black" stroke="black" points="1974.54,-201.32 1965.57,-195.686 1969.07,-205.686 1974.54,-201.32"/>
</g>
<!-- cstruct.ppx&#45;&gt;cstruct -->
<g id="edge41" class="edge"><title>cstruct.ppx&#45;&gt;cstruct</title>
<path fill="none" stroke="black" d="M889.888,-325.375C879.827,-314.739 867.893,-302.123 857.306,-290.932"/>
<polygon fill="black" stroke="black" points="859.647,-288.313 850.232,-283.454 854.562,-293.124 859.647,-288.313"/>
</g>
<!-- cstruct&#45;&gt;sexplib -->
<g id="edge65" class="edge"><title>cstruct&#45;&gt;sexplib</title>
<path fill="none" stroke="black" d="M829.569,-233.285C829.569,-225.319 829.569,-216.428 829.569,-207.939"/>
<polygon fill="black" stroke="black" points="833.069,-207.874 829.569,-197.874 826.069,-207.874 833.069,-207.874"/>
</g>
<!-- cstruct&#45;&gt;ocplib&#45;endian.bigstring -->
<g id="edge64" class="edge"><title>cstruct&#45;&gt;ocplib&#45;endian.bigstring</title>
<path fill="none" stroke="black" d="M798.964,-243.721C775.361,-231.467 742.128,-214.214 714.145,-199.685"/>
<polygon fill="black" stroke="black" points="715.75,-196.575 705.262,-195.074 712.525,-202.788 715.75,-196.575"/>
</g>
<!-- cstruct&#45;&gt;ocplib&#45;endian -->
<g id="edge63" class="edge"><title>cstruct&#45;&gt;ocplib&#45;endian</title>
<path fill="none" stroke="black" d="M860.354,-243.721C885.565,-230.709 921.696,-212.061 950.832,-197.024"/>
<polygon fill="black" stroke="black" points="952.742,-199.977 960.023,-192.28 949.531,-193.757 952.742,-199.977"/>
</g>
<!-- cstruct&#45;&gt;bytes -->
<g id="edge61" class="edge"><title>cstruct&#45;&gt;bytes</title>
<path fill="none" stroke="black" d="M851.273,-237.942C862.509,-226.362 876.214,-211.658 887.569,-197.74 906.06,-175.074 901.224,-160.218 925.569,-144 986.336,-103.518 1073.35,-93.5525 1123.28,-91.3414"/>
<polygon fill="black" stroke="black" points="1123.49,-94.8365 1133.36,-90.9791 1123.24,-87.841 1123.49,-94.8365"/>
</g>
<!-- cstruct&#45;&gt;bigarray -->
<g id="edge62" class="edge"><title>cstruct&#45;&gt;bigarray</title>
<path fill="none" stroke="black" d="M791.209,-255.725C723.171,-248.107 585.167,-229.16 549.569,-197.74 526.701,-177.557 517.594,-142.665 513.968,-118.287"/>
<polygon fill="black" stroke="black" points="517.423,-117.715 512.691,-108.236 510.479,-118.598 517.423,-117.715"/>
</g>
<!-- bigarray&#45;&gt;unix -->
<g id="edge60" class="edge"><title>bigarray&#45;&gt;unix</title>
<path fill="none" stroke="black" d="M491.421,-74.1548C477.083,-63.5899 457.701,-49.3083 442.252,-37.925"/>
<polygon fill="black" stroke="black" points="444.258,-35.0554 434.131,-31.9411 440.106,-40.6908 444.258,-35.0554"/>
</g>
<!-- astring&#45;&gt;bytes -->
<g id="edge1" class="edge"><title>astring&#45;&gt;bytes</title>
<path fill="none" stroke="black" d="M1863.35,-235.189C1845.85,-207.694 1813.38,-164.225 1772.57,-144 1671.79,-94.061 1320.81,-90.4682 1202.13,-90.7236"/>
<polygon fill="black" stroke="black" points="1202.03,-87.2238 1192.04,-90.756 1202.05,-94.2237 1202.03,-87.2238"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 49 KiB

View file

@ -0,0 +1,407 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.38.0 (20140413.2041)
-->
<!-- Title: mirage&#45;console Pages: 1 -->
<svg width="1601pt" height="582pt"
viewBox="0.00 0.00 1600.84 582.44" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 578.441)">
<title>mirage&#45;console</title>
<polygon fill="white" stroke="none" points="-4,4 -4,-578.441 1596.84,-578.441 1596.84,4 -4,4"/>
<!-- unix -->
<g id="node1" class="node"><title>unix</title>
<ellipse fill="#c02942" stroke="black" cx="598.941" cy="-18" rx="27" ry="18"/>
<text text-anchor="middle" x="598.941" y="-14.3" font-family="Times,serif" font-size="14.00">unix</text>
</g>
<!-- sexplib -->
<g id="node2" class="node"><title>sexplib</title>
<ellipse fill="#d95b43" stroke="black" cx="461.941" cy="-188.61" rx="71.3357" ry="26.7407"/>
<text text-anchor="middle" x="461.941" y="-192.41" font-family="Times,serif" font-size="14.00">sexplib</text>
<text text-anchor="middle" x="461.941" y="-177.41" font-family="Times,serif" font-size="14.00">113.33.00+4.03</text>
</g>
<!-- bigarray -->
<g id="node26" class="node"><title>bigarray</title>
<ellipse fill="#c02942" stroke="black" cx="598.941" cy="-98.8701" rx="40.0939" ry="18"/>
<text text-anchor="middle" x="598.941" y="-95.1701" font-family="Times,serif" font-size="14.00">bigarray</text>
</g>
<!-- sexplib&#45;&gt;bigarray -->
<g id="edge19" class="edge"><title>sexplib&#45;&gt;bigarray</title>
<path fill="none" stroke="black" d="M497.222,-165.015C519.143,-150.976 547.054,-133.101 568.091,-119.628"/>
<polygon fill="black" stroke="black" points="570.115,-122.488 576.649,-114.147 566.34,-116.593 570.115,-122.488"/>
</g>
<!-- result -->
<g id="node3" class="node"><title>result</title>
<ellipse fill="#d95b43" stroke="black" cx="33.9411" cy="-188.61" rx="33.8824" ry="26.7407"/>
<text text-anchor="middle" x="33.9411" y="-192.41" font-family="Times,serif" font-size="14.00">result</text>
<text text-anchor="middle" x="33.9411" y="-177.41" font-family="Times,serif" font-size="14.00">1.0</text>
</g>
<!-- ocplib&#45;endian.bigstring -->
<g id="node4" class="node"><title>ocplib&#45;endian.bigstring</title>
<ellipse fill="#d95b43" stroke="black" cx="728.941" cy="-188.61" rx="101.647" ry="26.7407"/>
<text text-anchor="middle" x="728.941" y="-192.41" font-family="Times,serif" font-size="14.00">ocplib&#45;endian.bigstring</text>
<text text-anchor="middle" x="728.941" y="-177.41" font-family="Times,serif" font-size="14.00">0.8</text>
</g>
<!-- bytes -->
<g id="node25" class="node"><title>bytes</title>
<ellipse fill="#c02942" stroke="black" cx="913.941" cy="-98.8701" rx="29.4969" ry="18"/>
<text text-anchor="middle" x="913.941" y="-95.1701" font-family="Times,serif" font-size="14.00">bytes</text>
</g>
<!-- ocplib&#45;endian.bigstring&#45;&gt;bytes -->
<g id="edge21" class="edge"><title>ocplib&#45;endian.bigstring&#45;&gt;bytes</title>
<path fill="none" stroke="black" d="M777.065,-164.787C810.153,-149.094 853.169,-128.692 882.071,-114.985"/>
<polygon fill="black" stroke="black" points="883.762,-118.057 891.297,-110.61 880.762,-111.732 883.762,-118.057"/>
</g>
<!-- ocplib&#45;endian.bigstring&#45;&gt;bigarray -->
<g id="edge20" class="edge"><title>ocplib&#45;endian.bigstring&#45;&gt;bigarray</title>
<path fill="none" stroke="black" d="M693.074,-163.403C672.87,-149.767 647.932,-132.935 628.801,-120.023"/>
<polygon fill="black" stroke="black" points="630.704,-117.085 620.457,-114.392 626.788,-122.887 630.704,-117.085"/>
</g>
<!-- ocplib&#45;endian -->
<g id="node5" class="node"><title>ocplib&#45;endian</title>
<ellipse fill="#d95b43" stroke="black" cx="913.941" cy="-188.61" rx="65.1077" ry="26.7407"/>
<text text-anchor="middle" x="913.941" y="-192.41" font-family="Times,serif" font-size="14.00">ocplib&#45;endian</text>
<text text-anchor="middle" x="913.941" y="-177.41" font-family="Times,serif" font-size="14.00">0.8</text>
</g>
<!-- ocplib&#45;endian&#45;&gt;bytes -->
<g id="edge22" class="edge"><title>ocplib&#45;endian&#45;&gt;bytes</title>
<path fill="none" stroke="black" d="M913.941,-161.285C913.941,-150.534 913.941,-138.099 913.941,-127.242"/>
<polygon fill="black" stroke="black" points="917.441,-127.031 913.941,-117.031 910.441,-127.031 917.441,-127.031"/>
</g>
<!-- mirage.runtime -->
<g id="node6" class="node"><title>mirage.runtime</title>
<ellipse fill="#ecd078" stroke="black" cx="389.941" cy="-368.09" rx="72.6644" ry="26.7407"/>
<text text-anchor="middle" x="389.941" y="-371.89" font-family="Times,serif" font-size="14.00">mirage.runtime</text>
<text text-anchor="middle" x="389.941" y="-356.89" font-family="Times,serif" font-size="14.00">2.9.0</text>
</g>
<!-- logs -->
<g id="node16" class="node"><title>logs</title>
<ellipse fill="#d95b43" stroke="black" cx="40.9411" cy="-278.35" rx="30.3115" ry="26.7407"/>
<text text-anchor="middle" x="40.9411" y="-282.15" font-family="Times,serif" font-size="14.00">logs</text>
<text text-anchor="middle" x="40.9411" y="-267.15" font-family="Times,serif" font-size="14.00">0.5.0</text>
</g>
<!-- mirage.runtime&#45;&gt;logs -->
<g id="edge8" class="edge"><title>mirage.runtime&#45;&gt;logs</title>
<path fill="none" stroke="black" d="M320.875,-359.455C258.087,-351.025 163.657,-334.585 85.9411,-305.22 81.958,-303.715 77.9123,-301.885 73.9627,-299.9"/>
<polygon fill="black" stroke="black" points="75.4599,-296.731 64.9962,-295.069 72.1398,-302.893 75.4599,-296.731"/>
</g>
<!-- ipaddr -->
<g id="node17" class="node"><title>ipaddr</title>
<ellipse fill="#d95b43" stroke="black" cx="485.941" cy="-278.35" rx="36.5405" ry="26.7407"/>
<text text-anchor="middle" x="485.941" y="-282.15" font-family="Times,serif" font-size="14.00">ipaddr</text>
<text text-anchor="middle" x="485.941" y="-267.15" font-family="Times,serif" font-size="14.00">2.7.0</text>
</g>
<!-- mirage.runtime&#45;&gt;ipaddr -->
<g id="edge6" class="edge"><title>mirage.runtime&#45;&gt;ipaddr</title>
<path fill="none" stroke="black" d="M416.428,-342.883C428.653,-331.709 443.226,-318.39 455.864,-306.84"/>
<polygon fill="black" stroke="black" points="458.424,-309.242 463.444,-299.912 453.701,-304.075 458.424,-309.242"/>
</g>
<!-- functoria.runtime -->
<g id="node20" class="node"><title>functoria.runtime</title>
<ellipse fill="#ecd078" stroke="black" cx="176.941" cy="-278.35" rx="82.0488" ry="26.7407"/>
<text text-anchor="middle" x="176.941" y="-282.15" font-family="Times,serif" font-size="14.00">functoria.runtime</text>
<text text-anchor="middle" x="176.941" y="-267.15" font-family="Times,serif" font-size="14.00">1.1.0</text>
</g>
<!-- mirage.runtime&#45;&gt;functoria.runtime -->
<g id="edge5" class="edge"><title>mirage.runtime&#45;&gt;functoria.runtime</title>
<path fill="none" stroke="black" d="M342.67,-347.618C311.189,-334.651 269.586,-317.513 235.939,-303.653"/>
<polygon fill="black" stroke="black" points="237.254,-300.409 226.674,-299.837 234.587,-306.882 237.254,-300.409"/>
</g>
<!-- astring -->
<g id="node27" class="node"><title>astring</title>
<ellipse fill="#d95b43" stroke="black" cx="391.941" cy="-278.35" rx="38.7821" ry="26.7407"/>
<text text-anchor="middle" x="391.941" y="-282.15" font-family="Times,serif" font-size="14.00">astring</text>
<text text-anchor="middle" x="391.941" y="-267.15" font-family="Times,serif" font-size="14.00">0.8.1</text>
</g>
<!-- mirage.runtime&#45;&gt;astring -->
<g id="edge7" class="edge"><title>mirage.runtime&#45;&gt;astring</title>
<path fill="none" stroke="black" d="M390.541,-340.765C390.723,-332.799 390.925,-323.908 391.119,-315.419"/>
<polygon fill="black" stroke="black" points="394.619,-315.431 391.348,-305.354 387.621,-315.272 394.619,-315.431"/>
</g>
<!-- mirage&#45;unix -->
<g id="node7" class="node"><title>mirage&#45;unix</title>
<ellipse fill="#ecd078" stroke="black" cx="991.941" cy="-457.831" rx="59.2941" ry="26.7407"/>
<text text-anchor="middle" x="991.941" y="-461.631" font-family="Times,serif" font-size="14.00">mirage&#45;unix</text>
<text text-anchor="middle" x="991.941" y="-446.631" font-family="Times,serif" font-size="14.00">2.6.0</text>
</g>
<!-- mirage&#45;clock&#45;unix -->
<g id="node12" class="node"><title>mirage&#45;clock&#45;unix</title>
<ellipse fill="#d95b43" stroke="black" cx="371.941" cy="-98.8701" rx="83.3772" ry="26.7407"/>
<text text-anchor="middle" x="371.941" y="-102.67" font-family="Times,serif" font-size="14.00">mirage&#45;clock&#45;unix</text>
<text text-anchor="middle" x="371.941" y="-87.6701" font-family="Times,serif" font-size="14.00">1.0.0</text>
</g>
<!-- mirage&#45;unix&#45;&gt;mirage&#45;clock&#45;unix -->
<g id="edge18" class="edge"><title>mirage&#45;unix&#45;&gt;mirage&#45;clock&#45;unix</title>
<path fill="none" stroke="black" d="M932.658,-455.938C774.149,-452.94 349.712,-440.68 307.941,-394.96 240.707,-321.37 308.66,-194.298 348.069,-133.794"/>
<polygon fill="black" stroke="black" points="351.049,-135.633 353.657,-125.364 345.214,-131.765 351.049,-135.633"/>
</g>
<!-- lwt.unix -->
<g id="node13" class="node"><title>lwt.unix</title>
<ellipse fill="#d95b43" stroke="black" cx="1178.94" cy="-368.09" rx="43.6818" ry="26.7407"/>
<text text-anchor="middle" x="1178.94" y="-371.89" font-family="Times,serif" font-size="14.00">lwt.unix</text>
<text text-anchor="middle" x="1178.94" y="-356.89" font-family="Times,serif" font-size="14.00">2.5.2</text>
</g>
<!-- mirage&#45;unix&#45;&gt;lwt.unix -->
<g id="edge15" class="edge"><title>mirage&#45;unix&#45;&gt;lwt.unix</title>
<path fill="none" stroke="black" d="M1032.06,-438.008C1062.5,-423.725 1104.29,-404.115 1135.52,-389.464"/>
<polygon fill="black" stroke="black" points="1137.28,-392.504 1144.85,-385.088 1134.31,-386.167 1137.28,-392.504"/>
</g>
<!-- lwt -->
<g id="node15" class="node"><title>lwt</title>
<ellipse fill="#d95b43" stroke="black" cx="1180.94" cy="-188.61" rx="30.3115" ry="26.7407"/>
<text text-anchor="middle" x="1180.94" y="-192.41" font-family="Times,serif" font-size="14.00">lwt</text>
<text text-anchor="middle" x="1180.94" y="-177.41" font-family="Times,serif" font-size="14.00">2.5.2</text>
</g>
<!-- mirage&#45;unix&#45;&gt;lwt -->
<g id="edge14" class="edge"><title>mirage&#45;unix&#45;&gt;lwt</title>
<path fill="none" stroke="black" d="M1013.57,-432.65C1022.75,-421.647 1033.1,-408.155 1040.94,-394.96 1076.32,-335.382 1059.77,-306.467 1101.94,-251.48 1114.46,-235.151 1132.25,-220.718 1147.78,-209.908"/>
<polygon fill="black" stroke="black" points="1149.78,-212.776 1156.12,-204.287 1145.87,-206.971 1149.78,-212.776"/>
</g>
<!-- io&#45;page.unix -->
<g id="node18" class="node"><title>io&#45;page.unix</title>
<ellipse fill="#d95b43" stroke="black" cx="689.941" cy="-368.09" rx="59.2941" ry="26.7407"/>
<text text-anchor="middle" x="689.941" y="-371.89" font-family="Times,serif" font-size="14.00">io&#45;page.unix</text>
<text text-anchor="middle" x="689.941" y="-356.89" font-family="Times,serif" font-size="14.00">1.6.0</text>
</g>
<!-- mirage&#45;unix&#45;&gt;io&#45;page.unix -->
<g id="edge16" class="edge"><title>mirage&#45;unix&#45;&gt;io&#45;page.unix</title>
<path fill="none" stroke="black" d="M942.747,-442.538C889.77,-427.147 805.496,-402.663 748.981,-386.243"/>
<polygon fill="black" stroke="black" points="749.693,-382.806 739.114,-383.377 747.74,-389.528 749.693,-382.806"/>
</g>
<!-- io&#45;page -->
<g id="node19" class="node"><title>io&#45;page</title>
<ellipse fill="#d95b43" stroke="black" cx="991.941" cy="-368.09" rx="39.6962" ry="26.7407"/>
<text text-anchor="middle" x="991.941" y="-371.89" font-family="Times,serif" font-size="14.00">io&#45;page</text>
<text text-anchor="middle" x="991.941" y="-356.89" font-family="Times,serif" font-size="14.00">1.6.0</text>
</g>
<!-- mirage&#45;unix&#45;&gt;io&#45;page -->
<g id="edge17" class="edge"><title>mirage&#45;unix&#45;&gt;io&#45;page</title>
<path fill="none" stroke="black" d="M991.941,-430.506C991.941,-422.539 991.941,-413.648 991.941,-405.159"/>
<polygon fill="black" stroke="black" points="995.441,-405.094 991.941,-395.094 988.441,-405.094 995.441,-405.094"/>
</g>
<!-- cstruct -->
<g id="node23" class="node"><title>cstruct</title>
<ellipse fill="#d95b43" stroke="black" cx="915.941" cy="-278.35" rx="38.7821" ry="26.7407"/>
<text text-anchor="middle" x="915.941" y="-282.15" font-family="Times,serif" font-size="14.00">cstruct</text>
<text text-anchor="middle" x="915.941" y="-267.15" font-family="Times,serif" font-size="14.00">2.1.0</text>
</g>
<!-- mirage&#45;unix&#45;&gt;cstruct -->
<g id="edge13" class="edge"><title>mirage&#45;unix&#45;&gt;cstruct</title>
<path fill="none" stroke="black" d="M968.951,-432.952C959.642,-422.109 949.552,-408.658 942.941,-394.96 930.768,-369.736 923.91,-338.715 920.155,-315.159"/>
<polygon fill="black" stroke="black" points="923.613,-314.614 918.685,-305.235 916.688,-315.64 923.613,-314.614"/>
</g>
<!-- mirage&#45;types.lwt -->
<g id="node8" class="node"><title>mirage&#45;types.lwt</title>
<ellipse fill="#ecd078" stroke="black" cx="1497.94" cy="-368.09" rx="76.2353" ry="26.7407"/>
<text text-anchor="middle" x="1497.94" y="-371.89" font-family="Times,serif" font-size="14.00">mirage&#45;types.lwt</text>
<text text-anchor="middle" x="1497.94" y="-356.89" font-family="Times,serif" font-size="14.00">2.8.0</text>
</g>
<!-- mirage&#45;types -->
<g id="node9" class="node"><title>mirage&#45;types</title>
<ellipse fill="#d95b43" stroke="black" cx="1340.94" cy="-368.09" rx="62.4516" ry="26.7407"/>
<text text-anchor="middle" x="1340.94" y="-371.89" font-family="Times,serif" font-size="14.00">mirage&#45;types</text>
<text text-anchor="middle" x="1340.94" y="-356.89" font-family="Times,serif" font-size="14.00">2.8.0</text>
</g>
<!-- mirage&#45;console.unix -->
<g id="node10" class="node"><title>mirage&#45;console.unix</title>
<ellipse fill="#ecd078" stroke="black" cx="1231.94" cy="-547.571" rx="91.4341" ry="26.7407"/>
<text text-anchor="middle" x="1231.94" y="-551.371" font-family="Times,serif" font-size="14.00">mirage&#45;console.unix</text>
<text text-anchor="middle" x="1231.94" y="-536.371" font-family="Times,serif" font-size="14.00">2.1.3</text>
</g>
<!-- mirage&#45;console.unix&#45;&gt;mirage&#45;unix -->
<g id="edge45" class="edge"><title>mirage&#45;console.unix&#45;&gt;mirage&#45;unix</title>
<path fill="none" stroke="black" d="M1176.28,-526.221C1137.34,-511.987 1085.58,-493.063 1046.82,-478.893"/>
<polygon fill="black" stroke="black" points="1047.85,-475.545 1037.26,-475.398 1045.45,-482.119 1047.85,-475.545"/>
</g>
<!-- mirage&#45;console.unix&#45;&gt;mirage&#45;types -->
<g id="edge42" class="edge"><title>mirage&#45;console.unix&#45;&gt;mirage&#45;types</title>
<path fill="none" stroke="black" d="M1247.79,-520.763C1266.87,-489.698 1298.97,-437.434 1320.05,-403.101"/>
<polygon fill="black" stroke="black" points="1323.17,-404.707 1325.43,-394.354 1317.21,-401.044 1323.17,-404.707"/>
</g>
<!-- mirage&#45;console -->
<g id="node11" class="node"><title>mirage&#45;console</title>
<ellipse fill="#d95b43" stroke="black" cx="1455.94" cy="-457.831" rx="71.3357" ry="26.7407"/>
<text text-anchor="middle" x="1455.94" y="-461.631" font-family="Times,serif" font-size="14.00">mirage&#45;console</text>
<text text-anchor="middle" x="1455.94" y="-446.631" font-family="Times,serif" font-size="14.00">2.1.3</text>
</g>
<!-- mirage&#45;console.unix&#45;&gt;mirage&#45;console -->
<g id="edge43" class="edge"><title>mirage&#45;console.unix&#45;&gt;mirage&#45;console</title>
<path fill="none" stroke="black" d="M1285.31,-525.666C1319.26,-512.369 1363.21,-495.152 1398.01,-481.523"/>
<polygon fill="black" stroke="black" points="1399.53,-484.686 1407.56,-477.78 1396.98,-478.168 1399.53,-484.686"/>
</g>
<!-- mirage&#45;console.unix&#45;&gt;lwt.unix -->
<g id="edge41" class="edge"><title>mirage&#45;console.unix&#45;&gt;lwt.unix</title>
<path fill="none" stroke="black" d="M1224.23,-520.763C1215.06,-490.05 1199.7,-438.615 1189.45,-404.274"/>
<polygon fill="black" stroke="black" points="1192.79,-403.221 1186.57,-394.641 1186.08,-405.224 1192.79,-403.221"/>
</g>
<!-- mirage&#45;console.unix&#45;&gt;lwt -->
<g id="edge40" class="edge"><title>mirage&#45;console.unix&#45;&gt;lwt</title>
<path fill="none" stroke="black" d="M1234.02,-520.507C1236.67,-481.386 1240.01,-405.242 1231.94,-341.22 1226.79,-300.37 1222.59,-290.325 1208.94,-251.48 1205.6,-241.986 1201.38,-231.946 1197.23,-222.778"/>
<polygon fill="black" stroke="black" points="1200.36,-221.2 1192.98,-213.6 1194.01,-224.145 1200.36,-221.2"/>
</g>
<!-- cstruct.lwt -->
<g id="node22" class="node"><title>cstruct.lwt</title>
<ellipse fill="#d95b43" stroke="black" cx="1131.94" cy="-457.831" rx="53.066" ry="26.7407"/>
<text text-anchor="middle" x="1131.94" y="-461.631" font-family="Times,serif" font-size="14.00">cstruct.lwt</text>
<text text-anchor="middle" x="1131.94" y="-446.631" font-family="Times,serif" font-size="14.00">2.1.0</text>
</g>
<!-- mirage&#45;console.unix&#45;&gt;cstruct.lwt -->
<g id="edge44" class="edge"><title>mirage&#45;console.unix&#45;&gt;cstruct.lwt</title>
<path fill="none" stroke="black" d="M1203.82,-521.897C1191.86,-511.403 1177.82,-499.084 1165.34,-488.132"/>
<polygon fill="black" stroke="black" points="1167.62,-485.482 1157.8,-481.518 1163.01,-490.744 1167.62,-485.482"/>
</g>
<!-- mirage&#45;console&#45;&gt;mirage&#45;types.lwt -->
<g id="edge32" class="edge"><title>mirage&#45;console&#45;&gt;mirage&#45;types.lwt</title>
<path fill="none" stroke="black" d="M1468.32,-430.98C1472.37,-422.501 1476.95,-412.936 1481.28,-403.905"/>
<polygon fill="black" stroke="black" points="1484.49,-405.287 1485.66,-394.756 1478.18,-402.265 1484.49,-405.287"/>
</g>
<!-- mirage&#45;console&#45;&gt;mirage&#45;types -->
<g id="edge31" class="edge"><title>mirage&#45;console&#45;&gt;mirage&#45;types</title>
<path fill="none" stroke="black" d="M1425.12,-433.318C1410.86,-422.439 1393.79,-409.414 1378.76,-397.946"/>
<polygon fill="black" stroke="black" points="1380.73,-395.042 1370.65,-391.759 1376.48,-400.607 1380.73,-395.042"/>
</g>
<!-- mirage&#45;console&#45;&gt;lwt -->
<g id="edge30" class="edge"><title>mirage&#45;console&#45;&gt;lwt</title>
<path fill="none" stroke="black" d="M1515.47,-442.964C1540.84,-433.79 1567.99,-418.876 1582.94,-394.96 1595.6,-374.708 1596.53,-360.864 1582.94,-341.22 1499.33,-220.322 1306.22,-195.716 1221.75,-190.794"/>
<polygon fill="black" stroke="black" points="1221.69,-187.286 1211.52,-190.264 1221.33,-194.277 1221.69,-187.286"/>
</g>
<!-- mirage&#45;clock&#45;unix&#45;&gt;unix -->
<g id="edge9" class="edge"><title>mirage&#45;clock&#45;unix&#45;&gt;unix</title>
<path fill="none" stroke="black" d="M427.181,-78.6771C470.606,-63.5895 529.641,-43.0781 565.972,-30.455"/>
<polygon fill="black" stroke="black" points="567.288,-33.7031 575.585,-27.1149 564.99,-27.0909 567.288,-33.7031"/>
</g>
<!-- lwt.unix&#45;&gt;unix -->
<g id="edge37" class="edge"><title>lwt.unix&#45;&gt;unix</title>
<path fill="none" stroke="black" d="M1194.73,-342.734C1219.26,-301.506 1259.76,-217.066 1219.94,-161.74 1150.4,-65.1173 758.849,-30.0693 635.889,-21.3562"/>
<polygon fill="black" stroke="black" points="636.055,-17.8593 625.837,-20.6605 635.572,-24.8426 636.055,-17.8593"/>
</g>
<!-- lwt.log -->
<g id="node14" class="node"><title>lwt.log</title>
<ellipse fill="#d95b43" stroke="black" cx="1147.94" cy="-278.35" rx="37.4533" ry="26.7407"/>
<text text-anchor="middle" x="1147.94" y="-282.15" font-family="Times,serif" font-size="14.00">lwt.log</text>
<text text-anchor="middle" x="1147.94" y="-267.15" font-family="Times,serif" font-size="14.00">2.5.2</text>
</g>
<!-- lwt.unix&#45;&gt;lwt.log -->
<g id="edge36" class="edge"><title>lwt.unix&#45;&gt;lwt.log</title>
<path fill="none" stroke="black" d="M1169.97,-341.712C1166.95,-333.164 1163.53,-323.469 1160.29,-314.314"/>
<polygon fill="black" stroke="black" points="1163.52,-312.934 1156.89,-304.671 1156.92,-315.266 1163.52,-312.934"/>
</g>
<!-- lwt.unix&#45;&gt;lwt -->
<g id="edge35" class="edge"><title>lwt.unix&#45;&gt;lwt</title>
<path fill="none" stroke="black" d="M1186.61,-341.452C1189.53,-330.413 1192.5,-317.292 1193.94,-305.22 1196.77,-281.505 1196.41,-275.237 1193.94,-251.48 1193.04,-242.77 1191.43,-233.48 1189.65,-224.818"/>
<polygon fill="black" stroke="black" points="1193.07,-224.034 1187.52,-215.009 1186.23,-225.525 1193.07,-224.034"/>
</g>
<!-- lwt.unix&#45;&gt;bigarray -->
<g id="edge38" class="edge"><title>lwt.unix&#45;&gt;bigarray</title>
<path fill="none" stroke="black" d="M1150.96,-347.008C1135.77,-335.527 1117.06,-320.419 1101.94,-305.22 1044.51,-247.471 1058.27,-202.813 987.941,-161.74 931.152,-128.576 740.114,-110.321 648.611,-103.293"/>
<polygon fill="black" stroke="black" points="648.723,-99.7914 638.488,-102.53 648.197,-106.772 648.723,-99.7914"/>
</g>
<!-- lwt.log&#45;&gt;lwt -->
<g id="edge34" class="edge"><title>lwt.log&#45;&gt;lwt</title>
<path fill="none" stroke="black" d="M1157.49,-251.972C1160.79,-243.182 1164.55,-233.18 1168.08,-223.8"/>
<polygon fill="black" stroke="black" points="1171.4,-224.918 1171.65,-214.326 1164.85,-222.454 1171.4,-224.918"/>
</g>
<!-- lwt&#45;&gt;bytes -->
<g id="edge39" class="edge"><title>lwt&#45;&gt;bytes</title>
<path fill="none" stroke="black" d="M1152.62,-178.304C1103.45,-162.145 1002.43,-128.948 948.944,-111.373"/>
<polygon fill="black" stroke="black" points="949.815,-107.975 939.222,-108.178 947.63,-114.625 949.815,-107.975"/>
</g>
<!-- logs&#45;&gt;result -->
<g id="edge1" class="edge"><title>logs&#45;&gt;result</title>
<path fill="none" stroke="black" d="M38.8788,-251.5C38.2365,-243.45 37.5161,-234.42 36.8283,-225.799"/>
<polygon fill="black" stroke="black" points="40.2972,-225.269 36.0129,-215.579 33.3194,-225.826 40.2972,-225.269"/>
</g>
<!-- ipaddr&#45;&gt;sexplib -->
<g id="edge4" class="edge"><title>ipaddr&#45;&gt;sexplib</title>
<path fill="none" stroke="black" d="M478.87,-251.5C476.62,-243.273 474.09,-234.023 471.685,-225.231"/>
<polygon fill="black" stroke="black" points="475.059,-224.301 469.045,-215.579 468.307,-226.148 475.059,-224.301"/>
</g>
<!-- ipaddr&#45;&gt;bytes -->
<g id="edge3" class="edge"><title>ipaddr&#45;&gt;bytes</title>
<path fill="none" stroke="black" d="M504.933,-254.801C528.595,-228.252 571.598,-184.856 617.941,-161.74 702.857,-119.385 815.422,-105.997 874.261,-101.786"/>
<polygon fill="black" stroke="black" points="874.857,-105.254 884.604,-101.101 874.394,-98.2694 874.857,-105.254"/>
</g>
<!-- io&#45;page.unix&#45;&gt;bigarray -->
<g id="edge12" class="edge"><title>io&#45;page.unix&#45;&gt;bigarray</title>
<path fill="none" stroke="black" d="M632.449,-360.84C538.904,-350.087 362.277,-327.125 343.941,-305.22 321.747,-278.706 360.321,-166.494 364.941,-161.74 378.145,-148.153 488.883,-123.003 553.177,-109.325"/>
<polygon fill="black" stroke="black" points="554.015,-112.726 563.075,-107.232 552.567,-105.877 554.015,-112.726"/>
</g>
<!-- io&#45;page&#45;&gt;cstruct -->
<g id="edge10" class="edge"><title>io&#45;page&#45;&gt;cstruct</title>
<path fill="none" stroke="black" d="M972.369,-344.495C963.15,-333.851 952.021,-321.003 942.091,-309.54"/>
<polygon fill="black" stroke="black" points="944.64,-307.136 935.447,-301.869 939.348,-311.719 944.64,-307.136"/>
</g>
<!-- io&#45;page&#45;&gt;bytes -->
<g id="edge11" class="edge"><title>io&#45;page&#45;&gt;bytes</title>
<path fill="none" stroke="black" d="M1001.75,-341.93C1015.87,-301.346 1037.02,-220.088 1005.94,-161.74 993.701,-138.757 968.706,-122.788 947.855,-112.837"/>
<polygon fill="black" stroke="black" points="949.182,-109.596 938.627,-108.685 946.31,-115.98 949.182,-109.596"/>
</g>
<!-- fmt -->
<g id="node21" class="node"><title>fmt</title>
<ellipse fill="#d95b43" stroke="black" cx="228.941" cy="-188.61" rx="30.3115" ry="26.7407"/>
<text text-anchor="middle" x="228.941" y="-192.41" font-family="Times,serif" font-size="14.00">fmt</text>
<text text-anchor="middle" x="228.941" y="-177.41" font-family="Times,serif" font-size="14.00">0.7.1</text>
</g>
<!-- functoria.runtime&#45;&gt;fmt -->
<g id="edge47" class="edge"><title>functoria.runtime&#45;&gt;fmt</title>
<path fill="none" stroke="black" d="M192.262,-251.5C197.812,-242.134 204.149,-231.442 209.976,-221.61"/>
<polygon fill="black" stroke="black" points="213.059,-223.273 215.147,-212.885 207.037,-219.704 213.059,-223.273"/>
</g>
<!-- cmdliner -->
<g id="node24" class="node"><title>cmdliner</title>
<ellipse fill="#d95b43" stroke="black" cx="132.941" cy="-188.61" rx="47.2526" ry="26.7407"/>
<text text-anchor="middle" x="132.941" y="-192.41" font-family="Times,serif" font-size="14.00">cmdliner</text>
<text text-anchor="middle" x="132.941" y="-177.41" font-family="Times,serif" font-size="14.00">0.9.8</text>
</g>
<!-- functoria.runtime&#45;&gt;cmdliner -->
<g id="edge46" class="edge"><title>functoria.runtime&#45;&gt;cmdliner</title>
<path fill="none" stroke="black" d="M163.978,-251.5C159.605,-242.78 154.656,-232.911 150.015,-223.656"/>
<polygon fill="black" stroke="black" points="153.121,-222.042 145.509,-214.672 146.863,-225.18 153.121,-222.042"/>
</g>
<!-- cstruct.lwt&#45;&gt;lwt.unix -->
<g id="edge29" class="edge"><title>cstruct.lwt&#45;&gt;lwt.unix</title>
<path fill="none" stroke="black" d="M1145.54,-431.452C1150.34,-422.478 1155.83,-412.239 1160.94,-402.688"/>
<polygon fill="black" stroke="black" points="1164.06,-404.274 1165.7,-393.806 1157.89,-400.969 1164.06,-404.274"/>
</g>
<!-- cstruct.lwt&#45;&gt;cstruct -->
<g id="edge28" class="edge"><title>cstruct.lwt&#45;&gt;cstruct</title>
<path fill="none" stroke="black" d="M1116.84,-431.591C1100.63,-406.181 1072.87,-367.136 1040.94,-341.22 1016.6,-321.466 984.911,-305.868 959.53,-295.276"/>
<polygon fill="black" stroke="black" points="960.722,-291.982 950.14,-291.463 958.089,-298.468 960.722,-291.982"/>
</g>
<!-- cstruct&#45;&gt;sexplib -->
<g id="edge27" class="edge"><title>cstruct&#45;&gt;sexplib</title>
<path fill="none" stroke="black" d="M878.659,-270.664C817.321,-259.6 691.308,-236.604 584.941,-215.48 568.033,-212.122 549.848,-208.374 532.784,-204.795"/>
<polygon fill="black" stroke="black" points="533.391,-201.346 522.884,-202.711 531.949,-208.196 533.391,-201.346"/>
</g>
<!-- cstruct&#45;&gt;ocplib&#45;endian.bigstring -->
<g id="edge26" class="edge"><title>cstruct&#45;&gt;ocplib&#45;endian.bigstring</title>
<path fill="none" stroke="black" d="M884.219,-262.466C857.569,-249.962 818.798,-231.771 786.666,-216.695"/>
<polygon fill="black" stroke="black" points="787.902,-213.409 777.362,-212.329 784.929,-219.746 787.902,-213.409"/>
</g>
<!-- cstruct&#45;&gt;ocplib&#45;endian -->
<g id="edge25" class="edge"><title>cstruct&#45;&gt;ocplib&#45;endian</title>
<path fill="none" stroke="black" d="M915.341,-251.025C915.159,-243.059 914.957,-234.168 914.763,-225.679"/>
<polygon fill="black" stroke="black" points="918.261,-225.532 914.534,-215.614 911.263,-225.691 918.261,-225.532"/>
</g>
<!-- cstruct&#45;&gt;bytes -->
<g id="edge23" class="edge"><title>cstruct&#45;&gt;bytes</title>
<path fill="none" stroke="black" d="M945.71,-260.543C961.419,-249.877 979.207,-234.502 987.941,-215.48 997.908,-193.775 998.054,-183.378 987.941,-161.74 978.907,-142.412 960.537,-126.998 944.36,-116.389"/>
<polygon fill="black" stroke="black" points="946.014,-113.296 935.672,-110.996 942.322,-119.244 946.014,-113.296"/>
</g>
<!-- cstruct&#45;&gt;bigarray -->
<g id="edge24" class="edge"><title>cstruct&#45;&gt;bigarray</title>
<path fill="none" stroke="black" d="M877.375,-274.663C805.08,-268.801 653.28,-252.329 617.941,-215.48 595.544,-192.126 593.646,-153.154 595.418,-126.992"/>
<polygon fill="black" stroke="black" points="598.909,-127.255 596.316,-116.983 591.937,-126.63 598.909,-127.255"/>
</g>
<!-- bigarray&#45;&gt;unix -->
<g id="edge33" class="edge"><title>bigarray&#45;&gt;unix</title>
<path fill="none" stroke="black" d="M598.941,-80.7564C598.941,-70.7312 598.941,-57.8362 598.941,-46.4246"/>
<polygon fill="black" stroke="black" points="602.441,-46.0802 598.941,-36.0802 595.441,-46.0803 602.441,-46.0802"/>
</g>
<!-- astring&#45;&gt;bytes -->
<g id="edge2" class="edge"><title>astring&#45;&gt;bytes</title>
<path fill="none" stroke="black" d="M380.295,-252.373C370.129,-226.428 360.103,-186.265 381.941,-161.74 390.184,-152.483 753.964,-115.706 875.136,-103.69"/>
<polygon fill="black" stroke="black" points="875.492,-107.172 885.098,-102.704 874.802,-100.206 875.492,-107.172"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 303 KiB

View file

@ -0,0 +1,95 @@
<svg width="1000" height="800" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g><rect x="0" y="0" height="418" width="354" style="stroke:#006000; fill: #D95B43"/> <text x="10" y="209">libgcc.a</text><title>/usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc.a (3027014)</title></g>
<g><rect x="0" y="418" height="193" width="354" style="stroke:#006000; fill: #C02942"/> <text x="10" y="515">stdlib.a</text><title>/home/hannes/.opam/4.02.3/lib/ocaml/stdlib.a (1400328)</title></g>
<g><rect x="0" y="612" height="187" width="354" style="stroke:#006000; fill: #542437"/> <text x="10" y="706">libgmp-xen.a</text><title>/home/hannes/.opam/4.02.3/lib/gmp-xen/libgmp-xen.a (1357772)</title></g>
<g><rect x="354" y="0" height="175" width="283" style="stroke:#006000; fill: #53777A"/> <text x="364" y="87">tls.a</text><title>/home/hannes/.opam/4.02.3/lib/tls/tls.a (1012386)</title></g>
<g><rect x="637" y="0" height="175" width="186" style="stroke:#006000; fill: #ECD078"/> <text x="647" y="87">sexplib.a</text><title>/home/hannes/.opam/4.02.3/lib/sexplib/sexplib.a (665768)</title></g>
<g><rect x="823" y="0" height="175" width="176" style="stroke:#006000; fill: #D95B43"/> <text x="833" y="87">libopenlibm.a</text><title>/home/hannes/.opam/4.02.3/lib/libopenlibm.a (629620)</title></g>
<g><rect x="354" y="175" height="207" width="138" style="stroke:#006000; fill: #C02942"/> <text x="364" y="279">tyxml.a</text><title>/home/hannes/.opam/4.02.3/lib/tyxml/tyxml.a (587802)</title></g>
<g><rect x="354" y="383" height="152" width="138" style="stroke:#006000; fill: #542437"/> <text x="364" y="459">nocrypto.a</text><title>/home/hannes/.opam/4.02.3/lib/nocrypto/nocrypto.a (431132)</title></g>
<g><rect x="354" y="535" height="142" width="138" style="stroke:#006000; fill: #53777A"/> <text x="364" y="607">x509.a</text><title>/home/hannes/.opam/4.02.3/lib/x509/x509.a (403540)</title></g>
<g><rect x="354" y="678" height="121" width="138" style="stroke:#006000; fill: #ECD078"/> <text x="364" y="739">libxenasmrun.a</text><title>/home/hannes/.opam/4.02.3/lib/pkgconfig/../../lib/mirage-xen-ocaml/libxenasmrun.a (343920)</title></g>
<g><rect x="493" y="175" height="123" width="131" style="stroke:#006000; fill: #D95B43"/> <text x="503" y="237">libasmrun.a</text><title>/home/hannes/.opam/4.02.3/lib/ocaml/libasmrun.a (331260)</title></g>
<g><rect x="624" y="175" height="123" width="130" style="stroke:#006000; fill: #C02942"/> <text x="634" y="237">lwt.a</text><title>/home/hannes/.opam/4.02.3/lib/lwt/lwt.a (328130)</title></g>
<g><rect x="755" y="175" height="123" width="125" style="stroke:#006000; fill: #542437"/> <text x="765" y="237">tcp.a</text><title>/home/hannes/.opam/4.02.3/lib/tcpip/tcp.a (315660)</title></g>
<g><rect x="880" y="175" height="123" width="119" style="stroke:#006000; fill: #53777A"/> <text x="890" y="237">libnocrypto_stubs.a</text><title>/home/hannes/.opam/4.02.3/lib/nocrypto/libnocrypto_stubs.a (301090)</title></g>
<g><rect x="493" y="298" height="127" width="110" style="stroke:#006000; fill: #ECD078"/> <text x="503" y="362">libnocrypto_xen_stubs.a</text><title>/home/hannes/.opam/4.02.3/lib/nocrypto/libnocrypto_xen_stubs.a (288802)</title></g>
<g><rect x="493" y="426" height="127" width="110" style="stroke:#006000; fill: #D95B43"/> <text x="503" y="490">libnocrypto_xen_stubs.a</text><title>/home/hannes/.opam/4.02.3/lib/nocrypto/libnocrypto_xen_stubs.a (288802)</title></g>
<g><rect x="493" y="554" height="123" width="110" style="stroke:#006000; fill: #C02942"/> <text x="503" y="615">asn1-combinators.a</text><title>/home/hannes/.opam/4.02.3/lib/asn1-combinators/asn1-combinators.a (279054)</title></g>
<g><rect x="493" y="677" height="122" width="110" style="stroke:#006000; fill: #542437"/> <text x="503" y="738">cmdliner.a</text><title>/home/hannes/.opam/4.02.3/lib/cmdliner/cmdliner.a (277042)</title></g>
<g><rect x="604" y="298" height="117" width="113" style="stroke:#006000; fill: #53777A"/> <text x="614" y="357">libminios.a</text><title>/home/hannes/.opam/4.02.3/lib/minios-xen/libminios.a (271372)</title></g>
<g><rect x="717" y="298" height="117" width="101" style="stroke:#006000; fill: #ECD078"/> <text x="727" y="357">astring.a</text><title>/home/hannes/.opam/4.02.3/lib/astring/astring.a (243240)</title></g>
<g><rect x="819" y="298" height="117" width="97" style="stroke:#006000; fill: #D95B43"/> <text x="829" y="357">re.a</text><title>/home/hannes/.opam/4.02.3/lib/re/re.a (233148)</title></g>
<g><rect x="916" y="298" height="117" width="83" style="stroke:#006000; fill: #C02942"/> <text x="926" y="357">ipv6.a</text><title>/home/hannes/.opam/4.02.3/lib/tcpip/ipv6.a (199486)</title></g>
<g><rect x="604" y="416" height="105" width="91" style="stroke:#006000; fill: #542437"/> <text x="614" y="469">ipaddr.a</text><title>/home/hannes/.opam/4.02.3/lib/ipaddr/ipaddr.a (198636)</title></g>
<g><rect x="604" y="522" height="103" width="91" style="stroke:#006000; fill: #53777A"/> <text x="614" y="573">tcpip.a</text><title>/home/hannes/.opam/4.02.3/lib/tcpip/tcpip.a (193400)</title></g>
<g><rect x="604" y="625" height="102" width="91" style="stroke:#006000; fill: #ECD078"/> <text x="614" y="676">camlstartupb4b590.o</text><title>/tmp/camlstartupb4b590.o (193160)</title></g>
<g><rect x="604" y="728" height="71" width="91" style="stroke:#006000; fill: #D95B43"/> <text x="614" y="764">dhcpv4.a</text><title>/home/hannes/.opam/4.02.3/lib/tcpip/dhcpv4.a (134406)</title></g>
<g><rect x="696" y="416" height="71" width="90" style="stroke:#006000; fill: #C02942"/> <text x="706" y="452">mirage-net-xen.a</text><title>/home/hannes/.opam/4.02.3/lib/mirage-net-xen/mirage-net-xen.a (131968)</title></g>
<g><rect x="786" y="416" height="71" width="82" style="stroke:#006000; fill: #542437"/> <text x="796" y="452">xenstore.a</text><title>/home/hannes/.opam/4.02.3/lib/xenstore/xenstore.a (119916)</title></g>
<g><rect x="868" y="416" height="71" width="68" style="stroke:#006000; fill: #53777A"/> <text x="878" y="452">ocplib_endian.a</text><title>/home/hannes/.opam/4.02.3/lib/ocplib-endian/ocplib_endian.a (99350)</title></g>
<g><rect x="937" y="416" height="71" width="62" style="stroke:#006000; fill: #ECD078"/> <text x="947" y="452">uutf.a</text><title>/home/hannes/.opam/4.02.3/lib/uutf/uutf.a (91822)</title></g>
<g><rect x="696" y="487" height="67" width="65" style="stroke:#006000; fill: #D95B43"/> <text x="706" y="521">ptime.a</text><title>/home/hannes/.opam/4.02.3/lib/ptime/ptime.a (89482)</title></g>
<g><rect x="761" y="487" height="67" width="63" style="stroke:#006000; fill: #C02942"/> <text x="771" y="521">zarith.a</text><title>/home/hannes/.opam/4.02.3/lib/zarith/zarith.a (87638)</title></g>
<g><rect x="825" y="487" height="67" width="62" style="stroke:#006000; fill: #542437"/> <text x="835" y="521">fmt.a</text><title>/home/hannes/.opam/4.02.3/lib/fmt/fmt.a (86522)</title></g>
<g><rect x="887" y="487" height="67" width="56" style="stroke:#006000; fill: #53777A"/> <text x="897" y="521">OS.a</text><title>/home/hannes/.opam/4.02.3/lib/mirage-xen/OS.a (77252)</title></g>
<g><rect x="944" y="487" height="67" width="55" style="stroke:#006000; fill: #ECD078"/> <text x="954" y="521">str.a</text><title>/home/hannes/.opam/4.02.3/lib/ocaml/str.a (76790)</title></g>
<g><rect x="696" y="555" height="68" width="53" style="stroke:#006000; fill: #D95B43"/> <text x="706" y="589">libzarith.a</text><title>/home/hannes/.opam/4.02.3/lib/zarith/libzarith.a (74428)</title></g>
<g><rect x="696" y="623" height="62" width="53" style="stroke:#006000; fill: #C02942"/> <text x="706" y="654">cstruct.a</text><title>/home/hannes/.opam/4.02.3/lib/cstruct/cstruct.a (68448)</title></g>
<g><rect x="696" y="686" height="57" width="53" style="stroke:#006000; fill: #542437"/> <text x="706" y="715">xenstore_client_lwt.a</text><title>/home/hannes/.opam/4.02.3/lib/xenstore/xenstore_client_lwt.a (62488)</title></g>
<g><rect x="696" y="743" height="56" width="53" style="stroke:#006000; fill: #53777A"/> <text x="706" y="771">libxenposix.a</text><title>/home/hannes/.opam/4.02.3/lib/pkgconfig/../../lib/mirage-xen-posix/libxenposix.a (61286)</title></g>
<g><rect x="749" y="555" height="55" width="51" style="stroke:#006000; fill: #ECD078"/> <text x="759" y="582">arpv4.a</text><title>/home/hannes/.opam/4.02.3/lib/tcpip/arpv4.a (58494)</title></g>
<g><rect x="749" y="610" height="50" width="51" style="stroke:#006000; fill: #D95B43"/> <text x="759" y="635">libzarith-xen.a</text><title>/home/hannes/.opam/4.02.3/lib/zarith/libzarith-xen.a (53452)</title></g>
<g><rect x="749" y="661" height="48" width="51" style="stroke:#006000; fill: #C02942"/> <text x="759" y="685">mirage_console_xen.a</text><title>/home/hannes/.opam/4.02.3/lib/mirage-console/mirage_console_xen.a (51346)</title></g>
<g><rect x="749" y="709" height="47" width="51" style="stroke:#006000; fill: #542437"/> <text x="759" y="733">bigstring.a</text><title>/home/hannes/.opam/4.02.3/lib/ocplib-endian/bigstring.a (50380)</title></g>
<g><rect x="749" y="757" height="42" width="51" style="stroke:#006000; fill: #53777A"/> <text x="759" y="778">main.o</text><title>main.o (45272)</title></g>
<g><rect x="801" y="555" height="42" width="51" style="stroke:#006000; fill: #ECD078"/> <text x="811" y="576">logs.a</text><title>/home/hannes/.opam/4.02.3/lib/logs/logs.a (44770)</title></g>
<g><rect x="853" y="555" height="42" width="49" style="stroke:#006000; fill: #D95B43"/> <text x="863" y="576">libxencamlbindings.a</text><title>/home/hannes/.opam/4.02.3/lib/pkgconfig/../../lib/mirage-xen/libxencamlbindings.a (43158)</title></g>
<g><rect x="902" y="555" height="42" width="48" style="stroke:#006000; fill: #C02942"/> <text x="912" y="576">xen_gnt.a</text><title>/home/hannes/.opam/4.02.3/lib/xen-gnt/xen_gnt.a (42476)</title></g>
<g><rect x="951" y="555" height="42" width="48" style="stroke:#006000; fill: #542437"/> <text x="961" y="576">icmpv4.a</text><title>/home/hannes/.opam/4.02.3/lib/tcpip/icmpv4.a (41882)</title></g>
<g><rect x="801" y="597" height="40" width="51" style="stroke:#006000; fill: #53777A"/> <text x="811" y="617">libx86_64.a</text><title>/home/hannes/.opam/4.02.3/lib/minios-xen/libx86_64.a (41790)</title></g>
<g><rect x="852" y="597" height="40" width="50" style="stroke:#006000; fill: #ECD078"/> <text x="862" y="617">shared_memory_ring.a</text><title>/home/hannes/.opam/4.02.3/lib/shared-memory-ring/shared_memory_ring.a (41024)</title></g>
<g><rect x="903" y="597" height="40" width="49" style="stroke:#006000; fill: #D95B43"/> <text x="913" y="617">page.o</text><title>page.o (40744)</title></g>
<g><rect x="953" y="597" height="40" width="46" style="stroke:#006000; fill: #C02942"/> <text x="963" y="617">unikernel.o</text><title>unikernel.o (38344)</title></g>
<g><rect x="801" y="637" height="42" width="43" style="stroke:#006000; fill: #542437"/> <text x="811" y="659">re_str.a</text><title>/home/hannes/.opam/4.02.3/lib/re/re_str.a (37994)</title></g>
<g><rect x="801" y="680" height="42" width="43" style="stroke:#006000; fill: #53777A"/> <text x="811" y="701">libxenotherlibs.a</text><title>/home/hannes/.opam/4.02.3/lib/pkgconfig/../../lib/mirage-xen-ocaml/libxenotherlibs.a (37666)</title></g>
<g><rect x="801" y="722" height="39" width="43" style="stroke:#006000; fill: #ECD078"/> <text x="811" y="742">tls-mirage.a</text><title>/home/hannes/.opam/4.02.3/lib/tls/tls-mirage.a (34816)</title></g>
<g><rect x="801" y="762" height="37" width="43" style="stroke:#006000; fill: #D95B43"/> <text x="811" y="781">tcpip-stack-direct.a</text><title>/home/hannes/.opam/4.02.3/lib/tcpip/tcpip-stack-direct.a (33808)</title></g>
<g><rect x="845" y="637" height="35" width="44" style="stroke:#006000; fill: #C02942"/> <text x="855" y="655">mirage_console_proto.a</text><title>/home/hannes/.opam/4.02.3/lib/mirage-console/mirage_console_proto.a (32550)</title></g>
<g><rect x="889" y="637" height="35" width="37" style="stroke:#006000; fill: #542437"/> <text x="899" y="655">libbigarray.a</text><title>/home/hannes/.opam/4.02.3/lib/ocaml/libbigarray.a (27760)</title></g>
<g><rect x="927" y="637" height="35" width="36" style="stroke:#006000; fill: #53777A"/> <text x="937" y="655">ipv4.a</text><title>/home/hannes/.opam/4.02.3/lib/tcpip/ipv4.a (26902)</title></g>
<g><rect x="964" y="637" height="35" width="35" style="stroke:#006000; fill: #ECD078"/> <text x="974" y="655">bigarray.a</text><title>/home/hannes/.opam/4.02.3/lib/ocaml/bigarray.a (26228)</title></g>
<g><rect x="845" y="673" height="34" width="35" style="stroke:#006000; fill: #D95B43"/> <text x="855" y="690">logger.o</text><title>logger.o (24376)</title></g>
<g><rect x="845" y="707" height="31" width="35" style="stroke:#006000; fill: #C02942"/> <text x="855" y="723">xen_evtchn.a</text><title>/home/hannes/.opam/4.02.3/lib/xen-evtchn/xen_evtchn.a (22362)</title></g>
<g><rect x="845" y="739" height="30" width="35" style="stroke:#006000; fill: #542437"/> <text x="855" y="754">mirage-runtime.a</text><title>/home/hannes/.opam/4.02.3/lib/mirage/mirage-runtime.a (22140)</title></g>
<g><rect x="845" y="770" height="29" width="35" style="stroke:#006000; fill: #53777A"/> <text x="855" y="785">lwt_shared_memory_ring.a</text><title>/home/hannes/.opam/4.02.3/lib/shared-memory-ring/lwt_shared_memory_ring.a (21432)</title></g>
<g><rect x="880" y="673" height="31" width="31" style="stroke:#006000; fill: #ECD078"/> <text x="890" y="689">re_emacs.a</text><title>/home/hannes/.opam/4.02.3/lib/re/re_emacs.a (20354)</title></g>
<g><rect x="912" y="673" height="31" width="31" style="stroke:#006000; fill: #D95B43"/> <text x="922" y="689">xenstore_ring.a</text><title>/home/hannes/.opam/4.02.3/lib/shared-memory-ring/xenstore_ring.a (19818)</title></g>
<g><rect x="943" y="673" height="31" width="30" style="stroke:#006000; fill: #C02942"/> <text x="953" y="689">console_ring.a</text><title>/home/hannes/.opam/4.02.3/lib/shared-memory-ring/console_ring.a (19722)</title></g>
<g><rect x="974" y="673" height="31" width="25" style="stroke:#006000; fill: #542437"/> <text x="984" y="689">mirage-bootvar.a</text><title>/home/hannes/.opam/4.02.3/lib/mirage-bootvar/mirage-bootvar.a (16280)</title></g>
<g><rect x="880" y="705" height="32" width="24" style="stroke:#006000; fill: #53777A"/> <text x="890" y="721">libtcpip_stubs.a</text><title>/home/hannes/.opam/4.02.3/lib/tcpip/libtcpip_stubs.a (16256)</title></g>
<g><rect x="880" y="737" height="31" width="24" style="stroke:#006000; fill: #ECD078"/> <text x="890" y="753">key_gen.o</text><title>key_gen.o (15832)</title></g>
<g><rect x="880" y="769" height="30" width="24" style="stroke:#006000; fill: #D95B43"/> <text x="890" y="784">functoria-runtime.a</text><title>/home/hannes/.opam/4.02.3/lib/functoria/functoria-runtime.a (15444)</title></g>
<g><rect x="904" y="705" height="24" width="28" style="stroke:#006000; fill: #C02942"/> <text x="914" y="717">static1.o</text><title>static1.o (14512)</title></g>
<g><rect x="904" y="729" height="24" width="28" style="stroke:#006000; fill: #542437"/> <text x="914" y="742">libtcpip_xen_stubs.a</text><title>/home/hannes/.opam/4.02.3/lib/tcpip/libtcpip_xen_stubs.a (14500)</title></g>
<g><rect x="904" y="754" height="22" width="28" style="stroke:#006000; fill: #53777A"/> <text x="914" y="766">mirage-entropy-xen.a</text><title>/home/hannes/.opam/4.02.3/lib/mirage-entropy-xen/mirage-entropy-xen.a (13398)</title></g>
<g><rect x="904" y="777" height="22" width="28" style="stroke:#006000; fill: #ECD078"/> <text x="914" y="788">io_page.a</text><title>/home/hannes/.opam/4.02.3/lib/io-page/io_page.a (13208)</title></g>
<g><rect x="933" y="705" height="25" width="23" style="stroke:#006000; fill: #D95B43"/> <text x="943" y="717">libcstruct_stubs.a</text><title>/home/hannes/.opam/4.02.3/lib/cstruct/libcstruct_stubs.a (12016)</title></g>
<g><rect x="957" y="705" height="25" width="21" style="stroke:#006000; fill: #C02942"/> <text x="967" y="717">mProf.a</text><title>/home/hannes/.opam/4.02.3/lib/mirage-profile/mProf.a (11084)</title></g>
<g><rect x="978" y="705" height="25" width="21" style="stroke:#006000; fill: #542437"/> <text x="988" y="717">libio_page_unix_stubs.a</text><title>/home/hannes/.opam/4.02.3/lib/io-page/libio_page_unix_stubs.a (10930)</title></g>
<g><rect x="933" y="730" height="19" width="22" style="stroke:#006000; fill: #53777A"/> <text x="943" y="740">udp.a</text><title>/home/hannes/.opam/4.02.3/lib/tcpip/udp.a (9112)</title></g>
<g><rect x="956" y="730" height="19" width="22" style="stroke:#006000; fill: #ECD078"/> <text x="966" y="740">libcamlstr.a</text><title>/home/hannes/.opam/4.02.3/lib/ocaml/libcamlstr.a (8938)</title></g>
<g><rect x="978" y="730" height="19" width="21" style="stroke:#006000; fill: #D95B43"/> <text x="988" y="740">test.o</text><title>test.o (8760)</title></g>
<g><rect x="933" y="749" height="17" width="24" style="stroke:#006000; fill: #C02942"/> <text x="943" y="758">libio_page_xen_stubs.a</text><title>/home/hannes/.opam/4.02.3/lib/io-page/libio_page_xen_stubs.a (8430)</title></g>
<g><rect x="933" y="767" height="16" width="24" style="stroke:#006000; fill: #542437"/> <text x="943" y="775">libshared_memory_ring_stubs.a</text><title>/home/hannes/.opam/4.02.3/lib/shared-memory-ring/libshared_memory_ring_stubs.a (8220)</title></g>
<g><rect x="933" y="783" height="16" width="24" style="stroke:#006000; fill: #53777A"/> <text x="943" y="791">nocrypto_xen.a</text><title>/home/hannes/.opam/4.02.3/lib/nocrypto/nocrypto_xen.a (7938)</title></g>
<g><rect x="957" y="749" height="17" width="21" style="stroke:#006000; fill: #ECD078"/> <text x="967" y="758">ethif.a</text><title>/home/hannes/.opam/4.02.3/lib/tcpip/ethif.a (7776)</title></g>
<g><rect x="978" y="749" height="17" width="21" style="stroke:#006000; fill: #D95B43"/> <text x="988" y="758">libmirage-entropy-xen_stubs.a</text><title>/home/hannes/.opam/4.02.3/lib/mirage-entropy-xen/libmirage-entropy-xen_stubs.a (7704)</title></g>
<g><rect x="957" y="767" height="17" width="21" style="stroke:#006000; fill: #C02942"/> <text x="967" y="776">libmirage-entropy-xen_stubs.a</text><title>/home/hannes/.opam/4.02.3/lib/mirage-entropy-xen/libmirage-entropy-xen_stubs.a (7704)</title></g>
<g><rect x="957" y="785" height="14" width="21" style="stroke:#006000; fill: #542437"/> <text x="967" y="792">mirage-clock.a</text><title>/home/hannes/.opam/4.02.3/lib/mirage-clock-xen/mirage-clock.a (6476)</title></g>
<g><rect x="979" y="767" height="11" width="20" style="stroke:#006000; fill: #53777A"/> <text x="989" y="773">tcpv4_plus.o</text><title>tcpv4_plus.o (4984)</title></g>
<g><rect x="979" y="779" height="12" width="11" style="stroke:#006000; fill: #ECD078"/> <text x="989" y="785">std_exit.o</text><title>/home/hannes/.opam/4.02.3/lib/ocaml/std_exit.o (2944)</title></g>
<g><rect x="979" y="791" height="8" width="11" style="stroke:#006000; fill: #D95B43"/> <text x="989" y="795">io_page_unix.a</text><title>/home/hannes/.opam/4.02.3/lib/io-page/io_page_unix.a (1934)</title></g>
<g><rect x="991" y="779" height="10" width="8" style="stroke:#006000; fill: #C02942"/> <text x="1001" y="784">result.a</text><title>/home/hannes/.opam/4.02.3/lib/result/result.a (1852)</title></g>
<g><rect x="991" y="790" height="9" width="8" style="stroke:#006000; fill: #542437"/> <text x="1001" y="795">mirage-console.a</text><title>/home/hannes/.opam/4.02.3/lib/mirage-console/mirage-console.a (1778)</title></g>
</svg>

After

Width:  |  Height:  |  Size: 19 KiB

1341
static/img/pinata-deps.svg Normal file

File diff suppressed because it is too large Load diff

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

File diff suppressed because one or more lines are too long

3
tags/UI Normal file
View file

@ -0,0 +1,3 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>full stack engineer</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="full stack engineer" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="flex-container"><div class="list-group listing"><a href="/Posts/Jackline" class="list-group-item"><h2 class="list-group-item-heading">Jackline, a secure terminal-based XMPP client</h2><span class="author">Written by hannes</span> <time>2017-01-30</time><br/><p class="list-group-item-text abstract"><p>implement it once to know you can do it. implement it a second time and you get readable code. implementing it a third time from scratch may lead to useful libraries.</p>
</p></a></div></div></div></main></body></html>

6
tags/background Normal file
View file

@ -0,0 +1,6 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>full stack engineer</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="full stack engineer" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="flex-container"><div class="list-group listing"><a href="/Posts/BottomUp" class="list-group-item"><h2 class="list-group-item-heading">Counting Bytes</h2><span class="author">Written by hannes</span> <time>2016-06-11</time><br/><p class="list-group-item-text abstract"><p>looking into dependencies and their sizes</p>
</p></a><a href="/Posts/Functoria" class="list-group-item"><h2 class="list-group-item-heading">Configuration DSL step-by-step</h2><span class="author">Written by hannes</span> <time>2016-05-10</time><br/><p class="list-group-item-text abstract"><p>how to actually configure the system</p>
</p></a><a href="/Posts/OCaml" class="list-group-item"><h2 class="list-group-item-heading">Why OCaml</h2><span class="author">Written by hannes</span> <time>2016-04-17</time><br/><p class="list-group-item-text abstract"><p>a gentle introduction into OCaml</p>
</p></a><a href="/About" class="list-group-item"><h2 class="list-group-item-heading">About</h2><span class="author">Written by hannes</span> <time>2016-04-01</time><br/><p class="list-group-item-text abstract"><p>introduction (myself, this site)</p>
</p></a></div></div></div></main></body></html>

3
tags/bitcoin Normal file
View file

@ -0,0 +1,3 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>full stack engineer</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="full stack engineer" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="flex-container"><div class="list-group listing"><a href="/Posts/Pinata" class="list-group-item"><h2 class="list-group-item-heading">The Bitcoin Piñata - no candy for you</h2><span class="author">Written by hannes</span> <time>2018-04-18</time><br/><p class="list-group-item-text abstract"><p>More than three years ago we launched our Bitcoin Piñata as a transparent security bait. It is still up and running!</p>
</p></a></div></div></div></main></body></html>

8
tags/deployment Normal file
View file

@ -0,0 +1,8 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>full stack engineer</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="full stack engineer" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="flex-container"><div class="list-group listing"><a href="/Posts/OpamMirror" class="list-group-item"><h2 class="list-group-item-heading">Mirroring the opam repository and all tarballs</h2><span class="author">Written by hannes</span> <time>2022-09-29</time><br/><p class="list-group-item-text abstract"><p>Re-developing an opam cache from scratch, as a MirageOS unikernel</p>
</p></a><a href="/Posts/Monitoring" class="list-group-item"><h2 class="list-group-item-heading">All your metrics belong to influx</h2><span class="author">Written by hannes</span> <time>2022-03-08</time><br/><p class="list-group-item-text abstract"><p>How to monitor your MirageOS unikernel with albatross and monitoring-experiments</p>
</p></a><a href="/Posts/Deploy" class="list-group-item"><h2 class="list-group-item-heading">Deploying binary MirageOS unikernels</h2><span class="author">Written by hannes</span> <time>2021-06-30</time><br/><p class="list-group-item-text abstract"><p>Finally, we provide reproducible binary MirageOS unikernels together with packages to reproduce them and setup your own builder</p>
</p></a><a href="/Posts/DnsServer" class="list-group-item"><h2 class="list-group-item-heading">Deploying authoritative OCaml-DNS servers as MirageOS unikernels</h2><span class="author">Written by hannes</span> <time>2019-12-23</time><br/><p class="list-group-item-text abstract"><p>A tutorial how to deploy authoritative name servers, let's encrypt, and updating entries from unix services.</p>
</p></a><a href="/Posts/Summer2019" class="list-group-item"><h2 class="list-group-item-heading">Summer 2019</h2><span class="author">Written by hannes</span> <time>2019-07-08</time><br/><p class="list-group-item-text abstract"><p>Bringing MirageOS into production, take IV monitoring, CalDAV, DNS</p>
</p></a><a href="/Posts/VMM" class="list-group-item"><h2 class="list-group-item-heading">Albatross - provisioning, deploying, managing, and monitoring virtual machines</h2><span class="author">Written by hannes</span> <time>2017-07-10</time><br/><p class="list-group-item-text abstract"><p>all we need is X.509</p>
</p></a></div></div></div></main></body></html>

3
tags/future Normal file
View file

@ -0,0 +1,3 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>full stack engineer</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="full stack engineer" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="flex-container"><div class="list-group listing"><a href="/Posts/Solo5" class="list-group-item"><h2 class="list-group-item-heading">Minimising the virtual machine monitor</h2><span class="author">Written by hannes</span> <time>2016-07-02</time><br/><p class="list-group-item-text abstract"><p>MirageOS solo5 multiboot native on bhyve</p>
</p></a></div></div></div></main></body></html>

3
tags/http Normal file
View file

@ -0,0 +1,3 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>full stack engineer</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="full stack engineer" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="flex-container"><div class="list-group listing"><a href="/Posts/nqsbWebsite" class="list-group-item"><h2 class="list-group-item-heading">Fitting the things together</h2><span class="author">Written by hannes</span> <time>2016-04-24</time><br/><p class="list-group-item-text abstract"><p>building a simple website</p>
</p></a></div></div></div></main></body></html>

3
tags/logging Normal file
View file

@ -0,0 +1,3 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>full stack engineer</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="full stack engineer" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="flex-container"><div class="list-group listing"><a href="/Posts/Syslog" class="list-group-item"><h2 class="list-group-item-heading">Exfiltrating log data using syslog</h2><span class="author">Written by hannes</span> <time>2016-11-05</time><br/><p class="list-group-item-text abstract"><p>sometimes preservation of data is useful</p>
</p></a></div></div></div></main></body></html>

23
tags/mirageos Normal file
View file

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>full stack engineer</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="full stack engineer" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="flex-container"><div class="list-group listing"><a href="/Posts/OpamMirror" class="list-group-item"><h2 class="list-group-item-heading">Mirroring the opam repository and all tarballs</h2><span class="author">Written by hannes</span> <time>2022-09-29</time><br/><p class="list-group-item-text abstract"><p>Re-developing an opam cache from scratch, as a MirageOS unikernel</p>
</p></a><a href="/Posts/Monitoring" class="list-group-item"><h2 class="list-group-item-heading">All your metrics belong to influx</h2><span class="author">Written by hannes</span> <time>2022-03-08</time><br/><p class="list-group-item-text abstract"><p>How to monitor your MirageOS unikernel with albatross and monitoring-experiments</p>
</p></a><a href="/Posts/Deploy" class="list-group-item"><h2 class="list-group-item-heading">Deploying binary MirageOS unikernels</h2><span class="author">Written by hannes</span> <time>2021-06-30</time><br/><p class="list-group-item-text abstract"><p>Finally, we provide reproducible binary MirageOS unikernels together with packages to reproduce them and setup your own builder</p>
</p></a><a href="/Posts/EC" class="list-group-item"><h2 class="list-group-item-heading">Cryptography updates in OCaml and MirageOS</h2><span class="author">Written by hannes</span> <time>2021-04-23</time><br/><p class="list-group-item-text abstract"><p>Elliptic curves (ECDSA/ECDH) are supported in a maintainable and secure way.</p>
</p></a><a href="/Posts/NGI" class="list-group-item"><h2 class="list-group-item-heading">The road ahead for MirageOS in 2021</h2><span class="author">Written by hannes</span> <time>2021-01-25</time><br/><p class="list-group-item-text abstract"><p>Home office, MirageOS unikernels, 2020 recap, 2021 tbd</p>
</p></a><a href="/Posts/Traceroute" class="list-group-item"><h2 class="list-group-item-heading">Traceroute</h2><span class="author">Written by hannes</span> <time>2020-06-24</time><br/><p class="list-group-item-text abstract"><p>A MirageOS unikernel which traces the path between itself and a remote host.</p>
</p></a><a href="/Posts/DnsServer" class="list-group-item"><h2 class="list-group-item-heading">Deploying authoritative OCaml-DNS servers as MirageOS unikernels</h2><span class="author">Written by hannes</span> <time>2019-12-23</time><br/><p class="list-group-item-text abstract"><p>A tutorial how to deploy authoritative name servers, let's encrypt, and updating entries from unix services.</p>
</p></a><a href="/Posts/ReproducibleOPAM" class="list-group-item"><h2 class="list-group-item-heading">Reproducible MirageOS unikernel builds</h2><span class="author">Written by hannes</span> <time>2019-12-16</time><br/><p class="list-group-item-text abstract"><p>MirageOS unikernels are reproducible :)</p>
</p></a><a href="/Posts/X50907" class="list-group-item"><h2 class="list-group-item-heading">X509 0.7</h2><span class="author">Written by hannes</span> <time>2019-08-15</time><br/><p class="list-group-item-text abstract"><p>Five years since ocaml-x509 initial release, it has been reworked and used more widely</p>
</p></a><a href="/Posts/Summer2019" class="list-group-item"><h2 class="list-group-item-heading">Summer 2019</h2><span class="author">Written by hannes</span> <time>2019-07-08</time><br/><p class="list-group-item-text abstract"><p>Bringing MirageOS into production, take IV monitoring, CalDAV, DNS</p>
</p></a><a href="/Posts/Pinata" class="list-group-item"><h2 class="list-group-item-heading">The Bitcoin Piñata - no candy for you</h2><span class="author">Written by hannes</span> <time>2018-04-18</time><br/><p class="list-group-item-text abstract"><p>More than three years ago we launched our Bitcoin Piñata as a transparent security bait. It is still up and running!</p>
</p></a><a href="/Posts/DNS" class="list-group-item"><h2 class="list-group-item-heading">My 2018 contains robur and starts with re-engineering DNS</h2><span class="author">Written by hannes</span> <time>2018-01-11</time><br/><p class="list-group-item-text abstract"><p>New year brings new possibilities and a new environment. I've been working on the most Widely deployed key-value store, the domain name system. Primary and secondary name services are available, including dynamic updates, notify, and tsig authentication.</p>
</p></a><a href="/Posts/VMM" class="list-group-item"><h2 class="list-group-item-heading">Albatross - provisioning, deploying, managing, and monitoring virtual machines</h2><span class="author">Written by hannes</span> <time>2017-07-10</time><br/><p class="list-group-item-text abstract"><p>all we need is X.509</p>
</p></a><a href="/Posts/Syslog" class="list-group-item"><h2 class="list-group-item-heading">Exfiltrating log data using syslog</h2><span class="author">Written by hannes</span> <time>2016-11-05</time><br/><p class="list-group-item-text abstract"><p>sometimes preservation of data is useful</p>
</p></a><a href="/Posts/ARP" class="list-group-item"><h2 class="list-group-item-heading">Re-engineering ARP</h2><span class="author">Written by hannes</span> <time>2016-07-12</time><br/><p class="list-group-item-text abstract"><p>If you want it as you like, you've to do it yourself</p>
</p></a><a href="/Posts/Solo5" class="list-group-item"><h2 class="list-group-item-heading">Minimising the virtual machine monitor</h2><span class="author">Written by hannes</span> <time>2016-07-02</time><br/><p class="list-group-item-text abstract"><p>MirageOS solo5 multiboot native on bhyve</p>
</p></a><a href="/Posts/BottomUp" class="list-group-item"><h2 class="list-group-item-heading">Counting Bytes</h2><span class="author">Written by hannes</span> <time>2016-06-11</time><br/><p class="list-group-item-text abstract"><p>looking into dependencies and their sizes</p>
</p></a><a href="/Posts/Functoria" class="list-group-item"><h2 class="list-group-item-heading">Configuration DSL step-by-step</h2><span class="author">Written by hannes</span> <time>2016-05-10</time><br/><p class="list-group-item-text abstract"><p>how to actually configure the system</p>
</p></a><a href="/Posts/BadRecordMac" class="list-group-item"><h2 class="list-group-item-heading">Catch the bug, walking through the stack</h2><span class="author">Written by hannes</span> <time>2016-05-03</time><br/><p class="list-group-item-text abstract"><p>10BTC could've been yours</p>
</p></a><a href="/Posts/nqsbWebsite" class="list-group-item"><h2 class="list-group-item-heading">Fitting the things together</h2><span class="author">Written by hannes</span> <time>2016-04-24</time><br/><p class="list-group-item-text abstract"><p>building a simple website</p>
</p></a><a href="/Posts/OperatingSystem" class="list-group-item"><h2 class="list-group-item-heading">Operating systems</h2><span class="author">Written by hannes</span> <time>2016-04-09</time><br/><p class="list-group-item-text abstract"><p>Operating systems and MirageOS</p>
</p></a></div></div></div></main></body></html>

4
tags/monitoring Normal file
View file

@ -0,0 +1,4 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>full stack engineer</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="full stack engineer" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="flex-container"><div class="list-group listing"><a href="/Posts/Monitoring" class="list-group-item"><h2 class="list-group-item-heading">All your metrics belong to influx</h2><span class="author">Written by hannes</span> <time>2022-03-08</time><br/><p class="list-group-item-text abstract"><p>How to monitor your MirageOS unikernel with albatross and monitoring-experiments</p>
</p></a><a href="/Posts/Summer2019" class="list-group-item"><h2 class="list-group-item-heading">Summer 2019</h2><span class="author">Written by hannes</span> <time>2019-07-08</time><br/><p class="list-group-item-text abstract"><p>Bringing MirageOS into production, take IV monitoring, CalDAV, DNS</p>
</p></a></div></div></div></main></body></html>

3
tags/myself Normal file
View file

@ -0,0 +1,3 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>full stack engineer</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="full stack engineer" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="flex-container"><div class="list-group listing"><a href="/About" class="list-group-item"><h2 class="list-group-item-heading">About</h2><span class="author">Written by hannes</span> <time>2016-04-01</time><br/><p class="list-group-item-text abstract"><p>introduction (myself, this site)</p>
</p></a></div></div></div></main></body></html>

3
tags/opam Normal file
View file

@ -0,0 +1,3 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>full stack engineer</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="full stack engineer" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="flex-container"><div class="list-group listing"><a href="/Posts/OpamMirror" class="list-group-item"><h2 class="list-group-item-heading">Mirroring the opam repository and all tarballs</h2><span class="author">Written by hannes</span> <time>2022-09-29</time><br/><p class="list-group-item-text abstract"><p>Re-developing an opam cache from scratch, as a MirageOS unikernel</p>
</p></a></div></div></div></main></body></html>

3
tags/operating system Normal file
View file

@ -0,0 +1,3 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>full stack engineer</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="full stack engineer" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="flex-container"><div class="list-group listing"><a href="/Posts/OperatingSystem" class="list-group-item"><h2 class="list-group-item-heading">Operating systems</h2><span class="author">Written by hannes</span> <time>2016-04-09</time><br/><p class="list-group-item-text abstract"><p>Operating systems and MirageOS</p>
</p></a></div></div></div></main></body></html>

6
tags/overview Normal file
View file

@ -0,0 +1,6 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>full stack engineer</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="full stack engineer" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="flex-container"><div class="list-group listing"><a href="/Posts/Conex" class="list-group-item"><h2 class="list-group-item-heading">Conex, establish trust in community repositories</h2><span class="author">Written by hannes</span> <time>2017-02-16</time><br/><p class="list-group-item-text abstract"><p>Conex is a library to verify and attest package release integrity and authenticity through the use of cryptographic signatures.</p>
</p></a><a href="/Posts/OCaml" class="list-group-item"><h2 class="list-group-item-heading">Why OCaml</h2><span class="author">Written by hannes</span> <time>2016-04-17</time><br/><p class="list-group-item-text abstract"><p>a gentle introduction into OCaml</p>
</p></a><a href="/Posts/OperatingSystem" class="list-group-item"><h2 class="list-group-item-heading">Operating systems</h2><span class="author">Written by hannes</span> <time>2016-04-09</time><br/><p class="list-group-item-text abstract"><p>Operating systems and MirageOS</p>
</p></a><a href="/About" class="list-group-item"><h2 class="list-group-item-heading">About</h2><span class="author">Written by hannes</span> <time>2016-04-01</time><br/><p class="list-group-item-text abstract"><p>introduction (myself, this site)</p>
</p></a></div></div></div></main></body></html>

6
tags/package signing Normal file
View file

@ -0,0 +1,6 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>full stack engineer</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="full stack engineer" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="flex-container"><div class="list-group listing"><a href="/Posts/ReproducibleOPAM" class="list-group-item"><h2 class="list-group-item-heading">Reproducible MirageOS unikernel builds</h2><span class="author">Written by hannes</span> <time>2019-12-16</time><br/><p class="list-group-item-text abstract"><p>MirageOS unikernels are reproducible :)</p>
</p></a><a href="/Posts/Summer2019" class="list-group-item"><h2 class="list-group-item-heading">Summer 2019</h2><span class="author">Written by hannes</span> <time>2019-07-08</time><br/><p class="list-group-item-text abstract"><p>Bringing MirageOS into production, take IV monitoring, CalDAV, DNS</p>
</p></a><a href="/Posts/Conex" class="list-group-item"><h2 class="list-group-item-heading">Conex, establish trust in community repositories</h2><span class="author">Written by hannes</span> <time>2017-02-16</time><br/><p class="list-group-item-text abstract"><p>Conex is a library to verify and attest package release integrity and authenticity through the use of cryptographic signatures.</p>
</p></a><a href="/Posts/Maintainers" class="list-group-item"><h2 class="list-group-item-heading">Who maintains package X?</h2><span class="author">Written by hannes</span> <time>2017-02-16</time><br/><p class="list-group-item-text abstract"><p>We describe why manual gathering of metadata is out of date, and version control systems are awesome.</p>
</p></a></div></div></div></main></body></html>

8
tags/protocol Normal file
View file

@ -0,0 +1,8 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>full stack engineer</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="full stack engineer" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="flex-container"><div class="list-group listing"><a href="/Posts/Traceroute" class="list-group-item"><h2 class="list-group-item-heading">Traceroute</h2><span class="author">Written by hannes</span> <time>2020-06-24</time><br/><p class="list-group-item-text abstract"><p>A MirageOS unikernel which traces the path between itself and a remote host.</p>
</p></a><a href="/Posts/DnsServer" class="list-group-item"><h2 class="list-group-item-heading">Deploying authoritative OCaml-DNS servers as MirageOS unikernels</h2><span class="author">Written by hannes</span> <time>2019-12-23</time><br/><p class="list-group-item-text abstract"><p>A tutorial how to deploy authoritative name servers, let's encrypt, and updating entries from unix services.</p>
</p></a><a href="/Posts/DNS" class="list-group-item"><h2 class="list-group-item-heading">My 2018 contains robur and starts with re-engineering DNS</h2><span class="author">Written by hannes</span> <time>2018-01-11</time><br/><p class="list-group-item-text abstract"><p>New year brings new possibilities and a new environment. I've been working on the most Widely deployed key-value store, the domain name system. Primary and secondary name services are available, including dynamic updates, notify, and tsig authentication.</p>
</p></a><a href="/Posts/Syslog" class="list-group-item"><h2 class="list-group-item-heading">Exfiltrating log data using syslog</h2><span class="author">Written by hannes</span> <time>2016-11-05</time><br/><p class="list-group-item-text abstract"><p>sometimes preservation of data is useful</p>
</p></a><a href="/Posts/ARP" class="list-group-item"><h2 class="list-group-item-heading">Re-engineering ARP</h2><span class="author">Written by hannes</span> <time>2016-07-12</time><br/><p class="list-group-item-text abstract"><p>If you want it as you like, you've to do it yourself</p>
</p></a><a href="/Posts/nqsbWebsite" class="list-group-item"><h2 class="list-group-item-heading">Fitting the things together</h2><span class="author">Written by hannes</span> <time>2016-04-24</time><br/><p class="list-group-item-text abstract"><p>building a simple website</p>
</p></a></div></div></div></main></body></html>

3
tags/provisioning Normal file
View file

@ -0,0 +1,3 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>full stack engineer</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="full stack engineer" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="flex-container"><div class="list-group listing"><a href="/Posts/VMM" class="list-group-item"><h2 class="list-group-item-heading">Albatross - provisioning, deploying, managing, and monitoring virtual machines</h2><span class="author">Written by hannes</span> <time>2017-07-10</time><br/><p class="list-group-item-text abstract"><p>all we need is X.509</p>
</p></a></div></div></div></main></body></html>

12
tags/security Normal file
View file

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>full stack engineer</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="full stack engineer" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="flex-container"><div class="list-group listing"><a href="/Posts/EC" class="list-group-item"><h2 class="list-group-item-heading">Cryptography updates in OCaml and MirageOS</h2><span class="author">Written by hannes</span> <time>2021-04-23</time><br/><p class="list-group-item-text abstract"><p>Elliptic curves (ECDSA/ECDH) are supported in a maintainable and secure way.</p>
</p></a><a href="/Posts/ReproducibleOPAM" class="list-group-item"><h2 class="list-group-item-heading">Reproducible MirageOS unikernel builds</h2><span class="author">Written by hannes</span> <time>2019-12-16</time><br/><p class="list-group-item-text abstract"><p>MirageOS unikernels are reproducible :)</p>
</p></a><a href="/Posts/X50907" class="list-group-item"><h2 class="list-group-item-heading">X509 0.7</h2><span class="author">Written by hannes</span> <time>2019-08-15</time><br/><p class="list-group-item-text abstract"><p>Five years since ocaml-x509 initial release, it has been reworked and used more widely</p>
</p></a><a href="/Posts/Summer2019" class="list-group-item"><h2 class="list-group-item-heading">Summer 2019</h2><span class="author">Written by hannes</span> <time>2019-07-08</time><br/><p class="list-group-item-text abstract"><p>Bringing MirageOS into production, take IV monitoring, CalDAV, DNS</p>
</p></a><a href="/Posts/Pinata" class="list-group-item"><h2 class="list-group-item-heading">The Bitcoin Piñata - no candy for you</h2><span class="author">Written by hannes</span> <time>2018-04-18</time><br/><p class="list-group-item-text abstract"><p>More than three years ago we launched our Bitcoin Piñata as a transparent security bait. It is still up and running!</p>
</p></a><a href="/Posts/Conex" class="list-group-item"><h2 class="list-group-item-heading">Conex, establish trust in community repositories</h2><span class="author">Written by hannes</span> <time>2017-02-16</time><br/><p class="list-group-item-text abstract"><p>Conex is a library to verify and attest package release integrity and authenticity through the use of cryptographic signatures.</p>
</p></a><a href="/Posts/Maintainers" class="list-group-item"><h2 class="list-group-item-heading">Who maintains package X?</h2><span class="author">Written by hannes</span> <time>2017-02-16</time><br/><p class="list-group-item-text abstract"><p>We describe why manual gathering of metadata is out of date, and version control systems are awesome.</p>
</p></a><a href="/Posts/Jackline" class="list-group-item"><h2 class="list-group-item-heading">Jackline, a secure terminal-based XMPP client</h2><span class="author">Written by hannes</span> <time>2017-01-30</time><br/><p class="list-group-item-text abstract"><p>implement it once to know you can do it. implement it a second time and you get readable code. implementing it a third time from scratch may lead to useful libraries.</p>
</p></a><a href="/Posts/Solo5" class="list-group-item"><h2 class="list-group-item-heading">Minimising the virtual machine monitor</h2><span class="author">Written by hannes</span> <time>2016-07-02</time><br/><p class="list-group-item-text abstract"><p>MirageOS solo5 multiboot native on bhyve</p>
</p></a><a href="/Posts/BadRecordMac" class="list-group-item"><h2 class="list-group-item-heading">Catch the bug, walking through the stack</h2><span class="author">Written by hannes</span> <time>2016-05-03</time><br/><p class="list-group-item-text abstract"><p>10BTC could've been yours</p>
</p></a></div></div></div></main></body></html>

6
tags/tls Normal file
View file

@ -0,0 +1,6 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>full stack engineer</title><meta charset="UTF-8"/><link rel="stylesheet" href="/static/css/style.css"/><link rel="stylesheet" href="/static/css/highlight.css"/><script src="/static/js/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="alternate" href="/atom" title="full stack engineer" type="application/atom+xml"/><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/Posts">full stack engineer</a></div><div class="collapse navbar-collapse collapse"><ul class="nav navbar-nav navbar-right"><li><a href="/About"><span>About</span></a></li><li><a href="/Posts"><span>Posts</span></a></li></ul></div></div></nav><main><div class="flex-container"><div class="flex-container"><div class="list-group listing"><a href="/Posts/EC" class="list-group-item"><h2 class="list-group-item-heading">Cryptography updates in OCaml and MirageOS</h2><span class="author">Written by hannes</span> <time>2021-04-23</time><br/><p class="list-group-item-text abstract"><p>Elliptic curves (ECDSA/ECDH) are supported in a maintainable and secure way.</p>
</p></a><a href="/Posts/X50907" class="list-group-item"><h2 class="list-group-item-heading">X509 0.7</h2><span class="author">Written by hannes</span> <time>2019-08-15</time><br/><p class="list-group-item-text abstract"><p>Five years since ocaml-x509 initial release, it has been reworked and used more widely</p>
</p></a><a href="/Posts/Summer2019" class="list-group-item"><h2 class="list-group-item-heading">Summer 2019</h2><span class="author">Written by hannes</span> <time>2019-07-08</time><br/><p class="list-group-item-text abstract"><p>Bringing MirageOS into production, take IV monitoring, CalDAV, DNS</p>
</p></a><a href="/Posts/nqsbWebsite" class="list-group-item"><h2 class="list-group-item-heading">Fitting the things together</h2><span class="author">Written by hannes</span> <time>2016-04-24</time><br/><p class="list-group-item-text abstract"><p>building a simple website</p>
</p></a></div></div></div></main></body></html>