Authenticate and get the name of assigned SFDC data server
329043
def make_session(self):
        """"""
        with connect_lock:
            if self._sf_session is None:
                sf_session = requests.Session()
                # TODO configurable class Salesforce***Auth
                sf_session.auth = SalesforcePasswordAuth(db_alias=self.alias,
                                                         settings_dict=self.settings_dict)
                sf_instance_url = sf_session.auth.instance_url
                sf_requests_adapter = HTTPAdapter(max_retries=get_max_retries())
                sf_session.mount(sf_instance_url, sf_requests_adapter)
                # Additional headers work, but the same are added automatically by "requests' package.
                # sf_session.header = {'accept-encoding': 'gzip, deflate', 'connection': 'keep-alive'} # TODO
                self._sf_session = sf_session
1073901
def get_rackspace_info(connection,
                       server_id):
    
    server = connection.servers.get(server_id)

    data = {}
    data['ip_address'] = server.accessIPv4
    data['accessIPv4'] = server.accessIPv4
    data['accessIPv6'] = server.accessIPv6
    data['addresses'] = server.addresses
    data['created'] = server.created
    data['flavor'] = server.flavor
    data['id'] = server.hostId
    data['human_id'] = server.human_id
    data['image'] = server.image['id']
    data['key_name'] = server.key_name
    data['state'] = server.status
    data['metadata'] = server.metadata
    data['name'] = server.name
    data['networks'] = server.networks
    data['tenant_id'] = server.tenant_id
    data['user_id'] = server.user_id
    data['cloud_type'] = 'rackspace'
    return data
980917
def _get_connection_info():
    """"""

    info = 'Connection: %s,' % CONN.url
    if CONN.creds is not None:
        info += ' userid=%s,' % CONN.creds[0]
    else:
        info += ' no creds,'

    info += ' cacerts=%s,' % ('sys-default' if CONN.ca_certs is None
                              else CONN.ca_certs)

    info += ' verifycert=%s,' % ('off' if CONN.no_verification else 'on')

    info += ' default-namespace=%s' % CONN.default_namespace
    if CONN.x509 is not None:
        info += ', client-cert=%s' % CONN.x509['cert_file']
        try:
            kf = CONN.x509['key_file']
        except KeyError:
            kf = "none"
        info += ":%s" % kf

    if CONN.timeout is not None:
        info += ', timeout=%s' % CONN.timeout

    # pylint: disable=protected-access
    info += ' stats=%s, ' % ('on' if CONN._statistics else 'off')

    info += 'log=%s' % ('on' if CONN._operation_recorders else 'off')

    if isinstance(CONN, FakedWBEMConnection):
        info += ', mock-server'

    return fill(info, 78, subsequent_indent='    ')
381400
def server_info(self, verbose=False):
        '''
        
        '''
        url = '{}/{}'.format(self.rest_url, 'serverinfo')
        return self.__auth_req_get(url, verbose=verbose)
212550
def server_by_name(name, profile=None, **kwargs):
    '''
    
    '''
    conn = _auth(profile, **kwargs)
    return conn.server_by_name(name)
971019
def Credentials(self):
		

		return(clc.v2.API.Call('GET','servers/%s/%s/credentials' % (self.alias,self.name),session=self.session))
1192599
def authenticate(self):
        '''
        
        '''
        log.debug('Authenticate to %s:%d, using the certificate %s',
                  self.address, self.port, self.certificate)
        if ':' in self.address:
            skt_ver = socket.AF_INET6
        else:
            skt_ver = socket.AF_INET
        skt = socket.socket(skt_ver, socket.SOCK_STREAM)
        self.ssl_skt = ssl.wrap_socket(skt,
                                       ca_certs=self.certificate,
                                       cert_reqs=ssl.CERT_REQUIRED)
        try:
            self.ssl_skt.connect((self.address, self.port))
            self.auth_try_id = 0
        except socket.error as err:
            log.error('Unable to open the SSL socket.')
            self.auth_try_id += 1
            if not self.max_try or self.auth_try_id < self.max_try:
                log.error('Trying to authenticate again in %d seconds', self.timeout)
                time.sleep(self.timeout)
                self.authenticate()
            log.critical('Giving up, unable to authenticate to %s:%d using the certificate %s',
                         self.address, self.port, self.certificate)
            raise ClientConnectException(err)

        # Explicit INIT
        self.ssl_skt.write(defaults.MAGIC_REQ)
        # Receive the private key
        private_key = self.ssl_skt.recv(defaults.BUFFER_SIZE)
        # Send back explicit ACK
        self.ssl_skt.write(defaults.MAGIC_ACK)
        # Read the hex of the verification key
        verify_key_hex = self.ssl_skt.recv(defaults.BUFFER_SIZE)
        # Send back explicit ACK
        self.ssl_skt.write(defaults.MAGIC_ACK)
        self.priv_key = nacl.secret.SecretBox(private_key)
        self.verify_key = nacl.signing.VerifyKey(verify_key_hex, encoder=nacl.encoding.HexEncoder)
564718
def ssh_get_info(node):
    """"""
    ssh_key = ""
    if node.cloud == "aws":
        raw_key = node.extra['key_name']
        ssh_key = "-i {0}{1}.pem ".format(CONFIG_DIR, raw_key)
        ssh_user = ssh_calc_aws(node)
    elif node.cloud == "azure":
        ssh_user = node.extra['properties']['osProfile']['adminUsername']
    elif node.cloud == "gcp":
        items = node.extra['metadata'].get('items', [{}])
        keyname = items['key' == 'ssh-keys'].get('value', "")
        pos = keyname.find(":")
        ssh_user = keyname[0:pos]
    elif node.cloud == "alicloud":
        ssh_user = ""
    return ssh_user, ssh_key
1097790
def floating_ip_associate(self, server_name, floating_ip):
        '''
        
        '''
        nt_ks = self.compute_conn
        server_ = self.server_by_name(server_name)
        server = nt_ks.servers.get(server_.__dict__['id'])
        server.add_floating_ip(floating_ip)
        return self.floating_ip_list()[floating_ip]
1253435
def server_show(server_id, profile=None, **kwargs):
    '''
    
    '''
    conn = _auth(profile, **kwargs)
    return conn.server_show(server_id)
8401
def servicegroup_server_exists(sg_name, s_name, s_port=None, **connection_args):
    '''
    
    '''
    return _servicegroup_get_server(sg_name, s_name, s_port, **connection_args) is not None
1365965
public function getServerSignature()
    {

        // try to load the OS identifier
        list($os, ) = sscanf(strtolower(php_uname('s')), '%s %s');

        // check if we've a file with the actual version number
        if (file_exists($filename = $this->getConfDir('/.release-version'))) {
            $version = file_get_contents($filename);
        } else {
            $version = 'dev-' . gethostname();
        }

        // prepare and return the server signature
        return sprintf('appserver/%s (%s) PHP/%s', $version, $os, PHP_VERSION);
    }
325983
def main():
    """"""
    server_configs = ServerConfig.get('sat1'), ServerConfig.get('sat2')
    for server_config in server_configs:
        org = Organization(server_config).search(
            query={'search': 'name="Default_Organization"'}
        )[0]
        # The LDAP authentication source with an ID of 1 is internal. It is
        # nearly guaranteed to exist and be functioning.
        user = User(
            server_config,
            auth_source=1,  # or: AuthSourceLDAP(server_config, id=1),
            login='Alice',
            mail='alice@example.com',
            organization=[org],
            password='hackme',
        ).create()
        pprint(user.get_values())
563925
function(args, cb) {
    var ssn = this.getSessionById(args.sessionId);
    if (!this._authFn) {
      var nodeEnv = process.env.NODE_ENV || "development";
      if (nodeEnv !== "development") {
        var msg = "The Node server you are connecting to appears "
        + "to be a production server, and yet its Vantage.js "
        + "instance does not support any means of authentication. \n"
        + "To connect to this server without authentication, "
        + "ensure its 'NODE_ENV' environmental variable is set "
        + "to 'development' (it is currently '" + nodeEnv + "').";
        ssn.log(chalk.yellow(msg));
        ssn.authenticating = false;
        ssn.authenticated = false;
        cb(msg, false);
      } else {
        ssn.authenticating = false;
        ssn.authenticated = true;
        cb(void 0, true);
      }
    } else {
      this._authFn.call(ssn, args, function(message, authenticated) {
        ssn.authenticating = false;
        ssn.authenticated = authenticated;
        if (authenticated === true) {
          cb(void 0, true);
        } else {
          cb(message);
        }
      });
    }
  }
900952
def authenticationReject():
    """"""
    a = TpPd(pd=0x5)
    b = MessageType(mesType=0x11)  # 00010001
    packet = a / b
    return packet
382419
def get_session_data(ctx, username, password, salt, server_public, private, preset):
    """"""
    session = SRPClientSession(
        SRPContext(username, password, prime=preset[0], generator=preset[1]),
        private=private)

    session.process(server_public, salt, base64=True)

    click.secho('Client session key: %s' % session.key_b64)
    click.secho('Client session key proof: %s' % session.key_proof_b64)
    click.secho('Client session key hash: %s' % session.key_proof_hash_b64)
23551
def get_sftp_conn(config):
    """"""
    remote = config.get('remote_location')
    parts = urlparse(remote)

    if ':' in parts.netloc:
        hostname, port = parts.netloc.split(':')
    else:
        hostname = parts.netloc
        port = 22
    port = int(port)

    username = config.get('remote_username') or getuser()
    luser = get_local_user(username)
    sshdir = get_ssh_dir(config, luser)
    hostkey = get_host_keys(hostname, sshdir)

    try:
        sftp = None
        keys = get_ssh_keys(sshdir)
        transport = Transport((hostname, port))
        while not keys.empty():
            try:
                key = PKey.from_private_key_file(keys.get())
                transport.connect(
                    hostkey=hostkey,
                    username=username,
                    password=None,
                    pkey=key)
                sftp = SFTPClient.from_transport(transport)
                break
            except (PasswordRequiredException, SSHException):
                pass
        if sftp is None:
            raise SaChannelUpdateTransportError("SFTP connection failed")
        return sftp, transport
    except BaseException as msg:
        raise SaChannelUpdateTransportError(msg)