| Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
08-19-2009, 05:26 AM
|
#1
|
|
LQ Newbie
Registered: Apr 2008
Posts: 27
Rep:
|
Blocking Port 25 On Proxy Server!!!
Hi everyone,
This is varun here,
i am using a proxy server 172.20.x.x,
how do i block port 25 on this server so that anyone from ip range 172.20.x.x cannot access via telnet,etc.using this port.
Please help.
Thanks!
|
|
|
|
08-19-2009, 05:29 AM
|
#2
|
|
Guru
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 18 with Awesome WM
Posts: 6,796
|
Hello,
What proxy are you using? Do you have iptables installed/configured?
Kind regards,
Eric
|
|
|
|
08-19-2009, 05:30 AM
|
#3
|
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 42,711
|
If it is a proxy then it would be giving access in the first place without running an smtp proxy on that port, which is unlikely if you don't already know. so you'd need to be routing, not proxying, the traffic on it, and that would be where firewalls, including iptables / netfilter would be used to block traffic.
|
|
|
|
08-19-2009, 05:38 AM
|
#4
|
|
LQ Newbie
Registered: Apr 2008
Posts: 27
Original Poster
Rep:
|
Yes i have iptables installed and configured however i am not able to block the port may be i am not putting the command right!
eg. iptables -A INPUT -s 172.20.x.x/20 -d proxyserver -p TCP --dport 25
i also tried;
iptables -A FORWARD -s 172.20.x.x/20 -d proxyserver -p TCP --dport 25
Please HELP!!!
|
|
|
|
08-19-2009, 05:59 AM
|
#5
|
|
Guru
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 18 with Awesome WM
Posts: 6,796
|
iptables -A INPUT -s 172.20.0.0 -p tcp -dport 25 -j DROP
That should block all traffic on port 25 from 172.20.0.0 network. But do you want to block all access to that port?
Kind regards,
Eric
|
|
|
|
08-19-2009, 06:05 AM
|
#6
|
|
LQ Newbie
Registered: Apr 2008
Posts: 27
Original Poster
Rep:
|
yes i want to block all except my internal lan??
|
|
|
|
08-19-2009, 06:11 AM
|
#7
|
|
Guru
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 18 with Awesome WM
Posts: 6,796
|
Ah ok, all except your internal LAN, sorry for the misunderstanding
Code:
iptables -A INPUT -s !172.20.0.0 -p tcp -dport 25 -j DROP
That should drop all access to port 25 from any source that is not 172.20.0.0.
Kind regards,
Eric
|
|
|
|
08-19-2009, 06:21 AM
|
#8
|
|
LQ Newbie
Registered: Apr 2008
Posts: 27
Original Poster
Rep:
|
Quote:
Originally Posted by EricTRA
Ah ok, all except your internal LAN, sorry for the misunderstanding
Code:
iptables -A INPUT -s !172.20.0.0 -p tcp -dport 25 -j DROP
That should drop all access to port 25 from any source that is not 172.20.0.0.
Kind regards,
Eric
|
i did it but when i tried this,
telnet 172.20.x.x 25
it connected,it is giving access via telnet on port 25 i want to stop that too?
|
|
|
|
08-19-2009, 06:33 AM
|
#9
|
|
Guru
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 18 with Awesome WM
Posts: 6,796
|
Are you on the same LAN or one of the subnets? I assume you are if you can connect.
Kind regards,
Eric
|
|
|
|
08-19-2009, 06:42 AM
|
#10
|
|
LQ Newbie
Registered: Apr 2008
Posts: 27
Original Poster
Rep:
|
Yes i am on the same lan but i want to stop access via telnet on port 25.
|
|
|
|
08-19-2009, 06:52 AM
|
#11
|
|
Guru
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 18 with Awesome WM
Posts: 6,796
|
Sorry but now your confusing me a lot. In your original post you state
Quote:
|
how do i block port 25 on this server so that anyone from ip range 172.20.x.x cannot access via telnet,etc.using this port.
|
To which I gave you
Code:
iptables -A INPUT -s 172.20.0.0 -p tcp -dport 25 -j DROP
as a solution to block all traffic from your LAN on port 25.
Following you said
Quote:
yes i want to block all except my internal lan??
Today 12:59 PM
|
so the rule changed to
Code:
iptables -A INPUT -s !172.20.0.0 -p tcp -dport 25 -j DROP
that blocks all traffic except from your LAN.
And now you change your mind again to blocking all access from your LAN?
Could you PLEASE state what exactly you want to do:
1. block access to port 25 from anywhere
2. block access to port 25 from anywhere except your LAN
3. block access to port 25 ONLY from your LAN
4. something else??
Kind regards,
Eric
|
|
|
|
08-19-2009, 07:29 AM
|
#12
|
|
LQ Newbie
Registered: Apr 2008
Posts: 27
Original Poster
Rep:
|
sorry for the misunderstanding..
i want to;
1. block access to port 25 from anywhere
Thanks,
|
|
|
|
08-19-2009, 07:32 AM
|
#13
|
|
Guru
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 18 with Awesome WM
Posts: 6,796
|
No worries.
Try this
Code:
iptables -A INPUT -p tcp -dport 25 -j DROP
Kind regards,
Eric
|
|
|
|
08-19-2009, 07:44 AM
|
#14
|
|
LQ Newbie
Registered: Apr 2008
Posts: 27
Original Poster
Rep:
|
its not working??
|
|
|
|
08-19-2009, 08:53 PM
|
#15
|
|
Guru
Registered: Aug 2004
Location: Brisbane
Distribution: Centos 6.4, Centos 5.9
Posts: 15,021
|
You have to restart iptables for it to take effect. If it works, you also have to save the iptables settings, otherwise a reboot will revert to the original settings.
Note also that if you want to 'block' access to port 25 from 'anywhere', then you don't need iptables, you just don't run a server (presumably mailserver eg sendmail) on port 25; no server listening on port 25 = no way to connect on port 25, regardless of iptables.
HTH
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 10:21 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|