系统:ubuntu22.04

编译安装caddy+naive:

apt install golang-go
go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
~/go/bin/xcaddy build --with github.com/caddyserver/forwardproxy@caddy2=github.com/klzgrad/forwardproxy@naive

如果第二条指令执行出错,可以尝试执行go env -w GO111MODULE=on再重试,还不行的话请自行搜索升级go版本方法

Caddyfile配置:

:443, naive.example.com #你的域名
tls [email protected] #你的邮箱
route {
 forward_proxy {
   basic_auth user pass #用户名和密码
   hide_ip
   hide_via
   probe_resistance
  }
 #支持多用户
 forward_proxy {
   basic_auth user2 pass2 #用户名和密码
   hide_ip
   hide_via
   probe_resistance
  }
 reverse_proxy  https://demo.cloudreve.org  { #伪装网址
   header_up  Host  {upstream_hostport}
   header_up  X-Forwarded-Host  {host}
  }
}

caddy常用指令:

前台运行caddy:./caddy run
后台运行caddy:./caddy start
停止caddy:./caddy stop
重载配置:./caddy reload
caddy配置守护进程(开机自启):https://github.com/klzgrad/naiveproxy/wiki/Run-Caddy-as-a-daemon

自定义端口:

naive如果要用自定义端口,需要使用json的配置方式,新手可以直接跳过
启动方式:./caddy start --config config.json

config.json内容:

//需删除注释内容caddy才能加载
{
 "apps": {
   "http": {
     "servers": {
       "srv0": {
         "listen": [
           ":4431"   //监听端口
         ],
         "routes": [
           {
             "handle": [
               {
                 "auth_user_deprecated": "user",   //用户名
                 "auth_pass_deprecated": "pass",  //密码
                 "handler": "forward_proxy",
                 "hide_ip": true,
                 "hide_via": true,
                 "probe_resistance": {}
               }
             ]
           },
           {
             "handle": [
               {
                 "handler": "reverse_proxy",
                 "headers": {
                   "request": {
                     "set": {
                       "Host": [
                         "{http.reverse_proxy.upstream.hostport}"
                       ],
                       "X-Forwarded-Host": [
                         "{http.request.host}"
                       ]
                     }
                   }
                 },
                 "transport": {
                   "protocol": "http",
                   "tls": {}
                 },
                 "upstreams": [
                   {
                     "dial": "demo.cloudreve.org:443"  //伪装网址
                   }
                 ]
               }
             ]
           }
         ],
         "tls_connection_policies": [
           {
             "match": {
               "sni": [
                 "naive.example.com"  //域名
               ]
             },
             "certificate_selection": {
               "any_tag": [
                 "cert0"
               ]
             }
           }
         ],
         "automatic_https": {
           "disable": true
         }
       }
     }
   },
   "tls": {
     "certificates": {
       "load_files": [
         {
           "certificate": "/root/a.crt",  //公钥路径
           "key": "/root/a.key",   //私钥路径
           "tags": [
             "cert0"
           ]
         }
       ]
     }
   }
 }
}

TLS指纹查看

jarm工具:https://github.com/salesforce/jarm
下载jarm:wget https://raw.githubusercontent.com/salesforce/jarm/master/jarm.py
查看网站jarm指纹:python3 jarm.py naive.example.com
网络空间资产搜索引擎:https://fofa.info