Skip to content

Commit

Permalink
Release 0.15.6
Browse files Browse the repository at this point in the history
  • Loading branch information
wh1te909 committed Dec 21, 2022
2 parents 4987482 + 34ae57e commit 0663969
Show file tree
Hide file tree
Showing 14 changed files with 90 additions and 38 deletions.
4 changes: 2 additions & 2 deletions .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.10.8", "3.11.0"]
python-version: ["3.10.8", "3.11.1"]

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -56,7 +56,7 @@ jobs:
if [ $? -ne 0 ]; then
exit 1
fi
- name: Lint with flake8
working-directory: api/tacticalrmm
run: |
Expand Down
21 changes: 21 additions & 0 deletions api/tacticalrmm/accounts/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,27 @@ def test_user_ui(self):
self.check_not_authenticated("patch", url)


class TestUserReset(TacticalTestCase):
def setUp(self):
self.authenticate()
self.setup_coresettings()

def test_reset_pw(self):
url = "/accounts/resetpw/"
data = {"password": "superSekret123456"}
r = self.client.put(url, data, format="json")
self.assertEqual(r.status_code, 200)

self.check_not_authenticated("put", url)

def test_reset_2fa(self):
url = "/accounts/reset2fa/"
r = self.client.put(url)
self.assertEqual(r.status_code, 200)

self.check_not_authenticated("put", url)


class TestAPIKeyViews(TacticalTestCase):
def setUp(self):
self.setup_coresettings()
Expand Down
2 changes: 2 additions & 0 deletions api/tacticalrmm/accounts/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@
path("roles/<int:pk>/", views.GetUpdateDeleteRole.as_view()),
path("apikeys/", views.GetAddAPIKeys.as_view()),
path("apikeys/<int:pk>/", views.GetUpdateDeleteAPIKey.as_view()),
path("resetpw/", views.ResetPass.as_view()),
path("reset2fa/", views.Reset2FA.as_view()),
]
20 changes: 20 additions & 0 deletions api/tacticalrmm/accounts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,3 +291,23 @@ def delete(self, request, pk):
apikey = get_object_or_404(APIKey, pk=pk)
apikey.delete()
return Response("The API Key was deleted")


class ResetPass(APIView):
permission_classes = [IsAuthenticated]

def put(self, request):
user = request.user
user.set_password(request.data["password"])
user.save()
return Response("Password was reset.")


class Reset2FA(APIView):
permission_classes = [IsAuthenticated]

def put(self, request):
user = request.user
user.totp_key = ""
user.save()
return Response("2FA was reset. Log out and back in to setup.")
15 changes: 8 additions & 7 deletions api/tacticalrmm/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,36 +1,37 @@
asgiref==3.5.2
celery==5.2.7
certifi==2022.9.24
certifi==2022.12.7
cffi==1.15.1
channels==4.0.0
channels_redis==4.0.0
chardet==4.0.0
cryptography==38.0.4
daphne==4.0.0
Django==4.1.3
Django==4.1.4
django-cors-headers==3.13.0
django-ipware==4.0.2
django-rest-knox==4.2.0
djangorestframework==3.14.0
drf-spectacular==0.24.2
drf-spectacular==0.25.1
future==0.18.2
hiredis==2.0.0
hiredis==2.1.0
meshctrl==0.1.15
msgpack==1.0.4
nats-py==2.2.0
packaging==22.0
psutil==5.9.4
psycopg2-binary==2.9.5
pycparser==2.21
pycryptodome==3.16.0
pyotp==2.7.0
pyotp==2.8.0
pyparsing==3.0.9
pytz==2022.5
qrcode==7.3.1
redis==4.3.5
redis==4.4.0
requests==2.28.1
six==1.16.0
sqlparse==0.4.3
twilio==7.15.4
twilio==7.16.0
urllib3==1.26.13
uWSGI==2.0.21
validators==0.20.0
Expand Down
2 changes: 2 additions & 0 deletions api/tacticalrmm/tacticalrmm/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,8 @@ class DebugLogType(models.TextChoices):
{"name": "InstallWindowsUpdates", "methods": ["POST"]},
{"name": "PendingActions", "methods": ["DELETE"]},
{"name": "clear_cache", "methods": ["GET"]},
{"name": "ResetPass", "methods": ["PUT"]},
{"name": "Reset2FA", "methods": ["PUT"]},
]

CONFIG_MGMT_CMDS = (
Expand Down
12 changes: 6 additions & 6 deletions api/tacticalrmm/tacticalrmm/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@
AUTH_USER_MODEL = "accounts.User"

# latest release
TRMM_VERSION = "0.15.5"
TRMM_VERSION = "0.15.6"

# https://github.com/amidaware/tacticalrmm-web
WEB_VERSION = "0.101.9"
WEB_VERSION = "0.101.11"

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

# https://github.com/amidaware/rmmagent
LATEST_AGENT_VER = "2.4.3"
LATEST_AGENT_VER = "2.4.4"

MESH_VER = "1.1.0"
MESH_VER = "1.1.1"

NATS_SERVER_VER = "2.9.8"
NATS_SERVER_VER = "2.9.10"

# for the update script, bump when need to recreate venv
PIP_VER = "34"
Expand Down
2 changes: 1 addition & 1 deletion docker/containers/tactical-nats/dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM nats:2.9.8-alpine
FROM nats:2.9.10-alpine

ENV TACTICAL_DIR /opt/tactical
ENV TACTICAL_READY_FILE ${TACTICAL_DIR}/tmp/tactical.ready
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ require (
github.com/golang/protobuf v1.5.2 // indirect
github.com/jmoiron/sqlx v1.3.5
github.com/lib/pq v1.10.7
github.com/nats-io/nats-server/v2 v2.9.8 // indirect
github.com/nats-io/nats.go v1.20.0
github.com/nats-io/nats-server/v2 v2.9.10 // indirect
github.com/nats-io/nats.go v1.22.0
github.com/ugorji/go/codec v1.2.7
github.com/wh1te909/trmm-shared v0.0.0-20220227075846-f9f757361139
google.golang.org/protobuf v1.28.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ github.com/mattn/go-sqlite3 v1.14.6 h1:dNPt6NO46WmLVt2DLNpwczCmdV5boIZ6g/tlDrlRU
github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g=
github.com/nats-io/jwt/v2 v2.3.0 h1:z2mA1a7tIf5ShggOFlR1oBPgd6hGqcDYsISxZByUzdI=
github.com/nats-io/nats-server/v2 v2.9.8 h1:jgxZsv+A3Reb3MgwxaINcNq/za8xZInKhDg9Q0cGN1o=
github.com/nats-io/nats-server/v2 v2.9.8/go.mod h1:AB6hAnGZDlYfqb7CTAm66ZKMZy9DpfierY1/PbpvI2g=
github.com/nats-io/nats.go v1.20.0 h1:T8JJnQfVSdh1CzGiwAOv5hEobYCBho/0EupGznYw0oM=
github.com/nats-io/nats.go v1.20.0/go.mod h1:tLqubohF7t4z3du1QDPYJIQQyhb4wl6DhjxEajSI7UA=
github.com/nats-io/nats-server/v2 v2.9.10 h1:LMC46Oi9E6BUx/xBsaCVZgofliAqKQzRPU6eKWkN8jE=
github.com/nats-io/nats-server/v2 v2.9.10/go.mod h1:AB6hAnGZDlYfqb7CTAm66ZKMZy9DpfierY1/PbpvI2g=
github.com/nats-io/nats.go v1.22.0 h1:3dxyVf+S449DbMriqQV27HgSbXklxT9SUKbDKIxhrV0=
github.com/nats-io/nats.go v1.22.0/go.mod h1:tLqubohF7t4z3du1QDPYJIQQyhb4wl6DhjxEajSI7UA=
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/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

var (
version = "3.3.3"
version = "3.4.0"
log = logrus.New()
)

Expand Down
Binary file modified natsapi/bin/nats-api
Binary file not shown.
22 changes: 21 additions & 1 deletion natsapi/svc.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,27 @@ func Svc(logger *logrus.Logger, cfg string) {
logger.Fatalln(err)
}

opts := setupNatsOptions(r.Key)
opts := []nats.Option{
nats.Name("trmm-nats-api"),
nats.UserInfo("tacticalrmm", r.Key),
nats.ReconnectWait(time.Second * 2),
nats.RetryOnFailedConnect(true),
nats.IgnoreAuthErrorAbort(),
nats.MaxReconnects(-1),
nats.ReconnectBufSize(-1),
nats.DisconnectErrHandler(func(nc *nats.Conn, nerr error) {
logger.Debugln("NATS disconnected:", nerr)
logger.Debugf("%+v\n", nc.Statistics)
}),
nats.ReconnectHandler(func(nc *nats.Conn) {
logger.Debugln("NATS reconnected")
logger.Debugf("%+v\n", nc.Statistics)
}),
nats.ErrorHandler(func(nc *nats.Conn, sub *nats.Subscription, nerr error) {
logger.Errorln("NATS error:", nerr)
logger.Errorf("%+v\n", sub)
}),
}
nc, err := nats.Connect(r.NatsURL, opts...)
if err != nil {
logger.Fatalln(err)
Expand Down
14 changes: 0 additions & 14 deletions natsapi/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,12 @@ import (
"errors"
"fmt"
"io/ioutil"
"time"

"github.com/jmoiron/sqlx"
_ "github.com/lib/pq"
nats "github.com/nats-io/nats.go"
trmm "github.com/wh1te909/trmm-shared"
)

func setupNatsOptions(key string) []nats.Option {
opts := []nats.Option{
nats.Name("trmm-nats-api"),
nats.UserInfo("tacticalrmm", key),
nats.ReconnectWait(time.Second * 2),
nats.RetryOnFailedConnect(true),
nats.MaxReconnects(-1),
nats.ReconnectBufSize(-1),
}
return opts
}

func GetConfig(cfg string) (db *sqlx.DB, r DjangoConfig, err error) {
if cfg == "" {
cfg = "/rmm/api/tacticalrmm/nats-api.conf"
Expand Down

0 comments on commit 0663969

Please sign in to comment.