[GH-ISSUE #85] 使用特权模式,开启use_encryption,frps产生错误退出 #38

Closed
opened 2026-05-05 11:35:30 -06:00 by gitea-mirror · 3 comments
Owner

Originally created by @Hirozy on GitHub (Aug 21, 2016).
Original GitHub issue: https://github.com/fatedier/frp/issues/85

服务器端开启特权模式

# frps.ini
[common]
bind_addr = 0.0.0.0
bind_port = 7500
vhost_http_port = 801
vhost_https_port = 443
dashboard_port = 7000
log_file = ./frps.log
log_level = info
log_max_days = 3
privilege_token is correct
privilege_mode = true
privilege_token = oxcm!Jkn/jQ(S?of
privilege_allow_ports = 2000-3000,3001,3003,4000-50000
max_pool_count = 100

客户端

# frpc.ini
[privilege_web1]
privilege_mode = true
type = http
local_ip = 127.0.0.1
local_port = 30000
use_gzip = true
use_encryption = true
custom_domains = xx.xxxx.xx

之后打开xx.xxxx.xx:801,frps就会自动退出,并且报错,错误内容如下

➜  frp ./frps -c frps.ini
panic: cipher.NewCBCEncrypter: IV length must equal block size

goroutine 25 [running]:
panic(0x794c80, 0xc82016b6a0)
        /usr/lib/golang/src/runtime/panic.go:481 +0x3e6
crypto/cipher.NewCBCEncrypter(0x7f9ca8a6dcf0, 0xc8201757d0, 0xc820308760, 0x20, 0x20, 0x0, 0x0)
        /usr/lib/golang/src/crypto/cipher/cbc.go:37 +0xa8
github.com/fatedier/frp/src/utils/pcrypto.(*Pcrypto).Encrypt(0xc820341eb8, 0xc820114380, 0x170, 0x1c0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /home/wcl/go_projects/src/github.com/fatedier/frp/src/utils/pcrypto/pcrypto.go:44 +0xd5
github.com/fatedier/frp/src/models/msg.pipeEncrypt(0xc82032e080, 0xc82032e240, 0xc82016b370, 0xe, 0x0, 0x0, 0xc82016b35c, 0x4, 0x10101, 0xc820174162, ...)
        /home/wcl/go_projects/src/github.com/fatedier/frp/src/models/msg/process.go:242 +0x92c
github.com/fatedier/frp/src/models/msg.JoinMore.func1(0xc82032e080, 0xc82032e240)
        /home/wcl/go_projects/src/github.com/fatedier/frp/src/models/msg/process.go:64 +0x104
created by github.com/fatedier/frp/src/models/msg.JoinMore
        /home/wcl/go_projects/src/github.com/fatedier/frp/src/models/msg/process.go:80 +0x1ca
Originally created by @Hirozy on GitHub (Aug 21, 2016). Original GitHub issue: https://github.com/fatedier/frp/issues/85 服务器端开启特权模式 ``` # frps.ini [common] bind_addr = 0.0.0.0 bind_port = 7500 vhost_http_port = 801 vhost_https_port = 443 dashboard_port = 7000 log_file = ./frps.log log_level = info log_max_days = 3 privilege_token is correct privilege_mode = true privilege_token = oxcm!Jkn/jQ(S?of privilege_allow_ports = 2000-3000,3001,3003,4000-50000 max_pool_count = 100 ``` 客户端 ``` # frpc.ini [privilege_web1] privilege_mode = true type = http local_ip = 127.0.0.1 local_port = 30000 use_gzip = true use_encryption = true custom_domains = xx.xxxx.xx ``` 之后打开[xx.xxxx.xx:801](url),frps就会自动退出,并且报错,错误内容如下 ``` ➜ frp ./frps -c frps.ini panic: cipher.NewCBCEncrypter: IV length must equal block size goroutine 25 [running]: panic(0x794c80, 0xc82016b6a0) /usr/lib/golang/src/runtime/panic.go:481 +0x3e6 crypto/cipher.NewCBCEncrypter(0x7f9ca8a6dcf0, 0xc8201757d0, 0xc820308760, 0x20, 0x20, 0x0, 0x0) /usr/lib/golang/src/crypto/cipher/cbc.go:37 +0xa8 github.com/fatedier/frp/src/utils/pcrypto.(*Pcrypto).Encrypt(0xc820341eb8, 0xc820114380, 0x170, 0x1c0, 0x0, 0x0, 0x0, 0x0, 0x0) /home/wcl/go_projects/src/github.com/fatedier/frp/src/utils/pcrypto/pcrypto.go:44 +0xd5 github.com/fatedier/frp/src/models/msg.pipeEncrypt(0xc82032e080, 0xc82032e240, 0xc82016b370, 0xe, 0x0, 0x0, 0xc82016b35c, 0x4, 0x10101, 0xc820174162, ...) /home/wcl/go_projects/src/github.com/fatedier/frp/src/models/msg/process.go:242 +0x92c github.com/fatedier/frp/src/models/msg.JoinMore.func1(0xc82032e080, 0xc82032e240) /home/wcl/go_projects/src/github.com/fatedier/frp/src/models/msg/process.go:64 +0x104 created by github.com/fatedier/frp/src/models/msg.JoinMore /home/wcl/go_projects/src/github.com/fatedier/frp/src/models/msg/process.go:80 +0x1ca ```
gitea-mirror 2026-05-05 11:35:30 -06:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@JimLee1996 commented on GitHub (Aug 21, 2016):

没有填特权密码,或者端口选用不当吧

<!-- gh-comment-id:241245030 --> @JimLee1996 commented on GitHub (Aug 21, 2016): 没有填特权密码,或者端口选用不当吧
Author
Owner

@Hirozy commented on GitHub (Aug 21, 2016):

已经设置特权密码,端口选取没有问题
PS:use_encryption = false时正常

<!-- gh-comment-id:241245946 --> @Hirozy commented on GitHub (Aug 21, 2016): 已经设置特权密码,端口选取没有问题 PS:use_encryption = false时正常
Author
Owner

@fatedier commented on GitHub (Aug 21, 2016):

已经确认这是一个 bug,你可以暂时将 privilege_token 改为一个小于 16 字节的字符串,后续会修复这个问题。

<!-- gh-comment-id:241255229 --> @fatedier commented on GitHub (Aug 21, 2016): 已经确认这是一个 bug,你可以暂时将 `privilege_token` 改为一个小于 16 字节的字符串,后续会修复这个问题。
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/frp#38
No description provided.