Skip to content

Commit

Permalink
Merge pull request #222 from mikaelarguedas/eloquent_backports
Browse files Browse the repository at this point in the history
Eloquent backports
  • Loading branch information
mikaelarguedas committed Jun 16, 2020
2 parents 48acf43 + 04482e3 commit a6a141f
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 20 deletions.
4 changes: 2 additions & 2 deletions SROS2_Linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ However, other nodes will not be able to communicate, e.g. the following invocat

```bash
# This will fail because the node name does not have valid keys/certificates
ros2 run demo_nodes_cpp talker __node:=not_talker
ros2 run demo_nodes_cpp talker --ros-args -r __node:=not_talker
```


Expand Down Expand Up @@ -207,5 +207,5 @@ For example, the following attempt for the `listener` node to subscribe to a top

```bash
# This will fail because the node is not permitted to subscribe to topics other than chatter.
ros2 run demo_nodes_py listener chatter:=not_chatter
ros2 run demo_nodes_py listener --ros-args -r chatter:=not_chatter
```
4 changes: 2 additions & 2 deletions SROS2_MacOS.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ However, other nodes will not be able to communicate, e.g. the following invocat

```bash
# This will fail because the node name does not have valid keys/certificates
ros2 run demo_nodes_cpp talker __node:=not_talker
ros2 run demo_nodes_cpp talker --ros-args -r __node:=not_talker
```


Expand Down Expand Up @@ -175,5 +175,5 @@ For example, the following attempt for the `listener` node to subscribe to a top

```bash
# This will fail because the node is not permitted to subscribe to topics other than chatter.
ros2 run demo_nodes_py listener chatter:=not_chatter
ros2 run demo_nodes_py listener --ros-args -r chatter:=not_chatter
```
4 changes: 2 additions & 2 deletions SROS2_Windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ However, other nodes will not be able to communicate, e.g. the following invocat

```bat
REM This will fail because the node name does not have valid keys/certificates
ros2 run demo_nodes_cpp talker __node:=not_talker
ros2 run demo_nodes_cpp talker --ros-args -r __node:=not_talker
```

### Access Control
Expand Down Expand Up @@ -173,5 +173,5 @@ For example, the following attempt for the `listener` node to subscribe to a top

```bat
REM This will fail because the node is not permitted to subscribe to topics other than chatter.
ros2 run demo_nodes_py listener chatter:=not_chatter
ros2 run demo_nodes_py listener --ros-args -r chatter:=not_chatter
```
6 changes: 3 additions & 3 deletions sros2/package.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format2.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="2">
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>sros2</name>
<version>0.8.1</version>
<description>Command line tools for managing SROS2 keys</description>
<maintainer email="michael@openrobotics.org">Michael Carroll</maintainer>
<maintainer email="ros-security@googlegroups.com">ROS Security Working Group</maintainer>
<license>Apache License 2.0</license>

<author email="morgan@osrfoundation.org">Morgan Quigley</author>
Expand Down
12 changes: 9 additions & 3 deletions sros2/sros2/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@

from collections import namedtuple
import datetime
import errno
import os
import pathlib
import shutil
import sys

Expand Down Expand Up @@ -324,9 +326,13 @@ def create_key(keystore_path, identity):


def list_keys(keystore_path):
for name in os.listdir(keystore_path):
if os.path.isdir(os.path.join(keystore_path, name)):
print(name)
if not os.path.isdir(keystore_path):
raise FileNotFoundError(
errno.ENOENT, os.strerror(errno.ENOENT), keystore_path)
p = pathlib.Path(keystore_path)
key_file_paths = sorted(p.glob('**/key.pem'))
for key_file_path in key_file_paths:
print('/{}'.format(key_file_path.parent.relative_to(keystore_path).as_posix()))
return True


Expand Down
6 changes: 4 additions & 2 deletions sros2/test/sros2/commands/security/verbs/test_list_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,19 @@


def test_list_keys(capsys):
key_names = ['/test_node', '/test_namespace/test_node', '/sky/is/the/limit']
with tempfile.TemporaryDirectory() as keystore_dir:
with capsys.disabled():
# First, create the keystore
assert create_keystore(keystore_dir)

# Now using that keystore, create a keypair
assert create_key(keystore_dir, '/test_node')
for key in key_names:
assert create_key(keystore_dir, key)

# Now verify that the key we just created is included in the list
assert cli.main(argv=['security', 'list_keys', keystore_dir]) == 0
assert capsys.readouterr().out.strip() == 'test_node'
assert capsys.readouterr().out.strip() == '\n'.join(sorted(key_names))


def test_list_keys_no_keys(capsys):
Expand Down
14 changes: 8 additions & 6 deletions sros2_cmake/package.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
<?xml version="1.0"?>
<package format="2">
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>

<package format="3">
<name>sros2_cmake</name>
<version>0.8.1</version>
<description>Cmake macros to configure security for nodes</description>
<author email="ros-contributions@amazon.com">AWS RoboMaker</author>
<maintainer email="ros-contributions@amazon.com">AWS RoboMaker</maintainer>
<maintainer email="michael@openrobotics.org">Michael Carroll</maintainer>
<description>CMake macros to configure security for nodes</description>
<maintainer email="ros-security@googlegroups.com">ROS Security Working Group</maintainer>
<license>Apache 2.0</license>

<author>AWS RoboMaker</author>

<buildtool_depend>ament_cmake</buildtool_depend>

<build_depend>ament_cmake_test</build_depend>

<build_export_depend>sros2</build_export_depend>
<build_export_depend>ros2cli</build_export_depend>
<build_export_depend>sros2</build_export_depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
Expand Down

0 comments on commit a6a141f

Please sign in to comment.