Closed fujitatomoya closed 6 months ago
So this is all about the ros2 daemon
.
root@tomoyafujita:~/ros2_ws/colcon_ws# env | grep ROS
ROS_VERSION=2
ROS_SECURITY_ENCLAVE_OVERRIDE=/talker_listener/listener
ROS_PYTHON_VERSION=3
ROS_SECURITY_KEYSTORE=/root/sros2_demo/demo_keystore
ROS_AUTOMATIC_DISCOVERY_RANGE=SUBNET
ROS_SECURITY_STRATEGY=Enforce
ROS_DISTRO=rolling
ROS_SECURITY_ENABLE=true
root@tomoyafujita:~/ros2_ws/colcon_ws# ros2 daemon stop
The daemon is not running
root@tomoyafujita:~/ros2_ws/colcon_ws# ros2 daemon start
The daemon has been started
root@tomoyafujita:~/ros2_ws/colcon_ws# ros2 node list
/listener
/talker
root@tomoyafujita:~/ros2_ws/colcon_ws# ros2 topic list
/chatter
/parameter_events
/rosout
as you can see above, if ros2 daemon is already running, it does not have security enclaves, so that it cannot discover those secured apps in the network. restarting daemon can solve this problem. (this actually brings me a question, daemon
should inherit the security enclaves silently? so that everyone can see the ROS 2 node and endpoint graph via xmlrpc. i think this is not supposed to be seen by unsecured or unauthorized users who do not have security enclaves?)
the other thing is, we should probably introduce the --no-daemon
option in sros2 doc to avoid the above problem in 1st place.
root@tomoyafujita:~/ros2_ws/colcon_ws# ros2 node list --no-daemon --spin-time 5
[INFO] [1715191452.038336038] [rcl]: Found security directory: /root/sros2_demo/demo_keystore/enclaves/talker_listener/listener
/listener
/talker
root@tomoyafujita:~/ros2_ws/colcon_ws# ros2 topic list --no-daemon --spin-time 5
[INFO] [1715191462.846370212] [rcl]: Found security directory: /root/sros2_demo/demo_keystore/enclaves/talker_listener/listener
/chatter
/parameter_events
/rosout
--spin-time
should be also explained to get the result with --no-daemon
option.
if --spin-time
is not specified, NodeStrategy
uses 0.5 sec default for the discovery without daemon, sometimes it does not give it enough time when the security is enabled. (authorization, handshake and so on take time longer than 0.5sec, eventually NodeStrategy ends up having no graph information.)
CC: @mikaelarguedas just FYI.
Thanks @fujitatomoya for testing more thoroughly and reporting!
There seem to be 3 different things:
The overriding of enclaves seems to work as the ros2 tools (or other nodes with enclave overriden) always seem to look for the security files at the place dictated by the environment variable
The leaking of information is another topic that comes down to multiple things:
The daemon behavior:
@mikaelarguedas thanks for the information.
something i am concerned here is, daemon could be spawned with security enclaves and expose the discovery information for everyone. and it does that silently
(authorized developer could easily expose secured information without knowing it once they use ros2cli commands) ... that is the major concern for 3rd party developer and end users for me. probably ros2 daemon
should not inherit the security enclaves by default?
i guess this topic needs to be discussed on https://github.com/ros2/ros2cli though.
daemon could be spawned with security enclaves and expose the discovery information for everyone. and it does that silently (authorized developer could easily expose secured information without knowing it once they use ros2cli commands)
I guess we'd need to dig a bit deeper with people knowing more about the daemon (either over at ros2cli or here) to figure out what is actually inherited from the parent process and figure out a way to mitigate it
CC: @mikaelarguedas
i want to keep the one issue for the fix, so i will go ahead to close this one. and create another issue to keep the discussion on ros2 daemon could expose secured network
.
Bug report
Required Info:
Steps to reproduce issue
https://github.com/ros2/sros2/blob/rolling/SROS2_Linux.md#run-the-demo-1 introduces
ROS_SECURITY_ENCLAVE_OVERRIDE
to be used withros2cli
such asros2 node list
andros2 topic list
. But sometimes it does not print the available nodes or topics as explained.talker
andlistener
, make sure they are working as expected.ros2cli
as followings.--no-daemon
, it sometimes does not work.Expected behavior
node list and topic list should print available nodes (talker and listener) and topic (/chatter).
Actual behavior
described above.
Additional information
originally found on https://github.com/ros2/sros2/pull/295