I'm writing an FTP client from scratch and have trouble opening a PASV connection. The server seems to send the right port, but the client receives a different raw string and subsequently cannot connect.
This is the server log (Filezilla):
2018.07.19 16:29:44 - (not logged in) (x.x.10.33)> Connected on port 21, sending welcome message...
2018.07.19 16:29:44 - (not logged in) (x.x.10.33)> 220 Hello from FileZilla Server 0.9.60 beta
2018.07.19 16:29:44 - (not logged in) (x.x.10.33)> USER test
2018.07.19 16:29:44 - (not logged in) (x.x.10.33)> 331 Password required for test
2018.07.19 16:29:45 - (not logged in) (x.x.10.33)> PASS test
2018.07.19 16:29:45 - test (x.x.10.33)> 230 Logged on
2018.07.19 16:29:45 - test (x.x.10.33)> PASV
2018.07.19 16:29:45 - test (x.x.10.33)> 227 Entering Passive Mode (y,y,105,118,93,232)
And this is the client log (my program):
> USER test
2018.07.19 14.29.02 - 220 Hello from FileZilla Server 0.9.60 beta
2018.07.19 14.29.02 - 331 Password required for test
> PASS test
2018.07.19 14.29.02 - 230 Logged on
> PASV
2018.07.19 14.29.03 - 227 Entering Passive Mode (y,y,105,118,214,224)
The shown output is the raw data received from the socket. All server output arrives, but the 227 response has the wrong port numbers. I'm confused how this is even possible.
The connection is via VPN (OpenVPN) from Vietnam to Germany, the server is located in Germany, too. I have verified that Filezilla and my client work together when run on the same machine (no internet traffic). I've also verified that my client works with an independent server (both locally and over unsecured internet), so the problem seems to be with Filezilla?
Related
I have a FTP server on a Windows Server 2012 machine and I am trying to get setup.exe from it.
CMD.EXE log:
C:\>ftp 1.2.3.4
Connected to 1.2.3.4.
220-FileZilla Server version 0.9.45 beta
220-written by Tim Kosse (tim.kosse#filezilla-project.org)
220 Please visit http://sourceforge.net/projects/filezilla/
User (1.2.3.4:(none)): my_username
331 Password required for my_username
Password:
230 Logged on
ftp> get setup.exe
200 Port command successful
150 Opening data channel for file download from server of "/setup.exe"
.. and stays like this
CMD.EXE log 2:
C:\>ftp 1.2.3.4
Connected to 1.2.3.4.
220-FileZilla Server version 0.9.45 beta
220-written by Tim Kosse (tim.kosse#filezilla-project.org)
220 Please visit http://sourceforge.net/projects/filezilla/
User (1.2.3.4:(none)): my_username
331 Password required for my_username
Password:
230 Logged on
ftp> quote cwd /
250 CWD successful. "/" is current directory.
ftp> quote TYPE I
200 Type set to I
ftp> QUOTE PASV
227 Entering Passive Mode (185,7,63,37,115,151)
ftp> RETR setup.exe
Invalid command.
ftp> QUOTE RETR setup.exe
425 Can't open data connection for transfer of "/setup.exe"
ftp> get setup.exe
200 Port command successful
150 Opening data channel for file download from server of "/setup.exe"
Aborting any active data connections...
Aborting any active data connections...
Connection closed by remote host.
ftp> quote get setup.exe
Not connected.
ftp>
FileZilla log:
Status: Connection established, waiting for welcome message...
Response: 220-FileZilla Server version 0.9.45 beta
Response: 220-written by Tim Kosse (tim.kosse#filezilla-project.org)
Response: 220 Please visit http://sourceforge.net/projects/filezilla/
Command: AUTH TLS
Response: 502 SSL/TLS authentication not allowed
Command: AUTH SSL
Response: 502 SSL/TLS authentication not allowed
Status: Insecure server, it does not support FTP over TLS.
Command: USER my_username
Response: 331 Password required for my_username
Command: PASS **************
Response: 230 Logged on
Status: Logged in
Status: Starting download of /setup.exe
Command: CWD /
Response: 250 CWD successful. "/" is current directory.
Command: TYPE I
Response: 200 Type set to I
Command: PASV
Response: 227 Entering Passive Mode (185,7,63,37,98,242)
Command: RETR setup.exe
Response: 150 Opening data channel for file download from server of "/setup.exe"
Response: 226 Successfully transferred "/setup.exe"
Status: File transfer successful, transferred 5,120 bytes in 1 second
Why it works with FileZilla but not with Windows FTP from command-line?
More than that I would want a command that executed one time would download this file from that FTP without asking the password.
Any ideas?
Thanks.
It works in FileZilla, because FileZilla defaults to the passive FTP mode, which is more firewall/NAT friendly. The Windows FTP command-line client (ftp.exe) not only defaults to the active mode, it does not even support the passive mode, on any version of Windows. It makes it pretty useless nowadays due to ubiquitous firewalls and NATs.
Read my article about the active and passive FTP connection modes to understand why the passive mode is a must.
Use any other Windows FTP command-line client instead. Most other support the passive mode.
For example WinSCP defaults to the passive mode and there's a guide available for converting Windows FTP script to WinSCP script.
Your can specifically use a batch file (.bat) like:
winscp.com /command ^
"open ftp://my_username:password#1.2.3.4/" ^
"get setup.exe" ^
"exit"
(I'm the author of WinSCP)
I recently completed my 1.0 version of my website and now that I uploaded it to dreamhost’s server, I’m having issues submitting the email form. When I host it locally, everything goes through with no problems. However, when on the server, it displays the email log:
SERVER -> CLIENT: 220 smtp.postmarkapp.com ESMTP sc-iad-smtp2
CLIENT -> SERVER: EHLO [website]
SERVER -> CLIENT: 250-smtp.postmarkapp.com250-PIPELINING250-SIZE 20480000250-VRFY250-ETRN250-STARTTLS250-AUTH PLAIN LOGIN CRAM-MD5 DIGEST-MD5250-AUTH=PLAIN LOGIN CRAM-MD5 DIGEST-MD5250-ENHANCEDSTATUSCODES250-8BITMIME250 DSN
CLIENT -> SERVER: AUTH LOGIN
SERVER -> CLIENT: 334 VXNlcm5hbWU6
CLIENT -> SERVER: NzI2NzExNWItNzYwNC00ZDE2LTk0MmEtNDIwM2Y5NTM2Njk5
SERVER -> CLIENT: 334 UGFzc3dvcmQ6
CLIENT -> SERVER: NzI2NzExNWItNzYwNC00ZDE2LTk0MmEtNDIwM2Y5NTM2Njk5
SERVER -> CLIENT: 235 2.7.0 Authentication successful
I’m currently using the postmark app while hosted on dreamhost.
I’ve tried editing this field:
if (!$mail->send()) {
echo "There was a problem sending the email:" . $mail->ErrorInfo;
exit;
}
by adding:
else {
header (“Location: [insert form confirmation page here]”)
}
But it just logs the command on the page. Can someone please help me understand why this is happening on the server and how to fix it?
I've been searching and testing for days now without any rational explanation for the following to happen:
I have a mail server which serves all our users and everyone is happily running on IMAP/POP3 access. I need to develop a utility to check POP3 e-mail and started getting errors retrieving mail. I set up the same pop account on my outlook and windows live mail and they couldn't download the e-mails either. I tried another PC and it downloaded just fine. After much debugging and searching, I found out that after sending the RETR command, there wasn't an "+OK" response on my pc but there was on the other pc. So I went down to telnet and sure as day my PC wasn't getting the +OK response on RETR, just the actual mail but I was getting it from every other pc I tried. I even booted up my win XP virtual pc and it has the same result as my pc. Here is an excerpt of the logs from mine and my test pc:
RETR with +OK:
+OK Welcome to MailEnable POP3 Server
USER devtest#x.com
+OK
PASS <Removed>
+OK
LIST
+OK 3 26743
1 2118
2 23949
3 676
.
UIDL
+OK
1 BE1F75CAE417453581CF11F16CF09989
2 846882DB63B54C9E91C4643AA5CCA1F5
3 A7BAFC28B04A493689A150F6D4CD7FD0
.
RETR 1
+OK 2118 octets
Received: from x ([x.x.60.10]) by x.net with MailEnab
le ESMTP; Sun, 28 Dec 2014 11:30:16 +0200
RETR with +OK missing:
+OK Welcome to MailEnable POP3 Server
USER devtest#x.com
+OK
PASS <Removed>
+OK
LIST
+OK 3 26743
1 2118
2 23949
3 676
.
UIDL
+OK
1 BE1F75CAE417453581CF11F16CF09989
2 846882DB63B54C9E91C4643AA5CCA1F5
3 A7BAFC28B04A493689A150F6D4CD7FD0
.
RETR 1
Received: from x ([x.x.60.10]) by x.net with MailEnab
le ESMTP; Sun, 28 Dec 2014 11:32:53 +0200
I'm now going to place another hard drive in my pc and install windows and telnet client and see what it does but I was hoping someone might have had some experience with this. It's only that one time that the +OK is missing, every other command has it showing as well as it being there on every other PC I try it on so it's only on my pc that it's missing.
Appreciate any thoughts or assistance!
Well loading a new hard drive worked perfectly as expected which led me to the fact that it must be something installed on my pc itself. Disabled the usual suspects (firewall and AV) and when that didn't work, I proceeded to close down every app running on my pc which possibly works with Ports and eventually narrowed the culprit down to the Fortinet VPN Client running on my PC. I don't have it's AV component enabled so I'm rather at a loss as to how it could be the reason for a single line on port 110 to go missing but if it's running then the +OK line is missing and if it's shut down then it appears.
I'm going to leave this question here in case it can help someone else and will also try post something to Fortinet as well.
I recently installed Postfix, Dovecot to setup a mail server on my own VPS ( using this tutorial: Email with Postfix, Dovecot, Mysql)
Imaps server uses port 993 for Authentication, and Postfix uses port 25 to send mails.
In this tutorial, users stored in a Database ( so imaps use mysql to authenticate users).
i'm sure every thing works fine with imaps and postfix , because few days ago i installed Kmail client (on my linux) and receive mails from my server. sending mails also works fine, i sent a mail to Gmail and google received it without a problem (in my "Gmail inbox" not spam folder)
So to get to my Emails from a web mail client, i installed Roundcube on /var/www/mail directory.
I configured Roundcube many times. but each time it gives me this Error:
IMAP Error: Login failed for [me#mydomain] from X.x.X.x . Empty
startup greeting (localhost:993) in
/var/www/mm/program/lib/Roundcube/rcube_imap.php on line 184 (POST
/mm/?_task=login?_task=login&_action=login)
When i do log in from roundcube, imap server says ( in /var/log/mail.log ):
May 20 07:05:16 my-server dovecot: imap-login: Disconnected (no auth
attempts): rip=::1, lip=::1, TLS handshaking: Disconnected
Here is my roundcube config file :
$config['db_dsnw'] = 'mysql://roundcubeuser:myPassword#localhost/roundcubemail';
// ----------------------------------
// IMAP
// ----------------------------------
$config['debug_level'] = 13;
$config['default_host'] = 'ssl://127.0.0.1';
$config['default_port'] = 993;
// ----------------------------------
// SMTP
// ----------------------------------
$config['smtp_server'] = 'ssl://localhost';
What's the problem? i really have no idea what is happening !
Thank you.
I'm using postfix + dovecot + roundcube a few months now and it's working for me. In my configuration, postfix rejects plaintext sessions, so roundcube has to connect with ssl - and it's working.
This is from my main.inc.php. I don't remember editing anything here, it's just the initial config created during the installation.
Now that I'm looking at it, default_port doesn't make any sense, I think it's just ignored.
// To use SSL/TLS connection, enter hostname with prefix ssl:// or tls://
// Supported replacement variables:
// %n - http hostname ($_SERVER['SERVER_NAME'])
// %d - domain (http hostname without the first part)
// %s - domain name after the '#' from e-mail address provided at login screen
// For example %n = mail.domain.tld, %d = domain.tld
// TCP port used for IMAP connections
$rcmail_config['default_port'] = 143;
$rcmail_config['default_host'] = array("ssl://localhost:993");
// TCP port used for IMAP connections
$rcmail_config['default_port'] = 143;
In case the other answer does not work, this is what worked for me. My config.inc.php now contains:
$config['default_host'] = 'ssl://localhost';
$config['default_port'] = 993;
NOTE: using tls://localhost did not work for me. I had to specify ssl:// as the URI scheme.
Via PhpMyAdmin, I also ran this SQL command (all my user accounts are on the same machine that runs RoundCube):
UPDATE `rc_users` SET `mail_host`='ssl://localhost'
I got the port number 993 from running sudo netstat -tulnp in order to determine the port on which Dovecot was listening.
I've set up a new PHP project on NetBeans, configured the FTP manager to open a standard (pure) FTP connection to my host...'Test Connection' works successfully ... FileZilla
works fine to log in to host + open + edit files (normal FTP operations).
Just can't get it to download my files in Netbeans ... very frustrating
USER hicksads 331 User hicksads OK. Password required PASS ** 230
OK. Current restricted directory is / PBSZ 0 200 PBSZ=0 TYPE I 200
TYPE is now 8-bit binary CWD /public_html 250 OK. Current directory is
/public_html PWD 257 "/public_html" is your current location CWD
/public_html 250 OK. Current directory is /public_html PWD 257
"/public_html" is your current location SYST 215 UNIX Type: L8 PORT
192,168,100,18,194,238
500 I won't open a connection to 192.168.100.18 (only to 110.142.50.242)
QUIT 221-Goodbye. You uploaded 0 and
downloaded 0 kbytes. 221 Logout.
Any help much appreciated!
I was in a hotel room and needed to download all the files for a project.
When downloading with netbeans on a pc...
I wont open a connection to ip address only to ip address...
after some searching it was this post that helped me.
1. find the remote connection row and click manage
2. most ftp accounts will need port 2
3. at the bottom there is a check box for passive mode. Check it.
test connection and if succesfull you are ready to download.