|
OpenVAS Scanner 23.32.3
|
#include "openvas.h"#include "../misc/kb_cache.h"#include "../misc/plugutils.h"#include "../misc/scan_id.h"#include "../misc/vendorversion.h"#include "../nasl/nasl_krb5.h"#include "attack.h"#include "debug_utils.h"#include "pluginlaunch.h"#include "processes.h"#include "sighand.h"#include "utils.h"#include <bsd/unistd.h>#include <errno.h>#include <fcntl.h>#include <gcrypt.h>#include <glib.h>#include <gnutls/gnutls.h>#include <grp.h>#include <gvm/base/logging.h>#include <gvm/base/nvti.h>#include <gvm/base/prefs.h>#include <gvm/base/version.h>#include <gvm/util/kb.h>#include <gvm/util/mqtt.h>#include <gvm/util/nvticache.h>#include <gvm/util/uuidutils.h>#include <netdb.h>#include <pwd.h>#include <signal.h>#include <stdio.h>#include <stdlib.h>#include <sys/stat.h>#include <sys/un.h>#include <sys/wait.h>#include <unistd.h>#include "../misc/network.h"
Go to the source code of this file.
Data Structures | |
| struct | openvas_option |
Macros | |
| #define | G_LOG_DOMAIN "sd main" |
| GLib log domain. | |
| #define | PROCTITLE_WAITING "openvas: Waiting for incoming connections" |
| #define | PROCTITLE_LOADING "openvas: Loading Handler" |
| #define | PROCTITLE_RELOADING "openvas: Reloading" |
| #define | PROCTITLE_SERVING "openvas: Serving %s" |
Functions | |
| static void | set_default_openvas_prefs () |
| Set the prefs from the openvas_defaults array. | |
| static void | my_gnutls_log_func (int level, const char *text) |
| static void | set_globals_from_preferences (void) |
| static void | handle_termination_signal (int sig) |
| static void | init_signal_handlers (void) |
| Initializes main scanner process' signal handlers. | |
| static int | overwrite_openvas_prefs_with_prefs_from_client (struct scan_globals *globals) |
| Read the scan preferences from redis. | |
| static int | init_logging () |
| Init logging. | |
| static void | gcrypt_init (void) |
| static void | check_tls () |
| Check TLS. | |
| static void | openvas_print_start_msg () |
| Print start message. | |
| static int | stop_single_task_scan (void) |
| Search in redis the process ID of a running scan and sends it the kill signal SIGUSR1, which will stop the scan. To find the process ID, it uses the scan_id passed with the –scan-stop option. | |
| static void | send_message_to_client_and_finish_scan (const char *msg) |
| Send a failure message and set the scan as finished. | |
| static int | attack_network_init (struct scan_globals *globals, const gchar *config_file) |
| Set up data needed for attack_network(). | |
| int | openvas (int argc, char *argv[], char *env[]) |
| openvas. | |
Variables | |
| int | global_max_hosts = 15 |
| int | global_max_checks = 10 |
| int | global_min_memory = 0 |
| int | global_max_sysload = 0 |
| GSList * | log_config = NULL |
| Logging parameters, as passed to setup_log_handlers. | |
| static volatile int | termination_signal = 0 |
| static openvas_option | openvas_defaults [] |
| Default values for scanner options. Must be NULL terminated. | |
OpenVAS main module, runs the scanner.
Definition in file openvas.c.
| #define PROCTITLE_WAITING "openvas: Waiting for incoming connections" |
|
static |
Set up data needed for attack_network().
| globals | scan_globals needed for client preference handling. |
| config_file | Used for config preference handling. |
Definition at line 411 of file openvas.c.
References check_tls(), init_signal_handlers(), openvas_print_start_msg(), overwrite_openvas_prefs_with_prefs_from_client(), plugins_cache_init(), scan_globals::scan_id, send_message_to_client_and_finish_scan(), set_default_openvas_prefs(), set_globals_from_preferences(), and vendor_version_set().
Referenced by openvas().


|
static |
Check TLS.
Definition at line 313 of file openvas.c.
References my_gnutls_log_func(), and openvas_SSL_init().
Referenced by attack_network_init().


|
static |
Definition at line 298 of file openvas.c.
Referenced by openvas().

|
static |
Definition at line 169 of file openvas.c.
References procs_terminate_childs(), and termination_signal.
Referenced by init_signal_handlers().


|
static |
Init logging.
Definition at line 274 of file openvas.c.
References log_config.
Referenced by openvas().

|
static |
Initializes main scanner process' signal handlers.
Definition at line 179 of file openvas.c.
References handle_termination_signal(), openvas_signal, and sighand_chld().
Referenced by attack_network_init().


|
static |
Definition at line 129 of file openvas.c.
Referenced by check_tls(), and main().

| int openvas | ( | int | argc, |
| char * | argv[], | ||
| char * | env[] ) |
openvas.
| argc | Argument count. |
| argv | Argument vector. |
Definition at line 494 of file openvas.c.
References attack_network(), attack_network_init(), destroy_scan_globals(), gcrypt_init(), get_scan_id(), init_logging(), init_sentry(), nasl_okrb5_clean(), plugins_cache_init(), plugins_init(), scan_globals::scan_id, scan_id, set_default_openvas_prefs(), set_globals_from_preferences(), set_scan_id(), and stop_single_task_scan().
Referenced by main().


|
static |
Print start message.
Definition at line 334 of file openvas.c.
Referenced by attack_network_init().

|
static |
Read the scan preferences from redis.
Adds preferences to the global_prefs. If preference already exists in global_prefs they will be overwritten by prefs from client.
| globals | Scan ID of globals used as key to find the corresponding KB where to take the preferences from. Globals also used for file upload. |
Definition at line 201 of file openvas.c.
References is_scanner_only_pref(), kb_item_set_int_with_main_kb_check(), kb_item_set_str_with_main_kb_check(), scan_globals::scan_id, set_main_kb(), and store_file().
Referenced by attack_network_init().


|
static |
Send a failure message and set the scan as finished.
| msg | Message to send to the client. |
Definition at line 388 of file openvas.c.
References get_scan_id().
Referenced by attack_network_init().


|
static |
Set the prefs from the openvas_defaults array.
Definition at line 122 of file openvas.c.
References openvas_defaults, and option.
Referenced by attack_network_init(), and openvas().

|
static |
Definition at line 135 of file openvas.c.
References global_max_checks, global_max_hosts, global_max_sysload, and global_min_memory.
Referenced by attack_network_init(), and openvas().

|
static |
Search in redis the process ID of a running scan and sends it the kill signal SIGUSR1, which will stop the scan. To find the process ID, it uses the scan_id passed with the –scan-stop option.
Definition at line 353 of file openvas.c.
References get_scan_id(), and pid.
Referenced by openvas().


| int global_max_checks = 10 |
Definition at line 85 of file openvas.c.
Referenced by get_max_checks_number(), and set_globals_from_preferences().
| int global_max_hosts = 15 |
Globals that should not be touched (used in utils module).
Definition at line 84 of file openvas.c.
Referenced by get_max_hosts_number(), and set_globals_from_preferences().
| int global_max_sysload = 0 |
Definition at line 88 of file openvas.c.
Referenced by check_sysload(), and set_globals_from_preferences().
| int global_min_memory = 0 |
Definition at line 87 of file openvas.c.
Referenced by check_memory(), and set_globals_from_preferences().
| GSList* log_config = NULL |
Logging parameters, as passed to setup_log_handlers.
Definition at line 93 of file openvas.c.
Referenced by init_logging().
|
static |
Default values for scanner options. Must be NULL terminated.
Only include options which are dependent on CMake variables. Empty options must be "\0", not NULL, to match the behavior of prefs_init.
Definition at line 110 of file openvas.c.
Referenced by set_default_openvas_prefs().
|
static |
Definition at line 95 of file openvas.c.
Referenced by handle_termination_signal().