Greenbone Vulnerability Manager
22.4.0~dev1
|
The Greenbone Vulnerability Manager GMP daemon. More...
#include "gmpd.h"
#include "gmp.h"
#include <assert.h>
#include <dirent.h>
#include <errno.h>
#include <string.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <gvm/util/serverutils.h>
Macros | |
#define | G_LOG_DOMAIN "md main" |
GLib log domain. | |
Functions | |
int | init_gmpd (GSList *log_config, const db_conn_info_t *database, int max_ips_per_target, int max_email_attachment_size, int max_email_include_size, int max_email_message_size, manage_connection_forker_t fork_connection, int skip_db_check) |
Initialise the GMP library for the GMP daemon. More... | |
void | init_gmpd_process (const db_conn_info_t *database, gchar **disable) |
Initialise a process forked within the GMP daemon. More... | |
static int | read_from_client_unix (int client_socket) |
Read as much from the client as the from_client buffer will hold. More... | |
static int | read_from_client_tls (gnutls_session_t *client_session) |
Read as much from the client as the from_client buffer will hold. More... | |
static int | read_from_client (gvm_connection_t *client_connection) |
Read as much from the client as the from_client buffer will hold. More... | |
static int | write_to_client_tls (gnutls_session_t *client_session) |
Write as much as possible from to_client to the client. More... | |
static int | write_to_client_unix (int client_socket) |
Write as much as possible from to_client to the client. More... | |
static int | write_to_client (gvm_connection_t *client_connection) |
Write as much as possible from to_client to the client. More... | |
static gboolean | gmpd_send_to_client (const char *msg, void *write_to_client_data) |
Send a response message to the client. More... | |
static int | get_nfds (int socket) |
Get nfds value. More... | |
int | serve_gmp (gvm_connection_t *client_connection, const db_conn_info_t *database, gchar **disable) |
Serve the Greenbone Management Protocol (GMP). More... | |
Variables | |
char | from_client [FROM_BUFFER_SIZE] |
Buffer of input from the client. More... | |
buffer_size_t | from_buffer_size = FROM_BUFFER_SIZE |
Size of from_client data buffer, in bytes. | |
buffer_size_t | from_client_start = 0 |
The start of the data in the from_client buffer. | |
buffer_size_t | from_client_end = 0 |
The end of the data in the from_client buffer. | |
The Greenbone Vulnerability Manager GMP daemon.
This file defines the Greenbone Vulnerability Manager daemon. The Manager serves the Greenbone Management Protocol (GMP) to clients such as the Greenbone Security Assistant (GSA). The Manager and GMP give clients full access to an OpenVAS Scanner.
The library provides two functions: init_gmpd and serve_gmp. init_gmpd initialises the daemon. serve_gmp serves GMP to a single client socket until end of file is reached on the socket.
|
static |
Get nfds value.
[in] | socket | Highest socket number. |
|
static |
Send a response message to the client.
Queue a message in to_client.
[in] | msg | The message, a string. |
[in] | write_to_client_data | Argument to write_to_client . |
int init_gmpd | ( | GSList * | log_config, |
const db_conn_info_t * | database, | ||
int | max_ips_per_target, | ||
int | max_email_attachment_size, | ||
int | max_email_include_size, | ||
int | max_email_message_size, | ||
manage_connection_forker_t | fork_connection, | ||
int | skip_db_check | ||
) |
Initialise the GMP library for the GMP daemon.
[in] | log_config | Log configuration |
[in] | database | Location of manage database. |
[in] | max_ips_per_target | Max number of IPs per target. |
[in] | max_email_attachment_size | Max size of email attachments. |
[in] | max_email_include_size | Max size of email inclusions. |
[in] | max_email_message_size | Max size of email user message text. |
[in] | fork_connection | Function to fork a connection to the GMP daemon layer, or NULL. |
[in] | skip_db_check | Skip DB check. |
void init_gmpd_process | ( | const db_conn_info_t * | database, |
gchar ** | disable | ||
) |
Initialise a process forked within the GMP daemon.
[in] | database | Location of manage database. |
[in] | disable | Commands to disable. |
|
static |
Read as much from the client as the from_client buffer will hold.
[in] | client_connection | The connection with the client. |
|
static |
Read as much from the client as the from_client buffer will hold.
[in] | client_session | The TLS session with the client. |
|
static |
Read as much from the client as the from_client buffer will hold.
[in] | client_socket | The socket. |
int serve_gmp | ( | gvm_connection_t * | client_connection, |
const db_conn_info_t * | database, | ||
gchar ** | disable | ||
) |
Serve the Greenbone Management Protocol (GMP).
Loop reading input from the sockets, processing the input, and writing any results to the appropriate socket. Exit the loop on reaching end of file on the client socket.
Read input from the client. Process the input with process_gmp_client_input. Write the results to the client.
[in] | client_connection | Connection. |
[in] | database | Location of manage database. |
[in] | disable | Commands to disable. |
|
static |
Write as much as possible from to_client to the client.
[in] | client_connection | The client connection. |
|
static |
|
static |
Write as much as possible from to_client to the client.
[in] | client_socket | The client socket. |
char from_client[FROM_BUFFER_SIZE] |
Buffer of input from the client.