Skip to content

Fix the UFW firewall on a VPS: apps can't reach the internet or show certificate errors

TroubleshootingDeployrr v6.0+CurrentFirewallDockerTraefikPorts

You run Deployrr on a rented VPS or a dedicated server. Your apps cannot reach the internet, or you see certificate errors you cannot explain. This page helps you clean up the firewall on the server and get back to a working state. If Domain Checks reports that port 80 or 443 is not reachable, see Domain Checks failed.

This page fits you if all of these are true:

  • Your server is a VPS or dedicated server with a public IP address.
  • You have no firewall outside the server. This means no firewall page in your hosting provider’s web panel, or you never opened ports there. At home, your router’s port forwarding page plays this role. A cloud server usually has no router in front of it.
  • You see one or more of the signs below.

What you may notice:

  • Apps cannot make outside connections. Features that call other services fail or show errors.
  • Your browser shows a certificate warning for your own domain.

In the Traefik log, you may see lines like this:

Serving default certificate for request: "connect.somethirdpartyAPI.com"
http: TLS handshake error from 192.168.91.1:42832: local error: tls: bad record MAC

If you open a shell inside an app’s container and test with curl, you may see this:

* SSL certificate problem: self-signed certificate
curl: (60) SSL certificate problem: self-signed certificate

Searches for these errors usually point to missing root certificates in the container. In this case, the certificates are not the cause.

The usual cause is the firewall on the server itself. Rules you added to UFW or iptables by hand can interfere with how Docker traffic moves. So can edits to /etc/ufw/before.rules or /etc/ufw/after.rules. The fix is to remove those changes and use a small set of plain rules.

On a home network, Deployrr’s Advanced mode expects your router to forward port 80 to 81 and port 443 to 444. A cloud server has no router to do that. People then try to fake the forwarding with firewall rules on the server, and those rules are easy to break. Simple mode avoids this. See step 3.

Steps 1, 2 and 5 are general Linux and UFW advice. They are not part of Deployrr. Steps 3, 4 and 6 use Deployrr menus.

  1. Look at what UFW has now:

    Terminal window
    sudo ufw status verbose
  2. Remove any rules or edits you added by hand. This includes any lines you added to /etc/ufw/before.rules or /etc/ufw/after.rules, and any custom iptables rules. Put each file back to its default state.

    Do not use PREROUTING ... REDIRECT rules to forward port 80 to 81 or port 443 to 444. They can work for a while, then stop after package upgrades and reboots. Lines like these are the ones to remove:

    -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 81
    -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-port 444
  1. In Deployrr, go to Proxy > Traefik. Look at the Traefik Mode line.

    • If it says Advanced, select Traefik Mode once. Deployrr shows Simple mode ENABLED.
    • If it says NOT SET, select Traefik Mode once. That turns on Simple mode.
    • If it already says Simple, leave it alone. Selecting it again switches back to Advanced.

    Traefik Mode only works once Proxy > Proxy Type is set to Traefik. If it isn’t, Deployrr tells you to go there first.

    Deployrr says Simple mode needs ports 80 and 443 sent to ports 80 and 443 on the Traefik host. On a VPS, that is the normal state. The internet reaches the server’s ports directly. You have nothing to forward.

    Advanced mode needs a router, gateway or firewall that forwards 80 to 81 and 443 to 444. A VPS with no firewall in front of it has nothing to do that. Stay on Simple mode unless you add such a device in front of your server. See Simple vs Advanced Traefik mode for how the two modes differ, and Allow only some IP addresses to reach an app for how Internal and External exposure work.

  1. Check that Prerequisites > System Type is set to VPS - Virtual Private Server in the cloud.

    Then go to Prerequisites > Server IP. Deployrr asks:

    Enter the Docker Host IP (LAN IP or WAN IP for VPS):

    On a VPS in Simple mode, enter the server’s public IP address. Deployrr then shows “Server IP set to” and your address. You can run this again at any time.

    If you change the IP later, use Tools > Change Server IP (needs a Pro license). It asks for the new IP, then the previous IP. It then asks you to confirm. It updates the IP for services on the Deployrr Dashboard and in the Traefik file providers. Change the server IP walks through it.

  1. Run these commands one at a time. This is general UFW advice. It denies everything coming in except what you allow.

    Terminal window
    sudo ufw default deny incoming
    sudo ufw default allow outgoing
    sudo ufw allow 22/tcp
    sudo ufw allow 80/tcp
    sudo ufw allow 443/tcp

    Change 22 in the SSH rule if you moved SSH to another port. If you get this wrong, you lock yourself out of the server. To set up SSH keys and the provider firewall on a new server first, see Secure a fresh VPS before you install Deployrr.

    Add these rules too. The first two allow web traffic that UFW routes through the server to Docker. The last one allows Tailscale, if you use it:

    Terminal window
    sudo ufw route allow proto tcp from any to any port 80
    sudo ufw route allow proto tcp from any to any port 443
    sudo ufw allow in on tailscale0

    Then turn UFW on and restart the server:

    Terminal window
    sudo ufw enable
    sudo reboot

    Deployrr v6 does not have a UFW-Docker option any more. Its release notes list “UFW Docker integration” as removed. If you installed UFW-Docker with an older version, remove it the way its own documentation says.

Deployrr does not turn UFW on. Here is what it does change:

  • Socket Proxy adds one rule when you set it up: allow traffic from 192.168.91.0/24, the Socket Proxy’s Docker network. It adds it even if UFW is off. If UFW is not installed but firewalld is, the rule goes to firewalld instead.
  • Prerequisites > Packages installs UFW on Debian, Ubuntu and Arch. It stays off until you run sudo ufw enable.
  • Traefik adds no rules. Allow ports 80 and 443 yourself, as in step 5. In Advanced mode, a firewall in front of the server sends traffic to ports 81 and 444. If you use one, allow those two ports as well.
  • No other app adds a UFW or firewalld rule. If you open an app’s port to the internet without Traefik, allow it yourself.
  • Security > Firewall Bouncer, if you install it, blocks the addresses CrowdSec bans. It does this in the server’s firewall. See Install the Firewall Bouncer.
  • On Fedora and RHEL, Packages doesn’t install UFW. Use firewalld’s own commands instead of the UFW commands on this page.

Domain Checks briefly lets ports 80, 81, 443 and 444 through for its own test when nothing listens on them yet. A pass there does not mean UFW allows them. Run sudo ufw status verbose to see what UFW allows.

To see the rules before you turn UFW on, run sudo ufw show added. It works while UFW is off.

  1. Open apps you do not want public through Tailscale. In Deployrr, set up the network adapter first at System > Network (needs a Basic, Plus or Pro license). Then install Tailscale from Apps > Browse Apps. The Tailscale - Configuration box asks Enter value for TS_AUTH_KEY:. For the full walk-through, see Set up Tailscale.

    Deployrr shows a Tailscale Mode box. It says Tailscale installs in host networking mode, and you open apps at TAILSCALE-IP:PORT. It also says you should turn off MagicDNS in the Tailscale admin console. If you leave MagicDNS on, the Docker host can lose its internet connection.

  2. Open an app at http://TAILSCALE-IP:PORT. Replace TAILSCALE-IP with your server’s Tailscale address and PORT with the app’s port. This address uses plain http, with no certificate and no domain name.

    To see an app opened by its Tailscale IP, watch Tailscale tutorial: Accessing Tailnet Devices and Services at 10:54 (shows Deployrr v5; menus differ in v6). The matching guide section is UDMS part 16: Access by Tailscale IP (manual setup).

Private networking (only if you use Advanced mode)

Section titled “Private networking (only if you use Advanced mode)”

You do not need this section for Simple mode. In Advanced mode, Deployrr needs a local address to tell internal traffic from external traffic. Cloud providers often offer private networking for this. Look in your provider’s documentation. You usually switch it on in the provider’s panel, then add a network interface on the server with netplan or /etc/network/interfaces.

This is an example netplan file only. Interface names, allowed IP ranges and the MAC address are different at every provider. Replace the values in capitals with the ones your provider gives you.

network:
version: 2
ethernets:
INTERFACE_NAME:
match:
macaddress: YOUR_MAC_ADDRESS
addresses:
- PRIVATE_IP/24

After you add the interface, set the server IP in Deployrr (step 4) to the private address.

  1. Open a shell in an affected container. Replace CONTAINER_NAME with the container’s name:

    Terminal window
    sudo docker exec -it CONTAINER_NAME sh

    With the Deployrr bash aliases: dexec CONTAINER_NAME sh.

  2. Run a test. If curl is not installed in the container, use wget instead:

    Terminal window
    curl -I https://google.com

    You should get an HTTP response and no “SSL certificate problem” message.

  3. Check your apps. The features that failed before should work now.

  4. Open your app’s domain in a browser. The certificate warning should be gone.

  5. Check the Traefik log. After a fresh restart, the “Serving default certificate” and “bad record MAC” lines should not come back. See Read the Traefik logs for how to find the log.

If the problem stays, check whether your provider has its own firewall page in its web panel. Open ports 80 and 443 there too. For why a VPS needs this extra layer, watch Traefik 3 guide: firewall and VPS provider rules at 16:43 (manual Docker Compose setup). To allow the ports in UFW by hand, see UDMS part 18: Allow Ports 80 and 443 on Firewall (manual setup).