def SSLTransportInit(manager):

    #os.environ['ORBtraceLevel'] = '25'
    #os.environ['ORBendPoint'] = 'giop:ssl::'
    #os.environ['ORBsslVerifyMode'] = "none"

    prop = manager.getConfig()
    certificate_authority_file = prop.getProperty(
        "corba.ssl.certificate_authority_file")
    key_file = prop.getProperty("corba.ssl.key_file")
    key_file_password = prop.getProperty("corba.ssl.key_file_password")

    corba_args = prop.getProperty("corba.args")
    corba_args += " -ORBendPoint giop:ssl::"
    if not OpenRTM_aist.toBool(prop.getProperty(
            "manager.is_master"), "YES", "NO", True):
        if not prop.getProperty("corba.endpoints"):
            if not prop.getProperty("corba.endpoint"):
                if str(prop.getProperty("corba.args")).find(
                        "-ORBendPoint") == -1:
                    corba_args += " -ORBendPoint giop:tcp::"

    prop.setProperty("corba.args", corba_args)

    sslTP.certificate_authority_file(certificate_authority_file)
    sslTP.key_file(key_file)
    sslTP.key_file_password(key_file_password)
Exemple #2
0
    def _create_orb(self, orb=None):
        # Create the ORB, optionally checking the environment variable for
        # arguments to pass to the ORB.
        if orb:
            self._orb = orb
            self._orb_is_mine = False
        else:
            if ORB_SSL_ENABLE_ENV_VAR in os.environ:
                if os.environ[ORB_SSL_ENABLE_ENV_VAR] == 'YES':
                    from omniORB import sslTP
                    if ORB_SSL_CAFILE_ENV_VAR in os.environ:
                        sslTP.certificate_authority_file(
                            os.environ[ORB_SSL_CAFILE_ENV_VAR])
                    if ORB_SSL_KEYFILE_ENV_VAR in os.environ:
                        sslTP.key_file(os.environ[ORB_SSL_KEYFILE_ENV_VAR])
                    if ORB_SSL_KEYPASSWORD_ENV_VAR in os.environ:
                        sslTP.key_file_password(
                            os.environ[ORB_SSL_KEYPASSWORD_ENV_VAR])

            if ORB_HTTP_ENABLE_ENV_VAR in os.environ:
                if os.environ[ORB_HTTP_ENABLE_ENV_VAR] == 'YES':
                    from omniORB import httpTP
                    if ORB_HTTPS_CAFILE_ENV_VAR in os.environ:
                        httpTP.set_CA(
                            os.environ[ORB_HTTPS_CAFILE_ENV_VAR], None)
                    if ORB_HTTPS_KEYFILE_ENV_VAR in os.environ:
                        password = None
                        if ORB_HTTPS_KEYPASSWORD_ENV_VAR in os.environ:
                            password = os.environ[ORB_HTTPS_KEYPASSWORD_ENV_VAR]
                        httpTP.set_key(
                            os.environ[ORB_HTTPS_KEYFILE_ENV_VAR], password)

            if ORB_ARGS_ENV_VAR in os.environ:
                orb_args = os.environ[ORB_ARGS_ENV_VAR].split(';')
            else:
                orb_args = []
            self._orb = CORBA.ORB_init(orb_args)
            self._orb_is_mine = True
        # Run the POA manager
        self._poa = self._orb.resolve_initial_references('RootPOA')
        self._poa._get_the_POAManager().activate()