nghttpx: Add logging for somewhat important events (logs, tickets, and ocsp)
This commit is contained in:
parent
14d4979c54
commit
889e705f35
|
@ -417,9 +417,7 @@ namespace {
|
||||||
void reopen_log_signal_cb(struct ev_loop *loop, ev_signal *w, int revents) {
|
void reopen_log_signal_cb(struct ev_loop *loop, ev_signal *w, int revents) {
|
||||||
auto conn_handler = static_cast<ConnectionHandler *>(w->data);
|
auto conn_handler = static_cast<ConnectionHandler *>(w->data);
|
||||||
|
|
||||||
if (LOG_ENABLED(INFO)) {
|
LOG(NOTICE) << "Reopening log files: main";
|
||||||
LOG(INFO) << "Reopening log files: main";
|
|
||||||
}
|
|
||||||
|
|
||||||
(void)reopen_log_files();
|
(void)reopen_log_files();
|
||||||
redirect_stderr_to_errorlog();
|
redirect_stderr_to_errorlog();
|
||||||
|
@ -573,9 +571,8 @@ void renew_ticket_key_cb(struct ev_loop *loop, ev_timer *w, int revents) {
|
||||||
const auto &old_ticket_keys = conn_handler->get_ticket_keys();
|
const auto &old_ticket_keys = conn_handler->get_ticket_keys();
|
||||||
|
|
||||||
auto ticket_keys = std::make_shared<TicketKeys>();
|
auto ticket_keys = std::make_shared<TicketKeys>();
|
||||||
if (LOG_ENABLED(INFO)) {
|
LOG(NOTICE) << "Renew ticket keys: main";
|
||||||
LOG(INFO) << "renew ticket key";
|
|
||||||
}
|
|
||||||
// We store at most 2 ticket keys
|
// We store at most 2 ticket keys
|
||||||
if (old_ticket_keys) {
|
if (old_ticket_keys) {
|
||||||
auto &old_keys = old_ticket_keys->keys;
|
auto &old_keys = old_ticket_keys->keys;
|
||||||
|
|
|
@ -69,6 +69,8 @@ void ocsp_cb(struct ev_loop *loop, ev_timer *w, int revent) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOG(NOTICE) << "Start ocsp update";
|
||||||
|
|
||||||
h->proceed_next_cert_ocsp();
|
h->proceed_next_cert_ocsp();
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -358,6 +360,10 @@ int ConnectionHandler::start_ocsp_update(const char *cert_file) {
|
||||||
int rv;
|
int rv;
|
||||||
int pfd[2];
|
int pfd[2];
|
||||||
|
|
||||||
|
if (LOG_ENABLED(INFO)) {
|
||||||
|
LOG(INFO) << "Start ocsp update for " << cert_file;
|
||||||
|
}
|
||||||
|
|
||||||
assert(!ev_is_active(&ocsp_.rev));
|
assert(!ev_is_active(&ocsp_.rev));
|
||||||
assert(!ev_is_active(&ocsp_.chldev));
|
assert(!ev_is_active(&ocsp_.chldev));
|
||||||
|
|
||||||
|
@ -391,8 +397,8 @@ int ConnectionHandler::start_ocsp_update(const char *cert_file) {
|
||||||
auto pid = fork();
|
auto pid = fork();
|
||||||
if (pid == -1) {
|
if (pid == -1) {
|
||||||
auto error = errno;
|
auto error = errno;
|
||||||
LOG(WARN) << "Could not execute ocsp query command: " << argv[0]
|
LOG(WARN) << "Could not execute ocsp query command for " << cert_file
|
||||||
<< ", fork() failed, errno=" << error;
|
<< ": " << argv[0] << ", fork() failed, errno=" << error;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -461,22 +467,23 @@ void ConnectionHandler::handle_ocsp_complete() {
|
||||||
ev_io_stop(loop_, &ocsp_.rev);
|
ev_io_stop(loop_, &ocsp_.rev);
|
||||||
ev_child_stop(loop_, &ocsp_.chldev);
|
ev_child_stop(loop_, &ocsp_.chldev);
|
||||||
|
|
||||||
auto rstatus = ocsp_.chldev.rstatus;
|
|
||||||
auto status = WEXITSTATUS(rstatus);
|
|
||||||
if (ocsp_.error || !WIFEXITED(rstatus) || status != 0) {
|
|
||||||
LOG(WARN) << "ocsp query command failed: error=" << ocsp_.error
|
|
||||||
<< ", rstatus=" << rstatus << ", status=" << status;
|
|
||||||
++ocsp_.next;
|
|
||||||
proceed_next_cert_ocsp();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(ocsp_.next < all_ssl_ctx_.size());
|
assert(ocsp_.next < all_ssl_ctx_.size());
|
||||||
|
|
||||||
auto ssl_ctx = all_ssl_ctx_[ocsp_.next];
|
auto ssl_ctx = all_ssl_ctx_[ocsp_.next];
|
||||||
auto tls_ctx_data =
|
auto tls_ctx_data =
|
||||||
static_cast<ssl::TLSContextData *>(SSL_CTX_get_app_data(ssl_ctx));
|
static_cast<ssl::TLSContextData *>(SSL_CTX_get_app_data(ssl_ctx));
|
||||||
|
|
||||||
|
auto rstatus = ocsp_.chldev.rstatus;
|
||||||
|
auto status = WEXITSTATUS(rstatus);
|
||||||
|
if (ocsp_.error || !WIFEXITED(rstatus) || status != 0) {
|
||||||
|
LOG(WARN) << "ocsp query command for " << tls_ctx_data->cert_file
|
||||||
|
<< " failed: error=" << ocsp_.error << ", rstatus=" << rstatus
|
||||||
|
<< ", status=" << status;
|
||||||
|
++ocsp_.next;
|
||||||
|
proceed_next_cert_ocsp();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (LOG_ENABLED(INFO)) {
|
if (LOG_ENABLED(INFO)) {
|
||||||
LOG(INFO) << "ocsp update for " << tls_ctx_data->cert_file
|
LOG(INFO) << "ocsp update for " << tls_ctx_data->cert_file
|
||||||
<< " finished successfully";
|
<< " finished successfully";
|
||||||
|
|
|
@ -160,17 +160,13 @@ void Worker::process_events() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case RENEW_TICKET_KEYS:
|
case RENEW_TICKET_KEYS:
|
||||||
if (LOG_ENABLED(INFO)) {
|
WLOG(NOTICE, this) << "Renew ticket keys: worker(" << this << ")";
|
||||||
WLOG(INFO, this) << "Renew ticket keys: worker(" << this << ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
ticket_keys_ = wev.ticket_keys;
|
ticket_keys_ = wev.ticket_keys;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case REOPEN_LOG:
|
case REOPEN_LOG:
|
||||||
if (LOG_ENABLED(INFO)) {
|
WLOG(NOTICE, this) << "Reopening log files: worker(" << this << ")";
|
||||||
WLOG(INFO, this) << "Reopening log files: worker(" << this << ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
reopen_log_files();
|
reopen_log_files();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue