Replies: 11 comments 28 replies
-
I am really looking forward to this. Will 'cluster-nodes' be able to contact a central RBAC logon point? |
Beta Was this translation helpful? Give feedback.
-
That's a big step forward! Awesome! Looking forward to use RBAC in GNS3! Thanks for the hard work that you put in this project! |
Beta Was this translation helpful? Give feedback.
-
To add more points to the discussion. |
Beta Was this translation helpful? Give feedback.
-
Have have noticed a small problem with our current approach. Let's say we want to prevent all users from duplicating their projects, we could do this by adding a DENY permission matching One way around that would be to allow generic permissions like |
Beta Was this translation helpful? Give feedback.
-
deny duplicate is just another right or deny. Yes, you can (even you must) consider a duplication permission. Else, logically, I am denied (example) to access the nodes, I dup the project, I can play with the nodes :-) |
Beta Was this translation helpful? Give feedback.
-
About regexp, That is what I already do in Vigrid. However, I dont use SQL. If SQL can manage it, the only side effect is performance. Keep in mind you have to check at each API call :-( |
Beta Was this translation helpful? Give feedback.
-
Why not just create a general permission called |
Beta Was this translation helpful? Give feedback.
-
@eantowne that is a discuss we started to have with Jeremy, but action should be taken as webui level : summarized rights. |
Beta Was this translation helpful? Give feedback.
-
I am working on adding more default roles and permissions in #1987 So far I have this for the roles:
Questions / comments
|
Beta Was this translation helpful? Give feedback.
-
Would ownership of templates make sense? |
Beta Was this translation helpful? Give feedback.
-
I know this is an old discussion, but just thought I'd ask something as it's likely I'll be planning on deploying GNS3 in a education environment once 3.0 is stable. How will (or if not implemented yet, would) RBAC be applied to VM consoles like telnet, VNC and SPICE? An obvious option would be requiring the user's login credentials to access the VNC and SPICE sessions, but obviously that won't work with telnet. SSH maybe? I've also had additional concerns from our networking team as they really aren't a fan of large port ranges. Is it possible some sort of proxy/gateway could be used to accept connections on a single port and forward them to the correct VM based upon supplied credentials? |
Beta Was this translation helpful? Give feedback.
-
GNS3 3.0 will come with a RBAC (Role Based Access Control) API. Here is a quick presentation of what we already have. Of course, this can be (and will most likely) be improved.
Theory
RBAC allows you to leverage permissions to specify what can be accessed – be it actions, or resources – while eliminating the need to manage these permissions individually. Permissions are assigned to roles, and roles can be assigned to users or user groups.
Roles will often have titles that we see commonly, such as User or Administrator. Once you have identified and defined the roles and assigned them to each user, these roles can be assigned permissions which are then applied to the users within the role group. By managing permissions within a small set of roles, administration and security becomes an easier task.
A best practice is to assign roles to user groups rather than individuals and with no permissions existing by default. This is what we will do in GNS3.
General implementation
The GNS3 controller manages the RBAC system using a SQL database which is SQLite but could easily be MySQL, PostgresQL etc. if needed.
Because not all resources are recorded in the database (only computes, images, templates, users, user groups, permissions and roles) and because we also want something flexible, we have chosen to implement permissions based on the API URI paths and HTTP methods instead of associating permissions directly with resources like projects, nodes etc.
For example, to deny a specific project to be duplicated, a DENY permission on POST
/projects/{project_id}/duplicate
can be created and assigned to a role that is itself assigned to an user group which users belong to.To summarize, the URI is the resource and the HTTP method is the action performed on this resource.
This idea originally comes from https://medium.com/practo-engineering/route-based-access-control-462861b04433
Something important here is the API must be organized in a way that allow permissions to be easily and logically created. Luckily the current API (documentation on https://apiv3.gns3.net/ or https://apiv3.gns3.net/redoc) is quite hierarchical and only minor adjustments should be needed.
Permissions management
Permissions are managed using these API endpoints: https://apiv3.gns3.net/#/Permissions
Here is an example with JSON data to create a new permission.
POST
/v3/permissions
methods
is the HTTP method to match. There can be multiple methods with:POST
= CREATEGET
= READPUT
= UPDATEDELETE
= DELETEAction can be
ALLOW
orDENY
.Path is the API URI to match. Creating a permission on an URI that does not exist is not allowed.
Roles management
Roles are managed using these API endpoints: https://apiv3.gns3.net/#/Roles
Here is an example with JSON data to create a new role
POST
/v3/roles
Permissions can be assigned to the role once it is created with PUT
/v3/roles/{role_id}/permissions/{permission_id}
https://apiv3.gns3.net/#/Roles/add_permission_to_role_v3_roles__role_id__permissions__permission_id__putUsers management
Users are managed using these API endpoints: https://apiv3.gns3.net/#/Users
Here is an example with JSON data to create a new user
POST
/v3/users
Authentication
Users must be authenticated to access endpoints with the lock symbol shown in the API documentation on https://apiv3.gns3.net/, to authenticate an user, an API call to https://apiv3.gns3.net/#/Users/login_v3_users_login_post is done and a token is returned upon success. The token is then used for all other API calls, this is when the RBAC system checks the user is authorized or not.
There is one special case, all
/users/me
endpoints are authorized. This is to allow users to check or update his/her own information.User groups management
User groups are managed using these API endpoints: https://apiv3.gns3.net/#/Users%20groups
Here is an example with JSON data to create a new group.
POST
/v3/group
Roles can be assigned to the group once it is created with PUT
/v3/groups/{group_id}/roles/{role_id}
https://apiv3.gns3.net/#/Users%20groups/add_role_to_group_v3_groups__user_group_id__roles__role_id__putUsers can be assigned to the group with PUT
/v3/groups/{group_id}/members/{user_id}
https://apiv3.gns3.net/#/Users%20groups/add_member_to_group_v3_groups__user_group_id__members__user_id__put
Groups are the link between users and roles.
Defaults
These defaults are created when the controller is started and no database file exists, the file is stored in
~/.config/GNS3/3.0/gns3_controller.db
. Deleting this file and restarting the controller will reset everything.Super admin
The only user created by default is
admin
with defaultadmin
password, this is the super administrator which cannot be restricted in any way and completely bypass the RBAC system. This is the only account needed if users wish to use GNS3 in the same way as previous versions, without restrictions.Default user groups
A freshly created user must be assigned to
Users
by an Administrator otherwise this user won't be able to create/access anything.Default roles
Default permissions for the Administrator role
The Administrator role has access to everything.
Default permissions for User role
The User role can create create/list projects, create/list templates, use computes and create/list symbols. This is subject to changes.
Permission priorities
Permissions are checked from the longest to shortest URI . For example:
/projects/{project_id}/duplicate
will match first and then/projects/
. We are considering adding an explicitpriority
field to permissions.Automatically created permissions
Each time an user creates a new project or a new template, a permission is added to the user. The user is the owner of that resource and other users cannot access it excepting if explicitly allowed.
The generated permission would be
/projects/{project_id}/*
for a newly created project and/templates/{template_id}/*
for a newly created template.The
/*
gives access to all resources inside another one, for instance all nodes and links belonging to a project. A permission on/projects/{project.id}
only allows requests matching exactly that path which means only GET, PUT or DELETE on that project but nothing else as seen in the API documentation for projects: https://apiv3.gns3.net/#/ProjectsThese kind of generated permissions are directly associated to users who create the resource. They are automatically deleted when a given project or template is deleted.
Note that while it is possible to assign permissions directly to an user, we encourage to use user groups and roles to do this. Also, role permissions are checked first before user permissions.
User created permissions
Users must already have a permission on a path before they can create a new permission on this path. We will have to perform more checks to make sure we cover all use cases here and everything is secure. Of course, users must have a permission for POST
/v3/permissions
in order to create new permissions and, for example, a permission for PUT and DELETE/v3/roles/{role_id}/permissions/*
to allow the user to assign permissions.SQL model
Here is our SQL model for those of you who are interested
Beta Was this translation helpful? Give feedback.
All reactions