Exemple #1
0
 def setUp(self):
     super(RootwrapTestCase, self).setUp()
     self.filters = [
         filters.RegExpFilter("/bin/ls", "root", 'ls', '/[a-z]+'),
         filters.CommandFilter("/usr/bin/foo_bar_not_exist", "root"),
         filters.RegExpFilter("/bin/cat", "root", 'cat', '/[a-z]+'),
         filters.CommandFilter("/nonexistant/cat", "root"),
         filters.CommandFilter("/bin/cat", "root")]  # Keep this one last
Exemple #2
0
 def test_exec_dirs_search(self):
     # This test supposes you have /bin/cat or /usr/bin/cat locally
     f = filters.CommandFilter("cat", "root")
     usercmd = ['cat', '/f']
     self.assertTrue(f.match(usercmd))
     self.assertTrue(
         f.get_command(usercmd, exec_dirs=['/bin', '/usr/bin']) in (
             ['/bin/cat', '/f'], ['/usr/bin/cat', '/f']))
Exemple #3
0
# vim: tabstop=4 shiftwidth=4 softtabstop=4

# Copyright (c) 2012 Openstack, LLC.
# All Rights Reserved.
#
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

from quantum.rootwrap import filters

filterlist = [
    # quantum/plugins/ryu/agent/ryu_quantum_agent.py:
    #   "ovs-vsctl", "--timeout=2", ...
    filters.CommandFilter("/usr/bin/ovs-vsctl", "root"),
    filters.CommandFilter("/bin/ovs-vsctl", "root"),

    # quantum/plugins/ryu/agent/ryu_quantum_agent.py:
    #   "xe", "vif-param-get", ...
    filters.CommandFilter("/usr/bin/xe", "root"),
    filters.CommandFilter("/usr/sbin/xe", "root"),
]
Exemple #4
0
#    License for the specific language governing permissions and limitations
#    under the License.

from quantum.rootwrap import filters

filterlist = [
    # quantum/plugins/linuxbridge/agent/linuxbridge_quantum_agent.py:
    #   'brctl', 'addbr', bridge_name
    #   'brctl', 'addif', bridge_name, interface
    #   'brctl', 'addif', bridge_name, tap_device_name
    #   'brctl', 'delbr', bridge_name
    #   'brctl', 'delif', bridge_name, interface_name
    #   'brctl', 'delif', current_bridge_name, ...
    #   'brctl', 'setfd', bridge_name, ...
    #   'brctl', 'stp', bridge_name, 'off'
    filters.CommandFilter("/usr/sbin/brctl", "root"),
    filters.CommandFilter("/sbin/brctl", "root"),

    # quantum/plugins/linuxbridge/agent/linuxbridge_quantum_agent.py:
    #   'ip', 'link', 'add', 'link', ...
    #   'ip', 'link', 'delete', interface
    #   'ip', 'link', 'set', bridge_name, 'down'
    #   'ip', 'link', 'set', bridge_name, 'up'
    #   'ip', 'link', 'set', interface, 'down'
    #   'ip', 'link', 'set', interface, 'up'
    #   'ip', 'link', 'show', 'dev', device
    #   'ip', 'tuntap'
    #   'ip', 'tuntap'
    filters.CommandFilter("/usr/sbin/ip", "root"),
    filters.CommandFilter("/sbin/ip", "root"),
]
#
#    Licensed under the Apache License, Version 2.0 (the "License");
#    you may not use this file except in compliance with the License.
#    You may obtain a copy of the License at
#
#        http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS,
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.
#
# @author: Juliano Martinez, Locaweb.

from quantum.rootwrap import filters

filterlist = [
    # quantum/agent/linux/iptables_manager.py
    #   "iptables-save", ...
    filters.CommandFilter("/sbin/iptables-save", "root"),
    filters.CommandFilter("/sbin/iptables-restore", "root"),
    filters.CommandFilter("/sbin/ip6tables-save", "root"),
    filters.CommandFilter("/sbin/ip6tables-restore", "root"),

    # quantum/agent/linux/iptables_manager.py
    #   "iptables", "-A", ...
    filters.CommandFilter("/sbin/iptables", "root"),
    filters.CommandFilter("/sbin/ip6tables", "root"),
]