-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add authenticated API endpoint to reload custom certificates
- /api/do/ssl/custom/reload json is returned with the status and count of installed certificates
- Loading branch information
Showing
2 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
Smithproxy- transparent proxy with SSL inspection capabilities. | ||
Copyright (c) 2014, Ales Stibal <[email protected]>, All rights reserved. | ||
Smithproxy is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
Smithproxy is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with Smithproxy. If not, see <http://www.gnu.org/licenses/>. | ||
Linking Smithproxy statically or dynamically with other modules is | ||
making a combined work based on Smithproxy. Thus, the terms and | ||
conditions of the GNU General Public License cover the whole combination. | ||
In addition, as a special exception, the copyright holders of Smithproxy | ||
give you permission to combine Smithproxy with free software programs | ||
or libraries that are released under the GNU LGPL and with code | ||
included in the standard release of OpenSSL under the OpenSSL's license | ||
(or modified versions of such code, with unchanged license). | ||
You may copy and distribute such a system following the terms | ||
of the GNU GPL for Smithproxy and the licenses of the other code | ||
concerned, provided that you include the source code of that other code | ||
when and as the GNU GPL requires distribution of source code. | ||
Note that people who make modified versions of Smithproxy are not | ||
obligated to grant this special exception for their modified versions; | ||
it is their choice whether to do so. The GNU General Public License | ||
gives permission to release a modified version without this exception; | ||
this exception also makes it possible to release a modified version | ||
which carries forward this exception. | ||
*/ | ||
|
||
#include <nlohmann/json.hpp> | ||
|
||
#include <ext/lmhpp/include/lmhttpd.hpp> | ||
#include <service/httpd/util.hpp> | ||
#include <service/http/jsonize.hpp> | ||
|
||
|
||
static nlohmann::json json_do_ssl_custom_reload(struct MHD_Connection * connection, std::string const& meth, std::string const& req) { | ||
|
||
using namespace jsonize; | ||
|
||
auto& store = SSLFactory::factory(); | ||
auto lc_ = std::scoped_lock(store.lock()); | ||
|
||
store.cache_custom().clear(); | ||
auto ret = store.load_custom_certificates(); | ||
|
||
return { | ||
{"result", ret }, | ||
{"count", store.cache_custom().size()}, | ||
}; | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters