Ufw firewall

Hello, I’m getting several attacks on my server on port 433, I would like to block it via ufw, but whenever I do that, I can’t access the n8n. Is there any way to avoid this?

Hey @Integra_Ninja,

This is more of a Linux question than an n8n question, That being said depending on what features of n8n you are using you could block all 443 traffic and only allow it for you IP (assuming it is static) or you could block all external traffic and use an SSH tunnel when you want to connect.

ufw deny 443/tcp
ufw allow from 1.1.1.1 proto tcp to any port 443

If you are noticing attacks you could also in theory read your logs then use n8n to SSH to the host and run…

ufw deny from the.ip.from.logs

If you wanted to take SSH tunnel route you can just run

ssh user@n8n -Nf -p 22 -L 127.0.0.1:8080:127.0.0.1:5678

Then in your browser if you go to http://127.0.0.1:8080 it will direct to :5678 over the SSH tunnel. Hopefully this helps and gives you a few ideas to play with.

2 Likes