stevespringett / nist-data-mirror

A simple Java command-line utility to mirror the CVE JSON data from NIST.
Apache License 2.0
206 stars 93 forks source link

Docker Image 1.4.0 is throwing "Permission denied" issues #57

Closed Muzamri closed 4 years ago

Muzamri commented 4 years ago

Hi,

I'm having an issue when using version 1.4.0 of the docker image.

After populating /tmp/nvd, the application is unable to copy the files over to /usr/local/apache2/htdocs.

Running the container

mkdir -p /tmp/target/docs/

docker run -dit \
    --name mirror \
    -p 80:80 \
    --mount type=bind,source=/tmp/target/docs/,target=/usr/local/apache2/htdocs \
    sspringett/nvdmirror:1.4.0

Logs

2020-01-07 10:15:55,354 INFO Set uid to user 0 succeeded
2020-01-07 10:15:55,355 INFO supervisord started with pid 1
2020-01-07 10:15:56,357 INFO spawned: 'httpd' with pid 8
2020-01-07 10:15:56,358 INFO spawned: 'crond' with pid 9
2020-01-07 10:15:56,359 INFO spawned: 'initialize_htdocs' with pid 10
Updating...
crond 4.5 dillon's cron daemon, started with loglevel notice
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
[Tue Jan 07 10:15:56.384458 2020] [mpm_event:notice] [pid 8:tid 140323194153832] AH00489: Apache/2.4.39 (Unix) configured -- resuming normal operations
[Tue Jan 07 10:15:56.384489 2020] [core:notice] [pid 8:tid 140323194153832] AH00094: Command line: 'httpd -D FOREGROUND'
2020-01-07 10:15:57,385 INFO success: httpd entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2020-01-07 10:15:57,385 INFO success: crond entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2020-01-07 10:15:57,385 INFO success: initialize_htdocs entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
/tmp/nvd/nvdcve-1.0-modified.meta
cp: can't create '/usr/local/apache2/htdocs/nvdcve-1.0-modified.meta': Permission denied

... snipped ...

/tmp/nvd/nvdcve-1.1-2020.json
cp: can't create '/usr/local/apache2/htdocs/nvdcve-1.1-2020.json': Permission denied
2020-01-07 10:22:44,156 INFO exited: initialize_htdocs (exit status 1; not expected)

Running processes

# ps -ef
PID   USER     TIME  COMMAND
    1 root      0:00 {supervisord} /usr/bin/python2 /usr/bin/supervisord -n -c /etc/supervisor/conf.d/supervisord.conf -l
    8 root      0:00 httpd -DFOREGROUND
    9 root      0:00 crond -s /var/spool/cron/crontabs -f
   25 daemon    0:00 httpd -DFOREGROUND
   26 daemon    0:00 httpd -DFOREGROUND
   27 daemon    0:00 httpd -DFOREGROUND
  122 root      0:00 /bin/bash
  323 root      0:00 ps -ef

Files in /tmp/

# ls -lah /tmp/
total 20
drwxrwxrwt    6 root     root        4.0K Jan  7 10:15 .
drwxr-xr-x   51 root     root        4.0K Jan  7 10:19 ..
drwxr-xr-x    2 root     root        4.0K Jan  7 10:30 cron.fObHDd
drwxr-xr-x    2 mirror   mirror      4.0K Jan  7 10:22 hsperfdata_mirror
drwxr-xr-x    2 mirror   mirror      4.0K Jan  7 10:22 nvd

Files in /usr/local/apache2/

total 48
drwxr-xr-x   15 www-data www-data    4.0K Jan  7 10:15 .
drwxr-xr-x   15 root     root        4.0K Jan  7 10:15 ..
drwxr-xr-x    2 root     root        4.0K May 11  2019 bin
drwxr-xr-x    2 root     root        4.0K May 11  2019 build
drwxr-xr-x    2 root     root        4.0K May 11  2019 cgi-bin
drwxr-xr-x    4 root     root        4.0K Oct 18 19:50 conf
drwxr-xr-x    3 root     root        4.0K May 11  2019 error
drwxrwxr-x    2 1000     1000        4.0K Jan  7 10:15 htdocs
drwxr-xr-x    3 root     root        4.0K May 11  2019 icons
drwxr-xr-x    2 root     root        4.0K May 11  2019 include
drwxr-xr-x    2 root     root        4.0K Jan  7 10:15 logs
drwxr-xr-x    2 root     root        4.0K May 11  2019 modules

Thank you for your time.

Muzamri commented 4 years ago

Hi,

If I start the container without specifying the volume to mount, it will work correctly.

I was following the instructions specified in the readme -- I don't need to mount it for my usage, closing this issue.

Kind regards.