From: Sean Bright Date: Wed, 3 Oct 2018 12:56:34 +0000 (-0400) Subject: http.c: Reload TLS even if http.conf hasn't changed X-Git-Tag: 16.1.0-rc1~80^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2b4752911f496d83c2ff53b31211721acbc940a2;p=thirdparty%2Fasterisk.git http.c: Reload TLS even if http.conf hasn't changed There is currently no way to indicate to Asterisk that TLS certificates and/or keys have been updated other than by modifying http.conf or restarting Asterisk. There is already code in main/tcptls.c that determines if a reload is actually necessary based on the hashes of the certicate and dependent files, so this change merely gives us a way to request a reload without explicitly modifying http.conf. Change-Id: Ie795420dcc7eb3d91336820688a29adbcc321276 --- diff --git a/main/http.c b/main/http.c index 5d0b89e0ca..dcf90ae1c3 100644 --- a/main/http.c +++ b/main/http.c @@ -2066,7 +2066,15 @@ static int __ast_http_load(int reload) int http_tls_was_enabled = 0; cfg = ast_config_load2("http.conf", "http", config_flags); - if (!cfg || cfg == CONFIG_STATUS_FILEUNCHANGED || cfg == CONFIG_STATUS_FILEINVALID) { + if (!cfg || cfg == CONFIG_STATUS_FILEINVALID) { + return 0; + } + + /* Even if the http.conf hasn't been updated, the TLS certs/keys may have been */ + if (cfg == CONFIG_STATUS_FILEUNCHANGED) { + if (http_tls_cfg.enabled && ast_ssl_setup(https_desc.tls_cfg)) { + ast_tcptls_server_start(&https_desc); + } return 0; }