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

Ensure that new kb taken by the scanner are always clean. #469

Merged
merged 2 commits into from
Mar 29, 2021

Conversation

jjnicola
Copy link
Member

What:
Ensure that new kb taken by the scanner are always clean.

Why:
To ensure that new kbs taken by the scanner are always clean.

How:
Enter to redis-cli and check that the only kb set "in used" is the kb 1, which contains the VTs cache

$ redis-cli -s /run/redis-openvas/redis.sock 
redis /run/redis-openvas/redis.sock> keys *
1) "GVM.__GlobalDBIndex"
redis /run/redis-openvas/redis.sock> HGETALL GVM.__GlobalDBIndex
1) "1"
2) "1"

Add some items to the the KB 2 and KB 3

redis /run/redis-openvas/redis.sock> SELECT 2
OK
redis /run/redis-openvas/redis.sock[2]> LPUSH a 123 1231 11222
(integer) 3
redis /run/redis-openvas/redis.sock[2]> LPUSH b 123 1231 11222
(integer) 3
redis /run/redis-openvas/redis.sock[2]> LPUSH b 123 1231 11222
(integer) 6
redis /run/redis-openvas/redis.sock[2]> LPUSH x 123 1231 11222
(integer) 3
redis /run/redis-openvas/redis.sock[2]> LPUSH c 123 1231 11222
(integer) 3
redis /run/redis-openvas/redis.sock[2]> LPUSH v 123 1231 11222
(integer) 3
redis /run/redis-openvas/redis.sock[2]> LPUSH w 123 1231 11222
(integer) 3
redis /run/redis-openvas/redis.sock[2]> keys *
1) "a"
2) "w"
3) "b"
4) "v"
5) "x"
6) "c"
redis /run/redis-openvas/redis.sock[2]> SELECT 3
OK
redis /run/redis-openvas/redis.sock[3]> LPUSH w 123 1231 11222
(integer) 3
redis /run/redis-openvas/redis.sock[3]> LPUSH v 123 1231 11222
(integer) 3
redis /run/redis-openvas/redis.sock[3]> LPUSH b 123 1231 11222
(integer) 3
redis /run/redis-openvas/redis.sock[3]> LPUSH x 123 1231 11222
(integer) 3
redis /run/redis-openvas/redis.sock[3]> LPUSH a 123 1231 11222
(integer) 3
redis /run/redis-openvas/redis.sock[3]> LPUSH as 123 1231 11222
(integer) 3
redis /run/redis-openvas/redis.sock[3]> LPUSH asd 123 1231 11222
(integer) 3
redis /run/redis-openvas/redis.sock[3]> LPUSH asdf 123 1231 11222
(integer) 3
redis /run/redis-openvas/redis.sock[3]> LPUSH asdgf 123 1231 11222
(integer) 3
redis /run/redis-openvas/redis.sock[3]> LPUSH asdvdsgf 123 1231 11222
(integer) 3
redis /run/redis-openvas/redis.sock[3]> LPUSH asd23vdsgf 123 1231 11222
(integer) 3
redis /run/redis-openvas/redis.sock[3]> LPUSH asd23htvdsgf 123 1231 11222
(integer) 3
redis /run/redis-openvas/redis.sock[3]> LPUSH asd23htvjdsgf 123 1231 11222
(integer) 3
redis /run/redis-openvas/redis.sock[3]> LPUSH asd23htvdjdsgf 123 1231 11222
(integer) 3

redis /run/redis-openvas/redis.sock> info keyspace
# Keyspace
db0:keys=1,expires=0,avg_ttl=0
db1:keys=179237,expires=0,avg_ttl=0
db2:keys=6,expires=0,avg_ttl=0
db3:keys=14,expires=0,avg_ttl=0

Run a scan. As the only kb set as "in used" is the kb 1, kb 2 and kb 3 will be taken for the task.
Once the openvas started and scans the host, check in the kb 2 and kb 3 if the items you added above were deleted (kb clean)

redis /run/redis-openvas/redis.sock[2]> SELECT 2
OK
redis /run/redis-openvas/redis.sock[2]> keys *
1) "internal/scanid"
2) "internal/7f24d936-8879-41b4-83ef-195a55129345/scanprefs"
3) "internal/ec2f19c9-32dd-4fde-b9b4-7d6f07a7a53c/globalscanid"
4) "internal/7f24d936-8879-41b4-83ef-195a55129345"

redis /run/redis-openvas/redis.sock[2]> SELECT 3
OK
redis /run/redis-openvas/redis.sock[3]> keys as*
(empty list or set)
redis /run/redis-openvas/redis.sock[3]> info keyspace
# Keyspace
db0:keys=1,expires=0,avg_ttl=0
db1:keys=179237,expires=0,avg_ttl=0
db2:keys=5,expires=0,avg_ttl=0
db3:keys=71,expires=0,avg_ttl=0

Checklist:

@jjnicola jjnicola added backport-to-stable This pull request will be backported to the 21.04 branch backport-to-main This pull request will be ported to the master branch labels Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-to-main This pull request will be ported to the master branch backport-to-stable This pull request will be backported to the 21.04 branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants