-
-
Notifications
You must be signed in to change notification settings - Fork 803
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
Disallow access in publicly exposed services #1761
Disallow access in publicly exposed services #1761
Conversation
Fixed those notes. I also can't get the server to start with this patch. It looks like cfg.GetSecurityTripwire(...) is always true. Can't figure that one out. Also, the server doesn't seem to exit, simply hang and not answer requests. Which has me thinking, should we just not shut down the server, but instead 403 every request after the tripwire is blown? |
287c1b6
to
292d18b
Compare
I've stopped the server from shutting down, now it just closes the database and returns every request with a little snippet about what's happening. I figure this will stop support requests for "My server crashed for no reason and I can't be bothered to read the logs" I still have the problem with it being triggered all of the time. I don't know how the config options work well enough to fix this. Also it seems that if the config file is missing, it triggers too. |
I've fixed the last few bugs and tested it. It seems all good now. The protection is not applied to the first-time setup, but I think that's fine. |
@gitgiggety moving to comments for visibility. I agree. I've added a trusted proxies section, and am allowing proxy chains from the local network by default. They still don't allow access from endpoints on the public internet. This should prevent the cases you've mentioned, such as leaving a reverse proxy exposed accidentally (provided it send X-FORWARDED-FOR). It also prevents spoofing x-forwarded-for to bypass the protection. @WithoutPants when this is merged, is it possible to make a backported 0.9.1 release with just this? I don't have exact numbers but a decent chunk, maybe most, of affected instances ran the latest stable, so it's hopeful to assume they'd take a point release too, protecting them. |
Fixed an issue where access from 127.0.0.1 was blocked. Here's my testcases for this PR, I used curl to simulate the proxy headers.
|
- Change trustedProxies to string slice - Change tripwire config to the IP that triggered it - Move external access check code to session package - Move authentication handler to separate file - Add startup check and log if tripwire is active
I've done a bit of refactoring on the new code:
I have updated the wiki page to be consistent with the new behaviour. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New changes staticly reviewed reviewed but not tested, approved.
Where in the config.yml file should the I tried to access my stash remotely using Tailscale as recommended here, but it didn't work. Then I think I removed |
Several in-the-wild unprotected stash instances have been found, disclosing their contents on the public internet.
This patch tries to prevent that from being possible. When a request is received from an IP that is not a private network and authentication is not enabled, it logs details, blows a tripwire, and shuts down the server to protect the data. Stash will not start again until a config option,
security_tripwire_accessed_from_public_internet
is changed.Users of external auth can set
dangerous_allow_public_without_auth
totrue
to continue using their setups.Also created for reference: https://github.com/stashapp/stash/wiki/Authentication-Required-When-Accessing-Stash-From-the-Internet