Quantcast
Channel: Rebex Q&A Forum - Recent questions and answers
Viewing all 3865 articles
Browse latest View live

Answered: (Rebex.FTP/SSL) Very slow download speed from within docker container.

$
0
0

UPDATE
I found out that this is caused by SecureTransfers property. If I set it to false then speed from container is the same as from host.

So as I understand, this SecureTransfers compresses/encrypts traffic on fly right? So bottleneck could be from either client or server side as I understand.


Answered: Does getting messages from Exchange mark them as read? Can I have two processes monitoring one inbox?

$
0
0

Does reading messages from Exchange mark them as read?

I need to be sure they will not pull the same messages if they run at exactly same time.

It is not possible in no mail protocol (POP3, IMAP, EWS). To do this, the server would be capable of operations like "atomic operation for downloading a message and deleting it" or "atomic operation for downloading an unread message and marking it as read".

So you have to synchronize the two processes by yourself. You can use for example Mutex.

HTTPS Xamarin iOS support for clientcertificates?

$
0
0

Hi,
We would like to use your HTTPS library in our Xamarin project, but it doesn't appear to attatch client certificates to requests. This is a known issue for other projects as the version of .Net used in Xamarin doesn't support it, but as your libraries list support for Xamarin, we thought to ask. Using the latest Xamarin, in iOS 12.1, on an iOS 12 phone, the following code (either with the call back or without, not that the callback is called...) doesn't send the certificate.

HttpRequestCreator request = new HttpRequestCreator();
request.Settings.SslAcceptAllCertificates = true;
request.Settings.SslClientCertificateRequestHandler = new CertRequestHandler(); ;
var fullrequest = request.Create(uriEndPoint);
fullrequest.ClientCertificates.Add(UserData.Cert);
var response = fullrequest.GetResponse();
Stream receiveStream = response.GetResponseStream();
StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8); string resultString = readStream.ReadToEnd();

Thanks!

Slow send with large attachment

$
0
0

Hi,
I'm trying to send an email with a 20 Mb attachment and this takes more than 2 minutes to do it.
Is this normal?

this is my send code:

Smtp smtp = new Smtp();
smtp.LogWriter = new FileLogWriter("log.txt", LogLevel.Debug);
smtp.Connect("serverName", 5264, SslMode.Implicit);
smtp.Login("Username", "Password");
smtp.Settings.SkipContentTransferEncodingCheck = true;
smtp.Send(message);
smtp.Disconnect();

I have noticed this in the log file:

2018-10-24 18:03:31.526 INFO Smtp(1)[1] Response: 354 End data with <CR><LF>.<CR><LF>
2018-10-24 18:05:03.219 INFO Smtp(1)[1] Response: 250 2.0.0 Ok: queued as 42gFRR3LCpz2L1Hyh

Thanks!

Answered: HTTPS Xamarin iOS support for clientcertificates?

$
0
0

The client certificates are supported for Xamarin.

However, please note that the client certificate has to meet couple of requirements:

  1. It must be time valid: cert.IsTimeValid().
  2. It must have private key: cert.HasPrivateKey().
  3. It must be issued for client authentication: cert.GetEnhancedUsage() is either null or contains ExtendedUsageOids.ClientAuthentication or contains ExtendedUsageOids.AnyPurpose.
  4. Issuer of the client certificate has to match issuer(s) requested by the server.

The first 3 checks can be validated on the client certificate directly. The last check can be validated by the ICertificateRequestHandler.Request() method (your CertRequestHandler class), which contains array of DistinguishedName requested by the server.

Please ensure that the client certificate you used (UserData.Cert) meets all requirements above.

Rebex SFTP Connecting

$
0
0

How do i prevent this error message on Rebex.Net.Sftp.Connect

Errormessage: Could not use server's key. Please contact server administrator to generate new key

Log:

2018-10-24 14:07:07.328 Opening log file. 2018-10-24 14:07:07.329
Using FileLogWriter version 2.0.5885.0. 2018-10-24 14:07:07.344 INFO
Sftp(1)[1] Info: Connecting to ftpshop.soennecken.de:22 using Sftp
3.0.5885.0. 2018-10-24 14:07:07.521 VERBOSE Sftp(1)[1] SSH: Sending data: 0000 |53-53-48-2D-32-2E-30-2D 52-65-62-65-78-53-53-48|
SSH-2.0-RebexSSH 0010 |5F-33-2E-30-2E-35-38-38 35-2E-30-0D-0A
| 3.0.5885.0.. 2018-10-24 14:07:07.561 VERBOSE Sftp(1)[1] SSH:
Received data: 0000 |53-53-48-2D-32-2E-30-2D 50-53-46-54-50-64-2E-20|
SSH-2.0-PSFTPd. 0010 |53-65-63-75-72-65-20-46
54-50-20-53-65-72-76-65| Secure FTP Serve 0020
|72-20-72-65-61-64-79-0D 0A | r ready.. 2018-10-24
14:07:07.562 DEBUG Sftp(1)[1] SSH: Server is 'SSH-2.0-PSFTPd. Secure
FTP Server ready'. 2018-10-24 14:07:07.577 INFO Sftp(1)[1] SSH:
Negotiation started. 2018-10-24 14:07:07.614 VERBOSE Sftp(1)[1] SSH:
Sending packet SSH
MSG_KEXINIT (879 bytes). 0000
|14-CA-F5-A1-10-A8-AB-47 92-C2-57-68-DC-F2-5E-ED| .......G..Wh..^.
0010 |1D-00-00-00-7E-64-69-66 66-69-65-2D-68-65-6C-6C|
....~diffie-hell 0020 |6D-61-6E-2D-67-72-6F-75
70-2D-65-78-63-68-61-6E| man-group-exchan 0030
|67-65-2D-73-68-61-32-35 36-2C-64-69-66-66-69-65| ge-sha256,diffie
0040 |2D-68-65-6C-6C-6D-61-6E 2D-67-72-6F-75-70-2D-65|
-hellman-group-e 0050 |78-63-68-61-6E-67-65-2D 73-68-61-31-2C-64-69-66| xchange-sha1,dif 0060
|66-69-65-2D-68-65-6C-6C 6D-61-6E-2D-67-72-6F-75| fie-hellman-grou
0070 |70-31-34-2D-73-68-61-31 2C-64-69-66-66-69-65-2D|
p14-sha1,diffie- 0080 |68-65-6C-6C-6D-61-6E-2D
67-72-6F-75-70-31-2D-73| hellman-group1-s 0090
|68-61-31-00-00-00-1F-73 73-68-2D-64-73-73-2C-73| ha1....ssh-dss,s
00A0 |73-68-2D-72-73-61-2C-78 35-30-39-76-33-2D-73-69|
sh-rsa,x509v3-si 00B0 |67-6E-2D-72-73-61-00-00
00-E9-61-65-73-32-35-36| gn-rsa....aes256 00C0
|2D-63-74-72-2C-61-65-73 31-39-32-2D-63-74-72-2C| -ctr,aes192-ctr,
00D0 |61-65-73-31-32-38-2D-63 74-72-2C-61-65-73-32-35|
aes128-ctr,aes25 00E0 |36-2D-63-62-63-2C-61-65
73-31-39-32-2D-63-62-63| 6-cbc,aes192-cbc 00F0
|2C-61-65-73-31-32-38-2D 63-62-63-2C-33-64-65-73| ,aes128-cbc,3des
0100 |2D-63-74-72-2C-33-64-65 73-2D-63-62-63-2C-74-77|
-ctr,3des-cbc,tw 0110 |6F-66-69-73-68-32-35-36 2D-63-74-72-2C-74-77-6F| ofish256-ctr,two 0120
|66-69-73-68-31-39-32-2D 63-74-72-2C-74-77-6F-66| fish192-ctr,twof
0130 |69-73-68-31-32-38-2D-63 74-72-2C-74-77-6F-66-69|
ish128-ctr,twofi 0140 |73-68-32-35-36-2D-63-62
63-2C-74-77-6F-66-69-73| sh256-cbc,twofis 0150
|68-31-39-32-2D-63-62-63 2C-74-77-6F-66-69-73-68| h192-cbc,twofish
0160 |31-32-38-2D-63-62-63-2C 74-77-6F-66-69-73-68-2D|
128-cbc,twofish- 0170 |63-62-63-2C-62-6C-6F-77
66-69-73-68-2D-63-74-72| cbc,blowfish-ctr 0180
|2C-62-6C-6F-77-66-69-73 68-2D-63-62-63-2C-61-72| ,blowfish-cbc,ar
0190 |63-66-6F-75-72-32-35-36 2C-61-72-63-66-6F-75-72|
cfour256,arcfour 01A0 |31-32-38-00-00-00-E9-61
65-73-32-35-36-2D-63-74| 128....aes256-ct 01B0
|72-2C-61-65-73-31-39-32 2D-63-74-72-2C-61-65-73| r,aes192-ctr,aes
01C0 |31-32-38-2D-63-74-72-2C 61-65-73-32-35-36-2D-63|
128-ctr,aes256-c 01D0 |62-63-2C-61-65-73-31-39
32-2D-63-62-63-2C-61-65| bc,aes192-cbc,ae 01E0
|73-31-32-38-2D-63-62-63 2C-33-64-65-73-2D-63-74| s128-cbc,3des-ct
01F0 |72-2C-33-64-65-73-2D-63 62-63-2C-74-77-6F-66-69|
r,3des-cbc,twofi 0200 |73-68-32-35-36-2D-63-74
72-2C-74-77-6F-66-69-73| sh256-ctr,twofis 0210
|68-31-39-32-2D-63-74-72 2C-74-77-6F-66-69-73-68| h192-ctr,twofish
0220 |31-32-38-2D-63-74-72-2C 74-77-6F-66-69-73-68-32|
128-ctr,twofish2 0230 |35-36-2D-63-62-63-2C-74
77-6F-66-69-73-68-31-39| 56-cbc,twofish19 0240
|32-2D-63-62-63-2C-74-77 6F-66-69-73-68-31-32-38| 2-cbc,twofish128
0250 |2D-63-62-63-2C-74-77-6F 66-69-73-68-2D-63-62-63|
-cbc,twofish-cbc 0260 |2C-62-6C-6F-77-66-69-73 68-2D-63-74-72-2C-62-6C| ,blowfish-ctr,bl 0270
|6F-77-66-69-73-68-2D-63 62-63-2C-61-72-63-66-6F| owfish-cbc,arcfo
0280 |75-72-32-35-36-2C-61-72 63-66-6F-75-72-31-32-38|
ur256,arcfour128 0290 |00-00-00-47-68-6D-61-63
2D-73-68-61-32-2D-32-35| ...Ghmac-sha2-25 02A0
|36-2C-68-6D-61-63-2D-73 68-61-32-2D-35-31-32-2C| 6,hmac-sha2-512,
02B0 |68-6D-61-63-2D-73-68-61 31-2C-68-6D-61-63-2D-6D|
hmac-sha1,hmac-m 02C0 |64-35-2C-68-6D-61-63-2D
73-68-61-31-2D-39-36-2C| d5,hmac-sha1-96, 02D0
|68-6D-61-63-2D-6D-64-35 2D-39-36-00-00-00-47-68| hmac-md5-96...Gh
02E0 |6D-61-63-2D-73-68-61-32 2D-32-35-36-2C-68-6D-61|
mac-sha2-256,hma 02F0 |63-2D-73-68-61-32-2D-35
31-32-2C-68-6D-61-63-2D| c-sha2-512,hmac- 0300
|73-68-61-31-2C-68-6D-61 63-2D-6D-64-35-2C-68-6D| sha1,hmac-md5,hm
0310 |61-63-2D-73-68-61-31-2D 39-36-2C-68-6D-61-63-2D|
ac-sha1-96,hmac- 0320 |6D-64-35-2D-39-36-00-00
00-1A-6E-6F-6E-65-2C-7A| md5-96....none,z 0330
|6C-69-62-2C-7A-6C-69-62 40-6F-70-65-6E-73-73-68| lib,zlib@openssh
0340 |2E-63-6F-6D-00-00-00-1A 6E-6F-6E-65-2C-7A-6C-69|
.com....none,zli 0350 |62-2C-7A-6C-69-62-40-6F
70-65-6E-73-73-68-2E-63| b,zlib@openssh.c 0360
|6F-6D-00-00-00-00-00-00 00-00-00-00-00-00-00 | om.............
2018-10-24 14:07:07.667 VERBOSE Sftp(1)[16] SSH: Received packet

Answered: SFTPException's code property value does not match with SFTP standard error codes

$
0
0

SFTP error codes are only available for SFTP protocol level errors that were reported by the server. This is indicated by SftpException's Status property of SftpExceptionStatus.ProtocolError. In this case, SFTP error code can be retrieved from SftpExceptions Code property.

Sample code:

try
{
    sftp.CreateDirectory(directoryPath);
}
catch (SftpException ex)
{
    if (ex.Status == SftpExceptionStatus.ProtocolError)
    {
        // SFTP protocol error => SFTP error code is available
        SftpErrorCode code = ex.Code;
        ...
    }
    else
    {
        // not an SFTP protocol error => no SFTP error code
        ...
    }
}

To get a numeric code value as defined by SFTP protocol drafts, convert SftpErrorCode value to an integer:

int nativeCode = (int)ex.Code;

IMAP client memory usage for large folders

$
0
0

We have a dotnet core application running in a container, using the IMAP client to retrieve a large number of messages from a folder.

The approach is roughly like this:

  • create new Imap instance, connect and login
  • SelectFolder
  • get TotalMessageCount
  • call imap.GetMessages(ImapMessageSet.All, ImapListFields.Envelope, messageReceiver)
  • in messageReceiver we get Info property, and also call ToMailMessage(). The message details are written to a DataTable which is periodically written to downstream services and cleared.

We have a HMail test server set up with 100k randomly generated test emails.
What we find is that memory usage builds up over time.

Using ANTS memory profiler, we see the following:

  • based on two snapshots (at approx 10k and 50k emails, which is approx 2min and 8min30s) we see an increase of approx 47MB of strings

  • based on two snapshots (at approx 10k and 90k emails, which is approx 1min42s and 18min50s) we see an increase of approx 94MB of strings

Most of these strings seem to have email info (not content) e.g.

  • 14244 FETCH (UID 14244 RFC822.SIZE 2146 FLAGS () INTERNALDATE \"12-Oct-2017 19:02:45 +0100\" ENVELOPE (\"Thu, 12 Oct 2017 18:02:45 +0100\"\"fishcake luctus vehicula\" ((\"x@y.com\" NIL \"admin\"\"test-server.com\")) ((\"admin@test-server.com\" NIL \"admin\"\"test-server.com\")) ((\"admin@test-server.com\" NIL \"admin\"\"test-server.com\")) ((\"tester@test-server.com\" NIL \"tester\"\"test-server.com\")) NIL NIL NIL \"<30bf5a14b2451c5b65bfdfd053f04a4b@test-server>\") BODY[] {14243})

It appears that these strings are not eligible for GC until after the client has disconnected and cleaned up.

Additionally, the memory profiler instance retention graph seems to show that the Imap client is holding onto these items:

Imap -> _items (List) -> System.Object[] -> System.String

This is a problem for us as we could potentially run out of memory in our container for example if there is an unusually large load or multiple concurrent loads.

So the questions are:
1) are we using the client sensibly? Is there any way we can reduce memory consumption out of the box?
2) should we consider 'batching up' when we have a large number of emails to retrieve? For example check total message count up front and batch up requests into (say) 1k emails and after each batch dispose the Imap client and re-create?
3) something else - ideally we do not want to impose a low maximum limit on number of emails that can be retrieved in any single load.

Thanks in advance,

Nick


VPN connection with CE7

$
0
0

Hello Rebex Community,
I know that this question does not belong here, but it may still be that Rebex offers a solution to the problem.
I want to establish a VPN (L2TP) connection in Ce7. Is there anything in the Rebex library? If no, you might have an idea where to find such a library?
Currently I'm trying it on OpenNetCF but it seems to me to be incompatible for CE7 ...
Thank you very much
Best regards
Saphymo

Answered: IMAP client memory usage for large folders

$
0
0

Thank you for pointing to this.

We realized that the server responses (* FETCH ...) are unintentionally held in local variable of the Imap.GetMessages() method.

We have fixed it. I will send you link to hotfix version to your e-mail later today, when the build is ready.

System.InvalidOperationException: Not enough data

$
0
0

Getting the following exception while uploading the files.

System.InvalidOperationException: Not enough data.
at Rebex.Net.CCD.T()
at Rebex.Net.CCD.I()
at Rebex.Net.SftpAttributes..ctor(CCD W, Int32 O)
at Rebex.Net.QVD..ctor(Byte[] W, Int32 O, Int32 C, Encoding N, Int32 V)
at Rebex.Net.ZND.JC(VCD& W)
at Rebex.Net.ZND.JC(UInt32 W, Boolean O)
at Rebex.Net.ZND.MC(VCD W, UInt32 O, JCD C)
at Rebex.Net.ZND.GO(String W, Boolean O, Boolean C, Boolean N, MND V, IND& D, JCD A)
at Rebex.Net.Sftp.HEO(String W, Boolean O, Boolean

Ftp receive non existing host file creates empty local file

$
0
0

If the file trying to FTP receive does not exist, an error is returned but an empty local file is also created which I don't think should happen.

Save email as unsent using .eml in Apple Mail

$
0
0

I am trying to save and open an .eml file in Apple Mail as unsent.

I have added the header: Headers.Add("X-Unsent", "1") to the Rebex.Mail.

It opens fine in Outlook (ready to be sent) but when I open the saved .eml file in Apple Mail the email is not ready to be sent. It looks like an email already received. I want to be able to save the .eml file, then open it in Apple Mail and it must be ready to be sent.

Is this possible?
Does the .eml format fully support Apple Mail?
I am trying to use the Rebex library to create emails for an Apple environment.

Thanks

Answered: Ftp receive non existing host file creates empty local file

$
0
0

This is the "Chicken-and-egg" problem:

Local file preference:

  • Create local file then start downloading.
  • If remote file is not accessible, we ended with empty local file.

Remote file preference:

  • Start file download. When the first byte (or EOF) is received, create local file to store the data.
  • If local file cannot be created, we have to abort FTP transfer, which cannot be done (at all or easily) on some servers.

We think that the problem is not just about deleting an empty local file. The "remote file doesn't exist" is only one of the possible errors.

  • What do you want to do in case that couple of bytes are received?
    Do you want to delete the unfinished file, or do you want to keep the file, so you can resume download after while?

  • What do you want to do in case you are overwriting an existing local file? Would you like to delete the empty file, which means the previously existing file disappears; or do you want to restore the original file (this requires moving files from/to temporary location or using a naming convention).

We leave this questions on application programmer. The application knows what to do in current state. The component behavior is consistent. When download is started the local file is created. When any error arises the local file is kept in its current state (empty or not).

If you want to fully control creating of local files, you can use Stream overload ftp.GetFile("path", outputStream) and handle file creations by yourself.

Or simply delete the file in your preferred cases when an error occurs:

try
{
    ftp.GetFile("remotePath", "localPath");
}
catch (FtpException)
{
    // your condition e.g.:
    // - local file is empty
    // - remote file does not exist
    // - local file did not exist before
    if (condition)
        File.Delete("localPath");
}

The other common solution is to download files to specially named files, e.g. "myfile.txt.ftpdown" or special locations e.g. "c:/temp/ftpdownloads".

  • When the file download is finished the file is moved/renamed to final location e.g. "myfile.txt.ftpdown" -> "myfile.txt"
  • If the file download is aborted for any reason, the file remains as is, indicating the user that it was not finished correctly, and the user will decide for himself what to do (the application keeps simple = do nothing special).

As you can imagine there is a lot of cases and lot of possible solutions. Deleting the empty file after failed transfer is not general solution (and can be a problem in some cases).

Conclusion:
We will keep the current behavior. It is consistent and straightforward.
However, you can vote for adding an option, which will add the requested behavior at https://rebex.uservoice.com

Answered: Tiny SFTP Server - Error while initializing subsystem (): The 'shell' subsystem is not enabled.

$
0
0

Hi,

Tiny SFTP Server does not allow shell subsystem, only SFTP connections. You can try our Buru SFTP Server which has some SSH shell functionality (see the docs for details). Please note that it is only an emulated shell, nowhere close to what real Linux SSH shell offers - the major difference being you have to specify which commands will be supported as there are only few built-in commands available.


POP3 limit number of messages returned by GetMessageList?

$
0
0

We are using GetMessageList() to fetch the message IDs from POP3 servers. We then iterate through results calling GetMailMessage(sequenceNumber).

Problem is that the initial call to GetMessageList may consume a lot of memory - initial tests suggest the amount of memory is proportional to the number of messages in the POP3 account (although we have not memory profiled this yet).

This is a dotnet core application running in a container (similar case to https://forum.rebex.net/9846/imap-client-memory-usage-for-large-folders actually).

Is there a way to limit the number of messages returned by GetMessageList (or perhaps it could be added?).

I think we could get the mailbox size and/or number of messages and use this to decide whether to call GetMessageList - but this probably would result in a poor user experience (e.g. 'Cannot load messages because your mailbox is too big').

It might be nicer to have GetMessageList(int maxMessageCount) or similar.

We may not even need to support POP3 in our product as IMAP seems more useful in general, so this is just a preliminary question to make sure we're not missing something!

Thanks in advance,

Nick

SFTP Server Negotiation Delays

$
0
0

I have written a simple SFTP Server using Rebex 2018R3. It works as expected when run under Windows but when executed on a Raspbian Linux box under Mono V5.14.0.177 the connection takes a long time or times out depending on the application used to connect.

From a Wireshark trace I can see a 2 minute delay between the client's Group Exchange Init message coming in and the server's Group Exchange Reply going out. This delay is not present when the server is run under Windows.

There is a corresponding delay with matching timestamps recorded in the Rebex trace log between receiving the SSH_MSG_PACKET32 message and sending the SSH_MSG_PACKET33 message.

2018-11-06 22:27:17.905 DEBUG FileServer(1)[6] SSH: Session 1: Local SSH version: SSH-2.0-RebexSSH_1.0.6874.0
2018-11-06 22:27:17.925 DEBUG FileServer(1)[6] SSH: Session 1: Remote SSH version: SSH-2.0-OpenSSH_6.6.1
2018-11-06 22:27:17.927 DEBUG FileServer(1)[6] SSH: Session 1: Performing algorithm negotiation and key exchange.
2018-11-06 22:27:17.982 VERBOSE FileServer(1)[6] SSH: Session 1: Sent packet SSH_MSG_KEXINIT (768 bytes).
2018-11-06 22:27:17.990 VERBOSE FileServer(1)[5] SSH: Session 1: Received packet SSH_MSG_KEXINIT (1008 bytes).
2018-11-06 22:27:18.023 DEBUG FileServer(1)[5] SSH: Session 1: Performing key exchange using diffie-hellman-group-exchange-sha256 with ssh-rsa.
2018-11-06 22:27:18.024 VERBOSE FileServer(1)[6] SSH: Session 1: Received packet SSH_MSG_PACKET34 (24 bytes).
2018-11-06 22:27:18.035 VERBOSE FileServer(1)[6] SSH: Session 1: Sent packet SSH_MSG_KEXDH_REPLY (1048 bytes).
2018-11-06 22:27:18.059 VERBOSE FileServer(1)[5] SSH: Session 1: Received packet SSH_MSG_PACKET32 (528 bytes).
2018-11-06 22:29:21.224 VERBOSE FileServer(1)[5] SSH: Session 1: Sent packet SSH_MSG_PACKET33 (832 bytes).
2018-11-06 22:29:21.232 VERBOSE FileServer(1)[5] SSH: Session 1: Sent packet SSH_MSG_NEWKEYS (16 bytes).
2018-11-06 22:29:21.248 DEBUG FileServer(1)[5] SSH: Session 1: Current encryptor is aes128-ctr/hmac-sha2-512.
2018-11-06 22:29:21.249 INFO FileServer(1)[14] SSH: Session 1: Connection closed by the remote host.

How do I remove this delay?

Thanks,

Mark.

Executing command on server does not works

$
0
0

Hello,

I use Rebex and everything works fine when I test it on my computer, but when I publish it on server all my commands does not work on. All devices are in same net like my server and computer is.

My code is really simple and just send simple command to device to reboot him.

PS there is not even error, just do not do anything. I configure port and IP adress correct.

Thank you

Answered: How To Fix Epson Printer Error Code 0x9d

$
0
0

We are sorry, this is forum related to Rebex.NET components.

Your question is out of scope on this forum.

Identifying User that raise custom command

$
0
0

The SFTP Server supports implementation of custom command via SSH session. If there is more than one user login to the Server, what is the proper way for the Server to identify the user that raise that custom command ?

Viewing all 3865 articles
Browse latest View live