Skip to content

ROS2 Security settings and certificates #5707

@darshit-desai

Description

@darshit-desai

Is there an already existing issue for this?

  • I have searched the existing issues

Expected behavior

The expected behavior as far as my understanding goes is that it should discover and show topics

Current behavior

Hi I have been trying to use the FASTRTPS_DEFAULT_PROFILES_FILE env variable and FASRDDS_DEFAULT_PROFILES_FILE env variable to setup ros2 security and ACLs for my ros2 topics.

Here's the scenario, IN Term#1 I source the relevant files as shown in the screenshot and than I run the MicroXRCEAgent for PX4, it starts up flawlessly and when I open up another terminal to source the same xml file through which the I started the agent it shows me this error

Image

I have checked to make sure my permissions and governance files are signed and converted to smime's. I am using this example from the FASTDDS repo.
https://github.com/eProsima/Fast-DDS/tree/master/examples/cpp/security/certs
https://github.com/eProsima/Fast-DDS/blob/master/examples/cpp/security/secure_publisher_profile.xml

I will be corssposting this on FASTDDS and ROS2 both because I can't seem to figure out what's the issue,

I am using ROS2 Humble , the MicroXRCEAgent and the term#2 are all on the same computer and network

Steps to reproduce

Install ROS2 humble
Clone the fast dds repo
Replace the contents of all the xml files in the security example as attached
Export and source the xml files before the next step, make sure smime's are signed
If possible compile MicroXRCEAgent with Security ON run the agent with the PX4 main line sitl code
In another terminal do the same and than do ros2 doctor --report

Fast DDS version/commit

Not sure, whichever is packaged with ROS2 Humble

Platform/Architecture

Other. Please specify in Additional context section.

Transport layer

UDPv4

Additional context

Ubuntu 22.04

XML configuration file

Below are the permissions, governance and the domain participant xml files:

Permissions file:

<?xml version="1.0" encoding="utf-8"?>
<dds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.omg.org/spec/DDS-Security/20170801/omg_shared_ca_permissions.xsd">
    <permissions>
        <grant name="PublisherPermissions">
            <subject_name>emailAddress=mainpub@eprosima.com, CN=Main Publisher, OU=eProsima, O=eProsima, ST=MA, C=ES</subject_name>
            <validity>
                <not_before>2013-06-01T13:00:00</not_before>
                <not_after>2038-06-01T13:00:00</not_after>
            </validity>
            <allow_rule>
                <domains>
                    <id_range>
                        <min>0</min>
                        <max>230</max>
                    </id_range>
                </domains>
                <publish>
                    <topics>
                        <topic>ros_discovery_info</topic>
                        <topic>rt/rosout</topic>
                        <topic>rt/parameter_events</topic>
                        <topic>rt/fmu/out/*</topic>
                        <topic>rr/fmu/*</topic>
                    </topics>
                </publish>
                <subscribe>
                    <topics>
                        <topic>rt/fmu/in/*</topic>
                        <topic>rq/fmu/*</topic>
                        <topic>ros_discovery_info</topic>
                        <topic>rt/rosout</topic>
                        <topic>rt/parameter_events</topic>
                    </topics>
                </subscribe>
            </allow_rule>
            <default>DENY</default>
        </grant>
        <grant name="SubscriberPermissions">
            <subject_name> emailAddress=mainsub@eprosima.com, CN=Main Subscriber, OU=eProsima, O=eProsima, ST=MA, C=ES</subject_name>
            <validity>
                <not_before>2013-06-01T13:00:00</not_before>
                <not_after>2038-06-01T13:00:00</not_after>
            </validity>
            <allow_rule>
                <domains>
                    <id_range>
                        <min>0</min>
                        <max>230</max>
                    </id_range>
                </domains>
                <subscribe>
                    <topics>
                        <topic>rt/fmu/in/*</topic>
                        <topic>rr/fmu/*</topic>
                        <topic>ros_discovery_info</topic>
                        <topic>rt/rosout</topic>
                        <topic>rt/parameter_events</topic>
                    </topics>
                </subscribe>
            </allow_rule>
            <default>DENY</default>
        </grant>
    </permissions>
</dds>


Governance file:

<?xml version="1.0" encoding="utf-8"?>
<dds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="omg_shared_ca_domain_governance.xsd">
    <domain_access_rules>
        <domain_rule>
            <domains>
                <id_range>
                    <min>0</min>
                    <max>230</max>
                </id_range>
            </domains>
            <allow_unauthenticated_participants>false</allow_unauthenticated_participants>
            <enable_join_access_control>true</enable_join_access_control>
            <discovery_protection_kind>ENCRYPT</discovery_protection_kind>
            <liveliness_protection_kind>ENCRYPT</liveliness_protection_kind>
            <rtps_protection_kind>ENCRYPT</rtps_protection_kind>
            <topic_access_rules>
                <topic_rule>
                    <topic_expression>ros_discovery_info</topic_expression>
                    <enable_discovery_protection>false</enable_discovery_protection>
                    <enable_liveliness_protection>false</enable_liveliness_protection>
                    <enable_read_access_control>false</enable_read_access_control>
                    <enable_write_access_control>false</enable_write_access_control>
                    <metadata_protection_kind>NONE</metadata_protection_kind>
                    <data_protection_kind>NONE</data_protection_kind>
                </topic_rule>
                <topic_rule>
                    <topic_expression>rt/rosout</topic_expression>
                    <enable_discovery_protection>false</enable_discovery_protection>
                    <enable_liveliness_protection>false</enable_liveliness_protection>
                    <enable_read_access_control>false</enable_read_access_control>
                    <enable_write_access_control>false</enable_write_access_control>
                    <metadata_protection_kind>NONE</metadata_protection_kind>
                    <data_protection_kind>NONE</data_protection_kind>
                </topic_rule>
                <topic_rule>
                    <topic_expression>rt/parameter_events</topic_expression>
                    <enable_discovery_protection>false</enable_discovery_protection>
                    <enable_liveliness_protection>false</enable_liveliness_protection>
                    <enable_read_access_control>false</enable_read_access_control>
                    <enable_write_access_control>false</enable_write_access_control>
                    <metadata_protection_kind>NONE</metadata_protection_kind>
                    <data_protection_kind>NONE</data_protection_kind>
                </topic_rule>
                <topic_rule>
                    <topic_expression>rt/fmu/out/*</topic_expression>
                    <enable_discovery_protection>true</enable_discovery_protection>
                    <enable_liveliness_protection>false</enable_liveliness_protection>
                    <enable_read_access_control>true</enable_read_access_control>
                    <enable_write_access_control>true</enable_write_access_control>
                    <metadata_protection_kind>ENCRYPT</metadata_protection_kind>
                    <data_protection_kind>ENCRYPT</data_protection_kind>
                </topic_rule>
                <topic_rule>
                    <topic_expression>rt/fmu/in/*</topic_expression>
                    <enable_discovery_protection>true</enable_discovery_protection>
                    <enable_liveliness_protection>false</enable_liveliness_protection>
                    <enable_read_access_control>true</enable_read_access_control>
                    <enable_write_access_control>true</enable_write_access_control>
                    <metadata_protection_kind>ENCRYPT</metadata_protection_kind>
                    <data_protection_kind>ENCRYPT</data_protection_kind>
                </topic_rule>
                <topic_rule>
                    <topic_expression>rq/fmu/*</topic_expression>
                    <enable_discovery_protection>true</enable_discovery_protection>
                    <enable_liveliness_protection>false</enable_liveliness_protection>
                    <enable_read_access_control>true</enable_read_access_control>
                    <enable_write_access_control>true</enable_write_access_control>
                    <metadata_protection_kind>ENCRYPT</metadata_protection_kind>
                    <data_protection_kind>ENCRYPT</data_protection_kind>
                </topic_rule>
                <topic_rule>
                    <topic_expression>rr/fmu/*</topic_expression>
                    <enable_discovery_protection>true</enable_discovery_protection>
                    <enable_liveliness_protection>false</enable_liveliness_protection>
                    <enable_read_access_control>true</enable_read_access_control>
                    <enable_write_access_control>true</enable_write_access_control>
                    <metadata_protection_kind>ENCRYPT</metadata_protection_kind>
                    <data_protection_kind>ENCRYPT</data_protection_kind>
                </topic_rule>
            </topic_access_rules>
        </domain_rule>
    </domain_access_rules>
</dds>


Domain participant xml

<?xml version="1.0" encoding="UTF-8" ?>
<profiles xmlns="http://www.eprosima.com" >
    <transport_descriptors>
        <transport_descriptor>
            <transport_id>custom_udp_transport</transport_id>
            <type>UDPv4</type>
            <interfaceWhiteList>
                <address>127.0.0.1</address>
            </interfaceWhiteList>
        </transport_descriptor>
    </transport_descriptors>

    <!-- Default publisher profile (Data Sharing / Zero-Copy when possible) -->
    <data_writer profile_name="aos_default_publisher_profile" is_default_profile="true">
        <qos>
            <publishMode>
                <kind>SYNCHRONOUS</kind>
            </publishMode>
        </qos>
        <historyMemoryPolicy>PREALLOCATED_WITH_REALLOC</historyMemoryPolicy>
    </data_writer>
    <!-- Default subscriber profile (Data Sharing / Zero-Copy when possible) -->
    <data_reader profile_name="aos_default_subscriber_profile" is_default_profile="true">
        <historyMemoryPolicy>PREALLOCATED_WITH_REALLOC</historyMemoryPolicy>
    </data_reader>
    <participant profile_name="px4_participant" is_default_profile="true">
        <domainId>0</domainId>
        <rtps>
            <userTransports>
                <transport_id>custom_udp_transport</transport_id>
            </userTransports>
            <propertiesPolicy>
                <!-- Set authentication for DDS Domain communication  -->
                <properties>
                    <!-- Activate DDS:Auth:PKI-DH plugin -->
                    <property>
                        <name>dds.sec.auth.plugin</name>
                        <value>builtin.PKI-DH</value>
                    </property>
                    <!-- Configure DDS:Auth:PKI-DH plugin -->
                    <property>
                        <name>dds.sec.auth.builtin.PKI-DH.identity_ca</name>
                        <value>file:///home/px4dev/Software/Fast-DDS/examples/cpp/security/certs/maincacert.pem</value>
                    </property>
                    <property>
                        <name>dds.sec.auth.builtin.PKI-DH.identity_certificate</name>
                        <value>file:///home/px4dev/Software/Fast-DDS/examples/cpp/security/certs/mainpubcert.pem</value>
                    </property>
                    <property>
                        <name>dds.sec.auth.builtin.PKI-DH.private_key</name>
                        <value>file:///home/px4dev/Software/Fast-DDS/examples/cpp/security/certs/mainpubkey.pem</value>
                    </property>
                    <!-- Activate DDS:Access:Permissions plugin -->
                    <property>
                        <name>dds.sec.access.plugin</name>
                        <value>builtin.Access-Permissions</value>
                    </property>
                    <!-- Configure DDS:Access:Permissions plugin -->
                    <property>
                        <name>dds.sec.access.builtin.Access-Permissions.permissions_ca</name>
                        <value>file:///home/px4dev/Software/Fast-DDS/examples/cpp/security/certs/maincacert.pem</value>
                    </property>
                    <property>
                        <name>dds.sec.access.builtin.Access-Permissions.governance</name>
                        <value>file:///home/px4dev/Software/Fast-DDS/examples/cpp/security/certs/governance.smime</value>
                    </property>
                    <property>
                        <name>dds.sec.access.builtin.Access-Permissions.permissions</name>
                        <value>file:///home/px4dev/Software/Fast-DDS/examples/cpp/security/certs/permissions.smime</value>
                    </property>
                    <!-- Activate Crypto:AES-GCM-GMAC plugin -->
                    <property>
                        <name>dds.sec.crypto.plugin</name>
                        <value>builtin.AES-GCM-GMAC</value>
                    </property>
                </properties>
            </propertiesPolicy>
        </rtps>
    </participant>
    <!-- <data_writer profile_name="hello_world_datawriter_profile" is_default_profile="true">
        <qos>
            <durability>
                <kind>TRANSIENT_LOCAL</kind>
            </durability>
            <reliability>
                <kind>RELIABLE</kind>
            </reliability>
        </qos>
        <topic>
            <historyQos>
                <kind>KEEP_LAST</kind>
                <depth>100</depth>
            </historyQos>
            <resourceLimitsQos>
                <max_samples>100</max_samples>
                <max_instances>1</max_instances>
                <max_samples_per_instance>100</max_samples_per_instance>
            </resourceLimitsQos>
        </topic>
    </data_writer> -->
</profiles>

Relevant log output

Network traffic capture

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions