Closed iumairhasan closed 1 year ago
@iumairhasan Well first if you say that you have removed all authentication and the telnet still show auth_required: true
, then you may not be connecting to the server you changed the configuration of, or your configuration is not doing what you think it is. Posting the configuration (you can obfuscate/remove the content of the auth token) will help us help you better.
That being said, not sure what you mean by wanting to test telnet? It clearly works since you get the INFO protocol, so it means that a server is listening on that port. If you use a "auth" token, then your CONNECT, after connecting with telnet, should have the auth_token
field set to the token value.
Also, the way you are sending the CONNECT to the telnet seem wrong. For instance, here is a streaming server running with the -auth
field set to my_token
:
% nats-streaming-server -auth my_token
[18598] 2023/03/14 17:15:53.789192 [INF] STREAM: Starting nats-streaming-server[test-cluster] version 0.25.3
[18598] 2023/03/14 17:15:53.789309 [INF] STREAM: ServerID: E1ulu5DyUwdv5EhtnPvhHC
[18598] 2023/03/14 17:15:53.789313 [INF] STREAM: Go version: go1.19.4
[18598] 2023/03/14 17:15:53.789316 [INF] STREAM: Git commit: [not set]
[18598] 2023/03/14 17:15:53.792869 [INF] Starting nats-server
[18598] 2023/03/14 17:15:53.792875 [INF] Version: 2.9.11
[18598] 2023/03/14 17:15:53.792878 [INF] Git: [not set]
[18598] 2023/03/14 17:15:53.792880 [INF] Name: NB2MR7SLVEF2PSCFWTJOKGUWOMT7XJI73NLIDCG5NWFSQ6VSJJ4KYDLA
[18598] 2023/03/14 17:15:53.792883 [INF] ID: NB2MR7SLVEF2PSCFWTJOKGUWOMT7XJI73NLIDCG5NWFSQ6VSJJ4KYDLA
[18598] 2023/03/14 17:15:53.793436 [INF] Listening for client connections on 0.0.0.0:4222
[18598] 2023/03/14 17:15:53.793705 [INF] Server is ready
[18598] 2023/03/14 17:15:53.822087 [INF] STREAM: Recovering the state...
[18598] 2023/03/14 17:15:53.822107 [INF] STREAM: No recovered state
[18598] 2023/03/14 17:15:53.822609 [INF] STREAM: Message store is MEMORY
[18598] 2023/03/14 17:15:53.822646 [INF] STREAM: ---------- Store Limits ----------
[18598] 2023/03/14 17:15:53.822650 [INF] STREAM: Channels: 100 *
[18598] 2023/03/14 17:15:53.822653 [INF] STREAM: --------- Channels Limits --------
[18598] 2023/03/14 17:15:53.822656 [INF] STREAM: Subscriptions: 1000 *
[18598] 2023/03/14 17:15:53.822659 [INF] STREAM: Messages : 1000000 *
[18598] 2023/03/14 17:15:53.822661 [INF] STREAM: Bytes : 976.56 MB *
[18598] 2023/03/14 17:15:53.822664 [INF] STREAM: Age : unlimited *
[18598] 2023/03/14 17:15:53.822666 [INF] STREAM: Inactivity : unlimited *
[18598] 2023/03/14 17:15:53.822669 [INF] STREAM: ----------------------------------
[18598] 2023/03/14 17:15:53.822672 [INF] STREAM: Streaming Server is ready
Now, here is the telnet command with the proper CONNECT protocol and the result:
{ echo 'CONNECT {"auth_token":"my_token"}'; sleep 1 } | telnet localhost 4222
Trying ::1...
Connected to localhost.
Escape character is '^]'.
INFO {"server_id":"NB2MR7SLVEF2PSCFWTJOKGUWOMT7XJI73NLIDCG5NWFSQ6VSJJ4KYDLA","server_name":"NB2MR7SLVEF2PSCFWTJOKGUWOMT7XJI73NLIDCG5NWFSQ6VSJJ4KYDLA","version":"2.9.11","proto":1,"go":"go1.19.4","host":"0.0.0.0","port":4222,"headers":true,"auth_required":true,"max_payload":1048576,"client_id":9,"client_ip":"::1"}
+OK
Connection closed by foreign host.
The connection is closed after a second. If you want to use the telnet session, then you would need to have the proper CONNECT line in the copy/paste buffer and once connected with telnet paste the CONNECT command before the authorization timeout.
Thank you for the detailed response, Yes, I was able to telnet nats server using the right CONNECT protocol as per your suggestion.
you have removed all authentication
I think I had to remove authorization block all together to make sure "auth_required"
is not true, It is resolved now.
It clearly works since you get the INFO protocol
yes, I wanted to complete the connection, and I was curious as to how I can test with CONNECT protocol, which is again resolved now.
I'm facing the same issue as mentioned in Issue - 866, my
conf
file is using authorization token, but I tried to remove all authentication to test telnet, but this doesn't seem to work for me.My telnet response
I also tried to use
CONNECT echo "CONNECT {\"user\":\"\",\"pass\":\"\",\"auth_token\":\"\"}\r" | telnet localhost 7422
to see if this would help, but this doesn't seem to give response.I want to know
"auth_required":false
, I could not find any documentation that would help me disable this.Thanks