关于中转二次验证
server01.example.com 作为中转服务器,server02.example.com作为上游代理
上游代理服务器:
{
servers {
protocol {
experimental_http3 #开启 HTTP/3支持
}
}
}
:443, server02.example.com
tls /etc/ssl/private/cert.pem /etc/ssl/private/key.pem
route {
forward_proxy {
basic_auth user pass
hide_ip
hide_via
probe_resistance
}
}
中转服务器上,设置上游代理:
{
servers {
protocol {
experimental_http3 #开启 HTTP/3支持
}
}
}
:443, server01.example.com
tls /etc/ssl/private/cert.pem /etc/ssl/private/key.pem
route {
forward_proxy {
basic_auth user pass
hide_ip
hide_via
upstream https://user:[email protected]:443
}
}
客户端配置,中转服务器的地址:
./naive --proxy=https://user:[email protected]:443 …
意味着上游代理服务器和中转服务器都需要配置不同的域名和证书?还有 forward_proxy 中的 basic_auth、hide_ip、hide_via在中转机中也需要填写对吧?目前在本地navie代理填写了中转的地址 server01.example.com,连接后发现ip地址最终连接的为上游代理服务器的地址server02.example.com的解析ip。这意味着上游代理服务器和中转服务器都需要证书认证,我不太清楚会不会影响性能,可能我这种方式设置有些问题。肯请作者指正我的不足之处,万分感谢!
中转机和上游机之间未必用https
上游机用一个squid或者tinyproxy可能都可以
中转机和上游机之间未必用https
上游机用一个squid或者tinyproxy可能都可以
{
servers {
protocol {
experimental_http3 #开启 HTTP/3支持
}
}
}
:443, server02.example.com
tls /etc/ssl/private/cert.pem /etc/ssl/private/key.pem
route {
forward_proxy {
basic_auth user pass
hide_ip
hide_via
upstream http://ip:port # 上游机的ip和端口
}
}
但重启服务发现:
● caddy.service - Caddy
Loaded: loaded (/etc/systemd/system/caddy.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2021-09-28 04:38:25 EDT; 55s ago
Docs: https://caddyserver.com/docs/
Process: 11160 ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile (code=exited, status=1/FAILURE)
Main PID: 11160 (code=exited, status=1/FAILURE)
Sep 28 04:38:25 test.example.cc caddy[11160]: {"level":"info","ts":1632818305.5647526,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""}
Sep 28 04:38:25 test.example.cc caddy[11160]: {"level":"warn","ts":1632818305.5766335,"msg":"input is not formatted with 'caddy fmt'","adapter":"caddyfile","file":"/etc/caddy/Caddyfile","line":2}
Sep 28 04:38:25 test.example.cc caddy[11160]: {"level":"info","ts":1632818305.584068,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["localhost:2019","[::1]:2019","127.0.0.1:2019"]}
Sep 28 04:38:25 test.example.cc caddy[11160]: {"level":"info","ts":1632818305.5883346,"logger":"http","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}
Sep 28 04:38:25 test.example.cc caddy[11160]: {"level":"info","ts":1632818305.5915473,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc0000dd960"}
Sep 28 04:38:25 test.example.cc caddy[11160]: {"level":"info","ts":1632818305.5916126,"logger":"tls.cache.maintenance","msg":"stopped background certificate maintenance","cache":"0xc0000dd960"}
Sep 28 04:38:25 test.example.cc caddy[11160]: run: loading initial config: loading new config: loading http app module: provision http: server srv0: setting up route handlers: route 0: loading handler modules: position 0: loading module 'subroute': provision http.handlers.subroute: setting up subroutes: route 0: loading handler modules: position 0: loading module 'forward_proxy': provision http.handlers.forward_proxy: insecure schemes are only allowed to localhost upstreams
Sep 28 04:38:25 test.example.cc systemd[1]: caddy.service: Main process exited, code=exited, status=1/FAILURE
Sep 28 04:38:25 test.example.cc systemd[1]: caddy.service: Unit entered failed state.
Sep 28 04:38:25 test.example.cc systemd[1]: caddy.service: Failed with result 'exit-code'.
似乎不允许将上游服务器是一个hhtp协议的,还是?该如何解决?
中转机和上游机之间未必用https
上游机用一个squid或者tinyproxy可能都可以
我看了forward_proxy,似乎仅允许在本地主机可以以http设置,而远程主机则不支持http,仅支持https?

forwardproxy的说明里写着upstream代理为https时忽略证书检验,那这样中转会不会有中间人攻击风险?会和其他tls类代理开启“允许不安全”选项一样吗?
关键是如果上游服务是本地的话,HTTPS可以忽略掉证书,否则需强行添加上证书。所以目前要想实现中转上游代理服务器和中转服务器,各自必须都需要一个单独的域名和证书,这势必流量加密多次,效率低下。
关键是如果上游服务是本地的话,HTTPS可以忽略掉证书,否则需强行添加上证书。所以目前要想实现中转上游代理服务器和中转服务器,各自必须都需要一个单独的域名和证书,这势必流量加密多次,效率低下。
本地当然可以忽略,如果不考虑效率,远程https忽略检验会不会有安全隐患?
把这行代码删了
或者弄个iptables转发一下