2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-30 13:58:22 +00:00

utils/apparmor/sandbox.py:

- fix detection of xdummy driver
- update comments
- add '--no-tray' to 'xpra attach'
This commit is contained in:
Jamie Strandboge
2012-08-24 11:09:35 -05:00
parent 056e642d2b
commit c062a8a841

View File

@@ -236,6 +236,12 @@ class SandboxXpra(SandboxXserver):
SandboxXserver.cleanup(self) SandboxXserver.cleanup(self)
def _get_xvfb_args(self): def _get_xvfb_args(self):
'''Setup xvfb arguments'''
# Debugging tip (can also use glxinfo):
# $ xdpyinfo > /tmp/native
# $ aa-sandbox -X -t sandbox-x /usr/bin/xdpyinfo > /tmp/nested
# $ diff -Naur /tmp/native /tmp/nested
xvfb_args = [] xvfb_args = []
if self.driver == None: if self.driver == None:
@@ -317,17 +323,14 @@ EndSection
# FIXME: is there a better way we can detect this? # FIXME: is there a better way we can detect this?
drv = "/usr/lib/xorg/modules/drivers/dummy_drv.so" drv = "/usr/lib/xorg/modules/drivers/dummy_drv.so"
debug("Searching for '%s'" % drv) debug("Searching for '%s'" % drv)
rc, report = cmd(['which', drv]) if not os.path.exists(drv):
if rc != 0:
raise AppArmorException("Could not find '%s'" % drv) raise AppArmorException("Could not find '%s'" % drv)
xvfb_args = self._get_xvfb_args() xvfb_args = self._get_xvfb_args()
listener_x = os.fork() listener_x = os.fork()
if listener_x == 0: if listener_x == 0:
# Debugging tip (can also use glxinfo): # This will clean out any dead sessions
# $ xdpyinfo > /tmp/native cmd(['xpra', 'list'])
# $ aa-sandbox -X -t sandbox-x /usr/bin/xdpyinfo > /tmp/nested
# $ diff -Naur /tmp/native /tmp/nested
x_args = ['--no-daemon', x_args = ['--no-daemon',
#'--no-mmap', # for security? #'--no-mmap', # for security?
@@ -369,10 +372,10 @@ EndSection
args = ['/usr/bin/xpra', 'attach', self.display, args = ['/usr/bin/xpra', 'attach', self.display,
'--title=%s' % self.title, '--title=%s' % self.title,
#'--no-mmap', # for security? #'--no-mmap', # for security?
'--no-tray',
'--no-clipboard', '--no-clipboard',
'--no-pulseaudio'] '--no-pulseaudio']
debug(" ".join(args)) debug(" ".join(args))
#cmd(args)
if apparmor.common.DEBUGGING == True: if apparmor.common.DEBUGGING == True:
sys.stderr.flush() sys.stderr.flush()
os.execv(args[0], args) os.execv(args[0], args)