Skip to content

Commit

Permalink
Release 0.7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
wh1te909 committed Jun 30, 2021
2 parents 71e78bd + 6a06734 commit ba42c5e
Show file tree
Hide file tree
Showing 31 changed files with 359 additions and 206 deletions.
1 change: 1 addition & 0 deletions .devcontainer/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ EOF
"${VIRTUAL_ENV}"/bin/python manage.py load_chocos
"${VIRTUAL_ENV}"/bin/python manage.py load_community_scripts
"${VIRTUAL_ENV}"/bin/python manage.py reload_nats
"${VIRTUAL_ENV}"/bin/python manage.py create_installer_user

# create super user
echo "from accounts.models import User; User.objects.create_superuser('${TRMM_USER}', '[email protected]', '${TRMM_PASS}') if not User.objects.filter(username='${TRMM_USER}').exists() else 0;" | python manage.py shell
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import uuid

from django.core.management.base import BaseCommand
from accounts.models import User


class Command(BaseCommand):
help = "Creates the installer user"

def handle(self, *args, **kwargs):
if User.objects.filter(is_installer_user=True).exists():
return

User.objects.create_user( # type: ignore
username=uuid.uuid4().hex,
is_installer_user=True,
password=User.objects.make_random_password(60), # type: ignore
)
18 changes: 18 additions & 0 deletions api/tacticalrmm/accounts/migrations/0023_user_is_installer_user.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.4 on 2021-06-30 03:22

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('accounts', '0022_user_clear_search_when_switching'),
]

operations = [
migrations.AddField(
model_name='user',
name='is_installer_user',
field=models.BooleanField(default=False),
),
]
1 change: 1 addition & 0 deletions api/tacticalrmm/accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class User(AbstractUser, BaseAuditModel):
client_tree_splitter = models.PositiveIntegerField(default=11)
loading_bar_color = models.CharField(max_length=255, default="red")
clear_search_when_switching = models.BooleanField(default=True)
is_installer_user = models.BooleanField(default=False)

agent = models.OneToOneField(
"agents.Agent",
Expand Down
2 changes: 1 addition & 1 deletion api/tacticalrmm/accounts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class GetAddUsers(APIView):
permission_classes = [IsAuthenticated, AccountsPerms]

def get(self, request):
users = User.objects.filter(agent=None)
users = User.objects.filter(agent=None, is_installer_user=False)

return Response(UserSerializer(users, many=True).data)

Expand Down
5 changes: 4 additions & 1 deletion api/tacticalrmm/agents/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ def patch(self, request):
@permission_classes([IsAuthenticated, InstallAgentPerms])
def install_agent(request):
from knox.models import AuthToken
from accounts.models import User

from agents.utils import get_winagent_url

Expand All @@ -415,8 +416,10 @@ def install_agent(request):
)
download_url = get_winagent_url(arch)

installer_user = User.objects.filter(is_installer_user=True).first()

_, token = AuthToken.objects.create(
user=request.user, expiry=dt.timedelta(hours=request.data["expires"])
user=installer_user, expiry=dt.timedelta(hours=request.data["expires"])
)

if request.data["installMethod"] == "exe":
Expand Down
5 changes: 2 additions & 3 deletions api/tacticalrmm/autotasks/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ def send_email(self):
from core.models import CoreSettings

CORE = CoreSettings.objects.first()

# Format of Email sent when Task has email alert
if self.agent:
subject = f"{self.agent.client.name}, {self.agent.site.name}, {self.agent.hostname} - {self} Failed"
else:
Expand All @@ -427,11 +427,10 @@ def send_email(self):
CORE.send_mail(subject, body, self.agent.alert_template)

def send_sms(self):

from core.models import CoreSettings

CORE = CoreSettings.objects.first()

# Format of SMS sent when Task has SMS alert
if self.agent:
subject = f"{self.agent.client.name}, {self.agent.site.name}, {self.agent.hostname} - {self} Failed"
else:
Expand Down
5 changes: 4 additions & 1 deletion api/tacticalrmm/clients/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,16 +251,19 @@ def get(self, request):

def post(self, request):
from knox.models import AuthToken
from accounts.models import User

client = get_object_or_404(Client, pk=request.data["client"])
site = get_object_or_404(Site, pk=request.data["site"])

installer_user = User.objects.filter(is_installer_user=True).first()

expires = dt.datetime.strptime(
request.data["expires"], "%Y-%m-%d %H:%M"
).astimezone(pytz.timezone("UTC"))
now = djangotime.now()
delta = expires - now
obj, token = AuthToken.objects.create(user=request.user, expiry=delta)
obj, token = AuthToken.objects.create(user=installer_user, expiry=delta)

flags = {
"power": request.data["power"],
Expand Down
4 changes: 3 additions & 1 deletion api/tacticalrmm/logs/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ def post(self, request):

if request.data["type"] == "user":
users = User.objects.filter(
username__icontains=request.data["pattern"], agent=None
username__icontains=request.data["pattern"],
agent=None,
is_installer_user=False,
)
return Response(UserSerializer(users, many=True).data)

Expand Down
2 changes: 1 addition & 1 deletion api/tacticalrmm/scripts/community_scripts.json
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@
"guid": "5320dfc8-022a-41e7-9e39-11c493545ec9",
"filename": "Win_AD_Hudu_ADDS_Documentation.ps1",
"submittedBy": "https://github.com/unplugged216",
"name": "ADDS - Direcotry documentation in Hudu",
"name": "ADDS - Directory documentation in Hudu",
"description": "Auto generates ADDS documentation and submits it to your Hudu instance.",
"args": [
"-ClientName {{client.name}}",
Expand Down
6 changes: 3 additions & 3 deletions api/tacticalrmm/tacticalrmm/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
AUTH_USER_MODEL = "accounts.User"

# latest release
TRMM_VERSION = "0.7.1"
TRMM_VERSION = "0.7.2"

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

# https://github.com/wh1te909/rmmagent
LATEST_AGENT_VER = "1.5.9"
Expand All @@ -28,7 +28,7 @@

# for the update script, bump when need to recreate venv or npm install
PIP_VER = "19"
NPM_VER = "18"
NPM_VER = "19"

SETUPTOOLS_VER = "57.0.0"
WHEEL_VER = "0.36.2"
Expand Down
7 changes: 7 additions & 0 deletions api/tacticalrmm/tacticalrmm/test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import uuid
from django.test import TestCase, override_settings
from model_bakery import baker
from rest_framework.authtoken.models import Token
Expand All @@ -20,6 +21,12 @@ def authenticate(self):
self.client_setup()
self.client.force_authenticate(user=self.john)

User.objects.create_user( # type: ignore
username=uuid.uuid4().hex,
is_installer_user=True,
password=User.objects.make_random_password(60), # type: ignore
)

def setup_agent_auth(self, agent):
agent_user = User.objects.create_user(
username=agent.agent_id,
Expand Down
1 change: 1 addition & 0 deletions docker/containers/tactical/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ EOF
python manage.py load_chocos
python manage.py load_community_scripts
python manage.py reload_nats
python manage.py create_installer_user

# create super user
echo "from accounts.models import User; User.objects.create_superuser('${TRMM_USER}', '[email protected]', '${TRMM_PASS}') if not User.objects.filter(username='${TRMM_USER}').exists() else 0;" | python manage.py shell
Expand Down
103 changes: 103 additions & 0 deletions docs/docs/3rdparty_screenconnect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Screenconnect / Connectwise Control

## Connectwise Control Integration

!!!info
To make this work you will need the name of a the Service from one of your agents running a Screen Connect Guest.

!!!info
You can setup a full automation policy to collect the machine GUID but this example will collect from just one agent for testing purposes.

From the UI go to **Settings > Global Settings > CUSTOM FIELDS > Agents**

Add Custom Field</br>
**Target** = `Client`</br>
**Name** = `ScreenConnectService`</br>
**Field Type** = `Text` </br>
**Default Value** = `The name of your SC Service eg. ScreenConnect Client (XXXXXXXXXXXXXXXXX)`</br>

![Service Name](images/3rdparty_screenconnect1.png)

Add Custom Field</br>
**Target** = `Agent`</br>
**Name** = `ScreenConnectGUID`</br>
**Field Type** = `Text`</br>

![Service Name](images/3rdparty_screenconnect2.png)

While in Global Settings go to **URL ACTIONS**

Add a URL Action</br>
**Name** = `ScreenConnect`</br>
**Description** = `Launch Screen Connect Session`</br>
**URL Pattern** =

```html
https://<your_screenconnect_fqdn_with_port>/Host#Access/All%20Machines//{{agent.ScreenConnectGUID}}/Join
```

![Service Name](images/3rdparty_screenconnect3.png)

Navigate to an agent with ConnectWise Service running (or apply using **Settings > Automation Manager**).</br>
Go to Tasks.</br>
Add Task</br>
**Select Script** = `ScreenConnect - Get GUID for client` (this is a builtin script from script library)</br>
**Script argument** = `-serviceName{{client.ScreenConnectService}}`</br>
**Descriptive name of task** = `Collects the Machine GUID for ScreenConnect.`</br>
**Collector Task** = `CHECKED`</br>
**Custom Field to update** = `ScreenConectGUID`</br>

![Service Name](images/3rdparty_screenconnect4.png)

Click **Next**</br>
Check **Manual**</br>
Click **Add Task**

Right click on the newly created task and click **Run Task Now**.

Give it a second to execute then right click the agent that you are working with and go to **Run URL Action > ScreenConnect**

It should ask you to sign into your Connectwise Control server if you are not already logged in and launch the session.

*****

## Install Tactical RMM via Screeconnect commands window

1. Create a Deplopment under **Agents > Manage Deployments**
2. Replace `<deployment URL>` below with your Deployment Download Link.

**x64**

```cmd
#!ps
#maxlength=500000
#timeout=600000
Invoke-WebRequest "<deployment URL>" -OutFile ( New-Item -Path "C:\temp\trmminstallx64.exe" -Force )
$proc = Start-Process c:\temp\trmminstallx64.exe -ArgumentList '-silent' -PassThru
Wait-Process -InputObject $proc
if ($proc.ExitCode -ne 0) {
Write-Warning "$_ exited with status code $($proc.ExitCode)"
}
Remove-Item -Path "c:\temp\trmminstallx64.exe" -Force
```

**x86**

```cmd
#!ps
#maxlength=500000
#timeout=600000
Invoke-WebRequest "<deployment URL>" -OutFile ( New-Item -Path "C:\temp\trmminstallx86.exe" -Force )
$proc = Start-Process c:\temp\trmminstallx86.exe -ArgumentList '-silent' -PassThru
Wait-Process -InputObject $proc
if ($proc.ExitCode -ne 0) {
Write-Warning "$_ exited with status code $($proc.ExitCode)"
}
Remove-Item -Path "c:\temp\trmminstallx86.exe" -Force
```

*****
3 changes: 3 additions & 0 deletions docs/docs/functions/custom_fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

In the dashboard, go to **Settings > Global Settings > Custom Fields** and click **Add Custom Field**.

!!!info
Everything between {{}} is CaSe sEnSiTive

The following options are available to configure on custom fields:

- **Model** - This is the object that the custom field will be added to. The available options are:
Expand Down
3 changes: 3 additions & 0 deletions docs/docs/functions/keystore.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ To Add/Edit values in the Global Key Store, browse to **Settings > Global Settin

You can reference values from the key store in script arguments by using the {{global.key_name}} syntax.

!!!info
Everything between {{}} is CaSe sEnSiTive

See [Scripts](scripting.md) for more information.
2 changes: 1 addition & 1 deletion docs/docs/functions/scripting.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Tactical RMM allows passing in dashboard data to scripts as arguments. The below
```

!!!info
Script variables are case-sensitive!
Everything between {{}} is CaSe sEnSiTive

See a full list of available options [Here](../script_variables.md)

Expand Down
16 changes: 14 additions & 2 deletions docs/docs/howitallworks.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ Has a postgres database located here:

### Services


nginx

!!!description
Expand Down Expand Up @@ -100,7 +99,6 @@ Found in `%programfiles%\TacticalAgent`

The [MeshCentral](https://meshcentral.com/) system which is accessible from <https://mesh.example.com> and is used


* It runs 2 goroutines
* one is the checkrunner which runs all the checks and then just sleeps until it's time to run more checks
* 2nd goroutine periodically sends info about the agent to the rmm and also handles agent recovery
Expand Down Expand Up @@ -131,3 +129,17 @@ Downloads latest `winagent-vx.x.x-x86/64.exe` to `%programfiles%`
Executes the file (INNO setup exe)

Files create `c:\Windows\temp\Tacticalxxxx\` folder for install (and log files)

*****

### Windows Update Management

Tactical RMM Agent sets:

```reg
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU
AUOptions (REG_DWORD):
1: Keep my computer up to date is disabled in Automatic Updates.
```

Uses this Microsoft API to handle updates: [https://docs.microsoft.com/en-us/windows/win32/api/_wua/](https://docs.microsoft.com/en-us/windows/win32/api/_wua/)
Binary file added docs/docs/images/3rdparty_screenconnect1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/images/3rdparty_screenconnect2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/images/3rdparty_screenconnect3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/images/3rdparty_screenconnect4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/docs/script_variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Tactical RMM allows passing dashboard data into script as arguments. This uses t

See below for the available options.

!!!info
Everything between {{}} is CaSe sEnSiTive

## Agent

- **{{agent.version}}** - Tactical RMM agent version
Expand Down
Loading

0 comments on commit ba42c5e

Please sign in to comment.