LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 05-27-2014, 05:38 AM   #1
ronban
Member
 
Registered: Aug 2005
Location: India
Distribution: Gentoo
Posts: 43

Rep: Reputation: 15
iptables keeps loading instead of the service being switched off


I have this server where I have used Iptables some time back to use redirection. Now I am starting the server with configured ports so I don't need to use port redirection. I have set the iptables to off mode for all runtimes using this

Code:
chkconfig iptables off
After that whenever I restart the server, I always find the iptables status as shown in the image below



Now the moment I restart the iptables service, it takes up the allow all rules which I have I set up by default.

Now every day I startup the server, I need to manually stop the iptables service. Worst part is even a cron job to stop the service doesn't work. All other cron jobs work fine.

Any pointers will help. server used is Red Hat Enterprise Linux.
Attached Thumbnails
Click image for larger version

Name:	roney_—_root_ip-10-179-30-157___—_bash_—_ttys002.png
Views:	27
Size:	92.8 KB
ID:	15614  
 
Old 05-27-2014, 07:14 AM   #2
GunFighT
Member
 
Registered: May 2014
Location: Romania
Distribution: Debian/Ubuntu, Rocky Linux
Posts: 53

Rep: Reputation: Disabled
Did you searched in /etc/rc.local to see if there is somechind of command/script that stars the firewall at startup?
 
Old 05-27-2014, 09:22 AM   #3
ronban
Member
 
Registered: Aug 2005
Location: India
Distribution: Gentoo
Posts: 43

Original Poster
Rep: Reputation: 15
Nopes the file has nothing related to iptables. Here goes



Code:
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
if [ ! -d /root/.ssh ] ; then
    mkdir -p /root/.ssh
    chmod 0700 /root/.ssh
    restorecon /root/.ssh
fi

# bz 707364
if [ ! -f /etc/blkid/blkid.tab ] ; then
        blkid /dev/xvda &>/dev/null
fi

ATTEMPTS=5
FAILED=0
# Fetch public key using HTTP
while [ ! -f /root/.ssh/authorized_keys ]; do
    curl -f http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key > /tmp/aws-key 2>/dev/null
    if [ $? -eq 0 ]; then
        cat /tmp/aws-key >> /root/.ssh/authorized_keys
        chmod 0600 /root/.ssh/authorized_keys
        restorecon /root/.ssh/authorized_keys
        rm -f /tmp/aws-key
        echo "Successfully retrieved AWS public key from instance metadata"
    else
        FAILED=$(($FAILED + 1))
        if [ $FAILED -ge $ATTEMPTS ]; then
            echo "Failed to retrieve AWS public key after $FAILED attempts, quitting"
            break
        fi
        echo "Could not retrieve AWS public key (attempt #$FAILED/$ATTEMPTS), retrying in 5 seconds..."
        sleep 5
    fi
done
 
Old 05-27-2014, 02:00 PM   #4
GunFighT
Member
 
Registered: May 2014
Location: Romania
Distribution: Debian/Ubuntu, Rocky Linux
Posts: 53

Rep: Reputation: Disabled
Well, you can try by using this command in rc.local, when the server starts up:
Code:
/etc/init.d/iptables stop
That`s for a fast solution...
 
Old 05-27-2014, 02:02 PM   #5
ronban
Member
 
Registered: Aug 2005
Location: India
Distribution: Gentoo
Posts: 43

Original Poster
Rep: Reputation: 15
Finally found the error. Silly mistake. The Glasffish server script the starting the firewall.
 
  


Reply

Tags
chkconfig, iptables, redhat



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
iptables and FTP service cinojose Linux - Security 4 05-20-2013 08:15 PM
iptables 1.27a still loading rules after installing iptables 1.3.0 yawe_frek Linux - Software 1 06-07-2007 09:50 PM
kdm service loading twice on suse10.2 NDR008 SUSE / openSUSE 11 02-21-2007 10:48 AM
checking iptables service neocontrol Linux - Software 3 11-14-2006 08:48 PM
IPTABLES Service timeouts Paul_assheton Linux - Networking 2 04-27-2002 05:18 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 12:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration