Skip to content

Commit 130fb44

Browse files
committed
Refs #24365: Fix other tests
Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com>
1 parent 33981e2 commit 130fb44

3 files changed

Lines changed: 97 additions & 10 deletions

File tree

test/blackbox/auth_handshake_props_profile.xml

Lines changed: 75 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<dds xmlns="http://www.eprosima.com">
33
<profiles>
4-
<participant profile_name="auth_handshake_props">
4+
<participant profile_name="auth_handshake_props_pub">
55
<domainId>0</domainId>
66
<rtps>
77
<propertiesPolicy>
@@ -24,10 +24,26 @@
2424
<name>dds.sec.auth.builtin.PKI-DH.private_key</name>
2525
<value>file://${CERTS_PATH}/mainpubkey.pem</value>
2626
</property>
27-
<!-- Activate DDS:Crypto:AES-GCM-GMAC plugin -->
2827
<property>
29-
<name>dds.sec.crypto.plugin</name>
30-
<value>builtin.AES-GCM-GMAC</value>
28+
<name>dds.sec.auth.builtin.PKI-DH.max_handshake_requests</name>
29+
<value>10</value>
30+
</property>
31+
<property>
32+
<name>dds.sec.auth.builtin.PKI-DH.initial_handshake_resend_period</name>
33+
<value>100</value>
34+
</property>
35+
<property>
36+
<name>dds.sec.auth.builtin.PKI-DH.handshake_resend_period_gain</name>
37+
<value>1.1</value>
38+
</property>
39+
<!-- Activate Access Control -->
40+
<property>
41+
<name>dds.sec.access.plugin</name>
42+
<value>builtin.Access-Permissions</value>
43+
</property>
44+
<property>
45+
<name>dds.sec.access.builtin.Access-Permissions.permissions_ca</name>
46+
<value>file://${CERTS_PATH}/maincacert.pem</value>
3147
</property>
3248
<property>
3349
<name>dds.sec.access.builtin.Access-Permissions.governance</name>
@@ -37,6 +53,39 @@
3753
<name>dds.sec.access.builtin.Access-Permissions.permissions</name>
3854
<value>file://${CERTS_PATH}/permissions_helloworld.smime</value>
3955
</property>
56+
<!-- Activate DDS:Crypto:AES-GCM-GMAC plugin -->
57+
<property>
58+
<name>dds.sec.crypto.plugin</name>
59+
<value>builtin.AES-GCM-GMAC</value>
60+
</property>
61+
</properties>
62+
</propertiesPolicy>
63+
</rtps>
64+
</participant>
65+
66+
<participant profile_name="auth_handshake_props_sub">
67+
<domainId>0</domainId>
68+
<rtps>
69+
<propertiesPolicy>
70+
<properties>
71+
<!-- Activate DDS:Auth:PKI-DH plugin -->
72+
<property>
73+
<name>dds.sec.auth.plugin</name>
74+
<value>builtin.PKI-DH</value>
75+
</property>
76+
<!-- Configure DDS:Auth:PKI-DH plugin -->
77+
<property>
78+
<name>dds.sec.auth.builtin.PKI-DH.identity_ca</name>
79+
<value>file://${CERTS_PATH}/maincacert.pem</value>
80+
</property>
81+
<property>
82+
<name>dds.sec.auth.builtin.PKI-DH.identity_certificate</name>
83+
<value>file://${CERTS_PATH}/mainsubcert.pem</value>
84+
</property>
85+
<property>
86+
<name>dds.sec.auth.builtin.PKI-DH.private_key</name>
87+
<value>file://${CERTS_PATH}/mainsubkey.pem</value>
88+
</property>
4089
<property>
4190
<name>dds.sec.auth.builtin.PKI-DH.max_handshake_requests</name>
4291
<value>10</value>
@@ -49,6 +98,28 @@
4998
<name>dds.sec.auth.builtin.PKI-DH.handshake_resend_period_gain</name>
5099
<value>1.1</value>
51100
</property>
101+
<!-- Activate Access Control -->
102+
<property>
103+
<name>dds.sec.access.plugin</name>
104+
<value>builtin.Access-Permissions</value>
105+
</property>
106+
<property>
107+
<name>dds.sec.access.builtin.Access-Permissions.permissions_ca</name>
108+
<value>file://${CERTS_PATH}/maincacert.pem</value>
109+
</property>
110+
<property>
111+
<name>dds.sec.access.builtin.Access-Permissions.governance</name>
112+
<value>file://${CERTS_PATH}/governance_helloworld_all_enable.smime</value>
113+
</property>
114+
<property>
115+
<name>dds.sec.access.builtin.Access-Permissions.permissions</name>
116+
<value>file://${CERTS_PATH}/permissions_helloworld.smime</value>
117+
</property>
118+
<!-- Activate DDS:Crypto:AES-GCM-GMAC plugin -->
119+
<property>
120+
<name>dds.sec.crypto.plugin</name>
121+
<value>builtin.AES-GCM-GMAC</value>
122+
</property>
52123
</properties>
53124
</propertiesPolicy>
54125
</rtps>

test/blackbox/common/BlackboxTestsSecurity.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5629,7 +5629,8 @@ TEST(Security, ValidateAuthenticationHandshakePropertiesParsing)
56295629

56305630
PropertyPolicy property_policy;
56315631

5632-
fill_sub_auth(property_policy);
5632+
fill_pub_auth(property_policy);
5633+
fill_access(property_policy);
56335634
fill_crypto(property_policy);
56345635

56355636
// max_handshake_requests out of bounds
@@ -5687,21 +5688,20 @@ TEST(Security, ValidateAuthenticationHandshakePropertiesParsing)
56875688
TEST(Security, ValidateAuthenticationHandshakeProperties)
56885689
{
56895690
// Create
5690-
PubSubReader<HelloWorldPubSubType> reader(TEST_TOPIC_NAME);
5691-
PubSubWriter<HelloWorldPubSubType> writer(TEST_TOPIC_NAME);
5691+
PubSubReader<HelloWorldPubSubType> reader("HelloWorldTopic");
5692+
PubSubWriter<HelloWorldPubSubType> writer("HelloWorldTopic");
56925693

56935694
PropertyPolicy property_policy;
56945695
std::string xml_file = "auth_handshake_props_profile.xml";
5695-
std::string profile_name = "auth_handshake_props";
56965696

56975697
// Set a configuration that makes participant authentication
56985698
// to be performed quickly so that we receive handshake
56995699
// in 0.15 secs approx
57005700
writer.set_xml_filename(xml_file);
5701-
writer.set_participant_profile(profile_name);
5701+
writer.set_participant_profile("auth_handshake_props_pub");
57025702

57035703
reader.set_xml_filename(xml_file);
5704-
reader.set_participant_profile(profile_name);
5704+
reader.set_participant_profile("auth_handshake_props_sub");
57055705

57065706
reader.init();
57075707
ASSERT_TRUE(reader.isInitialized());

test/blackbox/common/DDSBlackboxTestsSecurity.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,21 @@ void set_authentication_config(
5353
props.emplace_back(kIdentityPrivateKey, "file://" + std::string(certs_path) + "/mainsubkey.pem");
5454
}
5555

56+
void set_access_control_config(
57+
rtps::PropertySeq& props)
58+
{
59+
static constexpr auto kAccessControlPlugin{ "dds.sec.access.plugin" };
60+
static constexpr auto kAccessControlPluginNameValue{ "builtin.Access-Permissions" };
61+
static constexpr auto kPermissionsCA{ "dds.sec.access.builtin.Access-Permissions.permissions_ca" };
62+
static constexpr auto kPermissionsGovernance{ "dds.sec.access.builtin.Access-Permissions.governance" };
63+
static constexpr auto kPermissionsFile{ "dds.sec.access.builtin.Access-Permissions.permissions" };
64+
65+
props.emplace_back(kAccessControlPlugin, kAccessControlPluginNameValue);
66+
props.emplace_back(kPermissionsCA, "file://" + std::string(certs_path) + "/maincacert.pem");
67+
props.emplace_back(kPermissionsGovernance, "file://" + std::string(certs_path) + "/governance_only_auth.smime");
68+
props.emplace_back(kPermissionsFile, "file://" + std::string(certs_path) + "/permissions.smime");
69+
}
70+
5671
void set_participant_crypto_config(
5772
rtps::PropertySeq& props)
5873
{
@@ -97,6 +112,7 @@ void test_big_message_corner_case(
97112

98113
auto qos{ fastdds::PARTICIPANT_QOS_DEFAULT };
99114
set_authentication_config(qos.properties().properties());
115+
set_access_control_config(qos.properties().properties());
100116
set_participant_crypto_config(qos.properties().properties());
101117
auto transport = std::make_shared<eprosima::fastdds::rtps::UDPv4TransportDescriptor>();
102118
transport->interfaceWhiteList.push_back("127.0.0.1");

0 commit comments

Comments
 (0)