Attachment size

Hi,

I would like to ask if you manage somehow to skip an issue like below:

Note: This report exceeds the maximum length of 1048576 characters and thus
was truncated.

but for containers edition. In the past I was able to managed this using i.e. that solution: I need help I cant see the reports be sent out because of maximum length - #13 by llopez

However it’s not so simple for docker as we cannot modify systemctl as it’s not a service. I was trying to play with MTA setup and setting a size, but it’s not an option here:

  - MTA_SIZE=10048576

I’m just wondering if there is a way to make it. Any help would be appreciated.

I think you can implement the previous solution you referenced by downloading gvmd and adjusting the start_gvmd.sh file, and using that rather than the image hosted on DockerHub:

[ -z "$GVMD_ARGS" ] && GVMD_ARGS="--listen-mode=666"

add the other argunents:

[ -z "$GVMD_ARGS" ] && GVMD_ARGS="--listen-mode=666 --max-email-attachment-size=-1 --max-email-include-size=-1"

Something like this should work.

To build the container from the local gvmd repository you need to replace the image with a build instruction to point tot the local prod.DockerFile:

  gvmd:
    build:
      context: .docker
      dockerfile: prod.Dockerfile
    restart: on-failure
1 Like

Hi,

Please can anyone verify if the above suggestion by rippledj works or is there any other solution for docker container attachment size issue!?

Thank you

In order the change the attachment size, command line arguments must be added to the gvmd process, there is a no mechanism within the current docker file to add these. gvmd is started in the container with the following script, /usr/local/bin/start-gvmd. What I do is run a cron job on a regular interval to make sure the new command line arguments are running with gvmd and if not, as in the case of a new pull, I re-apply those settings. Here is my hacky script that I run by cron job. I hope it helps.

#!/bin/bash


# Do not run if openvas processes are running, try again at the next cron interval
if pgrep -f "testing" > /dev/null; then
        exit;
fi


# if a this process isn't running perform the following actions
if ! pgrep -f "max-email" > /dev/null; then

        mv -f ~/start-gvmd ~/start-gvmd,saveold

        # Get original start-gvmd from the container
        docker cp greenbone-community-edition-gvmd-1:/usr/local/bin/start-gvmd  ~/start-gvmd

        # add the command line args needed
        cat ~/start-gvmd | sed 's/"--listen-mode=666"/\"--listen-mode=666 --max-email-attachment-size='-1' --max-email-include-size='-1' --max-email-message-size='-1'"/g' > ~/start-gvmd,updated

        # copy the start-gvmd back to the container
        docker cp ~/start-gvmd,updated greenbone-community-edition-gvmd-1:/usr/local/bin/start-gvmd

        # make the start-gvmd executable
        docker compose -f ~/greenbone-community-container/docker-compose.yml -p greenbone-community-edition exec gvmd /bin/bash -c "chmod 755 /usr/local/bin/start-gvmd"

        # restart the gvmd container
        docker compose -f ~/greenbone-community-container/docker-compose.yml -p greenbone-community-edition  restart gvmd 

fi

Thanks ChanScan,

Please clarify the processes you are checking “testing” and “max-email”?

apologies if its a dumb question.

I have a cronjob that updates the feeds every few days to keep it current and will revert any changes am thinking this is the testing process you are checking?

Also the max-email is this process run by this script?

Appreciate the help!!

1 Like