Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1294 from doanac/ssl-certs
Browse files Browse the repository at this point in the history
httpclient: Always set path to CA certs
  • Loading branch information
pattivacek authored Aug 29, 2019
2 parents ffc150d + 84247e9 commit d5d0c65
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/libaktualizr/http/httpclient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ HttpClient::HttpClient(const std::vector<std::string>* extra_headers) {
curlEasySetoptWrapper(curl, CURLOPT_NOSIGNAL, 1L);
curlEasySetoptWrapper(curl, CURLOPT_TIMEOUT, 60L);
curlEasySetoptWrapper(curl, CURLOPT_CONNECTTIMEOUT, 60L);
curlEasySetoptWrapper(curl, CURLOPT_CAPATH, Utils::getCaPath());

// let curl use our write function
curlEasySetoptWrapper(curl, CURLOPT_WRITEFUNCTION, writeString);
Expand Down
6 changes: 6 additions & 0 deletions src/libaktualizr/utilities/utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,12 @@ const char *Utils::getUserAgent() {

std::string Utils::user_agent_;

void Utils::setCaPath(boost::filesystem::path path) { ca_path_ = std::move(path); }

const char *Utils::getCaPath() { return ca_path_.c_str(); }

boost::filesystem::path Utils::ca_path_{"/etc/ssl/certs"};

TemporaryFile::TemporaryFile(const std::string &hint)
: tmp_name_(SafeTempRoot::Get() / boost::filesystem::unique_path(std::string("%%%%-%%%%-").append(hint))) {}

Expand Down
4 changes: 4 additions & 0 deletions src/libaktualizr/utilities/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,13 @@ struct Utils {
static void setUserAgent(std::string user_agent);
static const char *getUserAgent();

static void setCaPath(boost::filesystem::path path);
static const char *getCaPath();

private:
static std::string storage_root_path_;
static std::string user_agent_;
static boost::filesystem::path ca_path_;
};

/**
Expand Down

0 comments on commit d5d0c65

Please sign in to comment.