Checks if the current system is missing an SSLContext object
969915
def is_insecure_platform():
    
    v = sys.version_info
    if v.major == 3:
        return False  # Python 2 issue

    if v.major == 2 and v.minor == 7 and v.micro >= 9:
        return False  # >= 2.7.9 includes the new SSL updates

    try:
        import OpenSSL  # noqa
        import ndg  # noqa
        import pyasn1  # noqa
    except ImportError:
        pass
    return True
951719
def warn_if_insecure_platform():
    
    m = (
        "\n"
        "######################################################################################\n"  # noqa
        "#                                                                                    #\n"  # noqa
        "#  Your version of Python appears to be out of date and lack important security      #\n"  # noqa
        "#  features. Please update to Python >= 2.7.9 or `pip install requests[security]`.   #\n"  # noqa
        "#                                                                                    #\n"  # noqa
        "#  InsecurePlatformWarning: A true SSLContext object is not available. This          #\n"  # noqa
        "#  prevents urllib3 from configuring SSL appropriately and may cause certain         #\n"  # noqa
        "#  SSL connections to fail. For more information, see                                #\n"  # noqa
        "#  https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.  #\n"  # noqa
        "#                                                                                    #\n"  # noqa
        "######################################################################################\n"
    )  # noqa
    if is_insecure_platform():
        click.echo(m, err=True)
        return True
    else:
        cli_log.debug("Python SSLContext passed")
        return False
738325
def valid_server?(server, port = SSL_PORT)
      # cheating by shelling out to curl, because getting open-uri, or even net/http to use
      # ssl_options like :OP_NO_SSLv2 and :OP_NO_SSLv3 will take time to figure out..
      return true if `/usr/bin/curl -s 'https://#{server}:#{port}/#{TEST_PATH}'`.include? TEST_CONTENT
      return true if `/usr/bin/curl -s 'http://#{server}:#{port}/#{TEST_PATH}'`.include? TEST_CONTENT
      false

      # # try ssl first
      # # NOTE:  doesn't work if we can't disallow SSLv3 or force TLSv1
      # # See cheat above.
      # begin
      #   return true if open("https://#{server}:#{port}/#{TEST_PATH}", ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE).read.include? TEST_CONTENT
      #
      # rescue
      #   # then regular http
      #   begin
      #     return true if open("http://#{server}:#{port}/#{TEST_PATH}").read.include? TEST_CONTENT
      #   rescue
      #     # any errors = no API
      #     return false
      #   end # begin
      # end # begin
      # # if we're here, no API
      # false
    end
986398
def on_error(exc)
      case exc
      when Kontena::Websocket::SSLVerifyError
        if exc.cert
          error "unable to connect to SSL server with KONTENA_SSL_VERIFY=true: #{exc} (subject #{exc.subject}, issuer #{exc.issuer})"
        else
          error "unable to connect to SSL server with KONTENA_SSL_VERIFY=true: #{exc}"
        end

      when Kontena::Websocket::SSLConnectError
        error "unable to connect to SSL server: #{exc}"

      when Kontena::Websocket::ConnectError
        error "unable to connect to server: #{exc}"

      when Kontena::Websocket::ProtocolError
        error "unexpected response from server, check url: #{exc}"

      else
        error "websocket error: #{exc}"
      end
    end
1088270
function verifyConfiguration (req, sessionKey, cookie) {
  if (!getSecretBag(req, sessionKey, cookie)) {
    return false
  }

  if (cookie && cookie.signed && !req.secret) {
    return false
  }

  return true
}
64384
public boolean doesSSLConfigExist(String sslAliasName) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.entry(tc, "doesSSLConfigExist", new Object[] { sslAliasName });

        if (sslAliasName == null)
            throw new IllegalArgumentException("sslAliasName is null.");

        boolean exists = (null != SSLConfigManager.getInstance().getProperties(sslAliasName));

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.exit(tc, "doesSSLConfigExist -> " + exists);
        return exists;
    }
1049135
def check(cls):
        
        attribs = [
            'app_version',
            'app_name',
            'config_file_path',
            'config_sep_str',
        ]
        for attrib in attribs:
            if getattr(cls, attrib) == 'not_set':
                raise IncompleteSetupError(f'elib_config setup is incomplete; missing: {attrib}')
1267579
def after_start_check(self):
        
        try:
            if self.url.scheme == 'http':
                conn = HTTPConnection(self.host, self.port)
            elif self.url.scheme == 'https':
                ssl_context = None
                if not self.verify_tls:
                    ssl_context = ssl._create_unverified_context()
                conn = HTTPSConnection(
                    self.host,
                    self.port,
                    context=ssl_context,
                )
            else:
                raise ValueError(f'Unsupported URL scheme: "{self.url.scheme}"')

            self._send_request(conn)
            response = conn.getresponse()
            status = str(response.status)

            if not self._validate_response(response):
                return False

            if status == self.status or self.status_re.match(status):
                conn.close()
                return True

        except (HTTPException, socket.timeout, socket.error) as ex:
            log.debug('Executor process not healthy yet', command=self.command, error=ex)
            time.sleep(.05)
            return False

        return False
773176
def respond_to_missing?(name, _include_private = false)
      str_name = name.to_s
      key?(name.to_sym) || %w[? !].any?(&str_name.method(:end_with?)) || super
    end
632066
def enable_tls(context = SMTP.default_ssl_context)
      raise 'openssl library not installed' unless defined?(OpenSSL)
      raise ArgumentError, "SMTPS and STARTTLS is exclusive" if @starttls
      @tls = true
      @ssl_context = context
    end
67004
def is_ssl_error(error=None):
    """"""
    if error is None:
        error = sys.exc_info()[1]
    from OpenSSL import SSL
    return isinstance(error, SSL.Error)
98098
function checkTLSOptions(queryString) {
  const queryStringKeys = Object.keys(queryString);
  if (
    queryStringKeys.indexOf('tlsInsecure') !== -1 &&
    (queryStringKeys.indexOf('tlsAllowInvalidCertificates') !== -1 ||
      queryStringKeys.indexOf('tlsAllowInvalidHostnames') !== -1)
  ) {
    throw new MongoParseError(
      'The `tlsInsecure` option cannot be used with `tlsAllowInvalidCertificates` or `tlsAllowInvalidHostnames`.'
    );
  }

  const tlsValue = assertTlsOptionsAreEqual('tls', queryString, queryStringKeys);
  const sslValue = assertTlsOptionsAreEqual('ssl', queryString, queryStringKeys);

  if (tlsValue != null && sslValue != null) {
    if (tlsValue !== sslValue) {
      throw new MongoParseError('All values of `tls` and `ssl` must be the same.');
    }
  }
}
509635
def _check_ssh(self, *args):
        """"""
        ssh = subprocess.Popen(
            args,
            stdin=subprocess.DEVNULL,
            stdout=subprocess.DEVNULL,
            stderr=subprocess.DEVNULL)
        ssh.wait()
        return ssh.returncode == 0
447459
def vserver_sslcert_add(v_name, sc_name, **connection_args):
    '''
    
    '''
    ret = True
    if vserver_sslcert_exists(v_name, sc_name, **connection_args):
        return False
    nitro = _connect(**connection_args)
    if nitro is None:
        return False
    sslcert = NSSSLVServerSSLCertKeyBinding()
    sslcert.set_vservername(v_name)
    sslcert.set_certkeyname(sc_name)
    try:
        NSSSLVServerSSLCertKeyBinding.add(nitro, sslcert)
    except NSNitroError as error:
        log.debug('netscaler module error - NSSSLVServerSSLCertKeyBinding.add() failed: %s', error)
        ret = False
    _disconnect(nitro)
    return ret
708804
private static function check() {

        foreach(['openssl'] as $extension) {

            if(false === extension_loaded($extension)) {
                return trigger_error(sprintf('Extension "%s" should be loaded to use %s', $extension, __CLASS__), E_USER_ERROR);
            }
        }
    }
872330
def _assert_ssl_exc_contains(exc, *msgs):
    """"""
    if len(msgs) < 1:
        raise TypeError(
            '_assert_ssl_exc_contains() requires '
            'at least one message to be passed.',
        )
    err_msg_lower = str(exc).lower()
    return any(m.lower() in err_msg_lower for m in msgs)
816835
private function areNullableReturnTypesSupported(): bool
    {
        $testVersion = trim(PHPCompatibility\PHPCSHelper::getConfigData('testVersion') ?: '');
        if (!$testVersion) {
            return false;
        }

        preg_match('`^(\d+\.\d+)(?:\s*-\s*(?:\d+\.\d+)?)?$`', $testVersion, $matches);
        $min = $matches[1] ?? null;

        return $min && version_compare($min, '7.1', '>=');
    }