1 Star 0 Fork 83

Xia,Rongfu / xcloud-webconsole

forked from maomao1x / xcloud-webconsole 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.md 7.43 KB
一键复制 编辑 原始数据 按行查看 历史
wanglsir 提交于 2020-11-07 22:05 . docs: loss fix

XCloud WebConsole

A lightweight enterprise Web Console terminal, which brings together the advantages of most similar products, supporting SSH2/lrzsz (RDP/RFB/Telnet) protocol, Audit and screen recording function, etc

中文文档.

Quick start

step1. Installing project
git clone https://github.com/wl4g/xcloud-webconsole.git # upstream, latest
# git clone https://gitee.com/wl4g/xcloud-webconsole.git
cd xcloud-webconsole/scripts
./build.sh  # Compiling to Linux
# build.bat # Compiling to Windows
./webconsole_linux_amd64 -c resources/webconsole.yml # Startup(Default by ./webconsole.yml)

Load configuration file '/etc/webconsole.yml'{"level":"info","time":"20-11-07 22:03:49","line":"pkg/webconsole.go:71","msg":"WebConsole server starting...","service":"main"}
{"level":"info","time":"20-11-07 22:03:49","line":"admin/metric-exporter.go:142","msg":"Starting prometheus exporter...","service":"main","Listen":":16089"}
[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
 - using env:   export GIN_MODE=release
 - using code:  gin.SetMode(gin.ReleaseMode)

[GIN-debug] GET    /terminal/ws/:id          --> xcloud-webconsole/pkg/modules/ssh2.NewWebsocketConnectionFunc (4 handlers)
[GIN-debug] GET    /terminal/session/list    --> xcloud-webconsole/pkg/modules/ssh2.QuerySSH2SessionsFunc (4 handlers)
[GIN-debug] POST   /terminal/session/create  --> xcloud-webconsole/pkg/modules/ssh2.AddSSH2SessionFunc (4 handlers)
[GIN-debug] POST   /terminal/session/delete  --> xcloud-webconsole/pkg/modules/ssh2.DeleteSSH2SessionFunc (4 handlers)
[GIN-debug] POST   /terminal/session/close   --> xcloud-webconsole/pkg/modules/ssh2.CloseSSH2SessionFunc (4 handlers)
[GIN-debug] Listening and serving HTTP on :26088
step2. Deploying to nginx. (Deploy to nginx (https is optional))

Because webconsole is based on HTML, the copy and paste functions of the browser are limited by the security mechanism and can only be used under HTTPS, Of course, if you don't want to be troublesome, this step can be ignored. You can use HTTP local test directly, but you can't use the copy and paste function of the browser

127.0.0.1   webconsole.wl4g.debug # Add hosts
sudo mkdir -p /etc/nginx/conf.d && \
sudo mkdir -p /etc/nginx/certs && \
cat > /etc/nginx/conf.d/sslwebconsole.conf <<EOF
# Generated by WebConsole docs sample.

# WebConsole web pages.
server {
    listen 443 ssl;
    server_name webconsole.wl4g.debug;
    ssl on;
    ssl_certificate   certs/_wildcard.wl4g.debug.pem;
    ssl_certificate_key  certs/_wildcard.wl4g.debug-key.pem;
    ssl_session_timeout 5m;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    location / {
       root /usr/share/nginx/html/webconsole;
       index index.html;
    }
}

# WebConsole server APIs.
server {
    listen 26088 ssl;
    server_name  webconsole.wl4g.debug;
    ssl_certificate   certs/_wildcard.wl4g.debug.pem;
    ssl_certificate_key  certs/_wildcard.wl4g.debug-key.pem;
    ssl_session_timeout  5m;
    ssl_prefer_server_ciphers    on;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;         
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
    location / {
        proxy_http_version 1.1;    
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";     
        proxy_set_header X-real-ip $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_pass http://127.0.0.1:16088;
    }
}
EOF

mv $PROJECT/testing/*.pem /etc/nginx/certs/ # Configure test certificate
sudo chmod 755 /etc/nginx/conf.d/sslwebconsole.conf
sudo systemctl restart nginx

Test Ca and certificate (if using https)

Install the test CA certificate to the system and chrome, for example (Chrome84.x):

chrome://settings/security

Management Certificate -> Trusted certification authority -> Imports, Then restart chrome and try to access: https://webconsole.wl4g.debug

Features

  • It is designed as a native JavaScript class library, which can be easily integrated with React/Vue/AngularJS and other frameworks
  • It can run on Android iOS and any other terminal that can render HTML. It can almost completely replace the shell client based on the installation program
  • Fully support lrzsz command set (implemented based on zmodem)
  • Enhanced support for mobile terminal copy, paste, fast forward, backward and other key combination command, user-friendly operation habits
  • Seamless docking Prometheus metric acquisition

Collect prometheus metrics

curl http://localhost:16089/metrics

# HELP goroutines_num Number of goroutines
# TYPE goroutines_num gauge
goroutines_num 16
# HELP mysql_active_conn Current active connections of MySQL
# TYPE mysql_active_conn gauge
mysql_active_conn{dbconnectstr="gzsm:******@tcp(10.0.0.160:3306)/devops_dev?charset=utf8",host="10.0.0.172"} 1
# HELP ssh2_active_dispatch_channels Current active channels of SSH2 dispatcher
# TYPE ssh2_active_dispatch_channels gauge
ssh2_active_dispatch_channels{host="10.0.0.172",user="admin"} 0
# HELP threads_num Number of threads
# TYPE threads_num gauge
threads_num 8
# HELP virtual_free_memory Size of virtual free memory
# TYPE virtual_free_memory gauge
virtual_free_memory 1.731424256
# HELP virtual_total_memory Size of virtual total memory
# TYPE virtual_total_memory gauge
virtual_total_memory 8.50089984

Screenshots

  • rz Upload file
  • rz Upload file

Note: the page does not set the most compact test page of CSS style

Primary Dependencies

Other descriptions (Optional)

TODO

  • [√] Completely unify the daily output of each component, such as gin framework.
  • [√] Enhance the administrator functions of webconsole service, such as its own health/metrics/indicator(CPU/Mem/Network/Connections...) And more detailed indicators.
  • Canvas + Object Storage Audit screen recording function.
  • In order to realize the remote image UI control protocol compatible with windows RDP(Remote Desktop Protocol) based on Web, And RFB/Telnet

Custom Development Guide

  • It is recommended that ide use vscode for secondary development, because the project root directory already contains the .vscode editor configuration file
  • Modifying database configuration: resources/webconsole.yml#datasource.mysql.dbconnectstr
  • Configuration file description: this project uses Viper configuration framework, and the loading priority is: Set()/Flags/Env/Config/Default
  • If you need to add new configuration items, you must use config_ generator.go Tool generation and xxx-config.go Corresponding default configuration items to webconsole.default.yml.go, reference command:
cd $WEBCONSOLE_HOME
go run config_generator.go

Successfully for pkg/config/webconsole.default.yml.go
Go
1
https://gitee.com/xiarongfu/xcloud-webconsole.git
git@gitee.com:xiarongfu/xcloud-webconsole.git
xiarongfu
xcloud-webconsole
xcloud-webconsole
master

搜索帮助