From: Anthony Geay Date: Tue, 15 Feb 2022 10:32:47 +0000 (+0100) Subject: First impl of SSL by default mode X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c213dc8dacb028572dd031fbd82275c8708c46e9;p=modules%2Fkernel.git First impl of SSL by default mode --- diff --git a/bin/runSalome.py b/bin/runSalome.py index 619f4dc3b..9935796df 100755 --- a/bin/runSalome.py +++ b/bin/runSalome.py @@ -263,15 +263,15 @@ class LoggerServer(Server): pass # end of LoggerServer class # --- - -class SessionServer(Server): +import abc +class CommonSessionServer(Server): def __init__(self,args,modules_list,modules_root_dir): self.args = args.copy() # Bug 11512 (Problems with runSalome --xterm on Mandrake and Debian Sarge) #self.args['xterm']=0 # self.initArgs() - self.SCMD1=['SALOME_Session_Server'] + self.SCMD1=[self.getSessionServerExe()] if "SQUISH_PREFIX" in os.environ: if platform.system() == "Windows" : self.SCMD1 = [os.path.join(os.getenv("SQUISH_PREFIX"), "bin", "dllpreload.exe"),os.path.join(os.getenv("SQUISH_SALOME_PATH"), "W64", "GUI", "bin", "salome", self.SCMD1[0])] @@ -345,6 +345,10 @@ class SessionServer(Server): self.SCMD2+=['--language=%s' % self.args['language']] pass + @abc.abstractmethod + def getSessionServerExe(self): + pass + def setpath(self,modules_list,modules_root_dir): list_modules = modules_list[:] list_modules.reverse() @@ -390,6 +394,14 @@ class SessionServer(Server): self.CMD = l + self.CMD pass +class SessionServer(CommonSessionServer): + def __init__(self,args,modules_list,modules_root_dir): + super().__init__(args,modules_list,modules_root_dir) + import KernelBasis + KernelBasis.setSSLMode(False) + + def getSessionServerExe(self): + return "SALOME_Session_Server" # --- class LauncherServer(Server): diff --git a/bin/runSalomeNoServer.py b/bin/runSalomeNoServer.py index f63e74a73..09e35e509 100755 --- a/bin/runSalomeNoServer.py +++ b/bin/runSalomeNoServer.py @@ -21,15 +21,16 @@ import setenv import runSalome import os -class NoSessionServer(runSalome.SessionServer): +class NoSessionServer(runSalome.CommonSessionServer): def __init__(self,args,modules_list,modules_root_dir): super().__init__(args,modules_list,modules_root_dir) for i in range (len(self.SCMD1)): if self.SCMD1[i] == "SALOME_Session_Server" : self.SCMD1[i] = "SALOME_Session_Server_No_Server" - os.putenv("SALOME_EMB_SERVANT", "1") SalomeAppSLConfig=os.getenv("SalomeAppConfig","") os.putenv("SalomeAppSLConfig", SalomeAppSLConfig) + def getSessionServerExe(self): + return "SALOME_Session_Server_No_Server" def main(): args, modules_list, modules_root_dir = setenv.get_config() diff --git a/bin/salomeContext.py b/bin/salomeContext.py index be7fc03d4..f86833e5a 100755 --- a/bin/salomeContext.py +++ b/bin/salomeContext.py @@ -39,23 +39,25 @@ Usage: salome [command] [options] [--config=] Commands: ========= - start Start a new SALOME instance. + start Start a new SALOME instance. Start a single SALOME_Session_Server_No_Server + process with environment relevant to the application and hosting all servants in it. context Initialize SALOME context. Current environment is extended. shell Initialize SALOME context, attached to the last created SALOME instance if any, and executes scripts passed as command arguments. User works in a Shell terminal. SALOME environment is set but application is not started. - connect Connect a Python console to the active SALOME instance. - remote run command in SALOME environment from remote call, ssh or rsh. - kill Terminate SALOME instances running on given ports for current user. - Port numbers must be separated by blank characters. - killall Terminate *all* SALOME running instances for current user. - Do not start a new one. test Run SALOME tests. info Display some information about SALOME. doc Show online module documentation (if available). Module names must be separated by blank characters. help Show this message. + remote run command in SALOME environment from remote call, ssh or rsh. + withsession Start a new SWS SALOME instance with multiple servers hosting all servants. + connect In SWS context, Connect a Python console to the active SALOME instance. + kill In SWS context, Terminate SALOME instances running on given ports for current user. + Port numbers must be separated by blank characters. + killall Terminate *all* SALOME running SWS instances for current user. + Do not start a new one. If no command is given, default is start. @@ -223,8 +225,8 @@ class SalomeContext: options = args[1:] availableCommands = { - 'start' : '_runAppli', - 'sessionless' : '_sessionless', + 'start' : '_sessionless', + 'withsession' : '_runAppli', 'context' : '_setContext', 'shell' : '_runSession', 'remote' : '_runRemote', @@ -273,7 +275,7 @@ class SalomeContext: usage() return 0 # try to default to "start" command - command = "_runAppli" + command = "_sessionless" try: res = getattr(self, command)(options) # run appropriate method @@ -570,7 +572,7 @@ Available options are: if "-v" in args or "--version" in args: print("Running with python", platform.python_version()) - return self._runAppli(["--version"]) + return self._sessionless(["--version"]) return 0 # diff --git a/src/Basics/KernelBasis.cxx b/src/Basics/KernelBasis.cxx index 6274ddcec..0129281cd 100644 --- a/src/Basics/KernelBasis.cxx +++ b/src/Basics/KernelBasis.cxx @@ -19,7 +19,7 @@ #include "KernelBasis.hxx" -static bool DEFAULT_SSL_MODE = false; +static bool DEFAULT_SSL_MODE = true; static bool GUI_MODE = false; // IOR of SALOME_Embedded_NamingService servant diff --git a/src/KERNEL_PY/__init__.py b/src/KERNEL_PY/__init__.py index 80449ac00..175a86c30 100644 --- a/src/KERNEL_PY/__init__.py +++ b/src/KERNEL_PY/__init__.py @@ -166,20 +166,15 @@ myStudy, myStudyName = None,None salome_initial=True -__EMB_SERVANT_ENV_VAR_NAME = "SALOME_EMB_SERVANT" - def standalone(): - import os - os.environ[__EMB_SERVANT_ENV_VAR_NAME] = "1" + pass + +def withServers(): import KernelBasis - KernelBasis.setSSLMode(True) + KernelBasis.setSSLMode(False) def salome_init(path=None, embedded=False): - import os import KernelBasis - if __EMB_SERVANT_ENV_VAR_NAME in os.environ: - KernelBasis.setSSLMode(True) - # if KernelBasis.getSSLMode(): if KernelBasis.getIOROfEmbeddedNS() == "": salome_init_without_session(path, embedded)