Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report: failed to read from json (Docker) #294

Closed
xpfgsyb opened this issue Jan 15, 2017 · 11 comments
Closed

Report: failed to read from json (Docker) #294

xpfgsyb opened this issue Jan 15, 2017 · 11 comments
Labels

Comments

@xpfgsyb
Copy link

xpfgsyb commented Jan 15, 2017

Hi,
if I run the current Docker container with the report parameter I always get this message: time="Jan 15 01:38:55" level=error msg="Failed to read from JSON: Stdin is invalid: ". No other output is created and no mail is sent.

Environment
vuls v0.2.0 8e77937 (Docker-Image, Tag latest, Image ID af4a684f4a87)
Docker version 1.12.6, build 78d1802
Server: Debian 8.6
Command: docker run --rm -v /home/service/vuls-data/ssh:/root/.ssh:ro -v /home/service/vuls-data/data/:/vuls -v /home/service/vuls-data/log/vuls/:/var/log/vuls -v /etc/localtime:/etc/localtime:ro vuls/vuls report -cvedb-path=/vuls/cve.sqlite3 -format-short-text -config=/vuls/config.toml -to-email -debug

The results directory is located directly within the mapped data directory. Have I missed something at the update to 0.2 or is this a bug?

@kotakanbe
Copy link
Member

@xpfgsyb Thanks. I will check the issue.

@Klar
Copy link

Klar commented Jan 20, 2017

I've seen the same issue but on a normal ubuntu server. I run the report command via a bash script. It works when I run the script. But I get the same error message as above when I run it via crontab.

crontab -e
56 14 * * 1-5 /home/username/vuls/run_vuls._report.sh

cat /home/username/vuls/run_vuls_report.sh

#!/bin/sh

/bin/vuls report -config=/home/username/vuls/config.toml -cvedb-path=/home/username/vuls/go-cve-dictionary/cve.sqlite3 -results-dir=/home/username/vuls/results/ -format-one-line-text -format-full-text -debug > /tmp/hello.txt
  • /tmp/hello.txt is empty after cronjob
  • not empty after running with ./home/username/vuls/run_vuls._report.sh

@rinForIssue
Copy link

I'm also suffering from the same issue since last wednesday.
Error occurs only when cron is executed. There is no problem with command execution.

time="Jan19 17:01:01" level=error msg="Failed to read from JSON: Stdin is invalid:`

@kotakanbe
Copy link
Member

@xpfgsyb @rinForIssue

The -it flag is required

docker run --rm -it ...

kotakanbe added a commit that referenced this issue Jan 23, 2017
Solved the problem of trying to read from STDIN and stopping on the way when running from CRON or AWS Lambda.
kotakanbe added a commit that referenced this issue Jan 23, 2017
Solved the problem of trying to read from STDIN and stopping on the way when running from CRON or AWS Lambda.
@kotakanbe
Copy link
Member

@Klar
It was reproduced.
I am trying to solve this problem. see #299

kotakanbe added a commit that referenced this issue Jan 23, 2017
Solved the problem of trying to read from STDIN and stopping on the way when running from CRON or AWS Lambda.
kotakanbe added a commit that referenced this issue Jan 23, 2017
@kotakanbe
Copy link
Member

@Klar
Merged to master branch. Please try it out.

@rinForIssue
Copy link

@kotakanbe
Thanks! Works Well with Update line on CentOS/RHEL6

@xpfgsyb
Copy link
Author

xpfgsyb commented Jan 24, 2017

Thank you @kotakanbe, the -it flag did the trick :)

@Klar
Copy link

Klar commented Jan 25, 2017

@kotakanbe I tried it with the -pipe command but couldn't get it to work, did you test it, if so how does your script / crontab look?

thanks a lot

@kotakanbe
Copy link
Member

@Klar
The -pipe option is not required for crontab.

@Klar
Copy link

Klar commented Jan 26, 2017

@kotakanbe
it's working now, thanks a lot! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants