Skip to content

Commit 6ab39d6

Browse files
committed
Release 0.18.1
2 parents 7284d9f + 4aa413e commit 6ab39d6

File tree

5 files changed

+25
-27
lines changed

5 files changed

+25
-27
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ assignees: ''
1414

1515
**Installation Method:**
1616
- [ ] Standard
17+
- [ ] Standard with `--insecure` flag at install
1718
- [ ] Docker
1819

1920
**Agent Info (please complete the following information):**
2021
- Agent version (as shown in the 'Summary' tab of the agent from web UI):
21-
- Agent OS: [e.g. Win 10 v2004, Server 2012 R2]
22+
- Agent OS: [e.g. Win 10 v2004, Server 2016]
2223

2324
**Describe the bug**
2425
A clear and concise description of what the bug is.

api/tacticalrmm/core/mesh_utils.py

+12-23
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import asyncio
22
import json
33
import re
4+
import secrets
5+
import string
46
import traceback
57
from typing import TYPE_CHECKING, Any
68

79
import websockets
810

911
from accounts.utils import is_superuser
1012
from tacticalrmm.constants import TRMM_WS_MAX_SIZE
11-
from tacticalrmm.helpers import make_random_password
1213
from tacticalrmm.logger import logger
1314

1415
if TYPE_CHECKING:
@@ -40,6 +41,14 @@ def has_mesh_perms(*, user: "User") -> bool:
4041
return user.role and getattr(user.role, "can_use_mesh")
4142

4243

44+
def make_mesh_password() -> str:
45+
alpha = string.ascii_letters + string.digits
46+
nonalpha = "!@#$"
47+
passwd = [secrets.choice(alpha) for _ in range(29)] + [secrets.choice(nonalpha)]
48+
secrets.SystemRandom().shuffle(passwd)
49+
return "".join(passwd)
50+
51+
4352
def transform_trmm(obj):
4453
ret = []
4554
try:
@@ -128,7 +137,7 @@ def add_users_to_node(self, *, node_id: str, user_ids: list[str]):
128137
"action": "adddeviceuser",
129138
"nodeid": node_id,
130139
"usernames": [s.replace("user//", "") for s in user_ids],
131-
"rights": 72,
140+
"rights": 3563736,
132141
"remove": False,
133142
}
134143
self.mesh_action(payload=payload, wait=False)
@@ -156,7 +165,7 @@ def add_user_to_mesh(self, *, user_info: dict[str, Any]) -> None:
156165
"action": "adduser",
157166
"username": user_info["username"],
158167
"email": user_info["email"],
159-
"pass": make_random_password(len=30),
168+
"pass": make_mesh_password(),
160169
"resetNextLogin": False,
161170
"randomPassword": False,
162171
"removeEvents": False,
@@ -172,23 +181,3 @@ def delete_user_from_mesh(self, *, mesh_user_id: str) -> None:
172181
"userid": mesh_user_id,
173182
}
174183
self.mesh_action(payload=payload, wait=False)
175-
176-
def add_agent_to_user(self, *, user_id: str, node_id: str) -> None:
177-
payload = {
178-
"action": "adddeviceuser",
179-
"nodeid": node_id,
180-
"userids": [user_id],
181-
"rights": 72,
182-
"remove": False,
183-
}
184-
self.mesh_action(payload=payload, wait=False)
185-
186-
def remove_agent_from_user(self, *, user_id: str, node_id: str) -> None:
187-
payload = {
188-
"action": "adddeviceuser",
189-
"nodeid": node_id,
190-
"userids": [user_id],
191-
"rights": 0,
192-
"remove": True,
193-
}
194-
self.mesh_action(payload=payload, wait=False)

api/tacticalrmm/core/tasks.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
transform_trmm,
3131
)
3232
from core.models import CoreSettings
33-
from core.utils import get_core_settings, get_mesh_ws_url
33+
from core.utils import get_core_settings, get_mesh_ws_url, make_alpha_numeric
3434
from logs.models import PendingAction
3535
from logs.tasks import prune_audit_log, prune_debug_log
3636
from tacticalrmm.celery import app
@@ -444,7 +444,9 @@ def sync_mesh_perms_task(self):
444444
# make sure that doesn't happen by making a random email
445445
rand_str1 = make_random_password(len=6)
446446
rand_str2 = make_random_password(len=5)
447-
email = f"{user.username}.{rand_str1}@tacticalrmm-do-not-change-{rand_str2}.local"
447+
# for trmm users whos usernames are emails
448+
email_prefix = make_alpha_numeric(user.username)
449+
email = f"{email_prefix}.{rand_str1}@tacticalrmm-do-not-change-{rand_str2}.local"
448450
mesh_users_dict[user.mesh_user_id] = {
449451
"_id": user.mesh_user_id,
450452
"username": user.mesh_username,
@@ -454,6 +456,8 @@ def sync_mesh_perms_task(self):
454456

455457
new_trmm_agents = []
456458
for agent in Agent.objects.defer(*AGENT_DEFER):
459+
if not agent.mesh_node_id:
460+
continue
457461
agent_dict = {
458462
"node_id": f"node//{agent.hex_mesh_node_id}",
459463
"hostname": agent.hostname,

api/tacticalrmm/core/utils.py

+4
Original file line numberDiff line numberDiff line change
@@ -205,3 +205,7 @@ def get_meshagent_url(
205205
}
206206

207207
return base + "/meshagents?" + urllib.parse.urlencode(params)
208+
209+
210+
def make_alpha_numeric(s: str):
211+
return "".join(filter(str.isalnum, s))

api/tacticalrmm/tacticalrmm/settings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
AUTH_USER_MODEL = "accounts.User"
2222

2323
# latest release
24-
TRMM_VERSION = "0.18.0"
24+
TRMM_VERSION = "0.18.1"
2525

2626
# https://github.com/amidaware/tacticalrmm-web
2727
WEB_VERSION = "0.101.43"

0 commit comments

Comments
 (0)