[libvirt] [PATCH 2/2] add vnc unix sockets to apparmor policy (v2)

Daniel P. Berrange berrange at redhat.com
Tue Dec 11 20:25:32 UTC 2012


On Tue, Dec 11, 2012 at 08:20:30PM +0000, serge at hallyn.com wrote:
> From: Serge Hallyn <serge.hallyn at ubuntu.com>
> 
> When using vnc gaphics over a unix socket, virt-aa-helper needs to provide
> access for the qemu domain to access the sockfile.
> 
> Changelog:
>  v2: add testcase to virt-aa-helper-tests to make sure xml with vnc socket
>      works.
> 
> Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
> ---
>  src/security/virt-aa-helper.c |    7 +++++++
>  tests/virt-aa-helper-test     |    3 +++
>  2 files changed, 10 insertions(+)
> 
> diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
> index e480b30..c6b9903 100644
> --- a/src/security/virt-aa-helper.c
> +++ b/src/security/virt-aa-helper.c
> @@ -1003,6 +1003,13 @@ get_files(vahControl * ctl)
>          if (vah_add_file(&buf, ctl->def->os.loader, "r") != 0)
>              goto clean;
>  
> +    for (i = 0; i < ctl->def->ngraphics; i++) {
> +        if (ctl->def->graphics[i]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
> +                    ctl->def->graphics[i]->data.vnc.socket &&
> +                    vah_add_file(&buf, ctl->def->graphics[i]->data.vnc.socket, "rw"))

Odd indentation alignment

> +                goto clean;
> +    }
> +
>      if (ctl->def->ngraphics == 1 &&
>          ctl->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL)
>          if (vah_add_file(&buf, ctl->def->graphics[0]->data.sdl.xauth,
> diff --git a/tests/virt-aa-helper-test b/tests/virt-aa-helper-test
> index f14db8b..af91c61 100755
> --- a/tests/virt-aa-helper-test
> +++ b/tests/virt-aa-helper-test
> @@ -319,6 +319,9 @@ testme "0" "sdl Xauthority" "-r -u $valid_uuid" "$test_xml"
>  sed -e "s,###UUID###,$uuid,g" -e "s,###DISK###,$disk1,g" "$template_xml" > "$test_xml"
>  testme "0" "hugepages" "-r -u $valid_uuid -F /run/hugepages/kvm/\*\*" "$test_xml"
>  
> +sed -e "s,###UUID###,$uuid,g" -e "s,###DISK###,$disk1,g" -e "s,<graphics.*>,<graphics type='vnc' socket='/var/lib/libvirt/qemu/myself.vnc'><listen type='address' address='0.0.0.0'/></graphics>,g" "$template_xml" > "$test_xml"
> +testme "0" "vnc socket" "-r -u $valid_uuid" "$test_xml"
> +
>  testme "0" "help" "-h"
>  
>  echo "" >$output


ACK

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list