Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here. |
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
04-22-2002, 06:24 PM
|
#1
|
Member
Registered: Jan 2002
Location: UK
Distribution: Redhat 7.2
Posts: 35
Rep:
|
ftp and ftp port forwarding with IPtables??
I already have an ftpd running on port 20/21/Unpriv on a linuxbox1 connected directly to the internet..
However I want to port forward 1574 to another ftpd which is serving ftp on port 1574 within an internal LAN on box2.
If the default ftp ports are 20/21 what ports do i forward instead of 20/21.. I know i have to forward 1574 but what other port do i need to forward to make up for port 20?? and the unpriv ports??
this is my attempt so far..
#$IPT -t nat -A PREROUTING -p tcp --sport $UNPRIVPORTS --dport 1574 -i $IEXT -j DNAT --to 10.0.0.2
#$IPT -A FORWARD -p tcp -i $IEXT --sport $UNPRIVPORTS -o $IINT -d 10.0.0.2 --dport 1574 -j ACCEPT
#$IPT -t nat -A PREROUTING -p tcp --sport $UNPRIVPORTS --dport 1573 -i $IEXT -j DNAT --to 10.0.0.2
#$IPT -A FORWARD -p tcp -i $IEXT --sport $UNPRIVPORTS -o $IINT -d 10.0.0.2 --dport 1573 -j ACCEPT
#$IPT -t nat -A PREROUTING -p tcp --sport $UNPRIVPORTS --dport $UNPRIVPORTS -i $IEXT -j DNAT --to 10.0.0.2
#$IPT -A FORWARD -p tcp -i $IEXT --sport $UNPRIVPORTS -o $IINT -d 10.0.0.2 --dport $UNPRIVPORTS -j ACCEPT
problem with this is..
won't this cut out the INPUT for unprivports, hence rendering the ftpd on linuxbox1 inaccessable?
Please help.
|
|
|
04-23-2002, 12:37 PM
|
#2
|
Moderator
Registered: May 2001
Posts: 29,417
|
IIRC the ftp data port always is one below the control connection, like you ve shown in your example. This example (as far as I can see) won't cut out $UNPRIVPORTS as it's first-match-wins in netfilter/iptables, and this one only matches $UNPRIVPORTS ACCEPT's for this address.
/* Kinda IIRC, cuz Raz left so we can't ask him, I still need to convert to netfilter/iptables... */
|
|
|
04-23-2002, 07:41 PM
|
#3
|
Member
Registered: Jan 2002
Location: UK
Distribution: Redhat 7.2
Posts: 35
Original Poster
Rep:
|
so if i used 800 as control connection then the data transfer port will be 799.
as for unpriv ports, even if i FORWARD unpriv ports, it won't interfere with the INPUT unpriv ports because it is specifically filtering packets that has its destination to 10.0.0.2..
am i correct?
I think i'm beginning to understand..
|
|
|
04-24-2002, 03:03 AM
|
#4
|
Moderator
Registered: May 2001
Posts: 29,417
|
Quote:
Originally posted by FunkFlex
so if i used 800 as control connection then the data transfer port will be 799.
|
AFAIK, yes.
as for unpriv ports, even if i FORWARD unpriv ports, it won't interfere with the INPUT unpriv ports because it is specifically filtering packets that has its destination to 10.0.0.2[/QUOTE]
Guesso, to me it kinda reads like: "lemme FORWARD from TCP WHERE source is UNPRIVPORTS AND destination is 10.0.0.2 1574" :-]
If unsure I always tack on logging rules for *everything* dropped and accepted, so you'll see soon enough what fails where.
|
|
|
All times are GMT -5. The time now is 12:54 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
|
|