安全套接字漏斗(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