![]() |
Tutorial 8: OSSIM + JAsperServer + iReport Tutorial Tue, 17 Mar 2009 This eigth installment of the tutorial series will focus on a feature which will be revolutionary for OSSIM for sure: tight jasperserver integration for custom/periodic reports with the guarantee of a strong BI suite. The upcoming installer release will include both Tomcat as well as JasperServer ready to use and with sample preloaded reports and datasources. (Note: Installer beta2 users can already test some of this out, although no real tight integration until beta4 will be in place). If you haven't heard about JasperServer nor iReport you can them check out JasperServer and iReport for some background. Quoting those two pages: "JasperServer is a high-performance business intelligence platform and report server designed for developers and businesses. Deploy JasperServer when end-users need to create their own ad hoc queries, reports, charts, crosstabs, dashboards, or it becomes necessary to secure, store, schedule, distribute, share, drill-down, or interact with reports." "iReport is a graphical report tool for report designers, developers, and power-users. iReport provides complete coverage of all the reporting capabilities in JasperReports, JasperServer, and Jasper4Salesforce, including the creation of parameterized reports, pixel-perfect production reports, and remote JasperServer repository management". I'm no jasperreports expert myself, I used it for report creation and I'm sure there are tons of tips and tricks experts can provide. Any comments and feedback that help improving this article will be greatly appreciated :-) During this tutorial the following steps will be covered:
OSSIM - JasperServer integrationOk, a couple of notes first. The installer uses JDK6, Tomcat 6.0.18 and JasperServer 3.1. Everything is installed into /var/tomcat/, passwords get adjusted from /etc/ossim/ossim_setup.conf using ossim-reconfig and default login/password is jasperadmin/jasperadmin. Point your browser at http://ossim_ip:8080/jasperserver/ and you're set. OSSIM will provide a series of default datasources for the most useful databases for reporting, that is, ossim, ocs inventory and snort. The idea behind this provide strong reporting without having to code it from zero up, but also have a way to share generic reports with other users. That's what we're going to do using the .jrxml formats, be able to share reports with others, creating an amazing amount of custom reports for users to use. More on this on the last section, the Alien Forge ;-) Warning: the following applies to users of the installer beta versions released on 2009/03 and beyond, don't try this with 1.0.6 or previous versions; you'll end up quite frustrated. Assumptions
iReport download and setupFirst, get iReport for your platform: Download. Win and mac got an easy installer, for linux I guess it's the .jar file anyway. (Haven't tested it). OSSIM for iReport setupIn order to enable access from your client you've got to grant it permissions from within mysql and enable mysql to listen on the network.
Note: this is the easiest way of doing it, tighter permissions and separate users for each DB are recommended in high security environments
Next, fire up iReport. We'll start by creating a blank report:
Here goes our next screen:
Sample report: top events by risk/ocurrenceOur report will have two sections: - Top 50 events by risk (from acid_event). - Top 10 events by occurrence. First we start off with the query(s). This might be the hardest part of all, but as said, the idea is that all ossim users share their reports, so there might be those with more SQL knowledge, those with report designing skills and those with a greater security knowledge; combining the three of them will yield great reports. Our main report will be the one just reporting the 50 events. After that we'll include a sub-report with the events by occurrence. For the record, the table we're going to use herein is:
acid_event: ---------------------------------------- | Field | Type | Null | Key | Default | Extra | +-------------------+------------------+------+-----+---------+-------+ | sid | int(10) unsigned | NO | PRI | NULL | | | cid | int(10) unsigned | NO | PRI | NULL | | | signature | int(10) unsigned | NO | MUL | NULL | | | sig_name | varchar(255) | YES | MUL | NULL | | | sig_class_id | int(10) unsigned | YES | MUL | NULL | | | sig_priority | int(10) unsigned | YES | MUL | NULL | | | timestamp | datetime | NO | MUL | NULL | | | ip_src | int(10) unsigned | YES | MUL | NULL | | | ip_dst | int(10) unsigned | YES | MUL | NULL | | | ip_proto | int(11) | YES | MUL | NULL | | | layer4_sport | int(10) unsigned | YES | MUL | NULL | | | layer4_dport | int(10) unsigned | YES | MUL | NULL | | | ossim_type | int(11) | YES | MUL | 1 | | | ossim_priority | int(11) | YES | MUL | 1 | | | ossim_reliability | int(11) | YES | MUL | 1 | | | ossim_asset_src | int(11) | YES | MUL | 1 | | | ossim_asset_dst | int(11) | YES | MUL | 1 | | | ossim_risk_c | int(11) | YES | MUL | 1 | | | ossim_risk_a | int(11) | YES | MUL | 1 | | ------------------------------------------ Everything we need for this report can be found in there. Our querys would be as follows:
select timestamp, sig_name, inet_ntoa(ip_src) as source, layer4_sport, inet_ntoa(ip_dst) as dest, layer4_dport, ((ossim_risk_c + ossim_risk_a) / 2) as risk from acid_event where timestamp > DATE_SUB(NOW(), INTERVAL 7 DAY) order by risk desc limit 50; select sig_name, count(*) as cnt from acid_event where timestamp > DATE_SUB(NOW(), INTERVAL 7 DAY) group by sig_name order by cnt desc limit 10;
So, first let's select SNORTDB as datasource on top. Then right-click on report name, "Edit Query" and insert our first one and click OK. Edit query location can be found here:
Our first test would be to add some fields to the detail. Click on "Fields" so that you get a list like this:
Or, on image:
If we move any of those into the "Detail" (or any other) band, we'll get them into our report. Let's move timestamp, sig_name and risk into it, making the sections shorter and see how it will look. Also, a quick title (using a "Static text" field from the palette into title) and removing unused sections will help. Click on Preview next :-)
(Screens below show the final layout and how our first preview should look like:)
There we go ! Some first (ugly :P) results. Next we'll get the top 10 graph into the report to get some colour into it.
Let's start by generating a sub-report.
Start of with selecting "Create a new report". Next we'll select SNORTDB as datasource, since acid_event is inside SNORTDB: select sig_name, count(*) as cnt from acid_event where timestamp > DATE_SUB(NOW(), INTERVAL 7 DAY) group by sig_name order by cnt desc limit 10; .No need for grouping, same connection as master and we're set. Next, we'll clean up everything, just leaving the title band. Select everything, right click, delete: ![]() A nice empty drawing space: . Let's fill it.
See the chart widget on the right area ? Drag it right into our blank area and you'll see a popup with the selection.
Next thing to do is to stretch the chart to fit into your window. Result should be something like this: ![]() Let's fill in the values next. Right click chart, click on "edit chart data" and then on the "Detail tab". Remember we had two fields available to us on this query, sig_name and cnt ? Well, let's fill them into the right place. The key on which we'll iterate is clearly the actual name, while the value will be the count. Since we also want to see how many there are of each count, we'll use the count as label expression too. Note: label has to be a string so we need to convert the field into the right value before using it. You can see the final positions below: Accept and preview this new graph. It should ressemble this one:
There we go, our graph is ready. Numbers are a bit crippled but I don't know how to fix this right now, it's a start nonetheless and I'll update when I figure out (or hopefully someone else figures it out and tells me...).
Now let's get back to the main report (look at the tabs on top). Adjust the graph to content and align it to the left of our doc. Uploading this report to jasperserver
Now we want to get this onto our server, see that we can generate it there whenever we want and schedule reports so they get sent out to the manager(s) every once in a while. (Note: don't send them out this way, add some corporate logos, adjust styles, include more info and all that of course :-))
grant all on *.* to reports@127.0.0.1 identified by 'report_password'; grant all on *.* to reports@localhost identified by 'report_password'; After this, in order to create the missing datasources, we'll right click on our server and Add new Datasource
. Fill in the name and label (OSSIMDS) and get into detail. We can import it from our report first but need to change the ip to 127.0.0.1. Rinse and repeat for SNORTDS.
If you click on your server, you should now have two datasources (I've got no idea how the "Add new server" label got on top of OSSIMDS, but trust me, it's there) defined.
Let's see if it worked. Point your browser at http://your_ip:8080/jasperserver/ and log in using jasperadmin/jasperadmin. As you (hopefully will) see, there is our report. Let's generate it by clicking on the name :-)
Aaah, there it is
Lastly I'd suggest getting back to iReport and upload the .jrxml reports files as backup, so next time you can fetch them from there and you can share it with co-workers: What to do next?Well, next steps would be scheduling reports to run on a daily/weekly/monthly basis as well as getting those reports into the executive panel for real-time visualization. Tips and TricksThe next list is intended to be a quick lifesaver guide for those into jasperserver. I'm sure I'll need it in 6 months :-)
Sharing your work/fun: The Alien ForgeWhy do I call this work/fun? My reasoning behind this whole article/post is as following: I'll do a sample report and share it with all the fellow ossim users. This report might look like shit and be of a limited use, but I hope to get something moving. This report just shows a weekly top 50 events by risk and a top 10 events by raw event count. The design is horrible and the usefulness is limited, but what if...
This last step is my goal and I really think it can be done. OSSIM parts that benefit from custom content:
The needs for this custom content will be covered in two ways:
The AlienVault Feed will include updates for all those items on a regular basis. Updates will happen once a week with exceptional "critical" updates on certain important threats. Most of the items from the AlienVault Feed will be consolidated into the ossim releases, effectively creating a delay for regular users. The Alien Forge on the other hand is an exchange place for all those items between users. Got something to share? put it in there. The more content is shared the more people will be willing to share back. Think of a snowball rolling down a snowfield :-) The code is just being finished. Uploads will be categorized into Manufacturer, Product, Version and Type. Everybody will get full credit for their uploads and points, points we plan on being able to spend in:
I hope you liked this tutorial, the best way you can show that is by contributing reports back, any of them, even if it's a "last 10 entries into the mysql users table"; everything will be used at some time by another users :-) Thanks for reading this far btw, it's been one of the longest and most intensive tutorials so far.
posted at: 11:25 | path: /ossim/tutorials | permanent link to this entry | 3 comments |
* Posted by Vradick at Tue Mar 17 12:11:29 2009
Only one little tip:
- If you use the URL of a report and you add "&decorate=no" the header is not shown. Good tip to view only the report inside another application ;).
* Posted by paul at Thu Mar 19 21:28:17 2009
I have tried on Debian 5 the free version of java (OpenJDK Java 6) and works fine :-D
* Posted by Amit at Wed Aug 12 08:42:30 2009
Hi,
Anybody can help in i report v3.5.1, i want to change the cloumn names dynamically. like eg: if user can select on screen it should display 31 columns otherwise it should display 12 columns. please help me on this. Thank you, Amit.
|
Categories
/ (62) Dominique Karg (feel free to get in touch) Friend's blogs:
Archives
2009-Dec Tags | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||








































