Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ignore SSL Certificate Error with Wget

Tags:

I have the following code in my coldfusion code that works:

<cfexecute name="curl" arguments = "https://myPath/myFile.xlsx -k" timeout="10" variable="test" />
<cfdump var="#test#" />

This downloads an Excel file from the specified path using cURL and dumps it to the browser, which works fine.

However, I can't get the same thing to work with Wget.

First I tried:

<cfexecute name="wget" arguments = "https://myPath/myFile.xlsx" timeout="10" variable="test" />
<cfdump var="#test#" />

This returns an empty string. It seems we need to use the equivalent of cURL's "-k" for Wget, to tell it to ignore SSL certificate errors. So I tried:

<cfexecute name="wget" arguments = "--no-check-certificate https://myPath/myFile.xlsx" timeout="10" variable="test" />
<cfdump var="#test#" />

This gives me the following results:

Usage: wget [OPTION]... [URL]... Try `wget --help' for more options. 

How can I use Wget within cfexecute to download the excel file, ignoring SSL certificate errors?

EDIT:

Running wget --no-check-certificate "https://myPath/myFile.xlsx" directly from the command line works.

like image 853
froadie Avatar asked Oct 02 '14 09:10

froadie


People also ask

How to ignore SSL errors in Wget?

ERROR: certificate common name ‘*.simplified.guide’ doesn't match requested host name ‘www.simplified.guide’. To connect to www.simplified.guide insecurely, use `--no-check-certificate'. You can turn off check-certificate option in Wget to skip certificate check thus ignoring SSL errors.

What is the default SSL certificate verification for WGET?

As of Wget 1.10, the default is to verify the server's certificate against the recognized certificate authorities, breaking the SSL handshake and aborting the download if the verification fails.

How do I stop WGET from checking for certificates?

The quickest way round this, albeit not the safest, is to tell wget to ignore any certificate checks and download the file. To do this, add the –no-check-certificate to your wget command. I don’t know why the wget developers couldn’t have chosen a switch that’s easier to remember!

What is the Wget error in Linux?

The Wget error is used to occur for a different reason, It might be that Wget is not properly supporting the Https downloads, due to secure protocol options or no check certificate and many more reasons. Usually, the Wget commands are used to download the files from the internet through the command line.


1 Answers

From the wget man page (http://linux.die.net/man/1/wget)

" HTTPS ( SSL/TLS ) Options

To support encrypted HTTP ( HTTPS ) downloads, Wget must be compiled with an external SSL library, currently OpenSSL. If Wget is compiled without SSL support, none of these options are available."

You might need to check whether the version of wget you are using supports SSL.

Could cfhttp do what you need though?

https://wikidocs.adobe.com/wiki/display/coldfusionen/cfhttp

If you're using a self signed certificate you can add it to your JVM's key store to avoid the certificate errors.

like image 125
Andrew Myers Avatar answered Sep 19 '22 20:09

Andrew Myers