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

Support for custom Permissions Policy HTTP header in Nginx #201

Closed
jessuppi opened this issue Apr 26, 2023 · 6 comments
Closed

Support for custom Permissions Policy HTTP header in Nginx #201

jessuppi opened this issue Apr 26, 2023 · 6 comments

Comments

@jessuppi
Copy link
Member

This is an issue we knew would eventually need to be discussed, and here it is being requested:

https://slickstack.io/forum/topic/feature-policy-header-blocking-camera-request

It gets to a bigger issue which is better support for "sub-config" files added under e.g. /etc/nginx/conf.d/ however, the official Nginx.com docs suggest feature-specific files which doesn't really apply to SlickStack since it's mostly just http... their docs suggest child config files for e.g. http, events, stream, etc.

Ref: https://docs.nginx.com/nginx/admin-guide/basic-functionality/managing-configuration-files/

I think we need to be even narrower than that for SlickStack. For example maybe featurepolicy.conf to focus specifically on that HTTP header, since other HTTP headers will likely remain hardcoded in SlickStack...

@jessuppi
Copy link
Member Author

jessuppi commented Apr 26, 2023

Since we are using a unique Nginx server blocks directory /var/www/sites/ we probably should ensure that any custom child config files are in a subdirectory there to avoid confusion.

For example like:

/var/www/sites/custom/

@jessuppi
Copy link
Member Author

I was going back on forth on this but I don't think custom is a good sudirectory name. It sounds like maybe users could replace default server blocks with their own but that's not true, it's just for Nginx includes only.

So I'm proceeding with calling this /var/www/sites/includes/

91ac5a6

After a few Google searches it looks like Roots Trellis uses a similar folder name nginx-includes so that's good, at least some similar naming helps the community.

Ref: https://roots.io/trellis/docs/nginx-includes/

Still pending integration with SlickStack installer scripts and the main Nginx config file...

@jessuppi
Copy link
Member Author

See here:

## pending testing ##
# include /var/www/sites/includes/featurepolicy.conf;

For better security/control perhaps we can include specific child includes only as they become approved by the community instead of just a wildcard include...

https://github.com/littlebizzy/slickstack/blob/master/modules/nginx/nginx-conf.txt

@jessuppi
Copy link
Member Author

https://forum.nginx.org/read.php?11,256135

Hi, you may use the include directive with some glob() pattern tricks

For instance, replace this

include /path/to/something/nonexisting.conf

with

include /path/to/something/nonexisting[.]conf

the config parser won't complain if such file does not exist.

Not sure if still relevant.

@jessuppi
Copy link
Member Author

@jessuppi jessuppi changed the title Support for custom feature policy HTTP header in Nginx Support for custom Permissions Policy HTTP header in Nginx Apr 10, 2024
@jessuppi
Copy link
Member Author

New default Permissions Policy submodule called perms-policy.conf

https://github.com/littlebizzy/slickstack/blob/master/modules/nginx/includes/perms-policy-conf.txt

You can now customize this in SlickStack. Simply edit your own file under /var/www/sites-includes/perms-policy.conf and SlickStack will validate that file during installation... if it's missing the string add_header Permissions-Policy then our default submodule will be installed in that file location instead.

Ref: https://github.com/littlebizzy/slickstack/blob/master/bash/ss-install-nginx-config.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant