Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
vendor
build/*
logs/*
data/*
release/*
node_modules/
Dockerfile
63 changes: 63 additions & 0 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#
name: Create and publish a Docker image

# Configures this workflow to run every time a change is pushed to the branch called `release`.
on:
workflow_dispatch:
inputs:
tag:
description: 'Tag to build'
required: true
default: 'latest'
type: string


# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
jobs:
build-and-push-image:
runs-on: ubuntu-latest
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
contents: read
packages: write
attestations: write
id-token: write
#
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw, value=${{ inputs.tag }}
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see [Usage](https://github.com/docker/build-push-action#usage) in the README of the `docker/build-push-action` repository.
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}

2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
prerelease: false
- uses: actions/setup-go@v2
with:
go-version: '1.23.x' # The Go version to download (if necessary) and use.
go-version: 'stable' # The Go version to download (if necessary) and use.
- name: Make Build
id: make_build
env:
Expand Down
39 changes: 39 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
FROM golang:1.24-bullseye AS stage-build
ARG TARGETARCH
ENV CGO_ENABLED=0
ENV GO111MODULE=on

WORKDIR /opt/wisp

COPY go.mod go.sum ./

RUN go mod download -x

COPY . .

RUN make build

FROM debian:bullseye-slim

ARG TARGETARCH
ENV LANG=en_US.UTF-8
ARG APT_MIRROR=http://deb.debian.org
ARG DEPENDENCIES=" \
bash-completion \
jq \
less \
ca-certificates"

RUN set -ex \
&& sed -i "s@http://.*.debian.org@${APT_MIRROR}@g" /etc/apt/sources.list \
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& apt-get update \
&& apt-get install -y --no-install-recommends ${DEPENDENCIES} \
&& apt-get clean all \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /opt/wisp

COPY --from=stage-build /opt/wisp/build/wisp .

CMD ["./wisp"]
4 changes: 4 additions & 0 deletions cmd/common/beat_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ func (b *BeatService) KeepCheckTokens() {
sessions := b.GetSessions()
tokens := make(map[string]model.TokenCheckStatus, len(sessions))
for _, s := range sessions {
if s.TokenId == "" {
logger.Infof("Check session %s token id empty", s.ID)
continue
}
ret, ok := tokens[s.TokenId]
if ok {
b.handleTokenCheck(s, &ret)
Expand Down
4 changes: 2 additions & 2 deletions cmd/impl/convert_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
)

var modelLoginFrom = map[pb.Session_LoginFrom]model.LabelField{
pb.Session_WT: model.LoginFromWT,
pb.Session_ST: model.LoginFromST,
pb.Session_WT: model.LoginFromWeb,
pb.Session_ST: model.LoginFromSSH,
pb.Session_RT: model.LoginFromRT,
pb.Session_DT: model.LoginFromDT,
}
Expand Down
8 changes: 4 additions & 4 deletions cmd/impl/convert_pb.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,10 @@ func ConvertToPbLoginFrom(s model.LabelField) pb.Session_LoginFrom {
}

var pbLoginFrom = map[model.LabelField]pb.Session_LoginFrom{
model.LoginFromWT: pb.Session_WT,
model.LoginFromST: pb.Session_ST,
model.LoginFromRT: pb.Session_RT,
model.LoginFromDT: pb.Session_DT,
model.LoginFromWeb: pb.Session_WT,
model.LoginFromSSH: pb.Session_ST,
model.LoginFromRT: pb.Session_RT,
model.LoginFromDT: pb.Session_DT,
}

func ConvertToPbTicketInfo(info *model.TicketInfo) *pb.TicketInfo {
Expand Down
49 changes: 49 additions & 0 deletions cmd/impl/jms_chat.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package impl

import (
"context"
"encoding/json"

"github.com/jumpserver/wisp/pkg/logger"
pb "github.com/jumpserver/wisp/protobuf-go/protobuf"
"google.golang.org/protobuf/types/known/structpb"
)

func (j *JMServer) GetAccountChat(ctx context.Context, req *pb.Empty) (*pb.AccountDetailResponse, error) {
var (
status pb.Status
)
accountChatDetail, err := j.apiClient.GetAccountsChat()
if err != nil {
logger.Errorf("GetAccountChat: %v", err)
status.Err = err.Error()
return &pb.AccountDetailResponse{
Status: &status,
}, nil
}
var m map[string]any
jsonBytes, err := json.Marshal(accountChatDetail)
if err != nil {
logger.Errorf("Encode accountChatDetail failed: %v", err)
status.Err = err.Error()
return &pb.AccountDetailResponse{
Status: &status,
}, nil
}
if err = json.Unmarshal(jsonBytes, &m); err != nil {
logger.Errorf("Unmarshal to map failed: %v", err)
status.Err = err.Error()
return &pb.AccountDetailResponse{
Status: &status,
}, nil
}
st, err1 := structpb.NewStruct(m)
if err1 != nil {
status.Err = err1.Error()
return &pb.AccountDetailResponse{
Status: &status,
}, nil
}
status.Ok = true
return &pb.AccountDetailResponse{Status: &status, Payload: st}, nil
}
21 changes: 21 additions & 0 deletions docker-compose.yaml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: "3.0"

networks:
wisp:
driver: bridge

services:
wisp:
image: ghcr.io/jumpserver/wisp:latest
container_name: jms_wisp
ports:
- "9090:9090"
environment:
LOG_LEVEL: DEBUG
CORE_HOST: http://docker.host.internal:8080
BOOTSTRAP_TOKEN: PleaseChangeMe
networks:
- guacd
restart: always
volumes:
- ./data/:/opt/wisp/data/:rw # /opt/wisp/-> 本地项目路径, 修改 ./data 目录权限为777
49 changes: 22 additions & 27 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
module github.com/jumpserver/wisp

go 1.23
go 1.24.6

require (
github.com/Azure/azure-storage-blob-go v0.14.0
github.com/aliyun/aliyun-oss-go-sdk v2.2.8+incompatible
github.com/Azure/azure-storage-blob-go v0.15.0
github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible
github.com/aws/aws-sdk-go v1.44.306
github.com/elastic/go-elasticsearch/v6 v6.8.5
github.com/elastic/go-elasticsearch/v8 v8.14.0
github.com/gorilla/websocket v1.5.3
github.com/huaweicloud/huaweicloud-sdk-go-obs v3.21.12+incompatible
github.com/jumpserver-dev/sdk-go v0.0.0-20250708045559-e0977dde0649
github.com/sirupsen/logrus v1.8.1
github.com/spf13/cobra v1.6.1
github.com/spf13/viper v1.14.0
golang.org/x/crypto v0.27.0
github.com/huaweicloud/huaweicloud-sdk-go-obs v3.25.4+incompatible
github.com/jumpserver-dev/sdk-go v0.0.0-20250925081620-d22b2b8e24d1
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.10.1
github.com/spf13/viper v1.21.0
golang.org/x/crypto v0.42.0
google.golang.org/grpc v1.65.0
google.golang.org/protobuf v1.34.2
gopkg.in/natefinch/lumberjack.v2 v2.2.1
Expand All @@ -25,40 +25,35 @@ require (
github.com/LeeEirc/httpsig v1.2.1 // indirect
github.com/dlclark/regexp2 v1.11.4 // indirect
github.com/elastic/elastic-transport-go/v8 v8.6.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/mattn/go-ieproxy v0.0.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/sagikazarmark/locafero v0.12.0 // indirect
github.com/shirou/gopsutil/v3 v3.24.5 // indirect
github.com/shoenig/go-m1cpu v0.1.6 // indirect
github.com/spf13/afero v1.9.3 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.4.1 // indirect
github.com/spf13/afero v1.15.0 // indirect
github.com/spf13/cast v1.10.0 // indirect
github.com/spf13/pflag v1.0.10 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.opentelemetry.io/otel v1.24.0 // indirect
go.opentelemetry.io/otel/metric v1.24.0 // indirect
go.opentelemetry.io/otel/trace v1.24.0 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/text v0.18.0 // indirect
golang.org/x/time v0.6.0 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/net v0.43.0 // indirect
golang.org/x/sys v0.36.0 // indirect
golang.org/x/text v0.29.0 // indirect
golang.org/x/time v0.12.0 // indirect
google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading