Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 08/11/2019, à 19:21

PingouinMagnifique

FTP Proftpd Impossible d'accéder aux fichiers

Bonjour,

Je cherche a faire fonctionner un serveur FTP sur Xubuntu. J'ai installer Proftpd à partir des tutos sur ce site. Le FTP semble me marcher je ne peux pas accéder au fichier. Voici le message que j'ai sur Filezila:

Statut :	Connexion établie, attente du message d'accueil...
Statut :	Initialisation de TLS...
Statut :	Vérification du certificat...
Statut :	Connexion TLS établie.
Statut :	Connecté
Statut :	Récupération du contenu du dossier...
Statut :	Le serveur a envoyé une réponse passive avec une adresse non routable. Adresse remplacée par celle du serveur.
Commande :	MLSD

Je pense que le problème vient plus de ma box Orange (Livebox4) que j'ai tenté de configurer au mieux.

Merci d'avance pour ceux qui auraient une piste de solutions.

Pour Info voici mon proftpd.conf:

#
# /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			"Debian"
# Set to inetd only if you would run proftpd by inetd/xinetd.
# Read README.Debian for more information on proper configuration.
ServerType				standalone
DeferWelcome			off
MultilineRFC2228		on
DefaultServer			on
ShowSymlinks			on
TimeoutNoTransfer		1200
TimeoutStalled			1200
TimeoutIdle			1200
DisplayLogin                    welcome.msg
DisplayChdir               	.message true
ListOptions                	"-l"
DenyFilter			\*.*/
# Use this to jail all users in their homes 
DefaultRoot			~
# 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                  50000 50100
# 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		1.2.3.4
# 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				ftpuser
Group				ftpgroup
# 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
# [url]http://www.securityfocus.com/bid/11430/discuss[/url]
# 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>
#
# Alternative authentication frameworks
#
#Include /etc/proftpd/ldap.conf
#Include /etc/proftpd/sql.conf
#
# This is used for FTPS connections
#
#Include /etc/proftpd/tls.conf
#
# Useful to keep VirtualHost/VirtualRoot directives separated
#
#Include /etc/proftpd/virtuals.conf
# A basic anonymous configuration, no upload directories.

# <Anonymous ~ftp>
#   User				ftp
#   Group				nogroup
#   # We want clients to be able to login with "anonymous" as well as "ftp"
#   UserAlias			anonymous ftp
#   # Cosmetic changes, all files belongs to ftp user
#   DirFakeUser	on ftp
#   DirFakeGroup on ftp
# 
#   RequireValidShell		off
# 
#   # Limit the maximum number of anonymous logins
#   MaxClients			10
# 
#   # We want 'welcome.msg' displayed at login, and '.message' displayed
#   # in each newly chdired directory.
#   DisplayLogin			welcome.msg
#   DisplayChdir		.message
# 
#   # Limit WRITE everywhere in the anonymous chroot
#   <Directory *>
#     <Limit WRITE>
#       DenyAll
#     </Limit>
#   </Directory>
# 
#   # Uncomment this if you're brave.
#   # <Directory incoming>
#   #   # Umask 022 is a good standard umask to prevent new files and dirs
#   #   # (second parm) from being group and world writable.
#   #   Umask				022  022
#   #            <Limit READ WRITE>
#   #            DenyAll
#   #            </Limit>
#   #            <Limit STOR>
#   #            AllowAll
#   #            </Limit>
#   # </Directory>
# 
# </Anonymous>
# Include other custom configuration files
Include /etc/proftpd/conf.d/


<VirtualHost localhost>
Port 65535
ServerName "localhost"
ServerIdent on "Vhost server"
PassivePorts 49152 65534
#MasqueradeAddress None
ServerAdmin Admin@example.org
Umask 022
TimesGMT off
MaxLoginAttempts 3
TimeoutLogin 300
TimeoutNoTransfer 120
TimeoutIdle 120
User nobody
Group nobody
DirFakeUser on nobody
DirFakeGroup on nobody
DefaultTransferMode binary
AllowForeignAddress off
DeleteAbortedStores off
AllowRetrieveRestart on
AllowStoreRestart on
TransferRate RETR 142
TransferRate STOR 142
TransferRate STOU 142
TransferRate APPE 142
RequireValidShell off
<IfModule mod_tls.c>
TLSEngine off
TLSRequired off
TLSVerifyClient off
TLSLog /var/log/proftpd_tls.log
TLSRSACertificateFile /etc/gadmin-proftpd/certs/cert.pem
TLSRSACertificateKeyFile /etc/gadmin-proftpd/certs/key.pem
TLSCACertificateFile /etc/gadmin-proftpd/certs/cacert.pem
TLSRenegotiate required off
</IfModule>

<IfModule mod_ratio.c>
Ratios off
SaveRatios off
RatioFile "/restricted/proftpd_ratios"
RatioTempFile "/restricted/proftpd_ratios_temp"
CwdRatioMsg "Please upload first!"
FileRatioErrMsg "FileRatio limit exceeded, upload something first..."
ByteRatioErrMsg "ByteRatio limit exceeded, upload something first..."
LeechRatioMsg "Your ratio is unlimited."
</IfModule>

<Limit LOGIN>
  DenyAll
</Limit>
</VirtualHost>

Modération : merci d'utiliser les balises code (explications ici).

Dernière modification par cqfd93 (Le 08/11/2019, à 19:31)

Hors ligne

#2 Le 09/11/2019, à 18:22

bruno

Re : FTP Proftpd Impossible d'accéder aux fichiers

Bonsoir,
Ta configuration est pour le moins étrange…
Peux-tu expliquer ceci :

# 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                  50000 50100
…
<VirtualHost localhost>
Port 65535
ServerName "localhost"
ServerIdent on "Vhost server"
PassivePorts 49152 65534
…

et cela :

<Limit LOGIN>
  DenyAll
</Limit>

Hors ligne

#3 Le 12/11/2019, à 11:49

PingouinMagnifique

Re : FTP Proftpd Impossible d'accéder aux fichiers

Bonjour,

Merci @Bruno pour ta réponse.

J'ai effectivement pas mal bidouillé le fichier proftpd.conf et sûrement fait des bêtises.

Du coup je suis reparti du proftpd.conf qui avait été généré lors de l'installation et j'ai relancer le serveur et j'ai malheureusement le même problème. Voici le proftpd.conf de base:

#
# /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			"Debian"
# Set to inetd only if you would run proftpd by inetd/xinetd.
# Read README.Debian for more information on proper configuration.
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			~
# 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		1.2.3.4
# 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
# [url]http://www.securityfocus.com/bid/11430/discuss[/url]
# 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>
#
# Alternative authentication frameworks
#
#Include /etc/proftpd/ldap.conf
#Include /etc/proftpd/sql.conf
#
# This is used for FTPS connections
#
#Include /etc/proftpd/tls.conf
#
# Useful to keep VirtualHost/VirtualRoot directives separated
#
#Include /etc/proftpd/virtuals.conf
# A basic anonymous configuration, no upload directories.

# <Anonymous ~ftp>
#   User				ftp
#   Group				nogroup
#   # We want clients to be able to login with "anonymous" as well as "ftp"
#   UserAlias			anonymous ftp
#   # Cosmetic changes, all files belongs to ftp user
#   DirFakeUser	on ftp
#   DirFakeGroup on ftp
# 
#   RequireValidShell		off
# 
#   # Limit the maximum number of anonymous logins
#   MaxClients			10
# 
#   # We want 'welcome.msg' displayed at login, and '.message' displayed
#   # in each newly chdired directory.
#   DisplayLogin			welcome.msg
#   DisplayChdir		.message
# 
#   # Limit WRITE everywhere in the anonymous chroot
#   <Directory *>
#     <Limit WRITE>
#       DenyAll
#     </Limit>
#   </Directory>
# 
#   # Uncomment this if you're brave.
#   # <Directory incoming>
#   #   # Umask 022 is a good standard umask to prevent new files and dirs
#   #   # (second parm) from being group and world writable.
#   #   Umask				022  022
#   #            <Limit READ WRITE>
#   #            DenyAll
#   #            </Limit>
#   #            <Limit STOR>
#   #            AllowAll
#   #            </Limit>
#   # </Directory>
# 
# </Anonymous>
# Include other custom configuration files
Include /etc/proftpd/conf.d/

J'ai également testé un proftpd.conf plus simple que j'ai trouvé sur le forum:

Include /etc/proftpd/modules.conf

ServerName			"ks3296972.kimsufi.com"
ServerIdent on			"my FTP Server"
ServerType			standalone
DefaultServer			on

Port				21
PassivePorts			49152 65534

AuthOrder			mod_auth_pam.c* mod_auth_unix.c

SystemLog			/var/log/proftpd/proftpd.log

Voici la réponse de Filezila:

Statut :	Connexion à 81.250.129.90:21...
Statut :	Connexion établie, attente du message d'accueil...
Statut :	Serveur non sécurisé, celui-ci ne supporte pas FTP sur TLS.
Statut :	Connecté
Statut :	Récupération du contenu du dossier...
Commande :	PWD
Réponse :	257 "/home/linux" est le répertoire courant
Commande :	TYPE I
Réponse :	200 Type paramétré à I
Commande :	PASV
Réponse :	227 Entering Passive Mode (81,250,129,90,224,17).
Commande :	MLSD

J'ai toujours un problème de récupération de dossier.

Si jamais quelqu'un à une idée pour que je puisse avoir accès aux données ce serai parfait.

En attendant je vais essayer de repartir du proftpd.conf de base que j'ai eu à l'installation en simplifiant avec la documentation.

Merci à ceux qui on lu jusqu'ici.

Dernière modification par PingouinMagnifique (Le 12/11/2019, à 14:26)

Hors ligne

#4 Le 12/11/2019, à 13:13

cqfd93

Re : FTP Proftpd Impossible d'accéder aux fichiers

Modération

Bonjour,

Pour ajouter toi-même les balises code à ton message #3 :

  • Cliquer sur le lien « Modifier » en bas à droite du message

  • Sélectionner le texte

  • Cliquer sur le <> de l'éditeur de message
    1471986854.png


cqfd93

Hors ligne

#5 Le 12/11/2019, à 14:22

bruno

Re : FTP Proftpd Impossible d'accéder aux fichiers

En attendant que tu remettes ton message en forme suivant les recommandations de cqfd93, voici quelques points importants :

- la doc proftpd est à l'état de brouillon et n'est absolument pas fiable ;
- quand on configure un service mieux vaut se référer à la doc officielle : http://proftpd.org/docs/ ;
- avec le fichier de configuration par défaut, tout utilisateur système peut se connecter et est bloqué dans son dossier personnel (cf. DefaulRoot)

Telle quelle ce n'est pas une configuration sécurisée car le protocole FTP n'est pas chiffré. Les information, et notamment les noms d'utilisateurs et mots de passe, circulent en clair sur les réseaux.
Si le serveur est destiné à être exposé sur l'Internet, il faudra en plus configurer le chiffrement TLS au dessus de FTP, soit FTPS (voir ici par exemple). Ceci dit, il est souvent bien plus simple et plus sécurisé d'utiliser le service SFTP fourni avec le serveur openSSH.

Hors ligne

#6 Le 12/11/2019, à 14:35

PingouinMagnifique

Re : FTP Proftpd Impossible d'accéder aux fichiers

Bonjour et merci au modérateur pour les informations de Balises

Bruno,
Je vais reprendre ma config en me fiant uniquement à la doc officielle.

Concernant le DefaulRoot, effectivement je souhaite que chaque utilisateur aie accès uniquement à son répertoire. J'ai déjà essayer de le déactivé mais ça na pas résolu mon problème.

Pour la sécurité, j'attends d'avoir un serveur qui marche pour installer openSSH. N'hésite pas à me dire si c'est plus judicieux de le faire en même temps.

Encore merci pour ton aide.

Hors ligne

#7 Le 12/11/2019, à 14:53

bruno

Re : FTP Proftpd Impossible d'accéder aux fichiers

Avec la configuration par défaut cela devrait fonctionner.
Maintenant tu parles de box Orange, mais on en sais pas où se situent le serveur et le client…

Hors ligne

#8 Le 12/11/2019, à 15:22

PingouinMagnifique

Re : FTP Proftpd Impossible d'accéder aux fichiers

J'ai pris la config Basic du site officiel: http://proftpd.org/docs/configs/basic.conf
J'ai juste changer le ServerName, User, Group et j'ai enlevé la partie anonyme. Cela ne fonctionne pas plus.

# This is a basic ProFTPD configuration file (rename it to 
# 'proftpd.conf' for actual use.  It establishes a single server
# and a single anonymous login.  It assumes that you have a user/group
# "nobody" and "ftp" for normal operation and anon.

ServerName			"Le Pingouin Magnifique"
ServerType			standalone
DefaultServer			on

# Port 21 is the standard FTP port.
Port				21

# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.
Umask				022

# 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 under which the server will run.
User				ftpuser
Group				ftpgroup

# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
DefaultRoot ~

# Normally, we want files to be overwriteable.
<Directory />
  AllowOverwrite		on
</Directory>

La réponse de Filezila:

Statut :	Connexion à 81.250.129.90:21...
Statut :	Connexion établie, attente du message d'accueil...
Statut :	Serveur non sécurisé, celui-ci ne supporte pas FTP sur TLS.
Statut :	Connecté
Statut :	Récupération du contenu du dossier...
Commande :	PWD
Réponse :	257 "/home/linux" est le répertoire courant
Commande :	TYPE I
Réponse :	200 Type paramétré à I
Commande :	PASV
Réponse :	227 Entering Passive Mode (81,250,129,90,159,247).
Commande :	MLSD

Hors ligne

#9 Le 12/11/2019, à 16:20

bruno

Re : FTP Proftpd Impossible d'accéder aux fichiers

Problème de pare-feu (ou de redirection de ports), vraisemblablement.
Tu attaques directement une IP publique, je suppose donc que le serveur FTP est derrière ta box et qu'un pare-feu bloque certains ports indispensables pour les transactions FTP, ou que les ports ne sont pas correctement redirigés vers le serveur (21 + la plage de ports pour le mode passif).

Hors ligne

#10 Le 12/11/2019, à 16:37

PingouinMagnifique

Re : FTP Proftpd Impossible d'accéder aux fichiers

J'ai déjà chercher de se côté mais je ne vois pas ce qui cloche:

linux@Pingouin-FTP:/etc/proftpd$ sudo ufw status verbose 
État : actif
Journalisation : on (low)
Par défaut : deny (incoming), allow (outgoing), disabled (routed)
Nouveaux profils : skip

Vers                       Action      De
----                       ------      --
20                         ALLOW IN    Anywhere                  
21                         ALLOW IN    Anywhere                  
20 (v6)                    ALLOW IN    Anywhere (v6)             
21 (v6)                    ALLOW IN    Anywhere (v6) 

Et sur ma Livebox 4, j'ai créé une IP fixe pour l'ordi du FTP, mis en place des règles NAT/PAT

[img]/home/linux/Bureau/Capture d’écran_2019-11-12_16-31-53.png[/img]

Et ouvert les ports du Pare feu de la livebox

[img]/home/linux/Bureau/Capture d’écran_2019-11-12_16-30-56.png[/img]

Hors ligne

#11 Le 12/11/2019, à 16:51

bruno

Re : FTP Proftpd Impossible d'accéder aux fichiers

Déjà faire fonctionner un serveur FTP derrière un pare-feu ce n'est pas évident, mais s'il y en a deux …

Franchement du SFTP avec openssh-server, c'est 100 fois plus simple et sécurisé. FTP c'est vraiment un protocole du XXe siècle.

Côté serveur les connexions entrantes doivent être autorisées sur le port 21, le port 20 (pour le mode non passif,) sur toutes la plages de ports définis pour le mode passif (cf. PassivePorts).
Même chose sur le par-feu de la bos avec un plus des redirections des ports, 21, 20 et de toute la plage de ports définis pour le mode passif vers les mes ports du serveur.

Hors ligne

#12 Le 12/11/2019, à 17:09

PingouinMagnifique

Re : FTP Proftpd Impossible d'accéder aux fichiers

Si tu me dis que le SFTP avec openssh-server est plus simple et plus sûr. Je vais partir là-dessus. Si tu as un lien avec tuto je suis preneur.
Concernant les firewalls, je vais désactivé celui de l'ordi.

Merci encore pour ton aide.

Hors ligne