Client Management


This chapter describes how to configure a Midori-based device locally through a browser interface or remotely through a network interface. In particular, the user or network administrator can:

Client Configuration

At boot-time, a small web server is launched by init that provides a series of configuration forms. The default browser has been modified so that the main configuration menu can be opened by clicking on the small icon on the top right of the screen. This opens a menu on the left side of the screen that includes all the possible choices.

Local/Remote Config

By default, Midori will only allow a local browser to change the configuration. Note that a skilled person may spoof its return address and be able to change configuration values anyway. Use the HTTPD_CONFIG_REMOTE build-time option to enable remote client configuration.

Build-Time Options

The build-time options listed below control the availability of different parts of the Midori client configuration system.
HTTPD_CONF Includes the configuration utility.
HTTPD_CONFIG_REMOTE Allows remote client configuration of Midori.
Each configuration option can be removed at compile time, or be protected with passwords as described below.

Security

By default no passwords are necessary to access any of the options. The system supports static passwords (which are compiled into the binary), or dynamic passwords.

Static Passwords

Two different static passwords can be set: a read-only password that allows the user to check the configuration, and a system administrator password that allows full access to all options.

The build-time options are:

HTTPD_CONFIG_PASSWORD=STATIC
HTTPD_CONFIG_READONLY_PASSWORD=user:user
HTTPD_CONFIG_SYSADMIN_PASSWORD=sysadmin:God

The string before the colon is the username, the string after the colon the password. Because static passwords are compiled into the binary (and not encrypted) it is rather trivial to find them. Static passwords should only be used for development purposes.

Dynamic Passwords

Dynamic passwords allow fine grained control. The web server sends a request to some predefined server (with the username and password) and expects in return a list of configuration options that can be changed by that user. The build-time options are:

HTTPD_CONFIG_PASSWORD=HTTP
HTTPD_CONFIG_PASSWORD_SERVER=servername
HTTPD_CONFIG_PASSWORD_PORT=port
HTTPD_CONFIG_PASSWORD_PATH=/somepath
The server will then send out a request of the form
GET /somepath HTTP/1.1
Host: servername
Authorization: Basic username:password
Connection: close
and in return expects
HTTP/1.1 200 OK
anything else is assumed to be a 'no permission' response. The file sent back must contain a list of scripts that this particular user may execute as a user or as sysadmin, of the form
x script
with x being 'r' for user access (no writes) or 'w' for sysadmin access. The list of scripts can be found in src/cgi/Makefile. Check all lines starting with
'PRG' (execute egrep 'PRG[+=]' src/cgi/Makefile
to get the list. An example would be
w poweroff
w reboot
w timezone
w time
w date
w disconnect
w reconnect
r network
which would allow the user to reboot or power off his device, change the time and date, and check the network configuration but not change it.

Note that even this scheme is relatively easy to circumvent (how is left as an exercise for the reader :-). In order to get truly secure, you would need to implement an SSL connection that also checks the key of the password server in order to avoid man in the middle attacks.

Remote Software Upgrades

Midori can perform remote software upgrades through a simple HTTP server/daemon mechanism.

Build-Time Options

The build-time options are:

UPGRADE_SRC=yes
UPGRADE_HOST=hostname
UPGRADE_PORT=portnumber
UPGRADE_PORT defines where the HTTP server will listen and UPGRADE_HOST defines where the upgrade program will look for the new images. There is an option to overwrite this when upgrading.

Performing an Upgrade

The simplest way to start an upgrade daemon is to run:

# make upgrade
in the top-level directory. It will first create the files necessary for the upgrade, and then start the httpd server. Once the server is running you can upgrade Midori as follows:
  1. Quit X (<ctrl>-<alt>-<backspace> does the trick)

  2. Type upgrade at the shell prompt. This will give you a list of packages that can be upgraded. Three are special:
    all upgrade everything
    packed upgrade the complete packed partition
    new upgrade only new packages (see below)

  3. To get a package type
    upgrade package_name
    
    If you upgrade the root package, your system will reboot after the upgrade.

  4. In order to upgrade from a specific host, use
    upgrade -h host:port
    
    After an upgrade the system will restart all the services that were stopped (for example X).

When done upgrading, you can type Ctrl-C in the shell where you ran make upgrade to kill the upgrade server.

Adding New Packages

The build process will assign every cramfs partition an edition number. By default it defines the edition number as the numbers of seconds since the Epoch. This means that every build will get a higher edition number and, as far as the upgrade program is concerned, each new image created is newer than the previous image.

However, by defining

EDITION=nnnn
in the config file one can define an edition number for the root partition, the main (/) packed partition and the usr partition. The same number is also used for cramfs images created for directories defined in image/images. In order to change the edition number for a specific directory, create a file called .edition which contains the edition number in this directory.

Example: to create a netscape partition with an edition number 1445 use:

echo "usr/lib/netscape" >> ../image/images
cd ../root/usr/lib
tar xzf ../../../tar/netscape.tar.gz
echo 1445 > netscape/.edition
Note that the special file .edition will not be part of the cramfs files.