examples/simpleclient: gives 513 Unrecognized command argument: Invalid key type
I am using the example given in the repo, and when I run it I get this error:
I don't devote enough time to this project to be able to debug this at this time. However, if you are able to debug the Tor control protocol and see what it may not like and/or if we're not prepared for some newer/older Tor version, we'd welcome any fixes.
Hey @cretz, thanks for the quick response; we appreciate it. (I'm working with @Delta456 on this.)
..., if you are able to debug the Tor control protocol ...
Does the 513 suggest to you that it's the Tor control protocol that is giving us this error?
Any related quick little pointers you have would helpful, thanks.
... and/or if we're not prepared for some newer/older Tor version ...
We may try building against a newer version of the Tor daemon :+1: .
I now see in https://github.com/torproject/torspec/blob/main/control-spec.txt --
"513 syntax error in configuration values" reply on syntax error
Looks like a control protocol issue indeed, yay; progress.
Any related quick little pointers you have would helpful, thanks.
Set tor.StartConf.DebugWriter which will then log all interaction back and forth with the control port on that writer (e.g. os.Stdout). Granted that's assuming the error doesn't happen before that writer is set.
@cretz Awesome, thank you! We'll try that.
Here is what I get
Connecting to control port 33685
Write line: PROTOCOLINFO
Read line: 250-PROTOCOLINFO 1
Read line: 250-AUTH METHODS=COOKIE,SAFECOOKIE COOKIEFILE="/home/delta/Documents/programs/data-dir-2197588529/control_auth_cookie"
Read line: 250-VERSION Tor="0.4.7.14"
Read line: 250 OK
Write line: AUTHCHALLENGE SAFECOOKIE
Read line: 250 AUTHCHALLENGE SERVERHASH=
SERVERNONCE=
Write line: AUTHENTICATE
Read line: 250 OK
Write line: ADD_ONION NEW:RSA1024 Port=80,127.0.0.1:8080
Read line: 513 Invalid key type
Closing onion .onion:80
Closing Tor
Write line: SIGNAL HALT
Read line: 250 OK
Write line: QUIT
2023/08/23 11:44:37 513 Unrecognized command argument: Invalid key type
exit status 1
I think when you create a v3 onion key, you have to use to use ED25519-V3 but here it is trying to set RSA1024. What does your ListenConf look like? I think you can just leave Key as nil and set Version3 to true.
For me the issue seemed to be occuring while creating the onion service. Changing
onion, err := t.Listen(listenCtx, &tor.ListenConf{RemotePorts: []int{80}})
to
onion, err := t.Listen(listenCtx, &tor.ListenConf{RemotePorts: []int{80}, Version3: true})
seemed to resolve the issue.