From 7d113e026e9485dd18e075551e84abb671e474ae Mon Sep 17 00:00:00 2001 From: Thomas Miceli <27960254+thomiceli@users.noreply.github.com> Date: Mon, 3 Jun 2024 17:14:06 +0200 Subject: [PATCH] Fix ssh error login (#292) --- Makefile | 2 +- internal/ssh/run.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 0f0e2cc..1d880d4 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,7 @@ build_dev_docker: docker build -t $(BINARY_NAME)-dev:latest --target dev . run_dev_docker: - docker run -v .:/opengist -p 6157:6157 -p 16157:16157 -v $(HOME)/.opengist-dev:/root/.opengist --rm $(BINARY_NAME)-dev:latest + docker run -v .:/opengist -p 6157:6157 -p 16157:16157 -p 2222:2222 -v $(HOME)/.opengist-dev:/root/.opengist --rm $(BINARY_NAME)-dev:latest watch_frontend: @echo "Building frontend assets..." diff --git a/internal/ssh/run.go b/internal/ssh/run.go index 6d62438..ff20950 100644 --- a/internal/ssh/run.go +++ b/internal/ssh/run.go @@ -25,8 +25,8 @@ func Start() { PublicKeyCallback: func(conn ssh.ConnMetadata, key ssh.PublicKey) (*ssh.Permissions, error) { strKey := strings.TrimSpace(string(ssh.MarshalAuthorizedKey(key))) exists, err := db.SSHKeyDoesExists(strKey) - if !exists { - if !errors.Is(err, gorm.ErrRecordNotFound) { + if !exists || err != nil { + if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { return nil, err }