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

Check if the scan was stopped before launching OpenVAS. #332

Merged
merged 1 commit into from
Sep 3, 2020

Conversation

jjnicola
Copy link
Member

@jjnicola jjnicola commented Sep 3, 2020

What:
Check if the scan was stopped before launching OpenVAS.

Why:
If the scan was stopped during the preferences handling before spawining the OpenVAS process,
the process was spawned but still marked as stopped.
Now the scan is indeed stopped and the new process is not being spawned.

How:
The issue is that ospd-openvas set the task as running, while it is still preparing the scan preferences to be sent to the scanner. In other words, Openvas has not been started when ospd-openvas received the stop command.

With a small scan config, this problem is probably harder to reproduce, since ospd-openvas prepares the preferences and starts Openvas faster

If you see in the logs, you can see that Openvas is started after the stop cmd is received. If you wait until Openvas is indeed started, the scan is stopped as expected.

To reproduce the issue and check the fix:

  1. Start a task with a "Full and fast" scan against a /24 network
  2. Once the task is displayed as "Running", stop it by clicking on the "Stop" icon.

Checklist:

If the scan was stopped during the preferences handling before spawining the OpenVAS process,
the process was spawned but still marked as stopped.
Now the scan is indeed stopped and the new process is not being spawned.
@codecov
Copy link

codecov bot commented Sep 3, 2020

Codecov Report

Merging #332 into ospd-openvas-20.08 will decrease coverage by 0.81%.
The diff coverage is 54.54%.

Impacted file tree graph

@@                  Coverage Diff                   @@
##           ospd-openvas-20.08     #332      +/-   ##
======================================================
- Coverage               82.71%   81.90%   -0.82%     
======================================================
  Files                       9        9              
  Lines                    1481     1514      +33     
======================================================
+ Hits                     1225     1240      +15     
- Misses                    256      274      +18     
Impacted Files Coverage Δ
ospd_openvas/daemon.py 62.12% <33.33%> (-0.78%) ⬇️
ospd_openvas/db.py 96.24% <57.14%> (-3.36%) ⬇️
ospd_openvas/preferencehandler.py 87.15% <66.66%> (+0.04%) ⬆️
ospd_openvas/__version__.py 100.00% <100.00%> (ø)
ospd_openvas/lock.py 85.96% <100.00%> (+0.25%) ⬆️
ospd_openvas/nvticache.py 98.49% <100.00%> (+0.01%) ⬆️
ospd_openvas/openvas.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 63e4db4...5509315. Read the comment docs.

@jjnicola jjnicola merged commit 90746aa into greenbone:ospd-openvas-20.08 Sep 3, 2020
@jjnicola jjnicola deleted the stop-scan branch September 3, 2020 10:04
ArnoStiefvater pushed a commit to ArnoStiefvater/ospd-openvas that referenced this pull request Oct 25, 2021
Allow the scanner to update total count of hosts.
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.

2 participants