Skip to content

Commit

Permalink
Release 0.2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
wh1te909 committed Dec 7, 2020
2 parents ff69bed + f242ddd commit 9b7ac58
Show file tree
Hide file tree
Showing 21 changed files with 447 additions and 551 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/docker-build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
pull: true
file: ./docker/containers/tactical/dockerfile
platforms: linux/amd64
tags: tacticalrmm/tactical:${{ steps.prep.outputs.version }},sadnub/tactical:latest
tags: tacticalrmm/tactical:${{ steps.prep.outputs.version }},tacticalrmm/tactical:latest

- name: Build and Push Tactical MeshCentral Image
uses: docker/build-push-action@v2
Expand All @@ -45,7 +45,7 @@ jobs:
pull: true
file: ./docker/containers/tactical-meshcentral/dockerfile
platforms: linux/amd64
tags: tacticalrmm/tactical-meshcentral:${{ steps.prep.outputs.version }},sadnub/tactical-meshcentral:latest
tags: tacticalrmm/tactical-meshcentral:${{ steps.prep.outputs.version }},tacticalrmm/tactical-meshcentral:latest

- name: Build and Push Tactical NATS Image
uses: docker/build-push-action@v2
Expand All @@ -55,7 +55,7 @@ jobs:
pull: true
file: ./docker/containers/tactical-nats/dockerfile
platforms: linux/amd64
tags: tacticalrmm/tactical-nats:${{ steps.prep.outputs.version }},sadnub/tactical-nats:latest
tags: tacticalrmm/tactical-nats:${{ steps.prep.outputs.version }},tacticalrmm/tactical-nats:latest

- name: Build and Push Tactical Salt Image
uses: docker/build-push-action@v2
Expand All @@ -65,7 +65,7 @@ jobs:
pull: true
file: ./docker/containers/tactical-salt/dockerfile
platforms: linux/amd64
tags: tacticalrmm/tactical-salt:${{ steps.prep.outputs.version }},sadnub/tactical-salt:latest
tags: tacticalrmm/tactical-salt:${{ steps.prep.outputs.version }},tacticalrmm/tactical-salt:latest

- name: Build and Push Tactical Frontend Image
uses: docker/build-push-action@v2
Expand All @@ -75,7 +75,7 @@ jobs:
pull: true
file: ./docker/containers/tactical-frontend/dockerfile
platforms: linux/amd64
tags: tacticalrmm/tactical-frontend:${{ steps.prep.outputs.version }},sadnub/tactical-frontend:latest
tags: tacticalrmm/tactical-frontend:${{ steps.prep.outputs.version }},tacticalrmm/tactical-frontend:latest

- name: Build and Push Tactical Nginx Image
uses: docker/build-push-action@v2
Expand All @@ -85,4 +85,4 @@ jobs:
pull: true
file: ./docker/containers/tactical-nginx/dockerfile
platforms: linux/amd64
tags: tacticalrmm/tactical-nginx:${{ steps.prep.outputs.version }},sadnub/tactical-nginx:latest
tags: tacticalrmm/tactical-nginx:${{ steps.prep.outputs.version }},tacticalrmm/tactical-nginx:latest
1 change: 0 additions & 1 deletion api/tacticalrmm/.coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ omit =
*/urls.py
*/tests.py
*/test.py
api/*.py
checks/utils.py

1 change: 1 addition & 0 deletions api/tacticalrmm/agents/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ def serialize(agent):

ret = AgentEditSerializer(agent).data
del ret["all_timezones"]
del ret["client"]
return ret

@staticmethod
Expand Down
1 change: 1 addition & 0 deletions api/tacticalrmm/agents/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@
path("bulk/", views.bulk),
path("agent_counts/", views.agent_counts),
path("maintenance/", views.agent_maintenance),
path("<int:pk>/wmi/", views.WMI.as_view()),
]
15 changes: 15 additions & 0 deletions api/tacticalrmm/agents/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,9 @@ def patch(self, request):
},
}

if pyver.parse(agent.version) >= pyver.parse("1.1.2"):
nats_data["schedtaskpayload"]["deleteafter"] = True

r = asyncio.run(agent.nats_cmd(nats_data, timeout=10))
if r != "ok":
return notify_error(r)
Expand Down Expand Up @@ -895,3 +898,15 @@ def agent_maintenance(request):
return notify_error("Invalid data")

return Response("ok")


class WMI(APIView):
def get(self, request, pk):
agent = get_object_or_404(Agent, pk=pk)
if pyver.parse(agent.version) < pyver.parse("1.1.2"):
return notify_error("Requires agent version 1.1.2 or greater")

r = asyncio.run(agent.nats_cmd({"func": "sysinfo"}, timeout=20))
if r != "ok":
return notify_error("Unable to contact the agent")
return Response("ok")
7 changes: 7 additions & 0 deletions api/tacticalrmm/autotasks/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from django.conf import settings
import pytz
from django.utils import timezone as djangotime
from packaging import version as pyver

from .models import AutomatedTask
from logs.models import PendingAction
Expand Down Expand Up @@ -56,6 +57,11 @@ def create_win_task_schedule(pk, pending_action=False):
},
}

if task.remove_if_not_scheduled and pyver.parse(
task.agent.version
) >= pyver.parse("1.1.2"):
nats_data["schedtaskpayload"]["deleteafter"] = True

elif task.task_type == "checkfailure" or task.task_type == "manual":
nats_data = {
"func": "schedtask",
Expand Down Expand Up @@ -201,6 +207,7 @@ def remove_orphaned_win_tasks(agentpk):
"TacticalRMM_fixmesh",
"TacticalRMM_SchedReboot",
"TacticalRMM_sync",
"TacticalRMM_agentupdate",
)

for task in r:
Expand Down
13 changes: 6 additions & 7 deletions api/tacticalrmm/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
amqp==2.6.1
asgiref==3.3.0
asgiref==3.3.1
asyncio-nats-client==0.11.4
billiard==3.6.3.0
celery==4.4.6
certifi==2020.11.8
certifi==2020.12.5
cffi==1.14.3
chardet==3.0.4
cryptography==3.2.1
decorator==4.4.2
Django==3.1.3
Django==3.1.4
django-cors-headers==3.5.0
django-rest-knox==4.1.0
djangorestframework==3.12.2
Expand All @@ -26,12 +26,11 @@ pyparsing==2.4.7
pytz==2020.4
qrcode==6.1
redis==3.5.3
requests==2.24.0
requests==2.25.0
six==1.15.0
sqlparse==0.4.1
tldextract==3.0.2
twilio==6.47.0
urllib3==1.25.11
twilio==6.49.0
urllib3==1.26.2
uWSGI==2.0.19.1
validators==0.18.1
vine==1.3.0
Expand Down
9 changes: 5 additions & 4 deletions api/tacticalrmm/tacticalrmm/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@ def get_debug_info():
EXCLUDE_PATHS = (
"/api/v3",
"/api/v2",
"/api/v1",
"/logs/auditlogs",
"/winupdate/winupdater",
"/winupdate/results",
f"/{settings.ADMIN_URL}",
"/logout",
"/agents/installagent",
"/logs/downloadlog",
)

ENDS_WITH = "/refreshedservices/"


class AuditMiddleware:
def __init__(self, get_response):
Expand All @@ -37,7 +36,9 @@ def __call__(self, request):
return response

def process_view(self, request, view_func, view_args, view_kwargs):
if not request.path.startswith(EXCLUDE_PATHS):
if not request.path.startswith(EXCLUDE_PATHS) and not request.path.endswith(
ENDS_WITH
):
# https://stackoverflow.com/questions/26240832/django-and-middleware-which-uses-request-user-is-always-anonymous
try:
# DRF saves the class of the view function as the .cls property
Expand Down
10 changes: 5 additions & 5 deletions api/tacticalrmm/tacticalrmm/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,25 @@
AUTH_USER_MODEL = "accounts.User"

# latest release
TRMM_VERSION = "0.2.5"
TRMM_VERSION = "0.2.6"

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

# https://github.com/wh1te909/salt
LATEST_SALT_VER = "1.1.0"

# https://github.com/wh1te909/rmmagent
LATEST_AGENT_VER = "1.1.1"
LATEST_AGENT_VER = "1.1.2"

MESH_VER = "0.7.10"

SALT_MASTER_VER = "3002.2"

# for the update script, bump when need to recreate venv or npm install
PIP_VER = "3"
NPM_VER = "2"
PIP_VER = "4"
NPM_VER = "3"

DL_64 = f"https://github.com/wh1te909/rmmagent/releases/download/v{LATEST_AGENT_VER}/winagent-v{LATEST_AGENT_VER}.exe"
DL_32 = f"https://github.com/wh1te909/rmmagent/releases/download/v{LATEST_AGENT_VER}/winagent-v{LATEST_AGENT_VER}-x86.exe"
Expand Down
2 changes: 2 additions & 0 deletions api/tacticalrmm/tacticalrmm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
import string
import subprocess
import time
from typing import List, Dict
from loguru import logger

Expand Down Expand Up @@ -117,6 +118,7 @@ def reload_nats():
json.dump(config, f)

if not settings.DOCKER_BUILD:
time.sleep(0.5)
subprocess.run(
["/usr/local/bin/nats-server", "-signal", "reload"], capture_output=True
)
2 changes: 1 addition & 1 deletion api/tacticalrmm/winupdate/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def check_agent_update_schedule_task():
def check_for_updates_task(pk, wait=False, auto_approve=False):

if wait:
sleep(70)
sleep(120)

agent = Agent.objects.get(pk=pk)
ret = agent.salt_api_cmd(
Expand Down
3 changes: 0 additions & 3 deletions api/tacticalrmm/winupdate/urls.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
from django.urls import path
from . import views
from apiv3 import views as v3_views

urlpatterns = [
path("<int:pk>/getwinupdates/", views.get_win_updates),
path("<int:pk>/runupdatescan/", views.run_update_scan),
path("editpolicy/", views.edit_policy),
path("winupdater/", views.win_updater),
path("results/", v3_views.WinUpdater.as_view()),
path("<int:pk>/installnow/", views.install_updates),
]
17 changes: 0 additions & 17 deletions api/tacticalrmm/winupdate/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,3 @@ def edit_policy(request):
patch.action = request.data["policy"]
patch.save(update_fields=["action"])
return Response("ok")


@api_view()
@authentication_classes((TokenAuthentication,))
@permission_classes((IsAuthenticated,))
def win_updater(request):
agent = get_object_or_404(Agent, agent_id=request.data["agent_id"])
agent.delete_superseded_updates()
patches = (
WinUpdate.objects.filter(agent=agent)
.exclude(installed=True)
.filter(action="approve")
)
if patches:
return Response(ApprovedUpdateSerializer(patches, many=True).data)

return Response("nopatches")
10 changes: 8 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,21 @@ jobs:
source env/bin/activate
cd /myagent/_work/1/s/api/tacticalrmm
pip install --no-cache-dir --upgrade pip
pip install --no-cache-dir setuptools==49.6.0 wheel==0.35.1
pip install --no-cache-dir setuptools==50.3.2 wheel==0.36.1
pip install --no-cache-dir -r requirements.txt -r requirements-test.txt
displayName: "Install Python Dependencies"
- script: |
cd /myagent/_work/1/s/api
git config user.email "[email protected]"
git config user.name "Bob"
git fetch
git checkout develop
git pull
source env/bin/activate
cd /myagent/_work/1/s/api/tacticalrmm
python manage.py test -v 2
coverage run manage.py test -v 2
coveralls
displayName: "Run django tests"
- script: |
Expand Down
4 changes: 2 additions & 2 deletions docker/containers/tactical/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ DEBUG = False
DOCKER_BUILD = True
CERT_FILE = '/opt/tactical/certs/fullchain.pem'
CERT_KEY = '/opt/tactical/certs/privkey.pem'
KEY_FILE = '/opt/tactical/certs/privkey.pem'
SCRIPTS_DIR = '/opt/tactical/scripts'
Expand Down Expand Up @@ -180,4 +180,4 @@ fi
if [ "$1" = 'tactical-celerywinupdate' ]; then
check_tactical_ready
celery -A tacticalrmm worker -Q wupdate
fi
fi
4 changes: 2 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

SCRIPT_VERSION="26"
SCRIPT_VERSION="27"
SCRIPT_URL='https://raw.githubusercontent.com/wh1te909/tacticalrmm/master/install.sh'

GREEN='\033[0;32m'
Expand Down Expand Up @@ -352,7 +352,7 @@ python3 -m venv env
source /rmm/api/env/bin/activate
cd /rmm/api/tacticalrmm
pip install --no-cache-dir --upgrade pip
pip install --no-cache-dir setuptools==49.6.0 wheel==0.35.1
pip install --no-cache-dir setuptools==50.3.2 wheel==0.36.1
pip install --no-cache-dir -r /rmm/api/tacticalrmm/requirements.txt
python manage.py migrate
python manage.py collectstatic --no-input
Expand Down
4 changes: 2 additions & 2 deletions restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pgpw="hunter2"

#####################################################

SCRIPT_VERSION="9"
SCRIPT_VERSION="10"
SCRIPT_URL='https://raw.githubusercontent.com/wh1te909/tacticalrmm/master/restore.sh'

GREEN='\033[0;32m'
Expand Down Expand Up @@ -246,7 +246,7 @@ python3 -m venv env
source /rmm/api/env/bin/activate
cd /rmm/api/tacticalrmm
pip install --no-cache-dir --upgrade pip
pip install --no-cache-dir setuptools==49.6.0 wheel==0.35.1
pip install --no-cache-dir setuptools==50.3.2 wheel==0.36.1
pip install --no-cache-dir -r /rmm/api/tacticalrmm/requirements.txt
python manage.py collectstatic --no-input
python manage.py reload_nats
Expand Down
4 changes: 2 additions & 2 deletions update.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

SCRIPT_VERSION="98"
SCRIPT_VERSION="99"
SCRIPT_URL='https://raw.githubusercontent.com/wh1te909/tacticalrmm/master/update.sh'
LATEST_SETTINGS_URL='https://raw.githubusercontent.com/wh1te909/tacticalrmm/master/api/tacticalrmm/tacticalrmm/settings.py'
YELLOW='\033[1;33m'
Expand Down Expand Up @@ -184,7 +184,7 @@ if [[ "${CURRENT_PIP_VER}" != "${LATEST_PIP_VER}" ]]; then
source /rmm/api/env/bin/activate
cd /rmm/api/tacticalrmm
pip install --no-cache-dir --upgrade pip
pip install --no-cache-dir setuptools==49.6.0 wheel==0.35.1
pip install --no-cache-dir setuptools==50.3.2 wheel==0.36.1
pip install --no-cache-dir -r requirements.txt
else
source /rmm/api/env/bin/activate
Expand Down
Loading

0 comments on commit 9b7ac58

Please sign in to comment.