Skip to content

Tutorial permissions not working #79

Closed

Description

@mikaelarguedas

Bug report

Required Info:

  • Operating System:
    • Ubuntu Bionic
  • Installation type:
    • source
  • Version or commit hash:
  • DDS implementation:
    • N/A
  • Client library (if applicable):
    • N/A

Steps to reproduce issue

Follow the SROS2_Linux Tutorial until Access control section

or

$ docker run -it --rm ros:crystal
apt update && apt upgrade -y && apt install -y curl ros-crystal-demo-nodes-cpp ros-crystal-demo-nodes-py ros-crystal-sros2 
mkdir ~/sros2_demo && cd ~/sros2_demo
ros2 security create_keystore demo_keys
ros2 security create_key demo_keys talker
ros2 security create_key demo_keys listener
curl -sk https://raw.githubusercontent.com/ros2/sros2/master/examples/sample_policy.yaml -o ./demo_keys/policies.yaml
ros2 security create_permission demo_keys talker demo_keys/policies.yaml

Expected behavior

Generate permission.xml files and be able to use access control

Actual behavior

Fails to create permission files.

Additional information

Error1
Traceback (most recent call last):
  File "/opt/ros/crystal/bin/ros2", line 11, in <module>
    load_entry_point('ros2cli==0.6.3', 'console_scripts', 'ros2')()
  File "/opt/ros/crystal/lib/python3.6/site-packages/ros2cli/cli.py", line 69, in main
    rc = extension.main(parser=parser, args=args)
  File "/opt/ros/crystal/lib/python3.6/site-packages/sros2/command/security.py", line 37, in main
    return extension.main(args=args)
  File "/opt/ros/crystal/lib/python3.6/site-packages/sros2/verb/create_permission.py", line 44, in main
    success = create_permission(args)
  File "/opt/ros/crystal/lib/python3.6/site-packages/sros2/api/__init__.py", line 522, in create_permission
    permissions_dict = get_permissions(name, policy_file_path)
  File "/opt/ros/crystal/lib/python3.6/site-packages/sros2/api/__init__.py", line 500, in get_permissions
    return graph['nodes'][name]
KeyError: 'nodes'

Reason: the url https://raw.githubusercontent.com/ros2/sros2/master/examples/sample_policy.yaml is broken, the file is now at https://raw.githubusercontent.com/ros2/sros2/sros2/master/examples/sample_policy.yaml

Error2 (using the updated URL)
ros2 security create_permission demo_keys talker demo_keys/policies.yaml
Namespace(NAME='talker', POLICY_FILE_PATH='demo_keys/policies.yaml', ROOT='demo_keys', _command=<sros2.command.security.SecurityCommand object at 0x7f67d0927860>, _verb=<sros2.verb.create_permission.CreatePermissionVerb object at 0x7f67cbccbdd8>, **{' command': 'security', ' verb': 'create_permission'})
key_dir demo_keys/talker
while scanning a simple key
  in "demo_keys/policies.yaml", line 30, column 9
could not find expected ':'
  in "demo_keys/policies.yaml", line 31, column 7

The file is invalid yaml format.
The file is missing whitespaces line 30 and 36

Error3(using valid yaml file)
Traceback (most recent call last):
  File "/opt/ros/crystal/bin/ros2", line 11, in <module>
    load_entry_point('ros2cli==0.6.3', 'console_scripts', 'ros2')()
  File "/opt/ros/crystal/lib/python3.6/site-packages/ros2cli/cli.py", line 69, in main
    rc = extension.main(parser=parser, args=args)
  File "/opt/ros/crystal/lib/python3.6/site-packages/sros2/command/security.py", line 37, in main
    return extension.main(args=args)
  File "/opt/ros/crystal/lib/python3.6/site-packages/sros2/verb/create_permission.py", line 44, in main
    success = create_permission(args)
  File "/opt/ros/crystal/lib/python3.6/site-packages/sros2/api/__init__.py", line 524, in create_permission
    create_permission_file(permissions_path, name, domain_id, permissions_dict)
  File "/opt/ros/crystal/lib/python3.6/site-packages/sros2/api/__init__.py", line 425, in create_permission_file
    service_dict = permissions_dict['services']
KeyError: 'services'

@ross-desmond @jacobperron Is there another policy file to use for the Linux tutorial ?

I will try the code and tutorial from #72 to see if the issue is resolved with the xml version

Update
I got the tutorial working using #72 + #80

Activity

  1. ross-desmond commented on Feb 18, 2019

    @ross-desmond
    Contributor
  2. ross-desmond commented on Feb 18, 2019

    @ross-desmond
    Contributor

    Since we are moving to #72 and #80, a fix in the yaml version may not be necessary, but should one be necessary in the meantime: #81

  3. jacobperron commented on Feb 21, 2019

    @jacobperron
    Member

    Since we are moving to #72 and #80, a fix in the yaml version may not be necessary, but should one be necessary in the meantime: #81

    Since #72 is a significant change to the policy format, I think it's probably better to merge #81 first, and backport it as a patch for Crystal so the tutorial is not broken.

    @mjcarroll FYI

  4. self-assigned this
    on Feb 28, 2019
  5. added
    in progress
    on Feb 28, 2019
  6. mjcarroll commented on Mar 19, 2019

    @mjcarroll
    Member

    Update
    I got the tutorial working using #72 + #80

    @mikaelarguedas Is this resolved now?

  7. mikaelarguedas commented on Mar 19, 2019

    @mikaelarguedas
    MemberAuthor

    mikaelarguedas Is this resolved now?

    Yes, #99 was the last blocker 👍

  8. removed
    in progress
    on Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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