immauss / openvas

Containers for running the Greenbone Vulnerability Manager. Run as a single container with all services or separate single applications containers via docker-compose.
GNU Affero General Public License v3.0
367 stars 102 forks source link

[FEATURE] Allow to configure the lines in the XML report #244

Closed LoZio closed 9 months ago

LoZio commented 10 months ago

Please attach large files to the report instead of pasting the contents into the report.

Describe the improvement Exporting XML files is limited to 1000 lines. From my understanding (https://github.com/greenbone/gvmd/blob/7862bd54a0c7524524e6460dad70f155dd30510d/src/manage_sql.h#L113) it is something that can be configured during the build or setting a configuration parameter like: gvmd --modify-setting 76374a7a-0569-11e6-b6da-28d24461215b --value 10000 I know I can use the cli inside the container but it is very clunky. If I'm not mistaken during the first startup of a container a line dealing with report limits pops up...

The general problem is having less lines than you need, say you have 2000 results and can export only 1000. The opposite is not a problem since if you need fewer results you can easily apply filters from the interface. So the proposal is to increase the build limit to 10000 (10x). It would be usefult to have a script in the /scripts directory just like set-report-lines.sh <number> That just switches to the gvm user and runs /usr/local/sbin/gvmd --modify-setting 76374a7a-0569-11e6-b6da-28d24461215b --value <number>

Maybe an env variable can do the trick during container creation.

immauss commented 10 months ago

Ugh ... sorry

Undocumented feature.

It's been there for a while.

REPORT_LINES=${REPORT_LINES:-1000}

Just add -e REPORT_LINES to your docker run. Or set it in the environment of the dockercompose.yml.

immauss commented 10 months ago

I'm going to mark this as documentation and leave it open until I get a chance to update the docs.

Thanks for bringing it up.

-Scott

LoZio commented 10 months ago

Since it's just a two-liner maybe also creating the script in the /scripts dir can be useful if you want to change the value after the container creation

if [ "$1" == "" ] ; then
 echo Need to specify the number of lines in the report
 exit 1
fi
su gvm -c /usr/local/sbin/gvmd --modify-setting 76374a7a-0569-11e6-b6da-28d24461215b --value $1

maybe adding some checks on the parameter can be added but given who the users of this stuff are maybe its enough. Or an example in the docs may be a valid alternative

immauss commented 10 months ago

Easy enough. I can do that too.

Hmmm ....

Would also need some logic in the startup scripts to only make a change if the value is set to something other than the default of 1000. Otherwise, changes made by the script would get replaced on the next restart.

( So I don't for get that ^^^ )

Thanks, -Scott

LoZio commented 10 months ago

You can save the env variable value in a file that by default contains 1000. At each start the above script will re-set it every time So you are actually resetting it at each start with the last value in the file

immauss commented 10 months ago

That only works for folks using docker-compose though. I've actually already added the checks in my base code... :)

-Scott

immauss commented 9 months ago

This is resolved in the latest and 22.4.40. And the option has been added to the docs.

-Scott