added security to server installation

This commit is contained in:
Saifeddine ALOUI 2024-02-19 23:02:21 +01:00
parent 4bc60c51a1
commit 2fb9f39082
10 changed files with 31 additions and 7 deletions

View File

@ -30,6 +30,12 @@ lollmsElfServer:LOLLMSWebUI = LOLLMSWebUI.get_instance()
@router.get("/install_motion_ctrl")
def install_motion_ctrl():
try:
if lollmsElfServer.config.headless_server_mode:
return {"status":False,"error":"Service installation is blocked when in headless mode for obvious security reasons!"}
if lollmsElfServer.config.host!="localhost" and lollmsElfServer.config.host!="127.0.0.1":
return {"status":False,"error":"Service installation is blocked when the server is exposed outside for very obvious reasons!"}
lollmsElfServer.ShowBlockingMessage("Installing Motion Ctrl api server\nPlease stand by")
from lollms.services.motion_ctrl.lollms_motion_ctrl import install_motion_ctrl
install_motion_ctrl(lollmsElfServer)

View File

@ -30,6 +30,12 @@ lollmsElfServer:LOLLMSWebUI = LOLLMSWebUI.get_instance()
@router.get("/install_ollama")
def install_ollama():
try:
if lollmsElfServer.config.headless_server_mode:
return {"status":False,"error":"Service installation is blocked when in headless mode for obvious security reasons!"}
if lollmsElfServer.config.host!="localhost" and lollmsElfServer.config.host!="127.0.0.1":
return {"status":False,"error":"Service installation is blocked when the server is exposed outside for very obvious reasons!"}
lollmsElfServer.ShowBlockingMessage("Installing ollama server\nPlease stand by")
from lollms.services.ollama.lollms_ollama import install_ollama
if install_ollama(lollmsElfServer):

View File

@ -30,6 +30,12 @@ lollmsElfServer:LOLLMSWebUI = LOLLMSWebUI.get_instance()
@router.get("/install_sd")
def install_sd():
try:
if lollmsElfServer.config.headless_server_mode:
return {"status":False,"error":"Service installation is blocked when in headless mode for obvious security reasons!"}
if lollmsElfServer.config.host!="localhost" and lollmsElfServer.config.host!="127.0.0.1":
return {"status":False,"error":"Service installation is blocked when the server is exposed outside for very obvious reasons!"}
lollmsElfServer.ShowBlockingMessage("Installing SD api server\nPlease stand by")
from lollms.services.sd.lollms_sd import install_sd
install_sd(lollmsElfServer)

View File

@ -29,6 +29,12 @@ lollmsElfServer:LOLLMSWebUI = LOLLMSWebUI.get_instance()
@router.get("/install_vllm")
def install_vllm():
try:
if lollmsElfServer.config.headless_server_mode:
return {"status":False,"error":"Service installation is blocked when in headless mode for obvious security reasons!"}
if lollmsElfServer.config.host!="localhost" and lollmsElfServer.config.host!="127.0.0.1":
return {"status":False,"error":"Service installation is blocked when the server is exposed outside for very obvious reasons!"}
lollmsElfServer.ShowBlockingMessage("Installing vllm server\nPlease stand by")
from lollms.services.vllm.lollms_vllm import install_vllm
if install_vllm(lollmsElfServer):

View File

@ -132,10 +132,10 @@ async def text2Audio(request: LollmsText2AudioRequest):
def install_xtts():
try:
if lollmsElfServer.config.headless_server_mode:
return {"status":False,"error":"Code execution is blocked when in headless mode for obvious security reasons!"}
return {"status":False,"error":"Service installation is blocked when in headless mode for obvious security reasons!"}
if lollmsElfServer.config.host!="localhost" and lollmsElfServer.config.host!="127.0.0.1":
return {"status":False,"error":"Code execution is blocked when the server is exposed outside for very obvious reasons!"}
return {"status":False,"error":"Service installation is blocked when the server is exposed outside for very obvious reasons!"}
from lollms.services.xtts.lollms_xtts import install_xtts
lollmsElfServer.ShowBlockingMessage("Installing xTTS api server\nPlease stand by")

View File

@ -6,7 +6,7 @@ if [ -e "$HOME/miniconda3/bin/conda" ]; then
else
echo "Conda is not installed. Please install it first."
echo Installing conda
curl -LOk https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
curl -LO https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
./Miniconda3-latest-Linux-x86_64.sh -b
$HOME/miniconda3/bin/conda init --all
rm ./Miniconda3-latest-Linux-x86_64.sh

View File

@ -6,7 +6,7 @@ if [ -e "$HOME/miniconda3/bin/conda" ]; then
else
echo "Conda is not installed. Please install it first."
echo Installing conda
curl -LOk https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
curl -LO https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
./Miniconda3-latest-Linux-x86_64.sh -b
rm ./Miniconda3-latest-Linux-x86_64.sh
echo Done

View File

@ -77,7 +77,7 @@ REPO_URL="https://github.com/ParisNeo/lollms.git"
if [ ! -f "$MINICONDA_DIR/Scripts/conda" ]; then
# Download miniconda
echo "Downloading Miniconda installer from $MINICONDA_DOWNLOAD_URL"
curl -LOk "$MINICONDA_DOWNLOAD_URL"
curl -LO "$MINICONDA_DOWNLOAD_URL"
# Install miniconda
echo

View File

@ -73,7 +73,7 @@ REPO_URL="https://github.com/ParisNeo/lollms.git"
if [ ! -f "$MINICONDA_DIR/Scripts/conda" ]; then
# Download Miniconda
echo "Downloading Miniconda installer from $MINICONDA_DOWNLOAD_URL"
curl -LOk "$MINICONDA_DOWNLOAD_URL"
curl -LO "$MINICONDA_DOWNLOAD_URL"
# Install Miniconda
echo

View File

@ -73,7 +73,7 @@ set REPO_URL=https://github.com/ParisNeo/lollms.git
if not exist "%MINICONDA_DIR%\Scripts\conda.exe" (
@rem download miniconda
echo Downloading Miniconda installer from %MINICONDA_DOWNLOAD_URL%
call curl -LOk "%MINICONDA_DOWNLOAD_URL%"
call curl -LO "%MINICONDA_DOWNLOAD_URL%"
@rem install miniconda
echo. && echo Installing Miniconda To "%MINICONDA_DIR%" && echo Please Wait... && echo.