80 lines
5 KiB
Markdown
80 lines
5 KiB
Markdown
---
|
|
title: Mirage hack retreat 2017
|
|
date: 2017-03-20
|
|
---
|
|
|
|
Two weeks ago I was in Marrakech to attend the third [Mirage](https://mirage.io/) [hack retreat](http://marrakech2017.mirage.io/).
|
|
It was the first time I was
|
|
|
|
* attending the hack retreat,
|
|
|
|
* in Morocco,
|
|
|
|
* and outside Europe (although just barely)!
|
|
|
|
After landing in the newly expanded airport I managed to meet up with a few other attendees.
|
|
Luckily for me one of them had been to the hostel-turned-artist-collective(?) [Priscilla Queen of the Medina](http://www.queen-of-the-medina.com/en/index.html).
|
|
Otherwise I would have to [find my own way](https://www.youtube.com/watch?v=zgzwmyxlKBE)!
|
|
After about three walks I learned the route myself.
|
|
|
|
![RAK airport (* TODO: scale image *)](/images/RAK.jpg)
|
|
|
|
In Marrakech the weather was really hot, and the sun strong.
|
|
A week prior to arriving, I had had some pre-heating with 17 degrees in Vienna.
|
|
It was still quite a big jump in temperatures;
|
|
some days it was around 30 degrees, and with sun as strong as it gets on the warmest summer days in Denmark.
|
|
The situation was made worse by me somehow forgetting to pack my shorts (I swear I put them out on the desk at home so as to not forget them!)
|
|
|
|
# When not relaxing
|
|
|
|
When I was not relaxing, I spent most of my time working with [Michele](https://github.com/mmaker) and others updating his [Let's Encrypt / ACME client](https://github.com/mmaker/ocaml-letsencrypt).
|
|
Before arriving I had mentioned I had mentioned on the mailing list that the Let's Encrypt client was something I wanted to work on.
|
|
My motives were, however, mostly about getting something I could start using rather an interest in working on this.
|
|
It turned out to be a lot of fun to work with Michele and others on this.
|
|
A lot of my time on this project went in to handling accepting the terms of service.
|
|
To this day it's still a mystery how exactly you're supposed to do this.
|
|
The implementation works for most use cases, but there is still a corner case where it doesn't work:
|
|
A new client registration was initiated but not completed e.g. due to network errors - it's then a mystery to me how one is supposed to retrieve the terms of service.
|
|
Besides the ToS handling, we managed to implement some cool features!
|
|
|
|
## Getting distracted
|
|
|
|
While working on the Let's Encrypt client I had an idea and a sudden urge to implement this idea.
|
|
In utop you can `#show` the type of values and the structure of modules.
|
|
However, if you want to access the documentation strings you have to fire up another program called `ocp-browser` (from the package `ocp-index`; hit alt+h to access help information in `ocp-browser`).
|
|
This is a distraction to my work flow.
|
|
I thought to myself *'why is this not accessible from within utop?'*
|
|
So I started investigating how `ocp-browser` works, and I discovered `ocp-index` provides a library.
|
|
Perfect!
|
|
|
|
|
|
So I spent half a day trying to figure out how to get the path to `lib` inside your current opam switch using `opam-lib`.
|
|
After finally figuring this out I could query the doc strings of functions using the library.
|
|
Next step was implementing this as a OCaml toplevel directive.
|
|
Thanks to [Rudi](https://github.com/rgrinberg) I avoided spending another half-day trying to figure out how to do something not-so-well-documented.
|
|
It culminated in a repository which can be pinned and installed in opam as [ocp-index-top](https://github.com/reynir/ocp-index-top).
|
|
I ended up removing the `opam-lib` dependency and shelling out to `opam config var lib` instead as `ocp-browser` does.
|
|
I found this inelegant, but unfortunately the `opam-lib` API seems to be unstable and resulted in a couple of version conflicts and downgrades when other people wanted to install my package.
|
|
It's still a bit of a hack but *It Works For Me*™
|
|
|
|
## An SSH library
|
|
|
|
Another project I worked on (barely) was [awa-ssh](https://github.com/haesbaert/awa-ssh) by [Christiano](https://github.com/haesbaert).
|
|
It's a SSH library in pure OCaml.
|
|
It was a project I was excited about because SSH is a protocol I use often and many times a day, and I find the protocol itself interesting.
|
|
For example, the protocol can be used [as a chat client or for RPC](https://medium.com/@shazow/ssh-how-does-it-even-9e43586e4ffc).
|
|
Christiano suggested I first read (some of) the RFCs for the protocol in order to get a basic understanding.
|
|
I did so, and the next day I had read up some on the first steps in the protocol.
|
|
He then showed me how the code was structured, and I played around with a test server.
|
|
Immediately I found a bug!
|
|
My client sends a version string `SSH-2.0-OpenSSH_7.4p1 Debian-6`.
|
|
The bit before the space character is the version information while the bit after is a comment string.
|
|
The dash (`-`) in the comment threw off the parser, and it deemed it an invalid version string.
|
|
A test case was added and I then proceeded to fix the bug and got it [merged](https://github.com/haesbaert/awa-ssh/pull/2).
|
|
What a start!
|
|
I hope to spend some more time looking, and hopefully contributing, to this library.
|
|
…
|
|
Once I find time!
|
|
|
|
Overall it was a pleasant experience, and I look forward to joining next year!
|