Box JWT config erroring Panic

What is the problem you are having with rclone?

Can't connect to Box via JWT json file, I have 2 different servers with the same setup using 2 different setups and both are producing the same error. Here is the information for one of my setups.

Run the command 'rclone version' and share the full output of the command.

rclone v1.64.0-beta.7211.40de89df7

  • os/version: gentoo 2.13 (64 bit)
  • os/kernel: 5.15.26-gentoo-whatbox (x86_64)
  • os/type: linux
  • os/arch: amd64
  • go/version: go1.21rc4
  • go/linking: static
  • go/tags: none

Which cloud storage system are you using? (eg Google Drive)

Box

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone config reconnect box:
[box]
type = box
client_id = client_id removed
client_secret = client_secret removed
token = xxx
root_folder_id = xxx
box_config_file = /mnt/mpathaf/xxx/.config/rclone/whatbox_config.json
box_sub_type = enterprise

[crypt_box]
type = crypt
remote = box:
password = xxx
password2 = xxx
filename_encoding = base32768

[chunker_box]
type = chunker
remote = crypt_box:
chunk_size = 4.5G
name_format = *.rcc###
hash_type = sha1all

A log from the command with the -vv flag

rclone -vv config reconnect box-jwt:
2023/08/08 15:30:49 DEBUG : rclone: Version "v1.64.0-beta.7211.40de89df7" starting with parameters ["rclone" "-vv" "config" "reconnect" "box-jwt:"]
2023/08/08 15:30:49 DEBUG : Using config file from "/home/sacwoo/.config/rclone/rclone.conf"
2023/08/08 15:30:49 DEBUG : box-jwt: config in: state="", result=""
2023/08/08 15:30:49 DEBUG : box-jwt: config out: out=<nil>, err=<nil>
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0xabfe9e]

goroutine 1 [running]:
github.com/rclone/rclone/backend/box.getDecryptedPrivateKey(0xc000de4780)
        github.com/rclone/rclone/backend/box/box.go:248 +0x7e
github.com/rclone/rclone/backend/box.refreshJWTToken({0x273b8e8, 0x393ee60}, {0xc000dca1f2?, 0x77b754?}, {0xc000064c6f, 0xa}, {0x7fff4a1f542a, 0x7}, {0x272b0c0, 0xc00091e4e0})
        github.com/rclone/rclone/backend/box/box.go:177 +0xc5
github.com/rclone/rclone/backend/box.init.0.func1({0x273b8e8, 0x393ee60}, {0x7fff4a1f542a, 0x7}, {0x272b0c0?, 0xc00091e4e0}, {{0x0, 0x0}, {0x0, 0x0}})
        github.com/rclone/rclone/backend/box/box.go:97 +0x145
github.com/rclone/rclone/fs.backendConfigStep({0x273b8e8, 0x393ee60}, {0x7fff4a1f542a, 0x7}, {0x272b0c0, 0xc00091e4e0}, 0xc000ae7b80, {0x271bac0, 0xc00091e600}, {{0x0, ...}, ...})
        github.com/rclone/rclone/fs/backend_config.go:489 +0x303
github.com/rclone/rclone/fs.BackendConfig({0x273b8e8, 0x393ee60}, {0x7fff4a1f542a, 0x7}, {0x272b0c0, 0xc00091e4e0}, 0xc000bbfbd0?, {0x271bac0, 0xc00091e600}, {{0x0, ...}, ...})
        github.com/rclone/rclone/fs/backend_config.go:340 +0xe7
github.com/rclone/rclone/fs/config.backendConfig({0x273b8e8, 0x393ee60}, {0x7fff4a1f542a, 0x7}, {0x272b0c0, 0xc00091e4e0}, 0x7fff4a1f542a?, {0x271bac0, 0xc00091e600}, {0x0, ...})
        github.com/rclone/rclone/fs/config/ui.go:397 +0x128
github.com/rclone/rclone/fs/config.PostConfig({0x273b8e8, 0x393ee60}, {0x7fff4a1f542a, 0x7}, {0x272b0c0, 0xc00091e4e0}, 0xc000ae7b80)
        github.com/rclone/rclone/fs/config/ui.go:450 +0xaf
github.com/rclone/rclone/cmd/config.glob..func14(0xc000296a00?, {0xc000955940?, 0x1, 0x212fc04?})
        github.com/rclone/rclone/cmd/config/config.go:452 +0x8a
github.com/spf13/cobra.(*Command).execute(0x38d7da0, {0xc000955920, 0x2, 0x2})
        github.com/spf13/cobra@v1.7.0/command.go:940 +0x87c
github.com/spf13/cobra.(*Command).ExecuteC(0x38d3000)
        github.com/spf13/cobra@v1.7.0/command.go:1068 +0x3a5
github.com/spf13/cobra.(*Command).Execute(...)
        github.com/spf13/cobra@v1.7.0/command.go:992
github.com/rclone/rclone/cmd.Main()
        github.com/rclone/rclone/cmd/cmd.go:570 +0x71
main.main()
        github.com/rclone/rclone/rclone.go:14 +0xf

Last night before I got the the latest error, this was the error I was getting. I went to bed and this morning, the latest error occurred.

2023/08/08 00:09:21 DEBUG : rclone: Version "v1.64.0-beta.7211.40de89df7" starting with parameters ["rcloneorig" "--config" "/boot/config/plugins/rclone/.rclone.conf" "-vv" "config" "reconnect" "box:"]

2023/08/08 00:09:21 DEBUG : Using config file from "/boot/config/plugins/rclone/.rclone.conf"

2023/08/08 00:09:21 DEBUG : box: config in: state="", result=""

2023/08/08 00:09:21 DEBUG : jwtutil: Response Body: {"error":"invalid_grant","error_description":"Please check the 'sub' claim. The 'sub' specified is invalid."}

2023/08/08 00:09:21 DEBUG : box: config out: out=<nil>, err=failed to configure token with jwt authentication: jwtutil: failed making auth request: 400 Bad Request

Error: failed to configure token with jwt authentication: jwtutil: failed making auth request: 400 Bad Request

I think there is an issue with Box and JWT in general e.g.:

1 Like

This looks like the PEM decode failed for the JWT. Rclone should have a check for that rather than blowing up - I'll add one

Try this

v1.64.0-beta.7211.02d643f78.fix-box-jwt-config-panic on branch fix-box-jwt-config-panic (uploaded in 15-30 mins)

I think the issue is that your JWT file is corrupted somehow.

I downloaded the latest beta, Generated a Public/Private Keypair, uploaded my Json and it's working.
I did have to add the service account ID to the shared users for the folder and it now is working. Thanks!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.