Statistics
| Branch: | Tag: | Revision:

root / doc / security.rst @ d2baa21d

History | View | Annotate | Download (4.1 kB)

1 28cc354f Iustin Pop
Security in Ganeti
2 6884c0ca Iustin Pop
==================
3 28cc354f Iustin Pop
4 28cc354f Iustin Pop
Ganeti was developed to run on internal, trusted systems. As such, the
5 28cc354f Iustin Pop
security model is all-or-nothing.
6 28cc354f Iustin Pop
7 28cc354f Iustin Pop
All the Ganeti code runs as root, because all the operations that Ganeti
8 bd028152 Iustin Pop
is doing require privileges: creating logical volumes, drbd devices,
9 28cc354f Iustin Pop
starting instances, etc. Running as root does not mean setuid, but that
10 28cc354f Iustin Pop
you need to be root to run the cluster commands.
11 28cc354f Iustin Pop
12 28cc354f Iustin Pop
Host issues
13 28cc354f Iustin Pop
-----------
14 28cc354f Iustin Pop
15 7faf5110 Michael Hanselmann
For a host on which the Ganeti software has been installed, but not
16 7faf5110 Michael Hanselmann
joined to a cluster, there are no changes to the system.
17 28cc354f Iustin Pop
18 28cc354f Iustin Pop
For a host that has been joined to the cluster, there are very important
19 28cc354f Iustin Pop
changes:
20 6884c0ca Iustin Pop
21 6884c0ca Iustin Pop
- The host will have its SSH host key replaced with the one of the
22 6884c0ca Iustin Pop
  cluster (which is the one the initial node had at the cluster
23 6884c0ca Iustin Pop
  creation)
24 6884c0ca Iustin Pop
- A new public key will be added to root's authorized_keys file,
25 6884c0ca Iustin Pop
  granting root access to all nodes of the cluster. The private part of
26 6884c0ca Iustin Pop
  the key is also distributed to all nodes. Old files are renamed.
27 6884c0ca Iustin Pop
- Communication between nodes is encrypted using SSL/TLS. A common key
28 6884c0ca Iustin Pop
  and certificate combo is shared between all nodes of the cluster.  At
29 6884c0ca Iustin Pop
  this time, no CA is used.
30 6884c0ca Iustin Pop
- The Ganeti node daemon will accept RPC requests from any host within
31 6884c0ca Iustin Pop
  the cluster with the correct certificate, and the operations it will
32 6884c0ca Iustin Pop
  do as a result of these requests are:
33 6884c0ca Iustin Pop
34 6884c0ca Iustin Pop
  - running commands under the /etc/ganeti/hooks directory
35 6884c0ca Iustin Pop
  - creating DRBD disks between it and the IP it has been told
36 6884c0ca Iustin Pop
  - overwrite a defined list of files on the host
37 28cc354f Iustin Pop
38 28cc354f Iustin Pop
As you can see, as soon as a node is joined, it becomes equal to all
39 28cc354f Iustin Pop
other nodes in the cluster, and the security of the cluster is
40 28cc354f Iustin Pop
determined by the weakest node.
41 28cc354f Iustin Pop
42 4fbe765c Michael Hanselmann
Note that only the SSH key will allow other machines to run random
43 28cc354f Iustin Pop
commands on this node; the RPC method will run only:
44 6884c0ca Iustin Pop
45 6884c0ca Iustin Pop
- well defined commands to create, remove, activate logical volumes,
46 6884c0ca Iustin Pop
  drbd devices, start/stop instances, etc;
47 6884c0ca Iustin Pop
- run SSH commands on other nodes in the cluster, again well-defined
48 6884c0ca Iustin Pop
- scripts under the /etc/ganeti/hooks directory
49 28cc354f Iustin Pop
50 28cc354f Iustin Pop
It is therefore important to make sure that the contents of the
51 28cc354f Iustin Pop
/etc/ganeti/hooks directory is supervised and only trusted sources can
52 28cc354f Iustin Pop
populate it.
53 28cc354f Iustin Pop
54 28cc354f Iustin Pop
Cluster issues
55 28cc354f Iustin Pop
--------------
56 28cc354f Iustin Pop
57 28cc354f Iustin Pop
As told above, there are multiple ways of communication between cluster
58 28cc354f Iustin Pop
nodes:
59 6884c0ca Iustin Pop
60 6884c0ca Iustin Pop
- SSH-based, for high-volume traffic like image dumps or for low-level
61 6884c0ca Iustin Pop
  command, e.g. restarting the Ganeti node daemon
62 6884c0ca Iustin Pop
- RPC communication between master and nodes
63 6884c0ca Iustin Pop
- DRBD real-time disk replication traffic
64 28cc354f Iustin Pop
65 4fbe765c Michael Hanselmann
The SSH traffic is protected (after the initial login to a new node) by
66 4fbe765c Michael Hanselmann
the cluster-wide shared SSH key.
67 28cc354f Iustin Pop
68 7faf5110 Michael Hanselmann
RPC communication between the master and nodes is protected using
69 7faf5110 Michael Hanselmann
SSL/TLS encryption. Both the client and the server must have the
70 7faf5110 Michael Hanselmann
cluster-wide shared SSL/TLS certificate and verify it when establishing
71 7faf5110 Michael Hanselmann
the connection by comparing fingerprints. We decided not to use a CA to
72 7faf5110 Michael Hanselmann
simplify the key handling.
73 28cc354f Iustin Pop
74 6884c0ca Iustin Pop
The DRBD traffic is not protected by encryption, as DRBD does not
75 6884c0ca Iustin Pop
support this. It's therefore recommended to implement host-level
76 888891c7 Michael Hanselmann
firewalling or to use a separate range of IP addresses for the DRBD
77 888891c7 Michael Hanselmann
traffic (this is supported in Ganeti) which is not routed outside the
78 6884c0ca Iustin Pop
cluster. DRBD connections are protected from connecting due to bugs to
79 6884c0ca Iustin Pop
other machines, and from accepting connections from other machines, by
80 6884c0ca Iustin Pop
using a shared secret, exchanged via RPC requests from the master to the
81 6884c0ca Iustin Pop
nodes when configuring the device.
82 6884c0ca Iustin Pop
83 6884c0ca Iustin Pop
Master daemon
84 6884c0ca Iustin Pop
-------------
85 6884c0ca Iustin Pop
86 7faf5110 Michael Hanselmann
The command-line tools to master daemon communication is done via an
87 7faf5110 Michael Hanselmann
UNIX socket, whose permissions are reset to ``0600`` after listening but
88 7faf5110 Michael Hanselmann
before serving requests. This permission-based protection is documented
89 7faf5110 Michael Hanselmann
and works on Linux, but is not-portable; however, Ganeti doesn't work on
90 7faf5110 Michael Hanselmann
non-Linux system at the moment.
91 4fbe765c Michael Hanselmann
92 4fbe765c Michael Hanselmann
Remote API
93 4fbe765c Michael Hanselmann
----------
94 4fbe765c Michael Hanselmann
95 7faf5110 Michael Hanselmann
Starting with Ganeti 2.0, Remote API traffic is encrypted using SSL/TLS
96 7faf5110 Michael Hanselmann
by default. It supports Basic authentication as per RFC2617.
97 4fbe765c Michael Hanselmann
98 7faf5110 Michael Hanselmann
Paths for certificate, private key and CA files required for SSL/TLS
99 7faf5110 Michael Hanselmann
will be set at source configure time. Symlinks or command line
100 7faf5110 Michael Hanselmann
parameters may be used to use different files.
101 558fd122 Michael Hanselmann
102 558fd122 Michael Hanselmann
.. vim: set textwidth=72 :
103 c71a1a3d Iustin Pop
.. Local Variables:
104 c71a1a3d Iustin Pop
.. mode: rst
105 c71a1a3d Iustin Pop
.. fill-column: 72
106 c71a1a3d Iustin Pop
.. End: