Return the ssh_gateway configuration.
771450
def get_ssh_gateway_config(vm_):
    '''
    
    '''
    ssh_gateway = config.get_cloud_config_value(
        'ssh_gateway', vm_, __opts__, default=None,
        search_global=False
    )

    # Check to see if a SSH Gateway will be used.
    if not isinstance(ssh_gateway, six.string_types):
        return None

    # Create dictionary of configuration items

    # ssh_gateway
    ssh_gateway_config = {'ssh_gateway': ssh_gateway}

    # ssh_gateway_port
    ssh_gateway_config['ssh_gateway_port'] = config.get_cloud_config_value(
        'ssh_gateway_port', vm_, __opts__, default=None,
        search_global=False
    )

    # ssh_gateway_username
    ssh_gateway_config['ssh_gateway_user'] = config.get_cloud_config_value(
        'ssh_gateway_username', vm_, __opts__, default=None,
        search_global=False
    )

    # ssh_gateway_private_key
    ssh_gateway_config['ssh_gateway_key'] = config.get_cloud_config_value(
        'ssh_gateway_private_key', vm_, __opts__, default=None,
        search_global=False
    )

    # ssh_gateway_password
    ssh_gateway_config['ssh_gateway_password'] = config.get_cloud_config_value(
        'ssh_gateway_password', vm_, __opts__, default=None,
        search_global=False
    )

    # ssh_gateway_command
    ssh_gateway_config['ssh_gateway_command'] = config.get_cloud_config_value(
        'ssh_gateway_command', vm_, __opts__, default=None,
        search_global=False
    )

    # Check if private key exists
    key_filename = ssh_gateway_config['ssh_gateway_key']
    if key_filename is not None and not os.path.isfile(key_filename):
        raise SaltCloudConfigError(
            'The defined ssh_gateway_private_key \'{0}\' does not exist'
            .format(key_filename)
        )
    elif (
        key_filename is None and
        not ssh_gateway_config['ssh_gateway_password']
    ):
        raise SaltCloudConfigError(
            'No authentication method. Please define: '
            ' ssh_gateway_password or ssh_gateway_private_key'
        )

    return ssh_gateway_config
940452
def _get_tcpip_interface_info(interface):
    '''
    
    '''
    base_information = _get_base_interface_info(interface)
    if base_information['ipv4']['requestmode'] == 'static':
        settings = _load_config(interface.name, ['IP_Address', 'Subnet_Mask', 'Gateway', 'DNS_Address'])
        base_information['ipv4']['address'] = settings['IP_Address']
        base_information['ipv4']['netmask'] = settings['Subnet_Mask']
        base_information['ipv4']['gateway'] = settings['Gateway']
        base_information['ipv4']['dns'] = [settings['DNS_Address']]
    elif base_information['up']:
        base_information['ipv4']['address'] = interface.sockaddrToStr(interface.addr)
        base_information['ipv4']['netmask'] = interface.sockaddrToStr(interface.netmask)
        base_information['ipv4']['gateway'] = '0.0.0.0'
        base_information['ipv4']['dns'] = _get_dns_info()
        with salt.utils.files.fopen('/proc/net/route', 'r') as route_file:
            pattern = re.compile(r'^{interface}\t[0]{{8}}\t([0-9A-Z]{{8}})'.format(interface=interface.name),
                                 re.MULTILINE)
            match = pattern.search(route_file.read())
            iface_gateway_hex = None if not match else match.group(1)
        if iface_gateway_hex is not None and len(iface_gateway_hex) == 8:
            base_information['ipv4']['gateway'] = '.'.join([str(int(iface_gateway_hex[i:i + 2], 16))
                                                            for i in range(6, -1, -2)])
    return base_information
236735
def get_default_config_help(self):
        
        config = super(RiemannHandler, self).get_default_config_help()

        config.update({
            'host': '',
            'port': '',
            'transport': 'tcp or udp',
        })

        return config
1096256
def override_ssh_auth_env():
    """"""
    ssh_auth_sock = "SSH_AUTH_SOCK"
    old_ssh_auth_sock = os.environ.get(ssh_auth_sock)

    del os.environ[ssh_auth_sock]

    yield

    if old_ssh_auth_sock:
        os.environ[ssh_auth_sock] = old_ssh_auth_sock
656208
def _get_ssh_client(self):
        """"""
        return ipa_utils.get_ssh_client(
            self.instance_ip,
            self.ssh_private_key_file,
            self.ssh_user,
            timeout=self.timeout
        )
252869
def _configure_computer(self):
        """"""
        print("Configuring '{}'".format(self.name))
        sshcfg = parse_sshconfig(self.hostname)
        authparams = {
            'compress': True,
            'gss_auth': False,
            'gss_deleg_creds': False,
            'gss_host': self.hostname,
            'gss_kex': False,
            'key_policy': 'WarningPolicy',
            'load_system_host_keys': True,
            'port': 22,
            'timeout': 60,
        }
        if 'user' in sshcfg:
            authparams['username'] = sshcfg['user']
        else:
            print ("SSH username is not provided, please run `verdi computer configure {}` "
                   "from the command line".format(self.name))
            return
        if 'proxycommand' in sshcfg:
            authparams['proxy_command'] = sshcfg['proxycommand']
        aiidauser = get_automatic_user()
        authinfo = DbAuthInfo(dbcomputer=Computer.get(self.name).dbcomputer, aiidauser=aiidauser)
        authinfo.set_auth_params(authparams)
        authinfo.save()
        print(check_output(['verdi', 'computer', 'show', self.name]))
1072231
def ssh_interface(vm_):
    '''
    
    '''
    ret = config.get_cloud_config_value(
        'ssh_interface', vm_, __opts__, default='public_ips',
        search_global=False
    )
    if ret not in ('public_ips', 'private_ips'):
        log.warning(
            'Invalid ssh_interface: %s. '
            'Allowed options are ("public_ips", "private_ips"). '
            'Defaulting to "public_ips".', ret
        )
        ret = 'public_ips'
    return ret
356377
def obtain_hosting_device_credentials_from_config():
    
    cred_dict = get_specific_config('cisco_hosting_device_credential')
    attr_info = {
        'name': {'allow_post': True, 'allow_put': True,
                 'validate': {'type:string': None}, 'is_visible': True,
                 'default': ''},
        'description': {'allow_post': True, 'allow_put': True,
                        'validate': {'type:string': None},
                        'is_visible': True, 'default': ''},
        'user_name': {'allow_post': True, 'allow_put': True,
                      'validate': {'type:string': None},
                      'is_visible': True, 'default': ''},
        'password': {'allow_post': True, 'allow_put': True,
                     'validate': {'type:string': None},
                     'is_visible': True, 'default': ''},
        'type': {'allow_post': True, 'allow_put': True,
                 'validate': {'type:string': None}, 'is_visible': True,
                 'default': ''}}
    credentials = {}
    for cred_uuid, kv_dict in cred_dict.items():
        # ensure cred_uuid is properly formatted
        cred_uuid = uuidify(cred_uuid)
        verify_resource_dict(kv_dict, True, attr_info)
        credentials[cred_uuid] = kv_dict
    return credentials
961367
def get_auth_config(self):
        
        return self.get_template(
            'amazon-auth-cm.yaml',
            arn=self.node_arn,
            users=self.admins
        )
383017
def _get_ssh_key(kwargs):
    '''
    
    '''
    ssh_key_name = kwargs.get('name', None)
    ssh_key_description = kwargs.get('description', None)
    public_key = kwargs.get('public_key', None)

    return SshKey(
        name=ssh_key_name,
        description=ssh_key_description,
        public_key=public_key
    )
493325
def config():
    
    cfg = ConfigParser()
    cfg.read(os.path.join(os.path.dirname(os.path.realpath(ips_vagrant.__file__)), 'config/ipsv.conf'))
    return cfg
1356001
protected function _getShopHostInfoFromConfig()
    {
        $sShopURL = Registry::getConfig()->getConfigParam('sShopURL');
        if (preg_match('#^(https?://)?([^/:]+)(:([0-9]+))?(/.*)?$#i', $sShopURL, $m)) {
            $sHost = $m[2];
            $iPort = (int) $m[4];
            $blSsl = (strtolower($m[1]) == 'https://');
            if (!$iPort) {
                $iPort = $blSsl ? 443 : 80;
            }
            $sScript = rtrim($m[5], '/') . '/';

            return [
                'host' => $sHost,
                'port' => $iPort,
                'dir'  => $sScript,
                'ssl'  => $blSsl,
            ];
        }

        return false;
    }
121631
def get_environ(self):
        """"""
        req = self.req
        env_10 = super(Gateway_u0, self).get_environ()
        env = dict(map(self._decode_key, env_10.items()))

        # Request-URI
        enc = env.setdefault(six.u('wsgi.url_encoding'), six.u('utf-8'))
        try:
            env['PATH_INFO'] = req.path.decode(enc)
            env['QUERY_STRING'] = req.qs.decode(enc)
        except UnicodeDecodeError:
            # Fall back to latin 1 so apps can transcode if needed.
            env['wsgi.url_encoding'] = 'ISO-8859-1'
            env['PATH_INFO'] = env_10['PATH_INFO']
            env['QUERY_STRING'] = env_10['QUERY_STRING']

        env.update(map(self._decode_value, env.items()))

        return env
60843
def _get_ssh_public_key(self):
        """"""
        key = ipa_utils.generate_public_ssh_key(self.ssh_private_key_file)
        return '{user}:{key} {user}'.format(
            user=self.ssh_user,
            key=key.decode()
        )
628500
def get_configuration_dict(self, secret_attrs=False):
        """"""
        rd = {'name': self.name,
              'path': self.path,
              'git_dir': self.git_dir,
              'assumed_doc_version': self.assumed_doc_version,
              'doc_dir': self.doc_dir,
              'git_ssh': self.git_ssh, }
        if secret_attrs:
            rd['pkey'] = self.pkey
        with self._index_lock:
            si = self._doc_index
        r = _invert_dict_list_val(si)
        key_list = list(r.keys())
        rd['number of documents'] = len(key_list)
        key_list.sort()
        m = []
        for k in key_list:
            v = r[k]
            fp = k[2]
            assert fp.startswith(self.doc_dir)
            rp = fp[len(self.doc_dir) + 1:]
            m.append({'keys': v, 'relpath': rp})
        rd['documents'] = m
        return rd
870721
def network_configuration
      dns = settings.provider.network.dns
      dns = dns.split(",") if dns.is_a?(String)
      {
        "ip"=>public_ip,
        "netmask"=>settings.provider.network.netmask,
        "gateway"=>settings.provider.network.gateway,
        "dns"=>dns,
        "cloud_properties"=>{
          "name"=>settings.provider.network.name
        }
      }
    end
1307677
def cli(self):
        
        client = paramiko.SSHClient()
        client.set_missing_host_key_policy(paramiko.AutoAddPolicy())

        client.connect(hostname=self.private_hostname,
                       username=self.username,
                       key_filename=self.key_filename,
                       timeout=self.timeout,
                       look_for_keys=self.look_for_keys)
        # set keepalive
        transport = client.get_transport()
        transport.set_keepalive(3)
        return client