Hi,
For iptables I would also recommend to limit the rate of TCP connections and to drop packets with illegal states and prevent SYN flodding.
I never heard of ufw until now, but according to the manual you can limit the rate by simply executing "ufw limit". For example, "ufw limit SSH" will limit the amount of of requests (to 6 per 30 seconds with the default setting afaik).
Also, limiting SSHD to your local IP is a good idea in combination with OpenVPN to get access to SSHD and other management related tools, webinterfaces, etc. from other IPs.
If you are using a virtualization solution such as VMWare ESXi, or XenServer you can also set up a virtual management network which can only be accessed through a gateway instance responsible for routing and hosting OpenVPN. All the servers then host their important management services on a second network card within the virtual management network:
So to attack any kind of management service you first have to break into the virtual LAN.
I use to connect the virtual networks of many hypervisors (not physically located at the same place) using dedicated VMs as a bridge and firewall.
As for iptables: They a pretty straight forward.
That's how it works:
There are many kind of tables, most often you will use the filter table.
Every table has so called chains, by default INPUT, OUTPUT, FORWARD.
Once a packet gets processed by the kernel, it will jump to the appropriate chain and match the rules.
You can either ACCEPT a packet, DROP a packet, REJECT a packet or...
If none of the rules match, the chains default policy will be applied.
You can also jump to other chains, exit the current chain - It's like a book. You start at the top and go through everything - maybe you have to jump back, etc.
So if you get a TCP packet to your INPUT chain, you may want to check the tcp flags and states. You can write an own chain for that. Then you may want to jump to another chain checking for floods,...