FTP server behind pfsense
-
Hi,
I have installed a FTP (vsftpd) server on a linux server in my LAN network and i would like to access it from the WAN server but i does'nt work :(
The server should be reachable via SFTP (port 22) from the WAN network, here is my configuration of port fowarding: ( i made it from "Firewall->Rules->WAN)
http://hpics.li/cf3cb77When i try to access it with with WinSCP via WAN it keep searching for the host without finding it. I used the configration in https://doc.pfsense.org/index.php/FTP_without_a_Proxy for the conf of vsftpd but i have a question:
Can the the vsftpd server be reachable when with the configuration i made via "Firewall-> Rules" or should i add something in " Firewall->NAT->1:1" and if yes, what should i add ? Should i erase my current conf and create a new one in firewall->NAT ?
Thank you :P
-
22 is SSH.. Is it possible you have SSH (Secure Shell Server) enabled on your pfSense?
-
Hello chpalmer,
I have enabled the secureshell now i can access the server with the Public IP from the LAN but not from the WAN :(
-
I ama pretty sur i should add someting in "Firewall->NAT->1:1" but i don't know how to do it ;( i thought the configuration i have psoted would be enough :(
-
You do not need any 1:1 NAT to do a dead simple port forward. You are doing it wrong - use Firewall - NAT - Port Forward, not Firewall - Rules.
-
so your running your control channel for ftp on 22?? SSH or sftp?? WTF?? Makes ZERO sense to do that.. vsftp is not sftp server.. its a ftp server..
So which is it do you want to run ftp or ftps/ftpes (ftp using ssl) or do you wan to run sftp - which secure ftp using ssh.. Part of ssh, you do not need to install the ftp server vsftp to do that.
If sftp then simple as port forward 22. If then its a bit more complicated - are you clients active or passive. Are you going to do it over ssl then the common port is 990..
-
Hello doktornotor & chpalmer,
Thank you for your feedback, i am going to focus on ftp instead of sftp which looks easier.
Thank for your help, i will get back to you when i will be available.
-
Not sure where u got idea ftp is easier? In ftp there are multiple ports involved control and data and data changes direction if active or passive much more involved in getting to work through nat firewall while sftp is 1 port
-
Hi there again,
I have made progess regarding my FTP server but it still doesn'work. I have erased my old configuration and add this conf:
http://www.hostingpics.net/viewer.php?id=153586501.jpgFirst rule "FTP passive port forward":
http://www.hostingpics.net/viewer.php?id=805386262.jpgSecond rule "FTP port forward 4101":
http://www.hostingpics.net/viewer.php?id=597823163.jpgThe FTP works normally in the lan when the followwng line is uncommented:
"MasqueradeAddress x.x.x.x" (where x.x.x.x is the public adress of my pfsense).As soon as i uncomment it i cannot access my FTP anymore with his private IP adress from the LAN or with the public adress of my pfsense from the WAN, i have the same error message with winscp or filezilla client:
http://www.hostingpics.net/viewer.php?id=791995304.jpgIn the log of proftpd i see the messages:
"USER ftpuser: Login successful"
"FTP session opened"In the log of winscp i see:
. 2017-03-07 13:15:22.133 Using FTP protocol.
. 2017-03-07 13:15:22.133 Doing startup conversation with host.2017-03-07 13:15:22.196 PWD
< 2017-03-07 13:15:22.212 257 "/" est le répertoire courant
. 2017-03-07 13:15:22.212 Getting current directory name.
. 2017-03-07 13:15:22.383 Retrieving directory listing…
2017-03-07 13:15:22.383 TYPE A
< 2017-03-07 13:15:22.399 200 Type paramétré à A
2017-03-07 13:15:22.399 PASV
< 2017-03-07 13:15:22.415 227 Entering Passive Mode (x,x,x,x,234,144). (NOTE: x.x.x.x is the public addressof pfsense)
2017-03-07 13:15:22.415 MLSD
. 2017-03-07 13:15:22.415 Connecting to x.x.x.x:60048 ... (NOTE: x.x.x.x is the public addrress of pfsense)
. 2017-03-07 13:15:37.811 Timeout detected. (data connection)
. 2017-03-07 13:15:37.811 Could not retrieve directory listing- 2017-03-07 13:15:37.982 (EFatal) Lost connection.
I have the same thing in filezilla client so i think the problem doesnt come from the ftp client
Here is my proftpd config:
Includes DSO modules
Include /etc/proftpd/modules.conf
Set off to disable IPv6 support which is annoying on IPv4 only boxes.
UseIPv6 off
If set on you can experience a longer connection delay in many cases.
IdentLookups off
ServerName "Debian"
ServerType standalone
DeferWelcome offMultilineRFC2228 on
DefaultServer on
ShowSymlinks onTimeoutNoTransfer 600
TimeoutStalled 600
TimeoutIdle 1200DisplayLogin welcome.msg
DisplayChdir .message true
ListOptions "-l"DenyFilter *.*/
Use this to jail all users in their homes
DefaultRoot ~
Port 21 is the standard FTP port.
Port 4101
In some cases you have to specify passive ports range to by-pass
firewall limitations. Ephemeral ports can be used for that, but
feel free to use a more narrow range.
PassivePorts 60000 60050
If your host was NATted, this option is useful in order to
allow passive tranfers to work. You have to use your public
address and opening the passive ports used on your firewall as well.
MasqueradeAddress x.x.x.x (the public IP adress of my pfsense)
This is useful for masquerading address with dynamic IPs:
refresh any configured MasqueradeAddress directives every 8 hours
<ifmodule mod_dynmasq.c=""># DynMasqRefresh 28800</ifmodule>
To prevent DoS attacks, set the maximum number of child processes
to 30. If you need to allow more than 30 concurrent connections
at once, simply increase this value. Note that this ONLY works
in standalone mode, in inetd mode you should use an inetd server
that allows you to limit maximum number of processes per service
(such as xinetd)
MaxInstances 30
Set the user and group that the server normally runs at.
User proftpd
Group nogroupUmask 022 is a good standard umask to prevent new files and dirs
(second parm) from being group and world writable.
Umask 022 022
Normally, we want files to be overwriteable.
AllowOverwrite on
Uncomment this if you are using NIS or LDAP via NSS to retrieve passwords:
PersistentPasswd off
This is required to use both PAM-based authentication and local passwords
AuthOrder mod_auth_pam.c* mod_auth_unix.c
Be warned: use of this directive impacts CPU average load!
Uncomment this if you like to see progress and transfer rate with ftpwho
in downloads. That is not needed for uploads rates.
UseSendFile off
TransferLog /var/log/proftpd/xferlog
SystemLog /var/log/proftpd/proftpd.logLogging onto /var/log/lastlog is enabled but set to off by default
#UseLastlog on
In order to keep log file dates consistent after chroot, use timezone info
from /etc/localtime. If this is not set, and proftpd is configured to
chroot (e.g. DefaultRoot or <anonymous>), it will use the non-daylight
savings timezone regardless of whether DST is in effect.
#SetEnv TZ :/etc/localtime
<ifmodule mod_quotatab.c="">QuotaEngine off</ifmodule>
<ifmodule mod_ratio.c="">Ratios off</ifmodule>
Delay engine reduces impact of the so-called Timing Attack described in
http://www.securityfocus.com/bid/11430/discuss
It is on by default.
<ifmodule mod_delay.c="">DelayEngine on</ifmodule>
<ifmodule mod_ctrls.c="">ControlsEngine off
ControlsMaxClients 2
ControlsLog /var/log/proftpd/controls.log
ControlsInterval 5
ControlsSocket /var/run/proftpd/proftpd.sock</ifmodule><ifmodule mod_ctrls_admin.c="">AdminControlsEngine off</ifmodule>
This is used for FTPS connections
#Include /etc/proftpd/tls.conf
Useful to keep VirtualHost/VirtualRoot directives separated
#Include /etc/proftpd/virtuals.conf
Include other custom configuration files
Include /etc/proftpd/conf.d/
<limit login="">DenyGroup !ftpuser</limit></anonymous>
-
Dude, when you passive ports range is 60000 60050 then kindly do NOT redirect 6000 - 6050. WTF.
-
Hi doktornotor,
Thank you for you kind advice, indeed the port redirection was not correct, i modify it and its working now.
Thanks a lot WTF bro ;)
-
You are welcome.
P.S. FTP still sucks, definitely would use SCP/SFTP whenever it's a viable alternative. :P