UFW and OpenVPN

I used the excellent script here to setup OpenVPN on a server I'm running recently. I've set it up a hundred times before manually, and frankly its a bit of a slog, so its nice to find a tool that can do it for you and cut out the drudgery. And it nearly did, except on this particular server it didn't work. Clients could connect, but couldn't use the internet through the VPN.

After scratching my head for a while, I narrowed it down to the IPv4 forwarding. The script puts this line into iptables
"iptables -t nat -A POSTROUTING -s 10.8.0.0/d" and adds it to /etc/rc.local
But it wasn't appearing in the rules. Turns out this was because it had ufw installed, which is a simplified firewall interface which sits on top of iptables. The newly added rules were just being overwritten by ufw.

Read more