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

Basic scriptlet-based authorizer #188

Open
stgraber opened this issue Oct 22, 2023 · 11 comments
Open

Basic scriptlet-based authorizer #188

stgraber opened this issue Oct 22, 2023 · 11 comments
Assignees
Labels
API Changes to the REST API Documentation Documentation needs updating Feature New feature, not a bug
Milestone

Comments

@stgraber
Copy link
Member

stgraber commented Oct 22, 2023

We now have OpenFGA for fine grained access control, but not everyone needs to run a full authorization server and for simpler cases, it could be very useful to have a basic built-in option that can still be very flexible.

I'm thinking of a new authorization.scriptlet server config key which takes a scriplet that would then be called with some user context, object context and action and have the ability to allow or deny the request.

@stgraber stgraber added the Feature New feature, not a bug label Oct 22, 2023
@stgraber stgraber added this to the incus-0.3 milestone Nov 1, 2023
@sharathsivakumar
Copy link
Contributor

@stgraber I would be interested to work on this.

@stgraber
Copy link
Member Author

Sounds good!

@stgraber stgraber modified the milestones: incus-0.3, incus-0.4 Nov 24, 2023
@stgraber stgraber added Documentation Documentation needs updating API Changes to the REST API labels Nov 28, 2023
@stgraber stgraber removed this from the incus-0.4 milestone Dec 19, 2023
@hi-ko
Copy link

hi-ko commented Feb 28, 2024

I would be happy to test on this. I guess such a script hook would open for much more scenarios to use incus as remote image server having something like a voter script which could then access external services like ldap or db to block or allow access. Are you thinking of a shell script or a Go construct?

@stgraber
Copy link
Member Author

We're looking at using a scriptlet which is already a technology we use for our scheduler.
Those scriptlets are python looking scripts that are run inside of a safe environment directly within the Go daemon.

This uses go-starlark from Google.

@stgraber stgraber added this to the soon milestone Mar 8, 2024
@stgraber
Copy link
Member Author

Unassigning due to lack of activity.

@christina-zh
Copy link

Im interested in working on this issue, can I be assigned to it please?

@stgraber
Copy link
Member Author

Probably best to tackle last in the current batch of stuff assigned to you as that's a bit trickier than the others. But #652 should help you get familiar with some of that stuff already.

This will need a new kind of scriptlet be defined in internal/server/scriptlet. It will also need a new server configuration key authorization.scriptlet to be added.

The basic infrastructure you can do with:

  • Add an API extension, let's call it authorization_scriptlet
  • Add the new config key in internal/server/cluster/config/config.go
  • Re-generate the documentation keys with make update-metadata
  • Add the new scriptlet definition to internal/server/scriptlet
  • Add the new authorizer to internal/server/auth
  • Add the needed glue (handle the new config key) to cmd/incusd/daemon.go and cmd/incusd/api_1.0.go

@stgraber
Copy link
Member Author

stgraber commented May 9, 2024

@christina-zh hello, do you still intend to work on this one or should I clear the assignee?

@christina-zh
Copy link

hi @stgraber , our group might not have the time to continue working on this issue. You could clear the assignee. Thank you for your help!

@bensmrs
Copy link
Contributor

bensmrs commented Oct 31, 2024

Hi! I’d like to work on this.

@stgraber
Copy link
Member Author

There you go!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Changes to the REST API Documentation Documentation needs updating Feature New feature, not a bug
Development

No branches or pull requests

5 participants