mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 07:23:53 +01:00
ircd::net::acceptor: Condition accepted SNI from listener's certificate for now.
This commit is contained in:
parent
d45b18f3e8
commit
035ec56bc3
2 changed files with 19 additions and 4 deletions
|
@ -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;
|
||||
|
|
22
ircd/net.cc
22
ircd/net.cc
|
@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue