MDT(1)

NAME
mdt - manipulate Mendel Linux devices

SYNOPSIS
mdt [SUBCOMMAND] [ARGS]...

DESCRIPTION

MDT is a simple tool to aid in working with single board computers that the Mendel Linux distribution runs on. It consists of a whole bunch of pre-existing open source tooling, coupled with some simple wrappers written in python to ease their use.

It also provides an easy way to interact with these boards without having to fight with serial consoles, IP addresses, and other fiddly bits, reducing barrier to entry when working with these boards.

With minimal effort, MDT should also be portable to existing systems such as Debian and Ubuntu, if needed. This, however, is out of the scope of this project.

MDT primarily uses the SSH protocol for most of its operations, and heavily relies on key-based authentication to the device.

TYPICAL WORKFLOW

Running the mdt command will automatically print out a summary of useful subcommands to run. The typical workflow with mdt is the following:

Run mdt devices to see what devices are available on your local network segment.

Run mdt set preferred-device DEVICE-NAME-OR-IP-ADDRESS to set the name or IP address of the device you would like to connect to.

Run mdt shell to open an interactive terminal to the device. This will automatically generate a key (if you didn't have one already), push the key to the board, and then open an interactive shell via SSH.

Run mdt pull or mdt push to push and pull files to and from the device.

Run mdt install to install a locally-built Debian package to the board, without having to manually push and run dpkg.

NETWORKING

MDT uses SSH to handle most commands in the backend, and requires SSH keys for authentication to the device. Keys are stored in the ~/.config/mdt/keys directory, and are readily usable by standard SSH tooling, if required. The remote device is expected to advertise the _googlemdt._tcp service over mDNS and run both SSH and mdt-keymaster.

INITIAL SETUP

MDT expects the remote device to be free of any initial SSH keys and running the mdt-keymaster service on port 41337. This service is a simple HTTP server that expects a single PUT command to be sent containing a line that can be added to the default user's authorized_keys file.

During first contact the MDT client will generate an SSH key if none are on disk. Once it has one, it will attempt to connect via SSH to the remote device using this key only. If this fails, it will then attempt to push the key's public part via the mdt-keymaster service as described above.

Once this file has been written to, mdt-keymaster will stop running from that point forward, and key authentication should perform normally. It is expected that the remote SSH service will be running in key authentication mode only.

To reset the board's authentication keys, run mdt resetkeys. This will remove all MDT keys from the device's authorized_keys file and restart mdt-keymaster, making it ready to receive new keys again.

SUBCOMMANDS

MDT recognizes the following subcommands:

help
    gets detailed help on any other subcommand

clear
    clears (unsets) an MDT variable on disk

devices
    prints a list of discovered devices on the local network segment

exec
    runs a shell command on a connected device

genkey
    generates an SSH key to use for authenticating to a device

get prints the value of an MDT variable on disk

install
    installs a Debian package (.deb) to a connected device

pull
    pulls (copies, downloads) a single or set of files from a connected device

push
    pushes (copies, uploads) a single or set of files to a connected device

reboot
    reboots a connected device

reboot-bootloader
    reboots a connected device into the fastboot bootloader

resetkeys
    removes all MDT keys from a device and restarts mdt-keymaster so that keys may be pushed again

set sets an MDT variable on disk

setkey
    imports an OpenSSH private key in PEM format into MDT's keys directory

shell
    opens an SSH shell connection to a connected device

wait-for-device
    waits for a device to be discovered on the local network segment

version
    prints which version of MDT this is

FILES

MDT stores files in the user's home directory under the standard .config/mdt heirarchy. Two subdirectories are used in here, called attribs and keys.

attribs contains any single-line files used to store MDT variables.

keys contains the SSH keys generated by MDT and are used for SSH authentication.

KNOWN ISSUES

None.

AUTHOR
Written by June Tate-Gans.

REPORTING BUGS
Contact Coral support at <coral-support@google.com>

COPYRIGHT
Copyright © 2018 Google, Inc. License Apache 2.0.