Commit f858dcaeba3aacf364a29f7dc2840ff19a1cc31d
1 parent
6f43024c
Document all VNC authentication options, by Daniel P. Berrange.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3140 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
351 additions
and
52 deletions
qemu-doc.texi
... | ... | @@ -129,6 +129,7 @@ Download the experimental binary installer at |
129 | 129 | * pcsys_network:: Network emulation |
130 | 130 | * direct_linux_boot:: Direct Linux Boot |
131 | 131 | * pcsys_usb:: USB emulation |
132 | +* vnc_security:: VNC security | |
132 | 133 | * gdb_usage:: GDB usage |
133 | 134 | * pcsys_os_specific:: Target OS specific information |
134 | 135 | @end menu |
... | ... | @@ -243,53 +244,6 @@ Set virtual RAM size to @var{megs} megabytes. Default is 128 MB. |
243 | 244 | Simulate an SMP system with @var{n} CPUs. On the PC target, up to 255 |
244 | 245 | CPUs are supported. |
245 | 246 | |
246 | -@item -nographic | |
247 | - | |
248 | -Normally, QEMU uses SDL to display the VGA output. With this option, | |
249 | -you can totally disable graphical output so that QEMU is a simple | |
250 | -command line application. The emulated serial port is redirected on | |
251 | -the console. Therefore, you can still use QEMU to debug a Linux kernel | |
252 | -with a serial console. | |
253 | - | |
254 | -@item -no-frame | |
255 | - | |
256 | -Do not use decorations for SDL windows and start them using the whole | |
257 | -available screen space. This makes the using QEMU in a dedicated desktop | |
258 | -workspace more convenient. | |
259 | - | |
260 | -@item -vnc display | |
261 | - | |
262 | -Normally, QEMU uses SDL to display the VGA output. With this option, | |
263 | -you can have QEMU listen on VNC display @var{display} and redirect the VGA | |
264 | -display over the VNC session. It is very useful to enable the usb | |
265 | -tablet device when using this option (option @option{-usbdevice | |
266 | -tablet}). When using the VNC display, you must use the @option{-k} | |
267 | -option to set the keyboard layout if you are not using en-us. | |
268 | - | |
269 | -@var{display} may be in the form @var{interface:d}, in which case connections | |
270 | -will only be allowed from @var{interface} on display @var{d}. Optionally, | |
271 | -@var{interface} can be omitted. @var{display} can also be in the form | |
272 | -@var{unix:path} where @var{path} is the location of a unix socket to listen for | |
273 | -connections on. | |
274 | - | |
275 | - | |
276 | -@item -k language | |
277 | - | |
278 | -Use keyboard layout @var{language} (for example @code{fr} for | |
279 | -French). This option is only needed where it is not easy to get raw PC | |
280 | -keycodes (e.g. on Macs, with some X11 servers or with a VNC | |
281 | -display). You don't normally need to use it on PC/Linux or PC/Windows | |
282 | -hosts. | |
283 | - | |
284 | -The available layouts are: | |
285 | -@example | |
286 | -ar de-ch es fo fr-ca hu ja mk no pt-br sv | |
287 | -da en-gb et fr fr-ch is lt nl pl ru th | |
288 | -de en-us fi fr-be hr it lv nl-be pt sl tr | |
289 | -@end example | |
290 | - | |
291 | -The default is @code{en-us}. | |
292 | - | |
293 | 247 | @item -audio-help |
294 | 248 | |
295 | 249 | Will show the audio subsystem help: list of drivers, tunable |
... | ... | @@ -312,9 +266,6 @@ Set the real time clock to local time (the default is to UTC |
312 | 266 | time). This option is needed to have correct date in MS-DOS or |
313 | 267 | Windows. |
314 | 268 | |
315 | -@item -full-screen | |
316 | -Start in full screen. | |
317 | - | |
318 | 269 | @item -pidfile file |
319 | 270 | Store the QEMU process PID in @var{file}. It is useful if you launch QEMU |
320 | 271 | from a script. |
... | ... | @@ -340,6 +291,117 @@ caption. The name will also be used for the VNC server. |
340 | 291 | |
341 | 292 | @end table |
342 | 293 | |
294 | +Display options: | |
295 | +@table @option | |
296 | + | |
297 | +@item -nographic | |
298 | + | |
299 | +Normally, QEMU uses SDL to display the VGA output. With this option, | |
300 | +you can totally disable graphical output so that QEMU is a simple | |
301 | +command line application. The emulated serial port is redirected on | |
302 | +the console. Therefore, you can still use QEMU to debug a Linux kernel | |
303 | +with a serial console. | |
304 | + | |
305 | +@item -no-frame | |
306 | + | |
307 | +Do not use decorations for SDL windows and start them using the whole | |
308 | +available screen space. This makes the using QEMU in a dedicated desktop | |
309 | +workspace more convenient. | |
310 | + | |
311 | +@item -full-screen | |
312 | +Start in full screen. | |
313 | + | |
314 | +@item -vnc display[,option[,option[,...]]] | |
315 | + | |
316 | +Normally, QEMU uses SDL to display the VGA output. With this option, | |
317 | +you can have QEMU listen on VNC display @var{display} and redirect the VGA | |
318 | +display over the VNC session. It is very useful to enable the usb | |
319 | +tablet device when using this option (option @option{-usbdevice | |
320 | +tablet}). When using the VNC display, you must use the @option{-k} | |
321 | +parameter to set the keyboard layout if you are not using en-us. Valid | |
322 | +syntax for the @var{display} is | |
323 | + | |
324 | +@table @code | |
325 | + | |
326 | +@item @var{interface:d} | |
327 | + | |
328 | +TCP connections will only be allowed from @var{interface} on display @var{d}. | |
329 | +By convention the TCP port is 5900+@var{d}. Optionally, @var{interface} can | |
330 | +be omitted in which case the server will bind to all interfaces. | |
331 | + | |
332 | +@item @var{unix:path} | |
333 | + | |
334 | +Connections will be allowed over UNIX domain sockets where @var{path} is the | |
335 | +location of a unix socket to listen for connections on. | |
336 | + | |
337 | +@item @var{none} | |
338 | + | |
339 | +VNC is initialized by not started. The monitor @code{change} command can be used | |
340 | +to later start the VNC server. | |
341 | + | |
342 | +@end table | |
343 | + | |
344 | +Following the @var{display} value there may be one or more @var{option} flags | |
345 | +separated by commas. Valid options are | |
346 | + | |
347 | +@table @code | |
348 | + | |
349 | +@item @var{password} | |
350 | + | |
351 | +Require that password based authentication is used for client connections. | |
352 | +The password must be set separately using the @code{change} command in the | |
353 | +@ref{pcsys_monitor} | |
354 | + | |
355 | +@item @var{tls} | |
356 | + | |
357 | +Require that client use TLS when communicating with the VNC server. This | |
358 | +uses anonymous TLS credentials so is susceptible to a man-in-the-middle | |
359 | +attack. It is recommended that this option be combined with either the | |
360 | +@var{x509} or @var{x509verify} options. | |
361 | + | |
362 | +@item @var{x509=/path/to/certificate/dir} | |
363 | + | |
364 | +Valid if @var{tls} is specified. Require that x509 credentials are used | |
365 | +for negotiating the TLS session. The server will send its x509 certificate | |
366 | +to the client. It is recommended that a password be set on the VNC server | |
367 | +to provide authentication of the client when this is used. The path following | |
368 | +this option specifies where the x509 certificates are to be loaded from. | |
369 | +See the @ref{vnc_security} section for details on generating certificates. | |
370 | + | |
371 | +@item @var{x509verify=/path/to/certificate/dir} | |
372 | + | |
373 | +Valid if @var{tls} is specified. Require that x509 credentials are used | |
374 | +for negotiating the TLS session. The server will send its x509 certificate | |
375 | +to the client, and request that the client send its own x509 certificate. | |
376 | +The server will validate the client's certificate against the CA certificate, | |
377 | +and reject clients when validation fails. If the certificate authority is | |
378 | +trusted, this is a sufficient authentication mechanism. You may still wish | |
379 | +to set a password on the VNC server as a second authentication layer. The | |
380 | +path following this option specifies where the x509 certificates are to | |
381 | +be loaded from. See the @ref{vnc_security} section for details on generating | |
382 | +certificates. | |
383 | + | |
384 | +@end table | |
385 | + | |
386 | +@item -k language | |
387 | + | |
388 | +Use keyboard layout @var{language} (for example @code{fr} for | |
389 | +French). This option is only needed where it is not easy to get raw PC | |
390 | +keycodes (e.g. on Macs, with some X11 servers or with a VNC | |
391 | +display). You don't normally need to use it on PC/Linux or PC/Windows | |
392 | +hosts. | |
393 | + | |
394 | +The available layouts are: | |
395 | +@example | |
396 | +ar de-ch es fo fr-ca hu ja mk no pt-br sv | |
397 | +da en-gb et fr fr-ch is lt nl pl ru th | |
398 | +de en-us fi fr-be hr it lv nl-be pt sl tr | |
399 | +@end example | |
400 | + | |
401 | +The default is @code{en-us}. | |
402 | + | |
403 | +@end table | |
404 | + | |
343 | 405 | USB options: |
344 | 406 | @table @option |
345 | 407 | |
... | ... | @@ -862,8 +924,38 @@ Quit the emulator. |
862 | 924 | @item eject [-f] device |
863 | 925 | Eject a removable medium (use -f to force it). |
864 | 926 | |
865 | -@item change device filename | |
866 | -Change a removable medium. | |
927 | +@item change device setting | |
928 | + | |
929 | +Change the configuration of a device | |
930 | + | |
931 | +@table @option | |
932 | +@item change @var{diskdevice} @var{filename} | |
933 | +Change the medium for a removable disk device to point to @var{filename}. eg | |
934 | + | |
935 | +@example | |
936 | +(qemu) change cdrom /path/to/some.iso | |
937 | +@end example | |
938 | + | |
939 | +@item change vnc @var{display,options} | |
940 | +Change the configuration of the VNC server. The valid syntax for @var{display} | |
941 | +and @var{options} are described at @ref{sec_invocation}. eg | |
942 | + | |
943 | +@example | |
944 | +(qemu) change vnc localhost:1 | |
945 | +@end example | |
946 | + | |
947 | +@item change vnc password | |
948 | + | |
949 | +Change the password associated with the VNC server. The monitor will prompt for | |
950 | +the new password to be entered. VNC passwords are only significant upto 8 letters. | |
951 | +eg. | |
952 | + | |
953 | +@example | |
954 | +(qemu) change vnc password | |
955 | +Password: ******** | |
956 | +@end example | |
957 | + | |
958 | +@end table | |
867 | 959 | |
868 | 960 | @item screendump filename |
869 | 961 | Save screen into PPM image @var{filename}. |
... | ... | @@ -1421,6 +1513,213 @@ plugged. You can use the option @option{-usbdevice} to do the same. |
1421 | 1513 | When relaunching QEMU, you may have to unplug and plug again the USB |
1422 | 1514 | device to make it work again (this is a bug). |
1423 | 1515 | |
1516 | +@node vnc_security | |
1517 | +@section VNC security | |
1518 | + | |
1519 | +The VNC server capability provides access to the graphical console | |
1520 | +of the guest VM across the network. This has a number of security | |
1521 | +considerations depending on the deployment scenarios. | |
1522 | + | |
1523 | +@menu | |
1524 | +* vnc_sec_none:: | |
1525 | +* vnc_sec_password:: | |
1526 | +* vnc_sec_certificate:: | |
1527 | +* vnc_sec_certificate_verify:: | |
1528 | +* vnc_sec_certificate_pw:: | |
1529 | +* vnc_generate_cert:: | |
1530 | +@end menu | |
1531 | +@node vnc_sec_none | |
1532 | +@subsection Without passwords | |
1533 | + | |
1534 | +The simplest VNC server setup does not include any form of authentication. | |
1535 | +For this setup it is recommended to restrict it to listen on a UNIX domain | |
1536 | +socket only. For example | |
1537 | + | |
1538 | +@example | |
1539 | +qemu [...OPTIONS...] -vnc unix:/home/joebloggs/.qemu-myvm-vnc | |
1540 | +@end example | |
1541 | + | |
1542 | +This ensures that only users on local box with read/write access to that | |
1543 | +path can access the VNC server. To securely access the VNC server from a | |
1544 | +remote machine, a combination of netcat+ssh can be used to provide a secure | |
1545 | +tunnel. | |
1546 | + | |
1547 | +@node vnc_sec_password | |
1548 | +@subsection With passwords | |
1549 | + | |
1550 | +The VNC protocol has limited support for password based authentication. Since | |
1551 | +the protocol limits passwords to 8 characters it should not be considered | |
1552 | +to provide high security. The password can be fairly easily brute-forced by | |
1553 | +a client making repeat connections. For this reason, a VNC server using password | |
1554 | +authentication should be restricted to only listen on the loopback interface | |
1555 | +or UNIX domain sockets. Password ayuthentication is requested with the @code{password} | |
1556 | +option, and then once QEMU is running the password is set with the monitor. Until | |
1557 | +the monitor is used to set the password all clients will be rejected. | |
1558 | + | |
1559 | +@example | |
1560 | +qemu [...OPTIONS...] -vnc :1,password -monitor stdio | |
1561 | +(qemu) change vnc password | |
1562 | +Password: ******** | |
1563 | +(qemu) | |
1564 | +@end example | |
1565 | + | |
1566 | +@node vnc_sec_certificate | |
1567 | +@subsection With x509 certificates | |
1568 | + | |
1569 | +The QEMU VNC server also implements the VeNCrypt extension allowing use of | |
1570 | +TLS for encryption of the session, and x509 certificates for authentication. | |
1571 | +The use of x509 certificates is strongly recommended, because TLS on its | |
1572 | +own is susceptible to man-in-the-middle attacks. Basic x509 certificate | |
1573 | +support provides a secure session, but no authentication. This allows any | |
1574 | +client to connect, and provides an encrypted session. | |
1575 | + | |
1576 | +@example | |
1577 | +qemu [...OPTIONS...] -vnc :1,tls,x509=/etc/pki/qemu -monitor stdio | |
1578 | +@end example | |
1579 | + | |
1580 | +In the above example @code{/etc/pki/qemu} should contain at least three files, | |
1581 | +@code{ca-cert.pem}, @code{server-cert.pem} and @code{server-key.pem}. Unprivileged | |
1582 | +users will want to use a private directory, for example @code{$HOME/.pki/qemu}. | |
1583 | +NB the @code{server-key.pem} file should be protected with file mode 0600 to | |
1584 | +only be readable by the user owning it. | |
1585 | + | |
1586 | +@node vnc_sec_certificate_verify | |
1587 | +@subsection With x509 certificates and client verification | |
1588 | + | |
1589 | +Certificates can also provide a means to authenticate the client connecting. | |
1590 | +The server will request that the client provide a certificate, which it will | |
1591 | +then validate against the CA certificate. This is a good choice if deploying | |
1592 | +in an environment with a private internal certificate authority. | |
1593 | + | |
1594 | +@example | |
1595 | +qemu [...OPTIONS...] -vnc :1,tls,x509verify=/etc/pki/qemu -monitor stdio | |
1596 | +@end example | |
1597 | + | |
1598 | + | |
1599 | +@node vnc_sec_certificate_pw | |
1600 | +@subsection With x509 certificates, client verification and passwords | |
1601 | + | |
1602 | +Finally, the previous method can be combined with VNC password authentication | |
1603 | +to provide two layers of authentication for clients. | |
1604 | + | |
1605 | +@example | |
1606 | +qemu [...OPTIONS...] -vnc :1,password,tls,x509verify=/etc/pki/qemu -monitor stdio | |
1607 | +(qemu) change vnc password | |
1608 | +Password: ******** | |
1609 | +(qemu) | |
1610 | +@end example | |
1611 | + | |
1612 | +@node vnc_generate_cert | |
1613 | +@subsection Generating certificates for VNC | |
1614 | + | |
1615 | +The GNU TLS packages provides a command called @code{certtool} which can | |
1616 | +be used to generate certificates and keys in PEM format. At a minimum it | |
1617 | +is neccessary to setup a certificate authority, and issue certificates to | |
1618 | +each server. If using certificates for authentication, then each client | |
1619 | +will also need to be issued a certificate. The recommendation is for the | |
1620 | +server to keep its certificates in either @code{/etc/pki/qemu} or for | |
1621 | +unprivileged users in @code{$HOME/.pki/qemu}. | |
1622 | + | |
1623 | +@menu | |
1624 | +* vnc_generate_ca:: | |
1625 | +* vnc_generate_server:: | |
1626 | +* vnc_generate_client:: | |
1627 | +@end menu | |
1628 | +@node vnc_generate_ca | |
1629 | +@subsubsection Setup the Certificate Authority | |
1630 | + | |
1631 | +This step only needs to be performed once per organization / organizational | |
1632 | +unit. First the CA needs a private key. This key must be kept VERY secret | |
1633 | +and secure. If this key is compromised the entire trust chain of the certificates | |
1634 | +issued with it is lost. | |
1635 | + | |
1636 | +@example | |
1637 | +# certtool --generate-privkey > ca-key.pem | |
1638 | +@end example | |
1639 | + | |
1640 | +A CA needs to have a public certificate. For simplicity it can be a self-signed | |
1641 | +certificate, or one issue by a commercial certificate issuing authority. To | |
1642 | +generate a self-signed certificate requires one core piece of information, the | |
1643 | +name of the organization. | |
1644 | + | |
1645 | +@example | |
1646 | +# cat > ca.info <<EOF | |
1647 | +cn = Name of your organization | |
1648 | +ca | |
1649 | +cert_signing_key | |
1650 | +EOF | |
1651 | +# certtool --generate-self-signed \ | |
1652 | + --load-privkey ca-key.pem | |
1653 | + --template ca.info \ | |
1654 | + --outfile ca-cert.pem | |
1655 | +@end example | |
1656 | + | |
1657 | +The @code{ca-cert.pem} file should be copied to all servers and clients wishing to utilize | |
1658 | +TLS support in the VNC server. The @code{ca-key.pem} must not be disclosed/copied at all. | |
1659 | + | |
1660 | +@node vnc_generate_server | |
1661 | +@subsubsection Issuing server certificates | |
1662 | + | |
1663 | +Each server (or host) needs to be issued with a key and certificate. When connecting | |
1664 | +the certificate is sent to the client which validates it against the CA certificate. | |
1665 | +The core piece of information for a server certificate is the hostname. This should | |
1666 | +be the fully qualified hostname that the client will connect with, since the client | |
1667 | +will typically also verify the hostname in the certificate. On the host holding the | |
1668 | +secure CA private key: | |
1669 | + | |
1670 | +@example | |
1671 | +# cat > server.info <<EOF | |
1672 | +organization = Name of your organization | |
1673 | +cn = server.foo.example.com | |
1674 | +tls_www_server | |
1675 | +encryption_key | |
1676 | +signing_key | |
1677 | +EOF | |
1678 | +# certtool --generate-privkey > server-key.pem | |
1679 | +# certtool --generate-certificate \ | |
1680 | + --load-ca-certificate ca-cert.pem \ | |
1681 | + --load-ca-privkey ca-key.pem \ | |
1682 | + --load-privkey server server-key.pem \ | |
1683 | + --template server.info \ | |
1684 | + --outfile server-cert.pem | |
1685 | +@end example | |
1686 | + | |
1687 | +The @code{server-key.pem} and @code{server-cert.pem} files should now be securely copied | |
1688 | +to the server for which they were generated. The @code{server-key.pem} is security | |
1689 | +sensitive and should be kept protected with file mode 0600 to prevent disclosure. | |
1690 | + | |
1691 | +@node vnc_generate_client | |
1692 | +@subsubsection Issuing client certificates | |
1693 | + | |
1694 | +If the QEMU VNC server is to use the @code{x509verify} option to validate client | |
1695 | +certificates as its authentication mechanism, each client also needs to be issued | |
1696 | +a certificate. The client certificate contains enough metadata to uniquely identify | |
1697 | +the client, typically organization, state, city, building, etc. On the host holding | |
1698 | +the secure CA private key: | |
1699 | + | |
1700 | +@example | |
1701 | +# cat > client.info <<EOF | |
1702 | +country = GB | |
1703 | +state = London | |
1704 | +locality = London | |
1705 | +organiazation = Name of your organization | |
1706 | +cn = client.foo.example.com | |
1707 | +tls_www_client | |
1708 | +encryption_key | |
1709 | +signing_key | |
1710 | +EOF | |
1711 | +# certtool --generate-privkey > client-key.pem | |
1712 | +# certtool --generate-certificate \ | |
1713 | + --load-ca-certificate ca-cert.pem \ | |
1714 | + --load-ca-privkey ca-key.pem \ | |
1715 | + --load-privkey client-key.pem \ | |
1716 | + --template client.info \ | |
1717 | + --outfile client-cert.pem | |
1718 | +@end example | |
1719 | + | |
1720 | +The @code{client-key.pem} and @code{client-cert.pem} files should now be securely | |
1721 | +copied to the client for which they were generated. | |
1722 | + | |
1424 | 1723 | @node gdb_usage |
1425 | 1724 | @section GDB usage |
1426 | 1725 | ... | ... |