Skip to content

Commit

Permalink
Merge branch 'main' into get-nvts-skip-tags
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmundell authored Sep 4, 2023
2 parents 50e4886 + 159e286 commit 74eb288
Show file tree
Hide file tree
Showing 13 changed files with 137 additions and 60 deletions.
5 changes: 5 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,11 @@ supported values for `<name>` are:
This cleans up id sequences that are likely to run out due to regular feed
updates like the ids for config preferences.

- `cleanup-tls-certificate-encoding`

This cleans up TLS certificates where the subject or issuer DN is not
valid UTF-8.

- `migrate-relay-sensors`

If relays are active, this can be used to make sure all sensor type
Expand Down
2 changes: 1 addition & 1 deletion doc/gvmd.8
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ Modify user's password and exit.
Modify user's password and exit.
.TP
\fB--optimize=\fINAME\fB\f1
Run an optimization: vacuum, add-feed-permissions, analyze, cleanup-config-prefs, cleanup-feed-permissions, cleanup-port-names, cleanup-report-formats, cleanup-result-nvts, cleanup-result-severities, cleanup-schedule-times, cleanup-sequences, migrate-relay-sensors, rebuild-report-cache or update-report-cache.
Run an optimization: vacuum, add-feed-permissions, analyze, cleanup-config-prefs, cleanup-feed-permissions, cleanup-port-names, cleanup-report-formats, cleanup-result-nvts, cleanup-result-severities, cleanup-schedule-times, cleanup-sequences, cleanup-tls-certificate-encoding, migrate-relay-sensors, rebuild-report-cache or update-report-cache.
.TP
\fB--osp-vt-update=\fISCANNER-SOCKET\fB\f1
Unix socket for OSP NVT update. Defaults to the path of the 'OpenVAS Default' scanner if it is an absolute path.
Expand Down
4 changes: 2 additions & 2 deletions doc/gvmd.8.xml
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
cleanup-config-prefs, cleanup-feed-permissions,
cleanup-port-names, cleanup-report-formats, cleanup-result-nvts,
cleanup-result-severities, cleanup-schedule-times, cleanup-sequences,
migrate-relay-sensors, rebuild-report-cache
or update-report-cache.</p>
cleanup-tls-certificate-encoding, migrate-relay-sensors,
rebuild-report-cache or update-report-cache.</p>
</optdesc>
</option>
<option>
Expand Down
4 changes: 2 additions & 2 deletions doc/gvmd.html
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ <h2>Options</h2>
cleanup-config-prefs, cleanup-feed-permissions,
cleanup-port-names, cleanup-report-formats, cleanup-result-nvts,
cleanup-result-severities, cleanup-schedule-times, cleanup-sequences,
migrate-relay-sensors, rebuild-report-cache
or update-report-cache.</p>
cleanup-tls-certificate-encoding, migrate-relay-sensors,
rebuild-report-cache or update-report-cache.</p>



Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ find_package (Threads)
## list and throw an error, otherwise long install-cmake-install-cmake cycles
## might occur.

pkg_check_modules (LIBGVM_BASE REQUIRED libgvm_base>=22.6)
pkg_check_modules (LIBGVM_BASE REQUIRED libgvm_base>=22.7)
pkg_check_modules (LIBGVM_UTIL REQUIRED libgvm_util>=22.6)
pkg_check_modules (LIBGVM_OSP REQUIRED libgvm_osp>=22.6)
pkg_check_modules (LIBGVM_GMP REQUIRED libgvm_gmp>=22.6)
Expand Down
65 changes: 33 additions & 32 deletions src/gvmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ accept_and_maybe_fork (int server_socket, sigset_t *sigmask_current)
init_sentry ();
is_parent = 0;

setproctitle ("gvmd: Serving client");
setproctitle ("Serving client");

/* Restore the sigmask that was blanked for pselect. */
pthread_sigmask (SIG_SETMASK, sigmask_current, NULL);
Expand Down Expand Up @@ -736,7 +736,7 @@ fork_connection_internal (gvm_connection_t *client_connection,
/* Child. Serve the scheduler GMP, then exit. */

init_sentry ();
setproctitle ("gvmd: Serving GMP internally");
setproctitle ("Serving GMP internally");

parent_client_socket = sockets[0];

Expand Down Expand Up @@ -834,7 +834,7 @@ fork_connection_internal (gvm_connection_t *client_connection,

g_debug ("%s: %i forked %i", __func__, getpid (), pid);

setproctitle ("gvmd: Requesting GMP internally");
setproctitle ("Requesting GMP internally");

/* This process is returned as the child of
* fork_connection_for_scheduler so that the returned parent can wait
Expand Down Expand Up @@ -1105,7 +1105,7 @@ handle_sigabrt_simple (int signal)
static int
update_nvt_cache_osp (const gchar *update_socket)
{
setproctitle ("gvmd: OSP: Updating NVT cache");
setproctitle ("OSP: Updating NVT cache");

return manage_update_nvts_osp (update_socket);
}
Expand All @@ -1121,7 +1121,7 @@ update_nvt_cache_osp (const gchar *update_socket)
static int
update_nvt_cache_retry ()
{
setproctitle ("gvmd: Reloading NVTs");
setproctitle ("Reloading NVTs");

/* Don't ignore SIGCHLD, in order to wait for child process. */
setup_signal_handler (SIGCHLD, SIG_DFL, 0);
Expand Down Expand Up @@ -1216,7 +1216,7 @@ fork_update_nvt_cache ()
/* Child. */

init_sentry ();
setproctitle ("gvmd: Updating NVT cache");
setproctitle ("Updating NVT cache");

/* Clean up the process. */

Expand Down Expand Up @@ -1327,7 +1327,7 @@ fork_feed_sync ()
/* Child. */

init_sentry ();
setproctitle ("gvmd: Synchronizing feed data");
setproctitle ("Synchronizing feed data");

/* Clean up the process. */

Expand Down Expand Up @@ -2101,7 +2101,8 @@ gvmd (int argc, char** argv, char *env[])
" cleanup-config-prefs, cleanup-feed-permissions,"
" cleanup-port-names, cleanup-report-formats, cleanup-result-encoding,"
" cleanup-result-nvts, cleanup-result-severities,"
" cleanup-schedule-times, cleanup-sequences, migrate-relay-sensors,"
" cleanup-schedule-times, cleanup-sequences,"
" cleanup-tls-certificate-encoding, migrate-relay-sensors,"
" rebuild-report-cache or update-report-cache.",
"<name>" },
{ "osp-vt-update", '\0', 0, G_OPTION_ARG_STRING,
Expand Down Expand Up @@ -2378,7 +2379,7 @@ gvmd (int argc, char** argv, char *env[])
/* Set process title. */

setproctitle_init (argc, argv, env);
setproctitle ("gvmd: Initializing");
setproctitle ("Initializing");

/* Setup initial signal handlers. */

Expand Down Expand Up @@ -2573,7 +2574,7 @@ gvmd (int argc, char** argv, char *env[])
return EXIT_FAILURE;
}

setproctitle ("gvmd: Migrating database");
setproctitle ("Migrating database");

g_info (" Migrating database.");

Expand Down Expand Up @@ -2658,7 +2659,7 @@ gvmd (int argc, char** argv, char *env[])
{
int ret;

setproctitle ("gvmd: Optimizing");
setproctitle ("Optimizing");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand All @@ -2674,7 +2675,7 @@ gvmd (int argc, char** argv, char *env[])
{
int ret;

setproctitle ("gvmd: --rebuild");
setproctitle ("--rebuild");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand All @@ -2696,7 +2697,7 @@ gvmd (int argc, char** argv, char *env[])

error_msg = NULL;

setproctitle ("gvmd: --rebuild-gvmd-data");
setproctitle ("--rebuild-gvmd-data");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand All @@ -2721,7 +2722,7 @@ gvmd (int argc, char** argv, char *env[])
{
int ret;

setproctitle ("gvmd: --rebuild-scap");
setproctitle ("--rebuild-scap");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand All @@ -2740,7 +2741,7 @@ gvmd (int argc, char** argv, char *env[])
{
int ret;

setproctitle ("gvmd: --dump-vt-verification");
setproctitle ("--dump-vt-verification");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand All @@ -2763,7 +2764,7 @@ gvmd (int argc, char** argv, char *env[])

/* Create the scanner and then exit. */

setproctitle ("gvmd: Creating scanner");
setproctitle ("Creating scanner");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand Down Expand Up @@ -2815,7 +2816,7 @@ gvmd (int argc, char** argv, char *env[])

/* Modify the scanner and then exit. */

setproctitle ("gvmd: Modifying scanner");
setproctitle ("Modifying scanner");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand Down Expand Up @@ -2859,7 +2860,7 @@ gvmd (int argc, char** argv, char *env[])
{
int ret;

setproctitle ("gvmd: Checking alerts");
setproctitle ("Checking alerts");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand All @@ -2874,7 +2875,7 @@ gvmd (int argc, char** argv, char *env[])
if (create_encryption_key)
{
int ret;
setproctitle ("gvmd: Creating encryption key");
setproctitle ("Creating encryption key");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand All @@ -2889,7 +2890,7 @@ gvmd (int argc, char** argv, char *env[])
if (set_encryption_key)
{
int ret;
setproctitle ("gvmd: Setting encryption key");
setproctitle ("Setting encryption key");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand All @@ -2906,7 +2907,7 @@ gvmd (int argc, char** argv, char *env[])
{
int ret;

setproctitle ("gvmd: Creating user");
setproctitle ("Creating user");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand All @@ -2923,7 +2924,7 @@ gvmd (int argc, char** argv, char *env[])
{
int ret;

setproctitle ("gvmd: Deleting user");
setproctitle ("Deleting user");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand All @@ -2939,7 +2940,7 @@ gvmd (int argc, char** argv, char *env[])
{
int ret;

setproctitle ("gvmd: Getting roles");
setproctitle ("Getting roles");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand All @@ -2955,7 +2956,7 @@ gvmd (int argc, char** argv, char *env[])
{
int ret;

setproctitle ("gvmd: Getting users");
setproctitle ("Getting users");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand All @@ -2971,7 +2972,7 @@ gvmd (int argc, char** argv, char *env[])
{
int ret;

setproctitle ("gvmd: Getting scanners");
setproctitle ("Getting scanners");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand All @@ -2987,7 +2988,7 @@ gvmd (int argc, char** argv, char *env[])
{
int ret;

setproctitle ("gvmd: Deleting scanner");
setproctitle ("Deleting scanner");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand All @@ -3003,7 +3004,7 @@ gvmd (int argc, char** argv, char *env[])
{
int ret;

setproctitle ("gvmd: Verifying scanner");
setproctitle ("Verifying scanner");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand All @@ -3019,7 +3020,7 @@ gvmd (int argc, char** argv, char *env[])
{
int ret;

setproctitle ("gvmd: Modifying user password");
setproctitle ("Modifying user password");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand All @@ -3035,7 +3036,7 @@ gvmd (int argc, char** argv, char *env[])
{
int ret;

setproctitle ("gvmd: Modifying setting");
setproctitle ("Modifying setting");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand All @@ -3052,7 +3053,7 @@ gvmd (int argc, char** argv, char *env[])
{
int ret;

setproctitle ("gvmd: Encrypting all credentials");
setproctitle ("Encrypting all credentials");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand All @@ -3068,7 +3069,7 @@ gvmd (int argc, char** argv, char *env[])
{
int ret;

setproctitle ("gvmd: Decrypting all credentials");
setproctitle ("Decrypting all credentials");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand Down Expand Up @@ -3319,7 +3320,7 @@ gvmd (int argc, char** argv, char *env[])

/* Enter the main forever-loop. */

setproctitle ("gvmd: Waiting for incoming connections");
setproctitle ("Waiting for incoming connections");
serve_and_schedule ();

gvm_close_sentry ();
Expand Down
10 changes: 5 additions & 5 deletions src/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -2865,7 +2865,7 @@ fork_osp_scan_handler (task_t task, target_t target, int from,
exit (-1);
}

setproctitle ("gvmd: OSP: Handling scan %s", report_id);
setproctitle ("OSP: Handling scan %s", report_id);

rc = handle_osp_scan (task, global_current_report, report_id);
g_free (report_id);
Expand Down Expand Up @@ -3217,7 +3217,7 @@ fork_cve_scan_handler (task_t task, target_t target)

set_task_run_status (task, TASK_STATUS_RUNNING);

setproctitle ("gvmd: CVE: Handling scan %s", report_id);
setproctitle ("CVE: Handling scan %s", report_id);
g_free (report_id);

hosts = target_hosts (target);
Expand Down Expand Up @@ -4764,7 +4764,7 @@ scheduled_task_start (scheduled_task_t *scheduled_task,

/* Parent. Wait for child, to check return. */

setproctitle ("gvmd: scheduler: waiting for %i", pid);
setproctitle ("scheduler: waiting for %i", pid);

g_debug ("%s: %i fork_connectioned %i",
__func__, getpid (), pid);
Expand Down Expand Up @@ -4865,7 +4865,7 @@ scheduled_task_start (scheduled_task_t *scheduled_task,

/* Start the task. */

setproctitle ("gvmd: scheduler: starting %s", scheduled_task->task_uuid);
setproctitle ("scheduler: starting %s", scheduled_task->task_uuid);

auth_opts = gmp_authenticate_info_opts_defaults;
auth_opts.username = scheduled_task->owner_name;
Expand Down Expand Up @@ -4956,7 +4956,7 @@ scheduled_task_stop (scheduled_task_t *scheduled_task,

/* Stop the task. */

setproctitle ("gvmd: scheduler: stopping %s",
setproctitle ("scheduler: stopping %s",
scheduled_task->task_uuid);

auth_opts = gmp_authenticate_info_opts_defaults;
Expand Down
3 changes: 3 additions & 0 deletions src/manage_pg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2886,6 +2886,9 @@ create_tables ()

/* Create indexes. */

sql ("SELECT create_index ('config_preferences_by_config',"
" 'config_preferences', 'config');");

sql ("SELECT create_index ('host_details_by_host',"
" 'host_details', 'host');");

Expand Down
Loading

0 comments on commit 74eb288

Please sign in to comment.