Skip to content

Commit e84c4ff

Browse files
committed
Merge pull request #183 from jonludlam/pool-wide-ssh
Add pool-wide ssh design draft
2 parents 8df6b4d + 4df1cd3 commit e84c4ff

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
title: Pool-wide SSH
3+
layout: default
4+
design_doc: true
5+
revision: 1
6+
status: proposed
7+
---
8+
9+
## Background
10+
11+
The SMAPIv3 plugin architecture requires that storage plugins are able to work
12+
in the absence of xapi. Amongst other benefits, this allows them to be tested
13+
in isolation, are able to be shared more widely than just within the XenServer
14+
community and will cause less load on xapi's database.
15+
16+
However, many of the currently existing SMAPIv1 backends require inter-host
17+
operations to be performed. This is achieved via the use of the Xen-API call
18+
'host.call_plugin', which allows an API user to execute a pre-installed plugin
19+
on any pool member. This is important for operations such as coalesce / snapshot
20+
where the active data path for a VM somewhere in the pool needs to be refreshed
21+
in order to complete the operation. In order to use this, the RPM in which the
22+
SM backend lives is used to deliver a plugin script into /etc/xapi.d/plugins,
23+
and this executes the required function when the API call is made.
24+
25+
In order to support these use-cases without xapi running, a new mechanism needs
26+
to be provided to allow the execution of required functionality on remote hosts.
27+
The canonical method for remotely executing scripts is ssh - the secure shell.
28+
This design proposal is setting out how xapi might manage the public and
29+
private keys to enable passwordless authentication of ssh sessions between all
30+
hosts in a pool.
31+
32+
## Modifications to the host
33+
34+
On firstboot (and after being ejected), the host should generate a
35+
host key (already done I believe), and an authentication key for the
36+
user (root/xapi?).
37+
38+
## Modifications to xapi
39+
40+
Three new fields will be added to the host object:
41+
42+
- ```host.ssh_public_host_key : string```: This is the host key that identifies the host
43+
during the initial ssh key exchange protocol. This should be added to the
44+
'known_hosts' field of any other host wishing to ssh to this host.
45+
46+
- ```host.ssh_public_authentication_key : string```: This field is the public
47+
key used for authentication when sshing from the root account on that host -
48+
host A. This can be added to host B's ```authorized_keys``` file in order to
49+
allow passwordless logins from host A to host B.
50+
51+
- ```host.ssh_ready : bool```: A boolean flag indicating that the configuration
52+
files in use by the ssh server/client on the host are up to date.
53+
54+
One new field will be added to the pool record:
55+
56+
- ```pool.revoked_authentication_keys : string list```: This field records all
57+
authentication keys that have been used by hosts in the past. It is updated
58+
when a host is ejected from the pool.
59+
60+
### Pool Join
61+
62+
On pool join, the master creates the record for the new host and populates the
63+
two public key fields with values supplied by the joining host. It then sets
64+
the ```ssh_ready``` field on all other hosts to ```false```.
65+
66+
On each host in the pool, a thread is watching for updates to the
67+
```ssh_ready``` value for the local host. When this is set to false, the host
68+
then adds the keys from xapi's database to the appropriate places in the ssh
69+
configuration files and restarts sshd. Once this is done, the host sets the
70+
```ssh_ready``` field to 'true'
71+
72+
### Pool Eject
73+
74+
On pool eject, the host's ssh_public_host_key is lost, but the authetication key is added to a list of revoked keys on the pool object. This allows all other hosts to remove the key from the authorized_keys list when they next sync, which in the usual case is immediately the database is modified due to the event watch thread. If the host is offline though, the authorized_keys file will be updated the next time the host comes online.
75+
76+
77+
## Questions
78+
79+
- Do we want a new user? e.g. 'xapi' - how would we then use this user to execute privileged things? setuid binaries?
80+
- Is keeping the revoked_keys list useful? If we 'control the world' of the authorized_keys file, we could just remove anything that's currently in there that xapi doesn't know about

0 commit comments

Comments
 (0)