-
Notifications
You must be signed in to change notification settings - Fork 633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Drop daemon mode #337
Drop daemon mode #337
Conversation
This is the very first step towards removing the daemon mode of openvassd. As a command line tool, foreground is the only natural behaviour.
This removed calling the main_loop() function that brings openvassd into a daemon service mode. Subsequent to removing the function main_loop() some further local functions are not needed anymore and removed as well: remove_pidfile(), log_config_free(), check_termination() and check_reload().
As a plain command line tool, we do not need a pidfile.
Among these is pidfile, the last occurance in openvas.
The option "--only-cache" (same as "-C" is renamed to "--update-vt-info" ("-u") to be clear in meaning. The old command line option was a traditional name actually about some old file cache rebuild.
This removed the comand line options for openvassd "--unix-socket" ("-c"), "--listen-owner", "--listen-group" and "--listen-mode".
This essentially means to remove the function init_unix_network().
Because it is always OSP now.
This loading handler was about answering OTP request with a information that currentling the VTs are loaded. We do not need this handler anymore during loading the VTs.
Finally, there is no need of module "comm" anymore and therefore it can be removed entirely.
Removing the otp conditionals leads to a long chain of mandatory susequent removals of functions and function parameters.
There is no more a global socket used or needed. So, remove the last occurances of handling it.
The binary is now called "openvas" since it does not run as a daemon/service anymore.
Personally I would prefer to rename openvasd to openvas-scanner to be precise. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good and my tests worked as expected. Only the key name in src/hosts.c must be fixed.
Also, check_kb_status() and stop_all_scans() in src/openvas.c are not used anymore, and they can be removed. Maybe this can be done later with another PR.
src/hosts.c
Outdated
static void | ||
host_rm (struct host *h) | ||
{ | ||
if (h->pid != 0) | ||
waitpid (h->pid, NULL, WNOHANG); | ||
|
||
if (!global_scan_stop) | ||
ntp_timestamp_host_scan_ends (h->host_kb); | ||
host_set_time (h->host_kb, "internal/start_time"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The key name here should be "internal/end_time"
host_set_time (h->host_kb, "internal/start_time"); | |
host_set_time (h->host_kb, "internal/end_time"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
This function where removed when OTP was removed with greenbone#337 They were modified and adapted to the new protocol.
This function where removed when OTP was removed with greenbone#337 They were modified and adapted to the new protocol.
This essentially means to remove OTP entirely and to rename openvassd into openvas to make clear it is a command line tool now.
The main interface of the new "openvas" consists of two elements:
One the one hand there are two command line parameters to update the VT data into redis cache and to start a scan for which all data is stored in redis.
One the other hand, redis is the second interface where scan information is stored to run a scan and
from where vt info as well as scan results are retrieved.
"ospd-openvas" implements these interfaces and can fully control the new openvas.