Snorby / snorby

Ruby On Rails Application For Network Security Monitoring
Other
1k stars 226 forks source link

Export Dashboard to pdf 500 #435

Open Rossmairm opened 8 years ago

Rossmairm commented 8 years ago

Any time I attempt to export the dashboard to a PDF I get this message: snorby pdf issue I am running the latest version of Snorby on Ubuntu 16.04

`uname -a Linux snort16 4.4.0-22-generic #40-Ubuntu SMP Thu May 12 22:03:46 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

mysql --version mysql Ver 14.14 Distrib 5.7.12, for Linux (x86_64) using EditLine wrapper `

Rossmairm commented 8 years ago

From the delayed_job.log

2016-05-17T12:34:19-0400: [Worker(delayed_job host:snort16 pid:1709)] Snorby::Jobs::SensorCacheJob completed after 5.3694 2016-05-17T12:34:19-0400: [Worker(delayed_job host:snort16 pid:1709)] 1 jobs processed at 0.1860 j/s, 0 failed ... 2016-05-17T12:44:24-0400: [Worker(delayed_job host:snort16 pid:1709)] Snorby::Jobs::SensorCacheJob completed after 5.0694 2016-05-17T12:44:24-0400: [Worker(delayed_job host:snort16 pid:1709)] 1 jobs processed at 0.1970 j/s, 0 failed ... 2016-05-17T12:54:30-0400: [Worker(delayed_job host:snort16 pid:1709)] Snorby::Jobs::SensorCacheJob completed after 5.2360 2016-05-17T12:54:30-0400: [Worker(delayed_job host:snort16 pid:1709)] 1 jobs processed at 0.1907 j/s, 0 failed ... 2016-05-17T13:04:35-0400: [Worker(delayed_job host:snort16 pid:1709)] Snorby::Jobs::SensorCacheJob completed after 5.3939 2016-05-17T13:04:35-0400: [Worker(delayed_job host:snort16 pid:1709)] 1 jobs processed at 0.1851 j/s, 0 failed ... 2016-05-17T13:14:41-0400: [Worker(delayed_job host:snort16 pid:1709)] Snorby::Jobs::SensorCacheJob completed after 5.1324 2016-05-17T13:14:41-0400: [Worker(delayed_job host:snort16 pid:1709)] 1 jobs processed at 0.1946 j/s, 0 failed ...

Flashdown commented 8 years ago

I have the same issue, do you have the following in your apache2 or webserver log file, too?: The switch --print-media-type, is not support using unpatched qt, and will be ignored.

This seems to be related to a bad/wrong version of wkhtmltopdf. See http://stackoverflow.com/questions/18758589/wkhtmltopdf-installation-error-on-ubuntu

This is what I currently have, don't know if I will try it the way that is mentioned there, I will come back if I was able to fix it.

Flashdown commented 8 years ago

Hi, I was able to fix it as follows:

find out where your .bundle folder is located for the user that runs snorby and change into its parent directory.

Then i have used my modified version of the regex that is visible on the snorby git hub page to outline this error (only needed if you receive the same).

/var/lib/gems/2.1.0/gems/actionpack-3.2.22/lib/action_dispatch/http/mime_type.rb:102: warning: already initialized constant Mime::PDF /var/lib/gems/2.1.0/gems/actionpack-3.2.22/lib/action_dispatch/http/mime_type.rb:102: warning: previous definition of PDF was here sed -i 's/\(^.*\)\(Mime::Type.register.*application\/pdf.*$\)/\1if Mime::Type.lookup_by_extension(:pdf) != "application\/pdf"\n\1 \2\n\1end/' ./.bundle/ruby/2.1.0/ezprint-*/lib/ezprint/railtie.rb

Then I've visited http://wkhtmltopdf.org/downloads.html and downloaded http://download.gna.org/wkhtmltopdf/0.12/0.12.3/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz for my Debian 8. Since this versions version string is wkhtmltopdf 0.12.3 (with patched qt) <- "with patched qt" is important here.

then I removed what I installed from the debian repo: apt-get remove --purge wkhtmltopdf

Then I have extracted the archive which contains the files and directorie structures, I created a new folder in it called usr and moved every folder into it so that the path will be usr/bin instead of bin and so on. Then I created a folder called DEBIAN in the same folder as the usr folder is, there IÄve created the "control" and "conffiles" in the DEBIAN folder. I leaved the conffiles file empty so I just used touch. for the control file and for the creation of the deb file I followed this guide: http://www.sj-vs.net/creating-a-simple-debian-deb-package-based-on-a-directory-structure/

But I also used apt-cache show wkhtmltopdf to get more and better stuff for the control file. then I have gone one directory up called wkhtmltopdf which now contain the folder usr and DEBIAN. and executed this dpkg-deb --build wkhtmltopdf

Installed it and done. It works without any errors.

Good luck!

alexus1987 commented 7 years ago

Hi Flashdown How are U? I hope you´re fine, I have de same issue but I can´t resolve it, you think you could support me??

Please

Best regards

Flashdown commented 7 years ago

Sure, but actually all you need is written in the answer above your question. Maybe the sed needs to be adjusted to match the paths of your ruby version. So where do you get stuck at/ need help with?