Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve documentation for ROS 2 security #1662

Merged
merged 3 commits into from
Aug 27, 2021

Conversation

SidFaber
Copy link
Contributor

@SidFaber SidFaber commented Jun 7, 2021

Apologies for the length of this PR but I felt the first cut at a section of security tutorials should all go at once. This adds content currently in the sros2 github repository, adds a "concepts" page and some adds additional content as tutorials:

  • Update "Concepts" with a paragraph on ROS 2 Security
  • Add a new "About ROS 2 Security" page under "Concepts" to give a security overview, introduce security enclaves, summarize the six security files, and mention important security environment variables
  • Add a new "Tutorials" section titled "Security" and remove the current link to the sros2 repo under the "Demos" section
  • Migrate existing content in the sros2 github repo as new security tutorials "Introducing ROS 2 Security", "Security Across Two Machines" and "Security Access Controls"
  • Add "Understanding the ROS 2 Security Keystore" tutorial to explain details about the security files
  • Add "Examine Network Traffic" security tutorial to demonstrate inspection of raw network traffic
  • Update "Security Access Controls" content to show manual editing of a policy file to restrict enclave permissions
  • Update "Security Across Two Machines" content to use security standard alice and bob names for clarity rather than feather2 and oldschool
  • Combine Linux, MacOS and Windows content as tabs in one tutorial rather than as separate documents
  • Reference other tutorials where possible rather than including content in these docs (e.g., ROS installation, changing middleware, etc.)
  • Add quiz questions to "Introducing" and "Keystore" tutorials to improve learning

Include content currently in the sros2 github repository, a "concepts"
page and add additional content as tutorials:

 - Update "Concepts" with a paragraph on ROS 2 Security
 - Add a new "About ROS 2 Security" page under "Concepts" to give a
security overview, introduce security enclaves, summarize the size
security files, and mention important security environment variables
 - Add a new "Tutorials" section titled "Security" and remove the
current link to content in the sros2 github repository
 - Migrate existing content in the sros2 github repository the security
tutorials "Introducing ROS 2 Security", "Security Across Two Machines"
and "Security Access Controls"; combine Linux, MacOS and Windows content
as tabs
 - Reference other tutorials where possible rather than including
content here (e.g., ROS installation, changing middleware, etc.)
 - Add "Understanding the ROS 2 Security Keystore" tutorial discussing
details about the security files
 - Add "Examine Network Traffic" security tutorial to demonstrate
inspection of raw network traffic
 - Update "Security Access Controls" content to show manual editing of a
policy file to restrict enclave permissions
 - Update "Security Across Two Machines" content to use security
standard Alice and Bob names for clarity, rather than feather2 and
oldschool
 - Add questions to "Introducing" and "Keystore" tutorials

Signed-off-by: Sid Faber <[email protected]>
@SidFaber
Copy link
Contributor Author

@ros-security-wg @ruffsl @mikaelarguedas any chance I can get some eyes on this? Thank you!!

@ros-discourse
Copy link

This pull request has been mentioned on ROS Discourse. There might be relevant details there:

https://discourse.ros.org/t/ros-2-tsc-meeting-minutes-2021-06-17/21017/1

Copy link
Member

@vmayoral vmayoral left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I liked it quite a bit @SidFaber! Well done.

I left a few suggestions and comments below.

Security
^^^^^^^^

ROS 2 includes the ability to secure communications among nodes within the ROS 2 graph.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ROS 2 includes the ability to secure communications among nodes within the ROS 2 graph.
ROS 2 includes the ability to secure communications among nodes within the ROS 2 computational graph.

Though in the remainder of the content we can just omit it, let's make a clear distinction first between the ROS 2 computational graph and the ROS 2 data layer graph.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated with e80f5e1

^^^^^^^^

ROS 2 includes the ability to secure communications among nodes within the ROS 2 graph.
Similar to discovery, security happens through the underlying ROS 2 middleware.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Similar to discovery, security happens through the underlying ROS 2 middleware.
Similar to discovery, security happens through the underlying ROS 2 middleware (provided it has support for the corresponding security plugins).

Newcomers won't know that there're different middleware implementations, with different levels of support for the plugins. We should specify.

Also, my feeling in here is that we should probably say a bit more about other middlewares (and not just assume DDS will be the only option, since there're already use cases were this changes depending on the application/domain).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated with e80f5e1

The identity and permissions certificates also have associate private key files.
Add new enclaves to the domain by signing their Certificate Signing Request (CSR) with the identity certificate's private key.
Similarly, grant permissions for a new enclave by signing a permissions XML document with the permission certificate's private key.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An example in here would be awesome.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to leave this really lightweight, and leave all the examples in the tutorials. If you feel this should link to something else in this PR, leave me a suggestion and I'll add it in.


Take the Quiz!
--------------

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pretty cool 😄 !

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clever! I like this, too.

Copy link
Member

@mikaelarguedas mikaelarguedas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks Sid, this is great!

Is there a sister PR to retire the doc from the sros2 repo and refer to this set of tutorials instead ?

Dropped a couple inline remarks

The ``sros2`` package provides the tools and instructions to use ROS2 on top of DDS-Security.
The security features have been tested across platforms (Linux, macOS, and Windows) as well as across different languages (C++ and Python).

Although we are designing SROS2 to work with any secure middleware, at the moment we are testing with RTI Connext Secure 5.3.1 and eProsima's Fast-RTPS 1.6.0.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may need to update this. DDS implementation versions vary depending on the ROS 2 distro used, and I believe CycloneDDS is now tested at the same level as other implementations

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed this wording to be somewhat more generic & distribution independent with e80f5e1.


If you don't have OpenSSL installed, please follow :ref:`these instructions <windows-install-binary-installing-prerequisites>`

Fast-RTPS requires an additional CMake flag to build the security plugins, so the colcon invocation needs to be modified to pass:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be updated ? All active ROS 2 versions now use Fast-DDS

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed Fast-RTPS to Fast-DDS in e80f5e1. This was just a lift of the material from ths sros2 repo, is there more to be changed?

Selecting an alternate middleware
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

If you choose not to use the default middleware implementation, be sure to `change your DDS implementation <../../Installation/DDS-Implementations>` before proceeding.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do these need a :ref: or a trailing underscore to render properly ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@clalancette tagging you on this, more of a policy issue here. This link works on my local build, but to add a :ref: would mean a change to the DDS-Implementations page, even though it's not quite related to this PR.

Would you prefer adding the :ref:?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is far enough along that we can come through and amend these smaller issues in a subsequent small PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @kscottz: amendments can be in smaller, future PRs.

.. code-block:: bash

cd ~/sros2_demo
ros2 security create_keystore demo_keystore
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure how the tab system works, but is there a way for this type of line working across all platforms to not be duplicated n times ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe there's a type of #include directive but figured it was overkill for what we're doing here?

.. code-block:: bash

ros2 security create_enclave demo_keystore /talker_listener/talker
ros2 security create_enclave demo_keystore /talker_listener/listener
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, do we need to duplicate all commands 3 times if they're identical ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above.

.. code-block:: bash

sudo apt update
sudo apt install tcpdump
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linux-only tutorial ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Packet capture in Windows is a bit different, and the installation is quite different. If you feel this should be branded as a "Linux only" tutorial, just lmk.

Copy link
Member

@audrow audrow Aug 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be good to explicitly say that this is a Linux-only tutorial at the top. The same for any other tutorials that this is true for. This can be done, however, in a smaller PR.

.. code-block:: bash

# In terminal 1:
source ~/.bashrc_ros2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the content of this file ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above, leftover from RosDevDays. Removed in e80f5e1.

^^^^^^^^^^^^^^^^^

Stop both the talker and the listener nodes.
Enable encryption for both by setting the security environment variables and launch them again.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same remark about the use of "launch"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in e80f5e1.


source ~/.bashrc_ros2

export ROS_SECURITY_KEYSTORE=~/sros2_demo/demo_keys
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a way to share snippets between tutorials ? this environment setup would benefit from being referenced instead of explicitely written every time (getting the snippet with the tab for each platform would be awesome)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed above. It's doable, but I don't believe it's worth the effort.

Also if you're asking if we should have the reader do some sort of shortcut--I actually intentionally keep adding this in to drive home the idea of the environment variables that really matter.

.. code-block:: bash

# In terminal 1:
export ROS_SECURITY_KEYSTORE=~/sros2_demo/demo_keys
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a way to share snippets between tutorials ? this environment setup would benefit from being referenced instead of explicitely written every time (getting the snippet with the tab for each platform would be awesome)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above...

@vmayoral
Copy link
Member

vmayoral commented Jul 13, 2021

@clalancette can we please get some help to move this forward? @SidFaber proposal is quite valuable (and needed) IMHO.

Happy to rebase this and include all suggestions if @SidFaber or @clalancette can’t process reviews.

@SidFaber
Copy link
Contributor Author

@vmayoral @mikaelarguedas @clalancette thanks a bunch for moving this forward, sorry I've been out of pocket for the last few weeks. Really appreciate the great feedback, please let me know anything you'd like to iterate on.

@ros-discourse
Copy link

This pull request has been mentioned on ROS Discourse. There might be relevant details there:

https://discourse.ros.org/t/ros-2-tsc-meeting-minutes-2021-07-15/21453/2

Copy link
Collaborator

@kscottz kscottz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great and we should get it merged pronto. I don't think the outstanding issues are necessarily Sid's responsibility and we can address them in subsequent small PRs.

I say we merge it in. @clalancette Is that okay with you?

@kscottz
Copy link
Collaborator

kscottz commented Jul 21, 2021

Also, Thanks @SidFaber this is great and we really appreciate it.

@clalancette clalancette self-assigned this Aug 5, 2021
Copy link
Member

@audrow audrow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. I'm happy to get this moving.

In the future, it'd be much easier to review if this was broken into a few smaller PRs.

.. code-block:: bash

sudo apt update
sudo apt install tcpdump
Copy link
Member

@audrow audrow Aug 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be good to explicitly say that this is a Linux-only tutorial at the top. The same for any other tutorials that this is true for. This can be done, however, in a smaller PR.

Selecting an alternate middleware
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

If you choose not to use the default middleware implementation, be sure to `change your DDS implementation <../../Installation/DDS-Implementations>` before proceeding.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @kscottz: amendments can be in smaller, future PRs.


Take the Quiz!
--------------

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clever! I like this, too.

@audrow audrow merged commit f880ebd into ros2:rolling Aug 27, 2021
@audrow
Copy link
Member

audrow commented Aug 27, 2021

Thanks for the PR, @SidFaber - this was huge!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants