Check that ssl is enabled on listed rmq juju sentry units.

        :param sentry_units: list of all rmq sentry units
        :returns: True if successful.  Raise on error.
168823
def validate_rmq_ssl_disabled_units(self, sentry_units):
        
        for sentry_unit in sentry_units:
            if self.rmq_ssl_is_enabled_on_unit(sentry_unit):
                return ('Unexpected condition:  ssl is enabled on unit '
                        '({})'.format(sentry_unit.info['unit_name']))
        return None
377322
def enable_encryption(self):
        
        try:
            self.send_state_event("m.room.encryption",
                                  {"algorithm": "m.megolm.v1.aes-sha2"})
            self.encrypted = True
            return True
        except MatrixRequestError:
            return False
1179801
def _setup_sentry_client(context):
    """"""

    # get_secret will be deprecated soon
    dsn = os.environ.get("SENTRY_DSN")
    try:
        client = raven.Client(dsn, sample_rate=SENTRY_SAMPLE_RATE)
        client.user_context(_sentry_context_dict(context))
        return client
    except:
        rlogger.error("Raven client error", exc_info=True)
        return None
544358
def get_ubuntu_release_from_sentry(self, sentry_unit):
        
        msg = None
        cmd = 'lsb_release -cs'
        release, code = sentry_unit.run(cmd)
        if code == 0:
            self.log.debug('{} lsb_release: {}'.format(
                sentry_unit.info['unit_name'], release))
        else:
            msg = ('{} `{}` returned {} '
                   '{}'.format(sentry_unit.info['unit_name'],
                               cmd, release, code))
        if release not in self.ubuntu_releases:
            msg = ("Release ({}) not found in Ubuntu releases "
                   "({})".format(release, self.ubuntu_releases))
        return release, msg
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)
110375
def get_requests_for_local_unit(relation_name=None):
    
    local_name = local_unit().replace('/', '_')
    raw_certs_key = '{}.processed_requests'.format(local_name)
    relation_name = relation_name or 'certificates'
    bundles = []
    for rid in relation_ids(relation_name):
        for unit in related_units(rid):
            data = relation_get(rid=rid, unit=unit)
            if data.get(raw_certs_key):
                bundles.append({
                    'ca': data['ca'],
                    'chain': data.get('chain'),
                    'certs': json.loads(data[raw_certs_key])})
    return bundles
1310176
def is_request_sent(request, relation='ceph'):
    
    states = get_request_states(request, relation=relation)
    for rid in states.keys():
        if not states[rid]['sent']:
            return False

    return True
649658
def add_ssl_termination(self, loadbalancer, securePort, privatekey, certificate,
            intermediateCertificate, enabled=True, secureTrafficOnly=False):
        
        uri = "/loadbalancers/%s/ssltermination" % utils.get_id(loadbalancer)
        req_body = {"sslTermination": {
                "certificate": certificate,
                "enabled": enabled,
                "secureTrafficOnly": secureTrafficOnly,
                "privatekey": privatekey,
                "intermediateCertificate": intermediateCertificate,
                "securePort": securePort,
                }}
        resp, body = self.api.method_put(uri, body=req_body)
        return body
1198279
public static boolean isRestSSLAuthenticationEnabled(Configuration sslConfig) {
		checkNotNull(sslConfig, "sslConfig");
		return isRestSSLEnabled(sslConfig) &&
			sslConfig.getBoolean(SecurityOptions.SSL_REST_AUTHENTICATION_ENABLED);
	}
678315
def sentry_feature(app):
    

    # get keys
    sentry_public_key = app.config.get('SENTRY_PUBLIC_KEY')
    sentry_project_id = app.config.get('SENTRY_PROJECT_ID')
    if not sentry_public_key or not sentry_project_id:
        return

    # prepare dsn
    dsn = 'https://{key}@sentry.io/{project_id}'
    dsn = dsn.format(key=sentry_public_key, project_id=sentry_project_id)

    # init sentry
    sentry.init_app(app=app, dsn=dsn)
1081724
def check_ssl():
    """"""
    try:
        import ssl
    except:
        log.warning('Error importing SSL module', stack_info=True)
        print(SSL_ERROR_MESSAGE)
        sys.exit(1)
    else:
        log.info('SSL module is available')
        return ssl
830155
def check(sensor_class, args):
        
        parser = SensorCmdLine.parsers(sensor_class)
        parsed = parser.parse_args(args)
        return sensor_class.check(json.loads(parsed.data))
1198044
def _is_ignored_read_event(request):
    
    if (
        django.conf.settings.LOG_IGNORE_TRUSTED_SUBJECT
        and d1_gmn.app.auth.is_trusted_subject(request)
    ):
        return True
    if (
        django.conf.settings.LOG_IGNORE_NODE_SUBJECT
        and d1_gmn.app.auth.is_client_side_cert_subject(request)
    ):
        return True
    if _has_regex_match(
        request.META['REMOTE_ADDR'], django.conf.settings.LOG_IGNORE_IP_ADDRESS
    ):
        return True
    if _has_regex_match(
        request.META.get('HTTP_USER_AGENT', '<not provided>'),
        django.conf.settings.LOG_IGNORE_USER_AGENT,
    ):
        return True
    if _has_regex_match(
        request.primary_subject_str, django.conf.settings.LOG_IGNORE_SUBJECT
    ):
        return True
    return False
868389
def validate_ssl_certificate(self, client):
        
        response = client.request('GET', 'https://api.twilio.com:8443')

        if response.status_code < 200 or response.status_code >= 300:
            raise TwilioRestException(response.status_code, 'https://api.twilio.com:8443', 'Failed to validate SSL certificate')
1102840
function is_https(req) {
	if(req.headers && req.headers['x-forwarded-proto'] && req.headers['x-forwarded-proto'] === 'https') { return true; }
	return (req && req.connection && req.connection.encrypted) ? true : false;
}
120235
def is_unit_exist(unit_id):
    
    attribute = 'objectClass'
    response = LDAP_search(
        pattern_search="(uniqueidentifier={})".format(unit_id),
        attribute=attribute
    )
    try:
        unit_exist = 'EPFLorganizationalUnit' in response[0]['attributes'][attribute]
    except Exception:
        return False

    return unit_exist
945162
async def query_available_abilities(
        self, units: Union[List[Unit], "Units"], ignore_resource_requirements: bool = False
    ) -> List[List[AbilityId]]:
        
        if not isinstance(units, list):
            """ Deprecated, accepting a single unit may be removed in the future, query a list of units instead """
            assert isinstance(units, Unit)
            units = [units]
            input_was_a_list = False
        else:
            input_was_a_list = True
        assert units
        result = await self._execute(
            query=query_pb.RequestQuery(
                abilities=[query_pb.RequestQueryAvailableAbilities(unit_tag=unit.tag) for unit in units],
                ignore_resource_requirements=ignore_resource_requirements,
            )
        )
        """ Fix for bots that only query a single unit """
        if not input_was_a_list:
            return [[AbilityId(a.ability_id) for a in b.abilities] for b in result.query.abilities][0]
        return [[AbilityId(a.ability_id) for a in b.abilities] for b in result.query.abilities]