diff --git a/.gitignore b/.gitignore index 606d14bc..2cdd8826 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,8 @@ /**/OpenRPA_Orchestrator.exe /**/OpenRPAOrchestrator.exe /**/OpenRPARobotGUIx32.exe +/**/orpa-orc.exe +/**/orpa-agent.exe /**/OpenRPARobotGUIx64.exe /**/OpenRPAStudio.exe /**/OpenRPARobot.exe diff --git a/Agent/AgentDaemonKill.cmd b/Agent/AgentDaemonKill.cmd deleted file mode 100644 index 22b20308..00000000 --- a/Agent/AgentDaemonKill.cmd +++ /dev/null @@ -1,3 +0,0 @@ -cd %~dp0 -taskkill /F /FI "USERNAME eq %username%" /IM pyOpenRPA_Agent.exe -pause >nul \ No newline at end of file diff --git a/Agent/AgentDaemonX64.cmd b/Agent/AgentDaemonX64.cmd deleted file mode 100644 index 3695b6fa..00000000 --- a/Agent/AgentDaemonX64.cmd +++ /dev/null @@ -1,5 +0,0 @@ -cd %~dp0 -taskkill /im "pyOpenRPA_Agent.exe" /F /fi "username eq %username%" -copy /Y ..\Resources\WPy64-3720\python-3.7.2.amd64\pythonw.exe ..\Resources\WPy64-3720\python-3.7.2.amd64\pyOpenRPA_Agent.exe -.\..\Resources\WPy64-3720\python-3.7.2.amd64\pyOpenRPA_Agent.exe "AgentSettings.py" -pause >nul \ No newline at end of file diff --git a/Agent/AgentDaemonX64Debug.cmd b/Agent/AgentDaemonX64Debug.cmd deleted file mode 100644 index fdccc7d5..00000000 --- a/Agent/AgentDaemonX64Debug.cmd +++ /dev/null @@ -1,5 +0,0 @@ -cd %~dp0 -taskkill /im "pyOpenRPA_Agent.exe" /F /fi "username eq %username%" -copy /Y ..\Resources\WPy64-3720\python-3.7.2.amd64\python.exe ..\Resources\WPy64-3720\python-3.7.2.amd64\pyOpenRPA_Agent.exe -.\..\Resources\WPy64-3720\python-3.7.2.amd64\pyOpenRPA_Agent.exe "AgentSettings.py" -pause >nul \ No newline at end of file diff --git a/Agent/AgentSettings.py b/Agent/config.py similarity index 92% rename from Agent/AgentSettings.py rename to Agent/config.py index 881a046f..ba73ef98 100644 --- a/Agent/AgentSettings.py +++ b/Agent/config.py @@ -7,13 +7,17 @@ lPyOpenRPASourceFolderPathStr = r"..\Sources" # Path for test pyOpenRPA package if lPyOpenRPASourceFolderPathStr != "": sys.path.insert(0,os.path.abspath(os.path.join(lPyOpenRPASourceFolderPathStr))) # Path for test pyOpenRPA package from pyOpenRPA.Agent import __Agent__ +from pyOpenRPA.Tools import CrossOS + +if CrossOS.IS_WINDOWS_BOOL: lPortInt = 80 +if CrossOS.IS_LINUX_BOOL: lPortInt = 1024 gUserNameUpperStr = getpass.getuser().upper() if __name__ == "__main__": # New init way gSettings = { "OrchestratorDict":{ "IsHTTPSBool": False, # True - if server is secured HTTPS, False - if server is not secured HTTP "HostStr":"127.0.0.1", - "PortInt":80, + "PortInt":lPortInt, "SuperTokenStr":"1992-04-03-0643-ru-b4ff-openrpa52zzz", # Access token to Orchestrator }, "O2ADict":{ @@ -57,7 +61,7 @@ if __name__ == "__main__": # New init way lL.setLevel(logging.INFO) # create the logging file handler mRobotLoggerFH = logging.FileHandler( - "Logs\\" + gUserNameUpperStr + "_" + datetime.datetime.now().strftime("%Y_%m_%d") + ".log") + os.path.normpath("Logs\\" + gUserNameUpperStr + "_" + datetime.datetime.now().strftime("%Y_%m_%d") + ".log")) mRobotLoggerFormatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s') mRobotLoggerFH.setFormatter(mRobotLoggerFormatter) # add handler to logger object diff --git a/Agent/kill.cmd b/Agent/kill.cmd new file mode 100644 index 00000000..af2c90e5 --- /dev/null +++ b/Agent/kill.cmd @@ -0,0 +1,3 @@ +cd %~dp0 +taskkill /F /FI "USERNAME eq %username%" /IM orpa-agent.exe +pause >nul \ No newline at end of file diff --git a/Agent/start-daemon.cmd b/Agent/start-daemon.cmd new file mode 100644 index 00000000..d308709d --- /dev/null +++ b/Agent/start-daemon.cmd @@ -0,0 +1,5 @@ +cd %~dp0 +taskkill /im "orpa-agent.exe" /F /fi "username eq %username%" +copy /Y ..\Resources\WPy64-3720\python-3.7.2.amd64\pythonw.exe ..\Resources\WPy64-3720\python-3.7.2.amd64\orpa-agent.exe +.\..\Resources\WPy64-3720\python-3.7.2.amd64\orpa-agent.exe "config.py" +pause >nul \ No newline at end of file diff --git a/Agent/start.cmd b/Agent/start.cmd new file mode 100644 index 00000000..f3afdf35 --- /dev/null +++ b/Agent/start.cmd @@ -0,0 +1,5 @@ +cd %~dp0 +taskkill /im "orpa-agent.exe" /F /fi "username eq %username%" +copy /Y ..\Resources\WPy64-3720\python-3.7.2.amd64\python.exe ..\Resources\WPy64-3720\python-3.7.2.amd64\orpa-agent.exe +.\..\Resources\WPy64-3720\python-3.7.2.amd64\orpa-agent.exe "config.py" +pause >nul \ No newline at end of file diff --git a/Agent/start.sh b/Agent/start.sh new file mode 100644 index 00000000..612e5e65 --- /dev/null +++ b/Agent/start.sh @@ -0,0 +1,3 @@ +#!/bin/bash +export PYTHONPATH="../Sources" +./../Resources/LPy64-3105/bin/python3.10 "config.py" diff --git a/Orchestrator/OrchestratorSettings.py b/Orchestrator/config.py similarity index 93% rename from Orchestrator/OrchestratorSettings.py rename to Orchestrator/config.py index 242c77a7..3344ba2f 100644 --- a/Orchestrator/OrchestratorSettings.py +++ b/Orchestrator/config.py @@ -23,6 +23,7 @@ else: # TEST Add User ND - Add Login ND to superuser of the Orchestrator lUACClientDict = SettingsTemplate.__UACClientAdminCreate__() Orchestrator.UACUpdate(inGSettings=gSettings, inADLoginStr="ND", inADStr="", inADIsDefaultBool=True, inURLList=[], inRoleHierarchyAllowedDict=lUACClientDict) + Orchestrator.UACUpdate(inGSettings=gSettings, inADLoginStr="rpa00", inADStr="", inADIsDefaultBool=True, inURLList=[], inRoleHierarchyAllowedDict=lUACClientDict) # TEST Add User IMaslov - Add Login IMaslov to superuser of the Orchestrator Orchestrator.UACUpdate(inGSettings=gSettings, inADLoginStr="IMaslov", inADStr="", inADIsDefaultBool=True, inURLList=[]) # TEST Add Supertoken for the all access between robots diff --git a/Orchestrator/pyOpenRPA.Orchestrator_x64.cmd b/Orchestrator/pyOpenRPA.Orchestrator_x64.cmd deleted file mode 100644 index 73270e4f..00000000 --- a/Orchestrator/pyOpenRPA.Orchestrator_x64.cmd +++ /dev/null @@ -1,5 +0,0 @@ -cd %~dp0 -taskkill /im "pyOpenRPA_Orchestrator.exe" /F /fi "username eq %username%" -copy /Y ..\Resources\WPy64-3720\python-3.7.2.amd64\python.exe ..\Resources\WPy64-3720\python-3.7.2.amd64\pyOpenRPA_Orchestrator.exe -.\..\Resources\WPy64-3720\python-3.7.2.amd64\pyOpenRPA_Orchestrator.exe "OrchestratorSettings.py" -pause>nul \ No newline at end of file diff --git a/Orchestrator/pyOpenRPA.Orchestrator_x64.sh b/Orchestrator/pyOpenRPA.Orchestrator_x64.sh deleted file mode 100644 index 421767c5..00000000 --- a/Orchestrator/pyOpenRPA.Orchestrator_x64.sh +++ /dev/null @@ -1,2 +0,0 @@ -export PYTHONPATH="../Sources" -./../Resources/LPy64-3105/bin/python3.10 "OrchestratorSettings.py" diff --git a/Orchestrator/start.cmd b/Orchestrator/start.cmd new file mode 100644 index 00000000..2fba96d6 --- /dev/null +++ b/Orchestrator/start.cmd @@ -0,0 +1,5 @@ +cd %~dp0 +taskkill /im "orpa-orc.exe" /F /fi "username eq %username%" +copy /Y ..\Resources\WPy64-3720\python-3.7.2.amd64\python.exe ..\Resources\WPy64-3720\python-3.7.2.amd64\orpa-orc.exe +.\..\Resources\WPy64-3720\python-3.7.2.amd64\orpa-orc.exe "config.py" +pause>nul \ No newline at end of file diff --git a/Orchestrator/start.sh b/Orchestrator/start.sh new file mode 100644 index 00000000..612e5e65 --- /dev/null +++ b/Orchestrator/start.sh @@ -0,0 +1,3 @@ +#!/bin/bash +export PYTHONPATH="../Sources" +./../Resources/LPy64-3105/bin/python3.10 "config.py" diff --git a/Resources/WPy32-3720/python-3.7.2/OpenRPAUIDesktopX32.exe b/Resources/WPy32-3720/python-3.7.2/OpenRPAUIDesktopX32.exe deleted file mode 100644 index 4053ac88..00000000 Binary files a/Resources/WPy32-3720/python-3.7.2/OpenRPAUIDesktopX32.exe and /dev/null differ diff --git a/Resources/WPy64-3720/python-3.7.2.amd64/OpenRPA_Studio.exe b/Resources/WPy64-3720/python-3.7.2.amd64/OpenRPA_Studio.exe deleted file mode 100644 index 66a6265c..00000000 Binary files a/Resources/WPy64-3720/python-3.7.2.amd64/OpenRPA_Studio.exe and /dev/null differ diff --git a/Resources/WPy64-3720/python-3.7.2.amd64/OpenRPA_ToolScreenScrapRecognize.exe b/Resources/WPy64-3720/python-3.7.2.amd64/OpenRPA_ToolScreenScrapRecognize.exe deleted file mode 100644 index 66a6265c..00000000 Binary files a/Resources/WPy64-3720/python-3.7.2.amd64/OpenRPA_ToolScreenScrapRecognize.exe and /dev/null differ diff --git a/Resources/WPy64-3720/python-3.7.2.amd64/pyOpenRPA_Agent.exe b/Resources/WPy64-3720/python-3.7.2.amd64/pyOpenRPA_Agent.exe deleted file mode 100644 index 66a6265c..00000000 Binary files a/Resources/WPy64-3720/python-3.7.2.amd64/pyOpenRPA_Agent.exe and /dev/null differ diff --git a/Resources/WPy64-3720/python-3.7.2.amd64/pyOpenRPA_Orchestrator.exe b/Resources/WPy64-3720/python-3.7.2.amd64/pyOpenRPA_Orchestrator.exe deleted file mode 100644 index 66a6265c..00000000 Binary files a/Resources/WPy64-3720/python-3.7.2.amd64/pyOpenRPA_Orchestrator.exe and /dev/null differ diff --git a/Sources/pyOpenRPA/Agent/__Agent__.py b/Sources/pyOpenRPA/Agent/__Agent__.py index ab47c335..972f0f87 100644 --- a/Sources/pyOpenRPA/Agent/__Agent__.py +++ b/Sources/pyOpenRPA/Agent/__Agent__.py @@ -3,7 +3,10 @@ from . import O2A, A2O # Data flow Orchestrator To Agent from . import Processor # Processor Queue from ..Tools import Usage from ..Tools import License -from subprocess import CREATE_NEW_CONSOLE # Flag to create new process in another CMD +from pyOpenRPA.Tools import CrossOS +if CrossOS.IS_WINDOWS_BOOL: from subprocess import CREATE_NEW_CONSOLE # Flag to create new process in another CMD +if CrossOS.IS_LINUX_BOOL: pass + import os gSettings = None @@ -142,8 +145,11 @@ def OSCMD(inCMDStr, inRunAsyncBool=True, inGSettings = None, inSendOutputToOrche if inCaptureBool == True: lCMDProcess = subprocess.Popen(f'cmd /c {inCMDStr}', stdout=subprocess.PIPE, stderr=subprocess.STDOUT) else: - lCMDProcess = subprocess.Popen(f'cmd /c {inCMDStr}', stdout=None, stderr=None, - creationflags=CREATE_NEW_CONSOLE) + if CrossOS.IS_WINDOWS_BOOL: + lCMDProcess = subprocess.Popen(f'cmd /c {inCMDStr}', stdout=None, stderr=None, + creationflags=CREATE_NEW_CONSOLE) + if CrossOS.IS_LINUX_BOOL: + lCMDProcess = subprocess.Popen(f'cmd /c {inCMDStr}', stdout=None, stderr=None) lListenBool = True lMessageStr = f"{lOSCMDKeyStr}: # # # # AGENT CMD Process has been STARTED # # # # " if lL: lL.info(lMessageStr) diff --git a/Sources/pyOpenRPA/Orchestrator/ServerSettings.py b/Sources/pyOpenRPA/Orchestrator/ServerSettings.py index 1f0f928a..4506adb8 100644 --- a/Sources/pyOpenRPA/Orchestrator/ServerSettings.py +++ b/Sources/pyOpenRPA/Orchestrator/ServerSettings.py @@ -8,7 +8,7 @@ if CrossOS.IS_WINDOWS_BOOL: #CrossOS getDisplayRects, saveScreenToBmp, saveRectToBmp, getScreenAsImage, getRectAsImage, getDisplaysAsImages) -if CrossOS.IS_LINUX_BOOL: pass +if CrossOS.IS_LINUX_BOOL: import pyscreeze from http import cookies import uuid # generate UUID4 @@ -197,9 +197,9 @@ def pyOpenRPA_Screenshot(inRequest,inGlobalDict): # Get Screenshot def SaveScreenshot(inFilePath): # grab fullscreen - # Save the entire virtual screen as a PNG + # Save the entire virtual screen as a PNsG lScreenshot = getScreenAsImage() - lScreenshot.save('screenshot.png', format='png') + lScreenshot.save('Screenshot.png', format='png') # lScreenshot = ScreenshotSecondScreen.grab_screen() # save image file # lScreenshot.save('screenshot.png') @@ -211,7 +211,13 @@ def pyOpenRPA_Screenshot(inRequest,inGlobalDict): inRequest.OpenRPAResponseDict["Body"] = lFileObject.read() # Закрыть файловый объект lFileObject.close() - else: lFileObject = b'' + else: + pyscreeze._screenshot_linux(imageFilename='Screenshot.png') + lFileObject = open("Screenshot.png", "rb") + # Write content as utf-8 data + inRequest.OpenRPAResponseDict["Body"] = lFileObject.read() + # Закрыть файловый объект + lFileObject.close() # Add activity item or activity list to the processor queue # Body is Activity item or Activity List @@ -494,4 +500,4 @@ def SettingsUpdate(inGlobalConfiguration): ] Usage.Process(inComponentStr="Orchestrator") inGlobalConfiguration["ServerDict"]["URLList"]=inGlobalConfiguration["ServerDict"]["URLList"]+lURLList - return inGlobalConfiguration \ No newline at end of file + return inGlobalConfiguration diff --git a/Sources/pyOpenRPA/Orchestrator/SettingsTemplate.py b/Sources/pyOpenRPA/Orchestrator/SettingsTemplate.py index a3209029..f9d4fb72 100644 --- a/Sources/pyOpenRPA/Orchestrator/SettingsTemplate.py +++ b/Sources/pyOpenRPA/Orchestrator/SettingsTemplate.py @@ -340,7 +340,7 @@ def Create(inModeStr="BASIC", inLoggerLevel = None): lL.setLevel(logging.INFO) # create the logging file handler mRobotLoggerFH = logging.FileHandler( - "Reports\\" + datetime.datetime.now().strftime("%Y_%m_%d") + ".log") + os.path.normpath("Reports\\" + datetime.datetime.now().strftime("%Y_%m_%d") + ".log")) mRobotLoggerFormatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s') mRobotLoggerFH.setFormatter(mRobotLoggerFormatter) # add handler to logger object diff --git a/Sources/pyOpenRPA/Orchestrator/__Orchestrator__.py b/Sources/pyOpenRPA/Orchestrator/__Orchestrator__.py index 866943d2..3fce1ed1 100644 --- a/Sources/pyOpenRPA/Orchestrator/__Orchestrator__.py +++ b/Sources/pyOpenRPA/Orchestrator/__Orchestrator__.py @@ -493,6 +493,24 @@ def OSRemotePCRestart(inHostStr, inForceBool=True, inLogger = None): if inForceBool == True: lCMDStr = lCMDStr + " -Force" OSCMD(inCMDStr=lCMDStr,inLogger=inLogger) +def OSRestart(inForceBool=True, inLogger = None): + """L+,W+: Отправить сигнал на перезагрузку операционной системы. + + !ВНИМАНИЕ! Перезапуск будет принят, если учетная запись имеет полномочия на перезапуск на соответсвующей машине. + + :param inForceBool: True - принудительная перезагрузка; False - мягкая перезагрузка (дождаться окончания выполнения всех операций). По умолчанию True + :param inLogger: Логгер, в который отправлять информацию о результате выполнения команды + :return: + """ + if inLogger is None: inLogger = OrchestratorLoggerGet() + if CrossOS.IS_WINDOWS_BOOL: + lCMDStr = f"shutdown -r" + if inForceBool == True: lCMDStr = lCMDStr + " -f" + elif CrossOS.IS_LINUX_BOOL: + lCMDStr = f"reboot" + if inForceBool == True: lCMDStr = lCMDStr + " -f" + OSCMD(inCMDStr=lCMDStr,inLogger=inLogger) + def OSCMD(inCMDStr, inRunAsyncBool=True, inLogger = None): """ Отправить команду на выполнение на сессию, где выполняется Оркестратор. diff --git a/Sources/pyOpenRPA/Robot/UIWeb.py b/Sources/pyOpenRPA/Robot/UIWeb.py index 93290849..da73a4bd 100644 --- a/Sources/pyOpenRPA/Robot/UIWeb.py +++ b/Sources/pyOpenRPA/Robot/UIWeb.py @@ -23,7 +23,7 @@ def BrowserChromeStart(inDriverExePathStr:str = None, inChromeExePathStr:str = N from pyOpenRPA.Robot import UIWeb UIWeb.BrowserChromeStart() UIWeb.BrowserClose() - + :param inDriverExePathStr: Путь до компонента webdriver.exe, по умолчанию None (путь до webdriver.exe, который расположен в репозитории pyOpenRPA) :type inDriverExePathStr: str, опционально :param inChromeExePathStr:Путь до компонента chrome.exe, по умолчанию None (путь до chrome.exe, который расположен в репозитории pyOpenRPA) diff --git a/Utils/Configure/ubuntu-kde/add_robot.sh b/Utils/Configure/ubuntu-kde/add_robot.sh new file mode 100644 index 00000000..7b8dcfb2 --- /dev/null +++ b/Utils/Configure/ubuntu-kde/add_robot.sh @@ -0,0 +1,160 @@ +#!/bin/bash + +#ВНИМАНИЕ! ЗАПУСКАТЬ ИЗ ПОД ROOT + +echo "Добро пожаловать в мастер добавления УЗ робота pyOpenRPA (ubuntu + kde plasma)" +echo "!ВНИМАНИЕ! Убедитесь в том, что скрипт запущен из под root (с правами администратора)" +echo "!ВНИМАНИЕ! Добавление УЗ роботов делать только после настройки УЗ оркестратора (см. configure.sh)" +read -p "Установите логин УЗ робота [например: rpa01]: " VAR_USER +VAR_USER=${VAR_USER:-rpa01} +read -p "Установите группу роботов на машине [по-умолчанию: rpa]: " VAR_ROBOTGROUP +VAR_ROBOTGROUP=${VAR_ROBOTGROUP:-rpa} +echo "Установите пароль [по-умолчанию: 123QWEasd]" +read -s VAR_PASSWORD +VAR_PASSWORD=${VAR_PASSWORD:-123QWEasd} +read -p "Установите номер терминала tty для УЗ оркестратора [по-умолчанию: 3]: " VAR_TTY +VAR_TTY_NUM=${VAR_TTY:-3} +VAR_TTY=tty${VAR_TTY:-3} +echo "Подключиться к УЗ робота после автоматической настройки можно будет через протокол VNC. Параметры для подключения: ip адрес виртуальной машины, порт (укажите ниже), пароль (от УЗ робота)" +read -p "Укажите номер порта для VNC [по-умолчанию: 5901]: " VAR_VNC_PORT +VAR_VNC_PORT=${VAR_VNC_PORT:-5901} + +# УЗ РОБОТА [TESTED+] +useradd -b /home -d /home/$VAR_USER -g $VAR_ROBOTGROUP -G ssh,tty,audio,video,mail -p $(openssl passwd -crypt $VAR_PASSWORD) -s /bin/bash $VAR_USER +mkhomedir_helper $VAR_USER +rm -rf /etc/systemd/system/getty@$VAR_TTY.service.d +mkdir -p /etc/systemd/system/getty@$VAR_TTY.service.d +cd /home/$VAR_USER +# alternative systemctl edit getty@$VAR_TTY +echo "\ +[Service] +ExecStart= +ExecStart=-/sbin/agetty --autologin $VAR_USER --noclear %I 38400 linux +" >> /etc/systemd/system/getty@$VAR_TTY.service.d/override.conf +systemctl enable getty@$VAR_TTY.service + +# СЕРВЕР X11VNC +rm -rf /home/$VAR_USER/x11vnc +mkdir -p /home/$VAR_USER/x11vnc +x11vnc -storepasswd "$VAR_PASSWORD" /home/$VAR_USER/x11vnc/pass +echo "\ +#!/bin/bash +x11vnc -noxdamage -shared -dontdisconnect -many -noxfixes -rfbauth /home/$VAR_USER/x11vnc/pass -rfbport $VAR_VNC_PORT +" >> /home/$VAR_USER/x11vnc/start.sh + +#СОЗДАТЬ XORG.CONF - ВИРТУАЛЬНЫЙ ВИДЕОДРАЙВЕР [TESTED+] +rm -rf /home/$VAR_USER/xorg.conf +echo "\ +Section \"Monitor\" + Identifier \"dummy_monitor\" + HorizSync 28.0-80.0 + VertRefresh 48.0-75.0 + Modeline \"1920x1080\" 172.80 1920 2040 2248 2576 1080 1081 1084 1118 +EndSection + +Section \"Device\" + Identifier \"dummy_card\" + VideoRam 256000 + Driver \"dummy\" +EndSection + +Section \"Screen\" + Identifier \"dummy_screen\" + Device \"dummy_card\" + Monitor \"dummy_monitor\" + SubSection \"Display\" + EndSubSection +EndSection +" >> /home/$VAR_USER/xorg.conf +chown $VAR_USER:$VAR_ROBOTGROUP /home/$VAR_USER/xorg.conf + +#СОЗДАТЬ .bash_profile для запуска графической подсистемы [TESTED+] +rm -rf /home/$VAR_USER/.bash_profile +echo "\ +export LANG=C.UTF-8 +export XORGCONFIG=/home/$VAR_USER/xorg.conf +sleep 3s +startx -- :$VAR_TTY_NUM +" >> /home/$VAR_USER/.bash_profile +chown $VAR_USER:$VAR_ROBOTGROUP /home/$VAR_USER/.bash_profile + +#ДОБАВИТЬ В АВТОЗАГРУЗКУ KDE AGENT [TESTED+] +rm -rf /home/$VAR_USER/.config/autostart/orpa-agent-start.sh.desktop +mkdir -p /home/$VAR_USER/.config/autostart +echo "\ +[Desktop Entry] +Comment[en_US]= +Comment= +Exec=/opt/rpa/OpenRPA-prd/Agent/start.sh +GenericName[en_US]= +GenericName= +Icon=system-run +MimeType= +Name[en_US]= +Name= +OnlyShowIn=KDE; +Path=/opt/rpa/OpenRPA-prd/Agent +StartupNotify=true +Terminal=true +TerminalOptions= +Type=Application +X-DBUS-ServiceName= +X-DBUS-StartupType=none +X-KDE-SubstituteUID=false +X-KDE-Username= +" >> /home/$VAR_USER/.config/autostart/orpa-agent-start.sh.desktop +chown $VAR_USER:$VAR_ROBOTGROUP /home/$VAR_USER/.config/autostart/orpa-agent-start.sh.desktop + +#ДОБАВИТЬ В АВТОЗАГРУЗКУ KDE X11VNC +rm -rf /home/$VAR_USER/.config/autostart/x11vnc-start.sh.desktop +mkdir -p /home/$VAR_USER/.config/autostart +echo "\ +[Desktop Entry] +Comment[en_US]= +Comment= +Exec=/home/$VAR_USER/x11vnc/start.sh +GenericName[en_US]= +GenericName= +Icon=system-run +MimeType= +Name[en_US]= +Name= +OnlyShowIn=KDE; +Path=/home/$VAR_USER/x11vnc +StartupNotify=true +Terminal=false +TerminalOptions= +Type=Application +X-DBUS-ServiceName= +X-DBUS-StartupType=none +X-KDE-SubstituteUID=false +X-KDE-Username= +" >> /home/$VAR_USER/.config/autostart/x11vnc-start.sh.desktop +chown $VAR_USER:$VAR_ROBOTGROUP /home/$VAR_USER/.config/autostart/x11vnc-start.sh.desktop + +#ОТКЛЮЧИТЬ LOCKSCREEN KDE [TESTED+] +rm -rf /home/$VAR_USER/.config/kscreenlockerrc +mkdir -p /home/$VAR_USER/.config +echo "\ +[$Version] +update_info=kscreenlocker.upd:0.1-autolock + +[Daemon] +Autolock=false +LockOnResume=false +" >> /home/$VAR_USER/.config/kscreenlockerrc +chown $VAR_USER:$VAR_ROBOTGROUP /home/$VAR_USER/.config/kscreenlockerrc + +#Рекурсивная установка группы RPA для всех каталогов внутри /opt/rpa [TESTED+] +cd .. +chown -R root:$VAR_ROBOTGROUP /opt/rpa +chmod -R 775 /opt/rpa + +## ПРАВА ДОСТУПА ДОМАШНЕГО КАТАЛОГА +chown -R $VAR_USER:$VAR_ROBOTGROUP /home/$VAR_USER +chmod -R 755 /home/$VAR_USER +## ПРАВА ДОСТУПА ВНУТРИ ДОМАШНЕГО КАТАЛОГА К X11VNC +chmod ugo+r /home/$VAR_USER/x11vnc/pass +chmod ug+x /home/$VAR_USER/x11vnc/start.sh + + diff --git a/Utils/Configure/ubuntu-kde/configure.sh b/Utils/Configure/ubuntu-kde/configure.sh new file mode 100644 index 00000000..97b0ff18 --- /dev/null +++ b/Utils/Configure/ubuntu-kde/configure.sh @@ -0,0 +1,223 @@ +#!/bin/bash + +#ВНИМАНИЕ! ЗАПУСКАТЬ ИЗ ПОД ROOT + +echo "Добро пожаловать в мастер настройки pyOpenRPA (ubuntu + kde plasma)" +echo "!ВНИМАНИЕ! Убедитесь в том, что скрипт запущен из под root (с правами администратора)" +read -p "Установите логин УЗ оркестратора [по-умолчанию: rpa00]: " VAR_USER +VAR_USER=${VAR_USER:-rpa00} +read -p "Установите группу роботов на машине [по-умолчанию: rpa]: " VAR_ROBOTGROUP +VAR_ROBOTGROUP=${VAR_ROBOTGROUP:-rpa} +echo "Установите пароль [по-умолчанию: 123QWEasd]" +read -s VAR_PASSWORD +VAR_PASSWORD=${VAR_PASSWORD:-123QWEasd} +read -p "Установите номер терминала tty для УЗ оркестратора [по-умолчанию: 2]: " VAR_TTY +VAR_TTY=tty${VAR_TTY:-2} +echo "Подключиться к УЗ оркестратора после автоматической настройки можно будет через протокол VNC. Параметры для подключения: ip адрес виртуальной машины, порт (укажите ниже), пароль (от УЗ оркестратора)" +read -p "Укажите номер порта для VNC [по-умолчанию: 5900]: " VAR_VNC_PORT +VAR_VNC_PORT=${VAR_VNC_PORT:-5900} + +# Установка компонентов [TESTED+] +apt update +apt upgrade +apt -y install aptitude +aptitude install kde-plasma-desktop +apt -y install x11vnc #VNC сервер для подключения к УЗ роботов/оркестратора +apt -y install krdc #Клиент для подключения к VNC/ RDP +apt -y install remmina # rdp client для оркестратора +apt -y install xserver-xorg-video-dummy # драйвер для создания виртуальных графических сессий +apt -y install ufw # фаервол +apt -y install wget # скачивальщик +apt -y install xinit # X сервер +apt -y install scrot # screenshots +apt -y install xclip # буфер обмена +apt -y install openssl # шифрование +apt -y install x11-xkb-utils # переключение раскладки + +# ПЕРЕНОС НАСТРОЕК SSH [TESTED+] +rm -rf /etc/ssh/sshd_config +mkdir -p /etc/ssh +cp sshd_config /etc/ssh/sshd_config +chmod -R 644 "/etc/ssh/sshd_config" +chown -R root:root /etc/ssh/sshd_config + +# НАСТРОЙКА ОКРУЖЕНИЯ [TESTED+] +cd /opt +groupadd rpa +mkdir rpa +chown -R root:rpa rpa +chmod -R 770 rpa + + +# Скомпилировать исправленную версию x11vnc [TESTED+] +cd /opt/rpa +apt -y install gcc +apt -y install make +apt -y install -y libxtst-dev libssl-dev libjpeg-dev +wget http://x11vnc.sourceforge.net/dev/x11vnc-0.9.14-dev.tar.gz +gzip -dc x11vnc-0.9.14-dev.tar.gz | tar -xvf - +cd x11vnc-0.9.14/ +./configure --prefix=/usr/local CFLAGS='-g -O2 -fno-stack-protector -Wall' +make +make install +cd .. +rm -rf x11vnc-0.9.14-dev.tar.gz + + +# Скачать pyOpenRPA [TESTED+] +cd /opt/rpa +wget https://gitlab.com/UnicodeLabs/OpenRPA/-/archive/prd/OpenRPA-prd.tar +tar -xvf OpenRPA-prd.tar +chmod ug+x "/opt/rpa/OpenRPA-prd/Resources/LChrome64-10305060114/data/chrome" +chmod ug+x "/opt/rpa/OpenRPA-prd/Resources/LChrome64-10305060114/data/chrome_crashpad_handler" +chmod ug+x "/opt/rpa/OpenRPA-prd/Resources/LPy64-3105/bin/python3.10" +chmod ug+x "/opt/rpa/OpenRPA-prd/Resources/SeleniumWebDrivers/Chrome/chromedriver_lin64 v103.0.5060.53/chromedriver" +chmod ug+x "/opt/rpa/OpenRPA-prd/Orchestrator/start.sh" +chmod ug+x "/opt/rpa/OpenRPA-prd/Agent/start.sh" +chmod ug+x "/opt/rpa/OpenRPA-prd/Utils/Jupyter-notebooks/start.sh" +rm OpenRPA-prd.tar + +#НЕ ГРУЗИТЬ ГРАФИЧЕСКИЙ МЕНЕДЖЕР ЛОГИНА (ДЛЯ РОБОТА ОН БЕСПОЛЕЗЕН) [TESTED+] +systemctl enable multi-user.target --force +systemctl set-default multi-user.target + +# УЗ ОРКЕСТРАТОРА [TESTED+] +useradd -b /home -d /home/$VAR_USER -g $VAR_ROBOTGROUP -G ssh,tty,audio,video,mail -p $(openssl passwd -crypt $VAR_PASSWORD) -s /bin/bash $VAR_USER +mkhomedir_helper $VAR_USER +rm -rf /etc/systemd/system/getty@$VAR_TTY.service.d +mkdir -p /etc/systemd/system/getty@$VAR_TTY.service.d +cd /home/$VAR_USER +# alternative systemctl edit getty@$VAR_TTY +echo "\ +[Service] +ExecStart= +ExecStart=-/sbin/agetty --autologin $VAR_USER --noclear %I 38400 linux +" >> /etc/systemd/system/getty@$VAR_TTY.service.d/override.conf +systemctl enable getty@$VAR_TTY.service + +# СЕРВЕР X11VNC +rm -rf /home/$VAR_USER/x11vnc +mkdir -p /home/$VAR_USER/x11vnc +x11vnc -storepasswd "$VAR_PASSWORD" /home/$VAR_USER/x11vnc/pass +echo "\ +#!/bin/bash +x11vnc -noxdamage -shared -dontdisconnect -many -noxfixes -rfbauth /home/$VAR_USER/x11vnc/pass -rfbport $VAR_VNC_PORT +" >> /home/$VAR_USER/x11vnc/start.sh + +#СОЗДАТЬ XORG.CONF - ВИРТУАЛЬНЫЙ ВИДЕОДРАЙВЕР [TESTED+] +rm -rf /home/$VAR_USER/xorg.conf +echo "\ +Section \"Monitor\" + Identifier \"dummy_monitor\" + HorizSync 28.0-80.0 + VertRefresh 48.0-75.0 + Modeline \"1920x1080\" 172.80 1920 2040 2248 2576 1080 1081 1084 1118 +EndSection + +Section \"Device\" + Identifier \"dummy_card\" + VideoRam 256000 + Driver \"dummy\" +EndSection + +Section \"Screen\" + Identifier \"dummy_screen\" + Device \"dummy_card\" + Monitor \"dummy_monitor\" + SubSection \"Display\" + EndSubSection +EndSection +" >> /home/$VAR_USER/xorg.conf +chown $VAR_USER:$VAR_ROBOTGROUP /home/$VAR_USER/xorg.conf + +#СОЗДАТЬ .bash_profile для запуска графической подсистемы [TESTED+] +rm -rf /home/$VAR_USER/.bash_profile +echo "\ +export LANG=C.UTF-8 +export XORGCONFIG=/home/$VAR_USER/xorg.conf +sleep 3s +startx +" >> /home/$VAR_USER/.bash_profile +chown $VAR_USER:$VAR_ROBOTGROUP /home/$VAR_USER/.bash_profile + +#ДОБАВИТЬ В АВТОЗАГРУЗКУ KDE ОРКЕСТРАТОР [TESTED+] +rm -rf /home/$VAR_USER/.config/autostart/orpa-orc-start.sh.desktop +mkdir -p /home/$VAR_USER/.config/autostart +echo "\ +[Desktop Entry] +Comment[en_US]= +Comment= +Exec=/opt/rpa/OpenRPA-prd/Orchestrator/start.sh +GenericName[en_US]= +GenericName= +Icon=system-run +MimeType= +Name[en_US]= +Name= +OnlyShowIn=KDE; +Path=/opt/rpa/OpenRPA-prd/Orchestrator +StartupNotify=true +Terminal=true +TerminalOptions= +Type=Application +X-DBUS-ServiceName= +X-DBUS-StartupType=none +X-KDE-SubstituteUID=false +X-KDE-Username= +" >> /home/$VAR_USER/.config/autostart/orpa-orc-start.sh.desktop +chown $VAR_USER:$VAR_ROBOTGROUP /home/$VAR_USER/.config/autostart/orpa-orc-start.sh.desktop + +#ДОБАВИТЬ В АВТОЗАГРУЗКУ KDE X11VNC +rm -rf /home/$VAR_USER/.config/autostart/x11vnc-start.sh.desktop +mkdir -p /home/$VAR_USER/.config/autostart +echo "\ +[Desktop Entry] +Comment[en_US]= +Comment= +Exec=/home/$VAR_USER/x11vnc/start.sh +GenericName[en_US]= +GenericName= +Icon=system-run +MimeType= +Name[en_US]= +Name= +OnlyShowIn=KDE; +Path=/home/$VAR_USER/x11vnc +StartupNotify=true +Terminal=false +TerminalOptions= +Type=Application +X-DBUS-ServiceName= +X-DBUS-StartupType=none +X-KDE-SubstituteUID=false +X-KDE-Username= +" >> /home/$VAR_USER/.config/autostart/x11vnc-start.sh.desktop +chown $VAR_USER:$VAR_ROBOTGROUP /home/$VAR_USER/.config/autostart/x11vnc-start.sh.desktop + +#ОТКЛЮЧИТЬ LOCKSCREEN KDE [TESTED+] +rm -rf /home/$VAR_USER/.config/kscreenlockerrc +mkdir -p /home/$VAR_USER/.config +echo "\ +[$Version] +update_info=kscreenlocker.upd:0.1-autolock + +[Daemon] +Autolock=false +LockOnResume=false +" >> /home/$VAR_USER/.config/kscreenlockerrc +chown $VAR_USER:$VAR_ROBOTGROUP /home/$VAR_USER/.config/kscreenlockerrc + +#Рекурсивная установка группы RPA для всех каталогов внутри /opt/rpa [TESTED+] +cd .. +chown -R root:$VAR_ROBOTGROUP /opt/rpa +chmod -R 775 /opt/rpa + +## ПРАВА ДОСТУПА ДОМАШНЕГО КАТАЛОГА +chown -R $VAR_USER:$VAR_ROBOTGROUP /home/$VAR_USER +chmod -R 755 /home/$VAR_USER +## ПРАВА ДОСТУПА ВНУТРИ ДОМАШНЕГО КАТАЛОГА К X11VNC +chmod ugo+r /home/$VAR_USER/x11vnc/pass +chmod ug+x /home/$VAR_USER/x11vnc/start.sh + +reboot -f + diff --git a/Utils/Configure/ubuntu-kde/sshd_config b/Utils/Configure/ubuntu-kde/sshd_config new file mode 100644 index 00000000..65308c95 --- /dev/null +++ b/Utils/Configure/ubuntu-kde/sshd_config @@ -0,0 +1,122 @@ +# $OpenBSD: sshd_config,v 1.101 2017/03/14 07:19:07 djm Exp $ + +# This is the sshd server system-wide configuration file. See +# sshd_config(5) for more information. + +# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin + +# The strategy used for options in the default sshd_config shipped with +# OpenSSH is to specify options with their default value where +# possible, but leave them commented. Uncommented options override the +# default value. + +#Port 22 +#AddressFamily any +#ListenAddress 0.0.0.0 +#ListenAddress :: + +#HostKey /etc/ssh/ssh_host_rsa_key +#HostKey /etc/ssh/ssh_host_ecdsa_key +#HostKey /etc/ssh/ssh_host_ed25519_key + +# Ciphers and keying +#RekeyLimit default none + +# Logging +#SyslogFacility AUTH +#LogLevel INFO + +# Authentication: + +#LoginGraceTime 2m +PermitRootLogin yes +#StrictModes yes +#MaxAuthTries 6 +#MaxSessions 10 + +#PubkeyAuthentication yes + +# Expect .ssh/authorized_keys2 to be disregarded by default in future. +#AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2 + +#AuthorizedPrincipalsFile none + +#AuthorizedKeysCommand none +#AuthorizedKeysCommandUser nobody + +# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts +#HostbasedAuthentication no +# Change to yes if you don't trust ~/.ssh/known_hosts for +# HostbasedAuthentication +#IgnoreUserKnownHosts no +# Don't read the user's ~/.rhosts and ~/.shosts files +#IgnoreRhosts yes + +# To disable tunneled clear text passwords, change to no here! +PasswordAuthentication yes +#PermitEmptyPasswords no + +# Change to yes to enable challenge-response passwords (beware issues with +# some PAM modules and threads) +ChallengeResponseAuthentication no + +# Kerberos options +#KerberosAuthentication no +#KerberosOrLocalPasswd yes +#KerberosTicketCleanup yes +#KerberosGetAFSToken no + +# GSSAPI options +#GSSAPIAuthentication no +#GSSAPICleanupCredentials yes +#GSSAPIStrictAcceptorCheck yes +#GSSAPIKeyExchange no + +# Set this to 'yes' to enable PAM authentication, account processing, +# and session processing. If this is enabled, PAM authentication will +# be allowed through the ChallengeResponseAuthentication and +# PasswordAuthentication. Depending on your PAM configuration, +# PAM authentication via ChallengeResponseAuthentication may bypass +PermitRootLogin yes +# If you just want the PAM account and session checks to run without +# PAM authentication, then enable this but set PasswordAuthentication +# and ChallengeResponseAuthentication to 'no'. +UsePAM yes + +#AllowAgentForwarding yes +#AllowTcpForwarding yes +#GatewayPorts no +X11Forwarding yes +X11DisplayOffset 10 +X11UseLocalhost yes +#PermitTTY yes +PrintMotd no +#PrintLastLog yes +#TCPKeepAlive yes +#UseLogin no +#PermitUserEnvironment no +#Compression delayed +#ClientAliveInterval 0 +#ClientAliveCountMax 3 +#UseDNS no +#PidFile /var/run/sshd.pid +#MaxStartups 10:30:100 +#PermitTunnel no +#ChrootDirectory none +#VersionAddendum none + +# no default banner path +#Banner none + +# Allow client to pass locale environment variables +AcceptEnv LANG LC_* + +# override default of no subsystems +Subsystem sftp /usr/lib/openssh/sftp-server + +# Example of overriding settings on a per-user basis +#Match User anoncvs +# X11Forwarding no +# AllowTcpForwarding no +# PermitTTY no +# ForceCommand cvs server diff --git a/Utils/Jupyter-notebooks/jupyter-notebook-run.cmd b/Utils/Jupyter-notebooks/start.cmd similarity index 100% rename from Utils/Jupyter-notebooks/jupyter-notebook-run.cmd rename to Utils/Jupyter-notebooks/start.cmd diff --git a/Utils/Jupyter-notebooks/jupyter-notebook.sh b/Utils/Jupyter-notebooks/start.sh similarity index 86% rename from Utils/Jupyter-notebooks/jupyter-notebook.sh rename to Utils/Jupyter-notebooks/start.sh index 9e33cce4..8765ab70 100644 --- a/Utils/Jupyter-notebooks/jupyter-notebook.sh +++ b/Utils/Jupyter-notebooks/start.sh @@ -1 +1,2 @@ +#!/bin/bash ./../../Resources/LPy64-3105/bin/python3.10 -m notebook --notebook-dir=$PWD