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
360 stars 102 forks source link

Problems with bind mounts #84

Closed immauss closed 2 years ago

immauss commented 3 years ago

Images from 21.4.4-02 do not support bind mounts. I'm working on it.

cybermcm commented 3 years ago

Image 21.4.4-03 is working, just to make sure that you are searching in the right direction...

immauss commented 3 years ago

New release 21.4.4-05 moves the file system setup back to the start.sh. This ensure the /data folder is properly populated in an empty bind directory.

This is building now and will publish soon.

gooseleggs commented 2 years ago

Hello

Looks like -05 is still suffering bind mount issue. I looked at the github code but that appears to be lagging behind what is in the -05 image, so looked at the code in the image...

This is what is in the start.sh script

if ! [ -d /data ]; then
    /fs-setup.sh 
fi

We are bind mounting to /data, so this test will always pass. You need to pick a directory inside the /data directory to test for? Maybe this could work:

if ! [ -d /data/var-log ]; then
    /fs-setup.sh
fi
immauss commented 2 years ago

@gooseleggs yes ... So now ... the fs-setup ... just runs every time. There is now a 21.4.4-06 Please check it out. It's only barely tested, but .... please let me know..

Thanks, Scott

immauss commented 2 years ago

I also updated the git repo.

immauss commented 2 years ago

OK ... tested with old data on volumes and bind mounts. All looks good.

gooseleggs commented 2 years ago

Running the 06 container looks good. I do get a

openvas2    | cp: cannot stat '/var/lib/openvas/*': No such file or directory

as my first line. Anyway, the container starts up and looks good.

On restart, I get these messages, but all looks good as well (ie still has old results)

openvas2    | /data/database/base alredy exists ...
openvas2    |  NOT moving data from image to /data
openvas2    | cp: '/usr/local/var/lib/apt' and '/data/var-lib/apt' are the same file
openvas2    | cp: '/usr/local/var/lib/binfmts' and '/data/var-lib/binfmts' are the same file
openvas2    | cp: '/usr/local/var/lib/dpkg' and '/data/var-lib/dpkg' are the same file
openvas2    | cp: '/usr/local/var/lib/ghostscript' and '/data/var-lib/ghostscript' are the same file
openvas2    | cp: '/usr/local/var/lib/gvm' and '/data/var-lib/gvm' are the same file
openvas2    | cp: '/usr/local/var/lib/misc' and '/data/var-lib/misc' are the same file
openvas2    | cp: '/usr/local/var/lib/openvas' and '/data/var-lib/openvas' are the same file
openvas2    | cp: '/usr/local/var/lib/pam' and '/data/var-lib/pam' are the same file
openvas2    | cp: '/usr/local/var/lib/postfix' and '/data/var-lib/postfix' are the same file
openvas2    | cp: '/usr/local/var/lib/postgresql' and '/data/var-lib/postgresql' are the same file
openvas2    | cp: '/usr/local/var/lib/python' and '/data/var-lib/python' are the same file
openvas2    | cp: '/usr/local/var/lib/redis' and '/data/var-lib/redis' are the same file
openvas2    | cp: '/usr/local/var/lib/rpm' and '/data/var-lib/rpm' are the same file
openvas2    | cp: '/usr/local/var/lib/samba' and '/data/var-lib/samba' are the same file
openvas2    | cp: '/usr/local/var/lib/snmp' and '/data/var-lib/snmp' are the same file
openvas2    | cp: '/usr/local/var/lib/systemd' and '/data/var-lib/systemd' are the same file
openvas2    | cp: '/usr/local/var/lib/tex-common' and '/data/var-lib/tex-common' are the same file
openvas2    | cp: '/usr/local/var/lib/texmf' and '/data/var-lib/texmf' are the same file
openvas2    | cp: '/usr/local/var/lib/ucf' and '/data/var-lib/ucf' are the same file
immauss commented 2 years ago

Yep. That's to be expected. It's the brute force way. Now that I know it's all working, I'll have the fs-setup.sh mark the container file-system and then check for the mark on start. Then it will only run the first time around.

Thanks for your help. I have the new version fully out in a day or so.