• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1892
  • Last Modified:

rules for telnet and ftp

I have a server linux redhat and i need to administer it remotely.
I would like to use telnet and ftp but only accept requesting from an specific ip address.  Would be fine if i could use XDMCP also for logging into that machine but restricted to only one address.

How can i use ip tables for that goal ?

Thanks for your time to you all !!

0
diordonez
Asked:
diordonez
  • 4
  • 3
  • 2
  • +1
1 Solution
 
jlevieCommented:
If your firewall is set up with a default deny stance (iptables -P INPUT DROP) you can add rules to the INPUT chain like:

iptables -A INPUT -p tcp -s 1.2.3.4 --dport 23 -j ACCEPT
iptables -A INPUT -p tcp -s 1.2.3.4 --dport 20 -j ACCEPT
iptables -A INPUT -p tcp -s 1.2.3.4 --dport 21 -j ACCEPT
iptables -A INPUT -p tcp -s 1.2.3.4 --dport 1024:65535 -j ACCEPT

will allow telnet & ftp access from 1.2.3.4. However, keep in mind that anyone that can see your network traffic can easily extract your username & password from the telnet or ftp sessions. If they are a clever attacker they can then spoof the IP and access your server. It is far better to only use safe protocols (ssh, scp, sftp) for remote administration since everything is encrypted.


BTW, You have tow copies of this question. I'd recommend that you go to the Community Support topic area and ask to have http://www.experts-exchange.com/Security/Linux_Security/Q_20792310.html deleted and the points refunded.
0
 
diordonezAuthor Commented:
OK jlevie
you have touched the specific point i need.  What do i got to do in order to implement ssh & sftp.  (Excuse but i don´t know... is ssh an alternative for telnet ? )

And the final question, is secure to use XDMCP for graphical remote login ?
How can i enable this kind of access in iptables.

Could you help me ?
0
 
jlevieCommented:
Most, if not all, Linux systems include OpenSSH as a part of their distribution. So it is likely that your have it available on your server (or can install it from your distro). If you are running a firewall on the remote server you need to allow inbound connections via ssh with:

iptables -A INPUT -p tcp -s 1.2.3.4 --dport 22 -j ACCEPT

The ssh client tool (similar to a telnet session) allows the forwarding of X sessions from the remote to the local system. This means that you can open an ssh connection to the remote and run some X application and have the GUI shown on your local system. This is the preferred method of using X on a remote system.
0
 The Evil-ution of Network Security Threats

What are the hacks that forever changed the security industry? To answer that question, we created an exciting new eBook that takes you on a trip through hacking history. It explores the top hacks from the 80s to 2010s, why they mattered, and how the security industry responded.

 
chris_calabreseCommented:
BTW, why use telnet and ftp at all, when you can use ssh, which is oodles more secure?
0
 
diordonezAuthor Commented:
How do i modify those sentences if i need accept ssh and sftp from one only address from outside but all the local address 192.168.0.0/255.255.255.224

How do i deny definitively the access for ftp and telnet either from outside or inside.

How do i implemente secure access for pop3 ?
0
 
chris_calabreseCommented:
Jlevie already commented on iptables rules for ssh/sftp. Just replace 1.2.3.4 in his example with 192.168.0.0/255.255.255.224

Similarly, replace ACCEPT with DROP (and get rid of the -s 1.2.3.4) in Jlevie's example rules for ports 20, 21, and 23 to block telnet and ftp.

Finally, you can use iptables similarly to the above to allow access to pop3 (port 110 - read the iptables man page, this stuff is easy to figure out). But note that pop3 will still send data in the clear if you're not using an SSL-ized pop server or tunnel the pop3 traffic over ssh.

Getting those working, however, is a much larger discussion.
0
 
g0rathCommented:
SSH allows you to tunnel other non-secure ports through the encrypted channel.

For instance I forward port 110 from a foreign box across the internet to my local port 110. I use SSH to connect to my the foreign linux server, then point my mail program @ 127.0.0.1 port 110 and I read my email securely.
0
 
diordonezAuthor Commented:
OK guys, thanks to you all.  I´ve download some tools for ssh and sftp and they work very well.  I´ve learned a lot with all your comments and tips.

Warm greetings from Colombia !!
0
 
diordonezAuthor Commented:
I have my las question.

What ports do i have to open in order to use internet.  I have used all about telnet, ftp, ssh and pop, but now i can´t use internet neither do a ping to outside.
0
 
jlevieCommented:
If you've ditched telnet and FTP the only inbound firewall rule that you need is:

iptables -A INPUT -p tcp -s 1.2.3.4 --dport 22 -j ACCEPT

Take the others for telnet & FTP out of your rule set.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

  • 4
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now