Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Sun May 15, 2011 8:38 am 
Offline
Newbie

Joined: Sun May 15, 2011 8:02 am
Posts: 4
I've tried adding exceptions found on Google such as:
Code:
iptables -A INPUT -p tcp --dport 80 -j ACCEPT    //apache
but they don't seem to work.
Code:
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Setting chains to policy ACCEPT: security raw nat[FAILED]filter
iptables: Unloading modules:                               [  OK  ]
iptables: Applying firewall rules: iptables-restore: line 14 failed
                                                           [FAILED]



What gives? If I stop iptables, I can access all of my services. I literally just re-installed from a F14 instance that I set up and never had to deal with this!

Can anyone lend a hand?


Top
   
 Post subject:
PostPosted: Sun May 15, 2011 10:18 am 
Offline
Senior Member
User avatar

Joined: Sat Aug 30, 2008 1:55 pm
Posts: 1739
Location: Rochester, New York
What does "iptables -L -n -v" look like? How about the file that iptables-restore is reading from?

_________________
Code:
/* TODO: need to add signature to posts */


Top
   
 Post subject:
PostPosted: Sun May 15, 2011 11:39 am 
Offline
Senior Member

Joined: Wed Oct 20, 2010 12:11 pm
Posts: 142
Stupid question incoming - can you use // style comments? I've only seen the hash mark and the inline --comment used...


Top
   
 Post subject:
PostPosted: Sun May 15, 2011 2:29 pm 
Offline
Newbie

Joined: Sun May 15, 2011 8:02 am
Posts: 4
hoopycat wrote:
What does "iptables -L -n -v" look like? How about the file that iptables-restore is reading from?


First:
Code:
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
 5842 5881K ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0   
    0     0 ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0   
   33  1932 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:22
 1113 64847 REJECT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
    0     0 REJECT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT 4897 packets, 450K bytes)
 pkts bytes target     prot opt in     out     source               destination


I do not know anything about the file iptables-restore is reading from. But, I found this file /etc/sysconfig/system-config-firewall that may be relevant? Its contents are:


Code:
# system-config-firewall config written out by anaconda

--service=ssh


Top
   
 Post subject:
PostPosted: Sun May 15, 2011 3:22 pm 
Offline
Senior Member
User avatar

Joined: Sat Aug 30, 2008 1:55 pm
Posts: 1739
Location: Rochester, New York
Yeah, there is no allow rule for port 80 in there.

This sounds like some sort of wacky Red Hat-specific problem, but system-config-firewall might yield results too.

Where did you put the "iptables -A INPUT -p tcp --dport 80 -j ACCEPT" line?

_________________
Code:
/* TODO: need to add signature to posts */


Top
   
 Post subject:
PostPosted: Sun May 15, 2011 3:34 pm 
Offline
Newbie

Joined: Sun May 15, 2011 8:02 am
Posts: 4
hoopycat wrote:
Yeah, there is no allow rule for port 80 in there.

This sounds like some sort of wacky Red Hat-specific problem, but system-config-firewall might yield results too.

Where did you put the "iptables -A INPUT -p tcp --dport 80 -j ACCEPT" line?


I actually removed it after, as it was giving the error I posted in my first post. I'll re-add it and then re-print that command.


Top
   
 Post subject:
PostPosted: Sun May 15, 2011 3:51 pm 
Offline
Newbie

Joined: Sun May 15, 2011 8:02 am
Posts: 4
Code:
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
  409 32897 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED
    6   240 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0   
    2   120 ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0   
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:22
   75  4228 REJECT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
    0     0 REJECT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT 404 packets, 40103 bytes)
 pkts bytes target     prot opt in     out     source               destination


Contents of /etc/sysconfig/iptables

Code:
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
-A INPUT -p tcp --dport 80 -j ACCEPT


Top
   
 Post subject:
PostPosted: Sun May 15, 2011 6:06 pm 
Offline
Senior Member
User avatar

Joined: Sun Dec 27, 2009 11:12 pm
Posts: 1038
Location: Colorado, USA
Try moving the line dealing with TCP 80 UNDER the line about TCP 22 and OVER the REJECT line.

Then restart IPTABLES and see what happens.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group