Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    FTP server behind pfsense

    Scheduled Pinned Locked Moved Firewalling
    12 Posts 4 Posters 3.5k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      sizeur
      last edited by

      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 :(

      1 Reply Last reply Reply Quote 0
      • S
        sizeur
        last edited by

        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 :(

        1 Reply Last reply Reply Quote 0
        • D
          doktornotor Banned
          last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • johnpozJ
            johnpoz LAYER 8 Global Moderator
            last edited by

            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..

            An intelligent man is sometimes forced to be drunk to spend time with his fools
            If you get confused: Listen to the Music Play
            Please don't Chat/PM me for help, unless mod related
            SG-4860 24.11 | Lab VMs 2.8, 24.11

            1 Reply Last reply Reply Quote 0
            • S
              sizeur
              last edited by

              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.

              1 Reply Last reply Reply Quote 0
              • johnpozJ
                johnpoz LAYER 8 Global Moderator
                last edited by

                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

                An intelligent man is sometimes forced to be drunk to spend time with his fools
                If you get confused: Listen to the Music Play
                Please don't Chat/PM me for help, unless mod related
                SG-4860 24.11 | Lab VMs 2.8, 24.11

                1 Reply Last reply Reply Quote 0
                • S
                  sizeur
                  last edited by

                  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.jpg

                  First rule "FTP passive port forward":
                  http://www.hostingpics.net/viewer.php?id=805386262.jpg

                  Second rule "FTP port forward 4101":
                  http://www.hostingpics.net/viewer.php?id=597823163.jpg

                  The 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.jpg

                  In 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                    off

                  MultilineRFC2228                on
                  DefaultServer                  on
                  ShowSymlinks                    on

                  TimeoutNoTransfer              600
                  TimeoutStalled                  600
                  TimeoutIdle                    1200

                  DisplayLogin                    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                          nogroup

                  Umask 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.log

                  Logging 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>

                  1 Reply Last reply Reply Quote 0
                  • D
                    doktornotor Banned
                    last edited by

                    Dude, when you passive ports range is  60000 60050 then kindly do NOT redirect 6000 - 6050. WTF.

                    1 Reply Last reply Reply Quote 0
                    • S
                      sizeur
                      last edited by

                      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 ;)

                      1 Reply Last reply Reply Quote 0
                      • D
                        doktornotor Banned
                        last edited by

                        You are welcome.

                        P.S. FTP still sucks, definitely would use SCP/SFTP whenever it's a viable alternative. :P

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.