{"id":37100297,"url":"https://github.com/shibingli/webconsole","last_synced_at":"2026-01-14T12:13:18.492Z","repository":{"id":55800549,"uuid":"53117445","full_name":"shibingli/webconsole","owner":"shibingli","description":"基于Golang、WebSocket、xTermJS 的 Web SSH 远程终端","archived":false,"fork":false,"pushed_at":"2020-03-16T09:26:29.000Z","size":178296,"stargazers_count":576,"open_issues_count":0,"forks_count":211,"subscribers_count":41,"default_branch":"master","last_synced_at":"2024-06-18T20:08:13.004Z","etag":null,"topics":["ssh","webconsole","webssh"],"latest_commit_sha":null,"homepage":"https://webconsole.realclouds.org","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shibingli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-04T07:45:40.000Z","updated_at":"2024-04-18T14:08:35.000Z","dependencies_parsed_at":"2022-08-15T07:10:22.687Z","dependency_job_id":null,"html_url":"https://github.com/shibingli/webconsole","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/shibingli/webconsole","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shibingli%2Fwebconsole","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shibingli%2Fwebconsole/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shibingli%2Fwebconsole/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shibingli%2Fwebconsole/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shibingli","download_url":"https://codeload.github.com/shibingli/webconsole/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shibingli%2Fwebconsole/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28419689,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ssh","webconsole","webssh"],"created_at":"2026-01-14T12:13:18.019Z","updated_at":"2026-01-14T12:13:18.470Z","avatar_url":"https://github.com/shibingli.png","language":"JavaScript","readme":"# 欢迎大家踊跃报名，利用业余时间来拓展此项目，增加更多的功能服务大家。\n\n## 常规部署\n```\n1、下载 go1.8.1.linux-amd64.tar.gz\n2、tar zxvf go1.8.1.linux-amd64.tar.gz -C /usr/local\n3、echo 'export PATH=\"/usr/local/go/bin:$PATH\"' \u003e\u003e /etc/profile\n4、source /etc/profile\n5、cd /opt \u0026\u0026 git clone --recurse-submodules https://github.com/shibingli/webconsole.git \u0026\u0026 cd webconsole \u0026\u0026 git submodule update --init --recursive\n6、cd /opt/webconsole/src/apibox.club/apibox\n7、GOPATH=/opt/webconsole go install\n8、设置开机自动启动\n  cp /opt/webconsole/bin/webconsole  /etc/init.d/   \u0026\u0026 chmod   755 /etc/init.d/webconsole \n  chkconfig   --add  webconsole  \u0026\u0026  chkconfig webconsole   on  \u0026\u0026 service webconsole   start\n  \n\n```\n\n[下载 Golang](https://storage.googleapis.com/golang/go1.8.1.linux-amd64.tar.gz)\n\n\n## 容器部署\n```\n1、下载并安装 Docker\n2、cd /opt \u0026\u0026 git clone --recurse-submodules https://github.com/shibingli/webconsole.git \u0026\u0026 cd webconsole \u0026\u0026 git submodule update --init --recursive\n3、cd /opt/webconsole/src/apibox.club/apibox\n4、GOPATH=/opt/webconsole go install\n5、cd /opt/webconsole\n6、docker build -t webconsole:latest .\n7、docker run -d -p 8080:8080 --restart=always --name webconsole webconsole:latest\n```\n\n[安装 Docker](https://docs.docker.com/engine/installation/)\n\n\n## 更新日志\n\n2018.12.28\n\n    更新：\n\n        1、更新核心js库\n        2、合并 pczchen 提交的分支，支持 Docker 容器访问\n        3、常规修复\n\n2017.07.31\n\n    更新：\n\n        1、更新 xTerm.js\n\n2017.07.20\n\n    修证：\n\n        1、修证UTF-8字符集展示BUG;\n        2、修证大文件展示BUG。\n       \n     本次BUG由 @AEGQ 修证和贡献代码\n\n2017.04.19\n\n    更新：\n        1、删除 build.sh\n        2、添加部署说明\n\n2017.04.15\n\n    修证：\n        1、修证一些页面的展示BUG。\n\n    更新：\n        1、更新xTerm库。\n        2、添加外部引用例子。\n\n2017.04.11\n\n    更新：\n        1、添加对 JSONP 的支持，解决 JQuery 跨域请求的需求。\n        2、配置文件新增 JSONP 的支持。\n\n感谢 @朱小四(weichat:juechengke) 提出需求。\n\n2017.03.27\n\n    修证：\n        1、修证粘贴字串的BUG。\n\n    更新：\n        1、更新 xTerm 库。\n\n2017.03.14\n\n    修证:\n    \n        1、修证 wss 协议适配 BUG\n\n    更新：\n        1、删除根目录 golang 程序包。如果运行脚本，请自行下载对应 golang 包（go1.8.linux-amd64.tar.gz）放置根目录。\n\n2017.02.27\n\n    修证:\n    \n        1、修改部分BUG\n        2、更新 Golang 到 1.8 版本\n        3、修证 Golang 1.8 版本中 url.Parse 解析地址 BUG\n        4、替换 term.js 为 xterm.js\n        5、更新对CJK（中文、日文、韩文）字符集和IME的支持\n        6、更友好地支持 Linux 下主流程序，如：VIM、Tmux等\n            \n\n2016.05.25\n\n    修证:\n    \n        1、修证 log 目录不存在而引起的无法启动程序的 BUG\n        2、Dockerfile 无法 Build 项目的 BUG \n\n2016.05.21\n\n    修证:\n    \n        1、SSH Session 退出异常 BUG\n\n2016.05.17\n\n    新增:\n        添加跨域白名单的支持。(conf/conf.json     cors_white_list:\"127.0.0.1,www.xxx.com\");\n\n    感谢 @玩蝴蝶的法师 提出的功能建议。\n\n2016.05.13\n\n    修证:\n        1、修证 Ubuntu 下无法使用 VIM 的 BUG；\n\n    替换:\n        2、更换 Gorilla 的 Websocket 库。\n\n    感谢 @玩蝴蝶的法师 提出的建议和BUG。\n\n2016.03.05\n\n    新增:\n        1、增加 Dockerfile\n\n2016.03.04 发布 v1.1\n\n    新增:\n        1、增加命令行的启动、停止、状态查看功能. 如: ./apibox start/stop/status\n\n2016.03.03\n\n    修证:\n        1、修改独立模式时登陆JS验证问题.\n\n    新增:\n        1、增加后台运行模式(conf/conf.json.  daemon:true/false);\n        2、增加程序运行时的PID文件(log/apibox.pid);\n\n## 大概的数据流向：\n```\n    浏览器--》WebSocket--》SSH--》Linux OS\n```\n\n### 代码地址\n\n[Git@OSC](http://git.oschina.net/shibingli/webconsole)\n\n\n[Github](https://github.com/shibingli/webconsole)\n\n\n[演示地址](http://webconsole.realclouds.org)\n    \n\n## 程序包结构：\n\n```\n├── bin\n│   └── apibox\n├── conf\n│   ├── ssl_cert.crt (默认不存在)\n│   ├── ssl_cert.key (默认不存在)\n│   ├── conf.json\n│   └── mime.types\n├── log\n├── pkg\n├── static\n│   ├── images\n│   └── scripts\n└── template\n\n\n运行环境要求：\n\n1、Linux Kernel 3.x/x86_64 及更高版本\n2、建议 Linux 发行版 CentOS 7.0+ / Ubuntu 14.04+\n3、启用支持 SSL/TLS 模式访问时，需要生成对应的 SSL 证书文件且放置到 \"conf\" 文件夹下并配置 \"conf.json\" 文件\n4、客户端要求使用 IE9、Chrome 40、Firefox 38、Safari 9 或更高版本的浏览器访问\n5、服务器端需要对防火墙开启对应的外部访问端口。具体需要开放的端口请参考 \"conf\" 文件夹下的 \"conf.json\" 文件中的端口部分的配置\n6、本程序只能对 Unix/Linux 类的操作系统，且支持 SSH 协议的 OS 进行远程操作\n7、基于Go1.6+，原生支持 http2 \n\n\n一、部署\n1、将程序解压或下载至任一目录，运行 \"build.sh\" 编译可执行文件\n2、然后运行 \"bin\" 文件夹下的 \"apibox\" 文件即可。如:\"./apibox start/stop\"\n3、配置文件在 \"conf\" 文件夹下，核心配置文件为 \"conf.json\"，部署的时候需要添加跨域白名单来支持其他机器的访问\n4、后台运行可以配置 \"conf\" 文件夹下的 \"conf.json\" 文件,将 \"daemon\" 项配置为 \"true\" \n5、运行时日志文件存放在 \"log\" 文件夹下，以当天时期命名\n6、也可以配置程序以 Nginx 的 fcgi 模式运行,以 Nginx 做为访问入口\n```\n\n\n二、使用\n1、程序部署完成后，直接通过浏览器访问即可。如: http(s)://ip:port。\n\n2、外部系统引用步骤：\n    \n    1）、以 GET 或 POST 的方式，提交 \"vm_addr\" 参数至 \"http(s)://ip:port/console/chksshdaddr\" ,成功后可获取到加密后的 \"en_addr\" 信息。注：vm_addr 格式为: \"ip:port\" ，若不携带端口，默认端口为 \"22\" 。\n\n        获取到的结果为 JSON 格式(注:以下数据为测试数据)：\n\n            成功：\n                {\n                    \"ok\": true,\n                    \"msg\": \"\",\n                    \"data\": { \"en_addr\": \"0b-nDgcazQKTmUw4oBLfxott\", \"sshd_addr\": \"192.168.220.173:22\" }\n                }\n\n            失败：\n                { \"ok\": false, \"msg\": \"Unable to resolve host address.\", \"data\": null }\n\n    2）、成功获取到加密的 en_addr 信息后，以 GET 或 POST 方式访问  \"http(s)://ip:port/console/login/'en_addr'\" 即可。注: \"en_addr\" 是通过第 1）步操作获取的数据。\n\n## JQuery Demo:\n\n        \n### 第一种方式（需要二次登陆，同一个域的情况，同样可以使用跨域的方式访问）：\n\n\n```javascript\nvar protocol = (location.protocol === \"https:\") ? \"https://\" : \"http://\";\nvar addr = protocol + location.hostname + ((location.port) ? (\":\" + location.port) : \"\")\n\n$.post(addr+\"/console/chksshdaddr?rnd=\" + Math.random(), {\n    \"vm_addr\": \"192.168.220.177:22\"\n}, function(data) {\n    var json = data;\n    if (typeof(data) != \"object\") {\n        json = $.parseJSON(data);\n    }\n    if (json.ok) {\n        location.href = addr + json.data.sshd_addr;\n    }\n});\n```\n\n\n\n### 第二种方式（直接输入远端的主机地址、用户名、密码，然后直接登陆。跨域的情况）：\n\n```html\n\u003cbutton class=\"btn btn-primary\" onclick=\"testDemo();\"\u003eTest\u003c/button\u003e\n\n\u003cscript type=\"text/javascript\"\u003e\n    //注意，如果远程主机的访问地址是以IP形式出现的，可以忽略此步骤，直接调用 login 方法。具体登陆地址端口请根据实际情况更改.\n    var testDemo = function() {\n        $.ajax({\n            url: \"http://a.com:8081/console/chksshdaddr?rnd=\" + Math.random(),\n            method: \"POST\",\n            data: {\n                \"vm_addr\": \"172.16.18.223:22\",\n            },\n            dataType: \"jsonp\",\n            cache: false,\n        }).done(function(data) {\n            var json = data;\n            if (typeof(data) != \"object\") {\n                json = $.parseJSON(data);\n            }\n            if (json.ok) {\n                console.log(\"en_addr:\", json.data.sshd_addr);\n                login(json.data.sshd_addr, \"shibingli\", \"cloud123456\");\n            } else {\n                alert(\"登陆失败，请确认您的主机信息。\");\n            }\n        }).fail(function() {\n            alert(\"未知失败，请联系管理员。\");\n        });\n    };\n\n\n    //注意，如果远程主机的访问地址是以域名或主机形式出现的，可以执行上面步骤后，再调用本方法。具体登陆地址端口请根据实际情况更改.\n    var login = function(enVMAddr, username, password) {\n        $.ajax({\n            url: \"http://a.com:8081/console/login?rnd=\" + Math.random(),\n            method: \"POST\",\n            data: {\n                \"vm_addr\": enVMAddr,\n                \"user_name\": username,\n                \"user_pwd\": password\n            },\n            dataType: \"jsonp\",\n            cache: false,\n        }).done(function(data) {\n            var json = data;\n            if (typeof(data) != \"object\") {\n                json = $.parseJSON(data);\n            }\n            if (json.ok) {\n                location.href = \"http://a.com:8081\" + json.data;\n            } else {\n                alert(\"登陆失败，请确认您的登陆信息。\");\n            }\n        }).fail(function() {\n            alert(\"未知失败，请联系管理员。\");\n        });\n    };\n\u003c/script\u003e\n```\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshibingli%2Fwebconsole","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshibingli%2Fwebconsole","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshibingli%2Fwebconsole/lists"}