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

Update security environment variables #200

Merged
merged 1 commit into from
Apr 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion SROS2_Linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ ros2 security create_key demo_keys /listener
### Define the SROS2 environment variables

```bash
export ROS_SECURITY_ROOT_DIRECTORY=~/sros2_demo/demo_keys
export ROS_SECURITY_KEYSTORE=~/sros2_demo/demo_keys
export ROS_SECURITY_ENABLE=true
export ROS_SECURITY_STRATEGY=Enforce
```
Expand Down
2 changes: 1 addition & 1 deletion SROS2_MacOS.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ ros2 security create_key demo_keys /listener
### Define the SROS2 environment variables

```bash
export ROS_SECURITY_ROOT_DIRECTORY=$(pwd)/demo_keys
export ROS_SECURITY_KEYSTORE=$(pwd)/demo_keys
export ROS_SECURITY_ENABLE=true
export ROS_SECURITY_STRATEGY=Enforce
```
Expand Down
6 changes: 3 additions & 3 deletions SROS2_Windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Then re-run the commands above.
Prepare your environment by setting three following environment variables as follows

```bat
set ROS_SECURITY_ROOT_DIRECTORY=%cd%/demo_keys
set ROS_SECURITY_KEYSTORE=%cd%/demo_keys
set ROS_SECURITY_ENABLE=true
set ROS_SECURITY_STRATEGY=Enforce
```
Expand All @@ -102,7 +102,7 @@ Open a new terminal:

```bat
call <path_to_ros2_install>/setup.bat
set ROS_SECURITY_ROOT_DIRECTORY=%cd%/demo_keys
set ROS_SECURITY_KEYSTORE=%cd%/demo_keys
set ROS_SECURITY_ENABLE=true
set ROS_SECURITY_STRATEGY=Enforce
ros2 run demo_nodes_py talker
Expand All @@ -112,7 +112,7 @@ Open another terminal:

```bat
call <path_to_ros2_install>/setup.bat
set ROS_SECURITY_ROOT_DIRECTORY=%cd%/demo_keys
set ROS_SECURITY_KEYSTORE=%cd%/demo_keys
set ROS_SECURITY_ENABLE=true
set ROS_SECURITY_STRATEGY=Enforce
ros2 run demo_nodes_py listener
Expand Down
2 changes: 1 addition & 1 deletion sros2/sros2/api/_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from cryptography.hazmat.primitives.asymmetric import ec

_DOMAIN_ID_ENV = 'ROS_DOMAIN_ID'
_KEYSTORE_DIR_ENV = 'ROS_SECURITY_ROOT_DIRECTORY'
_KEYSTORE_DIR_ENV = 'ROS_SECURITY_KEYSTORE'


def create_symlink(*, src, dst):
Expand Down
2 changes: 1 addition & 1 deletion sros2_cmake/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ Macro definition:
# Executables can use a different or the same enclaves.
# All nodes in the same process use the same enclave.
# SECURITY (cmake arg) if not define or OFF, will not generate key/keystores
# ROS_SECURITY_ROOT_DIRECTORY (env variable) the location of the keystore
# ROS_SECURITY_KEYSTORE (env variable) the location of the keystore
# POLICY_FILE (cmake arg) if defined, will generate security artifacts for each enclave defined in the policy file.
```
6 changes: 3 additions & 3 deletions sros2_cmake/cmake/sros2_generate_artifacts.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ macro(sros2_generate_artifacts)
# SECURITY (cmake arg) if not defined or OFF, will not generate keystore/keys/permissions
# POLICY_FILE (cmake arg) if defined, policies defined in the file will used to generate
# permission files for all the enclaves listed in the policy file.
# ROS_SECURITY_ROOT_DIRECTORY (env variable) will be the location of the keystore
# ROS_SECURITY_KEYSTORE (env variable) will be the location of the keystore
if(NOT SECURITY)
message(STATUS "Not generating security files")
return()
endif()
find_program(PROGRAM ros2)

if(DEFINED ENV{ROS_SECURITY_ROOT_DIRECTORY})
set(SECURITY_KEYSTORE $ENV{ROS_SECURITY_ROOT_DIRECTORY})
if(DEFINED ENV{ROS_SECURITY_KEYSTORE})
set(SECURITY_KEYSTORE $ENV{ROS_SECURITY_KEYSTORE})
else()
set(SECURITY_KEYSTORE ${DEFAULT_KEYSTORE})
endif()
Expand Down