remote.h File Reference

This file contains the remote control functionality for the daemon. More...

Data Structures

struct  rc_state
 a busy control command connection, SSL state More...
 
struct  daemon_remote
 The remote control tool state. More...
 
struct  remote_stream
 Connection to print to, either SSL or plain over fd. More...
 

Macros

#define REMOTE_CONTROL_TCP_TIMEOUT   120000
 number of milliseconds timeout on incoming remote control handshake
 

Typedefs

typedef struct remote_stream RES
 

Functions

struct daemon_remotedaemon_remote_create (struct config_file *cfg)
 Create new remote control state for the daemon. More...
 
void daemon_remote_delete (struct daemon_remote *rc)
 remote control state to delete. More...
 
void daemon_remote_clear (struct daemon_remote *rc)
 remote control state to clear up. More...
 
struct listen_portdaemon_remote_open_ports (struct config_file *cfg)
 Open and create listening ports for remote control. More...
 
int daemon_remote_open_accept (struct daemon_remote *rc, struct listen_port *ports, struct worker *worker)
 Setup comm points for accepting remote control connections. More...
 
void daemon_remote_stop_accept (struct daemon_remote *rc)
 Stop accept handlers for TCP (until enabled again) More...
 
void daemon_remote_start_accept (struct daemon_remote *rc)
 Stop accept handlers for TCP (until enabled again) More...
 
void daemon_remote_exec (struct worker *worker)
 Handle nonthreaded remote cmd execution. More...
 

Detailed Description

This file contains the remote control functionality for the daemon.

The remote control can be performed using either the commandline unbound-control tool, or a SSLv3/TLS capable web browser. The channel is secured using SSLv3 or TLSv1, and certificates. Both the server and the client(control tool) have their own keys.

Function Documentation

◆ daemon_remote_create()

struct daemon_remote* daemon_remote_create ( struct config_file cfg)

Create new remote control state for the daemon.

Parameters
cfgconfig file with key file settings.
Returns
new state, or NULL on failure.

References config_file::control_use_cert, log_err(), daemon_remote::max_active, options_remote_is_address(), and config_file::remote_control_enable.

◆ daemon_remote_delete()

void daemon_remote_delete ( struct daemon_remote rc)

remote control state to delete.

Parameters
rcstate to delete.

References daemon_remote_clear(), and rc_state::rc.

Referenced by daemon_delete().

◆ daemon_remote_clear()

void daemon_remote_clear ( struct daemon_remote rc)

remote control state to clear up.

Busy and accept points are closed. Does not delete the rc itself, or the ssl context (with its keys).

Parameters
rcstate to clear.

References daemon_remote::accept_list, daemon_remote::active, daemon_remote::busy_list, rc_state::c, comm_point_delete(), listen_list_delete(), rc_state::next, rc_state::rc, and daemon_remote::worker.

Referenced by daemon_cleanup(), and daemon_remote_delete().

◆ daemon_remote_open_ports()

struct listen_port* daemon_remote_open_ports ( struct config_file cfg)

Open and create listening ports for remote control.

Parameters
cfgconfig options.
Returns
list of ports or NULL on failure. can be freed with listening_ports_free().

References add_open(), config_del_strarray(), config_file::control_ifs, config_file::control_port, config_file::do_ip4, config_file::do_ip6, config_strlist_head::first, listening_ports_free(), log_assert, config_file::remote_control_enable, and resolve_interface_names().

◆ daemon_remote_open_accept()

int daemon_remote_open_accept ( struct daemon_remote rc,
struct listen_port ports,
struct worker worker 
)

Setup comm points for accepting remote control connections.

Parameters
rcstate
portsalready opened ports.
workerworker with communication base. and links to command channels.
Returns
false on error.

References accept_open(), listen_port::fd, log_err(), listen_port::next, and daemon_remote::worker.

◆ daemon_remote_stop_accept()

void daemon_remote_stop_accept ( struct daemon_remote rc)

Stop accept handlers for TCP (until enabled again)

Parameters
rcstate

References daemon_remote::accept_list, and listen_list::next.

Referenced by worker_stop_accept().

◆ daemon_remote_start_accept()

void daemon_remote_start_accept ( struct daemon_remote rc)

Stop accept handlers for TCP (until enabled again)

Parameters
rcstate

References daemon_remote::accept_list, and listen_list::next.

Referenced by worker_start_accept().

◆ daemon_remote_exec()

void daemon_remote_exec ( struct worker worker)

Handle nonthreaded remote cmd execution.

Parameters
workerthis worker (the remote worker).

References worker::cmd, execute_cmd(), log_err(), tube_read_msg(), VERB_ALGO, and verbose().