I spent lots of time but not successful, so please help!
I am using ubuntu 10.0.4, and follow this tutor to install openvpn, without enable firewall (iptables):
http://library.linode.com/networking/openvpn/ubuntu-10.04-lucid
It is successful.
But if I want to enable firewall following this tutor:
http://library.linode.com/securing-your-server
to do in this way:
File:/etc/iptables.firewall.rules
*filter
# Allow all loopback (lo0) traffic and drop all traffic to 127/8 that doesn't use lo0
-A INPUT -i lo -j ACCEPT
-A INPUT ! -i lo -d 127.0.0.0/8 -j REJECT
# Accept all established inbound connections
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Allow all outbound traffic - you can modify this to only allow certain traffic
-A OUTPUT -j ACCEPT
# Allow HTTP and HTTPS connections from anywhere (the normal ports for websites and SSL).
-A INPUT -p tcp --dport 80 -j ACCEPT
-A INPUT -p tcp --dport 443 -j ACCEPT
# Allow SSH connections
#
# The -dport number should be the same port number you set in sshd_config
#
-A INPUT -p tcp -m state --state NEW --dport 22 -j ACCEPT
# Allow ping
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
# Log iptables denied calls
-A INPUT -m limit --limit 5/min -j LOG --log-prefix "iptables denied: " --log-level 7
# Reject all other inbound - default deny unless explicitly allowed policy
-A INPUT -j REJECT
-A FORWARD -j REJECT
COMMIT
The OpenVPN will be down. I know there is a remark:
By default, the rules will allow traffic to the following services and ports: HTTP (80), HTTPS (443), SSH (22), and ping. All other ports will be blocked.
Be sure to revise these rules if you add new services later.
And openVPN is using 1194, but I do not know how to insert it in the above firewall rules.
Moreover, before enable such firwall, I noticed there is something out by iptables -L:
ACCEPT all -- 10.8.0.0/24 anywhere
It disappeared after enable such rules. It is also the cause?
If I delete:
-A INPUT -j REJECT
-A FORWARD -j REJECT
OPENVPN is back to ok!
Please help me, I do not like the servering (OpenVPN) is running without firewall!
Thank you a lot!