Beispiel #1
0
 def test_default_container_context(self):
     default = util.default_container_context()
     if selinux.is_selinux_enabled():
         # newer policies use container_file_t
         self.assertTrue(default in
                         ['system_u:object_r:container_file_t:s0',
                          'system_u:object_r:svirt_sandbox_file_t:s0'])
     else:
         self.assertEqual(default, '')
Beispiel #2
0
 def test_default_container_context(self):
     default = util.default_container_context()
     if selinux.is_selinux_enabled():
         # newer policies use container_file_t
         self.assertTrue(default in
                         ['system_u:object_r:container_file_t:s0',
                          'system_u:object_r:svirt_sandbox_file_t:s0'])
     else:
         self.assertEqual(default, '')
Beispiel #3
0
 def _default_options(self, options, default_con=None, default_options=[]):
     """
     Merges user options with default options and determines security
     context.
     """
     if not options:
         options = default_options
     # Determines default context.
     if all([o.find('context=') == -1 for o in options]):
         options.append('context="' +
                        (default_con if default_con else
                         util.default_container_context()) + '"')
     return options
Beispiel #4
0
 def test_default_container_context(self):
     exp = ('system_u:object_r:svirt_sandbox_file_t:s0'
            if selinux.is_selinux_enabled() else '')
     self.assertEqual(exp, util.default_container_context())
Beispiel #5
0
 def test_default_container_context(self):
     exp = ('system_u:object_r:svirt_sandbox_file_t:s0' if
            selinux.is_selinux_enabled() else '')
     self.assertEqual(exp, util.default_container_context())