安全套接字漏斗(SSF)是网络工具和工具包。
它提供了简单有效的方法,可以通过单个安全的TLS隧道到远程计算机将数据从多个插座(TCP或UDP)转发。
SSF是跨平台(Windows,Linux,OSX),作为独立可执行文件。
特征:
下载预制的二进制文件
文档
在窗户上构建
建立在UNIX/Linux上
交叉编译SSF(例如Raspberry Pi)
用法: ssf[.exe] [options] server_address
选项:
-v verbose_level :详细性:关键|错误|警告|信息| debug | trace(默认:info)
-q :安静模式。不打印日志
-p port :远程端口(默认:8011)
-c config_file_path :指定配置文件。如果未设置,则从当前的工作目录中加载“ config.json”
-m attempts :最大连接尝试在停止之前不成功(默认:1)
-t delay :等待时间之前尝试重新连接几秒钟(默认:60)
-n :如果连接中断,请勿重新连接客户端
-g :允许网关端口。允许客户端将本地插座绑定到特定地址而不是“ Localhost”
-S :显示微服务状态(开/关)
服务选项:
-D [[bind_address]:]port :在服务器上运行袜子代理,可在[[bind_address]:]port上访问
-F [[bind_address]:]port :在[[bind_address]:]port上从服务器上访问的本地主机上运行袜子代理
-X [[bind_address]:]port :向前服务器Shell I/O到本地侧的指定端口。每个连接都会创建一个新的外壳过程
-Y [[bind_address]:]port :向前局部壳I/O到服务器上指定的端口
-L [[bind_address]:]port:host:hostport :前向TCP连接到[[bind_address]:]port host:hostport
-R [[bind_address]:]port:host:hostport :前向TCP连接到[[bind_address]:]port到host:hostport
-U [[bind_address]:]port:host:hostport : [[bind_address]:]port to host:hostport on the Server上
-V [[bind_address]:]port:host:hostport : [[bind_address]:]port上的UDP流量到host:hostport
用法: ssfd[.exe] [options]
选项:
-v verbose_level :详细性:关键|错误|警告|信息| debug | trace(默认:info)
-q :安静模式。不打印日志
-c config_file_path :指定配置文件。如果未设置,则从当前的工作目录中加载“ config.json”
-p port :本地端口(默认值:8011)
-R :服务器仅中继连接
-l host :设置服务器绑定地址
-g :允许网关端口。允许客户端将本地插座绑定到特定地址而不是“ Localhost”
-S :显示微服务状态(开/关)
必须在客户端和服务器配置文件上启用复制功能:
{
"ssf" : {
"services" : {
"copy" : { "enable" : true }
}
}
}用法: ssfcp[.exe] [options] [host@]/absolute/path/file [[host@]/absolute/path/file]
选项:
-v verbose_level :详细性:关键|错误|警告|信息| debug | trace(默认:info)
-q :安静模式。不打印日志
-c config_file_path :指定配置文件。如果未设置,则从当前的工作目录中加载“ config.json”
-p port :远程端口(默认:8011)
-t :使用stdin作为输入
--resume :如果存在目标文件,尝试恢复文件传输
--check-integrity :在转移结束时检查文件完整性
-r :递归复制文件
--max-transfers arg :最大传输并行转移(默认:1)
客户将在端口9000上运行袜子代理,并将连接请求传输到服务器192.168.0.1:8000
ssf -D 9000 -c config.json -p 8000 192.168.0.1
该服务器将在所有网络接口上绑定到端口8011
ssfd
服务器将绑定到192.168.0.1:9000
ssfd -p 9000 -l 192.168.0.1
ssfcp [-c config_file] [-p port] path/to/file host@absolute/path/directory_destination
ssfcp [-c config_file] [-p port] path/to/file* host@absolute/path/directory_destination
ssfcp [-c config_file] [-p port] -r path/to/dir host@absolute/path/directory_destination
data_in_stdin | ssfcp [-c config_file] [-p port] -t host@path/to/destination/file_destination
ssfcp [-c config_file] [-p port] remote_host@path/to/file absolute/path/directory_destination
ssfcp [-c config_file] [-p port] remote_host@path/to/file* absolute/path/directory_destination
ssfcp [-c config_file] [-p port] -r remote_host@path/to/dir absolute/path/directory_destination
{
"ssf" : {
"arguments" : " " ,
"circuit" : [],
"http_proxy" : {
"host" : " " ,
"port" : " " ,
"user_agent" : " " ,
"credentials" : {
"username" : " " ,
"password" : " " ,
"domain" : " " ,
"reuse_ntlm" : true ,
"reuse_nego" : true
}
},
"socks_proxy" : {
"version" : 5 ,
"host" : " " ,
"port" : " 1080 "
},
"tls" : {
"ca_cert_path" : " ./certs/trusted/ca.crt " ,
"cert_path" : " ./certs/certificate.crt " ,
"key_path" : " ./certs/private.key " ,
"key_password" : " " ,
"dh_path" : " ./certs/dh4096.pem " ,
"cipher_alg" : " DHE-RSA-AES256-GCM-SHA384 "
},
"services" : {
"datagram_forwarder" : { "enable" : true },
"datagram_listener" : {
"enable" : true ,
"gateway_ports" : false
},
"stream_forwarder" : { "enable" : true },
"stream_listener" : {
"enable" : true ,
"gateway_ports" : false
},
"copy" : { "enable" : false },
"shell" : {
"enable" : false ,
"path" : " /bin/bash|C: \ windows \ system32 \ cmd.exe " ,
"args" : " "
},
"socks" : { "enable" : true }
}
}
}| 配置密钥 | 描述 |
|---|---|
| 争论 | 使用配置参数代替给定的CLI参数( -c除外) |
arguments密钥让用户可以在配置文件中自定义命令行参数。此功能是保存不同客户连接配置文件的便捷方法。
给定以下配置文件conf.json :
{
"ssf" : {
"arguments" : " 10.0.0.1 -p 443 -D 9000 -L 11000:localhost:12000 -v debug "
}
} SSF将提取给定参数,并将其用作最初参数的替代( -c除外)。
例如, ssf -c conf.json将等效于ssf 10.0.0.1 -p 443 -D 9000 -L 11000:localhost:12000 -v debug :
10.0.0.1:443 10.0.0.1 -p 443 )-D 9000 )-L 11000:localhost:12000 )-v debug ) | 配置密钥 | 描述 |
|---|---|
| 电路 | 继电器链服务器用于建立与远程服务器的连接 |
该电路是一个包含弹跳服务器和端口的JSON阵列,用于建立连接。它们列出如下:
{
"ssf" : {
"circuit" : [
{ "host" : " SERVER1 " , "port" : " PORT1 " },
{ "host" : " SERVER2 " , "port" : " PORT2 " },
{ "host" : " SERVER3 " , "port" : " PORT3 " }
]
}
}此配置将创建以下连接链:
CLIENT -> SERVER1:PORT1 -> SERVER2:PORT2 -> SERVER3:PORT3 -> TARGET
SSF通过以下方式支持连接:
CONNECT HTTP方法的HTTP代理| 配置密钥 | 描述 |
|---|---|
| http_proxy.host | HTTP代理主机 |
| http_proxy.port | HTTP代理端口 |
| http_proxy.user_agent | HTTP连接请求中的用户代理标头值 |
| http_proxy.credentials.username | 代理用户名凭据(全平台:基本或摘要,Windows:ntlm和协商,如果reuse = false) |
| http_proxy.credentials.password | 代理密码凭据(所有平台:基本或摘要,Windows:ntlm和协商,如果REUSE = false) |
| http_proxy.credentials.domain | 用户域(NTLM和仅在Windows上协商AUTH) |
| http_proxy.credentials.reuse_ntlm | 重复使用当前计算机用户凭据以使用代理NTLM Auth(SSO)进行身份验证 |
| http_proxy.credentials.reuse_kerb | 重复使用当前计算机用户凭据(Kerberos票)以使用代理协商Auth(SSO)进行身份验证 |
支持的身份验证方案:
| 配置密钥 | 描述 |
|---|---|
| socks_proxy.version | 袜子版本(4或5) |
| socks_proxy.host | 袜子代理主持人 |
| socks_proxy.port | 袜子代理端口 |
不支持身份验证方案。
| 配置密钥 | 描述 |
|---|---|
| tls.ca_cert_path | CA证书文件的相对或绝对filepath |
| tls.cert_path | 实例证书文件的相对或绝对filepath |
| tls.key_path | 相对或绝对的filepath与私钥文件 |
| tls.key_password | 关键密码 |
| tls.dh_path | diffie-hellman文件(仅服务器)的相对或绝对filepath |
| tls.cipher_alg | 密码算法 |
使用默认选项,以下文件和文件夹应在客户端或服务器的工作目录中:
./certs/dh4096.pem./certs/certificate.crt./certs/private.key./certs/trusted/ca.crt在哪里:
如果您希望在不同路径的这些文件,则可以通过TLS路径键自定义它们:
{
"ssf" : {
"tls" : {
"ca_cert_path" : " ./certs/trusted/ca.crt " ,
"cert_path" : " ./certs/certificate.crt " ,
"key_path" : " ./certs/private.key " ,
"key_password" : " " ,
"dh_path" : " ./certs/dh4096.pem " ,
"cipher_alg" : " DHE-RSA-AES256-GCM-SHA384 "
}
}
}| 配置密钥 | 描述 |
|---|---|
| tls.ca_cert_buffer | Ca证书文件以PEM格式(:警告: n数据与PEM标头/页脚之间) |
| tls.cert_buffer | 以PEM格式的实例证书文件内容(:警告: n数据和PEM标头/页脚之间) |
| tls.key_buffer | PEM格式的私有密钥文件内容(:警告: n数据与PEM标头/页脚之间) |
| tls.key_password | 关键密码 |
| tls.dh_buffer | DIFFIE-HELLMAN参数以PEM格式(:警告: n之间的数据与PEM标头/页脚,服务器,服务器) |
| tls.cipher_alg | 密码算法 |
您可以使用tls.ca_cert_buffer , tls.cert_buffer , tls.key_buffer和tls.dh_buffer键,将TLS参数直接集成到配置文件中。
{
"ssf" : {
"tls" : {
"ca_cert_buffer" : " -----BEGIN CERTIFICATE----- n ... n -----END CERTIFICATE----- " ,
"cert_buffer" : " -----BEGIN CERTIFICATE----- n ... n -----END CERTIFICATE----- " ,
"key_buffer" : " -----BEGIN RSA PRIVATE KEY----- n ... n -----END RSA PRIVATE KEY----- " ,
"key_password" : " " ,
"dh_buffer" : " -----BEGIN DH PARAMETERS----- n ... n -----END DH PARAMETERS----- " ,
"cipher_alg" : " DHE-RSA-AES256-GCM-SHA384 "
}
}
}证书,私钥和DH参数必须采用PEM格式。n在数据和PEM标头/页脚之间是强制性的。
| 配置密钥 | 描述 |
|---|---|
| 服务。*。启用 | 启用/禁用微服务 |
| 服务。*。Gateway_ports | 启用/禁用网关端口 |
| services.shell.path | 用于外壳创建的二进制路径 |
| services.shell.args | 用于创建外壳的二进制论点 |
SSF的功能是使用微服务(TCP转发,远程袜子,...)构建的
有7个微服务:
每个功能都是至少一个客户端微服务和一个服务器端微服务的组合。
此表总结了每个功能的组装方式:
| SSF功能 | 微服务客户端 | 微服务服务器端 |
|---|---|---|
-L :TCP转发 | stream_listener | stream_forwarder |
-R :远程TCP转发 | stream_forwarder | stream_listener |
-U :UDP转发 | datagram_listener | datagram_forwarder |
-V :远程UDP转发 | datagram_forwarder | datagram_listener |
-D :袜子 | stream_listener | 袜子 |
-F :远程袜子 | 袜子 | stream_listener |
-X :shell | stream_listener | 壳 |
-Y :远程外壳 | 壳 | stream_listener |
这种体系结构使构建远程功能变得更容易:他们使用相同的微服务,但在另一侧。
ssf和ssfd具有预先支持的微服务。这是默认的微服务配置:
{
"ssf" : {
"services" : {
"datagram_forwarder" : { "enable" : true },
"datagram_listener" : { "enable" : true },
"stream_forwarder" : { "enable" : true },
"stream_listener" : { "enable" : true },
"socks" : { "enable" : true },
"copy" : { "enable" : false },
"shell" : { "enable" : false }
}
}
}要启用或禁用微服务,请将enable键设置为true或false 。
尝试使用需要禁用微服务的功能将导致错误消息。
openssl dhparam 4096 -outform PEM -out dh4096.pem首先,创建一个名为Extfile.txt的文件,其中包含以下行:
[ v3_req_p ]
basicConstraints = CA:FALSE
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
然后,生成一个自签名的证书(CA) CA.CRT及其私有密钥CA.Key :
openssl req -x509 -nodes -newkey rsa:4096 -keyout ca.key -out ca.crt -days 3650生成一个私钥私有。关键和证书签名请求证书。CSR :
openssl req -newkey rsa:4096 -nodes -keyout private.key -out certificate.csr通过与CA( CA.CRT , CA.KEKE )签署CSR来生成证书(证书.pem ):
openssl x509 -extfile extfile.txt -extensions v3_req_p -req -sha1 -days 3650 -CA ca.crt -CAkey ca.key -CAcreateserial -in certificate.csr -out certificate.pem