ProFTPD not using port 21 for WAN - Help to make Guide?

Post new topic   Reply to topic    DD-WRT Forum Index -> Marvell MVEBU based Hardware (WRT1900AC etc.)
Author Message
fretbuzz
DD-WRT Novice


Joined: 07 Aug 2018
Posts: 5

PostPosted: Tue Aug 07, 2018 1:24    Post subject: ProFTPD not using port 21 for WAN - Help to make Guide? Reply with quote
Hi guys - I'm quite a newb and not very familiar with linux terminal commands, so really looking to accomplish this using webui. I have looked at a few posts (eg. https://wiki.dd-wrt.com/wiki/index.php/ProFTPd#Configure_proftpd and https://forum.dd-wrt.com/phpBB2/viewtopic.php?p=992239) but am still confused. I have a Linksys WRT1900ac running Firmware: DD-WRT v3.0-r36410 std ( 07/28/18 ).

I am trying to have WAN FTP access for my router using the built-in ProFTPD service. I can access the directory and files within the LAN and am able to get the user/pass login prompt from the WAN, but unable to list the directory contents. I would REALLY appreciate if some kind soul would be able to help with a guide of what to do after proftpd is enabled with a port other than 21. I know it has to do with port forwarding, but am a confused over whether my forwarding is working, or perhaps something simple as i need to reboot the router to properly initialize? I would think that a guide should be available as many people (including this greenhorn) would like to run an FTP server outside port 21 as a security measure...

Thanks! Smile


Last edited by fretbuzz on Thu Aug 09, 2018 0:56; edited 1 time in total
Sponsor
fretbuzz
DD-WRT Novice


Joined: 07 Aug 2018
Posts: 5

PostPosted: Wed Aug 08, 2018 20:52    Post subject: Reply with quote
In case anyone cares, I finally got it to work by:

1) Making sure my shares for ProFTPD were setup in Services->USB configuration
2) Making sure ProFTPD was enabled and custom port was entered in Services->NAS
3) Setting up a range of ports (which my custom port from #2 was a part of) to open under under NAT/Qos-> Port Range Forwarding.
4) Creating and Entering a startup script in Administration->Commands so that the router re-writes the proftpd conf file and IPtables after each router reboot:

#-------- for proftpd passive WAN access -----
echo 'MasqueradeAddress xxx.xxx.xxx.xxx'>> /tmp/proftpd/etc/proftpd.conf
echo 'PassivePorts xxxxx xxxxx'>> /tmp/proftpd/etc/proftpd.conf
/usr/sbin/iptables -I INPUT -p tcp -m tcp --dport xxxxx:xxxxx --syn -j logaccept
killall -HUP proftpd

make sure to:
- put your WAN IP address in MasqueradeAddress line
- Put the port range you used in #3 to the PassivePorts line
- not sure if the IP tables are necessary to be written to after each reboot, but I did it anyways: use same port range as #3 again.
- reboot router after the above is done.

Not sure why this is what it took for me, but hope it helps someone else looking to use a non-standard (not 21) FTP port with WAN access and successful active/passive directory listing from the WAN.

Cheers Smile
fretbuzz
DD-WRT Novice


Joined: 07 Aug 2018
Posts: 5

PostPosted: Thu Aug 09, 2018 0:56    Post subject: Reply with quote
After reboot - no longer working. I'll give up and use port 21 unless anyone else wants to chime in...
05dyna
DD-WRT Guru


Joined: 25 Jan 2008
Posts: 968

PostPosted: Thu Aug 09, 2018 12:49    Post subject: Reply with quote
Since this isn’t specific to Marvell ping one of the mods (if you could find one) and ask him or her to move this post over this General or Advanced Networking sub forum for more exposure. I’ve seen a few regulars over there on both sub forums than know their stuff when it comes to firewall and IPv6 rules so you’ll likely be better served there. If you can’t find a mod just repost it. I haven’t ran and ftp service in years and don’t have any plans to do it again but its makes perfect sense in today’s world why you would run it on an it on an alternative port, good luck
fretbuzz
DD-WRT Novice


Joined: 07 Aug 2018
Posts: 5

PostPosted: Thu Aug 09, 2018 15:38    Post subject: Reply with quote
fretbuzz wrote:
In case anyone cares, I finally got it to work by:

1) Making sure my shares for ProFTPD were setup in Services->USB configuration
2) Making sure ProFTPD was enabled and custom port was entered in Services->NAS
3) Setting up a range of ports (which my custom port from #2 was a part of) to open under under NAT/Qos-> Port Range Forwarding.
4) Creating and Entering a startup script in Administration->Commands so that the router re-writes the proftpd conf file and IPtables after each router reboot:

#-------- for proftpd passive WAN access -----
echo 'MasqueradeAddress xxx.xxx.xxx.xxx'>> /tmp/proftpd/etc/proftpd.conf
echo 'PassivePorts xxxxx xxxxx'>> /tmp/proftpd/etc/proftpd.conf
/usr/sbin/iptables -I INPUT -p tcp -m tcp --dport xxxxx:xxxxx --syn -j logaccept
killall -HUP proftpd

make sure to:
- put your WAN IP address in MasqueradeAddress line
- Put the port range you used in #3 to the PassivePorts line
- not sure if the IP tables are necessary to be written to after each reboot, but I did it anyways: use same port range as #3 again.
- reboot router after the above is done.

Not sure why this is what it took for me, but hope it helps someone else looking to use a non-standard (not 21) FTP port with WAN access and successful active/passive directory listing from the WAN.

Cheers Smile


I think I stumbled on something else:

- enter this as a "startup script":

#-------- for proftpd passive WAN access -----
echo 'MasqueradeAddress xxx.xxx.xxx.xxx'>> /tmp/proftpd/etc/proftpd.conf
echo 'PassivePorts xxxxx xxxxx'>> /tmp/proftpd/etc/proftpd.conf
killall -HUP proftpd

- enter this as a "firewall script":

/usr/sbin/iptables -I INPUT -p tcp -m tcp --dport xxxxx:xxxxx --syn -j logaccept

(ie. 2 different scripts in Administration->Commands)

- Also, do not enter anything in NAT/QoS->Port Forwarding/Port Range etc. as this forwards the login rules past the router, but does not input them into the router (which has ProFTPD on it). The scripts created under Administration->Commands will insert everything needed upon reboot.
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Marvell MVEBU based Hardware (WRT1900AC etc.) All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum