• Login
  • Register
  • Login Register
    Login
    Username/Email:
    Password:
    Or login with a social network below
  • Forum
  • Website
  • GitHub
  • Status
  • Translation
  • Features
  • Team
  • Rules
  • Help
  • Feeds
User Links
  • Login
  • Register
  • Login Register
    Login
    Username/Email:
    Password:
    Or login with a social network below

    Useful Links Forum Website GitHub Status Translation Features Team Rules Help Feeds
    Jellyfin Forum Support Guides, Walkthroughs & Tutorials HAproxy on PFSense GUI Guide with screenshots Webhooks and all

     
    • 0 Vote(s) - 0 Average

    HAproxy on PFSense GUI Guide with screenshots Webhooks and all

    gaming09
    Offline

    Member

    Posts: 67
    Threads: 24
    Joined: 2023 Jun
    Reputation: 1
    Country:United States
    #1
    2023-06-21, 06:41 PM (This post was last modified: 2024-12-01, 07:24 PM by gaming09. Edited 3 times in total.)
    *** Guide now Deprecated - updated guide HERE ***


    Edited: Added backend security update
    For whatever reason this has been a lot of trial and error and via pfsense HA gui doesn't always align to HAproxy config documentation
    For reverse proxy via HAproxy on PFSense this is what you need

    Backend: (Example 1.bmp)
    Your Jellyfin backend>Advanced Settings>Backend pass thru
    These 3 lines as is
    *** change JELLYFINLOCALIP with your local IP

    Code:
    http-request set-header X-Forwarded-Port %[dst_port]   
    http-request add-header X-Forwarded-Proto https if { ssl_fc }
    server jellyfin(or your backend name) JELLYFINLOCALIP:8096
    http-response set-header Access-Control-Allow-Origin https://YOURJFDOMAIN.com
    http-response set-header Cache-Control "no-cache, no-store, must-revalidate, private"
    http-response del-header Server

    [Image: GuawSed.png]

    Frontend (Example 2.bmp)
    Your Frontend>Default backend, access control lists and actions>Access Control lists>Table
    ***JF is my short-name to attach to the actions table to hit the backend for HA proxy change it to yours
    ***Change YOUR_PUBLIC_URL.com to your external URL
    Code:
    jf |  Custom ACL:  | hdr(host) -i YOUR_PUBLIC_URL.com
    host_ws | Host starts with: | ws. 
    hdr_connection_upgrade | Custom acl: | hdr(Connection) -i upgrade   
    hdr_upgrade_websocket  | Custom acl: | hdr(Upgrade) -i websocket

    [Image: ppaLTTc.jpg]

    I hope this helps someone else and saves them a few hours of logs (most of this was available on the jellyfin guide but it wasn't intuitive for the GUI
    https://jellyfin.org/docs/general/networking/haproxy/

    Maybe I have extra stuff in there, if I do let me know. As far as I can tell everything is working now without errors
    Stats:
    JF running on Unraid Docker
    Library Transcoded to h265 mkv via TDARR
    Ram Drive Transcode
    5950x
    a770
    60tb
    3
    DarthVegan
    Offline

    Junior Member

    Posts: 1
    Threads: 0
    Joined: 2023 Sep
    Reputation: 0
    Country:United States
    #2
    2023-09-26, 12:41 AM
    Nice writeup! Any chance you'd want to do it on OPNsense now? Grinning-face
    SKECHER9
    Offline

    Junior Member

    Posts: 2
    Threads: 0
    Joined: 2024 Jan
    Reputation: 0
    Country:United States
    #3
    2024-01-17, 04:15 PM
    I am trying to understand the ssl/tls process. It is new to me and if I get something wrong I'd appreciate being corrected.
    Question 1: If I'm reading this right, your guide tells HAproxy plugin on the PFsense router to pass-through the whole request of "https://YOURJFDOMAIN.com" to the JF server, and the JF server handles everything for the TLS handshake?
    I'd seen people give examples of having the reverse proxy service caddy and nginx (no clue if haproxy has similar function) in order to force proper security.
    Question 2: Are there more benefits beyond forcing a more secure TLS handshake with HAproxy handling the tls handshake, or would there be other security concerns on the back end to the JF server?
    TheDreadPirate
    Offline

    Community Moderator

    Posts: 15,375
    Threads: 10
    Joined: 2023 Jun
    Reputation: 460
    Country:United States
    #4
    2024-01-17, 06:14 PM (This post was last modified: 2024-01-17, 06:14 PM by TheDreadPirate.)
    (2024-01-17, 04:15 PM)SKECHER9 Wrote: I am trying to understand the ssl/tls process. It is new to me and if I get something wrong I'd appreciate being corrected.
    Question 1: If I'm reading this right, your guide tells HAproxy plugin on the PFsense router to pass-through the whole request of "https://YOURJFDOMAIN.com" to the JF server, and the JF server handles everything for the TLS handshake?
    I'd seen people give examples of having the reverse proxy service caddy and nginx (no clue if haproxy has similar function) in order to force proper security.


    Reverse proxies, in general, handle the TLS handshake and pass the usually unencrypted request to the "upstream" server.

    (1970-01-20, 05:45 PM)SKECHER9 Wrote: Question 2: Are there more benefits beyond forcing a more secure TLS handshake with HAproxy handling the tls handshake, or would there be other security concerns on the back end to the JF server?

    Jellyfin is not hardened.  It makes no claims at being secure.

    The reason for using a reverse proxy is because there are exploits and attacks that target the TLS handshake process.  Not necessarily Jellyfin itself.  And the majority of proper reverse proxies/http servers are hardened against these handshake attacks.  Additionally, Jellyfin provides no way to restrict what TLS/SSL protocols are allowed, what ciphers are allowed, or many many other TLS/SSL properties.  But nginx/haproxy/apache/caddy allow you to restrict, for example, the version of TLS to 1.2 or newer.  Or to only use ciphers that aren't vulnerable to attacks that weaken them.  Or ciphers that are resistant to hypothetical future quantum computers.

    The wiki for TLS has a section about security that provides some examples of security issues that Jellyfin has no way to mitigate without a reverse proxy.

    https://en.wikipedia.org/wiki/Transport_...y#Security

    Additionally, I wrote a guide to configure Apache and Nginx to only use the strongest, most secure, available encryption ciphers and protocols.

    https://forum.jellyfin.org/t-apache-ngin...ls-ciphers
    Jellyfin 10.10.7 (Docker)
    Ubuntu 24.04.2 LTS w/HWE
    Intel i3 12100
    Intel Arc A380
    OS drive - SK Hynix P41 1TB
    Storage
        4x WD Red Pro 6TB CMR in RAIDZ1
    [Image: GitHub%20Sponsors-grey?logo=github]
    1
    SKECHER9
    Offline

    Junior Member

    Posts: 2
    Threads: 0
    Joined: 2024 Jan
    Reputation: 0
    Country:United States
    #5
    2024-01-18, 05:57 PM (This post was last modified: 2024-01-19, 02:45 AM by SKECHER9. Edited 1 time in total.)
    Ok got it, thanks TheDreadPirate. Was racking my brain on understanding this process, and was having trouble with the HAproxy setup. Got setup to enforce "modern" only TLS v1.3 and AEAD ciphers.
    Since I found a solution to the setup I was struggling with for pfSense router ACME and HAProxy forwarding to my Jellyfin server, here is what walked me through.
    This guide from Lawrence Systems on YouTube does a good job at explaining the setup. https://youtu.be/bU85dgHSb2E?si=J8C1Zo3N4RawYW1z
    In their example though, they don't connect to the outside internet (he gives a simple explanation on what to switch to do so) and they use the self signed cert to encrypt back end for TrueNAS. I think it should be simple enough to set a self signed cert for back end with JF even if it's unnecessary.

    Edit: After some testing with help from a friend. An important setting to check to enable logging for Fail2ban on Jellyfin's side is "forwardfor" under pfSense's HAProxy Frontend rules, whatever front end rule is listening outword, under "Advanced settings" "forwardfor" option creates an HTTP "X-Forwarded-For" header which contains the client's IP address. This is useful to let the final web server know what the client address was. (eg for statistics on domains)
    --For others who may come back to read this setup, a plain English explanation "forwardfor" lets the jellyfin server on the backend know the external client's IP address. If "forwardfor" is not enabled all external traffic will appear to your Jellyfin server like the client traffic is coming from your router. So then the Jellyfin logs, and therefor the logs Fail2ban, would read (assuming you followed the setup on the Jellyfin docs) that your router failed access and may be blocked.
    2
    cooljimy84
    Offline

    Junior Member

    Posts: 1
    Threads: 0
    Joined: 2024 Feb
    Reputation: 0
    Country:United Kingdom
    #6
    2024-02-12, 05:06 PM
    In Opnsense this setting is in HAProxy under

    Services: HAProxy: Settings
    Virtual Services (then click the down arrow to the side and select)
    Public Services

    Last option under "HTTP(S) settings" is the "X-Forwarded-For header

    Enable insertion of the X-Forwarded-For header to requests sent to servers."
    Icepick869
    Offline

    Junior Member

    Posts: 2
    Threads: 0
    Joined: 2024 Oct
    Reputation: 0
    Country:United States
    #7
    2024-10-16, 02:27 AM
    I can't really tell if I did something stupid or if the guide is outdated due to updates to HAProxy and/or PFSense, but I could really use some help. (BTW, this was the most understandable guide I've found, so thank you!)

    I followed the guide for the backend and frontend to set up the HAProxy, but it isn't getting through the PFSense to my jellyfin server. The server works and the DNS cuts back to my IP (I was getting a DNS rebinding warning until I changed the GUI port). It seems like the HAProxy isn't answering on 80 or 443 and I can't tell if the frontend is even getting the request.

    Here are the frontend settings:
       
    I've tried changing the port to 443 or 8920. No joy there.
       
    The domainname used in the first value is the FQDN used in the DNS.
       
    I've tried this with none as well since it wasn't mentioned in the guide, but that just grayed out the backend as not being used.

    The backend actually seemed the most straightforward:
    http-request set-header X-Forwarded-Port %[dst_port]   
    http-request add-header X-Forwarded-Proto https if { ssl_fc }
    server jellyfin 192.168.1.52:8096
    http-response set-header Access-Control-Allow-Origin https://[FQDN as listed in DNS]
    http-response set-header Cache-Control "no-cache, no-store, must-revalidate, private"
    http-response del-header Server

    Am I supposed to have added Firewall rules? This seems like the most likely mistake I could have made.

    If there is any other info I've missed let me know.
    alleycat
    Offline

    Member

    Posts: 69
    Threads: 19
    Joined: 2024 Sep
    Reputation: 0
    Country:United States
    #8
    2024-10-16, 05:15 AM
       

    Did you open port 443 in Firewall rules for HAproxy?
    Jellyfin 10.10.7 (bare metal)
    Ubuntu 24.04.2 LTS, OS 1TB NVMe
    Dell OptiPlex 7050 Intel i7-6700 32GB ram
    Intel Arc A310 ELF
    Storage: TrueNas Mini R Raidz2 45 TiB (Samba shares)
    Gateway: PFsense/HAproxy

    Icepick869
    Offline

    Junior Member

    Posts: 2
    Threads: 0
    Joined: 2024 Oct
    Reputation: 0
    Country:United States
    #9
    2024-10-16, 10:37 PM (This post was last modified: 2024-10-16, 10:39 PM by Icepick869. Edited 1 time in total.)
    (2024-10-16, 05:15 AM)alleycat Wrote: Did you open port 443 in Firewall rules for HAproxy?

    I had not, but now that I have it still isn't working. Thanks for the suggestion! It's the sort of thing I expect it to be, but apparently not quite the solution.

    I just had a thought. I'm running VLANs, but don't see anything pointing to the correct VLAN for the server.
    alleycat
    Offline

    Member

    Posts: 69
    Threads: 19
    Joined: 2024 Sep
    Reputation: 0
    Country:United States
    #10
    2024-10-17, 12:59 PM
    (2024-10-16, 10:37 PM)Icepick869 Wrote:
    (2024-10-16, 05:15 AM)alleycat Wrote: Did you open port 443 in Firewall rules for HAproxy?

    I had not, but now that I have it still isn't working. Thanks for the suggestion! It's the sort of thing I expect it to be, but apparently not quite the solution.

    I just had a thought. I'm running VLANs, but don't see anything pointing to the correct VLAN for the server.

    Instead of me posting a ton of screen shots here, I suggest watching Tom Lawrence's YT video on this, (you may have seen it already). I'm exposing three of my servers to the WAN with success including Jellyfin, but I had to watch it many times myself, lol.

    https://youtu.be/gVOEdt-BHDY
    Jellyfin 10.10.7 (bare metal)
    Ubuntu 24.04.2 LTS, OS 1TB NVMe
    Dell OptiPlex 7050 Intel i7-6700 32GB ram
    Intel Arc A310 ELF
    Storage: TrueNas Mini R Raidz2 45 TiB (Samba shares)
    Gateway: PFsense/HAproxy

    « Next Oldest | Next Newest »

    Users browsing this thread: 1 Guest(s)


    • View a Printable Version
    • Subscribe to this thread
    Forum Jump:

    Home · Team · Help · Contact
    © Designed by D&D - Powered by MyBB
    L


    Jellyfin

    The Free Software Media System

    Linear Mode
    Threaded Mode