]> git.proxmox.com Git - mirror_ovs.git/blame - Documentation/howto/ssl.rst
netdev-offload-dpdk: Support offload of VLAN PUSH/POP actions.
[mirror_ovs.git] / Documentation / howto / ssl.rst
CommitLineData
4b9ba26d
SF
1..
2 Licensed under the Apache License, Version 2.0 (the "License"); you may
3 not use this file except in compliance with the License. You may obtain
4 a copy of the License at
5
6 http://www.apache.org/licenses/LICENSE-2.0
7
8 Unless required by applicable law or agreed to in writing, software
9 distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11 License for the specific language governing permissions and limitations
12 under the License.
13
14 Convention for heading levels in Open vSwitch documentation:
15
16 ======= Heading 0 (reserved for the title in a document)
17 ------- Heading 1
18 ~~~~~~~ Heading 2
19 +++++++ Heading 3
20 ''''''' Heading 4
21
22 Avoid deeper levels because they do not render well.
23
24=====================
25Open vSwitch with SSL
26=====================
27
28If you plan to configure Open vSwitch to connect across the network to an
29OpenFlow controller, then we recommend that you build Open vSwitch with
30OpenSSL. SSL support ensures integrity and confidentiality of the OpenFlow
31connections, increasing network security.
32
33This document describes how to configure an Open vSwitch to connect to an
795752a3
SF
34OpenFlow controller over SSL. Refer to :doc:`/intro/install/general`. for
35instructions on building Open vSwitch with SSL support.
4b9ba26d
SF
36
37Open vSwitch uses TLS version 1.0 or later (TLSv1), as specified by RFC 2246,
38which is very similar to SSL version 3.0. TLSv1 was released in January 1999,
39so all current software and hardware should implement it.
40
41This document assumes basic familiarity with public-key cryptography and
42public-key infrastructure.
43
44SSL Concepts for OpenFlow
45-------------------------
46
47This section is an introduction to the public-key infrastructure architectures
48that Open vSwitch supports for SSL authentication.
49
50To connect over SSL, every Open vSwitch must have a unique private/public key
51pair and a certificate that signs that public key. Typically, the Open vSwitch
52generates its own public/private key pair. There are two common ways to obtain
53a certificate for a switch:
54
55* Self-signed certificates: The Open vSwitch signs its certificate with its own
56 private key. In this case, each switch must be individually approved by the
57 OpenFlow controller(s), since there is no central authority.
58
59 This is the only switch PKI model currently supported by NOX
60 (http://noxrepo.org).
61
62* Switch certificate authority: A certificate authority (the "switch CA") signs
63 each Open vSwitch's public key. The OpenFlow controllers then check that any
64 connecting switches' certificates are signed by that certificate authority.
65
66 This is the only switch PKI model supported by the simple OpenFlow controller
67 included with Open vSwitch.
68
69Each Open vSwitch must also have a copy of the CA certificate for the
70certificate authority that signs OpenFlow controllers' keys (the "controller
71CA" certificate). Typically, the same controller CA certificate is installed
72on all of the switches within a given administrative unit. There are two
73common ways for a switch to obtain the controller CA certificate:
74
75* Manually copy the certificate to the switch through some secure means, e.g.
76 using a USB flash drive, or over the network with "scp", or even FTP or HTTP
77 followed by manual verification.
78
79* Open vSwitch "bootstrap" mode, in which Open vSwitch accepts and saves the
80 controller CA certificate that it obtains from the OpenFlow controller on its
81 first connection. Thereafter the switch will only connect to controllers
82 signed by the same CA certificate.
83
84Establishing a Public Key Infrastructure
85----------------------------------------
86
87Open vSwitch can make use of your existing public key infrastructure. If you
88already have a PKI, you may skip forward to the next section. Otherwise, if
89you do not have a PKI, the ovs-pki script included with Open vSwitch can help.
90To create an initial PKI structure, invoke it as:
91
92::
93
94 $ ovs-pki init
95
96This will create and populate a new PKI directory. The default location for
97the PKI directory depends on how the Open vSwitch tree was configured (to see
98the configured default, look for the ``--dir`` option description in the output
99of ``ovs-pki --help``).
100
101The pki directory contains two important subdirectories. The `controllerca`
102subdirectory contains controller CA files, including the following:
103
104`cacert.pem`
105 Root certificate for the controller certificate authority. Each Open vSwitch
106 must have a copy of this file to allow it to authenticate valid controllers.
107
108`private/cakey.pem`
109 Private signing key for the controller certificate authority. This file must
110 be kept secret. There is no need for switches or controllers to have a copy
111 of it.
112
113The `switchca` subdirectory contains switch CA files, analogous to those in the
114`controllerca` subdirectory:
115
116`cacert.pem`
117 Root certificate for the switch certificate authority. The OpenFlow
118 controller must have this file to enable it to authenticate valid switches.
119
120`private/cakey.pem`
121 Private signing key for the switch certificate authority. This file must be
122 kept secret. There is no need for switches or controllers to have a copy of
123 it.
124
125After you create the initial structure, you can create keys and certificates
126for switches and controllers with ovs-pki. Refer to the ovs-pki(8) manage for
127complete details. A few examples of its use follow:
128
129Controller Key Generation
130~~~~~~~~~~~~~~~~~~~~~~~~~
131
132To create a controller private key and certificate in files named
133ctl-privkey.pem and ctl-cert.pem, run the following on the machine that
134contains the PKI structure:
135
136::
137
138 $ ovs-pki req+sign ctl controller
139
140ctl-privkey.pem and ctl-cert.pem would need to be copied to the controller for
141its use at runtime. If, for testing purposes, you were to use
142ovs-testcontroller, the simple OpenFlow controller included with Open vSwitch,
143then the --private-key and --certificate options, respectively, would point to
144these files.
145
146It is very important to make sure that no stray copies of ctl-privkey.pem are
147created, because they could be used to impersonate the controller.
148
149Switch Key Generation with Self-Signed Certificates
150~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
151
152If you are using self-signed certificates (see "SSL Concepts for OpenFlow"),
153this is one way to create an acceptable certificate for your controller to
154approve.
155
1561. Run the following command on the Open vSwitch itself::
157
158 $ ovs-pki self-sign sc
159
160 .. note::
161 This command does not require a copy of any of the PKI files generated by
162 ``ovs-pki init``, and you should not copy them to the switch because some
163 of them have contents that must remain secret for security.)
164
165 The ``ovs-pki self-sign`` command has the following output:
166
167 sc-privkey.pem
168 the switch private key file. For security, the contents of this file must
169 remain secret. There is ordinarily no need to copy this file off the Open
170 vSwitch.
171
172 sc-cert.pem
173 the switch certificate, signed by the switch's own private key. Its
174 contents are not a secret.
175
1762. Optionally, copy `controllerca/cacert.pem` from the machine that has the
177 OpenFlow PKI structure and verify that it is correct. (Otherwise, you will
178 have to use CA certificate bootstrapping when you configure Open vSwitch in
179 the next step.)
180
1813. Configure Open vSwitch to use the keys and certificates (see "Configuring
182 SSL Support", below).
183
184Switch Key Generation with a Switch PKI (Easy Method)
185~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
186
187If you are using a switch PKI (see "SSL Concepts for OpenFlow", above), this
188method of switch key generation is a little easier than the alternate method
189described below, but it is also a little less secure because it requires
190copying a sensitive private key from file from the machine hosting the PKI to
191the switch.
192
1931. Run the following on the machine that contains the PKI structure::
194
195 $ ovs-pki req+sign sc switch
196
197 This command has the following output:
198
199 sc-privkey.pem
200 the switch private key file. For security, the contents of this file must
201 remain secret.
202
203 sc-cert.pem
204 the switch certificate. Its contents are not a secret.
205
2062. Copy sc-privkey.pem and sc-cert.pem, plus controllerca/cacert.pem, to the
207 Open vSwitch.
208
2093. Delete the copies of sc-privkey.pem and sc-cert.pem on the PKI machine and
210 any other copies that may have been made in transit. It is very important
211 to make sure that there are no stray copies of sc-privkey.pem, because they
212 could be used to impersonate the switch.
213
214 .. warning::
215 Don't delete controllerca/cacert.pem! It is not security-sensitive and
216 you will need it to configure additional switches.
217
2184. Configure Open vSwitch to use the keys and certificates (see "Configuring
219 SSL Support", below).
220
221Switch Key Generation with a Switch PKI (More Secure)
222~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
223
224If you are using a switch PKI (see "SSL Concepts for OpenFlow", above), then,
225compared to the previous method, the method described here takes a little more
226work, but it does not involve copying the private key from one machine to
227another, so it may also be a little more secure.
228
2291. Run the following command on the Open vSwitch itself::
230
231 $ ovs-pki req sc
232
233 .. note::
234 This command does not require a copy of any of the PKI files generated by
235 "ovs-pki init", and you should not copy them to the switch because some of
236 them have contents that must remain secret for security.
237
238 The "ovs-pki req" command has the following output:
239
240 sc-privkey.pem
241 the switch private key file. For security, the contents of this file must
242 remain secret. There is ordinarily no need to copy this file off the Open
243 vSwitch.
244
245 sc-req.pem
246 the switch "certificate request", which is essentially the switch's public
247 key. Its contents are not a secret.
248
249 a fingerprint
250 this is output on stdout.
251
2522. Write the fingerprint down on a slip of paper and copy `sc-req.pem` to the
253 machine that contains the PKI structure.
254
2553. On the machine that contains the PKI structure, run::
256
257 $ ovs-pki sign sc switch
258
259 This command will output a fingerprint to stdout and request that you verify
260 it. Check that it is the same as the fingerprint that you wrote down on the
261 slip of paper before you answer "yes".
262
263 ``ovs-pki sign`` creates a file named `sc-cert.pem`, which is the switch
264 certificate. Its contents are not a secret.
265
2664. Copy the generated `sc-cert.pem`, plus `controllerca/cacert.pem` from the
267 PKI structure, to the Open vSwitch, and verify that they were copied
268 correctly.
269
270 You may delete `sc-cert.pem` from the machine that hosts the PKI
271 structure now, although it is not important that you do so.
272
273 .. warning::
274 Don't delete `controllerca/cacert.pem`! It is not security-sensitive and
275 you will need it to configure additional switches.
276
2775. Configure Open vSwitch to use the keys and certificates (see "Configuring
278 SSL Support", below).
279
280Configuring SSL Support
281-----------------------
282
283SSL configuration requires three additional configuration files. The first two
284of these are unique to each Open vSwitch. If you used the instructions above
285to build your PKI, then these files will be named `sc-privkey.pem` and
286`sc-cert.pem`, respectively:
287
288- A private key file, which contains the private half of an RSA or DSA key.
289
290 This file can be generated on the Open vSwitch itself, for the greatest
291 security, or it can be generated elsewhere and copied to the Open vSwitch.
292
293 The contents of the private key file are secret and must not be exposed.
294
295- A certificate file, which certifies that the private key is that of a
296 trustworthy Open vSwitch.
297
298 This file has to be generated on a machine that has the private key for the
299 switch certification authority, which should not be an Open vSwitch; ideally,
300 it should be a machine that is not networked at all.
301
302 The certificate file itself is not a secret.
303
304The third configuration file is typically the same across all the switches in a
305given administrative unit. If you used the instructions above to build your
306PKI, then this file will be named `cacert.pem`:
307
308- The root certificate for the controller certificate authority. The Open
309 vSwitch verifies it that is authorized to connect to an OpenFlow controller
310 by verifying a signature against this CA certificate.
311
312Once you have these files, configure ovs-vswitchd to use them using the
313``ovs-vsctl set-ssl`` command, e.g.::
314
315 $ ovs-vsctl set-ssl /etc/openvswitch/sc-privkey.pem \
316 /etc/openvswitch/sc-cert.pem /etc/openvswitch/cacert.pem
317
318Substitute the correct file names, of course, if they differ from the ones used
319above. You should use absolute file names (ones that begin with ``/``),
320because ovs-vswitchd's current directory is unrelated to the one from which you
321run ovs-vsctl.
322
323If you are using self-signed certificates (see "SSL Concepts for OpenFlow") and
324you did not copy controllerca/cacert.pem from the PKI machine to the Open
325vSwitch, then add the ``--bootstrap`` option, e.g.::
326
327 $ ovs-vsctl -- --bootstrap set-ssl /etc/openvswitch/sc-privkey.pem \
328 /etc/openvswitch/sc-cert.pem /etc/openvswitch/cacert.pem
329
330After you have added all of these configuration keys, you may specify ``ssl:``
331connection methods elsewhere in the configuration database. ``tcp:`` connection
332methods are still allowed even after SSL has been configured, so for security
333you should use only ``ssl:`` connections.
334
335Reporting Bugs
336--------------
337
338Report problems to bugs@openvswitch.org.