Solved

rules for telnet and ftp

Posted on 2003-11-09
10
1,883 Views
Last Modified: 2010-04-22
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
Comment
Question by:diordonez
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 40

Expert Comment

by:jlevie
ID: 9710648
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
 

Author Comment

by:diordonez
ID: 9711410
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
 
LVL 40

Accepted Solution

by:
jlevie earned 125 total points
ID: 9714846
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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 14

Expert Comment

by:chris_calabrese
ID: 9715606
BTW, why use telnet and ftp at all, when you can use ssh, which is oodles more secure?
0
 

Author Comment

by:diordonez
ID: 9722289
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
 
LVL 14

Expert Comment

by:chris_calabrese
ID: 9722459
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
 
LVL 5

Expert Comment

by:g0rath
ID: 9724518
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
 

Author Comment

by:diordonez
ID: 9725100
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
 

Author Comment

by:diordonez
ID: 9772654
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
 
LVL 40

Expert Comment

by:jlevie
ID: 9779290
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

​Being a Managed Services Provider (MSP) has presented you  with challenges in the past— and by meeting those challenges you’ve reaped the rewards of success.  In 2014, challenges and rewards remain; but as the Internet and business environment evol…
BIND is the most widely used Name Server. A Name Server is the one that translates a site name to it's IP address. There is a new bug in BIND (https://kb.isc.org/article/AA-01272), affecting all versions of BIND 9 from BIND 9.1.0 (inclusive) thro…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question