Skip to content
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

Merged
merged 30 commits into from
Jun 7, 2019
Merged

Drop daemon mode #337

merged 30 commits into from
Jun 7, 2019

Conversation

janowagner
Copy link
Member

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.

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.
@janowagner janowagner requested a review from a team May 31, 2019 23:23
@janowagner janowagner added the work in progress This pull request should not be merged yet, more commits are expected label May 31, 2019
@bjoernricks
Copy link
Contributor

Personally I would prefer to rename openvasd to openvas-scanner to be precise.

Copy link
Member

@jjnicola jjnicola left a 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");
Copy link
Member

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"

Suggested change
host_set_time (h->host_kb, "internal/start_time");
host_set_time (h->host_kb, "internal/end_time");

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@janowagner janowagner removed the work in progress This pull request should not be merged yet, more commits are expected label Jun 6, 2019
@jjnicola jjnicola merged commit b955373 into greenbone:master Jun 7, 2019
jjnicola added a commit to jjnicola/openvas-scanner that referenced this pull request Oct 10, 2019
This function where removed when OTP was removed with
greenbone#337
They were modified and adapted to the new protocol.
jjnicola added a commit to jjnicola/openvas-scanner that referenced this pull request Oct 10, 2019
This function where removed when OTP was removed with
greenbone#337
They were modified and adapted to the new protocol.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants