Skip to content

Commit

Permalink
Release 0.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
wh1te909 committed Apr 16, 2021
2 parents b5603a5 + f453b16 commit d1c3fc8
Show file tree
Hide file tree
Showing 23 changed files with 202 additions and 130 deletions.
13 changes: 10 additions & 3 deletions api/tacticalrmm/agents/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,21 +166,28 @@ def has_patches_pending(self):

@property
def checks(self):
total, passing, failing = 0, 0, 0
total, passing, failing, warning, info = 0, 0, 0, 0, 0

if self.agentchecks.exists(): # type: ignore
for i in self.agentchecks.all(): # type: ignore
total += 1
if i.status == "passing":
passing += 1
elif i.status == "failing":
failing += 1
if i.alert_severity == "error":
failing += 1
elif i.alert_severity == "warning":
warning += 1
elif i.alert_severity == "info":
info += 1

ret = {
"total": total,
"passing": passing,
"failing": failing,
"has_failing_checks": failing > 0,
"warning": warning,
"info": info,
"has_failing_checks": failing > 0 or warning > 0,
}
return ret

Expand Down
19 changes: 3 additions & 16 deletions api/tacticalrmm/agents/tasks.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import asyncio
import datetime as dt
import random
import requests
import urllib.parse
from time import sleep
from typing import Union
Expand All @@ -21,21 +20,9 @@
logger.configure(**settings.LOG_CONFIG)


def _get_exegen_url() -> str:
urls: list[str] = settings.EXE_GEN_URLS
for url in urls:
try:
r = requests.get(url, timeout=10)
except:
continue

if r.status_code == 200:
return url

return random.choice(urls)


def agent_update(pk: int, codesigntoken: str = None) -> str:
from agents.utils import get_exegen_url

agent = Agent.objects.get(pk=pk)

if pyver.parse(agent.version) <= pyver.parse("1.3.0"):
Expand All @@ -52,7 +39,7 @@ def agent_update(pk: int, codesigntoken: str = None) -> str:
inno = agent.win_inno_exe

if codesigntoken is not None and pyver.parse(version) >= pyver.parse("1.5.0"):
base_url = _get_exegen_url() + "/api/v1/winagents/?"
base_url = get_exegen_url() + "/api/v1/winagents/?"
params = {"version": version, "arch": agent.arch, "token": codesigntoken}
url = base_url + urllib.parse.urlencode(params)
else:
Expand Down
2 changes: 1 addition & 1 deletion api/tacticalrmm/agents/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ def setUp(self):
self.authenticate()
self.setup_coresettings()

@patch("agents.tasks._get_exegen_url")
@patch("agents.utils.get_exegen_url")
@patch("agents.models.Agent.nats_cmd")
def test_agent_update(self, nats_cmd, get_exe):
from agents.tasks import agent_update
Expand Down
37 changes: 37 additions & 0 deletions api/tacticalrmm/agents/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import random
import requests
import urllib.parse

from django.conf import settings


def get_exegen_url() -> str:
urls: list[str] = settings.EXE_GEN_URLS
for url in urls:
try:
r = requests.get(url, timeout=10)
except:
continue

if r.status_code == 200:
return url

return random.choice(urls)


def get_winagent_url(arch: str) -> str:
from core.models import CodeSignToken

try:
codetoken = CodeSignToken.objects.first().token
base_url = get_exegen_url() + "/api/v1/winagents/?"
params = {
"version": settings.LATEST_AGENT_VER,
"arch": arch,
"token": codetoken,
}
dl_url = base_url + urllib.parse.urlencode(params)
except:
dl_url = settings.DL_64 if arch == "64" else settings.DL_32

return dl_url
3 changes: 2 additions & 1 deletion api/tacticalrmm/agents/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ def patch(self, request):

@api_view(["POST"])
def install_agent(request):
from agents.utils import get_winagent_url
from knox.models import AuthToken

client_id = request.data["client"]
Expand All @@ -375,7 +376,7 @@ def install_agent(request):
inno = (
f"winagent-v{version}.exe" if arch == "64" else f"winagent-v{version}-x86.exe"
)
download_url = settings.DL_64 if arch == "64" else settings.DL_32
download_url = get_winagent_url(arch)

_, token = AuthToken.objects.create(
user=request.user, expiry=dt.timedelta(hours=request.data["expires"])
Expand Down
10 changes: 9 additions & 1 deletion api/tacticalrmm/checks/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ def patch(self, request, pk):
check = get_object_or_404(Check, pk=pk)

# remove fields that should not be changed when editing a check from the frontend
if "check_alert" not in request.data.keys():
if (
"check_alert" not in request.data.keys()
and "check_reset" not in request.data.keys()
):
[request.data.pop(i) for i in check.non_editable_fields]

# set event id to 0 if wildcard because it needs to be an integer field for db
Expand All @@ -108,6 +111,11 @@ def patch(self, request, pk):
if check.policy:
update_policy_check_fields_task(checkpk=pk)

# resolve any alerts that are open
if "check_reset" in request.data.keys():
if obj.alert.filter(resolved=False).exists():
obj.alert.get(resolved=False).resolve()

return Response(f"{obj.readable_desc} was edited!")

def delete(self, request, pk):
Expand Down
32 changes: 24 additions & 8 deletions api/tacticalrmm/clients/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,24 @@ def has_failing_checks(self):
.prefetch_related("agentchecks")
)

failing = 0
data = {"error": False, "warning": False}

for agent in agents:
if agent.checks["has_failing_checks"]:
failing += 1

if agent.checks["warning"]:
data["warning"] = True

if agent.checks["failing"]:
data["error"] = True
break

if agent.overdue_email_alert or agent.overdue_text_alert:
if agent.status == "overdue":
failing += 1
data["error"] = True
break

return failing > 0
return data

@staticmethod
def serialize(client):
Expand Down Expand Up @@ -184,16 +192,24 @@ def has_failing_checks(self):
.prefetch_related("agentchecks")
)

failing = 0
data = {"error": False, "warning": False}

for agent in agents:

if agent.checks["has_failing_checks"]:
failing += 1
if agent.checks["warning"]:
data["warning"] = True

if agent.checks["failing"]:
data["error"] = True
break

if agent.overdue_email_alert or agent.overdue_text_alert:
if agent.status == "overdue":
failing += 1
data["error"] = True
break

return failing > 0
return data

@staticmethod
def serialize(site):
Expand Down
2 changes: 0 additions & 2 deletions api/tacticalrmm/clients/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ class SiteTreeSerializer(ModelSerializer):
class Meta:
model = Site
fields = "__all__"
ordering = ("failing_checks",)


class ClientTreeSerializer(ModelSerializer):
Expand All @@ -106,7 +105,6 @@ class ClientTreeSerializer(ModelSerializer):
class Meta:
model = Client
fields = "__all__"
ordering = ("failing_checks",)


class DeploymentSerializer(ModelSerializer):
Expand Down
30 changes: 20 additions & 10 deletions api/tacticalrmm/scripts/community_scripts.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"name": "Disk - Cleanup C: drive",
"description": "Cleans the C: drive's Window Temperary files, Windows SoftwareDistribution folder, the local users Temperary folder, IIS logs (if applicable) and empties the recycling bin. All deleted files will go into a log transcript in $env:TEMP. By default this script leaves files that are newer than 7 days old however this variable can be edited.",
"shell": "powershell",
"category": "TRMM (Win):Other"
"category": "TRMM (Win):Maintenance"
},
{
"guid": "2f28e8c1-ae0f-4b46-a826-f513974526a3",
Expand All @@ -75,7 +75,7 @@
"guid": "3c46290b-85db-4cd2-93a2-943c8c93b3b1",
"filename": "Speedtest.py",
"submittedBy": "https://github.com/wh1te909",
"name": "Network - Speed Test",
"name": "Speed Test - Python",
"description": "Runs a Speed Test using Python",
"shell": "python",
"category": "TRMM (Win):Network"
Expand All @@ -102,7 +102,7 @@
"guid": "2ea35fa2-c227-4d17-a40e-4d39f252e27a",
"filename": "Win_Bitlocker_Create_Status_Report.ps1",
"submittedBy": "https://github.com/ThatsNASt",
"name": "Create Bitlocker Status Report",
"name": "Bitlocker - Create Status Report",
"description": "Creates a Bitlocker status report.",
"shell": "powershell",
"category": "TRMM (Win):Storage"
Expand Down Expand Up @@ -228,7 +228,7 @@
"guid": "24f19ead-fdfe-46b4-9dcb-4cd0e12a3940",
"filename": "Win_Speedtest.ps1",
"submittedBy": "https://github.com/dinger1986",
"name": "Speed Test Powershell",
"name": "Speed Test - Powershell",
"description": "Speed Test with Powershell(win 10 or server2016+)",
"shell": "powershell",
"category": "TRMM (Win):Network"
Expand Down Expand Up @@ -327,7 +327,7 @@
"guid": "5615aa90-0272-427b-8acf-0ca019612501",
"filename": "Win_Chocolatey_Update_Installed.bat",
"submittedBy": "https://github.com/silversword411",
"name": "Chocolatey Update Installed Apps",
"name": "Update Installed Apps",
"description": "Update all apps that were installed using Chocolatey.",
"shell": "cmd",
"category": "TRMM (Win):3rd Party Software>Chocolatey"
Expand Down Expand Up @@ -394,7 +394,7 @@
"name": "Updates - Finish and restart",
"description": "Finish installing Windows updates and restart PC",
"shell": "powershell",
"category": "TRMM (Win):Other"
"category": "TRMM (Win):Updates"
},
{
"guid": "63f89be0-a9c9-4c61-9b55-bce0b28b90b2",
Expand All @@ -403,7 +403,7 @@
"name": "Updates - Finish and Shutdown",
"description": "Finish installing Windows updates and shutdown PC",
"shell": "powershell",
"category": "TRMM (Win):Other"
"category": "TRMM (Win):Updates"
},
{
"guid": "e09895d5-ca13-44a2-a38c-6e77c740f0e8",
Expand Down Expand Up @@ -460,6 +460,16 @@
"category": "TRMM (Win):Network",
"default_timeout": "90"
},
{
"guid": "abe78170-7cf9-435b-9666-c5ef6c11a106",
"filename": "Win_Network_IPv6_Disable.ps1",
"submittedBy": "https://github.com/silversword411",
"name": "Network IPv6 - Disable",
"description": "Disable IPv6 on all adapters",
"shell": "powershell",
"category": "TRMM (Win):Network",
"default_timeout": "90"
},
{
"guid": "6ce5682a-49db-4c0b-9417-609cf905ac43",
"filename": "Win_Win10_Change_Key_and_Activate.ps1",
Expand Down Expand Up @@ -563,9 +573,9 @@
},
{
"guid": "77da9c87-5a7a-4ba1-bdde-3eeb3b01d62d",
"filename": "Win_Set_Network_To_Private.ps1",
"filename": "Win_Network_Set_To_Private.ps1",
"submittedBy": "https://github.com/tremor021",
"name": "Set Network To Private",
"name": "Network Category - Set Network To Private",
"description": "Sets current network type to Private",
"shell": "powershell",
"category": "TRMM (Win):Network"
Expand All @@ -574,7 +584,7 @@
"guid": "768f42d5-7b45-45ed-8233-254ae537aaa2",
"filename": "Win_TaskScheduler_Add_Task.ps1",
"submittedBy": "https://github.com/tremor021",
"name": "Add task to TaskScheduler",
"name": "Task Scheduler - Add a task",
"description": "Add a task to Task Scheduler, needs editing",
"shell": "powershell",
"category": "TRMM (Win):Other"
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 @@ -15,14 +15,14 @@
AUTH_USER_MODEL = "accounts.User"

# latest release
TRMM_VERSION = "0.6.0"
TRMM_VERSION = "0.6.1"

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

# https://github.com/wh1te909/rmmagent
LATEST_AGENT_VER = "1.5.0"
LATEST_AGENT_VER = "1.5.1"

MESH_VER = "0.7.93"

Expand Down
4 changes: 2 additions & 2 deletions api/tacticalrmm/tacticalrmm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def generate_winagent_exe(
file_name: str,
) -> Union[Response, FileResponse]:

from agents.tasks import _get_exegen_url
from agents.utils import get_exegen_url

inno = (
f"winagent-v{settings.LATEST_AGENT_VER}.exe"
Expand All @@ -62,7 +62,7 @@ def generate_winagent_exe(

try:
codetoken = CodeSignToken.objects.first().token
base_url = _get_exegen_url() + "/api/v1/winagents/?"
base_url = get_exegen_url() + "/api/v1/winagents/?"
params = {
"version": settings.LATEST_AGENT_VER,
"arch": arch,
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/backup.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ A backup script is provided for quick and easy way to backup all settings into o

Download the backup script:
```bash
wget https://raw.githubusercontent.com/wh1te909/tacticalrmm/master/backup.sh
wget -N https://raw.githubusercontent.com/wh1te909/tacticalrmm/master/backup.sh
```

From the Web UI, click **Tools > Server Maintenance**
Expand Down
8 changes: 8 additions & 0 deletions scripts/Win_Network_IPv6_Disable.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#CVE-2020-16898 | Windows TCP/IP Remote Code Execution Vulnerability
#https://portal.msrc.microsoft.com/en-US/security-guidance/advisory/CVE-2020-16898

#Disable IPv6 on All Adapers
Disable-NetAdapterBinding -Name "*" -ComponentID ms_tcpip6

#Confirm That all NIC's no longer have IPv6 Enabled
(Get-NetAdapterBinding -Name '*' -ComponentID ms_tcpip6).Enabled
File renamed without changes.
Loading

0 comments on commit d1c3fc8

Please sign in to comment.