Skip to content

Commit

Permalink
more self signed stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
wh1te909 committed Sep 1, 2023
1 parent 5111b17 commit aee0692
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
11 changes: 6 additions & 5 deletions api/tacticalrmm/agents/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,10 +570,9 @@ def install_agent(request):
from agents.utils import get_agent_url
from core.utils import token_is_valid

if getattr(settings, "TRMM_INSECURE", False) and request.data["installMethod"] in {
"exe",
"powershell",
}:
insecure = getattr(settings, "TRMM_INSECURE", False)

if insecure and request.data["installMethod"] in {"exe", "powershell"}:
return notify_error(
"Not available in insecure mode. Please use the 'Manual' method."
)
Expand Down Expand Up @@ -680,7 +679,7 @@ def install_agent(request):
if int(request.data["power"]):
cmd.append("--power")

if getattr(settings, "TRMM_INSECURE", False):
if insecure:
cmd.append("--insecure")

resp["cmd"] = " ".join(str(i) for i in cmd)
Expand All @@ -691,6 +690,8 @@ def install_agent(request):
resp["cmd"] = (
dl + f" && chmod +x {inno} && " + " ".join(str(i) for i in cmd)
)
if insecure:
resp["cmd"] += " --insecure"

resp["url"] = download_url

Expand Down
7 changes: 7 additions & 0 deletions api/tacticalrmm/clients/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import uuid
from contextlib import suppress

from django.conf import settings
from django.db.models import Count, Exists, OuterRef, Prefetch, prefetch_related_objects
from django.shortcuts import get_object_or_404
from django.utils import timezone as djangotime
Expand Down Expand Up @@ -288,6 +289,9 @@ def get(self, request):
return Response(DeploymentSerializer(deps, many=True).data)

def post(self, request):
if getattr(settings, "TRMM_INSECURE", False):
return notify_error("Not available in insecure mode")

from accounts.models import User

site = get_object_or_404(Site, pk=request.data["site"])
Expand Down Expand Up @@ -343,6 +347,9 @@ class GenerateAgent(APIView):
permission_classes = (AllowAny,)

def get(self, request, uid):
if getattr(settings, "TRMM_INSECURE", False):
return notify_error("Not available in insecure mode")

from tacticalrmm.utils import generate_winagent_exe

try:
Expand Down

0 comments on commit aee0692

Please sign in to comment.