I've set up a Raspberry Pi torrent server with Deluge & SABnzbd. It's all working well including Apache reverse proxy and an SSL certificate to reach it from outside my network.
To increase my privacy I want to let the torrents go over VPN via OpenVPN. I found a guide to set this up, it basically involves creating another user on the RPi that runs the Deluge & SABnzbd services and forcing all traffic of this user over the OpenVPN IP. (Guide, I already have a VPN provider that offers .openvpn connection files)
The problem I'm having is that the guide is using iptables to configure the firewall (and having the traffic go over the OpenVPN). I'm using ufw myself.
I can't find anything in the man pages of ufw so I want to ask here, is it possible to use iptables mangle & nat commands in ufw or do I need to switch my setup over from ufw to iptables?
iptables -t mangle -A OUTPUT -m owner --uid-owner bittorrent -j MARK --set-mark 3 iptables -t nat -A POSTROUTING -o $1 -j SNAT --to-source $4
And the commands to disable them:
iptables -t mangle -D OUTPUT -m owner --uid-owner bittorrent -j MARK --set-mark 3 iptables -t nat -D POSTROUTING -o $1 -j SNAT --to-source $4
In both, bittorrent is the created user on the RPi.
My current ufw config, would this be easily converted to iptables if ufw doesn't support mangle & nat?:
ufw default deny incoming ufw default allow outgoing ufw allow 22/tcp ufw allow 80/tcp ufw allow 443/tcp ufw allow 1194/udp //openvpn server ufw allow 58846/tcp //deluge thinclient