Merge branch 'dev-linux' of https://gitlab.com/UnicodeLabs/OpenRPA into dev-linux

dev-linux
robo-bo 2 years ago
commit df31babad0

2
.gitignore vendored

@ -17,6 +17,8 @@
/**/OpenRPA_Orchestrator.exe /**/OpenRPA_Orchestrator.exe
/**/OpenRPAOrchestrator.exe /**/OpenRPAOrchestrator.exe
/**/OpenRPARobotGUIx32.exe /**/OpenRPARobotGUIx32.exe
/**/orpa-orc.exe
/**/orpa-agent.exe
/**/OpenRPARobotGUIx64.exe /**/OpenRPARobotGUIx64.exe
/**/OpenRPAStudio.exe /**/OpenRPAStudio.exe
/**/OpenRPARobot.exe /**/OpenRPARobot.exe

@ -1,3 +0,0 @@
cd %~dp0
taskkill /F /FI "USERNAME eq %username%" /IM pyOpenRPA_Agent.exe
pause >nul

@ -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

@ -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

@ -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 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.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() gUserNameUpperStr = getpass.getuser().upper()
if __name__ == "__main__": # New init way if __name__ == "__main__": # New init way
gSettings = { gSettings = {
"OrchestratorDict":{ "OrchestratorDict":{
"IsHTTPSBool": False, # True - if server is secured HTTPS, False - if server is not secured HTTP "IsHTTPSBool": False, # True - if server is secured HTTPS, False - if server is not secured HTTP
"HostStr":"127.0.0.1", "HostStr":"127.0.0.1",
"PortInt":80, "PortInt":lPortInt,
"SuperTokenStr":"1992-04-03-0643-ru-b4ff-openrpa52zzz", # Access token to Orchestrator "SuperTokenStr":"1992-04-03-0643-ru-b4ff-openrpa52zzz", # Access token to Orchestrator
}, },
"O2ADict":{ "O2ADict":{
@ -57,7 +61,7 @@ if __name__ == "__main__": # New init way
lL.setLevel(logging.INFO) lL.setLevel(logging.INFO)
# create the logging file handler # create the logging file handler
mRobotLoggerFH = logging.FileHandler( 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') mRobotLoggerFormatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
mRobotLoggerFH.setFormatter(mRobotLoggerFormatter) mRobotLoggerFH.setFormatter(mRobotLoggerFormatter)
# add handler to logger object # add handler to logger object

@ -0,0 +1,3 @@
cd %~dp0
taskkill /F /FI "USERNAME eq %username%" /IM orpa-agent.exe
pause >nul

@ -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

@ -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

@ -0,0 +1,3 @@
#!/bin/bash
export PYTHONPATH="../Sources"
./../Resources/LPy64-3105/bin/python3.10 "config.py"

@ -23,6 +23,7 @@ else:
# TEST Add User ND - Add Login ND to superuser of the Orchestrator # TEST Add User ND - Add Login ND to superuser of the Orchestrator
lUACClientDict = SettingsTemplate.__UACClientAdminCreate__() lUACClientDict = SettingsTemplate.__UACClientAdminCreate__()
Orchestrator.UACUpdate(inGSettings=gSettings, inADLoginStr="ND", inADStr="", inADIsDefaultBool=True, inURLList=[], inRoleHierarchyAllowedDict=lUACClientDict) 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 # TEST Add User IMaslov - Add Login IMaslov to superuser of the Orchestrator
Orchestrator.UACUpdate(inGSettings=gSettings, inADLoginStr="IMaslov", inADStr="", inADIsDefaultBool=True, inURLList=[]) Orchestrator.UACUpdate(inGSettings=gSettings, inADLoginStr="IMaslov", inADStr="", inADIsDefaultBool=True, inURLList=[])
# TEST Add Supertoken for the all access between robots # TEST Add Supertoken for the all access between robots

@ -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

@ -1,2 +0,0 @@
export PYTHONPATH="../Sources"
./../Resources/LPy64-3105/bin/python3.10 "OrchestratorSettings.py"

@ -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

@ -0,0 +1,3 @@
#!/bin/bash
export PYTHONPATH="../Sources"
./../Resources/LPy64-3105/bin/python3.10 "config.py"

@ -3,7 +3,10 @@ from . import O2A, A2O # Data flow Orchestrator To Agent
from . import Processor # Processor Queue from . import Processor # Processor Queue
from ..Tools import Usage from ..Tools import Usage
from ..Tools import License 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 import os
gSettings = None gSettings = None
@ -142,8 +145,11 @@ def OSCMD(inCMDStr, inRunAsyncBool=True, inGSettings = None, inSendOutputToOrche
if inCaptureBool == True: if inCaptureBool == True:
lCMDProcess = subprocess.Popen(f'cmd /c {inCMDStr}', stdout=subprocess.PIPE, stderr=subprocess.STDOUT) lCMDProcess = subprocess.Popen(f'cmd /c {inCMDStr}', stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
else: else:
if CrossOS.IS_WINDOWS_BOOL:
lCMDProcess = subprocess.Popen(f'cmd /c {inCMDStr}', stdout=None, stderr=None, lCMDProcess = subprocess.Popen(f'cmd /c {inCMDStr}', stdout=None, stderr=None,
creationflags=CREATE_NEW_CONSOLE) creationflags=CREATE_NEW_CONSOLE)
if CrossOS.IS_LINUX_BOOL:
lCMDProcess = subprocess.Popen(f'cmd /c {inCMDStr}', stdout=None, stderr=None)
lListenBool = True lListenBool = True
lMessageStr = f"{lOSCMDKeyStr}: # # # # AGENT CMD Process has been STARTED # # # # " lMessageStr = f"{lOSCMDKeyStr}: # # # # AGENT CMD Process has been STARTED # # # # "
if lL: lL.info(lMessageStr) if lL: lL.info(lMessageStr)

@ -8,7 +8,7 @@ if CrossOS.IS_WINDOWS_BOOL: #CrossOS
getDisplayRects, saveScreenToBmp, saveRectToBmp, getScreenAsImage, getDisplayRects, saveScreenToBmp, saveRectToBmp, getScreenAsImage,
getRectAsImage, getDisplaysAsImages) getRectAsImage, getDisplaysAsImages)
if CrossOS.IS_LINUX_BOOL: pass if CrossOS.IS_LINUX_BOOL: import pyscreeze
from http import cookies from http import cookies
import uuid # generate UUID4 import uuid # generate UUID4
@ -197,9 +197,9 @@ def pyOpenRPA_Screenshot(inRequest,inGlobalDict):
# Get Screenshot # Get Screenshot
def SaveScreenshot(inFilePath): def SaveScreenshot(inFilePath):
# grab fullscreen # grab fullscreen
# Save the entire virtual screen as a PNG # Save the entire virtual screen as a PNsG
lScreenshot = getScreenAsImage() lScreenshot = getScreenAsImage()
lScreenshot.save('screenshot.png', format='png') lScreenshot.save('Screenshot.png', format='png')
# lScreenshot = ScreenshotSecondScreen.grab_screen() # lScreenshot = ScreenshotSecondScreen.grab_screen()
# save image file # save image file
# lScreenshot.save('screenshot.png') # lScreenshot.save('screenshot.png')
@ -211,7 +211,13 @@ def pyOpenRPA_Screenshot(inRequest,inGlobalDict):
inRequest.OpenRPAResponseDict["Body"] = lFileObject.read() inRequest.OpenRPAResponseDict["Body"] = lFileObject.read()
# Закрыть файловый объект # Закрыть файловый объект
lFileObject.close() 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 # Add activity item or activity list to the processor queue
# Body is Activity item or Activity List # Body is Activity item or Activity List

@ -340,7 +340,7 @@ def Create(inModeStr="BASIC", inLoggerLevel = None):
lL.setLevel(logging.INFO) lL.setLevel(logging.INFO)
# create the logging file handler # create the logging file handler
mRobotLoggerFH = logging.FileHandler( 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') mRobotLoggerFormatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
mRobotLoggerFH.setFormatter(mRobotLoggerFormatter) mRobotLoggerFH.setFormatter(mRobotLoggerFormatter)
# add handler to logger object # add handler to logger object

@ -493,6 +493,24 @@ def OSRemotePCRestart(inHostStr, inForceBool=True, inLogger = None):
if inForceBool == True: lCMDStr = lCMDStr + " -Force" if inForceBool == True: lCMDStr = lCMDStr + " -Force"
OSCMD(inCMDStr=lCMDStr,inLogger=inLogger) 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): def OSCMD(inCMDStr, inRunAsyncBool=True, inLogger = None):
""" """
Отправить команду на выполнение на сессию, где выполняется Оркестратор. Отправить команду на выполнение на сессию, где выполняется Оркестратор.

@ -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

@ -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

@ -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

@ -1 +1,2 @@
#!/bin/bash
./../../Resources/LPy64-3105/bin/python3.10 -m notebook --notebook-dir=$PWD ./../../Resources/LPy64-3105/bin/python3.10 -m notebook --notebook-dir=$PWD
Loading…
Cancel
Save