[SOLVED] Server FTP (again)

Postate qui per tutte le discussioni legate a Linux in generale.

Moderatore: Staff

Regole del forum
1) Citare sempre la versione di Slackware usata, la versione del Kernel e magari anche la versione della libreria coinvolta. Questi dati aiutano le persone che possono rispondere.
2) Per evitare confusione prego inserire in questo forum solo topic che riguardano appunto Gnu/Linux in genere, se l'argomento è specifico alla Slackware usate uno dei forum Slackware o Slackware64.
3) Leggere attentamente le risposte ricevute
4) Scrivere i messaggi con il colore di default, evitare altri colori.
5) Scrivere in Italiano o in Inglese, se possibile grammaticalmente corretto, evitate stili di scrittura poco chiari, quindi nessuna abbreviazione tipo telegramma o scrittura stile SMS o CHAT.
6) Appena registrati è consigliato presentarsi nel forum dedicato.

La non osservanza delle regole porta a provvedimenti di vari tipo da parte dello staff, in particolare la non osservanza della regola 5 porta alla cancellazione del post e alla segnalazione dell'utente. In caso di recidività l'utente rischia il ban temporaneo.
Rispondi
Avatar utente
Burroughs
Linux 4.x
Linux 4.x
Messaggi: 1076
Iscritto il: mer 15 dic 2004, 0:00
Nome Cognome: Andrea Lutri
Kernel: 3.16.0
Desktop: KDE SC 4.13.3
Distribuzione: Arch Linux
Località: Glasgow
Contatta:

[SOLVED] Server FTP (again)

Messaggio da Burroughs »

Buona domenica a tutti.
Sto cercando di rendere raggiungibile il mio decoder Zgemma H7S, su cui è installata OpenATV, dall'esterno, affidandomi a vsftpd.
Premetto che è una procedura che avevo già eseguito con un altro decoder in mio possesso, fra l'altro ne avevo parlato qualche tempo fa qui.
La configurazione del server è la seguente:

Codice: Seleziona tutto

# Example config file /etc/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.

# run standalone
listen=NO
listen_ipv6=YES

# No PAM sessions to save resources
session_support=NO

# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
#anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=NO
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=NO
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES
#chown_username=whoever
#
# You may override where the log file goes if you like. The default is shown
# below.
#xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format
xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftp
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that turning on ascii_download_enable enables malicious remote parties
# to consume your I/O resources, by issuing the command "SIZE /big/file" in
# ASCII mode.
# These ASCII options are split into upload and download because you may wish
# to enable ASCII uploads (to prevent uploaded scripts etc. from breaking),
# without the DoS risk of SIZE and ASCII downloads. ASCII mangling should be
# on the client anyway..
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
# You may fully customise the login banner string:
#ftpd_banner=Welcome to blah FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd.banned_emails
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
chroot_list_enable=YES
# (default follows)
chroot_list_file=/etc/vsftpd.chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
# This string is the name of the PAM service vsftpd will use.
pam_service_name=vsftpd
#
# This option is examined if userlist_enable is activated. If you set this
# setting to NO, then users will be denied login  unless  they are  explicitly 
# listed  in the file specified by userlist_file.  When login is denied, the 
# denial is issued before the user is asked for a password.
userlist_deny=YES
#
# If enabled, vsftpd will load a list of usernames, from the filename given by
# userlist_file.  If a user tries to log in using  a  name in  this  file,  they
# will be denied before they are asked for a password. This may be useful in 
# preventing cleartext passwords being transmitted. See also userlist_deny.
userlist_enable=NO
#
# If enabled,  vsftpd  will display directory listings with the time in your
# local time zone. The default is to display GMT. The times returned by the
# MDTM FTP command are also affected by this option.
use_localtime=YES
#
# If set to YES, local users will be (by default) placed in a chroot() jail in
# their home directory after login.  Warning: This  option has  security  
# implications,  especially  if  the users have upload permission, or shell access.
# Only enable if you know what you are doing.  Note that these security implications
# are not vsftpd specific. They apply to all FTP daemons which offer to put 
# local  users in chroot() jails.
chroot_local_user=YES
#
allow_writeable_chroot=YES
#
tcp_wrappers=NO

# Enable FXP
pasv_promiscuous=YES
port_promiscuous=YES

# Allow users w/o shell access
check_shell=NO

# Start directory for non-chrooted users
local_root=/

# Enable directory listing
dirlist_enable=YES

# Change FTP default listening ports
listen_port=880
ftp_data_port=881

# Additional settings
pasv_enable=YES
pasv_min_port=64000 
pasv_max_port=64010
port_enable=YES
Sul router ho nattato le porte in questione, quindi il range 880-881 ed il range 64000-64010, ma riesco solo a connettermi in locale.
Premetto che, vivendo in UK, il router che utilizzo, il Virgin Media Hub 3, fa leggermente schifo, ma non mi sembra che la mia configurazione sia roba dell'altro mondo...
Any ideas???
Ultima modifica di Burroughs il sab 4 apr 2020, 16:23, modificato 1 volta in totale.
"Two things are infinite: the universe and human stupidity; and I'm not sure about the universe" (Albert Einstein)

ilmich
Master
Master
Messaggi: 1645
Iscritto il: lun 16 lug 2007, 17:39
Slackware: 15.0 64bit
Kernel: 5.15.27
Desktop: kde
Località: Roma

Re: Server FTP (again)

Messaggio da ilmich »

controllo banale... verifica che il tuo provider ti dia un ip pubblico 'personale'
Io ad esempio col mio attuale provider Fastweb ho dovuto chiederlo come servizio, perchè diversamente mi nattavano con una ulteriore sottorete e di conseguenza tutti i tentativi di aprire porte sul router andavano in cavalleria.
#LiveSimple and #ProgramThings
https://github.com/ilmich
http://ilmich6502.it/

Avatar utente
Burroughs
Linux 4.x
Linux 4.x
Messaggi: 1076
Iscritto il: mer 15 dic 2004, 0:00
Nome Cognome: Andrea Lutri
Kernel: 3.16.0
Desktop: KDE SC 4.13.3
Distribuzione: Arch Linux
Località: Glasgow
Contatta:

Re: Server FTP (again)

Messaggio da Burroughs »

Ciao, miklos, grazie per aver risposto.
Io vivo in UK, ho la fibra e mi viene fornito un IP pubblico sostanzialmente statico, anche se da anni utilizzo un DNS dinamico, per sicurezza e comodità.
Ho nattato diverse porte sul router finora, considera che ho almeno tre server SSH che, per ovvi motivi, non usano la porta TCP di default, un server WebDAV ed un NAS, tutti nattati, appunto, e pubblicati su Internet.
L'unico problema ce l'ho con il server FTP sul decoder, configurato in modalità passiva.
Quello che ho notato, avviando la sessione FTP da riga di comando, è che la connessione avviene regolarmente ed all'istante, sulla porta 880, quando inoltro il comando per la visualizzazione dell'albero delle directory, invece, si blocca tutto e la sessione va in timeout:

Codice: Seleziona tutto

ftp> dir
229 Entering Extended Passive Mode (|||64184|)
ftp: Can't connect to `public_ip_address': Operation timed out
200 EPRT command successful. Consider using EPSV.
150 Here comes the directory listing.
drwxr-xr-x    2 0        0            4096 Mar 30 17:59 bin
drwxr-xr-x    2 0        0           16384 Jan 01  1970 boot
drwxr-xr-x   13 0        0           13760 Mar 30 22:39 dev
drwxr-xr-x   46 0        0            4096 Mar 30 22:41 etc
lrwxrwxrwx    1 0        0               9 Mar 30 18:00 hdd -> media/hdd
drwxr-xr-x    3 0        0            4096 Mar 30 17:59 home
drwxr-xr-x    8 0        0            4096 Mar 30 17:59 lib
drwxrwxrwt    4 0        0              80 Mar 30 22:39 media
lrwxrwxrwx    1 0        0               5 Mar 30 18:00 mnt -> media
dr-xr-xr-x  149 0        0               0 Jan 01  1970 proc
drwxr-xr-x    4 0        0            4096 Mar 30 22:08 run
drwxr-xr-x    2 0        0            4096 Mar 30 17:59 sbin
lrwxrwxrwx    1 0        0              10 Mar 30 18:00 share -> /usr/share
dr-xr-xr-x   12 0        0               0 Mar 30 22:39 sys
lrwxrwxrwx    1 0        0              17 Mar 30 18:00 tmp -> /var/volatile/tmp
drwxr-xr-x   11 0        0            4096 Mar 30 18:00 usr
drwxr-xr-x    7 0        0            4096 Mar 30 18:00 var
226 Directory send OK.
In pratica, quando il server FTP mette a disposizione una porta passiva random, facente parte del range che ho indicato io, qualcosa non va per il verso giusto e la sessione va in timeout.
L'unica spiegazione che mi sono dato è che sul server (il decoder) occorra aprire le porte passive che ho specificato nel file di configurazione, ma mi sembra una soluzione eccessiva e, fra l'altro, impraticabile in quanto il decoder implementa una versione castrata di iptables, in pratica non esiste l'opzione per passargli la destination port.
Che ne pensi?
"Two things are infinite: the universe and human stupidity; and I'm not sure about the universe" (Albert Einstein)

ilmich
Master
Master
Messaggi: 1645
Iscritto il: lun 16 lug 2007, 17:39
Slackware: 15.0 64bit
Kernel: 5.15.27
Desktop: kde
Località: Roma

Re: Server FTP (again)

Messaggio da ilmich »

penso che da adesso in poi potrei solo aiutarti ad andare per esclusione in quanto ammetto che il protocollo ftp è una di quelle cose che uso poco e sicuramente male.
Io ho disco di rete che ho apro 'spot' e solo per questioni emergenziali dall'interno della mia rete (alias il mio router e la sua console non sono accessibili dall'esterno) e quelle poche volte uso le porte 'standard'(sono piu' un fan della sicurezza degli accessi che dell'oscurantismo delle porte) e in modalità attiva quindi a me ha sempre funzionato regolarmente.

ad occhio non credo tu abbia problemi col firewall del decoder anche perchè se accedi nello stesso modo anche in lan locale non si spiegherebbe perchè a quanto dici ti funziona.

perciò la butto li... hai provato ad usare un altro range di porte?!?!? se in quel range di porte ci associ un altro servizio funziona?!?! sto pensando a dei filtri del provider
#LiveSimple and #ProgramThings
https://github.com/ilmich
http://ilmich6502.it/

Avatar utente
Burroughs
Linux 4.x
Linux 4.x
Messaggi: 1076
Iscritto il: mer 15 dic 2004, 0:00
Nome Cognome: Andrea Lutri
Kernel: 3.16.0
Desktop: KDE SC 4.13.3
Distribuzione: Arch Linux
Località: Glasgow
Contatta:

Re: Server FTP (again)

Messaggio da Burroughs »

miklos ha scritto:
mer 1 apr 2020, 6:57
[CUT]
perciò la butto li... hai provato ad usare un altro range di porte?!?!? se in quel range di porte ci associ un altro servizio funziona?!?! sto pensando a dei filtri del provider
Ciao, miklos, sì ho provato ad usare un range di porte differente ma il problema rimane lo stesso.
Onestamente, non ho ancora utilizzato le stesse porte per servizi diversi ma ti posso garantire che altri servizi di rete che ho abilitato, su porte molto random e non ben note, vanno bene.
Farò questo tentativo, nel frattempo sto provando immagini diverse e versioni diverse della stessa immagine, in quanto mi convinco sempre di più che possa trattarsi di un bug.
"Two things are infinite: the universe and human stupidity; and I'm not sure about the universe" (Albert Einstein)

Avatar utente
Burroughs
Linux 4.x
Linux 4.x
Messaggi: 1076
Iscritto il: mer 15 dic 2004, 0:00
Nome Cognome: Andrea Lutri
Kernel: 3.16.0
Desktop: KDE SC 4.13.3
Distribuzione: Arch Linux
Località: Glasgow
Contatta:

Re: [SOLVED] Server FTP (again)

Messaggio da Burroughs »

Ho risolto utilizzando, visto che non vi era altra scelta, un workaround: in condizioni "normali" avrei dovuto installare iptables e aggiungere le porte comprese nel range della connessione passiva alla catena di INPUT, ma era (ed è) impossibile perché tutte le immagini di Enigma2 hanno un supporto parziale ad iptables e, temo, nulla di nuovo cambierà anche in futuro.
Ho pensato allora di disinstallare dropbear, installare openssh-sftp e di aprire una porta diversa da quella di default.
Si è sistemato tutto in cinque minuti. \:D/ \:D/ \:D/
"Two things are infinite: the universe and human stupidity; and I'm not sure about the universe" (Albert Einstein)

Rispondi