this post was submitted on 15 Jun 2023
9 points (100.0% liked)

Selfhosted

40348 readers
509 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
 

So, I have been playing with Nginx (and it's pretty awesome).

My homelab has several VLANs, including a "management" VLAN where my networking equipment lives.

Mine (and my families) personal devices are mainly on our "LAN" VLAN, which can see everything by default, except only certain devices (my laptop and PC) are allowed to see the management network.

The problem I've run into, is that if I setup a proxy for, say my Pi Hole, then all devices on my LAN VLAN can access it, regardless of whether or not they are a part of my mgmt_approved alias (I guess this is a bit expected).

I am wondering what the best way to limit certain devices from accessing specific proxies may be. I see that you can limit them on the Nginx side like so , however I'd prefer to have access rules defined on my firewall (current rules for LAN VLAN).

It seems like once something is allowed to communicate with NGINX, it will be able to access whatever NGINX gives permissions to, and further firewall rules do not matter since traffic will then be going through the proxy.

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 7 points 1 year ago* (last edited 1 year ago) (1 children)

You'll have to use nginx's ACL feature. Like you've discovered once someone has access to the proxy itself, by its very nature it's acting on behalf of the client making the request so firewall rules won't help much there. You'd have to get into packet inspection, and deal with https man in the middle stuff and all that, likely not worth it.

I'm not familiar with nginx proxy manager which you seem to be using but in the config files it'd look like this:

nginx.conf

location / {

    include /etc/nginx/acl_file_name.acl;
    deny all;

   # rest of location config

}

the deny all; at the end means everything that wasn't listed in the ACL file is denied. You could alternatively put the deny all directly in the acl file at the end of the file.

the acl file itself is just a list, i create it in a file for easy re-use, and made up the ".acl" extension because it makes sense.

acl_file_name.acl

allow 192.168.1.0/24;
allow 192.168.2.101;
[–] root 3 points 1 year ago* (last edited 1 year ago)

Thanks for the reply! Yeah, I just tried the ACL in NGINX, and it seems to work fine. I can still ping the proxied services, but cannot connect to them. I guess I will maintain a seperate mgmt_allowed list there. Thanks again!