[Docker] Sshwifty Web 端 SSH 和 Telnet 连接器布署
Sshwifty 是专为 Web 设计的 SSH 和 Telnet 连接器。它可以部署在计算机或服务器上,为任何兼容(标准)的 Web 浏览器提供 SSH 和 Telnet 访问接口。
Github:https://github.com/nirui/sshwifty
什么是SSH?
SSH(Secure Shell)是一种网络协议,用于安全地远程登录到计算机系统。它提供了加密的通信和身份验证,因此可以在不安全的网络上安全地传输数据。通过SSH,您可以远程连接到运行SSH服务器的计算机,并使用远程终端访问该计算机的命令行界面。SSH协议支持密码和公钥认证,您可以使用密码和用户名对远程服务器进行身份验证,或者使用公钥认证机制来更加安全地完成身份验证。SSH协议是Linux系统中非常重要的一个组件,尤其是在远程管理服务器时,SSH可以保障管理的安全性和可靠性。
部署环境
- 系统:Debian
- 域名一个,并解析到服务器
- 安装好 Docker、Docker-compose,见VPS部署
- 安装好 Caddy,反向代理
部署
升级 packages,
apt update -y
安装常用的软件,
apt install wget curl sudo vim git
sshwifty
创建安装目录,
mkdir -p /root/data/docker/sshwifty
cd /root/data/docker/sshwifty
下载 docker-compose.yml
,
wget https://raw.githubusercontent.com/nirui/sshwifty/master/docker-compose.example.yaml
根据需求和配置说明修改配置环境变量,
version: "3.9"
services:
sshwifty:
image: 'niruix/sshwifty:latest'
container_name: sshwifty
restart: always
# environment:
# - SSHWIFTY_SHAREDKEY=WEB_ACCESS_PASSWORD
ports:
- '8182:8182'
stdin_open: true
tty: true
# deploy:
# replicas: 3
# resources:
# limits:
# cpus: '0.3'
# memory: 600M
启动,
docker-compose up -d
更新
进入 docker-compose.yml
所在的文件夹,
cd /root/data/docker/sshwifty
拉取最新的镜像,
docker-compose pull
重新更新当前镜像,
docker-compose up -d
卸载
进入 docker-compose 所在的文件夹,
cd /root/data/docker/sshwifty
停止容器,此时不会删除映射到本地的数据,
docker-compose down
完全删除映射到本地的数据,
cd
rm -rf /root/data/docker/sshwifty
反向代理
进入目录 /etc/caddy/sites
,创建并编辑 sshwifty.amaranthinking.eu.org.conf
,
sshwifty.amaranthinking.eu.org {
log {
level INFO
output file /root/data/docker/sshwifty/sshwifty.log {
roll_size 10MB
roll_keep 10
}
}
encode gzip
# Uncomment to improve security (WARNING: only use if you understand the implications!)
# If you want to use FIDO2 WebAuthn, set X-Frame-Options to "SAMEORIGIN" or the Browser will block those requests
header {
# Enable HTTP Strict Transport Security (HSTS)
Strict-Transport-Security "max-age=31536000;"
# Enable cross-site filter (XSS) and tell browser to block detected attacks
X-XSS-Protection "1; mode=block"
# Disallow the site to be rendered within a frame (clickjacking protection)
X-Frame-Options "SAMEORIGIN"
# Prevent search engines from indexing (optional)
X-Robots-Tag "none"
# Server name removing
-Server
}
# Proxy everything to Rocket
reverse_proxy 127.0.0.1:8182 {
# Send the true remote IP to Rocket, so that it can put this in the
# log, so that fail2ban can ban the correct IP.
header_up X-Real-IP {remote_host}
}
}
本作品采用 知识共享署名-相同方式共享 4.0 国际许可协议 进行许可。
评论已关闭