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 01-02-2002, 06:34 AM   #1
ForumKid
Member
 
Registered: Dec 2001
Posts: 195

Rep: Reputation: 30
iptables - I have searched and come up empty handed regarding telnet.


Hi,
I am using iptables. Telnet is not running on my box. However someone can still telnet to port 25, 110, etc. How can i possible reject all incoming telnet sessions to ALL ports? I have searched and tryed many things, but i am totally lost.

Thanks
 
Old 01-02-2002, 07:53 AM   #2
glj
Member
 
Registered: Jul 2001
Location: London
Distribution: RH 9
Posts: 151

Rep: Reputation: 30
Go to /etc/xinetd.d and there'll be a file telnet. Edit that, and there should be a line disable = no in there, just change it to be yes. No-one will be allowed to telnet in now. (The above is true for latest RedHat. IIRC, xinetd was changed from inetd, and some distros still use inetd)

HTH

glj
 
Old 01-02-2002, 01:44 PM   #3
ForumKid
Member
 
Registered: Dec 2001
Posts: 195

Original Poster
Rep: Reputation: 30
Hi, Thanks for the reply.

I dont even have telnet package installed. I have another machine with telnet installed but not running and the line in the telnet file is disable = yes and still people can telnet on port 25, 110, etc.

Thanks
 
Old 01-02-2002, 02:07 PM   #4
raven
Member
 
Registered: Dec 2001
Location: Basel, Switzerland
Distribution: ubuntu
Posts: 297

Rep: Reputation: 31
if you allow connections to those ports, telnet will work.

anyway it doesnt matter wether you retrieve your messages from a pop3 server with a program or using telnet and typing commands...

if you left those ports open, telnet will be possible...

anyway, setting telnet to disable in inetd.conf only disables telnetting to the telnet port (no insecure remote login), but there is no way to stop anyone to connect to ports which are allowed to be connected to.

greetz

visit: raven.eplay.ch
 
Old 01-02-2002, 02:08 PM   #5
raven
Member
 
Registered: Dec 2001
Location: Basel, Switzerland
Distribution: ubuntu
Posts: 297

Rep: Reputation: 31
oh forgot something: you can find a good tutorial how to set up iptables firewalls at

raven.eplay.ch

bye
 
Old 01-02-2002, 02:18 PM   #6
ForumKid
Member
 
Registered: Dec 2001
Posts: 195

Original Poster
Rep: Reputation: 30
Hi,

I have some friends that are using windows servers. EWWWWWW. ANyway they say they can prevent telnet on mail ports. I find it hard to believe that with iptables you cannot prevent telnetting on specified ports.

Oh well. I guess ill find some way to do it.
Thanks
 
Old 01-02-2002, 02:37 PM   #7
raven
Member
 
Registered: Dec 2001
Location: Basel, Switzerland
Distribution: ubuntu
Posts: 297

Rep: Reputation: 31
well in ths case there has to be a way......

if they can do it, then there should be a way with iptables too...

if it really works on their site and its not only a bug of the windows server )))

well....

im surprised...

tell me if you found a way... )

bye
 
Old 01-03-2002, 05:33 AM   #8
Mik
Senior Member
 
Registered: Dec 2001
Location: The Netherlands
Distribution: Ubuntu
Posts: 1,316

Rep: Reputation: 47
Someone told me a while ago that they also had that option on their windows firewall. I'm not really sure on how well it works though. Most firewall work by blocking based on ip and port either from the source or destination. Using those techniques it's not really possible to tell the difference if it's a sendmail program or a telnet client.
The only way I think they could tell the difference is if they would analyze the packets themselves. This would make the firewall run at a higher network level and consume more resources. But they could easily check for telnet characteristics. One of the main ones being that each key pressed usually gets sent in a seperate packet because the user is typing them one by one. So if it receives a command in multiple network packets the most likely it's a telnet user typing out his command. But you could still write a simple program which mimics a email program to get around that.
The best way is to make sure you've configured your mail server properly. If you've done that you shouldn't have to worry about people telnetting in.
 
Old 01-03-2002, 12:59 PM   #9
raven
Member
 
Registered: Dec 2001
Location: Basel, Switzerland
Distribution: ubuntu
Posts: 297

Rep: Reputation: 31
yeah you are right.

firewalls like iptables work on low (packet) level.

the solution what you need would be a gateway that runs at OSI layer 5 or higer. that uses more resources (as the previous post says).

and again. there should be no risk in allowing telnet to a open service. (at least not more than while normal use)

bye
 
Old 01-03-2002, 01:41 PM   #10
ForumKid
Member
 
Registered: Dec 2001
Posts: 195

Original Poster
Rep: Reputation: 30
Hey,
First I would like to thank everyone for the input that was left.
Second "and again. there should be no risk in allowing telnet to a open service. (at least not more than while normal use)". Is the above quote true?
Someone can telnet to port 25 and not be able to send or check mail at all??????

THanks
 
Old 01-03-2002, 05:46 PM   #11
raven
Member
 
Registered: Dec 2001
Location: Basel, Switzerland
Distribution: ubuntu
Posts: 297

Rep: Reputation: 31
hello

well, if someone CAN telnet to port 25 and you ALLOWED him to connect (that means he is legally on your site) then he can do everything what a mail client can do (if he knows the commands)

BUT

if you disallow, say, mail-routing, then NOONE will EVER be able to send mail using telnet or ANY other software. kmail would also fail then.

its all a question of cofiguration. telnetting to a service means nothing else, than dropping the good ol' user interface and doung everything hatdcore text-based.

for example: i can connect to my ISP's pop3 server using kmail, and then read my mails.
but i can also connect to him using telnet and doing the same. and this is no risk, you could never login to that site if you are not auhorised.

same with mail-routing. everyone can connect to my isp's smtp service. but mail routing IS forbidden, so i cannot do anything, becouse my IP differs from that he allowed to use. if i HAD permission to send mail without password, then the isp did bad work in protecting his system...

btw: my server runs with iptables protection only, never wanted to keep away telnet connections (except to the telnet port itself) and i dont have ANY rpoblems ))

bye
 
Old 01-07-2002, 04:58 PM   #12
[BHBS]=TK
Member
 
Registered: Aug 2001
Location: Salt Lake City, UT
Distribution: REDHAT 7.1
Posts: 32

Rep: Reputation: 15
STRING

You can recomplie IPTABLES with string filtering capability. I have not done this but was trying to find away to kill code red before it reached outlook on my windows clients. Telnet requests have standard packet headers just likt HTTP, etc. I am sure since it is plain text, you could filter by the string contained in the headers. Or, if you are not offering services, just drop everything with a -SYN flag coming from outside.
 
Old 01-08-2002, 11:05 AM   #13
ForumKid
Member
 
Registered: Dec 2001
Posts: 195

Original Poster
Rep: Reputation: 30
Not sure what you mean by "Or, if you are not offering services, just drop everything with a -SYN flag coming from outside."

Port 25 is the only port open from the outside so my mail can come in. Thats the only thing that this server is used for. Can a still block all -SYN from coming in and still get my mail?

Thanks
 
Old 01-08-2002, 05:50 PM   #14
ForumKid
Member
 
Registered: Dec 2001
Posts: 195

Original Poster
Rep: Reputation: 30
Is there a way to block someone from sending mail from my server after telnetting on port 25

halo
mail from
rcpt to
data
to
from
subject
test.

The above commands allow someone to send an email.
Is this preventable???
 
Old 01-09-2002, 01:26 AM   #15
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
What he means by SYN is that any connection from the outside to your box starts by the remote side sending a packet with the SYN flag set, this marks them wanting to set up a connection.
Note Im still a newbie on iptables syntax but the (un)blocking lines should look like this:

iptables -P INPUT DROP
iptables -A INPUT -p tcp --tcp-flags ALL SYN -j DROP
iptables -A INPUT -s <addr> -p tcp --destination-port 25 -j ACCEPT

This would add default deny policy for incoming TCP, then add a default deny for incoming TCP with SYN flags, then add allow for incoming TCP with SYN flags from specified IP <addr>. This will only work if you can specifiy all <addr> or network ranges where mail is sposed to come from. If this is a mailserver my guess is you don't want to do this but only block from illegal adresses like IANA designated private networks like 192 etc etc.

Then the last line could be something like
iptables -A INPUT -s 0.0.0.0 --destination-port 25 -p tcp --tcp-flags ALL SYN -j ACCEPT.
 
  


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
A little help with iptables and telnet. linmaster Linux - Networking 1 03-06-2005 11:39 PM
3d acceleration, pci ati 9200se, scoured LQ and google for hours, still empty handed veritas Slackware 16 09-08-2004 01:06 AM
switching mouse from right handed to left handed niverson Linux - Hardware 5 03-18-2004 09:32 PM
telnet problem - I have searched all over skibud2 Linux - Software 9 09-06-2003 07:20 AM
empty iptables rules or what ? cyfox Linux - Networking 5 02-07-2003 09:40 AM

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

All times are GMT -5. The time now is 06:44 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