The JaiaBots and Hubs require SSH access for several purposes:
SSH is primarily allowed through FIDO hardware authenticators (the Yubikey product) via OpenSSH's "ed25519-sk" public key type. This provides convenient two-factor authentication ([1] physical key + [2] private key file).
All permissions flow from a set of "root" Yubikeys that are flashed to the image at generation time (jaiabot/rootfs/customization/includes.chroot/etc/jaiabot/ssh/root_authorized_keys).
The root yubikeys are controlled by trusted parties at the JaiaBot headquarters. This always allow access, but only when the Bots/Hubs are accessible via the service VPN (which can be enabled/disabled using the Upgrade GUI).
These keys are stored in /etc/jaiabot/ssh/root_authorized_keys
.
This must currently be done manually, but future upgrades will provide a mechanism by which Root Yubikeys can be revoked during software upgrades (During apt install jaiabot-embedded
).
Each hub ships with its own Yubikey permanently installed into the USB port of the hub. The public key is distributed to all the bots during fleet configuration and is stored in /etc/jaiabot/ssh/hub_authorized_keys
.
Re-running fleet configuration with a new key will the key for that hub on all bots.
For various reasons (repairs, debugging, etc.), keys may need to be temporarily authorized that belong to JaiaBot employees, repair facilities, etc. These keys are stored in /etc/jaiabot/ssh/tmp_authorized_keys
and are set with a timeout corresponding to the required time to perform the necessary activities.
These must be provisioned by a system with existing SSH access, typically via the root Yubikeys.
The jaia
command line tool can be used to add temporary Yubikeys to a given system (via the jaia admin ssh
set of actions).
For convenience, known trusted public keys are compiled into the source code at jaiabot/src/bin/tool/actions/admin/ssh/pubkeys.cpp
(in the pubkeys
vector). Revoked (lost, stolen, damaged) keys are also listed within this file.
Each authorized public key in OpenSSH is formatted as such (see https://man.openbsd.org/sshd#AUTHORIZED_KEYS_FILE_FORMAT):
This format is what we also use here with the jaia
tool.
To add a key to a Bot or Hub, run:
where the parameters are:
jaia
tool (see the Jaia Tool page).authorized_keys
. To see keys compiled into the tool, use jaia admin ssh known
.This entry is added to /etc/jaiabot/ssh/tmp_authorized_keys
, replacing the same key if it already exists.
For example,
adds the key corresponding to the comment "jaia@repair_test1" in pubkeys.cpp to Bot 1 on Fleet 0 (over the service VPN) for a period of 2 weeks. This key is only allowed to run /usr/share/jaiabot/config/fleet/fleet-config.sh
as defined in pubkeys.cpp.
For another example,
adds Toby's contractor/employee key 16719472 (also defined in pubkeys.cpp) for 3 days to the Hub 1 on Fleet 3 so he can perform debugging requested by the customer.
To remove a given key run:
where the parameters are the same as for adding a key.
Alternatively,
removes all known (compiled-in) revoked public keys on that host.
shows all the authorized keys on the host and which file they reside in.
removes all temporary keys from the host.
shows the comment for all the known valid keys.
shows the full authorized keys line for all known valid keys.
shows the comment for all the revoked keys.
Keys can be revoked by adding them to the revoked_pubkeys
vector in pubkeys.cpp. These keys are no longer allowed to be added (with jaia admin ssh add
) and can be removed from existing systems using jaia admin ssh rm <host> --revoked
.
Customers are free to add SSH keys of any type to /home/jaia/.ssh/authorized_keys
, which is otherwise empty. When specifying "forever" as the "valid_for" parameter, the keys are defaulted to this file, rather than /etc/jaiabot/ssh/tmp_authorized_keys
.
The jaia
tool can add these keys using, for example:
or by manually editing the /home/jaia/.ssh/authorized_keys
file.
vpn.jaia.tech
and packages.jaia.tech
can be managed in the same way, e.g.: