# Trying to download a file via HTTPS

**URL:** <https://discourse.chef.io/t/trying-to-download-a-file-via-https/16744>\
**Category:** Chef Infra (archive)\
**Created:** [February 27, 2020, 6:31pm UTC](https://discourse.chef.io/t/trying-to-download-a-file-via-https/16744 "2020-02-27T18:31:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jyanga](https://avatars.discourse-cdn.com/v4/letter/j/35a633/32.png) [@jyanga](https://discourse.chef.io/u/jyanga)\
**Post date:** [February 27, 2020, 6:31pm UTC](https://discourse.chef.io/t/trying-to-download-a-file-via-https/16744/1 "2020-02-27T18:31:20Z")

</div>

Here is what I have in my recipes/default.rb.

if node[:platform] == 'ubuntu'  
remote\_file '/tmp/test.txt' do  
source '[https://server1.example.com/pub/test.txt](https://server1.example.com/pub/test.txt)'  
owner 'root'  
group 'root'  
mode '0755'  
action :create  
end  
end

I am getting this error.  
" [2020-02-27T18:27:10+00:00] FATAL: OpenSSL::SSL::SSLError: remote\_file[/tmp/test.txt] (installInfraServer::default line 108) had an error: OpenSSL::SSL::SSLError: SSL Error connecting to [https://server1.example.com/pub/test.txt](https://server1.example.com/pub/test.txt) - SSL\_connect returned=1 errno=0 state=error: certificate verify failed (self signed certificate)"

A newbee,  
j

---

<div class="post-metadata">

**Author:** ![joejoe19](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@joejoe19](https://discourse.chef.io/u/joejoe19)\
**Post date:** [February 27, 2020, 7:39pm UTC](https://discourse.chef.io/t/trying-to-download-a-file-via-https/16744/2 "2020-02-27T19:39:16Z")

</div>

You are receiving this error because you are connecting to your remote source using https (secure http) with a self-signed cert. You either need to get a CA signed cert or add your certificate to the cacert usually found at /opt/chef/embedded/ssl/certs/cacert.pem

---

<div class="post-metadata">

**Author:** ![jyanga](https://avatars.discourse-cdn.com/v4/letter/j/35a633/32.png) [@jyanga](https://discourse.chef.io/u/jyanga)\
**Post date:** [February 27, 2020, 11:42pm UTC](https://discourse.chef.io/t/trying-to-download-a-file-via-https/16744/3 "2020-02-27T23:42:13Z")

</div>

Thank you.

I have added the serf-signed cert into the `/opt/chef/embedded/ssl/certs/cacert.pem` of the vagrant box.

I ran `kitchen converge` and got the error below.

> [2020-02-27T23:38:31+00:00] FATAL: OpenSSL::SSL::SSLError: remote\_file[/tmp/test.txt] (installInfraServer::default line 108) had an error: OpenSSL::SSL::SSLError: SSL Error connecting to [https://server1.example.com/pub/test.txt](https://server1.example.com/pub/test.txt) - SSL\_connect returned=1 errno=0 state=error: certificate verify failed (error number 1)

---

<div class="post-metadata">

**Author:** ![jyanga](https://avatars.discourse-cdn.com/v4/letter/j/35a633/32.png) [@jyanga](https://discourse.chef.io/u/jyanga)\
**Post date:** [February 27, 2020, 11:58pm UTC](https://discourse.chef.io/t/trying-to-download-a-file-via-https/16744/4 "2020-02-27T23:58:13Z")

</div>

It started working when I used the CNAME in the cert rather than the hostname in my recipe.

Thank you for the help. 🙂
