source: trunk/packages/xen-common/xen-common/docs/man/xm.pod.1 @ 95

Last change on this file since 95 was 34, checked in by hartmans, 17 years ago

Add xen and xen-common

File size: 32.6 KB
Line 
1=head1 NAME
2
3xm - Xen management user interface
4
5=head1 SYNOPSIS
6
7xm <subcommand> [args]
8
9=head1 DESCRIPTION
10
11The B<xm> program is the main interface for managing Xen guest
12domains. The program can be used to create, pause, and shutdown
13domains. It can also be used to list current domains, enable or pin
14VCPUs, and attach or detach virtual block devices.
15
16The basic structure of every xm command is almost always:
17
18  xm <subcommand> <domain-id> [OPTIONS]
19
20Where I<subcommand> is one of the sub commands listed below, I<domain-id>
21is the numeric domain id, or the domain name (which will be internally
22translated to domain id), and I<OPTIONS> are sub command specific
23options.  There are a few exceptions to this rule in the cases where
24the sub command in question acts on all domains, the entire machine,
25or directly on the xen hypervisor.  Those exceptions will be clear for
26each of those sub commands.
27
28=head1 NOTES
29
30All B<xm> operations rely upon the Xen control daemon, aka B<xend>.
31For any xm commands to run xend must also be running.  For this reason
32you should start xend as a service when your system first boots using
33xen.
34
35Most B<xm> commands require root privileges to run due to the
36communications channels used to talk to the hypervisor.  Running as
37non root will return an error.
38
39Most B<xm> commands act asynchronously, so just because the B<xm>
40command returned, doesn't mean the action is complete.  This is
41important, as many operations on domains, like create and shutdown,
42can take considerable time (30 seconds or more) to bring the machine
43into a fully compliant state.  If you want to know when one of these
44actions has finished you must poll through xm list periodically.
45
46=head1 DOMAIN SUBCOMMANDS
47
48The following sub commands manipulate domains directly, as stated
49previously most commands take domain-id as the first parameter.
50
51=over 4
52
53=item B<console> I<domain-id>
54
55Attach to domain domain-id's console.  If you've set up your Domains to
56have a traditional log in console this will look much like a normal
57text log in screen.
58
59This uses the back end xenconsole service which currently only
60works for para-virtual domains. 
61
62The attached console will perform much like a standard serial console,
63so running curses based interfaces over the console B<is not
64advised>.  Vi tends to get very odd when using it over this interface.
65
66=item B<create> I<[-c]> I<configfile> I<[name=value]>..
67
68The create sub command requires a configfile and can optional take a
69series of name value pairs that add to or override variables defined
70in the config file.  See L<xmdomain.cfg> for full details of that file
71format, and possible options used in either the configfile or
72Name=Value combinations.
73
74Configfile can either be an absolute path to a file, or a relative
75path to a file located in /etc/xen.
76
77Create will return B<as soon> as the domain is started.  This B<does
78not> mean the guest OS in the domain has actually booted, or is
79available for input.
80
81B<OPTIONS>
82
83=over 4
84
85=item B<-c>
86
87Attache console to the domain as soon as it has started.  This is
88useful for determining issues with crashing domains.
89
90=back
91
92B<EXAMPLES>
93
94=over 4
95
96=item I<with config file>
97
98  xm create Fedora4
99
100This creates a domain with the file /etc/xen/Fedora4, and returns as
101soon as it is run.
102
103=item I<without config file>
104 
105  xm create /dev/null ramdisk=initrd.img \
106     kernel=/boot/vmlinuz-2.6.12.6-xenU \
107     name=ramdisk nics=0 vcpus=1 \
108     memory=64 root=/dev/ram0
109
110This creates the domain without using a config file (more specifically
111using /dev/null as an empty config file), kernel and ramdisk as
112specified, setting the name of the domain to "ramdisk", also disabling
113virtual networking.  (This example comes from the xm-test test suite.)
114
115=back
116
117=item B<destroy> I<domain-id>
118
119Immediately terminate the domain domain-id.  This doesn't give the domain
120OS any chance to react, and it the equivalent of ripping the power
121cord out on a physical machine.  In most cases you will want to use
122the B<shutdown> command instead.
123
124=item B<domid> I<domain-name>
125
126Converts a domain name to a domain id using xend's internal mapping.
127
128=item B<domname> I<domain-id>
129
130Converts a domain id to a domain name using xend's internal mapping.
131
132=item B<help> I<[--long]>
133
134Displays the short help message (i.e. common commands).
135
136The I<--long> option prints out the complete set of B<xm> subcommands,
137grouped by function.
138
139=item B<list> I<[--long | --label]> I<[domain-id, ...]>
140
141Prints information about one or more domains.  If no domains are
142specified it prints out information about all domains.
143
144An example format for the list is as follows:
145
146    Name                         ID Mem(MiB) VCPUs State  Time(s)
147    Domain-0                      0       98     1 r-----  5068.6
148    Fedora3                     164      128     1 r-----     7.6
149    Fedora4                     165      128     1 ------     0.6
150    Mandrake2006                166      128     1 -b----     3.6
151    Mandrake10.2                167      128     1 ------     2.5
152    Suse9.2                     168      100     1 ------     1.8
153
154Name is the name of the domain.  ID the domain numeric id.  Mem is the
155size of the memory allocated to the domain.  VCPUS is the number of
156VCPUS allocated to domain.  State is the run state (see below).  Time
157is the total run time of the domain as accounted for by Xen.
158
159B<STATES>
160
161=over 4
162
163The State field lists 6 states for a Xen Domain, and which ones the
164current Domain is in.
165
166=item B<r - running>
167
168The domain is currently running on a CPU
169
170=item B<b - blocked>
171
172The domain is blocked, and not running or runnable.  This can be caused
173because the domain is waiting on IO (a traditional wait state) or has
174gone to sleep because there was nothing else for it to do.
175
176=item B<p - paused>
177
178The domain has been paused, usually occurring through the administrator
179running B<xm pause>.  When in a paused state the domain will still
180consume allocated resources like memory, but will not be eligible for
181scheduling by the Xen hypervisor.
182
183=item B<s - shutdown>
184
185FIXME: Why would you ever see this state?
186
187=item B<c - crashed>
188
189The domain has crashed, which is always a violent ending.  Usually
190this state can only occur if the domain has been configured not to
191restart on crash.  See L<xmdomain.cfg> for more info.
192
193=item B<d - dying>
194
195The domain is in process of dying, but hasn't completely shutdown or
196crashed.
197
198FIXME: Is this right?
199
200=back
201
202B<LONG OUTPUT>
203
204=over 4
205
206If I<--long> is specified, the output for xm list is not the table
207view shown above, but instead is an S-Expression representing all
208information known about all domains asked for.  This is mostly only
209useful for external programs to parse the data.
210
211B<Note:> there is no stable guarantees on the format of this data.
212Use at your own risk.
213
214=back
215
216B<LABEL OUTPUT>
217
218=over 4
219
220If I<--label> is specified, the security labels are added to the
221output of xm list and the lines are sorted by the labels (ignoring
222case). The I<--long> option prints the labels by default and cannot be
223combined with I<--label>. See the ACCESS CONTROL SUBCOMMAND section of
224this man page for more information about labels.
225
226==back
227
228B<NOTES>
229
230=over 4
231
232The Time column is deceptive.  Virtual IO (network and block devices)
233used by Domains requires coordination by Domain0, which means that
234Domain0 is actually charged for much of the time that a DomainU is
235doing IO.  Use of this time value to determine relative utilizations
236by domains is thus very suspect, as a high IO workload may show as
237less utilized than a high CPU workload.  Consider yourself warned.
238
239=back
240
241=item B<mem-max> I<domain-id> I<mem>
242
243Specify the maximum amount of memory the Domain is able to use.  Mem
244is specified in megabytes.
245
246The mem-max value may not correspond to the actual memory used in the
247Domain, as it may balloon down it's memory to give more back to the OS.
248
249=item B<mem-set> I<domain-id> I<mem>
250
251Set the domain's used memory using the balloon driver.  Because this
252operation requires cooperation from the domain operating system, there
253is no guarantee that it will succeed.
254
255B<Warning:> there is no good way to know in advance how small of a
256mem-set will make a domain unstable and cause it to crash.  Be very
257careful when using this command on running domains.
258
259=item B<migrate> I<domain-id> I<host> I<[options]>
260
261Migrate a domain to another Host machine. B<Xend> must be running on
262other host machine, it must be running the same version of xen, it
263must have the migration TCP port open and accepting connections from
264the source host, and there must be sufficient resources for the domain
265to run (memory, disk, etc).
266
267Migration is pretty complicated, and has many security implications,
268please read the Xen Users Guide to ensure you understand the
269ramifications and limitations on migration before attempting it in
270production.
271
272B<OPTIONS>
273
274=over 4
275
276=item B<-l, --live>
277
278Use live migration.  This will migrate the domain between hosts
279without shutting down the domain.  See the Xen Users Guide for more
280information.
281
282=item B<-r, --resource> I<Mbs>
283
284Set maximum Mbs allowed for migrating the domain.  This ensures that
285the network link is not saturated with migration traffic while
286attempting to do other useful work.
287
288=back
289
290=item B<pause> I<domain-id>
291
292Pause a domain.  When in a paused state the domain will still consume
293allocated resources such as memory, but will not be eligible for
294scheduling by the Xen hypervisor.
295
296=item B<reboot> I<[options]> I<domain-id>
297
298Reboot a domain.  This acts just as if the domain had the B<reboot>
299command run from the console.  The command returns as soon as it has
300executed the reboot action, which may be significantly before the
301domain actually reboots.
302
303The behavior of what happens to a domain when it reboots is set by the
304I<on_reboot> parameter of the xmdomain.cfg file when the domain was
305created.
306
307B<OPTIONS>
308
309=over 4
310
311=item B<-a, --all>
312
313Reboot all domains
314
315=item B<-w, --wait>
316
317Wait for reboot to complete before returning.  This may take a while,
318as all services in the domain will have to be shut down cleanly.
319
320=back
321
322=item B<restore> I<state-file>
323
324Build a domain from an B<xm save> state file.  See I<save> for more info.
325
326=item B<save> I<domain-id> I<state-file>
327
328Saves a running domain to a state file so that it can be restored
329later.  Once saved, the domain will no longer be running on the
330system, thus the memory allocated for the domain will be free for
331other domains to use.  B<xm restore> restores from this state file.
332
333This is roughly equivalent to doing a hibernate on a running computer,
334with all the same limitations.  Open network connections may be
335severed upon restore, as TCP timeouts may have expired.
336
337=item B<shutdown> I<[options]> I<domain-id>
338
339Gracefully shuts down a domain.  This coordinates with the domain OS
340to perform graceful shutdown, so there is no guarantee that it will
341succeed, and may take a variable length of time depending on what
342services must be shutdown in the domain.  The command returns
343immediately after signally the domain unless that I<-w> flag is used.
344
345The behavior of what happens to a domain when it reboots is set by the
346I<on_shutdown> parameter of the xmdomain.cfg file when the domain was
347created.
348
349B<OPTIONS>
350
351=over 4
352
353=item B<-a>
354
355Shutdown B<all> domains.  Often used when doing a complete shutdown of
356a Xen system.
357
358=item B<-w>
359
360Wait for the domain to complete shutdown before returning.
361
362=back
363
364=item B<sysrq> I<domain-id> I<letter>
365
366Send a I<Magic System Request> signal to the domain.  For more
367information on available magic sys req operations, see sysrq.txt in
368your Linux Kernel sources.
369
370=item B<unpause> I<domain-id>
371
372Moves a domain out of the paused state.  This will allow a previously
373paused domain to now be eligible for scheduling by the Xen hypervisor.
374
375=item B<vcpu-set> I<domain-id> I<vcpu-count>
376
377Enables the I<vcpu-count> virtual CPUs for the domain in question.
378Like mem-set, this command can only allocate up to the maximum virtual
379CPU count configured at boot for the domain.
380
381If the I<vcpu-count> is smaller than the current number of active
382VCPUs, the highest number VCPUs will be hotplug removed.  This may be
383important for pinning purposes.
384
385Attempting to set the VCPUs to a number larger than the initially
386configured VCPU count is an error.  Trying to set VCPUs to < 1 will be
387quietly ignored.
388
389=item B<vcpu-list> I<[domain-id]>
390
391Lists VCPU information for a specific domain.  If no domain is
392specified, VCPU information for all domains will be provided.
393
394=item B<vcpu-pin> I<domain-id> I<vcpu> I<cpus>
395
396Pins the the VCPU to only run on the specific CPUs.  The keyword
397I<all> can be used to apply the I<cpus> list to all VCPUs in the
398domain.
399
400Normally VCPUs can float between available CPUs whenever Xen deems a
401different run state is appropriate.  Pinning can be used to restrict
402this, by ensuring certain VCPUs can only run on certain physical
403CPUs.
404
405=back
406
407=head1 XEN HOST SUBCOMMANDS
408
409=over 4
410
411=item B<dmesg> I<[-c]>
412
413Reads the Xen message buffer, similar to dmesg on a Linux system.  The
414buffer contains informational, warning, and error messages created
415during Xen's boot process.  If you are having problems with Xen, this
416is one of the first places to look as part of problem determination.
417
418B<OPTIONS>
419
420=over 4
421
422=item B<-c, --clear>
423
424Clears Xen's message buffer.
425
426=back
427
428=item B<info>
429
430Print information about the Xen host in I<name : value> format.  When
431reporting a Xen bug, please provide this information as part of the
432bug report.
433
434Sample xen domain info looks as follows (lines wrapped manually to
435make the man page more readable):
436
437 host                   : talon
438 release                : 2.6.12.6-xen0
439 version                : #1 Mon Nov 14 14:26:26 EST 2005
440 machine                : i686
441 nr_cpus                : 2
442 nr_nodes               : 1
443 sockets_per_node       : 2
444 cores_per_socket       : 1
445 threads_per_core       : 1
446 cpu_mhz                : 696
447 hw_caps                : 0383fbff:00000000:00000000:00000040
448 total_memory           : 767
449 free_memory            : 37
450 xen_major              : 3
451 xen_minor              : 0
452 xen_extra              : -devel
453 xen_caps               : xen-3.0-x86_32
454 xen_scheduler          : credit
455 xen_pagesize           : 4096
456 platform_params        : virt_start=0xfc000000
457 xen_changeset          : Mon Nov 14 18:13:38 2005 +0100
458                          7793:090e44133d40
459 cc_compiler            : gcc version 3.4.3 (Mandrakelinux
460                          10.2 3.4.3-7mdk)
461 cc_compile_by          : sdague
462 cc_compile_domain      : (none)
463 cc_compile_date        : Mon Nov 14 14:16:48 EST 2005
464 xend_config_format     : 3
465
466B<FIELDS>
467
468=over 4
469
470Not all fields will be explained here, but some of the less obvious
471ones deserve explanation:
472
473=item I<hw_caps>
474
475A vector showing what hardware capabilities are supported by your
476processor.  This is equivalent to, though more cryptic, the flags
477field in /proc/cpuinfo on a normal Linux machine.
478
479=item I<free_memory>
480
481Available memory (in MB) not allocated to Xen, or any other Domains.
482
483=item I<xen_caps>
484
485The xen version, architecture.  Architecture values can be one of:
486x86_32, x86_32p (i.e. PAE enabled), x86_64, ia64.
487
488=item I<xen_changeset>
489
490The xen mercurial changeset id.  Very useful for determining exactly
491what version of code your Xen system was built from.
492
493=back
494
495=item B<log>
496
497Print out the B<xend> log.  This log file can be found in
498/var/log/xend.log.
499
500=item B<top>
501
502Executes the xentop command, which provides real time monitoring of
503domains.  Xentop is a curses interface, and reasonably self
504explanatory.
505
506=back
507
508=head1 SCHEDULER SUBCOMMANDS
509
510Xen ships with a number of domain schedulers, which can be set at boot
511time with the I<sched=> parameter on the Xen command line.  By
512default I<sedf> is used for scheduling.
513
514FIXME: we really need a scheduler expert to write up this section.
515
516=over 4
517
518=item B<sched-sedf> I<period> I<slice> I<latency-hint> I<extratime> I<weight>
519
520Set Simple EDF (Earliest Deadline First) scheduler parameters.  This
521scheduler provides weighted CPU sharing in an intuitive way and uses
522realtime-algorithms to ensure time guarantees.  For more information
523see docs/misc/sedf_scheduler_mini-HOWTO.txt in the Xen distribution.
524
525B<PARAMETERS>
526
527=over 4
528
529=item I<period>
530
531The normal EDF scheduling usage in nanoseconds
532
533=item I<slice>
534
535The normal EDF scheduling usage in nanoseconds
536
537FIXME: these are lame, should explain more.
538
539=item I<latency-hint>
540
541Scaled period if domain is doing heavy I/O.
542
543=item I<extratime>
544
545Flag for allowing domain to run in extra time.
546
547=item I<weight>
548
549Another way of setting cpu slice.
550
551=back
552
553B<EXAMPLES>
554
555I<normal EDF (20ms/5ms):>
556
557    xm sched-sedf <dom-id> 20000000 5000000 0 0 0
558
559I<best-effort domains (i.e. non-realtime):>
560
561    xm sched-sedf <dom-id> 20000000 0 0 1 0
562
563I<normal EDF (20ms/5ms) + share of extra-time:>
564
565    xm sched-sedf <dom-id> 20000000 5000000 0 1 0
566
567I<4 domains with weights 2:3:4:2>
568
569    xm sched-sedf <d1> 0 0 0 0 2
570    xm sched-sedf <d2> 0 0 0 0 3
571    xm sched-sedf <d3> 0 0 0 0 4
572    xm sched-sedf <d4> 0 0 0 0 2
573 
574I<1 fully-specified (10ms/3ms) domain, 3 other domains share available
575rest in 2:7:3 ratio:>
576
577    xm sched-sedf <d1> 10000000 3000000 0 0 0
578    xm sched-sedf <d2> 0 0 0 0 2
579    xm sched-sedf <d3> 0 0 0 0 7
580    xm sched-sedf <d4> 0 0 0 0 3
581
582=back
583
584=head1 VIRTUAL DEVICE COMMANDS
585
586Most virtual devices can be added and removed while guests are
587running.  The effect to the guest OS is much the same as any hotplug
588event.
589
590=head2 BLOCK DEVICES
591
592=over 4
593
594=item B<block-attach> I<domain-id> I<be-dev> I<fe-dev> I<mode> I<[bedomain-id]>
595
596Create a new virtual block device.  This will trigger a hotplug event
597for the guest.
598
599B<OPTIONS>
600
601=over 4
602
603=item I<domain-id>
604
605The domain id of the guest domain that the device will be attached to.
606
607=item I<be-dev>
608
609The device in the backend domain (usually domain 0) to be exported.
610This can be specified as a physical partition (phy:sda7) or as a file
611mounted as loopback (file://path/to/loop.iso).
612
613=item I<fe-dev>
614
615How the device should be presented to the guest domain.  It can be
616specified as either a symbolic name, such as /dev/hdc, for common
617devices, or by device id, such as 0x1400 (/dev/hdc device id in hex).
618
619=item I<mode>
620
621The access mode for the device from the guest domain.  Supported modes
622are I<w> (read/write) or I<r> (read-only).
623
624=item I<bedomain-id>
625
626The back end domain hosting the device.  This defaults to domain 0.
627
628=back
629
630B<EXAMPLES>
631
632=over 4
633
634=item I<Mount an ISO as a Disk>
635
636xm block-attach guestdomain file://path/to/dsl-2.0RC2.iso /dev/hdc ro
637
638This will mount the dsl iso as /dev/hdc in the guestdomain as a read
639only device.  This will probably not be detected as a cdrom by the
640guest, but mounting /dev/hdc manually will work.
641
642=back
643
644=item B<block-detach> I<domain-id> I<devid>
645
646Destroy a domain's virtual block device. devid B<must> be the device
647id given to the device by domain 0.  You will need to run I<xm
648block-list> to determine that number.
649
650FIXME: this is currently B<broken>.  Even though a block device is
651removed from domU, it appears to still be allocated in the domain 0.
652
653=item B<block-list> I<[-l|--long]> I<domain-id>
654
655List virtual block devices for a domain.  The returned output is
656formatted as a list or as an S-Expression if the '--long' option was given.
657
658=head2 NETWORK DEVICES
659
660=item B<network-attach> I<domain-id> I<[script=scriptname]> I<[ip=ipaddr]>
661I<[mac=macaddr]> I<[bridge=bridge-name]> I<[backend=bedomain-id]>
662
663Creates a new network device in the domain specified by domain-id.  It
664takes the following optional options:
665
666B<OPTIONS>
667
668=over 4
669
670=item I<script=scriptname>
671
672Use the specified script name to bring up the network.  Defaults to
673the default setting in xend-config.sxp for I<vif-script>.
674
675=item I<ip=ipaddr>
676
677Passes the specified IP Address to the adapter on creation. 
678
679FIXME: this currently appears to be B<broken>.  I'm not sure under what
680circumstances this should actually work.
681
682=item I<mac=macaddr>
683
684The MAC address that the domain will see on its Ethernet device.  If
685the device is not specified it will be randomly generated with the
68600:16:3e vendor id prefix.
687
688=item I<bridge=bridge-name>
689
690The name of the bridge to attach the vif to, in case you have more
691than one.  This defaults to
692
693=item I<backend=bedomain-id>
694
695The backend domain id.  By default this is domain 0.
696
697=back
698
699=item B<network-detach> I<domain-id> I<devid>
700
701Removes the network device from the domain specified by I<domain-id>.
702I<devid> is the virtual interface device number within the domain
703(i.e. the 3 in vif22.3).
704
705FIXME: this is currently B<broken>.  Network devices aren't completely
706removed from domain 0.
707
708=item B<network-list> I<[-l|--long]> I<domain-id>
709
710List virtual network interfaces for a domain.  The returned output is
711formatted as a list or as an S-Expression if the '--long' option was given.
712
713=head2 VIRTUAL TPM DEVICES
714
715=item B<vtpm-list> I<[-l|--long]> I<domain-id>
716
717Show the virtual TPM device for a domain.  The returned output is
718formatted as a list or as an S-Expression if the '--long' option was given.
719
720=back
721
722=head1 VNET COMMANDS
723
724The Virtual Network interfaces for Xen.
725
726FIXME: This needs a lot more explanation, or it needs to be ripped
727out entirely.
728
729=over 4
730
731=item B<vnet-list> I<[-l|--long]>
732
733List vnets.
734
735=item B<vnet-create> I<config>
736
737Create a vnet from a config file.
738
739=item B<vnet-delete> I<vnetid>
740
741Delete a vnet.
742
743=back
744
745=head1 ACCESS CONTROL SUBCOMMANDS
746
747Access Control in Xen consists of two components: (i) The Access
748Control Policy (ACP) defines security labels and access rules based on
749these labels. (ii) The Access Control Module (ACM) makes access control
750decisions by interpreting the policy when domains require to
751communicate or to access resources. The Xen access control has
752sufficient mechanisms in place to enforce the access decisions even
753against maliciously acting user domains (mandatory access control).
754
755Access rights for domains in Xen are determined by the domain security
756label only and not based on the domain Name or ID. The ACP specifies
757security labels that can then be assigned to domains and
758resources. Every domain must be assigned exactly one security label,
759otherwise access control decisions could become indeterministic. ACPs
760are distinguished by their name, which is a parameter to most of the
761subcommands described below. Currently, the ACP specifies two ways to
762interpret labels:
763
764(1) Simple Type Enforcement: Labels are interpreted to decide access
765of domains to comunication means and virtual or physical
766resources. Communication between domains as well as access to
767resources are forbidden by default and can only take place if they are
768explicitly allowed by the security policy. The proper assignment of
769labels to domains controls the sharing of information (directly
770through communication or indirectly through shared resources) between
771domains. This interpretation allows to control the overt (intended)
772communication channels in Xen.
773
774(2) Chinese Wall: Labels are interpreted to decide which domains can
775co-exist (be run simultaneously) on the same system. This
776interpretation allows to prevent direct covert (unintended) channels
777and mitigates risks caused by imperfect core domain isolation
778(trade-off between security and other system requirements). For a
779short introduction to covert channels, please refer to
780http://www.multicians.org/timing-chn.html.
781
782The following subcommands help you to manage security policies in Xen
783and to assign security labels to domains. To enable access control
784security in Xen, you must compile Xen with ACM support enabled as
785described under "Configuring Security" below. There, you will find
786also examples of each subcommand described here.
787
788=item B<makepolicy> I<policy>
789
790Compiles the XML source representation of the security I<policy>. It
791creates a mapping (.map) as well as a binary (.bin) version of the
792policy. The compiled policy can be loaded into Xen with the
793B<loadpolicy> subcommand or can be configured to be loaded at boot
794time with the B<cfgbootpolicy> subcommand.
795
796=over 4
797
798I<policy> is a dot-separated list of names. The last part is the file
799name pre-fix for the policy xml file. The preceding name parts are
800translated into the local path pointing to the policy xml file
801relative to the global policy root directory
802(/etc/xen/acm-security/policies). For example,
803example.chwall_ste.client_v1 denotes the policy file
804example/chwall_ste/client_v1-security_policy.xml relative to the
805global policy root directory.
806
807=back
808
809=item B<loadpolicy> I<policy>
810
811Loads the binary representation of the I<policy> into Xen. The binary
812representation can be created with the B<makepolicy> subcommand.
813
814=item B<cfgbootpolicy> I<policy> [I<boot title>]
815
816Configures I<policy> as the boot policy for Xen. It copies the binary
817policy representation into the /boot directory and adds a module line
818specifying the binary policy to the /boot/grub/menu.lst file. If your
819boot configuration includes multiple Xen boot titles, then use the
820I<boot title> parameter to specify a unique part of the proper title.
821
822=item B<dumppolicy>
823
824Prints the current security policy state information of Xen.
825
826=item B<labels> [I<policy>] [I<type>=dom|res|any]
827
828Lists all labels of a I<type> (domain, resource, or both) that are
829defined in the I<policy>. Unless specified, the default I<policy> is
830the currently enforced access control policy. The default for I<type>
831is 'dom'. The labels are arranged in alphabetical order.
832
833=item B<addlabel> I<label> dom I<configfile> [I<policy>]
834
835=item B<addlabel> I<label> res I<resource> [I<policy>]
836
837Adds the security label with name I<label> to a domain
838I<configfile> (dom) or to the global resource label file for the
839given I<resource> (res). Unless specified, the default I<policy> is the
840currently enforced access control policy. This subcommand also
841verifies that the I<policy> definition supports the specified I<label>
842name.
843
844=item B<rmlabel> dom I<configfile>
845
846=item B<rmlabel> res I<resource>
847
848Works the same as the I<addlabel> command (above), except that this
849command will remove the label from the domain I<configfile> (dom) or
850the global resource label file (res).
851
852=item B<getlabel> dom I<configfile>
853
854=item B<getlabel> res I<resource>
855
856Shows the label for the given I<configfile> or I<resource>
857
858=item B<resources>
859
860Lists all resources in the global resource label file.  Each resource
861is listed with its associated label and policy name.
862
863=item B<dry-run> I<configfile>
864
865Determines if the specified I<configfile> describes a domain with a valid
866security configuration for type enforcement. The test shows the policy
867decision made for each resource label against the domain label as well as
868the overall decision.
869
870B<CONFIGURING SECURITY>
871
872=over 4
873
874In xen_source_dir/Config.mk set the following parameters:
875
876    ACM_SECURITY ?= y
877    ACM_DEFAULT_SECURITY_POLICY ?= \
878        ACM_CHINESE_WALL_AND_SIMPLE_TYPE_ENFORCEMENT_POLICY
879
880Then recompile and install xen and the security tools and then reboot:
881
882    cd xen_source_dir/xen; make clean; make; cp xen.gz /boot;
883    cd xen_source_dir/tools/security; make install;
884    reboot into xen
885
886=back
887
888B<COMPILING A SECURITY POLICY>
889
890=over 4
891
892This step creates client_v1.map and client_v1.bin files in
893/etc/xen/acm-security/policies/example/chwall_ste.
894
895    xm makepolicy example.chwall_ste.client_v1
896
897=back
898
899B<LOADING A SECURITY POLICY>
900
901=over 4
902
903This step activates client_v1.bin as new security policy in Xen. You
904can use the dumppolicy subcommand before and afterwards to see the
905change in the Xen policy state.
906
907    xm loadpolicy example.chwall_ste.client_v1
908
909=back
910
911B<CONFIGURING A BOOT SECURITY POLICY>
912
913=over 4
914
915This configures the boot loader to load client_v1.bin at boot
916time. During system start, the ACM configures Xen with this policy and
917Xen enforces this policy from then on.
918
919    xm cfgbootpolicy example.chwall_ste.client_v1
920
921=back
922
923B<LISTING SECURITY LABELS>
924
925=over 4
926
927This subcommand shows all labels that are defined and which can be
928attached to domains.
929
930    xm labels example.chwall_ste.client_v1 type=dom
931
932will print for our example policy:
933
934        dom_BoincClient
935        dom_Fun
936        dom_HomeBanking
937        dom_NetworkDomain
938        dom_StorageDomain
939        dom_SystemManagement
940
941=back
942
943B<ATTACHING A SECURITY LABEL TO A DOMAIN>
944
945=over 4
946
947The I<addlabel> subcommand can attach a security label to a domain
948configuration file, here a HomeBanking label. The example policy
949ensures that this domain does not share information with other
950non-hombanking user domains (i.e., domains labeled as dom_Fun or
951dom_Boinc) and that it will not run simultaneously with domains
952labeled as dom_Fun.
953
954We assume that the specified myconfig.xm configuration file actually
955instantiates a domain that runs workloads related to home-banking,
956probably just a browser environment for online-banking.
957
958    xm addlabel dom_HomeBanking dom myconfig.xm
959
960The very simple configuration file might now look as printed
961below. The I<addlabel> subcommand added the B<access_control> entry at
962the end of the file, consisting of a label name and the policy that
963specifies this label name:
964
965    kernel = "/boot/vmlinuz-2.6.16-xen"
966    ramdisk="/boot/U1_home_banking_ramdisk.img"
967    memory = 164
968    name = "homebanking"
969    vif = [ '' ]
970    dhcp = "dhcp"
971    access_control = ['policy=example.chwall_ste.client_v1,
972                       label=dom_HomeBanking']
973
974Security labels must be assigned to domain configurations because
975these labels are essential for making access control decisions as
976early as during the configuration phase of a newly instantiated
977domain. Consequently, a security-enabled Xen hypervisor will only
978start domains that have a security label configured and whose security
979label is consistent with the currently enforced policy. Otherwise,
980starting the domain will fail with the error condition "operation not
981permitted".
982
983=back
984
985B<ATTACHING A SECURITY LABEL TO A RESOURCE>
986
987=over 4
988
989The I<addlabel> subcommand can also be used to attach a security
990label to a resource. Following the home banking example from above,
991we can label a disk resource (e.g., a physical partition or a file)
992to make it accessible to the home banking domain. The example policy
993provides a resource label, res_LogicalDiskPartition1(hda1), that is
994compatible with the HomeBanking domain label.
995
996    xm addlabel "res_LogicalDiskPartition1(hda1)" res phy:hda6
997
998After labeling this disk resource, it can be attached to the domain
999by adding a line to the domain configuration file. The line below
1000attaches this disk to the domain at boot time.
1001
1002    disk = [ 'phy:hda6,sda2,w' ]
1003
1004Alternatively, the resource can be attached after booting the domain
1005by using the I<block-attach> subcommand.
1006
1007    xm block-attach homebanking phy:hda6 sda2 w
1008
1009Note that labeled resources cannot be used when security is turned
1010off.  Any attempt to use labeled resources with security turned off
1011will result in a failure with a corresponding error message.  The
1012solution is to enable security or, if security is no longer desired,
1013to remove the resource label using the I<rmlabel> subcommand.
1014
1015=back
1016
1017B<STARTING AND LISTING LABELED DOMAINS>
1018
1019=over 4
1020
1021    xm create myconfig.xm
1022
1023    xm list --label
1024
1025      Name         ID ...  Time(s)  Label
1026      homebanking  23 ...      4.4  dom_HomeBanking
1027      Domain-0      0 ...   2658.8  dom_SystemManagement
1028
1029=back
1030
1031B<LISTING LABELED RESOURCES>
1032
1033=over 4
1034
1035    xm resources
1036
1037      phy:hda6
1038          policy: example.chwall_ste.client_v1
1039          label:  res_LogicalDiskPartition1(hda1)
1040      file:/xen/disk_image/disk.img
1041          policy: example.chwall_ste.client_v1
1042          label:  res_LogicalDiskPartition2(hda2)
1043
1044=back
1045
1046B<POLICY REPRESENTATIONS>
1047
1048=over 4
1049
1050We distinguish three representations of the Xen access control policy:
1051the I<source XML> version, its I<binary> counterpart, and a I<mapping>
1052representation that enables the tools to deterministically translate
1053back and forth between label names of the XML policy and label
1054identifiers of the binary policy. All three versions must be kept
1055consistent to achieve predictable security guarantees.
1056
1057The XML version is the version that users are supposed to create or
1058change, either by manually editing the XML file or by using the Xen
1059policy generation tool (B<xensec_gen>). After changing the XML file,
1060run the B<makepolicy> subcommand to ensure that these changes are
1061reflected in the other versions. Use, for example, the subcommand
1062B<cfgbootpolicy> to activate the changes during the next system
1063reboot.
1064
1065The binary version of the policy is derived from the XML policy by
1066tokenizing the specified labels and is used inside Xen only. It is
1067created with the B<makepolicy> subcommand. Essentially, the binary
1068version is much more compact than the XML version and is easier to
1069evaluate during access control decisions.
1070
1071The mapping version of the policy is created during the XML-to-binary
1072policy translation (B<makepolicy>) and is used by the Xen management
1073tools to translate between label names used as input to the tools and
1074their binary identifiers (ssidrefs) used inside Xen.
1075
1076=back
1077
1078=head1 EXAMPLES
1079
1080=head1 SEE ALSO
1081
1082B<xmdomain.cfg>(5), B<xentop>(1)
1083
1084=head1 AUTHOR
1085
1086  Sean Dague <sean at dague dot net>
1087  Daniel Stekloff <dsteklof at us dot ibm dot com>
1088  Reiner Sailer <sailer at us dot ibm dot com>
1089
1090=head1 BUGS
Note: See TracBrowser for help on using the repository browser.