Background
I need help setting up the firewall/routing rules to allow remote and local access to a Jellyfin server behind an Ngnix Reverse Proxy.
I have two sites connected through the cloud via a wireguard tunnel on routers running OpenWrt 23.05.5 as shown in the, redacted, diagram below:
I am able to get everything working using ip addresses, but this means that the connection between the Jellyfin client and the Jellyfin server is via http, which is less than ideal.
I have the Jellyfin Server behind an Ngix Proxy Manager reverse proxy, which allows https access at jf.example.com (redacted) and I'd like to use this domain name instead of using ip addresses.
Because the ip address setup works, the router and devices have connectivity with each other, so I just need to determine the correct firewall rules for using domain names.
I have two use-cases:
1. Access the Jellyfin server remotely via a wireguard tunnel
This use case is to allow the Remote Untrusted Device A at Site A on the guest vlan to access the Jellyfin server on the lan vlan at Site B.
I am able to get this working using ip addresses with the following Firewall Traffic Rules.
The firewall rule on Site A to route traffic from the Jellyfin client into the wireguard tunnel:
config rule
option name 'Allow-Site-B-Jellyfin'
option src 'guest'
option dest 'vpn_to_site_b'
list dest_ip '10.30.30.22'
option dest_port '8096'
option target 'ACCEPT'
list src_ip '10.10.10.10'
The firewall rule on Site B to route traffic from the wireguard tunnel to the Jellyfin server:
config rule
option name 'Allow-Site-A-Jellyfin'
option src 'vpn_to_site_a'
list src_ip '10.10.10.10'
option dest 'lan'
option target 'ACCEPT'
list dest_ip '10.30.30.22'
option dest_port '8096'
Unfrotunately. the Firewall Traffic Rules only accept CIDR notation and do not accept domain names, so I can not just substitute jf.example.com for 10.30.330.22.
I think that I need to use policy based routing (PBR), but I don't have any experience with it.
Question 1.1 : On Site A, do I install the luci-app-pbr package and create a policy to route from 10.10.10.10 to jf.example.com?
Question 1.2 : On Site B, do I create a firewall rule that routes 10.10.10.10 to the Nginx Proxy Manager ip address, 10.30.30.11?
Something like this:
config rule
option name 'Allow-Site-A-Jellyfin'
option src 'vpn_to_site_a'
list src_ip '10.10.10.10'
option dest 'lan'
option target 'ACCEPT'
list dest_ip '10.30.30.11'
Question 1.3: Is there anything else I need to do on Site B to prevent the remote device accessing any other reverse proxies on the Nginx Proxy Manager?
2. Access the Jellyfin server locally from an adjacent vlan
This is to allow the Local Untrusted Device B at Site B on the guest vlan to access to the Jellyfin server on the lan vlan at Site B.
I am able to get this working using ip addresses with the following Site B Firewall Traffic Rule.
config rule
option name 'Allow-Local-Jellyfin-Access'
option src 'guest'
list src_ip '10.20.20.20'
option dest 'lan'
option target 'ACCEPT'
option dest_port '8096'
list dest_ip '10.30.30.11'
PBR doesn't seem to be suitable to route to the lan vlan, but I may be wrong. So I'm not sure how to do this for domain names.
Question 2.1: How do I establish a jf.example.com connection from the local guest vlan?
I've also thought of using this rule to allow 10.20.20.20 access to the Nginx Proxy Manager ip address, but this allows access to all reverse proxies located there, not just jf.example.com, which is unacceptable. There may be a way to setup ports to restrict access to the Jellyfin server only, but it's not something I've investigated.
config rule
option name 'Allow-Local-Jellyfin-Access'
option src 'guest'
list src_ip '10.20.20.20'
option dest 'lan'
option target 'ACCEPT'
list dest_ip '10.30.30.22'