Statistics
| Branch: | Tag: | Revision:

root / doc / security.rst @ 558fd122

History | View | Annotate | Download (4 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 4fbe765c Michael Hanselmann
For a host on which the Ganeti software has been installed, but not joined to a
16 4fbe765c Michael Hanselmann
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 4fbe765c Michael Hanselmann
RPC communication between the master and nodes is protected using SSL/TLS
69 6884c0ca Iustin Pop
encryption. Both the client and the server must have the cluster-wide
70 4fbe765c Michael Hanselmann
shared SSL/TLS certificate and verify it when establishing the connection
71 4fbe765c Michael Hanselmann
by comparing fingerprints. We decided not to use a CA to simplify the
72 4fbe765c Michael Hanselmann
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 6884c0ca Iustin Pop
The command-line tools to master daemon communication is done via an UNIX
87 6884c0ca Iustin Pop
socket, whose permissions are reset to ``0600`` after listening but before
88 6884c0ca Iustin Pop
serving requests. This permission-based protection is documented and works on
89 6884c0ca Iustin Pop
Linux, but is not-portable; however, Ganeti doesn't work on non-Linux system at
90 6884c0ca Iustin Pop
the moment.
91 4fbe765c Michael Hanselmann
92 4fbe765c Michael Hanselmann
Remote API
93 4fbe765c Michael Hanselmann
----------
94 4fbe765c Michael Hanselmann
95 4fbe765c Michael Hanselmann
Starting with Ganeti 2.0, Remote API traffic is encrypted using SSL/TLS by
96 4fbe765c Michael Hanselmann
default. It supports Basic authentication as per RFC2617.
97 4fbe765c Michael Hanselmann
98 4fbe765c Michael Hanselmann
Paths for certificate, private key and CA files required for SSL/TLS will
99 4fbe765c Michael Hanselmann
be set at source configure time. Symlinks or command line parameters may
100 4fbe765c Michael Hanselmann
be used to use different files.
101 558fd122 Michael Hanselmann
102 558fd122 Michael Hanselmann
.. vim: set textwidth=72 :