I have a Debian VPS on which I am trying to open some ports like 80, 443, etc. and here's what I've done:
Creating a test iptables file:
which has some basic rules:
*filter -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT -A OUTPUT -j ACCEPT -A INPUT -p tcp --dport 80 -j ACCEPT -A INPUT -p tcp --dport 443 -j ACCEPT -A INPUT -p tcp -m state --state NEW --dport 22 -j ACCEPT -A INPUT -m limit --limit 5/min -j LOG --log-prefix "iptables denied: " --log-level 7 COMMIT
The problem is that I am getting the following error on all lines:
iptables-restore: line xx failed
and I need to enable these ports ASAP so what's wrong?
update: fixed everything but now I can't connect to the server via any form (put the address in a browser's address bar and go to it)
P.S.: I'm using this server for my home automation project as a mid point (An Android app issues the commands to the server which in turn issues it to the raspberry pi which controls the house and then the pi sends back a response of success or failure) - on which I'm trying to do the following:
1- enable some ports like 80 & 443 which I have enabled using iptables but still can't put the server's address in a browser's address bar and navigate to it.
2- how will the app communicate with the server noting that sign up & login will take place through the server as I'm right now have both the app & the Pi ready but separate (not connected together & I already know that they will communicate over HTTP but what I don't know is how ?)