CURLE_UNSUPPORTED_PROTOCOL - ftp download fails - libcurl

i use cURL (installed via vcpkg). Also openssl installed via vcpkg for a c++ project on VS 2019.
The problem:
CURLE_UNSUPPORTED_PROTOCOL = curl_easy_perform(curl);
I used this example:
https://curl.haxx.se/libcurl/c/ftpsget.html
with corrected connection and file data. The FTP server is filezilla. I checked the connection and file
download with filezilla client. All fine.
When i use the sample from link, i get the CURLE_UNSUPPORTED_PROTOCOL and in my FTP server i can't see
any connection try.
The error is described like this:
The URL you passed to libcurl used a protocol that this libcurl does not support..
Verbose information is:
* STATE: INIT => CONNECT handle 0x148090e0b38; line 1356 (connection #-5000)
* Protocol "ftp" not supported or disabled in libcurl
* Closing connection -1
* Expire cleared (transfer 0x148090e0b38)
I check the internet for the error message above and none of those i found solved my problem.
It seems not to be a format problem or problem related to wrong url .
So my question is, where can i enable this ? Do i need additional packages ? Or is the problem elsewhere ?
Many thanks

Mean while i figured out how to accomplish this using latest curl command line tool (version 7.68.0) on windows:
curl -u my_user:my_password --ftp-ssl ftp://my_ip/my_relative_path/my_file --insecure -o my_file
The file for download is on a server where a FileZilla FTP server is working. This server cyphers with a self created cert. The curl client only accepts this, when using flag:
--insecure
So far, i could not find the related options for my c++ curl. Perhaps it is not possible at all, because sources available through vcpkg are not (yet) up to date. But i want to stick with vcpkg. For me, this solutions: using command line tool instead, works fine.
One more hint, which is important: curl version 7.64.00 works NOT. You get error:
curl: (35) schannel: failed to receive handshake, SSL/TLS connection failed

Related

Libcurl openSSL certificate problem (c++)

I am writing a program in C++ and now there is a need for cross-platform and dependency adjustment. While I was writing for linux, everything was OK, but I started to port the code to Windows. My program needs licurl. first I compiled through nmake - the wö learned the code worked. However, I need Cmake for the task. So I slightly edited CmakeLists compiled without SSL, which was fixed by compiling openSSL. And then there was a mistake that I'm not ready for at all:
* Trying 172.67.163.127:443...
* Connected to www.showmyip.com (172.67.163.127) port 443 (#0)
* ALPN: offers http/1.1
* SSL certificate problem: unable to get local issuer certificate
* Closing connection 0
I found out from OpenSSL --version that I have certificates registered along the way Z:\extlib_openssl111__\ssl there was no such disk, so I used a USB flash drive to create this path. Then I tried to export the certificate from the browser (pem). Created in the folder Z:\extlib_openssl111__\ssl folder www.showmyip.com and exported the ssl dir certificate there and to the root - it didn't help. Then I command:
openssl s_client -connect showmyip.com:443 -showcerts > stackoverflow.txt
This merged 3 certificates into an odil file and I really don't know what to do with it.
OpenSSL can be run with a derivative:
-CAfile demoCA/cacert.pem
but I have another case I can't run openssl.exe , I'm accessing libcurl and libcrypto directly, maybe it can somehow be written in the C++ code if you throw an example, I will be very grateful.

"TLS Handshake timeout" when installing aws-sdk-go package with go get

I am getting net/http: TLS handshake timeout when trying to install aws-sdk-go with go get.
go get -v github.com/aws/aws-sdk-go
go: downloading github.com/aws/aws-sdk-go v1.30.10
go get: github.com/aws/aws-sdk-go#v1.30.10: Get https://storage.googleapis.com/proxy-golang-org-prod/153044bb636484b4-github.com:aws:aws-sdk-go-v1.30.10.zip?Expires=1587550038&GoogleAccessId=gcs-urlsigner-prod%40golang-modproxy.iam.gserviceaccount.com&Signature=Py%2Fu6vp6bq%2F%2Bz57LXE4oUVTvCjAL08bnxnlWuHUh2FME7v89fzIz1%2FNOJ5kKsXCJV39OMJLsjF5j3457p1mZJsBZSgTjMnFbPbuVRHu%2FhKPFPmvVsLYvchvB7Va%2F%2BGcyYHhOsP0XMdSo3N8GjqltihMWfKML49RNOmqCrQT%2F0Qc1b%2BBhbz9iH88QNd9mSwYYQpr0kuAVOb3OGfyQGY11vrTHLWp5ammOH%2B6Xa7g5cpCMO91Ane8aOEYywc0oSsgvv4y32qp0G%2FGm18pDHzLq1o0OA7HEKUU59ACFpOsTyEhF0uECBoNfFpiBuOub%2BY%2FMhGzsojk1dW0vzmR0SOGxqg%3D%3D: net/http: TLS handshake timeout
I can install any other go packages without any trouble. And my colleagues (in different network) can install aws-sdk-go without any problem. But, I am continuously facing this problem. I have tried with two different laptops. I have also tried switching to 3G network instead of broadband but, no luck there too.
How can I troubleshoot this problem?

SSL not available in watson-developer-cloud example microphone-speech-to-text.py

Hello i try to get the following example running:
microphone-speech-to-text
I run this python script on Gentoo Linux device with a Python 2.7.6.
The device is connected to the internet via a mobile Hotspot from my mobile phone.
Unfortunately it does not work and get the following output:
Enter CTRL+C to end recording...
Error received: SSL not available.
Connection closed
I ran the script on my windows and it worked fine.
SSL libs are installed:
ldconfig -p | grep ssl
vocon_ssl.so (libc6) => /opt/aldebaran/lib/vocon_ssl.so
libssl.so.1.0.0 (libc6) => /usr/lib/libssl.so.1.0.0
libssl.so (libc6) => /usr/lib/libssl.so
libgnutls-openssl.so.27 (libc6) => /usr/lib/libgnutls-openssl.so.27
libgnutls-openssl.so (libc6) => /usr/lib/libgnutls-openssl.so
libevent_openssl-2.0.so.5 (libc6) => /usr/lib/libevent_openssl-2.0.so.5
If i run another example (speech_to_text_v1)
I get the correct result from watson followed by:
Error received: SSL not available.
Does anybody have an idea what could be the issue here?
Thanks
I could get rid of the "SSL not available" error by
pip install backports.ssl-match-hostname
I got this hint from here.
Also here is mentioned that websocket_client depends on backports.ssl-match-hostname for Python 2.x
After installing the package i got:
Error received: _ssl.c:334: No root certificates specified for verification of other-side certificates.
This could be fixed temporarily by calling disable_SSL_verification() of SpeechToTextV1 before the processing.
To fix it in the long term an approach could be downgrading the websocket-client library to 0.47.0 link1 link2
Another approach to get rid of the "No root certificates specified" Error is setting the Environment variable WEBSOCKET_CLIENT_CA_BUNDLE that is checked by the websocket library.
e.g.
os.environ['WEBSOCKET_CLIENT_CA_BUNDLE'] = '/etc/ssl/certs/ca-certificates.crt'
If I were to hazard a guess it would be that your Gentoo Linux device hasn't been setup with the appropriate TLS / SSL libraries. As a test run a list models request through cURL on your device, as per the API documentation - https://cloud.ibm.com/apidocs/speech-to-text#list-models
curl -X GET -u "apikey:{apikey}" "https://stream.watsonplatform.net/speech-to-text/api/v1/models"
That is going over TLS so, if you can get that to work, you may have better luck with the python application.

libCurl gives unsupported protocol on a script running as cron job

Here is my situation: I have an sh script that writes some data to text files then calls a pre-built c++ binary that processes these text files and uses libCurl to send an email. Under the user that created the script and the binary everything is working fine, the email is delivered perfectly. Something goes wrong when executing the script under the cron daemon. Permissions-wise, the script and binary have 777 and the text files have 666. I have created another user and tried executing the binary it gave me the following error:
* Protocol smtp not supported or disabled in libcurl
* Unsupported protocol
curl_easy_perform() failed: Unsupported protocol
After the cron period passed the shell gave a message something like You have a new mail in/var/spool/mail/$USER, that file contains the same message.
Executing curl -V on both users:
curl 7.48.0 (i686-pc-linux-gnu) libcurl/7.48.0 OpenSSL/1.0.0 zlib/1.2.3 libidn/1.18
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: IDN IPv6 Largefile NTLM NTLM_WB SSL libz UnixSockets
Any help is really appreciated.

How to fix distcc error

I'm trying to get distcc working between two machines CLIENT and SERVER I "think" I have it setup right but I am still getting this error
(dcc_build_somewhere) Warning: failed to distribute, running locally
instead
NOTHING is being compiled on the server.
My configuration is as follows
CLIENT = 192.168.0.14
SERVER = 192.168.0.15
/etc/default/distcc on SERVER
STARTDISTCC="true"
ALLOWEDNETS="192.168.0.0/24" // Also tried CLIENT IP here
LISTENER="192.168.0.15" // SERVER IP
NICE="10"
JOBS="16"
ZEROCONF="false"
client - yes I know that its set to only compile on the server currently
DISTCC_HOSTS="192.168.0.15"
/etc/distcc/host set to 192.168.0.15
$HOME/.distcc/host set to 192.168.0.15
command
make -jx CC=distcc
I have tried on different software repos to see if there was some problem with an individual repo but the problem persists no matter the package.
EDIT
The failed to distribute error is a client side error. Server side the log indicates
distccd[1046] (dcc_job_summary) client: 192.168.0.14:40732 COMPILE_ERROR exit:1 sig:0 core:0 ret:0 time:94ms gcc certs/system_keyring.c
I fixed this by upgrading my version of GCC. The client and Server are now running 5.x.
Check the log:
DISTCCD_OPTS="${DISTCCD_OPTS} --log-file /var/log/distccd.log"
In my case, my log said:
(dcc_warn_masquerade_whitelist) CRITICAL! /usr/local/lib/distcc not found. You must see up masquerade (see distcc(1)) to list whitelisted compilers or pass --enable-tcp-insecure. To set up masquerade automatically run update-distcc-symlinks.
So I had to run:
sudo update-distcc-symlinks
sudo ln -s /usr/lib/distcc /usr/local/lib/distcc # because I compiled from source