Scripting the import of a scan config

I have a custom scan config created on one OpenVAS instance then exported, which I would like to roll out to many instances of OpenVAS, without having to import it manually.

Is there a way to script the import of a scan config?

Thanks,

Anna

Hi,

please take a look at the gmp category

and gvm-tools respectively python-gvm

2 Likes

Thanks, but unfortunately the API doesn’t document a way to import an entire config. … unless I’ve missed something.

See here for the GMP command create_config:

https://docs.greenbone.net/API/GMP/gmp-7.0.html#command_create_config

You need to apply the second option with a embedded get_configs_response element which is what you exported.

2 Likes

Personally I don’t think this part of the create_config command is a good API therefore it isn’t available in python-gvm at the moment. create_config is a bit special because you always have to derive from an existing one. If you are not scared by the scan config details it would be better to script the following process:

  1. create/derive a new config
  2. modify the new config and add/change nvt families and/or nvts
  3. modify the new config and set preferences

But additionally I’ll also look at a python-gvm api to import a scan config in the next weeks.

3 Likes

With python-gvm 1.0.0.beta2 it’s possible to import a scan config now

https://python-gvm.readthedocs.io/en/latest/api/protocols.html#gvm.protocols.gmpv7.Gmp.import_config

1 Like

when i create_config,like you say, but the error is command is too log, why?? I hope you can help me!