You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ftpserver-users@mina.apache.org by Faseela Mohamed <fa...@gmail.com> on 2017/02/15 23:43:35 UTC

Custom welcome message

Hi,

I am using Apache FTP server in standalone mode. I would like to give a
custome welcome message. I created FtpStatus.gen in one directory and gave
taht in messages tag.
<messages directory="./res/conf/FtpStatus.gen"  />

Still it in not showing. Is tehre anything i missed ?

I also tried  session.write(new DefaultFtpReply(
FtpReply.REPLY_220_SERVICE_READY ,"   Welcome to the My FTP ");

on onConnect method of FTP let. It shows teh message and getting "GnuTLS
error -15: An unexpected TLS packet was received."

Please help.

Thanks,

Re: Custom welcome message

Posted by Faseela Mohamed <fa...@gmail.com>.
Log Level 1 - Warning also , the custom message shows up with fewer
messages. Thanks alot for all your input Gary. It really helped.

On Fri, Feb 17, 2017 at 10:39 AM, Faseela Mohamed <faseela.mohamed@gmail.com
> wrote:

> Thanks again Gary. It worked . It showed my message , but it is showing
> all the info ... that is too much info for the user :( ..It lists all the
> commands and trace and response.
>
>
> Response:     *220 Custom welcome message by Faseela.*
> Command:    AUTH TLS
> Response:     234 Command AUTH okay; starting TLS connection.
> Status:          Initializing TLS...
> Trace:           TLS Handshake successful
> Trace:           Protocol: TLS1.2, Key exchange: ECDHE-RSA, Cipher:
> AES-128-GCM, MAC: AEAD
> Status:          Verifying certificate...
> Status:          TLS connection established.
> Command:    USER xyz@123.com
> Response:     331 User name okay, need password for xyz@123.com
> Command:    PASS ***********
> Response:     230 User logged in, proceed.
> Command:    OPTS UTF8 ON
> Response:     200 Command OPTS okay.
> Command:    PBSZ 0
> Response:     200 Command PBSZ okay.
> Command:    PROT P
> Response:     200 Command PROT okay.
> Command:    OPTS MLST size;modify;type;
> Response:     200 Command OPTS okay.
>
>
> On Fri, Feb 17, 2017 at 1:48 AM, Gary Bell <ga...@aero.bombardier.com>
> wrote:
>
>> Hi Faseela, it looks like Filezilla is hiding the response string
>> returned from ftpserver unless an error occurs (in which case it shows the
>> full log in the log window). On filezilla 3.14.1, I got it to show the
>> custom response message all the time by setting the debug level in the
>> preferences to "2 - Info". Not sure if this is an option for you?
>>
>>
>>
>

Re: Custom welcome message

Posted by Faseela Mohamed <fa...@gmail.com>.
Thanks again Gary. It worked . It showed my message , but it is showing all
the info ... that is too much info for the user :( ..It lists all the
commands and trace and response.


Response:     *220 Custom welcome message by Faseela.*
Command:    AUTH TLS
Response:     234 Command AUTH okay; starting TLS connection.
Status:          Initializing TLS...
Trace:           TLS Handshake successful
Trace:           Protocol: TLS1.2, Key exchange: ECDHE-RSA, Cipher:
AES-128-GCM, MAC: AEAD
Status:          Verifying certificate...
Status:          TLS connection established.
Command:    USER xyz@123.com
Response:     331 User name okay, need password for xyz@123.com
Command:    PASS ***********
Response:     230 User logged in, proceed.
Command:    OPTS UTF8 ON
Response:     200 Command OPTS okay.
Command:    PBSZ 0
Response:     200 Command PBSZ okay.
Command:    PROT P
Response:     200 Command PROT okay.
Command:    OPTS MLST size;modify;type;
Response:     200 Command OPTS okay.


On Fri, Feb 17, 2017 at 1:48 AM, Gary Bell <ga...@aero.bombardier.com>
wrote:

> Hi Faseela, it looks like Filezilla is hiding the response string returned
> from ftpserver unless an error occurs (in which case it shows the full log
> in the log window). On filezilla 3.14.1, I got it to show the custom
> response message all the time by setting the debug level in the preferences
> to "2 - Info". Not sure if this is an option for you?
>
>
>

RE: Custom welcome message

Posted by Gary Bell <ga...@aero.bombardier.com>.
Hi Faseela, it looks like Filezilla is hiding the response string returned from ftpserver unless an error occurs (in which case it shows the full log in the log window). On filezilla 3.14.1, I got it to show the custom response message all the time by setting the debug level in the preferences to "2 - Info". Not sure if this is an option for you?



Re: Custom welcome message

Posted by Faseela Mohamed <fa...@gmail.com>.
Thanks Gary for the response. I did the same (steps 1 t0 6) , but I
mentioned the whole path, <messages directory="./res/conf/FtpStatus.gen>
before, but I fixed it to the directory the message is coming in the logs ,
but not in my Filezilla client.

I am using standalone, not embedded .. I want the highlighted message to be
displayed in Filezilla....

[INFO] 2017-02-15 23:27:40,572 [] [] FTP server started
[ INFO] 2017-02-15 23:27:48,997 [] [0:0:0:0:0:0:0:1] CREATED
[ INFO] 2017-02-15 23:27:49,000 [] [0:0:0:0:0:0:0:1] OPENED
*[ INFO] 2017-02-15 23:27:49,006 [] [0:0:0:0:0:0:0:1] SENT: 220 My custom
welcome message *

[ INFO] 2017-02-15 23:27:49,007 [] [0:0:0:0:0:0:0:1] RECEIVED: AUTH TLS
[ INFO] 2017-02-15 23:27:49,162 [] [0:0:0:0:0:0:0:1] SENT: 234 Command AUTH
okay; starting TLS connection.

[ INFO] 2017-02-15 23:27:49,164 [] [0:0:0:0:0:0:0:1] RECEIVED: USER
abc@123.com

[ INFO] 2017-02-15 23:27:49,166 [abc@123.com] [0:0:0:0:0:0:0:1] SENT: 331
User name okay, need password for abc@123.com.

[ INFO] 2017-02-15 23:27:49,167 [abc@123.com] [0:0:0:0:0:0:0:1] RECEIVED:
PASS *****

[ INFO] 2017-02-15 23:27:50,234 [abc@123.com] [0:0:0:0:0:0:0:1] Login
success - abc@123.com
[ INFO] 2017-02-15 23:27:50,235 [abc@123.com] [0:0:0:0:0:0:0:1] SENT: 230
User logged in, proceed.

[ INFO] 2017-02-15 23:27:50,235 [abc@123.com] [0:0:0:0:0:0:0:1] RECEIVED:
OPTS UTF8 ON
[ INFO] 2017-02-15 23:27:50,236 [abc@123.com] [0:0:0:0:0:0:0:1] SENT: 200
Command OPTS okay.

[ INFO] 2017-02-15 23:27:50,236 [abc@123.com] [0:0:0:0:0:0:0:1] RECEIVED:
PBSZ 0
[ INFO] 2017-02-15 23:27:50,237 [abc@123.com] [0:0:0:0:0:0:0:1] SENT: 200
Command PBSZ okay.

[ INFO] 2017-02-15 23:27:50,237 [abc@123.com] [0:0:0:0:0:0:0:1] RECEIVED:
PROT P
[ INFO] 2017-02-15 23:27:50,239 [abc@123.com] [0:0:0:0:0:0:0:1] SENT: 200
Command PROT okay.

[ INFO] 2017-02-15 23:27:50,240 [abc@123.com] [0:0:0:0:0:0:0:1] RECEIVED:
OPTS MLST size;modify;type;
[ INFO] 2017-02-15 23:27:50,240 [abc@123.com] [0:0:0:0:0:0:0:1] SENT: 200
Command OPTS okay.

[ INFO] 2017-02-15 23:27:50,242 [abc@123.com] [0:0:0:0:0:0:0:1] RECEIVED:
PWD
[ INFO] 2017-02-15 23:27:50,244 [abc@123.com] [0:0:0:0:0:0:0:1] SENT: 257
"/" is current directory.

[ INFO] 2017-02-15 23:31:46,761 [abc@123.com] [0:0:0:0:0:0:0:1] CLOSED


#######################################

Below are the messages in FileZilla


Status:          Connecting to [::1]:2121...
Status:          Connection established, waiting for welcome message...
Status:          Initializing TLS...
Status:          Verifying certificate...
Status:          TLS connection established.
Status:          Logged in
Status:          Retrieving directory listing...
Status:          Directory listing of "/" successful
Status:          Connection closed by server



On Thu, Feb 16, 2017 at 2:58 AM, Gary Bell <ga...@aero.bombardier.com>
wrote:

> Hi, I just tried that out and it worked form me on FtpServer-1.1.0. This
> is what I did:
>
> 0. Downloaded the latest FtpServer zip file and extracted it.
> 1. Created a new folder called \res\messages
> 2. Added a new file called FtpStatus.gen
> 3. Added my custom message for login like so:
>
> 220=JESTER ready for connection. WARNING! All activity on this site is
> monitored and tracked. Authorised personnel only.
>
> 4. Edited the res\conf\ftpd-typical.xml file to add the following element
> under the <server> tag:
>
> <messages directory="./res/messages" />
>
> 5. Started ftpserver under a cmd shell, passing in the config file to use:
>
> Bin\ftpd.bat \res\conf\ftpd-typical.xml
>
> 6. Connected to it using ftp client built into Windows 7 via the command
> prompt on port 2121
>
> Observed that the 220 greeting showed my new message.
>
> In production, I actually set the custome messages using a message factory
> when I am setting up the ftp server instance.
>
>  ------------------------------ cut --------------------
>
> FtpServerFactory factory = new FtpServerFactory();
>
>                 //Customised server messages (optional)
>                 String customMessageFile = config.getPropertyAsString("
> server.customMessages");
>                 if ( customMessageFile != null) {
>                         LOG.debug("Custom message resource specified: " +
> customMessageFile);
>                         File f = new File(customMessageFile);
>                         if (f.exists()) {
>                                 LOG.debug("Message file exists,
> configuring.");
>                                 MessageResourceFactory messageFactory =
> new MessageResourceFactory();
>                                 messageFactory.
> setCustomMessageDirectory(f);
>                                 factory.setMessageResource(messageFactory.
> createMessageResource());
>                         } else {
>                                 LOG.error("Custom message bundle
> \""+customMessageFile + "\" specified, but does not exist. Not loaded.");
>                         }
>                 }
> -------------------------------- cut -----------------------
>
>
>
>
> Best Regards,
> Gary.
>

RE: Custom welcome message

Posted by Gary Bell <ga...@aero.bombardier.com>.
Hi, I just tried that out and it worked form me on FtpServer-1.1.0. This is what I did:

0. Downloaded the latest FtpServer zip file and extracted it.
1. Created a new folder called \res\messages
2. Added a new file called FtpStatus.gen
3. Added my custom message for login like so:

220=JESTER ready for connection. WARNING! All activity on this site is monitored and tracked. Authorised personnel only.

4. Edited the res\conf\ftpd-typical.xml file to add the following element under the <server> tag:

<messages directory="./res/messages" />

5. Started ftpserver under a cmd shell, passing in the config file to use:

Bin\ftpd.bat \res\conf\ftpd-typical.xml

6. Connected to it using ftp client built into Windows 7 via the command prompt on port 2121

Observed that the 220 greeting showed my new message.

In production, I actually set the custome messages using a message factory when I am setting up the ftp server instance. 

 ------------------------------ cut --------------------

FtpServerFactory factory = new FtpServerFactory();
		
		//Customised server messages (optional)
		String customMessageFile = config.getPropertyAsString("server.customMessages");
		if ( customMessageFile != null) {
			LOG.debug("Custom message resource specified: " + customMessageFile);
			File f = new File(customMessageFile);
			if (f.exists()) {
				LOG.debug("Message file exists, configuring.");
				MessageResourceFactory messageFactory = new MessageResourceFactory();
				messageFactory.setCustomMessageDirectory(f);
				factory.setMessageResource(messageFactory.createMessageResource());
			} else {
				LOG.error("Custom message bundle \""+customMessageFile + "\" specified, but does not exist. Not loaded.");
			}
		}
-------------------------------- cut -----------------------




Best Regards,
Gary.