jaksi/sshesame
GitHub: jaksi/sshesame
一个轻量级 SSH 蜜罐,接受任意登录并详细记录攻击者活动,不执行实际命令。
Stars: 1715 | Forks: 106
# sshesame
一个易于设置和使用的 SSH 蜜罐,一个接受任何人登录并记录其活动的虚假 SSH 服务器
`sshesame` 接受并记录 SSH 连接和活动(channels,requests),而不会在主机上执行任何实际操作(例如执行命令、发起网络请求)。
[](https://asciinema.org/a/VSqzZi1oPA0FhQDyqht22iA6k)
- [安装与使用](#installation-and-usage)
- [从源码](#from-source)
- [GitHub 发布版本](#github-releases)
- [使用方法](#usage)
- [Docker](#docker)
- [CLI](#cli)
- [Dockerfile](#dockerfile)
- [Docker Compose](#docker-compose)
- [systemd](#systemd)
- [配置](#configuration)
- [输出示例](#sample-output)
## 安装与使用
### 从源码
```
$ git clone https://github.com/jaksi/sshesame.git
$ cd sshesame
$ go build
```
### GitHub 发布版本
针对多种架构的 Linux、macOS 和 Windows 二进制文件会自动构建并发布,可在 [Releases 页面](https://github.com/jaksi/sshesame/releases) 获取。
### 使用方法
```
$ sshesame -h
Usage of sshesame:
-config string
optional config file
-data_dir string
data directory to store automatically generated host keys in (default "...")
```
调试和错误日志会写入标准错误 (standard error)。除非设置了 `logging.file` 配置选项,否则活动日志默认写入标准输出 (standard out)。
### Docker
针对 amd64、arm64 和 armv7 的镜像会自动构建并发布,可在 [Packages 页面](https://github.com/jaksi/sshesame/pkgs/container/sshesame) 获取。
#### CLI
```
$ docker run -it --rm\
-p 127.0.0.1:2022:2022\
-v sshesame-data:/data\
[-v $PWD/sshesame.yaml:/config.yaml]\
ghcr.io/jaksi/sshesame
```
#### Dockerfile
```
FROM ghcr.io/jaksi/sshesame
#COPY sshesame.yaml /config.yaml
```
#### Docker Compose
```
services:
sshesame:
image: ghcr.io/jaksi/sshesame
ports:
- "127.0.0.1:2022:2022"
volumes:
- sshesame-data:/data
#- ./sshesame.yaml:/config.yaml
volumes:
sshesame-data: {}
```
### systemd
```
[Unit]
Description=SSH honeypot
After=network-online.target
Wants=network-online.target
[Service]
ExecStart=/path/to/sshesame #-config /path/to/sshesame.yaml
Restart=always
[Install]
WantedBy=multi-user.target
```
### 配置
可以使用 `-config` 标志选择性地传递配置文件。
如果未指定,将使用合理的默认值,并且 RSA、ECDSA 和 Ed25519 主机密钥将被生成并存储在 `-data_dir` 标志指定的目录中。
包含默认设置和所有配置选项说明的[示例配置文件](sshesame.yaml)已包含在内。
试图模拟 OpenSSH 服务器的[最小化配置文件](openssh.yaml)也已包含在内。
## 输出示例
```
2021/07/04 00:37:05 [127.0.0.1:64515] authentication for user "jaksi" without credentials rejected
2021/07/04 00:37:05 [127.0.0.1:64515] authentication for user "jaksi" with public key "SHA256:uUdTmvEHN6kCAoE4RJWsxr8+fGTGhCpAhBaWgmMVqNk" rejected
2021/07/04 00:37:07 [127.0.0.1:64515] authentication for user "jaksi" with password "hunter2" accepted
2021/07/04 00:37:07 [127.0.0.1:64515] connection with client version "SSH-2.0-OpenSSH_8.1" established
2021/07/04 00:37:07 [127.0.0.1:64515] [channel 1] session requested
2021/07/04 00:37:07 [127.0.0.1:64515] [channel 1] PTY using terminal "xterm-256color" (size 158x48) requested
2021/07/04 00:37:07 [127.0.0.1:64515] [channel 1] environment variable "LANG" with value "en_IE.UTF-8" requested
2021/07/04 00:37:07 [127.0.0.1:64515] [channel 1] shell requested
2021/07/04 00:37:16 [127.0.0.1:64515] [channel 1] input: "cat /etc/passwd"
2021/07/04 00:37:17 [127.0.0.1:64515] [channel 1] closed
2021/07/04 00:37:17 [127.0.0.1:64515] connection closed
```
标签:BOF, Cobalt Strike, Docker, ETW劫持, EVTX分析, EVTX分析, Go语言, Hakrawler, SSH Honeypot, SSH协议, SSH服务, 威胁情报, 安全防御评估, 开发者工具, 开源安全工具, 恶意活动监测, 攻击诱捕, 日志审计, 日志记录, 欺骗防御, 程序破解, 网络安全, 蜜罐, 蜜罐技术, 证书利用, 请求拦截, 逆向工程平台, 隐私保护