From b5e3b16e3a5c2e6cfa0bf788e592676f5ab94e76 Mon Sep 17 00:00:00 2001 From: sadnub Date: Tue, 12 Apr 2022 16:18:31 -0400 Subject: [PATCH] add option to disable mesh autologin --- .devcontainer/requirements.txt | 2 +- api/tacticalrmm/agents/views.py | 14 ++++++++++---- ...033_coresettings_mesh_disable_auto_login.py | 18 ++++++++++++++++++ api/tacticalrmm/core/models.py | 1 + .../modals/coresettings/EditCoreSettings.vue | 5 +++++ 5 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 api/tacticalrmm/core/migrations/0033_coresettings_mesh_disable_auto_login.py diff --git a/.devcontainer/requirements.txt b/.devcontainer/requirements.txt index 915a5403..bb9f6277 100644 --- a/.devcontainer/requirements.txt +++ b/.devcontainer/requirements.txt @@ -25,7 +25,7 @@ urllib3==1.26.9 validators==0.18.2 websockets==10.2 drf_spectacular==0.22.0 -meshctrl==0.1.13 +meshctrl==0.1.15 hiredis==2.0.0 # dev diff --git a/api/tacticalrmm/agents/views.py b/api/tacticalrmm/agents/views.py index 69c688de..737f1942 100644 --- a/api/tacticalrmm/agents/views.py +++ b/api/tacticalrmm/agents/views.py @@ -224,11 +224,17 @@ class AgentMeshCentral(APIView): agent = get_object_or_404(Agent, agent_id=agent_id) core = get_core_settings() - token = get_login_token(key=core.mesh_token, user=f"user//{core.mesh_username}") + if not core.mesh_disable_auto_login: + token = get_login_token( + key=core.mesh_token, user=f"user//{core.mesh_username}" + ) + token_param = f"login={token}&" + else: + token_param = "" - control = f"{core.mesh_site}/?login={token}&gotonode={agent.mesh_node_id}&viewmode=11&hide=31" - terminal = f"{core.mesh_site}/?login={token}&gotonode={agent.mesh_node_id}&viewmode=12&hide=31" - file = f"{core.mesh_site}/?login={token}&gotonode={agent.mesh_node_id}&viewmode=13&hide=31" + control = f"{core.mesh_site}/?{token_param}gotonode={agent.mesh_node_id}&viewmode=11&hide=31" + terminal = f"{core.mesh_site}/?{token_param}gotonode={agent.mesh_node_id}&viewmode=12&hide=31" + file = f"{core.mesh_site}/?{token_param}gotonode={agent.mesh_node_id}&viewmode=13&hide=31" AuditLog.audit_mesh_session( username=request.user.username, diff --git a/api/tacticalrmm/core/migrations/0033_coresettings_mesh_disable_auto_login.py b/api/tacticalrmm/core/migrations/0033_coresettings_mesh_disable_auto_login.py new file mode 100644 index 00000000..4a18973d --- /dev/null +++ b/api/tacticalrmm/core/migrations/0033_coresettings_mesh_disable_auto_login.py @@ -0,0 +1,18 @@ +# Generated by Django 4.0.3 on 2022-04-12 18:59 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0032_alter_coresettings_email_alert_recipients_and_more'), + ] + + operations = [ + migrations.AddField( + model_name='coresettings', + name='mesh_disable_auto_login', + field=models.BooleanField(default=False), + ), + ] diff --git a/api/tacticalrmm/core/models.py b/api/tacticalrmm/core/models.py index 63afc0f5..48881e47 100644 --- a/api/tacticalrmm/core/models.py +++ b/api/tacticalrmm/core/models.py @@ -66,6 +66,7 @@ class CoreSettings(BaseAuditModel): mesh_device_group = models.CharField( max_length=255, null=True, blank=True, default="TacticalRMM" ) + mesh_disable_auto_login = models.BooleanField(default=False) agent_auto_update = models.BooleanField(default=True) workstation_policy = models.ForeignKey( "automation.Policy", diff --git a/web/src/components/modals/coresettings/EditCoreSettings.vue b/web/src/components/modals/coresettings/EditCoreSettings.vue index 7eeddef0..618a92f2 100644 --- a/web/src/components/modals/coresettings/EditCoreSettings.vue +++ b/web/src/components/modals/coresettings/EditCoreSettings.vue @@ -347,6 +347,11 @@
+ +
Disable Auto Login for Remote Control and Remote background:
+
+ +