Autor Tópico: Problemas com Proftpd  (Lida 4106 vezes)

Offline paulorobertoess

  • Usuário Ubuntu
  • *
  • Mensagens: 3
    • Ver perfil
Problemas com Proftpd
« Online: 26 de Julho de 2015, 17:54 »
Prezados, tenho um servidor FTP rodando em um servidor EC2 da Amazon, quando tento me conectar com o FileZilla obtenho o erro:
Erro:   A conexão excedeu limite de tempo
Erro:   Falha na obtenção da lista de pastas

Se eu checar com o ftptest.net tenho esse resultado:

Status: Connected, waiting for welcome message...
Reply: 220 FTP Server ready.
Command: CLNT https://ftptest.net on behalf of 187.74.89.5
Reply: 500 CLNT not understood
Command: USER lya
Reply: 331 Password required for lya
Command: PASS **************
Reply: 230 User lya logged in
Command: SYST
Reply: 215 UNIX Type: L8
Command: FEAT
Reply: 211-Features:
Reply: MFMT
Reply: LANG en-US.UTF-8*;en-US
Reply: SIZE
Reply: SITE MKDIR
Reply: MFF modify;UNIX.group;UNIX.mode;
Reply: REST STREAM
Reply: MLST modify*;perm*;size*;type*;unique*;UNIX.group*;UNIX.mode*;UNIX.owner*;
Reply: UTF8
Reply: EPRT
Reply: SITE SYMLINK
Reply: EPSV
Reply: SITE UTIME
Reply: MDTM
Reply: SITE RMDIR
Reply: TVFS
Reply: SITE COPY
Reply: 211 End
Command: PWD
Reply: 257 "/" is the current directory
Status: Current path is /
Command: TYPE I
Reply: 200 Type set to I
Command: PASV
Reply: 227 Entering Passive Mode (54,94,152,176,199,81).
Command: MLSD
Status: Data connection established.
Error: Malformed directory listing
Error: Line feed received without preceding carriage return


No log do proftpd tenho essa mensagem
2015-07-26 20:23:00,151 servidor01 proftpd[1772] localhost (filezilla-project.org[213.239.212.239]): USER lya: Login successful.
2015-07-26 20:23:03,424 servidor01 proftpd[1772] localhost (filezilla-project.org[213.239.212.239]): ROOT PRIVS: unable to seteuid(): Operation not permitted
2015-07-26 20:23:03,424 servidor01 proftpd[1772] localhost (filezilla-project.org[213.239.212.239]): ROOT PRIVS: unable to setegid(): Operation not permitted
2015-07-26 20:23:03,427 servidor01 proftpd[1772] localhost (filezilla-project.org[213.239.212.239]): RELINQUISH PRIVS: unable to seteuid(PR_ROOT_UID): Operation not permitted
2015-07-26 20:23:03,427 servidor01 proftpd[1772] localhost (filezilla-project.org[213.239.212.239]): FTP session closed.

Instalei o proftpd usando
Código: [Selecionar]
apt-get install proftpd-basic
O usuario foi adicionado usando os comando:

Código: [Selecionar]
cp /bin/false /bin/ftp
echo "/bin/ftp" >> /etc/shells
adduser --shell=/bin/ftp --home=/www/lya lya

Se eu executar ls -l na raiz:
Código: [Selecionar]
drwxr-xr-x   6 ftp  nogroup  4096 Jul 23 03:17 www

Se eu executar ls -l dentro de www
drwxr-xr-x  5 lya      lya      4096 Jul 23 03:17 lya


Arquivo /etc/proftp/proftpd.conf
Código: [Selecionar]
# /etc/proftpd/proftpd.conf -- This is a basic ProFTPD configuration file.
# To really apply changes, reload proftpd after modifications, if
# it runs in daemon mode. It is not required in inetd/xinetd mode.
#

# Includes DSO modules
Include /etc/proftpd/modules.conf

# Set off to disable IPv6 support which is annoying on IPv4 only boxes.
UseIPv6                         on
# If set on you can experience a longer connection delay in many cases.
IdentLookups                    off
ServerName                      "servidor01"
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                     ~
<Global>
ServerIdent on "FTP Server ready."
</Global>

# Users require a valid shell listed in /etc/shells to login.
# Use this directive to release that constrain.
# RequireValidShell             off

# Port 21 is the standard FTP port.
Port                            21

# 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                 49152 65534

# 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 54.94.152.176

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

# 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
QuotaLog /etc/proftpd/quota_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 on

<IfModule mod_quotatab_file.c>
QuotaLimitTable file:/etc/proftpd/ftpquota.limittab #Abaixo como criar os arquivos.
QuotaTallyTable file:/etc/proftpd/ftpquota.tallytab
</IfModule>
</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>



Meu Security Group esta configurado assim:

SSH      TCP      22      0.0.0.0/0     
Custom TCP Rule      TCP      2121      0.0.0.0/0     
HTTP      TCP      80      0.0.0.0/0     
DNS (UDP)      UDP      53      0.0.0.0/0     
HTTPS      TCP      443      0.0.0.0/0     
DNS (TCP)      TCP      53      0.0.0.0/0     
Custom TCP Rule      TCP      20 - 21      0.0.0.0/0     
All ICMP      All      N/A      0.0.0.0/0     
Custom TCP Rule      TCP      49152 - 65534      0.0.0.0/0
O que pode estar causando esse problema?

Offline irtigor

  • Equipe Ubuntu
  • Usuário Ubuntu
  • *****
  • Mensagens: 4.344
  • Delete, delete, delete!
    • Ver perfil
Re:Problemas com Proftpd
« Resposta #1 Online: 26 de Julho de 2015, 18:53 »
Olá, seja bem-vindo

Primeiramente, tá usando o Ubuntu, né?

Quanto as mensagens:

- O que está em vermelho a principio em ignoraria porque é devido a diferença dos caracteres de controle usados pra marcar novas linhas (windows usa \r\n e no linux é só \n), e isso só deve causar dor de cabeça se não usar um editor decente (por ex. se tiver usando o notepad).

- Não sei porque raios copiou o /bin/false e chamou de /bin/ftp, qualquer tutorial que mandasse fazer isso sem uma boa explicação eu descartaria imediatamente.

- Pra usar ftp anonimo tem que descomentar a linha com "RequireValidShell             off", como está escrito no arquivo de configuração.

----
Obs: movi pra servidores.
« Última modificação: 26 de Julho de 2015, 19:17 por irtigor »

Offline paulorobertoess

  • Usuário Ubuntu
  • *
  • Mensagens: 3
    • Ver perfil
Re:Problemas com Proftpd
« Resposta #2 Online: 26 de Julho de 2015, 20:17 »
Antes de mais nada, obrigado pela ajuda.

Estou usando o Ubuntu Server 14.04,  referente as mensagens em vermelho, eu não sabia dessas diferenças, obrigado!
Normalmente, as pessoas colocam /bin/false com o objetivo de colocar os usuários que só vão logar no ftp e não logaram em um shell, eu só mudei para /bin/ftp, porque é mais prático para eu lembrar depois. Não pretendo usar ftp anônimo agora, mas é bom saber como fazer.

Agora independente do que mostra o ftptest.net, quando eu tento me logar com fillezilla ou usando o Windows Explorer, não consigo me logar, sempre esgota o tempo e não lista as pastas e se eu olhar o log, esta com a mensagem abaixo, alguma ideia do que pode ser?

Código: [Selecionar]
2015-07-26 20:23:00,151 servidor01 proftpd[1772] localhost (filezilla-project.org[213.239.212.239]): USER lya: Login successful.
2015-07-26 20:23:03,424 servidor01 proftpd[1772] localhost (filezilla-project.org[213.239.212.239]): ROOT PRIVS: unable to seteuid(): Operation not permitted
2015-07-26 20:23:03,424 servidor01 proftpd[1772] localhost (filezilla-project.org[213.239.212.239]): ROOT PRIVS: unable to setegid(): Operation not permitted
2015-07-26 20:23:03,427 servidor01 proftpd[1772] localhost (filezilla-project.org[213.239.212.239]): RELINQUISH PRIVS: unable to seteuid(PR_ROOT_UID): Operation not permitted
2015-07-26 20:23:03,427 servidor01 proftpd[1772] localhost (filezilla-project.org[213.239.212.239]): FTP session closed.

Offline irtigor

  • Equipe Ubuntu
  • Usuário Ubuntu
  • *****
  • Mensagens: 4.344
  • Delete, delete, delete!
    • Ver perfil
Re:Problemas com Proftpd
« Resposta #3 Online: 26 de Julho de 2015, 21:01 »
Independentemente, se ler o arquivo vai ver que tem que descomentar aquela opção porque lya não tem um shell válido.