Ejemplo n.º 1
0
flags.DEFINE_string('bridge_dev', 'eth2', 'network device for bridges')
flags.DEFINE_integer('vlan_start', 2020, 'First VLAN for private networks')
flags.DEFINE_integer('vlan_end', 2039, 'Last VLAN for private networks')
flags.DEFINE_integer('network_size', 256,
                     'Number of addresses in each private subnet')
flags.DEFINE_string('public_interface', 'vlan124',
                    'Interface for public IP addresses')
flags.DEFINE_string('public_range', '198.10.124.128-198.10.124.191',
                    'Public IP address block')
flags.DEFINE_string('private_range', '10.128.0.0/12',
                    'Private IP address block')
flags.DEFINE_string('cloudpipe_ami', 'ami-A7370FE3', 'CloudPipe image')
flags.DEFINE_integer('cloudpipe_start_port', 8000,
                     'Starting port for mapped CloudPipe external ports')

KEEPER = datastore.keeper(prefix="net")

logging.getLogger().setLevel(logging.DEBUG)

# TODO(joshua): Save the IPs at the top of each subnet for cloudpipe vpn clients


def confirm_rule(cmd):
    execute("sudo iptables --delete %s" % (cmd))
    execute("sudo iptables -I %s" % (cmd))


def remove_rule(cmd):
    execute("sudo iptables --delete %s" % (cmd))
    pass
Ejemplo n.º 2
0
                    'Template for creating users rc file')
flags.DEFINE_string('vpn_client_template',
                    utils.abspath('cloudpipe/client.ovpn.template'),
                    'Template for creating users vpn file')
flags.DEFINE_string('credential_key_file', 'pk.pem',
                    'Filename of private key in credentials zip')
flags.DEFINE_string('credential_cert_file', 'cert.pem',
                    'Filename of certificate in credentials zip')
flags.DEFINE_string('credential_rc_file', 'novarc',
                    'Filename of rc in credentials zip')
flags.DEFINE_string('vpn_ip', '127.0.0.1', 'Public IP for the cloudpipe VPN servers')

_log = logging.getLogger('auth')
_log.setLevel(logging.WARN)

KEEPER = datastore.keeper(prefix="user")


class UserError(exception.ApiError):
    pass

class InvalidKeyPair(exception.ApiError):
    pass

class User(object):
    def __init__(self, id, name, access, secret, admin):
        self.manager = UserManager.instance()
        self.id = id
        self.name = name
        self.access = access
        self.secret = secret
Ejemplo n.º 3
0
import logging
from nova import datastore

KEEPER = datastore.keeper('fakeldap')

SCOPE_SUBTREE  = 1

class NO_SUCH_OBJECT(Exception):
    pass

def initialize(uri):
    return FakeLDAP(uri)

if KEEPER['objects'] is None:
    KEEPER['objects'] = {}

class FakeLDAP(object):
    def __init__(self, uri):
        self.uri = uri

    def simple_bind_s(self, dn, password):
        pass
    
    def unbind_s(self):
        pass

    def search_s(self, dn, scope, query=None, fields=None):
        logging.debug("searching for %s" % dn)
        filtered = {}
        d = KEEPER['objects']
        for cn, attrs in d.iteritems():
Ejemplo n.º 4
0
                    'Template file for libvirt networks')
flags.DEFINE_string('networks_path', utils.abspath('../networks'),
                    'Location to keep network config files')
flags.DEFINE_integer('public_vlan', 2000, 'VLAN for public IP addresses') # FAKE!!! 
flags.DEFINE_string('bridge_dev', 'eth2',
                        'network device for bridges')
flags.DEFINE_integer('vlan_start', 2020, 'First VLAN for private networks')
flags.DEFINE_integer('vlan_end', 2039, 'Last VLAN for private networks')
flags.DEFINE_integer('network_size', 256, 'Number of addresses in each private subnet') 
flags.DEFINE_string('public_interface', 'vlan124', 'Interface for public IP addresses')
flags.DEFINE_string('public_range', '198.10.124.128-198.10.124.191', 'Public IP address block')
flags.DEFINE_string('private_range', '10.128.0.0/12', 'Private IP address block')
flags.DEFINE_string('cloudpipe_ami', 'ami-A7370FE3', 'CloudPipe image')
flags.DEFINE_integer('cloudpipe_start_port', 8000, 'Starting port for mapped CloudPipe external ports')

KEEPER = datastore.keeper(prefix="net")


logging.getLogger().setLevel(logging.DEBUG)



# TODO(joshua): Save the IPs at the top of each subnet for cloudpipe vpn clients




def confirm_rule(cmd):
    execute("sudo iptables --delete %s" % (cmd))
    execute("sudo iptables -I %s" % (cmd))
Ejemplo n.º 5
0
from tornado import ioloop
from twisted.internet import defer

FLAGS = flags.FLAGS
flags.DEFINE_string('storage_dev', '/dev/sdb', 'Physical device to use for volumes')
flags.DEFINE_string('volume_group', 'nova-volumes', 'Name for the VG that will contain exported volumes')
flags.DEFINE_string('aoe_eth_dev', 'eth0', 'Which device to export the volumes on')

flags.DEFINE_string('storage_name',
                    socket.gethostname(),
                    'name of this node')
flags.DEFINE_string('storage_availability_zone',
                    'nova',
                    'availability zone of this node')
KEEPER = datastore.keeper(prefix="storage")

class BlockStore(object):                                            

    def __init__(self):
        super(BlockStore, self).__init__()
        self.volume_class = Volume
        if FLAGS.fake_storage:
            self.volume_class = FakeVolume
        self._init_volume_group()
        pass

    def create_volume(self, size, user_id):
        logging.debug("Creating volume of size: %s" % (size))
        vol = self.volume_class(size = size, user_id = user_id)
        self._restart_exports()
Ejemplo n.º 6
0
from tornado import ioloop
from twisted.internet import defer

FLAGS = flags.FLAGS
flags.DEFINE_string('storage_dev', '/dev/sdb',
                    'Physical device to use for volumes')
flags.DEFINE_string('volume_group', 'nova-volumes',
                    'Name for the VG that will contain exported volumes')
flags.DEFINE_string('aoe_eth_dev', 'eth0',
                    'Which device to export the volumes on')

flags.DEFINE_string('storage_name', socket.gethostname(), 'name of this node')
flags.DEFINE_string('storage_availability_zone', 'nova',
                    'availability zone of this node')
KEEPER = datastore.keeper(prefix="storage")


class BlockStore(object):
    def __init__(self):
        super(BlockStore, self).__init__()
        self.volume_class = Volume
        if FLAGS.fake_storage:
            self.volume_class = FakeVolume
        self._init_volume_group()
        pass

    def create_volume(self, size, user_id):
        logging.debug("Creating volume of size: %s" % (size))
        vol = self.volume_class(size=size, user_id=user_id)
        self._restart_exports()
Ejemplo n.º 7
0
flags.DEFINE_string('vpn_client_template',
                    utils.abspath('cloudpipe/client.ovpn.template'),
                    'Template for creating users vpn file')
flags.DEFINE_string('credential_key_file', 'pk.pem',
                    'Filename of private key in credentials zip')
flags.DEFINE_string('credential_cert_file', 'cert.pem',
                    'Filename of certificate in credentials zip')
flags.DEFINE_string('credential_rc_file', 'novarc',
                    'Filename of rc in credentials zip')
flags.DEFINE_string('vpn_ip', '127.0.0.1',
                    'Public IP for the cloudpipe VPN servers')

_log = logging.getLogger('auth')
_log.setLevel(logging.WARN)

KEEPER = datastore.keeper(prefix="user")


class UserError(exception.ApiError):
    pass


class InvalidKeyPair(exception.ApiError):
    pass


class User(object):
    def __init__(self, id, name, access, secret, admin):
        self.manager = UserManager.instance()
        self.id = id
        self.name = name
Ejemplo n.º 8
0
import logging
from nova import datastore

KEEPER = datastore.keeper('fakeldap')

SCOPE_SUBTREE = 1


class NO_SUCH_OBJECT(Exception):
    pass


def initialize(uri):
    return FakeLDAP(uri)


if KEEPER['objects'] is None:
    KEEPER['objects'] = {}


class FakeLDAP(object):
    def __init__(self, uri):
        self.uri = uri

    def simple_bind_s(self, dn, password):
        pass

    def unbind_s(self):
        pass

    def search_s(self, dn, scope, query=None, fields=None):