Add WebAuditLog + SSL support

dev-linux
Ivan Maslov 4 years ago
parent fa8f15329d
commit fed27536d6

@ -24,6 +24,14 @@ elif __name__ == "__main__": # New init way - allow run as module -m PyOpenRPA.O
# TEST Add Supertoken for the all access between robots # TEST Add Supertoken for the all access between robots
Orchestrator.UACSuperTokenUpdate(inGSettings=gSettings, inSuperTokenStr="1992-04-03-0643-ru-b4ff-openrpa52zzz") 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
}
# Restore DUMP # Restore DUMP
Orchestrator.OrchestratorSessionRestore(inGSettings=gSettings) Orchestrator.OrchestratorSessionRestore(inGSettings=gSettings)

@ -455,3 +455,16 @@ def Update(inGSettings):
} }
if lL: lL.warning( if lL: lL.warning(
f"Backward compatibility (v1.2.1 to v1.2.2): Add new key RecoveryDict in ProcessorDict > RobotRDPActive") # Log about compatibility f"Backward compatibility (v1.2.1 to v1.2.2): Add new key RecoveryDict in ProcessorDict > RobotRDPActive") # Log about compatibility
# Add new key ServerDict > ListenDict
if "ListenDict" not in inGSettings["ServerDict"]:
lPortInt = inGSettings.get("ServerDict",{}).get("ListenPort",80)
inGSettings["ServerDict"]["ListenDict"] = {
"Default": {
"AddressStr": "",
"PortInt": lPortInt,
"CertFilePEMPathStr": None,
"ServerInstance": None
}
}
if lL: lL.warning(
f"Backward compatibility (v1.2.2 to v1.2.3): Add new key ServerDict > ListenDict. Transfer port from ServerDict > ListenPort") # Log about compatibility

@ -534,17 +534,25 @@ class RobotDaemonServer(Thread):
# Update the global dict # Update the global dict
ServerSettings.SettingsUpdate(inGlobalDict) ServerSettings.SettingsUpdate(inGlobalDict)
def run(self): def run(self):
inServerAddress="" lL = gSettingsDict.get("Logger",None)
inPort = gSettingsDict["ServerDict"]["ListenPort"] try:
lServerDict = gSettingsDict["ServerDict"]["ListenDict"][self.name]
lAddressStr=lServerDict["AddressStr"]
lPortInt=lServerDict["PortInt"]
lCertFilePathStr = lServerDict["CertFilePEMPathStr"]
if lCertFilePathStr == "": lCertFilePathStr = None
# Server settings # Server settings
# Choose port 8080, for port 80, which is normally used for a http server, you need root access # Choose port 8080, for port 80, which is normally used for a http server, you need root access
server_address = (inServerAddress, inPort) server_address = (lAddressStr, lPortInt)
#httpd = HTTPServer(server_address, testHTTPServer_RequestHandler) #httpd = HTTPServer(server_address, testHTTPServer_RequestHandler)
# Logging
gSettingsDict["Logger"].info(f"Server init. Listen URL: {inServerAddress}, Listen port: {inPort}")
#httpd.serve_forever() #httpd.serve_forever()
httpd = ThreadedHTTPServer(server_address, testHTTPServer_RequestHandler) httpd = ThreadedHTTPServer(server_address, testHTTPServer_RequestHandler)
#httpd.socket = ssl.wrap_socket(httpd.socket, server_side=True, if lCertFilePathStr is not None:
# certfile='yourpemfile.pem') 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}")
#print('Starting server, use <Ctrl-C> to stop') #print('Starting server, use <Ctrl-C> to stop')
httpd.serve_forever() httpd.serve_forever()
except Exception as e:
if lL: lL.exception(f"Web Server execution exception")

@ -43,21 +43,13 @@ def __Create__():
"AgentConnectionLifetimeSecFloat": 300.0, # Time in seconds to handle the open connection to the Agent "AgentConnectionLifetimeSecFloat": 300.0, # Time in seconds to handle the open connection to the Agent
"AgentLoopSleepSecFloat": 2.0, # Time in seconds to sleep between loops when check to send some activity to the agent "AgentLoopSleepSecFloat": 2.0, # Time in seconds to sleep between loops when check to send some activity to the agent
"WorkingDirectoryPathStr": None, # Will be filled automatically "WorkingDirectoryPathStr": None, # Will be filled automatically
"RequestTimeoutSecFloat": 300, # Time to handle request in seconds "RequestTimeoutSecFloat": 300, # Time to handle request in seconds,
"ListenPort_": "Порт, по которому можно подключиться к демону",
"ListenPort": 80,
"ListenURLList": [
{
"Description": "Local machine test",
"URL_": "Сетевое расположение сервера демона",
"URL": ""
}
],
"ListenDict": { # Prototype "ListenDict": { # Prototype
"localhost":{ "Default":{
"AddressStr":"", "AddressStr":"",
"PortInt":80, "PortInt":80,
"CertFilePEMPathStr":"" "CertFilePEMPathStr":"",
"ServerInstance": None
} }
}, },
"AccessUsers": { # Default - all URL is blocked "AccessUsers": { # Default - all URL is blocked

@ -2009,10 +2009,13 @@ def Orchestrator(inGSettings, inDumpRestoreBool = True, inRunAsAdministratorBool
lDaemonLastDateTime=datetime.datetime.now() lDaemonLastDateTime=datetime.datetime.now()
gSettingsDict["ServerDict"]["WorkingDirectoryPathStr"] = os.getcwd() # Set working directory in g settings gSettingsDict["ServerDict"]["WorkingDirectoryPathStr"] = os.getcwd() # Set working directory in g settings
#Инициализация сервера #Инициализация сервера (инициализация всех интерфейсов)
lThreadServer = Server.RobotDaemonServer("ServerThread", gSettingsDict) lListenDict = gSettingsDict.get("ServerDict",{}).get("ListenDict",{})
for lItemKeyStr in lListenDict:
lItemDict = lListenDict[lItemKeyStr]
lThreadServer = Server.RobotDaemonServer(lItemKeyStr, gSettingsDict)
lThreadServer.start() lThreadServer.start()
if lL: lL.info("Web server has been started") #Logging lItemDict["ServerInstance"] = lThreadServer
# Init the RobotScreenActive in another thread # Init the RobotScreenActive in another thread
lRobotScreenActiveThread = threading.Thread(target= Monitor.CheckScreen) lRobotScreenActiveThread = threading.Thread(target= Monitor.CheckScreen)

@ -411,25 +411,28 @@
<tr class="row-odd"><td><p><a class="reference internal" href="#pyOpenRPA.Orchestrator.__Orchestrator__.UACUserDictGet" title="pyOpenRPA.Orchestrator.__Orchestrator__.UACUserDictGet"><code class="xref py py-obj docutils literal notranslate"><span class="pre">UACUserDictGet</span></code></a>(inRequest)</p></td> <tr class="row-odd"><td><p><a class="reference internal" href="#pyOpenRPA.Orchestrator.__Orchestrator__.UACUserDictGet" title="pyOpenRPA.Orchestrator.__Orchestrator__.UACUserDictGet"><code class="xref py py-obj docutils literal notranslate"><span class="pre">UACUserDictGet</span></code></a>(inRequest)</p></td>
<td><p>Return user UAC hierarchy dict of the inRequest object.</p></td> <td><p>Return user UAC hierarchy dict of the inRequest object.</p></td>
</tr> </tr>
<tr class="row-even"><td><p><a class="reference internal" href="#pyOpenRPA.Orchestrator.__Orchestrator__.WebCPUpdate" title="pyOpenRPA.Orchestrator.__Orchestrator__.WebCPUpdate"><code class="xref py py-obj docutils literal notranslate"><span class="pre">WebCPUpdate</span></code></a>(inGSettings, inCPKeyStr[, …])</p></td> <tr class="row-even"><td><p><a class="reference internal" href="#pyOpenRPA.Orchestrator.__Orchestrator__.WebAuditMessageCreate" title="pyOpenRPA.Orchestrator.__Orchestrator__.WebAuditMessageCreate"><code class="xref py py-obj docutils literal notranslate"><span class="pre">WebAuditMessageCreate</span></code></a>(inRequest[, …])</p></td>
<td><p>Create message string with request user details (IP, Login etc…).</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#pyOpenRPA.Orchestrator.__Orchestrator__.WebCPUpdate" title="pyOpenRPA.Orchestrator.__Orchestrator__.WebCPUpdate"><code class="xref py py-obj docutils literal notranslate"><span class="pre">WebCPUpdate</span></code></a>(inGSettings, inCPKeyStr[, …])</p></td>
<td><p>Add control panel HTML, JSON generator or JS when page init</p></td> <td><p>Add control panel HTML, JSON generator or JS when page init</p></td>
</tr> </tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#pyOpenRPA.Orchestrator.__Orchestrator__.WebURLConnectDef" title="pyOpenRPA.Orchestrator.__Orchestrator__.WebURLConnectDef"><code class="xref py py-obj docutils literal notranslate"><span class="pre">WebURLConnectDef</span></code></a>(inGSettings, inMethodStr, …)</p></td> <tr class="row-even"><td><p><a class="reference internal" href="#pyOpenRPA.Orchestrator.__Orchestrator__.WebURLConnectDef" title="pyOpenRPA.Orchestrator.__Orchestrator__.WebURLConnectDef"><code class="xref py py-obj docutils literal notranslate"><span class="pre">WebURLConnectDef</span></code></a>(inGSettings, inMethodStr, …)</p></td>
<td><p>Connect URL to DEF</p></td> <td><p>Connect URL to DEF</p></td>
</tr> </tr>
<tr class="row-even"><td><p><a class="reference internal" href="#pyOpenRPA.Orchestrator.__Orchestrator__.WebURLConnectFile" title="pyOpenRPA.Orchestrator.__Orchestrator__.WebURLConnectFile"><code class="xref py py-obj docutils literal notranslate"><span class="pre">WebURLConnectFile</span></code></a>(inGSettings, inMethodStr, …)</p></td> <tr class="row-odd"><td><p><a class="reference internal" href="#pyOpenRPA.Orchestrator.__Orchestrator__.WebURLConnectFile" title="pyOpenRPA.Orchestrator.__Orchestrator__.WebURLConnectFile"><code class="xref py py-obj docutils literal notranslate"><span class="pre">WebURLConnectFile</span></code></a>(inGSettings, inMethodStr, …)</p></td>
<td><p>Connect URL to File</p></td> <td><p>Connect URL to File</p></td>
</tr> </tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#pyOpenRPA.Orchestrator.__Orchestrator__.WebURLConnectFolder" title="pyOpenRPA.Orchestrator.__Orchestrator__.WebURLConnectFolder"><code class="xref py py-obj docutils literal notranslate"><span class="pre">WebURLConnectFolder</span></code></a>(inGSettings, …)</p></td> <tr class="row-even"><td><p><a class="reference internal" href="#pyOpenRPA.Orchestrator.__Orchestrator__.WebURLConnectFolder" title="pyOpenRPA.Orchestrator.__Orchestrator__.WebURLConnectFolder"><code class="xref py py-obj docutils literal notranslate"><span class="pre">WebURLConnectFolder</span></code></a>(inGSettings, …)</p></td>
<td><p>Connect URL to Folder</p></td> <td><p>Connect URL to Folder</p></td>
</tr> </tr>
<tr class="row-even"><td><p><a class="reference internal" href="#pyOpenRPA.Orchestrator.__Orchestrator__.WebUserInfoGet" title="pyOpenRPA.Orchestrator.__Orchestrator__.WebUserInfoGet"><code class="xref py py-obj docutils literal notranslate"><span class="pre">WebUserInfoGet</span></code></a>(inRequest)</p></td> <tr class="row-odd"><td><p><a class="reference internal" href="#pyOpenRPA.Orchestrator.__Orchestrator__.WebUserInfoGet" title="pyOpenRPA.Orchestrator.__Orchestrator__.WebUserInfoGet"><code class="xref py py-obj docutils literal notranslate"><span class="pre">WebUserInfoGet</span></code></a>(inRequest)</p></td>
<td><p>Return User info about request</p></td> <td><p>Return User info about request</p></td>
</tr> </tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#pyOpenRPA.Orchestrator.__Orchestrator__.WebUserIsSuperToken" title="pyOpenRPA.Orchestrator.__Orchestrator__.WebUserIsSuperToken"><code class="xref py py-obj docutils literal notranslate"><span class="pre">WebUserIsSuperToken</span></code></a>(inRequest, inGSettings)</p></td> <tr class="row-even"><td><p><a class="reference internal" href="#pyOpenRPA.Orchestrator.__Orchestrator__.WebUserIsSuperToken" title="pyOpenRPA.Orchestrator.__Orchestrator__.WebUserIsSuperToken"><code class="xref py py-obj docutils literal notranslate"><span class="pre">WebUserIsSuperToken</span></code></a>(inRequest, inGSettings)</p></td>
<td><p>Return bool if request is authentificated with supetoken (token which is never expires)</p></td> <td><p>Return bool if request is authentificated with supetoken (token which is never expires)</p></td>
</tr> </tr>
<tr class="row-even"><td><p><a class="reference internal" href="#pyOpenRPA.Orchestrator.__Orchestrator__.WebUserUACHierarchyGet" title="pyOpenRPA.Orchestrator.__Orchestrator__.WebUserUACHierarchyGet"><code class="xref py py-obj docutils literal notranslate"><span class="pre">WebUserUACHierarchyGet</span></code></a>(inRequest)</p></td> <tr class="row-odd"><td><p><a class="reference internal" href="#pyOpenRPA.Orchestrator.__Orchestrator__.WebUserUACHierarchyGet" title="pyOpenRPA.Orchestrator.__Orchestrator__.WebUserUACHierarchyGet"><code class="xref py py-obj docutils literal notranslate"><span class="pre">WebUserUACHierarchyGet</span></code></a>(inRequest)</p></td>
<td><p>Return User UAC Hierarchy DICT Return {…}</p></td> <td><p>Return User UAC Hierarchy DICT Return {…}</p></td>
</tr> </tr>
</tbody> </tbody>
@ -1755,6 +1758,36 @@ Var 2 (Backward compatibility): inGSettings, inRDPSessionKeyStr, inHostStr, inPo
</dl> </dl>
</dd></dl> </dd></dl>
<dl class="py function">
<dt id="pyOpenRPA.Orchestrator.__Orchestrator__.WebAuditMessageCreate">
<code class="sig-prename descclassname">pyOpenRPA.Orchestrator.__Orchestrator__.</code><code class="sig-name descname">WebAuditMessageCreate</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">inRequest</span></em>, <em class="sig-param"><span class="n">inOperationCodeStr</span><span class="o">=</span><span class="default_value">'-'</span></em>, <em class="sig-param"><span class="n">inMessageStr</span><span class="o">=</span><span class="default_value">'-'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/pyOpenRPA/Orchestrator/__Orchestrator__.html#WebAuditMessageCreate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyOpenRPA.Orchestrator.__Orchestrator__.WebAuditMessageCreate" title="Permalink to this definition"></a></dt>
<dd><p>Create message string with request user details (IP, Login etc…). Very actual for IT security in big company.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># USAGE</span>
<span class="kn">from</span> <span class="nn">pyOpenRPA</span> <span class="kn">import</span> <span class="n">Orchestrator</span>
<span class="n">lWebAuditMessageStr</span> <span class="o">=</span> <span class="n">Orchestrator</span><span class="o">.</span><span class="n">WebAuditMessageCreate</span><span class="p">(</span>
<span class="n">inRequest</span> <span class="o">=</span> <span class="n">lRequest</span><span class="p">,</span>
<span class="n">inOperationCodeStr</span> <span class="o">=</span> <span class="s2">&quot;OP_CODE_1&quot;</span><span class="p">,</span>
<span class="n">inMessageStr</span><span class="o">=</span><span class="s2">&quot;Success&quot;</span><span class="p">):</span>
<span class="c1"># Log the WebAudit message</span>
<span class="n">lLogger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="n">lWebAuditMessageStr</span><span class="p">)</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>inRequest</strong> HTTP request handler</p></li>
<li><p><strong>inOperationCodeStr</strong> operation code in string format (actual for IT audit in control panels)</p></li>
<li><p><strong>inMessageStr</strong> additional message after</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>format “WebAudit :: <a class="reference external" href="mailto:DOMAINUSER&#37;&#52;&#48;101&#46;121&#46;123&#46;12">DOMAINUSER<span>&#64;</span>101<span>&#46;</span>121<span>&#46;</span>123<span>&#46;</span>12</a> :: operation code :: message”</p>
</dd>
</dl>
</dd></dl>
<dl class="py function"> <dl class="py function">
<dt id="pyOpenRPA.Orchestrator.__Orchestrator__.WebCPUpdate"> <dt id="pyOpenRPA.Orchestrator.__Orchestrator__.WebCPUpdate">
<code class="sig-prename descclassname">pyOpenRPA.Orchestrator.__Orchestrator__.</code><code class="sig-name descname">WebCPUpdate</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">inGSettings</span></em>, <em class="sig-param"><span class="n">inCPKeyStr</span></em>, <em class="sig-param"><span class="n">inHTMLRenderDef</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">inJSONGeneratorDef</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">inJSInitGeneratorDef</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/pyOpenRPA/Orchestrator/__Orchestrator__.html#WebCPUpdate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyOpenRPA.Orchestrator.__Orchestrator__.WebCPUpdate" title="Permalink to this definition"></a></dt> <code class="sig-prename descclassname">pyOpenRPA.Orchestrator.__Orchestrator__.</code><code class="sig-name descname">WebCPUpdate</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">inGSettings</span></em>, <em class="sig-param"><span class="n">inCPKeyStr</span></em>, <em class="sig-param"><span class="n">inHTMLRenderDef</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">inJSONGeneratorDef</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">inJSInitGeneratorDef</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/pyOpenRPA/Orchestrator/__Orchestrator__.html#WebCPUpdate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyOpenRPA.Orchestrator.__Orchestrator__.WebCPUpdate" title="Permalink to this definition"></a></dt>

@ -230,16 +230,15 @@
<span class="s2">&quot;AgentConnectionLifetimeSecFloat&quot;</span><span class="p">:</span> <span class="mf">300.0</span><span class="p">,</span> <span class="c1"># Time in seconds to handle the open connection to the Agent</span> <span class="s2">&quot;AgentConnectionLifetimeSecFloat&quot;</span><span class="p">:</span> <span class="mf">300.0</span><span class="p">,</span> <span class="c1"># Time in seconds to handle the open connection to the Agent</span>
<span class="s2">&quot;AgentLoopSleepSecFloat&quot;</span><span class="p">:</span> <span class="mf">2.0</span><span class="p">,</span> <span class="c1"># Time in seconds to sleep between loops when check to send some activity to the agent</span> <span class="s2">&quot;AgentLoopSleepSecFloat&quot;</span><span class="p">:</span> <span class="mf">2.0</span><span class="p">,</span> <span class="c1"># Time in seconds to sleep between loops when check to send some activity to the agent</span>
<span class="s2">&quot;WorkingDirectoryPathStr&quot;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span> <span class="c1"># Will be filled automatically</span> <span class="s2">&quot;WorkingDirectoryPathStr&quot;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span> <span class="c1"># Will be filled automatically</span>
<span class="s2">&quot;RequestTimeoutSecFloat&quot;</span><span class="p">:</span> <span class="mi">300</span><span class="p">,</span> <span class="c1"># Time to handle request in seconds</span> <span class="s2">&quot;RequestTimeoutSecFloat&quot;</span><span class="p">:</span> <span class="mi">300</span><span class="p">,</span> <span class="c1"># Time to handle request in seconds,</span>
<span class="s2">&quot;ListenPort_&quot;</span><span class="p">:</span> <span class="s2">&quot;Порт, по которому можно подключиться к демону&quot;</span><span class="p">,</span> <span class="s2">&quot;ListenDict&quot;</span><span class="p">:</span> <span class="p">{</span> <span class="c1"># Prototype</span>
<span class="s2">&quot;ListenPort&quot;</span><span class="p">:</span> <span class="mi">80</span><span class="p">,</span> <span class="s2">&quot;Default&quot;</span><span class="p">:{</span>
<span class="s2">&quot;ListenURLList&quot;</span><span class="p">:</span> <span class="p">[</span> <span class="s2">&quot;AddressStr&quot;</span><span class="p">:</span><span class="s2">&quot;&quot;</span><span class="p">,</span>
<span class="p">{</span> <span class="s2">&quot;PortInt&quot;</span><span class="p">:</span><span class="mi">80</span><span class="p">,</span>
<span class="s2">&quot;Description&quot;</span><span class="p">:</span> <span class="s2">&quot;Local machine test&quot;</span><span class="p">,</span> <span class="s2">&quot;CertFilePEMPathStr&quot;</span><span class="p">:</span><span class="s2">&quot;&quot;</span><span class="p">,</span>
<span class="s2">&quot;URL_&quot;</span><span class="p">:</span> <span class="s2">&quot;Сетевое расположение сервера демона&quot;</span><span class="p">,</span> <span class="s2">&quot;ServerInstance&quot;</span><span class="p">:</span> <span class="kc">None</span>
<span class="s2">&quot;URL&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span>
<span class="p">}</span> <span class="p">}</span>
<span class="p">],</span> <span class="p">},</span>
<span class="s2">&quot;AccessUsers&quot;</span><span class="p">:</span> <span class="p">{</span> <span class="c1"># Default - all URL is blocked</span> <span class="s2">&quot;AccessUsers&quot;</span><span class="p">:</span> <span class="p">{</span> <span class="c1"># Default - all URL is blocked</span>
<span class="s2">&quot;FlagCredentialsAsk&quot;</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="c1"># Turn on Authentication</span> <span class="s2">&quot;FlagCredentialsAsk&quot;</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="c1"># Turn on Authentication</span>
<span class="s2">&quot;RuleDomainUserDict&quot;</span><span class="p">:</span> <span class="p">{</span> <span class="s2">&quot;RuleDomainUserDict&quot;</span><span class="p">:</span> <span class="p">{</span>

@ -219,6 +219,14 @@
<span class="c1"># TEST Add Supertoken for the all access between robots</span> <span class="c1"># TEST Add Supertoken for the all access between robots</span>
<span class="n">Orchestrator</span><span class="o">.</span><span class="n">UACSuperTokenUpdate</span><span class="p">(</span><span class="n">inGSettings</span><span class="o">=</span><span class="n">gSettings</span><span class="p">,</span> <span class="n">inSuperTokenStr</span><span class="o">=</span><span class="s2">&quot;1992-04-03-0643-ru-b4ff-openrpa52zzz&quot;</span><span class="p">)</span> <span class="n">Orchestrator</span><span class="o">.</span><span class="n">UACSuperTokenUpdate</span><span class="p">(</span><span class="n">inGSettings</span><span class="o">=</span><span class="n">gSettings</span><span class="p">,</span> <span class="n">inSuperTokenStr</span><span class="o">=</span><span class="s2">&quot;1992-04-03-0643-ru-b4ff-openrpa52zzz&quot;</span><span class="p">)</span>
<span class="c1"># Add 2 interfaces!</span>
<span class="n">gSettings</span><span class="p">[</span><span class="s2">&quot;ServerDict&quot;</span><span class="p">][</span><span class="s2">&quot;ListenDict&quot;</span><span class="p">][</span><span class="s2">&quot;Int2&quot;</span><span class="p">]</span><span class="o">=</span><span class="p">{</span>
<span class="s2">&quot;AddressStr&quot;</span><span class="p">:</span><span class="s2">&quot;&quot;</span><span class="p">,</span>
<span class="s2">&quot;PortInt&quot;</span><span class="p">:</span><span class="mi">8080</span><span class="p">,</span>
<span class="s2">&quot;CertFilePEMPathStr&quot;</span><span class="p">:</span><span class="s2">&quot;test.pem&quot;</span><span class="p">,</span>
<span class="s2">&quot;ServerInstance&quot;</span><span class="p">:</span> <span class="kc">None</span>
<span class="p">}</span>
<span class="c1"># Restore DUMP</span> <span class="c1"># Restore DUMP</span>
<span class="n">Orchestrator</span><span class="o">.</span><span class="n">OrchestratorSessionRestore</span><span class="p">(</span><span class="n">inGSettings</span><span class="o">=</span><span class="n">gSettings</span><span class="p">)</span> <span class="n">Orchestrator</span><span class="o">.</span><span class="n">OrchestratorSessionRestore</span><span class="p">(</span><span class="n">inGSettings</span><span class="o">=</span><span class="n">gSettings</span><span class="p">)</span>

@ -781,6 +781,40 @@
<span class="k">if</span> <span class="n">inJSInitGeneratorDef</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> <span class="k">if</span> <span class="n">inJSInitGeneratorDef</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">inGSettings</span><span class="p">[</span><span class="s2">&quot;CPDict&quot;</span><span class="p">][</span><span class="n">inCPKeyStr</span><span class="p">][</span><span class="s2">&quot;JSInitGeneratorDef&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">inJSInitGeneratorDef</span></div> <span class="n">inGSettings</span><span class="p">[</span><span class="s2">&quot;CPDict&quot;</span><span class="p">][</span><span class="n">inCPKeyStr</span><span class="p">][</span><span class="s2">&quot;JSInitGeneratorDef&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">inJSInitGeneratorDef</span></div>
<div class="viewcode-block" id="WebAuditMessageCreate"><a class="viewcode-back" href="../../../Orchestrator/02_Defs.html#pyOpenRPA.Orchestrator.__Orchestrator__.WebAuditMessageCreate">[docs]</a><span class="k">def</span> <span class="nf">WebAuditMessageCreate</span><span class="p">(</span><span class="n">inRequest</span><span class="p">,</span> <span class="n">inOperationCodeStr</span><span class="o">=</span><span class="s2">&quot;-&quot;</span><span class="p">,</span> <span class="n">inMessageStr</span><span class="o">=</span><span class="s2">&quot;-&quot;</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Create message string with request user details (IP, Login etc...). Very actual for IT security in big company.</span>
<span class="sd"> .. code-block:: python</span>
<span class="sd"> # USAGE</span>
<span class="sd"> from pyOpenRPA import Orchestrator</span>
<span class="sd"> lWebAuditMessageStr = Orchestrator.WebAuditMessageCreate(</span>
<span class="sd"> inRequest = lRequest,</span>
<span class="sd"> inOperationCodeStr = &quot;OP_CODE_1&quot;,</span>
<span class="sd"> inMessageStr=&quot;Success&quot;):</span>
<span class="sd"> # Log the WebAudit message</span>
<span class="sd"> lLogger.info(lWebAuditMessageStr)</span>
<span class="sd"> :param inRequest: HTTP request handler</span>
<span class="sd"> :param inOperationCodeStr: operation code in string format (actual for IT audit in control panels)</span>
<span class="sd"> :param inMessageStr: additional message after</span>
<span class="sd"> :return: format &quot;WebAudit :: DOMAIN\\USER@101.121.123.12 :: operation code :: message&quot;</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">lClientIPStr</span> <span class="o">=</span> <span class="n">inRequest</span><span class="o">.</span><span class="n">client_address</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
<span class="n">lUserDict</span> <span class="o">=</span> <span class="n">WebUserInfoGet</span><span class="p">(</span><span class="n">inRequest</span><span class="o">=</span><span class="n">inRequest</span><span class="p">)</span>
<span class="n">lDomainUpperStr</span> <span class="o">=</span> <span class="n">lUserDict</span><span class="p">[</span><span class="s2">&quot;DomainUpperStr&quot;</span><span class="p">]</span>
<span class="n">lUserLoginStr</span> <span class="o">=</span> <span class="n">lUserDict</span><span class="p">[</span><span class="s2">&quot;UserNameUpperStr&quot;</span><span class="p">]</span>
<span class="n">lResultStr</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">&quot;WebAudit :: </span><span class="si">{</span><span class="n">lDomainUpperStr</span><span class="si">}</span><span class="se">\\\\</span><span class="si">{</span><span class="n">lUserLoginStr</span><span class="si">}</span><span class="s2">@</span><span class="si">{</span><span class="n">lClientIPStr</span><span class="si">}</span><span class="s2"> :: </span><span class="si">{</span><span class="n">inOperationCodeStr</span><span class="si">}</span><span class="s2"> :: </span><span class="si">{</span><span class="n">inMessageStr</span><span class="si">}</span><span class="s2">&quot;</span>
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="nb">print</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span> <span class="c1"># Has no logger - must be dead alg branch</span>
<span class="n">lResultStr</span> <span class="o">=</span> <span class="n">inMessageStr</span>
<span class="k">return</span> <span class="n">lResultStr</span></div>
<div class="viewcode-block" id="WebUserInfoGet"><a class="viewcode-back" href="../../../Orchestrator/02_Defs.html#pyOpenRPA.Orchestrator.__Orchestrator__.WebUserInfoGet">[docs]</a><span class="k">def</span> <span class="nf">WebUserInfoGet</span><span class="p">(</span><span class="n">inRequest</span><span class="p">):</span> <div class="viewcode-block" id="WebUserInfoGet"><a class="viewcode-back" href="../../../Orchestrator/02_Defs.html#pyOpenRPA.Orchestrator.__Orchestrator__.WebUserInfoGet">[docs]</a><span class="k">def</span> <span class="nf">WebUserInfoGet</span><span class="p">(</span><span class="n">inRequest</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span> <span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Return User info about request</span> <span class="sd"> Return User info about request</span>
@ -2156,10 +2190,13 @@
<span class="n">lDaemonLastDateTime</span><span class="o">=</span><span class="n">datetime</span><span class="o">.</span><span class="n">datetime</span><span class="o">.</span><span class="n">now</span><span class="p">()</span> <span class="n">lDaemonLastDateTime</span><span class="o">=</span><span class="n">datetime</span><span class="o">.</span><span class="n">datetime</span><span class="o">.</span><span class="n">now</span><span class="p">()</span>
<span class="n">gSettingsDict</span><span class="p">[</span><span class="s2">&quot;ServerDict&quot;</span><span class="p">][</span><span class="s2">&quot;WorkingDirectoryPathStr&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">getcwd</span><span class="p">()</span> <span class="c1"># Set working directory in g settings</span> <span class="n">gSettingsDict</span><span class="p">[</span><span class="s2">&quot;ServerDict&quot;</span><span class="p">][</span><span class="s2">&quot;WorkingDirectoryPathStr&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">getcwd</span><span class="p">()</span> <span class="c1"># Set working directory in g settings</span>
<span class="c1">#Инициализация сервера</span> <span class="c1">#Инициализация сервера (инициализация всех интерфейсов)</span>
<span class="n">lThreadServer</span> <span class="o">=</span> <span class="n">Server</span><span class="o">.</span><span class="n">RobotDaemonServer</span><span class="p">(</span><span class="s2">&quot;ServerThread&quot;</span><span class="p">,</span> <span class="n">gSettingsDict</span><span class="p">)</span> <span class="n">lListenDict</span> <span class="o">=</span> <span class="n">gSettingsDict</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;ServerDict&quot;</span><span class="p">,{})</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;ListenDict&quot;</span><span class="p">,{})</span>
<span class="k">for</span> <span class="n">lItemKeyStr</span> <span class="ow">in</span> <span class="n">lListenDict</span><span class="p">:</span>
<span class="n">lItemDict</span> <span class="o">=</span> <span class="n">lListenDict</span><span class="p">[</span><span class="n">lItemKeyStr</span><span class="p">]</span>
<span class="n">lThreadServer</span> <span class="o">=</span> <span class="n">Server</span><span class="o">.</span><span class="n">RobotDaemonServer</span><span class="p">(</span><span class="n">lItemKeyStr</span><span class="p">,</span> <span class="n">gSettingsDict</span><span class="p">)</span>
<span class="n">lThreadServer</span><span class="o">.</span><span class="n">start</span><span class="p">()</span> <span class="n">lThreadServer</span><span class="o">.</span><span class="n">start</span><span class="p">()</span>
<span class="k">if</span> <span class="n">lL</span><span class="p">:</span> <span class="n">lL</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;Web server has been started&quot;</span><span class="p">)</span> <span class="c1">#Logging</span> <span class="n">lItemDict</span><span class="p">[</span><span class="s2">&quot;ServerInstance&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">lThreadServer</span>
<span class="c1"># Init the RobotScreenActive in another thread</span> <span class="c1"># Init the RobotScreenActive in another thread</span>
<span class="n">lRobotScreenActiveThread</span> <span class="o">=</span> <span class="n">threading</span><span class="o">.</span><span class="n">Thread</span><span class="p">(</span><span class="n">target</span><span class="o">=</span> <span class="n">Monitor</span><span class="o">.</span><span class="n">CheckScreen</span><span class="p">)</span> <span class="n">lRobotScreenActiveThread</span> <span class="o">=</span> <span class="n">threading</span><span class="o">.</span><span class="n">Thread</span><span class="p">(</span><span class="n">target</span><span class="o">=</span> <span class="n">Monitor</span><span class="o">.</span><span class="n">CheckScreen</span><span class="p">)</span>

@ -470,6 +470,8 @@
<h2 id="W">W</h2> <h2 id="W">W</h2>
<table style="width: 100%" class="indextable genindextable"><tr> <table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul> <td style="width: 33%; vertical-align: top;"><ul>
<li><a href="Orchestrator/02_Defs.html#pyOpenRPA.Orchestrator.__Orchestrator__.WebAuditMessageCreate">WebAuditMessageCreate() (in module pyOpenRPA.Orchestrator.__Orchestrator__)</a>
</li>
<li><a href="Orchestrator/02_Defs.html#pyOpenRPA.Orchestrator.__Orchestrator__.WebCPUpdate">WebCPUpdate() (in module pyOpenRPA.Orchestrator.__Orchestrator__)</a> <li><a href="Orchestrator/02_Defs.html#pyOpenRPA.Orchestrator.__Orchestrator__.WebCPUpdate">WebCPUpdate() (in module pyOpenRPA.Orchestrator.__Orchestrator__)</a>
</li> </li>
<li><a href="Orchestrator/02_Defs.html#pyOpenRPA.Orchestrator.__Orchestrator__.WebURLConnectDef">WebURLConnectDef() (in module pyOpenRPA.Orchestrator.__Orchestrator__)</a> <li><a href="Orchestrator/02_Defs.html#pyOpenRPA.Orchestrator.__Orchestrator__.WebURLConnectDef">WebURLConnectDef() (in module pyOpenRPA.Orchestrator.__Orchestrator__)</a>

Binary file not shown.

File diff suppressed because one or more lines are too long

@ -308,6 +308,11 @@ Work with activity scheduling.
| Return user UAC hierarchy dict of the inRequest object. | Return user UAC hierarchy dict of the inRequest object.
|
| `WebAuditMessageCreate`(inRequest[, …])
| Create message string with request user details (IP, Login etc…).
| |
| `WebCPUpdate`(inGSettings, inCPKeyStr[, …]) | `WebCPUpdate`(inGSettings, inCPKeyStr[, …])
@ -1979,6 +1984,42 @@ Return user UAC hierarchy dict of the inRequest object. Empty dict - superuser a
### pyOpenRPA.Orchestrator.__Orchestrator__.WebAuditMessageCreate(inRequest, inOperationCodeStr='-', inMessageStr='-')
Create message string with request user details (IP, Login etc…). Very actual for IT security in big company.
```
# USAGE
from pyOpenRPA import Orchestrator
lWebAuditMessageStr = Orchestrator.WebAuditMessageCreate(
inRequest = lRequest,
inOperationCodeStr = "OP_CODE_1",
inMessageStr="Success"):
# Log the WebAudit message
lLogger.info(lWebAuditMessageStr)
```
* **Parameters**
* **inRequest** HTTP request handler
* **inOperationCodeStr** operation code in string format (actual for IT audit in control panels)
* **inMessageStr** additional message after
* **Returns**
format “WebAudit :: [DOMAINUSER@101.121.123.12](mailto:DOMAINUSER@101.121.123.12) :: operation code :: message”
### pyOpenRPA.Orchestrator.__Orchestrator__.WebCPUpdate(inGSettings, inCPKeyStr, inHTMLRenderDef=None, inJSONGeneratorDef=None, inJSInitGeneratorDef=None) ### pyOpenRPA.Orchestrator.__Orchestrator__.WebCPUpdate(inGSettings, inCPKeyStr, inHTMLRenderDef=None, inJSONGeneratorDef=None, inJSInitGeneratorDef=None)
Add control panel HTML, JSON generator or JS when page init Add control panel HTML, JSON generator or JS when page init

@ -48,16 +48,15 @@ def __Create__():
"AgentConnectionLifetimeSecFloat": 300.0, # Time in seconds to handle the open connection to the Agent "AgentConnectionLifetimeSecFloat": 300.0, # Time in seconds to handle the open connection to the Agent
"AgentLoopSleepSecFloat": 2.0, # Time in seconds to sleep between loops when check to send some activity to the agent "AgentLoopSleepSecFloat": 2.0, # Time in seconds to sleep between loops when check to send some activity to the agent
"WorkingDirectoryPathStr": None, # Will be filled automatically "WorkingDirectoryPathStr": None, # Will be filled automatically
"RequestTimeoutSecFloat": 300, # Time to handle request in seconds "RequestTimeoutSecFloat": 300, # Time to handle request in seconds,
"ListenPort_": "Порт, по которому можно подключиться к демону", "ListenDict": { # Prototype
"ListenPort": 80, "Default":{
"ListenURLList": [ "AddressStr":"",
{ "PortInt":80,
"Description": "Local machine test", "CertFilePEMPathStr":"",
"URL_": "Сетевое расположение сервера демона", "ServerInstance": None
"URL": ""
} }
], },
"AccessUsers": { # Default - all URL is blocked "AccessUsers": { # Default - all URL is blocked
"FlagCredentialsAsk": True, # Turn on Authentication "FlagCredentialsAsk": True, # Turn on Authentication
"RuleDomainUserDict": { "RuleDomainUserDict": {

@ -39,6 +39,14 @@ elif __name__ == "__main__": # New init way - allow run as module -m PyOpenRPA.O
# TEST Add Supertoken for the all access between robots # TEST Add Supertoken for the all access between robots
Orchestrator.UACSuperTokenUpdate(inGSettings=gSettings, inSuperTokenStr="1992-04-03-0643-ru-b4ff-openrpa52zzz") 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
}
# Restore DUMP # Restore DUMP
Orchestrator.OrchestratorSessionRestore(inGSettings=gSettings) Orchestrator.OrchestratorSessionRestore(inGSettings=gSettings)

Loading…
Cancel
Save