ROSBridge - Unknown Operation: Auth?
Hi Everyone,
I have ROSBridge Server and a client I wrote communicating just fine. Now I want to enable authentication.
I set "authenticate" to true in the ROSBridge launch file. I also started rosauth and set the "secret_file_location" param to point to a text file containing a 16 character key (which I use to encrypt my MAC using SHA-256).
When I launch the ROSBridge server, it disconnects any clients which communicate with it unless they have have "auth" in their "op" field. So if I try to "subscribe" or "publish", it will just disconnect the client. Now, the peculiar thing is that ROSBridge will then print to screen: "Unknown operation: auth. Allowed operations: ['call_service', 'publish', 'subscribe', 'unsubscribe', 'unadvertise', 'advertise']"
So it definitely understands that "auth" is an operation... because it does not immediately disconnect my client. However it tells me that "auth" is unknown. What's the deal?
EDIT: Here is my launch file:
<launch>
<arg name="port" default="9090" />
<arg name="ssl" default="false" />
<arg name="certfile" />
<arg name="keyfile" />
<arg name="authenticate" default="true" />
<param name="/rosbridge/port" value="$(arg port)"/>
<group ns="ros_mac_authentication">
<param name="secret_file_location" value="/home/developer/SecretFile.secret" />
<node pkg="rosauth" type="ros_mac_authentication" name="ros_mac_authentication" />
</group>
<group if="$(arg ssl)">
<node name="rosbridge_websocket" pkg="rosbridge_server" type="rosbridge_websocket" output="screen">
<param name="certfile" value="$(arg certfile)" />
<param name="keyfile" value="$(arg keyfile)" />
<param name="authenticate" value="$(arg authenticate)" />
</node>
</group>
<group unless="$(arg ssl)">
<node name="rosbridge_websocket" pkg="rosbridge_server" type="rosbridge_websocket" output="screen">
<param name="authenticate" value="$(arg authenticate)" />
</node>
</group>
<node name="rosapi" pkg="rosapi" type="rosapi" />
</launch>
Are you using the most recent version of rosbridge from source or debians? What parameters have you set in the launch file?
I am using the version of rosbridge that I got from "apt-get install ros-hydro-rosbridge-suite". The package.xml file I have says version 0.5.1. As for the launch file, I'll update my post to include its contents.
Is the message about awaiting authentication printing when the socket connects? I.e., https://github.com/RobotWebTools/rosbridge_suite/blob/hydro-devel/rosbridge_server/scripts/rosbridge_websocket#L69-L70
Yes it is. I downloaded the source and I've been poking around as well. It appears that L81 "resp = auth_srv(...)" throws an exception, but I still cannot figure out why.
That was going to be my next suggestion. Make sure the message has all the correct fields or it might throw an excepting trying to access something that doesn't exist. https://github.com/RobotWebTools/rosbridge_suite/blob/hydro-devel/rosbridge_server/scripts/rosbridge_websocket#L81-L83
I'm currently printing all of the fields to console. An exception was thrown upon printing the time field, yet I'm not sure why. Still investigating...
What is your client sending in the time fields? It should be a number (make sure it's not being sent as a string or anything), in seconds.
My client (for test purposes) is sending t : 1 and end : 2. ROS is printing that the received 't' is 1000000000 and the received 'end' is 2000000000. So the server appears to be appending nine 0's to the end of whatever I send. I suppose that's what rospy.Time() is doing, but why?