CURL gives empty response - elasticsearch

I'm attempting to set up a manual back up process for elastic search with ansible.. but when I attempt to curl the elastic server page I get an empty response from the console. No error message, no text, just empty.
I run curl https://website.etc.com:500 and that gives me an SSL error stating that the peers certificate issuer has been marked as not trusted by the user.
So I attempt to ignore ssl and curl -k url:port and it gives me a blank line in the console.
Why can't I curl this website???

Related

Can't cURL information from Elasticsearch cluster

I am trying to install and setup Elasticsearch on a remote Machine running CenOS7 via this guide. Following the install and start instructions for RPM I entered the cURL command given on the guide to check its up and running: curl --cacert $ES_PATH_CONF/certs/http_ca.crt -u elastic https://localhost:9200
I was met with the following message:
curl: (77) Problem with the SSL CA cert (path? access rights?)
I tried to go to the domain with the following command:
curl https://localhost:9200/
And was met with this:
curl: (60) Peer's certificate issuer has been marked as not trusted by the user.
More details here: http://curl.haxx.se/docs/sslcerts.html
curl performs SSL certificate verification by default, using a "bundle"
of Certificate Authority (CA) public keys (CA certs). If the default
bundle file isn't adequate, you can specify an alternate file
using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
the bundle, the certificate verification probably failed due to a
problem with the certificate (it might be expired, or the name might
not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
the -k (or --insecure) option.
So I tried the previous command once adding a '-k' but was met with this error:
{"error":{"root_cause":[{"type":"security_exception","reason":"missing authentication credentials for REST request [/]","header":{"WWW-Authenticate":["Basic realm=\"security\" charset=\"UTF-8\"","Bearer realm=\"security\"","ApiKey"]}}],"type":"security_exception","reason":"missing authentication credentials for REST request [/]","header":{"WWW-Authenticate":["Basic realm=\"security\" charset=\"UTF-8\"","Bearer realm=\"security\"","ApiKey"]}},"status":401}
I was able to complete the guide on my MacBook but have almost no experience working with remote machines or in CentOS 7. How do I successfully cURL the cluster information?

IBM Watson Discovery news curl forbidden error

Trying to query Watson discovery news with the following curl command and get error 403 forbidden.
curl -u "apikey":"{apikey}" "https://gateway.watsonplatform.net/discovery/api/v1/environments/system/collections/news-en/query?version=2019-04-30&query=relations.action.lemmatized:acquire&count=3&filter=entities.text:IBM&return=text"
I found documents on the IBM site to create and query your own environments but not help with how to access the news.
It turned out my url was incorrect. I got this to work.
curl -u "apikey":"{apikey}" "https://api.eu-gb.discovery.watson.cloud.ibm.com/instances/96a866f9-11bb-4b55-af26-a0f826807fec/v1/environments/system/collections/news-en/query?version=2019-04-30&query=enriched_title.semantic_roles:(action.normalized:acquire,object.entities:(type::Company))&count=3"
Your curl looks correct, which may indicate that your apikey is incorrect. Try running the curl command to list environments:
curl -u "apikey":"{apikey}" "https://gateway.watsonplatform.net/discovery/api/v1/environments?version=2019-04-30"
that should verify that you have the correct apikey.

Laravel - Mailing system doesn't work on my Web server but gives cURL error 7: (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

I am using Mailgun to send mail and It works well on my local server, but on my Web Server, where the site is hosted on HackFlix, It produces this error after sending
GuzzleHttp\Exception\ConnectException
cURL error 7: (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
I have done many research to this problem and i didn't get any correct answer that solves cURL error 7. Some people say that i should ping or nslookup smtp.mailgun.org but I don't have SSH shell access on my server. Please, what is the solution to this problem?

Why is wget failing on this image?

I'm attempting to download an image from google books with wget (I've tried curl as well) and I continually get a 500 error
// COMMAND
wget "http://books.google.com/books/content?id=pztHgTT4BGUC&printsec=frontcover&img=1"
// OUTPUT
--2016-07-13 20:58:06-- http://books.google.com/books/content?id=pztHgTT4BGUC&printsec=frontcover&img=1
Resolving books.google.com... 216.58.194.206, 2607:f8b0:4005:801::200e
Connecting to books.google.com|216.58.194.206|:80... connected.
HTTP request sent, awaiting response... 500 Internal Server Error
2016-07-13 20:58:06 ERROR 500: Internal Server Error.
It fails for the same reason the URL will fail in a browser if you're not logged into Google: The server refuses to serve you the content unless you're logged in.
You can probably copy a session cookie from an existing session if you log in with a browser and use it in wget.

Why does WGET return 2 error messages before succeeding?

I am using a script to pull down some XML data on a authentication required URL with WGET.
In doing so, my script produces the following output for each url accessed (IPs and hostnames changed to protect the guilty):
> Resolving host.name.com... 127.0.0.1
> Connecting to host.name.com|127.0.0.1|:80... connected.
> HTTP request sent, awaiting response... 401 Access denied
> Connecting to host.name.com|127.0.0.1|:80... connected.
> HTTP request sent, awaiting response... 401 Unauthorized
> Reusing existing connection to host.name.com:80.
> HTTP request sent, awaiting response... 200 OK
Why does WGET complain that accessing the URL fails twice before successfully connecting? Is there a way to shut it up, or get it to connect properly in the first attempt?
For reference, here's the line I am using to call WGET:
wget --http-user=USERNAME --password=PASSWORD -O file.xml http://host.name.com/file.xml
This appears to be by design. Following the advice of #Wayne Conrad, I added the -d switch and was able to observe the first attempt failing because NTLM was required, and the second attempt failing because the first NTLM attempt was only level 1, where a level 3 NTLM challenge-response was required. WGET finally provides the needed authentication at the third attempt.
WGET does get a cookie to prevent re-authenticating for the duration of the session, which would prevent this if the connection wasn't terminated between files. I would need to pass WGET a list of files for this to occur, however I am unable to because I do not know the file names in advance.
You seem to have a new version of wget. After 1.10.2, wget will not send out authentication unless challenged by the server first. And that is why the first one is failing. The second is failing cause of the what you described.
You can reduce one of them by adding the parameter --auth-no-challenge. This sends out the first in "basic" which will fail and the second one will be sent in "digest" mode. Which should work.

Resources