Friday, February 26, 2016

makeup and decorations

This week was focused on basic work on libcad, the foundations library I use for circus and other projects.

My objective, for the upcoming weeks, is to code the framework and the first message of circus's client. For that, I need two components. Since those are likely re-usable, I coded those two components into libcad.

Templating engine

Yes, there are already templating engines. But almost none target pure C and those who do have a few shortcomings, such as the inability to define a specific memory handler. I need that for security.
So I started with a well-known spec: Mustache, and wrote cad_stache, the templating engine for Mustache in C.
Soon the ringmaster will proudly show off his mustachio.

CGI framework

In the same way, I found no convincing C library for CGI handling. Most target C++, and none allow for the customization of the memory handling.
So I started from my own CGI implementation in Eiffel, and translated in libcad.
I will also implement fastCGI, later, just to be complete. The library they provide is just awful: macro-ridden, even stdin/out are replaced by macros, meaning that all the components must be aware (i.e. depend!!) on the fastcgi thingy.
Circus will not use fastCGI, because the client is actually meant to die. It's a feature, not a bug.

To be continued…

Sunday, February 21, 2016

And now come the clowns.

After some time spent in real-life, I could at last implement the next admin feature for circus: creating a new user.

When a user is created, he/she is allocated a temporary password (by default valid 15 minutes). The aim is to send an email with that temporary password, that the user must change as soon as possible. (The mail sending is not coded yet.)

This simple spec brought quite a few changes:

  • The users now have an associated email
  • The password validity can now be limited
  • For tests, the "current time" is mocked to make the tests reproducible

Now that the very basic infrastructure is in place server-side, I need to start implementing the client, so that the next features can be implemented "vertically", i.e. with actual visibility.

Happy coding!

Thursday, February 4, 2016

Jumping through hoops

The Circus server is now alive. The best proof is that it can be stopped! Ain't that magic?

So what happened since the last billet?

The server learned to stop. This very first message is important: it means that the server actually listens and is able to understand queries.

Stopping the server is not a light operation, most of all because the server is meant to be controlled by the OS (SysV, whatever). Eventually that operation will become privileged. But for now it fills its role.

The server also learned to answer. The second message, ping, sends a phrase that must be sent back.

While implementing that message, a lot of bugs were shaken out; now the ZMQ layer (channel) looks quite solid and working very well with libuv. I am quite sure of that, because the logger also uses libuv, and log messages are correctly emitted.

The server tests also got better. A small test client already got factorized and will be the basis for the following message tests.

Program for next week

More acrobatics.

I want to look at that multi-user stuff.

The basic thinking is: I would not want anybody just connecting and creating a user, now would I? So creating a user must be a privileged operation, performed by an authenticated and authorized… user…

There are a few possibilities: using PAM, or having an administrator as seed. Maybe pre-creating and filling the database.

Some thinking must happen here.

Merry hacking!

Monday, January 25, 2016

The marquee is up.

Ladies and gentlemen, welcome and take a seat. Free red noses for everybody!

Great news: the circus server process runs!

It does nothing yet except listening on a network socket; but it means that the following pieces are in place:

  • configuration (although the server is designed to work with zero conf)
  • libuv and zmq integration (I am quite happy with that one)
  • logging

The vault has already been designed too. It will have the same concept that drove pwd's: one file. But its structure is vastly different; pwd switched from a home format to JSON. Circus will use sqlite instead, which is the best tool for the job.

I also draw one lesson from the past days: one cannot code without a vision. I had to stop and think for a while. Now I know where I am going!

Here is what I want:
  • Contrarily to pwd, the client expects the server to run. It is not be responsible with starting the server. All operating systems offer tools that are adapted to process supervision. Those tools must be used.
  • That has one important impact: pwd made the assumption that each user would start their own server process at will. Since the server is now started by the system, it must be multi-user.
  • Minimal time/space in which the data transits in clear. That means zeroing data and mlock()ing it. Thanks to libcad the memory handling functions may be simply redefined.
  • Zero-conf by default. Things must work out of the box.
  • OSI-like network layering. Zmq as low-level, and above that message handlers that virtually talk to each other.
  • Keep the red nose. I want a light tone, some humor does no harm.

Now that the server starts, the next step is to make it do something. Dance, play the trumpet, maybe even make the lion jump through hoops?

Happy hacking!

Thursday, January 7, 2016

Fanfare!

Ladies and gentleman,

Let the Ringmaster introduce his new soon-to-be famous Circus!

Circus is the successor of pwd; but it is written in C. I want to use standard and proven technologies!

It is very new for the moment. The code is being built, don't hesitate to come and participate. Red nose mandatory!

Happy new year!

Friday, December 18, 2015

Down from the tower.

OK. That's one time too many. Or even, quite too many times too many.

My beloved Eiffel compiler is really not production ready. It is the right tool to test ideas, but it is too brittle. The compiler was a very good one 15 years ago; but it did not evolve and is now quite behind the times.

Hacking on that compiler cannot stay a priority anymore. Let's face it, I am not up to the challenge. I feel like Atlas, trying to carry the thing on my frail shoulders.

Each time I try to make pwd evolve, I need to fix the compiler, or some standard library.

That needs far too much work and my patience is quite over.

I need my password manager. And I need it now. I want to use the man power I own (i.e. one our two hours per day, max) to make the best password manager ever. And no, I don't want to use a standard one, at least because it is the software I want to completely control.

So I will start anew.

My needs:
  • Using standard technologies, so that others can contribute. I will use the lingua franca of free software: C.
  • Using as many standard libraries as possible.
  • Using an event-driven model, because I want to avoid threading issues. Not decided yet: zmq, libuv?
  • Whenever relevant, build reusable libraries. That begins with libcad and yacjp.
  • Good security, especially cryptography-wise. I still want to be able to exchange passwords between my server and a web client. I need layers of security above https which is the bare minimum.
I also need a name. Ideas are welcome :-)

I think I will not write again in this blog before next year. So merry Christmas to all, have a good time with your loved ones, and happy hacking!

PS– That does not mean that I completely forsake Liberty; I will gladly help people whenever such help is wanted. But hey! Judging from the current mail flow, it should not take a lot of my time. And that's an understatement.

Thursday, December 3, 2015

Key properties

Hard times seem to be behind. Cross fingers.

Now that pwd works with a new format (JSON), I can start to implement a few enhancements I wanted to do.

The first is a bunch of key "properties": attach extra information to each key. For the moment, three properties are implemented: username, url, and tags.

I am quite proud of the tags system. It was really missing. It will help segregate keys on user criteria.

This is not yet over. I need more work on accessing and changing the key properties in the console and maybe the menu clients, and in the webclient.

MOre happy hacking to come.