aboutsummaryrefslogtreecommitdiff
path: root/src/daemon
diff options
context:
space:
mode:
authorLee Clagett <code@leeclagett.com>2019-05-22 00:09:11 -0400
committerLee Clagett <code@leeclagett.com>2019-05-22 00:09:11 -0400
commit3544596f9fd0a260c3a1a9b75432234f93f78cb7 (patch)
tree1e961af0bae06e17e45b80b23352d836944ba3a4 /src/daemon
parentFix configuration bug; wallet2 --daemon-ssl-allow-any-cert now works. (diff)
downloadmonero-3544596f9fd0a260c3a1a9b75432234f93f78cb7.tar.xz
Add ssl_options support to monerod's rpc mode.
Diffstat (limited to 'src/daemon')
-rw-r--r--src/daemon/command_parser_executor.cpp3
-rw-r--r--src/daemon/command_parser_executor.h2
-rw-r--r--src/daemon/command_server.cpp3
-rw-r--r--src/daemon/command_server.h2
-rw-r--r--src/daemon/daemon.cpp3
-rw-r--r--src/daemon/main.cpp6
-rw-r--r--src/daemon/rpc_command_executor.cpp3
-rw-r--r--src/daemon/rpc_command_executor.h2
8 files changed, 19 insertions, 5 deletions
diff --git a/src/daemon/command_parser_executor.cpp b/src/daemon/command_parser_executor.cpp
index 17b945c9a..0b452800e 100644
--- a/src/daemon/command_parser_executor.cpp
+++ b/src/daemon/command_parser_executor.cpp
@@ -40,10 +40,11 @@ t_command_parser_executor::t_command_parser_executor(
uint32_t ip
, uint16_t port
, const boost::optional<tools::login>& login
+ , const epee::net_utils::ssl_options_t& ssl_options
, bool is_rpc
, cryptonote::core_rpc_server* rpc_server
)
- : m_executor(ip, port, login, is_rpc, rpc_server)
+ : m_executor(ip, port, login, ssl_options, is_rpc, rpc_server)
{}
bool t_command_parser_executor::print_peer_list(const std::vector<std::string>& args)
diff --git a/src/daemon/command_parser_executor.h b/src/daemon/command_parser_executor.h
index 098018642..2efd78ec0 100644
--- a/src/daemon/command_parser_executor.h
+++ b/src/daemon/command_parser_executor.h
@@ -40,6 +40,7 @@
#include "daemon/rpc_command_executor.h"
#include "common/common_fwd.h"
+#include "net/net_fwd.h"
#include "rpc/core_rpc_server.h"
namespace daemonize {
@@ -53,6 +54,7 @@ public:
uint32_t ip
, uint16_t port
, const boost::optional<tools::login>& login
+ , const epee::net_utils::ssl_options_t& ssl_options
, bool is_rpc
, cryptonote::core_rpc_server* rpc_server = NULL
);
diff --git a/src/daemon/command_server.cpp b/src/daemon/command_server.cpp
index 69ad6ff10..f665eec9c 100644
--- a/src/daemon/command_server.cpp
+++ b/src/daemon/command_server.cpp
@@ -43,10 +43,11 @@ t_command_server::t_command_server(
uint32_t ip
, uint16_t port
, const boost::optional<tools::login>& login
+ , const epee::net_utils::ssl_options_t& ssl_options
, bool is_rpc
, cryptonote::core_rpc_server* rpc_server
)
- : m_parser(ip, port, login, is_rpc, rpc_server)
+ : m_parser(ip, port, login, ssl_options, is_rpc, rpc_server)
, m_command_lookup()
, m_is_rpc(is_rpc)
{
diff --git a/src/daemon/command_server.h b/src/daemon/command_server.h
index c8e77f551..da532223e 100644
--- a/src/daemon/command_server.h
+++ b/src/daemon/command_server.h
@@ -43,6 +43,7 @@ Passing RPC commands:
#include "common/common_fwd.h"
#include "console_handler.h"
#include "daemon/command_parser_executor.h"
+#include "net/net_fwd.h"
namespace daemonize {
@@ -57,6 +58,7 @@ public:
uint32_t ip
, uint16_t port
, const boost::optional<tools::login>& login
+ , const epee::net_utils::ssl_options_t& ssl_options
, bool is_rpc = true
, cryptonote::core_rpc_server* rpc_server = NULL
);
diff --git a/src/daemon/daemon.cpp b/src/daemon/daemon.cpp
index 531c080de..5084b6283 100644
--- a/src/daemon/daemon.cpp
+++ b/src/daemon/daemon.cpp
@@ -45,6 +45,7 @@
#include "daemon/command_server.h"
#include "daemon/command_server.h"
#include "daemon/command_line_args.h"
+#include "net/net_ssl.h"
#include "version.h"
using namespace epee;
@@ -163,7 +164,7 @@ bool t_daemon::run(bool interactive)
if (interactive && mp_internals->rpcs.size())
{
// The first three variables are not used when the fourth is false
- rpc_commands.reset(new daemonize::t_command_server(0, 0, boost::none, false, mp_internals->rpcs.front()->get_server()));
+ rpc_commands.reset(new daemonize::t_command_server(0, 0, boost::none, epee::net_utils::ssl_support_t::e_ssl_support_disabled, false, mp_internals->rpcs.front()->get_server()));
rpc_commands->start_handling(std::bind(&daemonize::t_daemon::stop_p2p, this));
}
diff --git a/src/daemon/main.cpp b/src/daemon/main.cpp
index dbbb2308c..690d4d60e 100644
--- a/src/daemon/main.cpp
+++ b/src/daemon/main.cpp
@@ -324,7 +324,11 @@ int main(int argc, char const * argv[])
}
}
- daemonize::t_command_server rpc_commands{rpc_ip, rpc_port, std::move(login)};
+ auto ssl_options = cryptonote::rpc_args::process_ssl(vm, true);
+ if (!ssl_options)
+ return 1;
+
+ daemonize::t_command_server rpc_commands{rpc_ip, rpc_port, std::move(login), std::move(*ssl_options)};
if (rpc_commands.process_command_vec(command))
{
return 0;
diff --git a/src/daemon/rpc_command_executor.cpp b/src/daemon/rpc_command_executor.cpp
index 151baa33f..cca0f75f9 100644
--- a/src/daemon/rpc_command_executor.cpp
+++ b/src/daemon/rpc_command_executor.cpp
@@ -127,6 +127,7 @@ t_rpc_command_executor::t_rpc_command_executor(
uint32_t ip
, uint16_t port
, const boost::optional<tools::login>& login
+ , const epee::net_utils::ssl_options_t& ssl_options
, bool is_rpc
, cryptonote::core_rpc_server* rpc_server
)
@@ -137,7 +138,7 @@ t_rpc_command_executor::t_rpc_command_executor(
boost::optional<epee::net_utils::http::login> http_login{};
if (login)
http_login.emplace(login->username, login->password.password());
- m_rpc_client = new tools::t_rpc_client(ip, port, std::move(http_login));
+ m_rpc_client = new tools::t_rpc_client(ip, port, std::move(http_login), ssl_options);
}
else
{
diff --git a/src/daemon/rpc_command_executor.h b/src/daemon/rpc_command_executor.h
index 3c2686b3f..df2894d09 100644
--- a/src/daemon/rpc_command_executor.h
+++ b/src/daemon/rpc_command_executor.h
@@ -43,6 +43,7 @@
#include "common/common_fwd.h"
#include "common/rpc_client.h"
#include "cryptonote_basic/cryptonote_basic.h"
+#include "net/net_fwd.h"
#include "rpc/core_rpc_server.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
@@ -61,6 +62,7 @@ public:
uint32_t ip
, uint16_t port
, const boost::optional<tools::login>& user
+ , const epee::net_utils::ssl_options_t& ssl_options
, bool is_rpc = true
, cryptonote::core_rpc_server* rpc_server = NULL
);