LinuxQuestions.org
Visit Jeremy's Blog.
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 01-18-2004, 09:49 PM   #1
misfit-x
Member
 
Registered: Jan 2004
Location: NY
Distribution: RH9
Posts: 38

Rep: Reputation: 15
Setting up IRC proxy with iptables?


I want to use an irc proxy that is at port 6667 on localhost and go through that to connect to IRC. Problem is, I can't get it to work. I get something like this:

Socket(5), Error (98):Failed to bind listening socket.
sockListen: bind failed: host(127.0.0.1), port(6667)Failed to bind listening socket.

The proxy said it is accepting on port 6667 but comes up with the errors above.

I have bind installed:

# rpm -qa | grep bind
bind-utils-9.2.1-16
ypbind-1.11-4
bind-9.2.1-16

I was reading posts in this forum and stumbled upon one on how to stealth your linux box, so I grabbed the iptables from that and based mine on it:

*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:RH-Lokkit-0-50-INPUT - [0:0]
-A INPUT -j RH-Lokkit-0-50-INPUT
-A FORWARD -j RH-Lokkit-0-50-INPUT
-A RH-Lokkit-0-50-INPUT -i lo -j ACCEPT
-A RH-Lokkit-0-50-INPUT -m state --state INVALID -j DROP
-A RH-Lokkit-0-50-INPUT -p tcp -m tcp --dport 0:8080 --syn -j DROP
-A RH-Lokkit-0-50-INPUT -p tcp -m tcp --dport 8081:65535 --syn -j DROP
-A RH-Lokkit-0-50-INPUT -p udp -m udp --dport 0:8080 -j DROP
#-A RH-Lokkit-0-50-INPUT -p udp -m udp --dport 8081:65535 -j DROP
COMMIT

Now I commented the last line out before COMMIT because I was experimenting with it and it wouldn't even let me get to the web. Commented out, it lets me connect (what should be the right one?)

And how do I open port 6667in this mess but in a secure way?

Suggestions welcome. I've tried Lokkit, Firestarter and Bastille and none of those make the system as stealth as I'd like, and yet open just the ports I want securely.

I don't know anything about networking and firewalls, obviously so if someone can help... the thread about stealthing was hard enough to follow.
 
Old 01-26-2004, 11:27 AM   #2
Capt_Caveman
Senior Member
 
Registered: Mar 2003
Distribution: Fedora
Posts: 3,658

Rep: Reputation: 69
The only difference with stealthing is that you want to use the DROP target instead of REJECT. Also if you are going to be allowing incoming connections (like IRC) then you won't able to be "fully-stealthed". Personally I think stealthing is of minor importance compared to other things, but that's my opinion.

When working with your firewall, you should never manually edit the /etc/sysconfig/iptables file directly. Always use either the command line or use a script. The format of the file is important and editing it can cause your firewall to fail to load even if the syntax you've used is 100% correct.

As far as opening up the port, just do as root:

iptables -I INPUT -p tcp --dport 6667 -j ACCEPT

You'll also probably need to allow established and related connections through:

iptables -I INPUT -p tcp -m state --state RELATED,ESTABLISHED -j ACCEPT

But to get back to initial problem, your firewall shouldn't effect the ability of the IRC proxy to bind to a socket. Also when it says "bind" in the error message, that doesn't refer to the DNS packages named Bind. It actually means the IRC proxy failed to set up an open listening socket on that IP address and port (aka to bind to that port). So that error message is more likely due to a configuration error or another copy of the program already running on that port. You can test that, by turning off you firewall briefly with: service iptables stop. Then make sure nothing is already running on that port with netstat -al | grep 6667. Then try to start the IRC program and see if you still get the message. If you do, then you know it's something with the config. Go back through the README or other docs and see if you can troubleshooot it.
 
Old 01-26-2004, 12:02 PM   #3
misfit-x
Member
 
Registered: Jan 2004
Location: NY
Distribution: RH9
Posts: 38

Original Poster
Rep: Reputation: 15
Thanks for the extra IP Tables info. As for the port thing, I saw it really was a misconfiguration of the IRC proxy. I looked at the config files and finally got it set up right. Now it's working.

Thanks for the help.
 
Old 01-26-2004, 12:09 PM   #4
Capt_Caveman
Senior Member
 
Registered: Mar 2003
Distribution: Fedora
Posts: 3,658

Rep: Reputation: 69
Cool.

Check out the netfilter website (www.netfilter.org) for more info on iptables, in particular the frozen tux tutorial is pretty good. There's also some good links to iptables info at the Security references thread (towards the top of the forum). Good Luck.
 
  


Reply



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
startinb irc proxy or bnc at boot time jelgavchik Linux - Software 0 01-04-2005 07:21 AM
iptables and IRC clients. qwijibow Linux - Newbie 1 05-02-2004 11:41 PM
Using an IRC Proxy with KSIRC arun79 Linux - Software 0 08-02-2003 12:48 PM
IRC Client with Socks Proxy Capability friendklay Linux - Software 2 05-28-2003 05:58 PM
IPtables firewall and IRC jfall Linux - Networking 6 11-16-2002 09:23 AM

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

All times are GMT -5. The time now is 09:28 PM.

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