diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..a4c101d --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +node_modules +doc_images diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..62fca29 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM node:20.16-alpine3.20 +WORKDIR /easynode +COPY . . +RUN yarn + +WORKDIR /easynode/web +RUN yarn build +RUN mv dist/* ../server/app/static + +WORKDIR /easynode/server +ENV HOST 0.0.0.0 +EXPOSE 8082 +CMD [ "npm", "start" ] diff --git a/Q&A.md b/Q&A.md index 4e03d54..06cf475 100644 --- a/Q&A.md +++ b/Q&A.md @@ -25,7 +25,7 @@ PubkeyAcceptedAlgorithms +ssh-rsa ```shell vi /etc/selinux/config SELINUX=enforcing -// 修改为禁用 +# 修改为禁用 SELINUX=disabled ``` @@ -35,4 +35,6 @@ SELINUX=disabled ## 客户端服务启动成功,无法连接? -> 端口未开放:`iptables -I INPUT -s 0.0.0.0/0 -p tcp --dport 22022 -j ACCEPT` 或者 `rm -rf /etc/iptables && reboot` +> 1. 检查防火墙配置 + +> 2. iptables端口未开放:`iptables -I INPUT -s 0.0.0.0/0 -p tcp --dport 22022 -j ACCEPT` 或者 `rm -rf /etc/iptables && reboot` diff --git a/README.md b/README.md index 928774d..dd3b90c 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,19 @@ # EasyNode v2.0 -> 一个功能完善的Linux服务器SSH终端面板. - > [!WARNING] > 初次部署EasyNode,登录系统后务必记得修改默认账户密码 `admin/admin`! > [!WARNING] > 强烈建议使用 **iptables** 或 **fail2ban** 等安全服务限制IP访问,谨慎暴露面板服务到公网。 +> [!NOTE] +> 客户端信息监控与webssh功能都将以`该服务器作为中转`。中国大陆连接建议使用香港、新加坡、日本、韩国等地区的低延迟服务器来安装服务端 - --- @@ -114,19 +82,19 @@ wget -qO- --no-check-certificate https://ghproxy.com/https://raw.githubuserconte #### X86架构 ```shell -wget -qO- --no-check-certificate https://ghproxy.com/https://raw.githubusercontent.com/chaos-zhu/easynode/v1.2/easynode-client-install-x86.sh | bash +wget -qO- --no-check-certificate https://mirror.ghproxy.com/https://raw.githubusercontent.com/chaos-zhu/easynode/v1.2/easynode-client-install-x86.sh | bash ``` #### ARM架构 ```shell -wget -qO- --no-check-certificate https://ghproxy.com/https://raw.githubusercontent.com/chaos-zhu/easynode/v1.1/easynode-client-install-arm.sh | bash +wget -qO- --no-check-certificate https://mirror.ghproxy.com/https://raw.githubusercontent.com/chaos-zhu/easynode/v1.1/easynode-client-install-arm.sh | bash ``` > 卸载 ```shell -wget -qO- --no-check-certificate https://ghproxy.com/https://raw.githubusercontent.com/chaos-zhu/easynode/v1.2/easynode-client-uninstall.sh | bash +wget -qO- --no-check-certificate https://mirror.ghproxy.com/https://raw.githubusercontent.com/chaos-zhu/easynode/v1.2/easynode-client-uninstall.sh | bash ``` > 查看客户端状态:`systemctl status easynode-client` @@ -139,19 +107,7 @@ wget -qO- --no-check-certificate https://ghproxy.com/https://raw.githubuserconte ## 升级指南 -2.0版本无论前后端均作了大量的重构工作,1.0版本**不支持**无感升级到2.0版本 - -### 服务端 - -> v1.1对所有的敏感信息全部加密,所有的v1.0为加密的信息全部失效. 主要影响已存储的ssh密钥. -> -> **还原客户端列表:** 先备份`app\config\storage\host-list.json`, 使用一键脚本或者手动部署的同志安装好使用备份文件覆盖`\app\storage`下的同名文件即可。 -> -> 由于加密文件调整,使用docker镜像的v1.1一键脚本自己从镜像里把备份抠出来再重新构建镜像. - -### 客户端 - -> v1.2未对客户端包进行改动,客户端无需重复安装. 不会备份的在面板重新添加客户端机器即可. +2.0版本无论前后端均作了大量的重构工作,1.0版本**不支持**升级到2.0版本 ### 版本日志 @@ -159,11 +115,7 @@ wget -qO- --no-check-certificate https://ghproxy.com/https://raw.githubuserconte ## 安全与说明 -> 本人非专业后端,此服务全凭兴趣开发. 由于知识受限,并不能保证没有漏洞的存在,重要生产服务器最好不要使用此服务!!! - -> 所有服务器信息相关接口已做`jwt鉴权`, 安全信息均使用加密传输与储存! - -> webssh功能需要的密钥信息全部保存在服务端服务器的`app\storage\ssh-record.json`中. 在保存ssh密钥信息到服务器储存与传输过程皆已加密,`不过最好还是套https使用` +> 本人非专业后端,此服务全凭兴趣开发. 由于知识受限,并不能保证没有漏洞的存在,所以请务必使用`iptables`限制ip访问该服务,且不要轻易暴露此服务在公网。 ## 开发 @@ -182,4 +134,4 @@ wget -qO- --no-check-certificate https://ghproxy.com/https://raw.githubuserconte ## License -[MIT](LICENSE). Copyright (c). --> +[MIT](LICENSE). Copyright (c). diff --git a/doc_images/v2.0-1.jpg b/doc_images/v2.0-1.jpg new file mode 100644 index 0000000..a2d0cfb Binary files /dev/null and b/doc_images/v2.0-1.jpg differ diff --git a/doc_images/v2.0-2.jpg b/doc_images/v2.0-2.jpg new file mode 100644 index 0000000..f75d824 Binary files /dev/null and b/doc_images/v2.0-2.jpg differ diff --git a/easynode-client-install-arm.sh b/easynode-client-install-arm.sh index a9c8eb3..e903bdf 100644 --- a/easynode-client-install-arm.sh +++ b/easynode-client-install-arm.sh @@ -42,8 +42,8 @@ echo "***********************创建文件PATH***********************" mkdir -p ${FILE_PATH} echo "***********************下载开始***********************" -DOWNLOAD_FILE_URL="https://ghproxy.com/https://github.com/chaos-zhu/easynode/releases/download/v1.1/easynode-client-arm" -DOWNLOAD_SERVICE_URL="https://ghproxy.com/https://raw.githubusercontent.com/chaos-zhu/easynode/v1.1/client/easynode-client.service" +DOWNLOAD_FILE_URL="https://mirror.ghproxy.com/https://github.com/chaos-zhu/easynode/releases/download/v1.1/easynode-client-arm" +DOWNLOAD_SERVICE_URL="https://mirror.ghproxy.com/https://raw.githubusercontent.com/chaos-zhu/easynode/v1.1/client/easynode-client.service" # -O 指定路径和文件名(这里是二进制文件, 不需要扩展名) wget -O ${FILE_PATH}/${SERVER_NAME} --no-check-certificate --no-cache ${DOWNLOAD_FILE_URL} diff --git a/easynode-client-install-x86.sh b/easynode-client-install-x86.sh index 86073ea..cdc683f 100644 --- a/easynode-client-install-x86.sh +++ b/easynode-client-install-x86.sh @@ -42,8 +42,8 @@ echo "***********************创建文件PATH***********************" mkdir -p ${FILE_PATH} echo "***********************下载开始***********************" -DOWNLOAD_FILE_URL="https://ghproxy.com/https://github.com/chaos-zhu/easynode/releases/download/v1.1/easynode-client-x86" -DOWNLOAD_SERVICE_URL="https://ghproxy.com/https://raw.githubusercontent.com/chaos-zhu/easynode/v1.1/client/easynode-client.service" +DOWNLOAD_FILE_URL="https://mirror.ghproxy.com/https://github.com/chaos-zhu/easynode/releases/download/v1.1/easynode-client-x86" +DOWNLOAD_SERVICE_URL="https://mirror.ghproxy.com/https://raw.githubusercontent.com/chaos-zhu/easynode/v1.1/client/easynode-client.service" # -O 指定路径和文件名(这里是二进制文件, 不需要扩展名) wget -O ${FILE_PATH}/${SERVER_NAME} --no-check-certificate --no-cache ${DOWNLOAD_FILE_URL} diff --git a/easynode-server-install.sh b/easynode-server-install.sh deleted file mode 100644 index 909224f..0000000 --- a/easynode-server-install.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash - -if [ "$(id -u)" != "0" ] ; then - echo "***********************请切换到root再尝试执行***********************" - exit 1 -fi - -echo "***********************检测node环境***********************" -node -v -if [ $? != 0 ] -then - echo "未安装node运行环境" - exit 1 -fi -echo "已安装" - - -echo "***********************检测pm2守护进程***********************" -pm2 list -if [ $? != 0 ] -then - echo "未安装pm2,正在安装..." - npm i -g pm2 -fi -echo "已安装" - -echo "***********************开始下载EasyNode***********************" - -DOWNLOAD_FILE_URL="https://ghproxy.com/https://github.com/chaos-zhu/easynode/releases/download/v1.2.1/easynode-server.zip" -SERVER_NAME=easynode-server -SERVER_ZIP=easynode-server.zip -FILE_PATH=/root -wget -O ${FILE_PATH}/${SERVER_ZIP} --no-check-certificate --no-cache ${DOWNLOAD_FILE_URL} - -if [ $? != 0 ] -then - echo "下载EasyNode.zip失败,请检查网络环境或稍后再试" - exit 1 -fi -echo "下载成功" - -echo '***********************开始解压***********************' - -unzip -o -d ${FILE_PATH}/${SERVER_NAME} ${SERVER_ZIP} -if [ $? != 0 ] -then - echo "解压失败, 请确保已安装zip、tar基础工具" - exit 1 -fi -echo "解压成功" - -cd ${FILE_PATH}/${SERVER_NAME} || exit - -echo '***********************开始安装依赖***********************' -yarn -v -if [ $? != 0 ] -then - echo "未安装yarn管理工具,正在安装..." - npm i -g yarn -fi -yarn - -if [ $? != 0 ] -then - echo "yarn安装失败,请检测网络环境. 使用大陆vps请执行以下命令设置镜像源,再重新运行该脚本:npm config set registry https://registry.npm.taobao.org -" -fi -echo "依赖安装成功" - -echo '启动服务' - -pm2 start ${FILE_PATH}/${SERVER_NAME}/app/main.js --name easynode-server - -echo '查看日志请输入: pm2 log easynode-server' diff --git a/images/v1.2-1.png b/images/v1.2-1.png deleted file mode 100644 index 10683b2..0000000 Binary files a/images/v1.2-1.png and /dev/null differ diff --git a/images/v1.2-2.png b/images/v1.2-2.png deleted file mode 100644 index 75b3068..0000000 Binary files a/images/v1.2-2.png and /dev/null differ diff --git a/images/v1.2-3.png b/images/v1.2-3.png deleted file mode 100644 index 69ce061..0000000 Binary files a/images/v1.2-3.png and /dev/null differ diff --git a/package.json b/package.json index 79f6b10..429e2ca 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "easynode", - "version": "1.0.0", + "version": "2.0.0", "description": "web ssh", "private": true, "workspaces": [ diff --git a/server/Dockerfile b/server/Dockerfile deleted file mode 100644 index 373c8b4..0000000 --- a/server/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM node:16.15.0-alpine3.14 -ARG TARGET_DIR=/easynode-server -WORKDIR ${TARGET_DIR} -RUN yarn config set registry https://registry.npm.taobao.org -COPY package.json ${TARGET_DIR} -COPY yarn.lock ${TARGET_DIR} -RUN yarn -COPY . ${TARGET_DIR} -ENV HOST 0.0.0.0 -EXPOSE 8082 -EXPOSE 8083 -EXPOSE 22022 -CMD ["npm", "run", "server"] diff --git a/server/README.md b/server/README.md index c6a5faf..3154034 100644 --- a/server/README.md +++ b/server/README.md @@ -2,15 +2,6 @@ - 基于Koa -## docker - - -- 构建镜像:docker build -t chaoszhu/easynode:v1.1 . -- 推送镜像:docker push chaoszhu/easynode:v1.1 - -> `docker run -d --net=host easynode-server` - - ## 遇到的问题 > MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 input listeners added to [Socket]. Use emitter.setMaxListeners() to increase limit diff --git a/server/package.json b/server/package.json index 20200ae..0b160ed 100644 --- a/server/package.json +++ b/server/package.json @@ -11,7 +11,7 @@ "scripts": { "local": "cross-env EXEC_ENV=local nodemon ./app/index.js", "prod": "cross-env EXEC_ENV=production nodemon ./app/index.js", - "start": "node ./app/index.js", + "start": "node ./index.js", "pkgwin": "pkg . -t node20-win-x64", "pkglinux:x86": "pkg . -t node20-linux-x64", "pkglinux:arm": "pkg . -t node20-linux-arm64", diff --git a/web/Dockerfile b/web/Dockerfile deleted file mode 100644 index 6f87bae..0000000 --- a/web/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM nginx:stable-alpine -WORKDIR /easynode-web -COPY dist /easynode-web -COPY web.conf /etc/nginx/conf.d/default.conf \ No newline at end of file diff --git a/web/src/components/aside-box.vue b/web/src/components/aside-box.vue index e020fba..1740842 100644 --- a/web/src/components/aside-box.vue +++ b/web/src/components/aside-box.vue @@ -62,16 +62,16 @@ let menuList = reactive([ icon: markRaw(FolderOpened), index: '/group' }, - { - name: '批量指令', - icon: markRaw(Pointer), - index: '/onekey' - }, - { - name: '脚本库', - icon: markRaw(ArrowRight), - index: '/scripts' - }, + // { + // name: '批量指令', + // icon: markRaw(Pointer), + // index: '/onekey' + // }, + // { + // name: '脚本库', + // icon: markRaw(ArrowRight), + // index: '/scripts' + // }, { name: '系统设置', icon: markRaw(Setting), diff --git a/web/src/components/code-edit/index.vue b/web/src/components/code-edit/index.vue index 80e451f..a857882 100644 --- a/web/src/components/code-edit/index.vue +++ b/web/src/components/code-edit/index.vue @@ -1,7 +1,7 @@