0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 15:33:54 +01:00

ircd::net::acceptor: Condition accepted SNI from listener's certificate for now.

This commit is contained in:
Jason Volk 2019-09-30 13:24:50 -07:00
parent d45b18f3e8
commit 035ec56bc3
2 changed files with 19 additions and 4 deletions

View file

@ -39,6 +39,7 @@ struct ircd::net::acceptor
net::listener *listener_;
std::string name;
std::string opts;
std::string cname;
size_t backlog;
listener::callback cb;
listener::proffer pcb;

View file

@ -2093,8 +2093,7 @@ try
const string_view accept[]
{
ircd::server_name,
ircd::network_name,
this->cname,
};
const bool accepts
@ -2357,11 +2356,26 @@ ircd::net::acceptor::configure_certs(const json::object &opts)
};
ssl.use_certificate_file(filename, asio::ssl::context::pem);
const auto *const x509
{
SSL_CTX_get0_certificate(ssl.native_handle())
};
this->cname = ircd::string(rfc3986::DOMAIN_BUFSIZE | SHRINK_TO_FIT, [&x509]
(const mutable_buffer &buf)
{
return x509?
openssl::subject_common_name(buf, *x509):
string_view{};
});
log::info
{
log, "%s using certificate file '%s'",
log, "%s using file '%s' with certificate for '%s'",
loghead(*this),
filename
filename,
this->cname,
};
}