[Support] Linuxserver.io - SWAG - Secure Web Application Gateway (Nginx/PHP/Certbot/Fail2ban)


Recommended Posts

6 hours ago, sjaak said:

is here someone who got SWAG fully working on IPv6? i trying to get it working but after view weeks of trail and error i'm out of idea's...

Docker is fully working on IPv6, can confirm this. i have a tor relay running on unraid/docker and it external accessible through IPv6...

SWAG does have an working IPv6 address. but Cloudflare won't get connection to SWAG on IPv6, resulting many times with error 522

 

i did some research on nginx with ipv6, its needs '--with-ipv6'? when checking on SWAG with the command: nginx -V it gives me the following configure arguments:

 

no --with-ipv6 in there...

anyone have in idea what i can do???

 

You can't add it yourself. We use the packages from the alpine repo.

Link to comment

Hey All,

 

Im trying a get a custom web server running with swag and i'm having some dramas upstanding the documentation so i was wondering if i could get some help..

I have set up multiple reverse proxies but never hosted my own html.

 

I have created a .html file id like to host with my own sub-domain. As far as i understand i should move my html files into /config/www folder and in site-confs folder i should have a config file that points to said config/www folder. Within said conf file I should have which subdomain swag should be pointing too. 

 

Im not really sure if im missing anything or if my config file is correct or not. 

 

Does anyone have any guides or documentation that could help.

 

Regards,

 

Justin

Link to comment
33 minutes ago, Melawen said:

Looks like you have your ports the wrong way round on your router.  The external ports should be 80 & 443 and the internal ones should be 180 & 1443.

 

You might also want to hide your actual IP address in the images above.

Thanks a lot. You were right, everything works perfectly now.

Link to comment
On 4/25/2021 at 3:26 AM, saarg said:

Everything.

You have switched value and key and also remove =. Default value is also not -e. Just leave it blank.

 

On 4/25/2021 at 7:05 AM, Greygoose said:

 

Thank you,

 

I now have it working because of you help.

 

Much appreciated.

I too have this working now. 

 

Thank you

Link to comment

I set up Swag recently and have 2 domains set up with Let's Encrypt. Things have been running fine and then, today, I try and access my Nextcloud and I can't. I checked the Swag logs and see this:  

  

There were too many requests of a given type :: Error creating new order :: too many certificates (5) already issued for this exact set of domains in the last 168 hours

 

I understand there's a rate limit but why would this have been exceeded? I haven't done anything to cause more cert to get issued. I set up Swag, checked that it worked, and that was it. What am I missing here?

Link to comment

I apologize for the long post, running into two issues. I'll start with my main, more important one since it's a security issue. 

 

I have SWAG set up on my unRAID box and it seems to run fine, except for the fact I can't get it to work correctly for it's main purpose. I have a few docker containers I have going through SWAG, but to access them, I have to punch a hole through my firewall for them, and include the port in the address. My address for Home Assistant, for example, would end up looking like http://ha.mydomain.com:8123. I know this is a big hole I leave in my network, and the reason SWAG exists, but I can't seem to get the set up for this correct, and the documentation I can find doesn't seem to help. My end goal is to patch up the holes I put in my firewall, and clean up the address so the above link would appear as https://ha.mydomain.com instead. 

 

I'm not sure what all I should include to help diagnose my issue, but I'm more than willing to provide my set up.

 

-------

 

My second issue, I ran into while attempting to get the first issue fixed. Whenever I attempt to access a site, I can't access it within my own network (ex, while I'm on my desktop, or connected to Wi-Fi), but I can access it if I'm not on my network (ex, mobile data, friend's Wi-Fi).

 

I'm not quite sure why this ended up happening, but again, whatever you guys need out of my set up to help diagnose it, I'll be more than happy to provide.

 

Thanks in advance and again, I apologize for the giant wall of text.

Link to comment

Hi all - I'm having difficulty troubleshooting what looks like a port forwarding issue.

 

My SWAG reverse proxy was working fine until a week ago. I was getting BTRFS errors in my docker.img, so deleted it and created from new. After reloading my apps, I noticed my reverse proxy was not working anymore.

 

In my SWAG logs, I saw this error:

 

int: The Certificate Authority failed to download the challenge files from the temporary standalone webserver started by Certbot on port 80. Ensure that the listed domains point to this machine and that it can accept inbound connections from the internet.

Some challenges have failed.
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.
ERROR: Cert does not exist! Please see the validation error above. The issue may be due to incorrect dns or port forwarding settings. Please fix your settings and recreate the container

 

My port forwarding seemed to be correct for port 80 (to 180) and port 443 (to 1443) as per my SWAG docker template. I went to a number of port testing sites, and they all showed blocked for 80 and 443.

 

So at this point I contacted my ISP (Bell Canada) and they said they have not changed anything.

 

Where should I go now to figure this out? Thanks all.

Link to comment
On 6/27/2021 at 3:03 AM, Cytomax said:

So i figured it out... 

1.16.0-ls67 and 1.16.0-ls68 dont work for me

1.16.0-ls66 does work for me...

 

I have a very basic setup and I've just experienced this as well - all sites returning:

 

refused to connect.

 

Nothing logged in access.log or error.log

 

something broke between:

1.17.0-ls70 and

1.17.0-ls71

 

For anyone else seeing this, edit swag docker and change repo to:

 

linuxserver/swag:1.17.0-ls70

 

edit: Don't do the above, instead rename:

swag/nginx/proxy-confs/youtube-dl.subfolder.conf

 

to this

swag/nginx/proxy-confs/youtube-dl.subfolder.conf-notused

 

(unless you do actually use this config file, in which case remove the line containing:

proxy_redirect  off;

 

Edited by jortan
  • Thanks 1
Link to comment

After updating to 1.17.0-ls71 SWAG doen't start:

nginx: [emerg] "proxy_redirect" directive is duplicate in /config/nginx/proxy-confs/debianbullseye.subdomain.conf:36
nginx: [emerg] "proxy_redirect" directive is duplicate in /config/nginx/proxy-confs/debianbuster.subdomain.conf:36
nginx: [emerg] "proxy_redirect" directive is duplicate in /config/nginx/proxy-confs/ferdi-client.subdomain.conf:36
nginx: [emerg] "proxy_redirect" directive is duplicate in /config/nginx/proxy-confs/onlyoffice.subdomain.conf:22

 

i have to commenting out "proxy_redirect" in my all *.subdomain.conf to get SWAG work.

  • Thanks 2
Link to comment
2 hours ago, sonic6 said:

After updating to 1.17.0-ls71 SWAG doen't start:


nginx: [emerg] "proxy_redirect" directive is duplicate in /config/nginx/proxy-confs/debianbullseye.subdomain.conf:36
nginx: [emerg] "proxy_redirect" directive is duplicate in /config/nginx/proxy-confs/debianbuster.subdomain.conf:36
nginx: [emerg] "proxy_redirect" directive is duplicate in /config/nginx/proxy-confs/ferdi-client.subdomain.conf:36
nginx: [emerg] "proxy_redirect" directive is duplicate in /config/nginx/proxy-confs/onlyoffice.subdomain.conf:22

 

i have to commenting out "proxy_redirect" in my all *.subdomain.conf to get SWAG work.

i get similar errors since last update which stops SWAG from staring up

nginx: [emerg] "proxy_redirect" directive is duplicate in /config/nginx/proxy-confs/youtube-dl.subfolder.conf:22
nginx: [emerg] "proxy_redirect" directive is duplicate in /config/nginx/proxy-confs/youtube-dl.subfolder.conf:22
nginx: [emerg] "proxy_redirect" directive is duplicate in /config/nginx/proxy-confs/youtube-dl.subfolder.conf:22
nginx: [emerg] "proxy_redirect" directive is duplicate in /config/nginx/proxy-confs/youtube-dl.subfolder.conf:22
nginx: [emerg] "proxy_redirect" directive is duplicate in /config/nginx/proxy-confs/youtube-dl.subfolder.conf:22
nginx: [emerg] "proxy_redirect" directive is duplicate in /config/nginx/proxy-confs/youtube-dl.subfolder.conf:22

 

Link to comment
38 minutes ago, bastl said:

i get similar errors since last update which stops SWAG from staring up


nginx: [emerg] "proxy_redirect" directive is duplicate in /config/nginx/proxy-confs/youtube-dl.subfolder.conf:22
nginx: [emerg] "proxy_redirect" directive is duplicate in /config/nginx/proxy-confs/youtube-dl.subfolder.conf:22
nginx: [emerg] "proxy_redirect" directive is duplicate in /config/nginx/proxy-confs/youtube-dl.subfolder.conf:22
nginx: [emerg] "proxy_redirect" directive is duplicate in /config/nginx/proxy-confs/youtube-dl.subfolder.conf:22
nginx: [emerg] "proxy_redirect" directive is duplicate in /config/nginx/proxy-confs/youtube-dl.subfolder.conf:22
nginx: [emerg] "proxy_redirect" directive is duplicate in /config/nginx/proxy-confs/youtube-dl.subfolder.conf:22

 

same here.

Link to comment
11 hours ago, Marioawe said:

I apologize for the long post, running into two issues. I'll start with my main, more important one since it's a security issue. 

 

I have SWAG set up on my unRAID box and it seems to run fine, except for the fact I can't get it to work correctly for it's main purpose. I have a few docker containers I have going through SWAG, but to access them, I have to punch a hole through my firewall for them, and include the port in the address. My address for Home Assistant, for example, would end up looking like http://ha.mydomain.com:8123. I know this is a big hole I leave in my network, and the reason SWAG exists, but I can't seem to get the set up for this correct, and the documentation I can find doesn't seem to help. My end goal is to patch up the holes I put in my firewall, and clean up the address so the above link would appear as https://ha.mydomain.com instead. 

 

I'm not sure what all I should include to help diagnose my issue, but I'm more than willing to provide my set up.

 

-------

 

My second issue, I ran into while attempting to get the first issue fixed. Whenever I attempt to access a site, I can't access it within my own network (ex, while I'm on my desktop, or connected to Wi-Fi), but I can access it if I'm not on my network (ex, mobile data, friend's Wi-Fi).

 

I'm not quite sure why this ended up happening, but again, whatever you guys need out of my set up to help diagnose it, I'll be more than happy to provide.

 

Thanks in advance and again, I apologize for the giant wall of text.

You have not configured your proxy-confs correctly if you have to use the port. The container needs to have the same name as in upstream_app in the proxy conf and all lowercase. You also need to remove the sample part from the file name.

For this to work you need to create a custom bridge and add swag and set all the containers you reverse proxy to use that bridge.

As it is now you are not going through Swag.

 

The second issue has nothing to do with swag, but your router. You need to find out if it supports hairpinning or split DNS.

 

Do you get the default welcome page if you just go to your domain?

Link to comment

Same errors as above, proxy sites worked late yesterday but after an overnight update getting the following (example) and no sites reachable:

 

nginx: [emerg] "proxy_redirect" directive is duplicate in /config/nginx/proxy-confs/freshrss.subdomain.conf:38

Link to comment
8 hours ago, jortan said:

 

I have a very basic setup and I've just experienced this as well - all sites returning:

 


refused to connect.

 

Nothing logged in access.log or error.log

 

something broke between:

1.17.0-ls70 and

1.17.0-ls71

 

For anyone else seeing this, edit swag docker and change repo to:

 


linuxserver/swag:1.17.0-ls70

 

No need to pull an earlier version. Just comment out the proxy_redirect off; statement in all confs nginx complains about.

  • Thanks 2
Link to comment

I was also getting the error

Quote

nginx: [emerg] "proxy_redirect" directive is duplicate in /config/nginx/proxy-confs/youtube-dl.subfolder.conf:22

 

Which I thought odd as I've never setup youtube-dll. In the end I renamed youtube-dl.subfolder.conf to youtube-dl.subfolder.conf_BAK, restarted Swag and everything is back up and running normally

  • Thanks 3
Link to comment
No need to pull an earlier version. Just comment out the proxy_redirect off; statement in all confs nginx complains about.

Is that a new thing this specific build, 71, is “looking for” since it has been an issue before out of curiosity?

(I’m gonna spot check a few of my Confs to see how many it may be issue with before I upgrade…)
Link to comment
5 hours ago, Yak said:

Which I thought odd as I've never setup youtube-dll. In the end I renamed youtube-dl.subfolder.conf to youtube-dl.subfolder.conf_BAK, restarted Swag and everything is back up and running normally

oh, yeah! solved my problem! ty!

  • Thanks 1
Link to comment
9 hours ago, Yak said:

I was also getting the error

 

Which I thought odd as I've never setup youtube-dll. In the end I renamed youtube-dl.subfolder.conf to youtube-dl.subfolder.conf_BAK, restarted Swag and everything is back up and running normally

If it doesn't have .sample at the end you have enabled it at one point.

Link to comment
9 hours ago, blaine07 said:


Is that a new thing this specific build, 71, is “looking for” since it has been an issue before out of curiosity?

(I’m gonna spot check a few of my Confs to see how many it may be issue with before I upgrade…)

The log says which proxy confs has the issue. No need to go through all configs.

 

Alpine was updated from 3.13 to 3.14 and nginx also and they changed some things.

  • Like 1
Link to comment
5 hours ago, saarg said:

If it doesn't have .sample at the end you have enabled it at one point.

 

Nope, mine was also youtube-dl.subfolder.conf and I know I never enabled this as I only use *.subdomain.conf

 

I think somehow in a previous version of swag docker a non-sample conf must have been pushed out.  Possibly even from back before this docker was renamed?

 

edit: judging by the file date, this happened early July 2020.

Edited by jortan
Link to comment

Hello, 

Any idea what need to be changed in new sonarr conf ?

So far i am getting 502 bad gateway error nginx/1.20.1 for my sonarr subdomain

I managed to make bitwarden working, now trying to make sonarr alive

Edited by J05u
Link to comment
2 hours ago, J05u said:

Hello, 

Any idea what need to be changed in new sonarr conf ?

So far i am getting 502 bad gateway error nginx/1.20.1 for my sonarr subdomain

I managed to make bitwarden working, now trying to make sonarr alive

The upstream_app name doesn't match your container name or swag and sonarr is not in the same custom bridge

Link to comment

Hello,

 

Sorry I am total noob, I have been using Nginx Proxy Manger for a long time and all of sudden it won't renew my certificates for some reason. So I installed Swag. I think I got the certificate and the ports set up properly because when I go to my subdomain bi.xxxx.com it does open page saying "Welcome to your SWAG instance"

 

However I can't figure out how to make it forward to my Blue Iris IP running on a Unraid VM as it used to with Nginx. 

 

I understand I need to create xxx.subdomain.conf file but I don't know how to make it work. I found a .conf file from my nginx docker but the format seems to be different? This is what the old one looked like:

 

server {
  set $forward_scheme https;
  set $server         "192.168.1.31";
  set $port           7968;

  listen 8080;
listen [::]:8080;


  server_name bi.redacted.us;

  access_log /data/logs/proxy_host-1.log proxy;

  location / {        

    # Proxy!
    include conf.d/include/proxy.conf;
  }
  # Custom
  include /data/nginx/custom/server_proxy[.]conf;
}
 

I just need it to forward to 192.168.1.31:7968 

 

Any ideas what the swag conf file should look like? Thanks!

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.