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

Feature: Support Basic authentication and Bearer Token authorization for a connection to Frigate server #52

Closed
freefd opened this issue May 12, 2024 · 4 comments · Fixed by #58
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@freefd
Copy link
Contributor

freefd commented May 12, 2024

Sometimes Frigate and frigate-notify may not be placed in the same non-auth segment, but both can access the MQTT bus. And then we can assume that the Frigate API is protected by some type of auth (e.g., behind a reverse proxy, or we can imagine that Auth! MR is already implemented).
Since frigate-notify uses the net/http package to handle HTTP requests, we can easily implement Basic authentication and authorization based on the static Bearer Token header (generated externally).

Basic Auth description: https://pkg.go.dev/net/http#Request.BasicAuth + https://pkg.go.dev/net/http#Request.SetBasicAuth
Bearer Token description: https://swagger.io/docs/specification/authentication/bearer-authentication/

Thank you.

@0x2142 0x2142 self-assigned this May 13, 2024
@0x2142 0x2142 added the enhancement New feature or request label May 13, 2024
@0x2142 0x2142 added this to the v0.2.8 milestone May 13, 2024
@blakeblackshear
Copy link

The implementation in the PR changed a bit. Port 5000 access will remain unauthenticated and is designed to be only exposed internally to other services in the compose file or selectively opened as needed. The new 8080 port is where auth will be enforced and where reverse proxies meant for external access will be pointed.

@blakeblackshear
Copy link

Happy to make changes on the Frigate side to make implementing auth more seamless for cases where frigate and frigate-notify aren't on the same machine.

@freefd
Copy link
Contributor Author

freefd commented May 15, 2024

Port 5000 access will remain unauthenticated and is designed to be only exposed internally

Good point, thanks a lot!
Sounds like the frigate-notify might require separated Frigate endpoints configuration options:

  1. Non-auth endpoint for m2m talks with Frigate, for example: https://github.com/0x2142/frigate-notify/blob/main/events/mqtt.go#L108
  2. External auth-based endpoint, exposed in notifications towards the end user, for example: https://github.com/0x2142/frigate-notify/blob/main/events/events.go#L58-L62

@0x2142
Copy link
Owner

0x2142 commented May 15, 2024

Hey there @blakeblackshear - Thanks for sharing! That's great to know & will be helpful in addressing this.

So at the moment, I am working allowing the ability to configure additional arbitrary headers send to Frigate which should cover the initial request. And as suggested by @freefd, I'll go ahead and add a new config for an external/public URL to get ready for when that change is live in Frigate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants