Example #1
0
def main():
    # set default web flag option
    CONF.set_default('web', '/usr/share/novnc')

    baseproxy.proxy(
        host=CONF.novncproxy_host,
        port=CONF.novncproxy_port)
Example #2
0
def main():
    # set default web flag option
    web = '/usr/share/nova-serial'
    #web = os.path.join(os.path.dirname(__file__), 'serialproxy_web')
    CONF.set_default('web', web)
    config.parse_args(sys.argv)

    proxyclient_address = CONF.serial_console.proxyclient_address
    if proxyclient_address == '0.0.0.0':
        # determine the correct host to connect to as the local address
        # of the interface with the best default route
        import subprocess, re
        command = "route -n | awk '/^0.0.0.0/{print $5 \" \" $8}'"
        prc = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True)
        out, _ = prc.communicate()
        routes = [line.split(None, 1) for line in out.splitlines()]
        if routes:
            routes.sort(key=lambda metr_iface: int(metr_iface[0]))
            selected_iface = routes[0][1]

            command = "ifconfig %s" % selected_iface
            prc = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True)
            out, _ = prc.communicate()
            outside_ip = re.search(r'inet (?:addr:)?([^\s]+)', out)
            if outside_ip:
                proxyclient_address = outside_ip.group(1)

    baseproxy.proxy(target_host=proxyclient_address,
                    host=CONF.serial_console.serialproxy_host,
                    port=CONF.serial_console.serialproxy_port)
Example #3
0
def main():
    # set default web flag option
    CONF.set_default('web', '/usr/share/novnc')
    config.parse_args(sys.argv)

    baseproxy.proxy(host=CONF.vnc.novncproxy_host,
                    port=CONF.vnc.novncproxy_port)
Example #4
0
def main():
    # set default web flag option
    CONF.set_default('web', None)
    config.parse_args(sys.argv)

    baseproxy.proxy(host=CONF.serial_console.serialproxy_host,
                    port=CONF.serial_console.serialproxy_port)
Example #5
0
def main():
    # set default web flag option
    CONF.set_default('web', None)

    baseproxy.proxy(
        host=CONF.serial_console.serialproxy_host,
        port=CONF.serial_console.serialproxy_port)
Example #6
0
def main():
    # set default web flag option
    web = '/usr/share/nova-serial'
    #web = os.path.join(os.path.dirname(__file__), 'serialproxy_web')
    CONF.set_default('web', web)
    config.parse_args(sys.argv)

    proxyclient_address = CONF.serial_console.proxyclient_address
    if proxyclient_address == '0.0.0.0':
        # determine the correct host to connect to as the local address
        # of the interface with the best default route
        import subprocess, re
        command = "route -n | awk '/^0.0.0.0/{print $5 \" \" $8}'"
        prc = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True)
        out, _ = prc.communicate()
        routes = [line.split(None, 1) for line in out.splitlines()]
        if routes:
            routes.sort(key=lambda metr_iface: int(metr_iface[0]))
            selected_iface = routes[0][1]

            command = "ifconfig %s" % selected_iface
            prc = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True)
            out, _ = prc.communicate()
            outside_ip = re.search(r'inet (?:addr:)?([^\s]+)', out)
            if outside_ip:
                proxyclient_address = outside_ip.group(1)


    baseproxy.proxy(
        target_host=proxyclient_address,
        host=CONF.serial_console.serialproxy_host,
        port=CONF.serial_console.serialproxy_port)
Example #7
0
def main():
    # set default web flag option
    CONF.set_default('web', None)
    config.parse_args(sys.argv)

    baseproxy.proxy(
        host=CONF.serial_console.serialproxy_host,
        port=CONF.serial_console.serialproxy_port)
Example #8
0
def main():
    # set default web flag option
    CONF.set_default('web', '/usr/share/novnc')
    config.parse_args(sys.argv)

    baseproxy.proxy(
        host=CONF.novncproxy_host,
        port=CONF.novncproxy_port)
Example #9
0
 def test_proxy_ssl_settings(self, mock_start, mock_init, mock_exists):
     self.flags(ssl_minimum_version='tlsv1_3', group='console')
     self.flags(ssl_ciphers='ALL:!aNULL', group='console')
     baseproxy.proxy('0.0.0.0', '6080')
     mock_init.assert_called_once_with(
         listen_host='0.0.0.0', listen_port='6080', source_is_ipv6=False,
         cert='self.pem', key=None, ssl_only=False,
         ssl_ciphers='ALL:!aNULL', ssl_minimum_version='tlsv1_3',
         daemon=False, record=None, security_proxy=None, traffic=True,
         web='/usr/share/spice-html5', file_only=True,
         RequestHandlerClass=websocketproxy.NovaProxyRequestHandler)
Example #10
0
 def test_proxy(self, mock_start, mock_init, mock_gmr, mock_log,
                mock_exists):
     baseproxy.proxy('0.0.0.0', '6080')
     mock_log.assert_called_once_with(baseproxy.CONF, 'nova')
     mock_gmr.mock_assert_called_once_with(version)
     mock_init.assert_called_once_with(
         listen_host='0.0.0.0', listen_port='6080', source_is_ipv6=False,
         cert='self.pem', key=None, ssl_only=False,
         daemon=False, record=None, security_proxy=None, traffic=True,
         web='/usr/share/spice-html5', file_only=True,
         RequestHandlerClass=websocketproxy.NovaProxyRequestHandler)
     mock_start.assert_called_once_with()
Example #11
0
 def test_proxy(self, mock_start, mock_init, mock_gmr, mock_log,
                mock_exists):
     baseproxy.proxy('0.0.0.0', '6080')
     mock_log.assert_called_once_with(baseproxy.CONF, 'nova')
     mock_gmr.mock_assert_called_once_with(version)
     mock_init.assert_called_once_with(
         listen_host='0.0.0.0', listen_port='6080', source_is_ipv6=False,
         verbose=False, cert='self.pem', key=None, ssl_only=False,
         daemon=False, record=False, traffic=False,
         web='/usr/share/spice-html5', file_only=True,
         RequestHandlerClass=websocketproxy.NovaProxyRequestHandler)
     mock_start.assert_called_once_with()
Example #12
0
 def test_proxy(self, mock_select_ssl_version, mock_start, mock_init,
                mock_gmr, mock_log, mock_exists):
     baseproxy.proxy('0.0.0.0', '6080')
     mock_log.assert_called_once_with(baseproxy.CONF, 'nova')
     mock_gmr.assert_called_once_with(version, conf=baseproxy.CONF)
     mock_init.assert_called_once_with(
         listen_host='0.0.0.0', listen_port='6080', source_is_ipv6=False,
         cert='self.pem', key=None, ssl_only=False, ssl_ciphers=None,
         ssl_minimum_version='default', daemon=False, record=None,
         security_proxy=None, traffic=True,
         web='/usr/share/spice-html5', file_only=True,
         RequestHandlerClass=websocketproxy.NovaProxyRequestHandler)
     mock_start.assert_called_once_with()
def main():
    # set default web flag option
    CONF.set_default('web', '/usr/share/novnc')
    config.parse_args(sys.argv)

    # TODO(stephenfin): Always enable the security proxy once we support RFB
    # version 3.3, as used in XenServer.
    security_proxy = None
    if CONF.compute_driver != 'xenapi.XenAPIDriver':
        security_proxy = rfb.RFBSecurityProxy()

    baseproxy.proxy(host=CONF.vnc.novncproxy_host,
                    port=CONF.vnc.novncproxy_port,
                    security_proxy=security_proxy)
 def test_proxy(self, mock_start, mock_init, mock_gmr, mock_log,
                mock_exists):
     # Force verbose=False so something else testing nova.cmd.baseproxy
     # doesn't impact the call to mocked NovaWebSocketProxy.__init__.
     self.flags(verbose=False)
     baseproxy.proxy('0.0.0.0', '6080')
     mock_log.assert_called_once_with(baseproxy.CONF, 'nova')
     mock_gmr.mock_assert_called_once_with(version)
     mock_init.assert_called_once_with(
         listen_host='0.0.0.0', listen_port='6080', source_is_ipv6=False,
         verbose=False, cert='self.pem', key=None, ssl_only=False,
         daemon=False, record=None, traffic=False,
         web='/usr/share/spice-html5', file_only=True,
         RequestHandlerClass=websocketproxy.NovaProxyRequestHandler)
     mock_start.assert_called_once_with()
Example #15
0
def main():
    # set default web flag option
    CONF.set_default('web', '/usr/share/novnc')
    config.parse_args(sys.argv)

    # TODO(stephenfin): Always enable the security proxy once we support RFB
    # version 3.3, as used in XenServer.
    security_proxy = None
    if CONF.compute_driver != 'xenapi.XenAPIDriver':
        security_proxy = rfb.RFBSecurityProxy()

    baseproxy.proxy(
        host=CONF.vnc.novncproxy_host,
        port=CONF.vnc.novncproxy_port,
        security_proxy=security_proxy)
Example #16
0
 def test_proxy(self, mock_start, mock_init, mock_gmr, mock_log,
                mock_exists):
     # Force verbose=False so something else testing nova.cmd.baseproxy
     # doesn't impact the call to mocked NovaWebSocketProxy.__init__.
     self.flags(verbose=False)
     baseproxy.proxy('0.0.0.0', '6080')
     mock_log.assert_called_once_with(baseproxy.CONF, 'nova')
     mock_gmr.mock_assert_called_once_with(version)
     mock_init.assert_called_once_with(
         listen_host='0.0.0.0',
         listen_port='6080',
         source_is_ipv6=False,
         verbose=False,
         cert='self.pem',
         key=None,
         ssl_only=False,
         daemon=False,
         record=False,
         traffic=False,
         web='/usr/share/spice-html5',
         file_only=True,
         RequestHandlerClass=websocketproxy.NovaProxyRequestHandler)
     mock_start.assert_called_once_with()
Example #17
0
def main():
    # set default web flag option
    CONF.set_default('web', None)

    baseproxy.proxy(host=CONF.serial_console.serialproxy_host,
                    port=CONF.serial_console.serialproxy_port)
Example #18
0
def main():

    baseproxy.proxy(
        host=CONF.spice.html5proxy_host,
        port=CONF.spice.html5proxy_port)
Example #19
0
def main():
    config.parse_args(sys.argv)

    baseproxy.proxy(
        host=CONF.spice.html5proxy_host,
        port=CONF.spice.html5proxy_port)
def main():
    config.parse_args(sys.argv)

    baseproxy.proxy(host=CONF.spice.html5proxy_host,
                    port=CONF.spice.html5proxy_port)