* Common name resolution and cert validation */
| 1616 | * Common name resolution and cert validation |
| 1617 | */ |
| 1618 | bool |
| 1619 | SSLMultiCertConfigLoader::_prep_ssl_ctx(const shared_SSLMultiCertConfigParams &sslMultCertSettings, |
| 1620 | SSLMultiCertConfigLoader::CertLoadData &data, std::set<std::string> &common_names, |
| 1621 | std::unordered_map<int, std::set<std::string>> &unique_names) |
| 1622 | { |
| 1623 | std::vector<X509 *> cert_list; |
| 1624 | const SSLConfigParams *params = this->_params; |
| 1625 | |
| 1626 | SSLCertContextType cert_type; |
| 1627 | if (!this->load_certs_and_cross_reference_names(cert_list, data, params, sslMultCertSettings.get(), common_names, unique_names, |
| 1628 | &cert_type)) { |
| 1629 | return false; |
| 1630 | } |
| 1631 | |
| 1632 | int i = 0; |
| 1633 | bool good_certs = true; |
| 1634 | for (auto const &cert : cert_list) { |
| 1635 | const char *current_cert_name = data.cert_names_list[i].c_str(); |
| 1636 | if (0 > SSLMultiCertConfigLoader::check_server_cert_now(cert, current_cert_name)) { |
| 1637 | /* At this point, we know cert is bad, and we've already printed a |
| 1638 | descriptive reason as to why cert is bad to the log file */ |
| 1639 | Dbg(this->_dbg_ctl(), "Marking certificate as NOT VALID: %s", current_cert_name); |
| 1640 | good_certs = false; |
| 1641 | } |
| 1642 | i++; |
| 1643 | } |
| 1644 | |
| 1645 | for (auto &cert : cert_list) { |
| 1646 | X509_free(cert); |
| 1647 | } |
| 1648 | return good_certs; |
| 1649 | } |
| 1650 | |
| 1651 | /** |
| 1652 | Insert SSLCertContext (SSL_CTX and options) into SSLCertLookup with key. |
no test coverage detected