OPNsense
  • Home
  • Help
  • Search
  • Login
  • Register

  • OPNsense Forum »
  • Archive »
  • 21.7 Legacy Series »
  • Nginx WAF SNI forwarding
« previous next »
  • Print
Pages: [1]

Author Topic: Nginx WAF SNI forwarding  (Read 3744 times)

steilfirn_8000

  • Jr. Member
  • **
  • Posts: 56
  • Karma: 0
    • View Profile
Nginx WAF SNI forwarding
« on: January 02, 2022, 01:27:08 pm »
Hello everyone,

I tried enabling the Nginx WAF for my webservers.
Unfortunately my main webserver which hosts a couple of sites only shows an error message that no SNI is provided.

Within the location tab I have enabled that TLS SNI forward option - still no luck.


Any ideas?
Logged

Fright

  • Hero Member
  • *****
  • Posts: 1777
  • Karma: 164
    • View Profile
Re: Nginx WAF SNI forwarding
« Reply #1 on: January 02, 2022, 04:45:17 pm »
Hi
try to set your backend SNI in "TLS: Servername override" field in Upstream settings
Logged

steilfirn_8000

  • Jr. Member
  • **
  • Posts: 56
  • Karma: 0
    • View Profile
Re: Nginx WAF SNI forwarding
« Reply #2 on: January 02, 2022, 06:06:01 pm »
Thanks for the info but unfortunately this also does not work.
I get a 403 Forbidden: You don't have permission to access this resource.Reason: The client software did not provide a hostname using Server Name Indication (SNI), which is required to access this server.
Logged

Fright

  • Hero Member
  • *****
  • Posts: 1777
  • Karma: 164
    • View Profile
Re: Nginx WAF SNI forwarding
« Reply #3 on: January 02, 2022, 07:28:53 pm »
should definitely work (i use several servers with a similar configuration - the backend requires SNI). specified options should give
Code: [Select]
    proxy_ssl_server_name on;
    proxy_ssl_name *backend sni hostname*;
lines in the location part of nginx.conf.

you can use "Packet Capture" to check the SNI extension value on SSL handshake
Logged

steilfirn_8000

  • Jr. Member
  • **
  • Posts: 56
  • Karma: 0
    • View Profile
Re: Nginx WAF SNI forwarding
« Reply #4 on: January 02, 2022, 07:57:45 pm »
Can you tell me where to find find the nginx config file?
Logged

Fright

  • Hero Member
  • *****
  • Posts: 1777
  • Karma: 164
    • View Profile
Re: Nginx WAF SNI forwarding
« Reply #5 on: January 02, 2022, 08:03:22 pm »
/usr/local/etc/nginx/nginx.conf
Logged

steilfirn_8000

  • Jr. Member
  • **
  • Posts: 56
  • Karma: 0
    • View Profile
Re: Nginx WAF SNI forwarding
« Reply #6 on: January 02, 2022, 08:35:51 pm »
Thanks - I just checked the config file you've mentioned but the mentioned parameters
```
    proxy_ssl_server_name on;
    proxy_ssl_name *backend sni hostname*;
```
are not there.

Is this something that the GUI will set when I enable something or do I have to add them manually?
Logged

Fright

  • Hero Member
  • *****
  • Posts: 1777
  • Karma: 164
    • View Profile
Re: Nginx WAF SNI forwarding
« Reply #7 on: January 02, 2022, 08:44:12 pm »
Quote
Is this something that the GUI will set when I enable something or do I have to add them manually?
should work from gui. may indicate that the settings were not applied for some reason.
Logged

steilfirn_8000

  • Jr. Member
  • **
  • Posts: 56
  • Karma: 0
    • View Profile
Re: Nginx WAF SNI forwarding
« Reply #8 on: January 02, 2022, 09:01:24 pm »
Interessting:

If I edit `proxy_ssl_name *backend sni hostname*;` and just restart Nginx service then the proxy works out of the box - if I reload it via the tiny reload button the config is gone and the proxy stops working.

Do you know where this parameter is being shown in the GUI?
Logged

Fright

  • Hero Member
  • *****
  • Posts: 1777
  • Karma: 164
    • View Profile
Re: Nginx WAF SNI forwarding
« Reply #9 on: January 02, 2022, 09:06:48 pm »
Quote
where this parameter is being shown in the GUI?
"TLS: Servername override" field in Upstream settings
yes, in gui it is located in the upstream parameters.
when applying parameters, the template takes these settings from the upstream parameters and applies them to the location configuration
Logged

steilfirn_8000

  • Jr. Member
  • **
  • Posts: 56
  • Karma: 0
    • View Profile
Re: Nginx WAF SNI forwarding
« Reply #10 on: January 02, 2022, 09:18:31 pm »
Thanks FINALY I got it running!

Are there any kind of "best practice" things I should keep in mind?
Logged

Fright

  • Hero Member
  • *****
  • Posts: 1777
  • Karma: 164
    • View Profile
Re: Nginx WAF SNI forwarding
« Reply #11 on: January 03, 2022, 05:35:36 am »
glad it worked!
i don’t think the best practices are different from the nginx best practices  ;)
Logged

steilfirn_8000

  • Jr. Member
  • **
  • Posts: 56
  • Karma: 0
    • View Profile
Re: Nginx WAF SNI forwarding
« Reply #12 on: January 03, 2022, 06:51:53 am »
To be honest: My regular webservers are Apache2 - I have never used Nginx before.
But yesterday I found already an issue: My Matrix user was no longer able to decrypt my messages.

So I had to revert it (again) and need to investigate that as soon as I have spare time again.
Logged

  • Print
Pages: [1]
« previous next »
  • OPNsense Forum »
  • Archive »
  • 21.7 Legacy Series »
  • Nginx WAF SNI forwarding
 

OPNsense is an OSS project © Deciso B.V. 2015 - 2024 All rights reserved
  • SMF 2.0.19 | SMF © 2021, Simple Machines
    Privacy Policy
    | XHTML | RSS | WAP2