LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Iptables question (https://www.linuxquestions.org/questions/linux-newbie-8/iptables-question-4175600824/)

Samsolo 03-01-2017 04:18 AM

Iptables question
 
Hi all, just wondering if someone could be so kind as to give me some advice on my iptables.

I have a debian 8 bps running apache2. I am getting forbidden messages when attempting to go to my website.

I was wondering if someone could check these iptables for me? I am also running a minecraft server on the vps, access to the server and access via browser to the control panel work fine.

[Spoiler]
# Generated by iptables-save v1.4.21 on Tue Feb 28 12:49:44 2017
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [195:20556]
-A INPUT -i lo -j ACCEPT
-A INPUT -s 127.0.0.0/8 ! -i lo -j ACCEPT
-A INPUT -p icmp -m state --state NEW -m icmp --icmp-type 8 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 25565 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -m limit --limit 3/min -j LOG --log-prefix "iptables_INPUT_denied: " --log-level 7
-A INPUT -j REJECT --reject-with icmp-port-unreachable
-A INPUT -p tcp -m tcp --dport 21 -m conntrack --ctstate NEW,ESTABLISHED -m comment --comment "Allow ftp connections on port 21" -j ACCEPT
-A INPUT -p tcp -m tcp --sport 1024:65535 --dport 1024:65535 -m conntrack --ctstate ESTABLISHED -m comment --comment "Allow passive inbound connections" -j ACCEPT
-A FORWARD -j ACCEPT
-A OUTPUT -p tcp -m tcp --dport 21 -m conntrack --ctstate NEW,ESTABLISHED -m comment --comment "Allow ftp connections on port 21" -j ACCEPT
-A OUTPUT -p tcp -m tcp --sport 1024:65535 --dport 1024:65535 -m conntrack --ctstate RELATED,ESTABLISHED -m comment --comment "Allow passive inbound connections" -j ACCEPT
COMMIT
# Completed on Tue Feb 28 12:49:44 2017
[/spoiler]

Many thanks,
Sam.

r3sistance 03-01-2017 05:18 AM

Forbidden suggests apache itself is refusing to serve the file and nothing to do with the firewall. I'd check that apache has permissions to read the file and that there aren't any deny/accept directives that maybe interferring

vincix 03-02-2017 03:27 AM

I agree with r3sistance. It seems an explicit error given by apache itself. If apache was able to give that error, then it means you've already reached it. In another train of thoughts, if you're using https, then you'll also need to give access to port 443, following the example of the rule that grants ftp access (ctstate NEW, etc.)

Do you actually need any policies in the FORWARD chain? If this doesn't act as a router/vpn server or whatever, then I'd set the forward policy to DROP.

What is the exact error message that you receive?


All times are GMT -5. The time now is 10:46 AM.