snapweb icon indicating copy to clipboard operation
snapweb copied to clipboard

webconf service for the initial configuration of a device

Open dbarth opened this issue 8 years ago • 1 comments

Webconf provides a web UI for creating an initial administrative user on a device, similar to console-conf.

This initial implementation provides only the "create-user" part. Network configuration will come next.

A few words on the general architecture.

Webconf is implemented as a separate service, distinct from snapweb. Webconf runs only to turn an un-managed / embryonic device into a managed one. Once done, webconf is of no use on the device. At least, not until the device gets reset to its factory defaults.

Webconf is separated as a second safety measure over snapd's own guarantees against attempts at creating other admin users. In effect, snapd is protected by console access, whereas Snapweb only has the access token for it. Further, webconf is not protected by a token, and has to be available without preliminary console access, as its role is to open up console access for legit users. Hence the need to separate webconf and snapweb in distinct services.

Once webconf is done with the initial user creation, it stops and frees the HTTP socket for use by Snapweb. The handover is done by way of unix signals. Safety checks are placed at the start of both the webconf and snapweb services to ensure they won't run in the wrong context.

The UI for webconf, and its minimal daemon are implemented by re-using and re-packaging code from snapweb, since they both live in the same project space. Some further separation could be done at some point, in particular on the Web UI which is probably too complex for what it does. But i tried to stop when that was not helping anymore with the security of the implementation.

This branch also contains an initial set of spread tests verifying that webconf only runs on unmanaged devices. The tests also verify that snapweb doesn't start on an unmanaged device, and verify the transition between the 2 states.

dbarth avatar Jan 30 '17 17:01 dbarth

I think I addressed all comments. I have refactored the code a bit more to improve the test coverage.

dbarth avatar Mar 02 '17 20:03 dbarth