Skip to content

Commit

Permalink
Release 0.19.3
Browse files Browse the repository at this point in the history
  • Loading branch information
wh1te909 committed Aug 5, 2024
2 parents 4a768de + 751b0ef commit efb0748
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 8 deletions.
2 changes: 1 addition & 1 deletion api/tacticalrmm/agents/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def run_script_email_results_task(
return

CORE = get_core_settings()
subject = f"{agent.hostname} {script.name} Results"
subject = f"{agent.client.name}, {agent.site.name}, {agent.hostname} {script.name} Results"
exec_time = "{:.4f}".format(r["execution_time"])
body = (
subject
Expand Down
2 changes: 2 additions & 0 deletions api/tacticalrmm/core/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class CustomFieldPerms(permissions.BasePermission):
def has_permission(self, r, view) -> bool:
if r.method == "GET":
return _has_perm(r, "can_view_customfields")
elif r.method == "PATCH" and view.__class__.__name__ == "GetAddCustomFields":
return _has_perm(r, "can_view_customfields")

return _has_perm(r, "can_manage_customfields")

Expand Down
26 changes: 24 additions & 2 deletions api/tacticalrmm/core/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import os
import re
import subprocess
import tempfile
import time
Expand All @@ -16,6 +17,7 @@
from django.http import FileResponse
from meshctrl.utils import get_auth_token
from requests.utils import requote_uri

from tacticalrmm.constants import (
AGENT_TBL_PEND_ACTION_CNT_CACHE_PREFIX,
CORESETTINGS_CACHE_KEY,
Expand Down Expand Up @@ -231,14 +233,34 @@ def find_and_replace_db_values_str(*, text: str, instance):
return return_string


# usually for stderr fields that contain windows file paths, like {{alert.get_result.stderr}}
# but preserves newlines or tabs
# removes all control chars
def _sanitize_webhook(s: str) -> str:
s = re.sub(r"[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\x9f]", " ", s)
s = re.sub(r"(?<!\\)(\\)(?![\\nrt])", r"\\\\", s)
return s


def _run_url_rest_action(*, url: str, method, body: str, headers: str, instance=None):
# replace url
new_url = find_and_replace_db_values_str(text=url, instance=instance)
new_body = find_and_replace_db_values_str(text=body, instance=instance)
new_headers = find_and_replace_db_values_str(text=headers, instance=instance)
new_url = requote_uri(new_url)
new_body = json.loads(new_body)
new_headers = json.loads(new_headers)

new_body = _sanitize_webhook(new_body)
try:
new_body = json.loads(new_body, strict=False)
except Exception as e:
logger.error(f"{e=} {body=}")
logger.error(f"{new_body=}")

try:
new_headers = json.loads(new_headers, strict=False)
except Exception as e:
logger.error(f"{e=} {headers=}")
logger.error(f"{new_headers=}")

if method in ("get", "delete"):
return getattr(requests, method)(new_url, headers=new_headers)
Expand Down
6 changes: 3 additions & 3 deletions api/tacticalrmm/tacticalrmm/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
AUTH_USER_MODEL = "accounts.User"

# latest release
TRMM_VERSION = "0.19.2"
TRMM_VERSION = "0.19.3"

# https://github.com/amidaware/tacticalrmm-web
WEB_VERSION = "0.101.47"
WEB_VERSION = "0.101.48"

# bump this version everytime vue code is changed
# to alert user they need to manually refresh their browser
APP_VER = "0.0.193"
APP_VER = "0.0.194"

# https://github.com/amidaware/rmmagent
LATEST_AGENT_VER = "2.8.0"
Expand Down
6 changes: 6 additions & 0 deletions docker/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,9 @@ MESH_PERSISTENT_CONFIG=0
# database settings
POSTGRES_USER=postgres
POSTGRES_PASS=postgrespass

# disable web terminal
TRMM_DISABLE_WEB_TERMINAL=False

# disable server side scripts
TRMM_DISABLE_SERVER_SCRIPTS=False
4 changes: 4 additions & 0 deletions docker/containers/tactical/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ set -e
: "${APP_HOST:=tactical-frontend}"
: "${REDIS_HOST:=tactical-redis}"
: "${SKIP_UWSGI_CONFIG:=0}"
: "${TRMM_DISABLE_WEB_TERMINAL:=False}"
: "${TRMM_DISABLE_SERVER_SCRIPTS:=False}"

: "${CERT_PRIV_PATH:=${TACTICAL_DIR}/certs/privkey.pem}"
: "${CERT_PUB_PATH:=${TACTICAL_DIR}/certs/fullchain.pem}"
Expand Down Expand Up @@ -111,6 +113,8 @@ MESH_TOKEN_KEY = '${MESH_TOKEN}'
REDIS_HOST = '${REDIS_HOST}'
MESH_WS_URL = '${MESH_WS_URL}'
ADMIN_ENABLED = False
TRMM_DISABLE_WEB_TERMINAL = ${TRMM_DISABLE_WEB_TERMINAL}
TRMM_DISABLE_SERVER_SCRIPTS = ${TRMM_DISABLE_SERVER_SCRIPTS}
EOF
)"

Expand Down
2 changes: 2 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ services:
MESH_HOST: ${MESH_HOST}
TRMM_USER: ${TRMM_USER}
TRMM_PASS: ${TRMM_PASS}
TRMM_DISABLE_WEB_TERMINAL: ${TRMM_DISABLE_WEB_TERMINAL}
TRMM_DISABLE_SERVER_SCRIPTS: ${TRMM_DISABLE_SERVER_SCRIPTS}
depends_on:
- tactical-postgres
- tactical-meshcentral
Expand Down
12 changes: 11 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

SCRIPT_VERSION="84"
SCRIPT_VERSION="85"
SCRIPT_URL="https://raw.githubusercontent.com/amidaware/tacticalrmm/master/install.sh"

sudo apt install -y curl wget dirmngr gnupg lsb-release ca-certificates
Expand Down Expand Up @@ -79,6 +79,16 @@ else
exit 1
fi

if dpkg -l | grep -qi turnkey; then
echo -ne "${RED}Turnkey linux is not supported. Please use the official debian/ubuntu ISO.${NC}\n"
exit 1
fi

if ps aux | grep -v grep | grep -qi webmin; then
echo -ne "${RED}Webmin running, should not be installed. Please use the official debian/ubuntu ISO.${NC}\n"
exit 1
fi

if [ $EUID -eq 0 ]; then
echo -ne "${RED}Do NOT run this script as root. Exiting.${NC}\n"
exit 1
Expand Down
12 changes: 11 additions & 1 deletion restore.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

SCRIPT_VERSION="58"
SCRIPT_VERSION="59"
SCRIPT_URL='https://raw.githubusercontent.com/amidaware/tacticalrmm/master/restore.sh'

sudo apt update
Expand Down Expand Up @@ -75,6 +75,16 @@ else
exit 1
fi

if dpkg -l | grep -qi turnkey; then
echo -ne "${RED}Turnkey linux is not supported. Please use the official debian/ubuntu ISO.${NC}\n"
exit 1
fi

if ps aux | grep -v grep | grep -qi webmin; then
echo -ne "${RED}Webmin running, should not be installed. Please use the official debian/ubuntu ISO.${NC}\n"
exit 1
fi

if [ $EUID -eq 0 ]; then
echo -ne "\033[0;31mDo NOT run this script as root. Exiting.\e[0m\n"
exit 1
Expand Down

0 comments on commit efb0748

Please sign in to comment.