V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
ucyo
V2EX  ›  程序员

frp 的 ssl 应该怎样配置才安全呢

  •  
  •   ucyo · 229 天前 · 1736 次点击
    这是一个创建于 229 天前的主题,其中的信息可能已经有所发展或是发生改变。
    我这样设置的:
    frps 服务器端和 frpc 客户端都安装的 1panle 。

    frps 服务端设置:
    vhost_http_port = 1180
    vhost_https_port = 1443

    frps 服务端反代:
    location ^~ / {
    proxy_pass http://127.0.0.1:1180;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header REMOTE-HOST $remote_addr;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_http_version 1.1;
    add_header X-Cache $upstream_cache_status;
    }
    安装了 ssl ,可以正常用 https 访问。

    frpc 客户端这样设置的:
    [网站名称]
    type=http
    custom_domains = 域名
    local_ip=127.0.0.1
    local_port=80
    use_encryption=true
    use_compression=true

    frps 服务端和 frpc 端互相通信时并没有 ssl 。
    这样安全吗?
    应该怎样配置才最安全呢?
    12 条回复    2023-09-12 20:12:29 +08:00
    kkk9
        1
    kkk9  
       229 天前
    服务端和客户端之间通信是走 server 端口,你反代的是 vhost( http)
    kkk9
        2
    kkk9  
       229 天前
    [common] 部分的配置才是负责 C/S 通信的,具体可以看官方文档 - 身份认证

    https://gofrp.org/docs/features/common/authentication/

    其实设置好 token 就行了。
    ucyo
        3
    ucyo  
    OP
       229 天前
    @kkk9 token 是设置了的,frps 服务端和 frpc 客户端之间不用 ssl ,是吧
    mikaelson
        4
    mikaelson  
       229 天前
    我直接就 token+端口,完了。。。
    ysc3839
        5
    ysc3839  
       229 天前 via Android
    我个人选择用 WireGuard ,frp 那个协议很难说是否真的安全。
    kkk9
        6
    kkk9  
       229 天前
    @ucyo #3 请翻阅 frp 源码,ssl 也不见得安全啊
    gogogo2000
        7
    gogogo2000  
       229 天前
    想要让 frp 本身的控制协议走 ssl ,只需要设置 tls_enable 即可。

    https://gofrp.org/docs/features/common/network/network-tls/
    gogogo2000
        8
    gogogo2000  
       229 天前
    似乎应该是 tls_only ,文档中有些摇摆
    abonan
        9
    abonan  
       228 天前   ❤️ 1
    不用配 vhost 、http 之类的。首先自签一个 CA 证书,再用这个 CA 证书签发一个证书,该证书要配上 subjectAltName=IP:0.0.0.0 (服务端 IP )。

    服务端配置 common 块放上刚刚签的证书和私钥,客户端配置 common 块开启 tls_enable ,开启 CA 信任,信任刚开始的自签 CA 证书,这样就保证 tls 传输是安全的,只有该 CA 签发的证书是可信的,防止中间人攻击,当然可以双向开启 CA 验证,可以看文档。然后客户端直接 type=tcp 转发 http 端口就行了
    yaott2020
        10
    yaott2020  
       228 天前 via Android
    同楼上,搞个 TLS 双向认证,谁也看不到
    nmap
        11
    nmap  
       228 天前
    双向认证开启,其他随意
    lovelylain
        12
    lovelylain  
       228 天前 via Android
    自签名证书,双向认证
    tls_enable = true
    tls_cert_file = ../cert/client.crt
    tls_key_file = ../cert/client.key
    tls_trusted_ca_file = ../cert/ca.crt
    服务端同理且设置 tls_only = true
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5425 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 06:58 · PVG 14:58 · LAX 23:58 · JFK 02:58
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.