Skip to content

Commit 65868a5

Browse files
authored
add how to use ros2cli with security enclaves. (#4900)
Signed-off-by: Tomoya Fujita <[email protected]>
1 parent 3d4b2ef commit 65868a5

File tree

1 file changed

+59
-1
lines changed

1 file changed

+59
-1
lines changed

source/Tutorials/Advanced/Security/Introducing-ros2-security.rst

+59-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,65 @@ Note: You can switch between the C++ (demo_nodes_cpp) and Python (demo_nodes_py)
241241

242242
These nodes are able to communicate because we have created the appropriate keys and certificates for them.
243243

244-
Leave both nodes running as you answer the questions below.
244+
Leave both nodes running as you use ``ros2cli`` and answer the questions below.
245+
246+
247+
6\. Use ``ros2cli`` with security
248+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
249+
250+
To use ``ros2cli`` to iterate with ROS 2 secured network, you need to provide it with override enclave by ``ROS_SECURITY_ENCLAVE_OVERRIDE`` environmental variable.
251+
Open an another terminal and set up the following environmental variables.
252+
253+
.. tabs::
254+
255+
.. group-tab:: Linux
256+
257+
.. code-block:: bash
258+
259+
export ROS_SECURITY_KEYSTORE=~/sros2_demo/demo_keystore
260+
export ROS_SECURITY_ENABLE=true
261+
export ROS_SECURITY_STRATEGY=Enforce
262+
export ROS_SECURITY_ENCLAVE_OVERRIDE=/talker_listener/listener
263+
264+
.. group-tab:: MacOS
265+
266+
.. code-block:: bash
267+
268+
export ROS_SECURITY_KEYSTORE=~/sros2_demo/demo_keystore
269+
export ROS_SECURITY_ENABLE=true
270+
export ROS_SECURITY_STRATEGY=Enforce
271+
export ROS_SECURITY_ENCLAVE_OVERRIDE=/talker_listener/listener
272+
273+
.. group-tab:: Windows
274+
275+
.. code-block:: bat
276+
277+
set ROS_SECURITY_KEYSTORE=%cd%/demo_keystore
278+
set ROS_SECURITY_ENABLE=true
279+
set ROS_SECURITY_STRATEGY=Enforce
280+
set ROS_SECURITY_ENCLAVE_OVERRIDE=/talker_listener/listener
281+
282+
283+
Now you can use ``ros2cli`` to communicate with ROS 2 secured network.
284+
285+
.. code-block:: bash
286+
287+
ros2 node list --no-daemon --spin-time 3
288+
[INFO] [1733862009.410918416] [rcl]: Found security directory: /root/ros2_ws/colcon_ws/demo_keystore/enclaves/talker_listener/talker
289+
/listener
290+
/talker
291+
292+
.. code-block:: bash
293+
294+
ros2 topic list --no-daemon --spin-time 3
295+
[INFO] [1733861998.562163611] [rcl]: Found security directory: /root/ros2_ws/colcon_ws/demo_keystore/enclaves/talker_listener/talker
296+
/chatter
297+
/parameter_events
298+
/rosout
299+
300+
.. note::
301+
302+
Avoid using ros2 daemon because it may not have security enclaves, and enough time duration should be given for the discovery in ROS 2 secured network.
245303

246304

247305
Take the Quiz!

0 commit comments

Comments
 (0)