Skip to content

Commit

Permalink
Release 0.15.9
Browse files Browse the repository at this point in the history
  • Loading branch information
wh1te909 committed Apr 9, 2023
2 parents 4f44671 + 741c74e commit b544809
Show file tree
Hide file tree
Showing 19 changed files with 104 additions and 57 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/api.dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# pulls community scripts from git repo
FROM python:3.11.2-slim AS GET_SCRIPTS_STAGE
FROM python:3.11.3-slim AS GET_SCRIPTS_STAGE

RUN apt-get update && \
apt-get install -y --no-install-recommends git && \
git clone https://github.com/amidaware/community-scripts.git /community-scripts

FROM python:3.11.2-slim
FROM python:3.11.3-slim

ENV TACTICAL_DIR /opt/tactical
ENV TACTICAL_READY_FILE ${TACTICAL_DIR}/tmp/tactical.ready
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
name: Tests
strategy:
matrix:
python-version: ["3.11.2"]
python-version: ["3.11.3"]

steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions ansible/roles/trmm_dev/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
user: "tactical"
python_ver: "3.11.2"
go_ver: "1.19.7"
python_ver: "3.11.3"
go_ver: "1.20.3"
backend_repo: "https://github.com/amidaware/tacticalrmm.git"
frontend_repo: "https://github.com/amidaware/tacticalrmm-web.git"
scripts_repo: "https://github.com/amidaware/community-scripts.git"
Expand Down
32 changes: 21 additions & 11 deletions api/tacticalrmm/agents/management/commands/bulk_delete_agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ def add_arguments(self, parser):
type=str,
help="Delete agents that belong to the specified client",
)
parser.add_argument(
"--hostname",
type=str,
help="Delete agents with hostname starting with argument",
)
parser.add_argument(
"--delete",
action="store_true",
Expand All @@ -44,33 +49,38 @@ def handle(self, *args, **kwargs):
agentver = kwargs["agentver"]
site = kwargs["site"]
client = kwargs["client"]
hostname = kwargs["hostname"]
delete = kwargs["delete"]

if not days and not agentver and not site and not client:
if not days and not agentver and not site and not client and not hostname:
self.stdout.write(
self.style.ERROR(
"Must have at least one parameter: days, agentver, site, or client"
"Must have at least one parameter: days, agentver, site, client or hostname"
)
)
return

q = Agent.objects.defer(*AGENT_DEFER)
agents = Agent.objects.select_related("site__client").defer(*AGENT_DEFER)

agents = []
if days:
overdue = djangotime.now() - djangotime.timedelta(days=days)
agents = [i for i in q if i.last_seen < overdue]

if agentver:
agents = [i for i in q if pyver.parse(i.version) <= pyver.parse(agentver)]
agents = agents.filter(last_seen__lt=overdue)

if site:
agents = [i for i in q if i.site.name == site]
agents = agents.filter(site__name=site)

if client:
agents = [i for i in q if i.client.name == client]
agents = agents.filter(site__client__name=client)

if hostname:
agents = agents.filter(hostname__istartswith=hostname)

if agentver:
agents = [
i for i in agents if pyver.parse(i.version) <= pyver.parse(agentver)
]

if not agents:
if len(agents) == 0:
self.stdout.write(self.style.ERROR("No agents matched"))
return

Expand Down
2 changes: 2 additions & 0 deletions api/tacticalrmm/agents/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class AgentTableSerializer(serializers.ModelSerializer):
local_ips = serializers.ReadOnlyField()
make_model = serializers.ReadOnlyField()
physical_disks = serializers.ReadOnlyField()
custom_fields = AgentCustomFieldSerializer(many=True, read_only=True)

def get_alert_template(self, obj):
if not obj.alert_template:
Expand Down Expand Up @@ -153,6 +154,7 @@ class Meta:
"local_ips",
"make_model",
"physical_disks",
"custom_fields",
]
depth = 2

Expand Down
4 changes: 4 additions & 0 deletions api/tacticalrmm/agents/tests/test_agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,12 +573,14 @@ def test_run_script(self, run_script, email_task):
}
r = self.client.post(url, data, format="json")
self.assertEqual(r.status_code, 200)
hist = AgentHistory.objects.filter(agent=self.agent, script=script).last()
email_task.assert_called_with(
agentpk=self.agent.pk,
scriptpk=script.pk,
nats_timeout=18,
emails=[],
args=["abc", "123"],
history_pk=hist.pk,
run_as_user=False,
env_vars=["hello=world", "foo=bar"],
)
Expand All @@ -588,12 +590,14 @@ def test_run_script(self, run_script, email_task):
data["emailMode"] = "custom"
r = self.client.post(url, data, format="json")
self.assertEqual(r.status_code, 200)
hist = AgentHistory.objects.filter(agent=self.agent, script=script).last()
email_task.assert_called_with(
agentpk=self.agent.pk,
scriptpk=script.pk,
nats_timeout=18,
emails=["[email protected]", "[email protected]"],
args=["abc", "123"],
history_pk=hist.pk,
run_as_user=False,
env_vars=["hello=world", "foo=bar"],
)
Expand Down
38 changes: 36 additions & 2 deletions api/tacticalrmm/agents/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
_has_perm_on_site,
)
from tacticalrmm.utils import get_default_timezone, reload_nats
from winupdate.models import WinUpdate
from winupdate.models import WinUpdate, WinUpdatePolicy
from winupdate.serializers import WinUpdatePolicySerializer
from winupdate.tasks import bulk_check_for_updates_task, bulk_install_updates_task

Expand Down Expand Up @@ -134,6 +134,10 @@ def get(self, request):
"checkresults",
queryset=CheckResult.objects.select_related("assigned_check"),
),
Prefetch(
"custom_fields",
queryset=AgentCustomField.objects.select_related("field"),
),
)
.annotate(
has_patches_pending=Exists(
Expand Down Expand Up @@ -183,7 +187,36 @@ class Meta:

# get agent details
def get(self, request, agent_id):
agent = get_object_or_404(Agent, agent_id=agent_id)
from checks.models import Check, CheckResult

agent = get_object_or_404(
Agent.objects.select_related(
"site__server_policy",
"site__workstation_policy",
"site__client__server_policy",
"site__client__workstation_policy",
"policy",
"alert_template",
).prefetch_related(
Prefetch(
"agentchecks",
queryset=Check.objects.select_related("script"),
),
Prefetch(
"checkresults",
queryset=CheckResult.objects.select_related("assigned_check"),
),
Prefetch(
"custom_fields",
queryset=AgentCustomField.objects.select_related("field"),
),
Prefetch(
"winupdatepolicy",
queryset=WinUpdatePolicy.objects.select_related("agent", "policy"),
),
),
agent_id=agent_id,
)
return Response(AgentSerializer(agent).data)

# edit agent
Expand Down Expand Up @@ -742,6 +775,7 @@ def run_script(request, agent_id):
nats_timeout=req_timeout,
emails=emails,
args=args,
history_pk=history_pk,
run_as_user=run_as_user,
env_vars=env_vars,
)
Expand Down
2 changes: 1 addition & 1 deletion api/tacticalrmm/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ django-extensions
isort
types-pytz
django-silk
mypy==0.982
mypy
django-stubs
djangorestframework-stubs
django-types
Expand Down
17 changes: 8 additions & 9 deletions api/tacticalrmm/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
adrf==0.1.1
asgiref==3.6.0
celery==5.2.7
certifi==2022.12.7
cffi==1.15.1
channels==4.0.0
channels_redis==4.0.0
channels_redis==4.1.0
chardet==4.0.0
cryptography==39.0.2
cryptography==40.0.1
daphne==4.0.0
Django==4.1.7
Django==4.1.8
django-cors-headers==3.14.0
django-ipware==5.0.0
django-rest-knox==4.2.0
Expand All @@ -20,21 +19,21 @@ msgpack==1.0.5
nats-py==2.2.0
packaging==23.0
psutil==5.9.4
psycopg2-binary==2.9.5
psycopg2-binary==2.9.6
pycparser==2.21
pycryptodome==3.17
pyotp==2.8.0
pyparsing==3.0.9
pytz==2022.7.1
pytz==2023.3
qrcode==7.4.2
redis==4.3.5
redis==4.5.4
requests==2.28.2
six==1.16.0
sqlparse==0.4.3
twilio==7.16.5
twilio==7.17.0
urllib3==1.26.15
uWSGI==2.0.21
validators==0.20.0
vine==5.0.0
websockets==10.4
websockets==11.0.1
zipp==3.15.0
12 changes: 6 additions & 6 deletions api/tacticalrmm/tacticalrmm/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,26 @@
AUTH_USER_MODEL = "accounts.User"

# latest release
TRMM_VERSION = "0.15.8"
TRMM_VERSION = "0.15.9"

# https://github.com/amidaware/tacticalrmm-web
WEB_VERSION = "0.101.16"
WEB_VERSION = "0.101.18"

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

# https://github.com/amidaware/rmmagent
LATEST_AGENT_VER = "2.4.5"
LATEST_AGENT_VER = "2.4.6"

MESH_VER = "1.1.4"

NATS_SERVER_VER = "2.9.15"

# for the update script, bump when need to recreate venv
PIP_VER = "35"
PIP_VER = "36"

SETUPTOOLS_VER = "67.6.0"
SETUPTOOLS_VER = "67.6.1"
WHEEL_VER = "0.40.0"

AGENT_BASE_URL = "https://agents.tacticalrmm.com"
Expand Down
6 changes: 5 additions & 1 deletion api/tacticalrmm/tacticalrmm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,11 @@ def reload_nats() -> None:
"permissions": {
"publish": {"allow": agent.agent_id},
"subscribe": {"allow": agent.agent_id},
"allow_responses": True,
"allow_responses": {
"expires": getattr(
settings, "NATS_ALLOW_RESPONSE_EXPIRATION", "1435m"
)
},
},
}
)
Expand Down
6 changes: 3 additions & 3 deletions docker/containers/tactical/dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# creates python virtual env
FROM python:3.11.2-slim AS CREATE_VENV_STAGE
FROM python:3.11.3-slim AS CREATE_VENV_STAGE

ARG DEBIAN_FRONTEND=noninteractive

Expand All @@ -21,14 +21,14 @@ RUN apt-get update && \
pip install --no-cache-dir -r ${TACTICAL_TMP_DIR}/api/requirements.txt

# pulls community scripts from git repo
FROM python:3.11.2-slim AS GET_SCRIPTS_STAGE
FROM python:3.11.3-slim AS GET_SCRIPTS_STAGE

RUN apt-get update && \
apt-get install -y --no-install-recommends git && \
git clone https://github.com/amidaware/community-scripts.git /community-scripts

# runtime image
FROM python:3.11.2-slim
FROM python:3.11.3-slim

# set env variables
ENV VIRTUAL_ENV /opt/venv
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/jmoiron/sqlx v1.3.5
github.com/lib/pq v1.10.7
github.com/nats-io/nats-server/v2 v2.9.15 // indirect
github.com/nats-io/nats.go v1.24.0
github.com/nats-io/nats.go v1.25.0
github.com/ugorji/go/codec v1.2.11
github.com/wh1te909/trmm-shared v0.0.0-20220227075846-f9f757361139
google.golang.org/protobuf v1.28.0 // indirect
Expand All @@ -16,7 +16,7 @@ require (
require github.com/sirupsen/logrus v1.9.0

require (
github.com/nats-io/nkeys v0.3.0 // indirect
github.com/nats-io/nkeys v0.4.4 // indirect
github.com/nats-io/nuid v1.0.1 // indirect
github.com/stretchr/testify v1.7.1 // indirect
golang.org/x/crypto v0.6.0 // indirect
Expand Down
14 changes: 4 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA
github.com/nats-io/jwt/v2 v2.3.0 h1:z2mA1a7tIf5ShggOFlR1oBPgd6hGqcDYsISxZByUzdI=
github.com/nats-io/nats-server/v2 v2.9.15 h1:MuwEJheIwpvFgqvbs20W8Ish2azcygjf4Z0liVu2I4c=
github.com/nats-io/nats-server/v2 v2.9.15/go.mod h1:QlCTy115fqpx4KSOPFIxSV7DdI6OxtZsGOL1JLdeRlE=
github.com/nats-io/nats.go v1.24.0 h1:CRiD8L5GOQu/DcfkmgBcTTIQORMwizF+rPk6T0RaHVQ=
github.com/nats-io/nats.go v1.24.0/go.mod h1:dVQF+BK3SzUZpwyzHedXsvH3EO38aVKuOPkkHlv5hXA=
github.com/nats-io/nkeys v0.3.0 h1:cgM5tL53EvYRU+2YLXIK0G2mJtK12Ft9oeooSZMA2G8=
github.com/nats-io/nkeys v0.3.0/go.mod h1:gvUNGjVcM2IPr5rCsRsC6Wb3Hr2CQAm08dsxtV6A5y4=
github.com/nats-io/nats.go v1.25.0 h1:t5/wCPGciR7X3Mu8QOi4jiJaXaWM8qtkLu4lzGZvYHE=
github.com/nats-io/nats.go v1.25.0/go.mod h1:D2WALIhz7V8M0pH8Scx8JZXlg6Oqz5VG+nQkK8nJdvg=
github.com/nats-io/nkeys v0.4.4 h1:xvBJ8d69TznjcQl9t6//Q5xXuVhyYiSos6RPtvQNTwA=
github.com/nats-io/nkeys v0.4.4/go.mod h1:XUkxdLPTufzlihbamfzQ7mw/VGx6ObUs+0bN5sNvt64=
github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand All @@ -37,18 +37,12 @@ github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4d
github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
github.com/wh1te909/trmm-shared v0.0.0-20220227075846-f9f757361139 h1:PfOl03o+Y+svWrfXAAu1QWUDePu1yqTq0pf4rpnN8eA=
github.com/wh1te909/trmm-shared v0.0.0-20220227075846-f9f757361139/go.mod h1:ILUz1utl5KgwrxmNHv0RpgMtKeh8gPAABvK2MiXBqv8=
golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc=
golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
Expand Down
4 changes: 2 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

SCRIPT_VERSION="72"
SCRIPT_VERSION="73"
SCRIPT_URL='https://raw.githubusercontent.com/amidaware/tacticalrmm/master/install.sh'

sudo apt install -y curl wget dirmngr gnupg lsb-release
Expand All @@ -12,7 +12,7 @@ RED='\033[0;31m'
NC='\033[0m'

SCRIPTS_DIR='/opt/trmm-community-scripts'
PYTHON_VER='3.11.2'
PYTHON_VER='3.11.3'
SETTINGS_FILE='/rmm/api/tacticalrmm/tacticalrmm/settings.py'

TMP_FILE=$(mktemp -p "" "rmminstall_XXXXXXXXXX")
Expand Down
Loading

0 comments on commit b544809

Please sign in to comment.