diff --git a/Orchestrator/OrchestratorSettings.py b/Orchestrator/OrchestratorSettings.py index c7cab19d..41c98b75 100644 --- a/Orchestrator/OrchestratorSettings.py +++ b/Orchestrator/OrchestratorSettings.py @@ -24,13 +24,8 @@ elif __name__ == "__main__": # New init way - allow run as module -m PyOpenRPA.O # TEST Add Supertoken for the all access between robots Orchestrator.UACSuperTokenUpdate(inGSettings=gSettings, inSuperTokenStr="1992-04-03-0643-ru-b4ff-openrpa52zzz") - # Add 2 interfaces! - gSettings["ServerDict"]["ListenDict"]["Int2"]={ - "AddressStr":"", - "PortInt":8080, - "CertFilePEMPathStr":"test.pem", - "ServerInstance": None - } + # Add first interface! + Orchestrator.WebListenCreate(inGSettings=gSettings) # Restore DUMP Orchestrator.OrchestratorSessionRestore(inGSettings=gSettings) diff --git a/Sources/pyOpenRPA/Orchestrator/BackwardCompatibility.py b/Sources/pyOpenRPA/Orchestrator/BackwardCompatibility.py index d1d128e6..2bfac13b 100644 --- a/Sources/pyOpenRPA/Orchestrator/BackwardCompatibility.py +++ b/Sources/pyOpenRPA/Orchestrator/BackwardCompatibility.py @@ -463,6 +463,7 @@ def Update(inGSettings): "AddressStr": "", "PortInt": lPortInt, "CertFilePEMPathStr": None, + "KeyFilePathStr": None, "ServerInstance": None } } diff --git a/Sources/pyOpenRPA/Orchestrator/Server.py b/Sources/pyOpenRPA/Orchestrator/Server.py index ebafc1d8..76cfea8a 100644 --- a/Sources/pyOpenRPA/Orchestrator/Server.py +++ b/Sources/pyOpenRPA/Orchestrator/Server.py @@ -540,7 +540,9 @@ class RobotDaemonServer(Thread): lAddressStr=lServerDict["AddressStr"] lPortInt=lServerDict["PortInt"] lCertFilePathStr = lServerDict["CertFilePEMPathStr"] + lKeyFilePathStr = lServerDict["KeyFilePathStr"] if lCertFilePathStr == "": lCertFilePathStr = None + if lKeyFilePathStr == "": lKeyFilePathStr = None # Server settings # Choose port 8080, for port 80, which is normally used for a http server, you need root access server_address = (lAddressStr, lPortInt) @@ -548,7 +550,10 @@ class RobotDaemonServer(Thread): #httpd.serve_forever() httpd = ThreadedHTTPServer(server_address, testHTTPServer_RequestHandler) if lCertFilePathStr is not None: - httpd.socket = ssl.wrap_socket(httpd.socket, server_side=True, certfile=lCertFilePathStr) + if lKeyFilePathStr is not None: + httpd.socket = ssl.wrap_socket(httpd.socket, server_side=True, certfile=lCertFilePathStr, keyfile=lKeyFilePathStr) + else: + httpd.socket = ssl.wrap_socket(httpd.socket, server_side=True, certfile=lCertFilePathStr) if lL: lL.info(f"Web Server init (with SSL). Name: {self.name}, Listen URL: {lAddressStr}, Listen port: {lPortInt}, Cert path: {lCertFilePathStr}") else: if lL: lL.info(f"Web Server init. Name: {self.name}, Listen URL: {lAddressStr}, Listen port: {lPortInt}") diff --git a/Sources/pyOpenRPA/Orchestrator/SettingsTemplate.py b/Sources/pyOpenRPA/Orchestrator/SettingsTemplate.py index fa523301..923a0ce1 100644 --- a/Sources/pyOpenRPA/Orchestrator/SettingsTemplate.py +++ b/Sources/pyOpenRPA/Orchestrator/SettingsTemplate.py @@ -45,12 +45,13 @@ def __Create__(): "WorkingDirectoryPathStr": None, # Will be filled automatically "RequestTimeoutSecFloat": 300, # Time to handle request in seconds, "ListenDict": { # Prototype - "Default":{ - "AddressStr":"", - "PortInt":80, - "CertFilePEMPathStr":"", - "ServerInstance": None - } + #"Default":{ + # "AddressStr":"", + # "PortInt":80, + # "CertFilePEMPathStr":None, + # "KeyFilePathStr":None, + # "ServerInstance": None + #} }, "AccessUsers": { # Default - all URL is blocked "FlagCredentialsAsk": True, # Turn on Authentication diff --git a/Sources/pyOpenRPA/Orchestrator/__Orchestrator__.py b/Sources/pyOpenRPA/Orchestrator/__Orchestrator__.py index f3f9f5f6..366db88b 100644 --- a/Sources/pyOpenRPA/Orchestrator/__Orchestrator__.py +++ b/Sources/pyOpenRPA/Orchestrator/__Orchestrator__.py @@ -577,6 +577,27 @@ def WebURLConnectFile(inGSettings, inMethodStr, inURLStr, inMatchTypeStr, inFile } inGSettings["ServerDict"]["URLList"].append(lURLItemDict) +def WebListenCreate(inGSettings, inServerKeyStr="Default", inAddressStr="", inPortInt=80, inCertFilePEMPathStr=None, inKeyFilePathStr=None): + """ + Create listen interface for the web server + + :param inGSettings: Global settings dict (singleton) + :param inAddressStr: IP interface to listen + :param inPortInt: Port int to listen for HTTP default is 80; for HTTPS default is 443 + :param inCertFilePEMPathStr: Path to .pem (base 64) certificate. Required for SSL connection. ATTENTION - do not use certificate with password + :param inKeyFilePathStr: Path to the private key file + :return: + """ + + inGSettings["ServerDict"]["ListenDict"][inServerKeyStr]={ + "AddressStr":inAddressStr, + "PortInt":inPortInt, + "CertFilePEMPathStr":inCertFilePEMPathStr, + "KeyFilePathStr":inKeyFilePathStr, + "ServerInstance": None + } + + def WebCPUpdate(inGSettings, inCPKeyStr, inHTMLRenderDef=None, inJSONGeneratorDef=None, inJSInitGeneratorDef=None): """ Add control panel HTML, JSON generator or JS when page init diff --git a/Wiki/ENG_Guide/html/Orchestrator/02_Defs.html b/Wiki/ENG_Guide/html/Orchestrator/02_Defs.html index 988250de..7de85958 100644 --- a/Wiki/ENG_Guide/html/Orchestrator/02_Defs.html +++ b/Wiki/ENG_Guide/html/Orchestrator/02_Defs.html @@ -417,22 +417,25 @@

WebCPUpdate(inGSettings, inCPKeyStr[, …])

Add control panel HTML, JSON generator or JS when page init

-

WebURLConnectDef(inGSettings, inMethodStr, …)

+

WebListenCreate(inGSettings[, …])

+

Create listen interface for the web server

+ +

WebURLConnectDef(inGSettings, inMethodStr, …)

Connect URL to DEF

-

WebURLConnectFile(inGSettings, inMethodStr, …)

+

WebURLConnectFile(inGSettings, inMethodStr, …)

Connect URL to File

-

WebURLConnectFolder(inGSettings, …)

+

WebURLConnectFolder(inGSettings, …)

Connect URL to Folder

-

WebUserInfoGet(inRequest)

+

WebUserInfoGet(inRequest)

Return User info about request

-

WebUserIsSuperToken(inRequest, inGSettings)

+

WebUserIsSuperToken(inRequest, inGSettings)

Return bool if request is authentificated with supetoken (token which is never expires)

-

WebUserUACHierarchyGet(inRequest)

+

WebUserUACHierarchyGet(inRequest)

Return User UAC Hierarchy DICT Return {…}

@@ -1805,6 +1808,26 @@ Var 2 (Backward compatibility): inGSettings, inRDPSessionKeyStr, inHostStr, inPo +
+
+pyOpenRPA.Orchestrator.__Orchestrator__.WebListenCreate(inGSettings, inServerKeyStr='Default', inAddressStr='', inPortInt=80, inCertFilePEMPathStr=None, inKeyFilePathStr=None)[source]
+

Create listen interface for the web server

+
+
Parameters
+
    +
  • inGSettings – Global settings dict (singleton)

  • +
  • inAddressStr – IP interface to listen

  • +
  • inPortInt – Port int to listen for HTTP default is 80; for HTTPS default is 443

  • +
  • inCertFilePEMPathStr – Path to .pem (base 64) certificate. Required for SSL connection. ATTENTION - do not use certificate with password

  • +
  • inKeyFilePathStr – Path to the private key file

  • +
+
+
Returns
+

+
+
+
+
pyOpenRPA.Orchestrator.__Orchestrator__.WebURLConnectDef(inGSettings, inMethodStr, inURLStr, inMatchTypeStr, inDef, inContentTypeStr='application/octet-stream')[source]
diff --git a/Wiki/ENG_Guide/html/Orchestrator/03_gSettingsTemplate.html b/Wiki/ENG_Guide/html/Orchestrator/03_gSettingsTemplate.html index ab177fa2..235974da 100644 --- a/Wiki/ENG_Guide/html/Orchestrator/03_gSettingsTemplate.html +++ b/Wiki/ENG_Guide/html/Orchestrator/03_gSettingsTemplate.html @@ -232,12 +232,13 @@ "WorkingDirectoryPathStr": None, # Will be filled automatically "RequestTimeoutSecFloat": 300, # Time to handle request in seconds, "ListenDict": { # Prototype - "Default":{ - "AddressStr":"", - "PortInt":80, - "CertFilePEMPathStr":"", - "ServerInstance": None - } + #"Default":{ + # "AddressStr":"", + # "PortInt":80, + # "CertFilePEMPathStr":None, + # "KeyFilePathStr":None, + # "ServerInstance": None + #} }, "AccessUsers": { # Default - all URL is blocked "FlagCredentialsAsk": True, # Turn on Authentication diff --git a/Wiki/ENG_Guide/html/Orchestrator/04_HowToUse.html b/Wiki/ENG_Guide/html/Orchestrator/04_HowToUse.html index 3d81484f..3fe32ea4 100644 --- a/Wiki/ENG_Guide/html/Orchestrator/04_HowToUse.html +++ b/Wiki/ENG_Guide/html/Orchestrator/04_HowToUse.html @@ -219,13 +219,8 @@ # TEST Add Supertoken for the all access between robots Orchestrator.UACSuperTokenUpdate(inGSettings=gSettings, inSuperTokenStr="1992-04-03-0643-ru-b4ff-openrpa52zzz") - # Add 2 interfaces! - gSettings["ServerDict"]["ListenDict"]["Int2"]={ - "AddressStr":"", - "PortInt":8080, - "CertFilePEMPathStr":"test.pem", - "ServerInstance": None - } + # Add first interface! + Orchestrator.WebListenCreate(inGSettings=gSettings) # Restore DUMP Orchestrator.OrchestratorSessionRestore(inGSettings=gSettings) diff --git a/Wiki/ENG_Guide/html/_modules/pyOpenRPA/Orchestrator/__Orchestrator__.html b/Wiki/ENG_Guide/html/_modules/pyOpenRPA/Orchestrator/__Orchestrator__.html index 3e32b116..ba5d1a6a 100644 --- a/Wiki/ENG_Guide/html/_modules/pyOpenRPA/Orchestrator/__Orchestrator__.html +++ b/Wiki/ENG_Guide/html/_modules/pyOpenRPA/Orchestrator/__Orchestrator__.html @@ -758,6 +758,27 @@ } inGSettings["ServerDict"]["URLList"].append(lURLItemDict) +
[docs]def WebListenCreate(inGSettings, inServerKeyStr="Default", inAddressStr="", inPortInt=80, inCertFilePEMPathStr=None, inKeyFilePathStr=None): + """ + Create listen interface for the web server + + :param inGSettings: Global settings dict (singleton) + :param inAddressStr: IP interface to listen + :param inPortInt: Port int to listen for HTTP default is 80; for HTTPS default is 443 + :param inCertFilePEMPathStr: Path to .pem (base 64) certificate. Required for SSL connection. ATTENTION - do not use certificate with password + :param inKeyFilePathStr: Path to the private key file + :return: + """ + + inGSettings["ServerDict"]["ListenDict"][inServerKeyStr]={ + "AddressStr":inAddressStr, + "PortInt":inPortInt, + "CertFilePEMPathStr":inCertFilePEMPathStr, + "KeyFilePathStr":inKeyFilePathStr, + "ServerInstance": None + }
+ +
[docs]def WebCPUpdate(inGSettings, inCPKeyStr, inHTMLRenderDef=None, inJSONGeneratorDef=None, inJSInitGeneratorDef=None): """ Add control panel HTML, JSON generator or JS when page init diff --git a/Wiki/ENG_Guide/html/genindex.html b/Wiki/ENG_Guide/html/genindex.html index 820d613e..c4fca017 100644 --- a/Wiki/ENG_Guide/html/genindex.html +++ b/Wiki/ENG_Guide/html/genindex.html @@ -474,12 +474,14 @@
  • WebCPUpdate() (in module pyOpenRPA.Orchestrator.__Orchestrator__)
  • -
  • WebURLConnectDef() (in module pyOpenRPA.Orchestrator.__Orchestrator__) +
  • WebListenCreate() (in module pyOpenRPA.Orchestrator.__Orchestrator__)
  • -
  • WebURLConnectFile() (in module pyOpenRPA.Orchestrator.__Orchestrator__) +
  • WebURLConnectDef() (in module pyOpenRPA.Orchestrator.__Orchestrator__)