Apache Camel looses CRLF when writing to SFTP server - apache-camel

When writing a text file to a SFTP serveur via Apache Camel (and via Talend ESB), the file on the server looses CRLF, it only contains LF.
It works if we use FTP mode instead of SFTP.
It fails in SFTP mode with "&binary=true", with "&binary=false" and whatever the SFTP server we connect to.
It works on the same SFTP servers if we manually transfer the file with Filezilla.
Is there any workaround for what looks like a Camel bug ?

Related

Reasons for TLS Client Hello not being answered

I have written a basic TLS client for use in embedded systems (written in C). It uses TLS1.2, and it works great in 90% of situations. I have it working fine for HTTPS, and also have it working with various FTP servers using implicit and explicit FTPS. This week I've encountered an issue when using it with Cerberus FTP and proftpd though. TLS handshake goes through absolutely fine when opening the control channel on port 21, but when using passive mode and opening the passive port, my client sends the TLS Client hello (and I can see the server reply with a TCP ACK), but the FTP server never replies with a Server Hello. Does anyone know of a reason why that might be?-I'm guessing that there is something different in the way Cerberus and ProFTPd have implemented TLS that my client doesn't cater to. My client hello on both connections is identical (apart from port number in tcp headers) and I am not reusing the session data. I don't have this issue when testing against vsftpd or filezilla servers.
Found the reason for the lack of response, and it's an interesting one if anyone is ever writing their own FTP Client and need to use FTPS with it. The FTP Client I had written issued the PASV command, and then immediately opened the data channel port before then issuing the STOR command on the control channel. This behaviour is fine for all FTP servers when using un-encrypted FTP. However, as I discovered, you have to beware when using TLS. With proftpd and cerberus FTP, the FTP server doesn't seem to attach a listener to that port until you issue the STOR command (or equivalent), so it won't negotiate TLS on that port until you've issued the command, whereas other FTP servers like vsftpd and filezilla are happy to negotiate TLS as soon as the port is opened. SO the solution was to open the port after sending the STOR command.

Connect to linked server (Oracle) in SQL Server using Instant Client

I need to connect to a remote database (Oracle) using a MS SQL Server (2019) linked server. What I did so far:
Installed Oracle Instant Client x64 and the ODBC drivers on the machine where the SQL server is running
Created a symlink to the central TNSNAMES.ORA (on a file share in the network) inside the Oracle Instant client folder.
Set the necessary environment variables
Created an ODBC connection to the database on the Oracle server on this machine
Restarted MS SQL Server
Created a linked server (Microsoft OLEDB Provider for ODBC Drivers) in the SQL instance
When connecting to the SQL Server using sqlcmd on this machine (I did not install SSMS there), I can query the linked database using OPENQUERY(). I can also read the file TNSNAMES.ORA using this command (note, the given file is the symlink, but it displays the contents of the linked file, as it should):
SELECT * FROM OPENROWSET(BULK 'C:\InstantClientx64\tnsnames.ora', SINGLE_CLOB) TNSNames
So far, everything is fine.
Now, when I connect to the SQL Server from my workstation using SSMS, i get the following error when trying to read TNSNAMES.ORA using the command above:
Cannot bulk load because the file "C:\InstantClientx64\tnsnames.ora" could not be opened. Operating system error code 5(Access is denied.).
I created a file test.txt in the instant client folder containing something like "Am I allowed to read this?" - and I was, no problems.
I started procmon on the server to find out what happens. When using the above command on the SQL server, I get a REPARSE (because it's a link!), and then SUCCESS, the file is displayed in the sqlcmd console.
When using this command in SSMS (on my local workstation), first appears the REPARSE (OK), then ACCESS DENIED.
In both cases it is the same user account which is displayed as "Impersonating" in the procmon's details. There is definitely no problem with a firewall, and the read permissions on the tnsnames.ora file on the network share are granted for Everyone. I am also able to create an ODBC item on the local workstation, and can connect and query the database from here.
I have done this in the past I don't know how often, and never had problems. What am I missing?
Why are you trying to read the tnsnames.ora file via SQL? The Oracle libraries will (should) internally open it and use it when your app connects to the DB.
The default location for network config files is shown in the Instant Client installation doc. In your case it will be C:\InstantClientx64\network\admin. Unless you have set the TNS_ADMIN variable, then start by creating this subdirectory and putting tnsnames.ora in it.
(A future version of Instant Client on Windows will create the network\admin subdirectory automatically, similar to the way it is created with the Linux Instant Client packages).

Can I stop VSCode Remote Server re-installing itself when I connect via SSH?

I have got VSCode Remote via SSH working successfully between my Mac client and our Centos server. Our server is not online by default and I have to manually set proxies for it to download the Server.
VSCode Server wants to re-wget itself every now and then when I connect. When it does I need to kill the connection, set the proxies and reconnect to allow it to download the Server files.
My question: Is this wget procedure required (i.e. important updates) or can I bypass it?
Thanks in advance

Does phpseclib need a ftp client setup on server?

I'm using CakePHP and its plugin CakeFTP. This plugin relies on phpseclib. I wrote a function in a model which log to a remote FTP server, download files and process content using CakeFTP.
On my local machine (Ubuntu 14) everything goes fine : connection to the remote server, downloading files and so on. I pushed my work on my client server and I get a "unable to connect" error (the remote FTP server is the same).
I don't manage my client's server, but I have a ssh access, so I tried to connect to the FTP remote server from a terminal, and I get "ftp : unknown command".
I didn't dive into CakeFTP or phpseclib code, but could my bug be caused by the absence of FTP client on this server ?

SQL server name in hosts file

I'm developing an ASP.NET application and we're using TFS for source control. Each time we need to change the "data source" in the connectionString to point to our local server during the development. I'm running SQLEXPRESS so I was writing .\SQLEXPRESS in the web.config file and it was working fine. Now we shouldn't modify the web.config file any more and will need to add a record into the hosts file to point the "data source" from the web.config file to my local machine's SQL server. Say, we have "DEVDATABASE" in the web.config as "data source", how should the hosts file line look like for that to work? Something like the following?
.\SQLEXPRESS DEVDATABASE
This however does not work. Could anybody please help me to understand what's the way it should work?
Thanks.
You can't use the hosts file (or DNS) to point at a named instance. This is meant to redirect only to a specific machine, not to a specific machine + port number. You could try creating an alias in the client network utility - you'll also want to make sure that TCP/IP is enabled and that the SQL Browser service is running.

Resources