<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Security Advancements at the Monastery &#187; MySQL</title>
	<atom:link href="http://blog.securitymonks.com/category/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.securitymonks.com</link>
	<description>Information about developments at the Monastery</description>
	<lastBuildDate>Fri, 03 Sep 2010 05:41:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Google Visualization: An Example Graphing NVD CVE Data</title>
		<link>http://blog.securitymonks.com/2010/04/16/google-visualization-an-example-graphing-nvd-cve-data/</link>
		<comments>http://blog.securitymonks.com/2010/04/16/google-visualization-an-example-graphing-nvd-cve-data/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 15:54:42 +0000</pubDate>
		<dc:creator>John Gerber</dc:creator>
				<category><![CDATA[CERT]]></category>
		<category><![CDATA[CVE]]></category>
		<category><![CDATA[CVSS]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Metrics]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[NIST]]></category>
		<category><![CDATA[NVD]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[SCAP]]></category>
		<category><![CDATA[Visualization]]></category>
		<category><![CDATA[Vulnerability]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://blog.securitymonks.com/?p=1825</guid>
		<description><![CDATA[Google visualization offers graphing abilities to any number of projects.  Why should security professionals care?  If you are going to have to collect and present security metrics, it is best to showcase them in the very best manner possible.  Andrew Jaquith in his article, &#8220;Creating meaningful information security metrics&#8221; states, &#8220;For 2010, [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.securitymonks.com/wp-content/uploads/2010/04/googlevisualization.gif" align="left" width=100/>Google visualization offers graphing abilities to any number of projects.  Why should security professionals care?  If you are going to have to collect and present security metrics, it is best to showcase them in the very best manner possible.  Andrew Jaquith in his article, &#8220;<a href="http://searchsecurity.techtarget.com/magazineFeature/0,296894,sid14_gci1394672_mem1,00.html">Creating meaningful information security metrics</a>&#8221; states, &#8220;For 2010, Forrester Research expects that overall security budgets will rise less than 5 percent over 2009 &#8211;higher than in the previous year, but not by much.&#8221;  Andrew goes on to point out, &#8220;smart security managers, sensing sudden vulnerability in their budgets, seek better ways to measure and prove the value of what they do every day.&#8221;</p>
<p>
In today&#8217;s work environment there is a need to show changes, potential risks, improved performance, etc. in all areas of the company&#8217;s operations.  Security professionals need to be prepared to answer the basic question, &#8220;why should the CIO or CEO care about security?&#8221;  CSO Online has a great quote from the post, &#8220;<a href="http://www.csoonline.com/article/550413/From_the_CIO_Why_You_Didn_t_Get_the_CISO_Job">From the CIO: Why You Didn&#8217;t Get the CISO Job</a>&#8221; that challenges us to consider our views when it comes to security.  The post states, “laser focus on your speciality is great in middle management. It’s what we want. One of the really hard things about jumping from management to executive is a focus on the whole of the business. It’s a rare person who manages it quickly or easily.”  That is basically the problem with metrics.  It is a battle between generalization to the point of uselessness and details to the point of not being understandable or collectible.  At the end of the day, something needs to be done because the security industry is currently leaving upper management in the position of not understanding what is going on within their business.  That is a risk that not acceptable.
</p>
<p>
Andrew&#8217;s article discusses what kind of security metrics should be used.  Additional sources of information on security metrics can be found in a previous post entitled &#8220;<a href="http://blog.securitymonks.com/2007/04/29/security-metrics/">Security Metrics</a>.&#8221;  The post provides links to wonderful sources on security metric information.  You might also want to take a look at the <a href="http://cisecurity.org/en-us/?route=downloads.show.single.metrics.100">CIS Consensus Security Metrics v1.0.0</a> guide, NIST Special Publication (SP) <a href="http://csrc.nist.gov/publications/nistpubs/800-55-Rev1/SP800-55-rev1.pdf">800-55 Rev 1</a> &#8220;Security Metrics Guide for Information Technology Systems&#8221;, <a href="http://csrc.nist.gov/publications/nistir/ir7564/nistir-7564_metrics-research.pdf">NIST IR-7564</a> &#8220;Directions in Security Metrics Research&#8221;,  &#8220;<a href="http://www.gilligangroupinc.com/headlines/2009/feb-23-related/20090223-cag-draft1.0.pdf">Twenty Most Important Controls and Metrics for Effective Cyber Defense and Continuous FISMA Compliance</a>,&#8221; and &#8220;<a href="http://www.slideshare.net/ramsesgallego/metrics-measures-myths">Metrics, measures &#038; Myths</a>.&#8221;  Once you have start gathering metrics, you will want to present them in an easy to understand format.  This is where Google Visualization can help.
</p>
<p>
Today&#8217;s post walks through an example using the data from the National Institute of Standards and Technology (NIST) National Vulnerability Database (<a href="http://nvd.nist.gov/">NVD</a><a>) Common Vulnerabilities and Exposures (</a><a href="http://cve.mitre.org/">CVE</a>) database.  The purpose is to provide a working example from which you can learn and apply to the various metrics gathered at your organization.
</p>
<p><h3>Data Source</h3>
</p>
<p>
A previous post, &#8220;<a href="http://blog.securitymonks.com/2009/08/09/standardization-and-interoperability-in-security/">Standardization and Interoperability in Security</a>,&#8221; discussed how the Security Content Automation Protocol (<a href="http://scap.nist.gov/">SCAP</a>) is an attempt to help defenders by providing a collection of XML schemas/standards that allow technical security information to be exchanged between tools.  SCAP components consists of:</p>
<ul>
<li><a href="http://cce.mitre.org/" onclick="javascript:pageTracker._trackPageview('/outbound/article/cce.mitre.org');">Common Configuration Enumeration (CCE)</a>: provide unique identifiers to system configuration issues in order to facilitate fast and accurate correlation of configuration data across multiple information sources and tools.</li>
<li><a href="http://cpe.mitre.org/" onclick="javascript:pageTracker._trackPageview('/outbound/article/cpe.mitre.org');">Common Platform Enumeration (CPE)</a>:  a structured naming scheme for information technology systems, platforms, and packages.</li>
<li><a href="http://cve.mitre.org/" onclick="javascript:pageTracker._trackPageview('/outbound/article/cve.mitre.org');">Common Vulnerability Enumeration (CVE)</a>: a dictionary of publicly known information security vulnerabilities and exposures.</li>
<li><a href="http://www.first.org/cvss/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.first.org');">Common Vulnerability Scoring System (CVSS)</a>: a vulnerability scoring system designed to provide an open and standardized method of rating IT vulnerabilities.  NIST has even provided a <a href="http://nvd.nist.gov/cvss.cfm?calculator&#038;adv&#038;version=2" onclick="javascript:pageTracker._trackPageview('/outbound/article/nvd.nist.gov');">calculator</a> for creating CVSS vulnerability severity scores. </li>
<li><a href="http://scap.nist.gov/specifications/xccdf/" onclick="javascript:pageTracker._trackPageview('/outbound/article/scap.nist.gov');">eXtensible Checklist Configuration Description Format (XCCDF)</a>: a specification language for writing security checklists, benchmarks, and related kinds of documents.  NIST has released the NIST Interagency Report 7275 Revision 3 &#8220;<a href="http://csrc.nist.gov/publications/nistir/ir7275r3/NISTIR-7275r3.pdf" onclick="javascript:pageTracker._trackPageview('/outbound/article/csrc.nist.gov');">Specification for Extensible Configuration Checklist Description Format (XCCDF) Version 1.1.4</a>.&#8221;</li>
<li><a href="http://oval.mitre.org/" onclick="javascript:pageTracker._trackPageview('/outbound/article/oval.mitre.org');">Open Vulnerability Assessment Language (OVAL)</a>: an information security community standard to promote open and publicly available security content, and to standardize the transfer of this information across security tools and services.</li>
</ul>
<p>
We are going to make use of the data from <a href="http://static.nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-recent.xml">NVD/CVE XML feed</a> with the Common Vulnerability Scoring System (<a href="http://www.first.org/cvss/cvss-guide.html">CVSS</a>) mappings (version 2.0).  NIST documentation states:<br />
<blockquote>CVSS provides an open framework for communicating the characteristics and impacts of IT vulnerabilities. Its quantitative model ensures repeatable accurate measurement while enabling users to see the underlying vulnerability characteristics that were used to generate the scores. Thus, CVSS is well suited as a standard measurement system for industries, organizations, and governments that need accurate and consistent vulnerability impact scores. Two common uses of CVSS are prioritization of vulnerability remediation activities and in calculating the severity of vulnerabilities discovered on one&#8217;s systems. </p></blockquote>
<p>
NVD provides CVSS &#8216;<b>base scores</b>&#8216; representing the innate characteristics of each vulnerability.  &#8216;<b>Temporal scores</b>,&#8217; which change over time due to events external to the vulnerability, are not provided though NVD does provide a <a href="http://nvd.nist.gov/cvss.cfm?calculator">CVSS score calculator</a>.  This allows an organization to add temporal data and even factor in &#8216;<b>environmental scores</b>&#8216; customized to reflect the impact of the vulnerability on the organization.  Please refer to the <a href="http://www.first.org/cvss/cvss-guide.html">CVSS standards guide</a> and the <a herf="http://www.owasp.org/index.php/OWASP_Risk_Rating_Methodology">OWASP Risk Rating Methodology</a> concerning factors involved in estimating the severity of risks to your business.
</p>
<p><h4><b>NVD CVE XML Schema</b></h4>
</p>
<p>
For our example, we will be using the data feeds <a href="http://static.nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-2010.xml">nvdcve-2.0-2010.xml</a> and <a href="http://static.nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-2090.xml">nvdcve-2.0-2009.xml</a>.  Examining the <a href="http://nvd.nist.gov/schema/nvd-cve-feed_2.0.xsd">CVE XML 2.0 Schema</a>, we are particularly interested in certain vulnerability and CVSS scoring information.  For example, for CVE-2010-1228, we will parse and pull the following kind of information:
</p>
<p><pre><tt><b><font color="#3366FF">&lt;entry</font></b> <font color="#009900">id</font><font color="#990000">=</font><font color="#CC3333">"CVE-2010-1228"</font><b><font color="#3366FF">&gt;</font></b>
  <b><font color="#3366FF">&lt;vuln:cve-id&gt;</font></b>CVE-2010-1228<b><font color="#3366FF">&lt;/vuln:cve-id&gt;</font></b>
  <b><font color="#3366FF">&lt;vuln:published-datetime&gt;</font></b>2010-04-01T18:30:00.453-04:00
  <b><font color="#3366FF">&lt;/vuln:published-datetime&gt;</font></b>
  <b><font color="#3366FF">&lt;vuln:last-modified-datetime&gt;</font></b>2010-04-05T00:00:00.000-04:00
  <b><font color="#3366FF">&lt;/vuln:last-modified-datetime&gt;</font></b>
  <b><font color="#3366FF">&lt;vuln:cvss&gt;</font></b>
    <b><font color="#3366FF">&lt;cvss:base_metrics&gt;</font></b>
      <b><font color="#3366FF">&lt;cvss:score&gt;</font></b>10.0<b><font color="#3366FF">&lt;/cvss:score&gt;</font></b>
      <b><font color="#3366FF">&lt;cvss:access-vector&gt;</font></b>NETWORK<b><font color="#3366FF">&lt;/cvss:access-vector&gt;</font></b>
      <b><font color="#3366FF">&lt;cvss:access-complexity&gt;</font></b>LOW<b><font color="#3366FF">&lt;/cvss:access-complexity&gt;</font></b>
      <b><font color="#3366FF">&lt;cvss:authentication&gt;</font></b>NONE<b><font color="#3366FF">&lt;/cvss:authentication&gt;</font></b>
      <b><font color="#3366FF">&lt;cvss:confidentiality-impact&gt;</font></b>COMPLETE<b><font color="#3366FF">&lt;/cvss:confidentiality-impact&gt;</font></b>
      <b><font color="#3366FF">&lt;cvss:integrity-impact&gt;</font></b>COMPLETE<b><font color="#3366FF">&lt;/cvss:integrity-impact&gt;</font></b>
      <b><font color="#3366FF">&lt;cvss:availability-impact&gt;</font></b>COMPLETE<b><font color="#3366FF">&lt;/cvss:availability-impact&gt;</font></b>
      <b><font color="#3366FF">&lt;cvss:source&gt;</font></b>http://nvd.nist.gov<b><font color="#3366FF">&lt;/cvss:source&gt;</font></b>
    <b><font color="#3366FF">&lt;/cvss:base_metrics&gt;</font></b>
  <b><font color="#3366FF">&lt;/vuln:cvss&gt;</font></b>
<b><font color="#3366FF">&lt;/entry&gt;</font></b>
</tt></pre>
</p>
<p><h4><b>Using Perl to Retrieve the CVE File</b></h4>
</p>
<p>
Initially we will read the <a href="http://static.nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-2010.xml">nvdcve-2.0-2010.xml</a> and <a href="http://static.nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-2090.xml">nvdcve-2.0-2009.xml</a> files.  If we start retrieving the file regularly, we would want to change this to <a href="http://static.nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-recent.xml">nvdcve-2.0-recent.xml</a>.  Of course, previous years can also be read in to provide a longer perspective on vulnerabilities.  A simple example of a Perl subroutine to read the NVD CVE file and save it locally would be:
</p>
<p><pre><tt><b><font color="#3366FF">sub</font></b> readpage <font color="#CC3333">{</font>
   <b><font color="#3366FF">my</font></b><font color="#990000">(</font><font color="#009900">$url</font><font color="#990000">,</font><font color="#009900">$nvd_file</font><font color="#990000">)</font> <font color="#990000">=</font> <font color="#009900">@_</font><font color="#990000">;</font>
   <b><font color="#3366FF">my</font></b><font color="#990000">(</font><font color="#009900">$proxy</font><font color="#990000">)</font> <font color="#990000">=</font> <font color="#CC3333">"http://your-proxy-server:proxy-port"</font><font color="#990000">;</font>
   <b><font color="#3366FF">my</font></b> <font color="#009900">$ua</font> <font color="#990000">=</font> new LWP<font color="#990000">::</font>UserAgent<font color="#990000">;</font>
   <font color="#009900">$ua</font><font color="#990000">-&gt;</font><b><font color="#000000">proxy</font></b><font color="#990000">(</font>http  <font color="#990000">=&gt;</font> <font color="#009900">$proxy</font><font color="#990000">);</font>
   <font color="#009900">$ua</font><font color="#990000">-&gt;</font><b><font color="#000000">proxy</font></b><font color="#990000">(</font>ftp <font color="#990000">=&gt;</font> <font color="#009900">$proxy</font><font color="#990000">);</font>
   <font color="#009900">$ua</font><font color="#990000">-&gt;</font><b><font color="#000000">proxy</font></b><font color="#990000">(</font>https <font color="#990000">=&gt;</font> <font color="#009900">$proxy</font><font color="#990000">);</font>
   <i><font color="#996633"># Go out and retrieve page</font></i>
   <b><font color="#3366FF">my</font></b> <font color="#009900">$req</font> <font color="#990000">=</font> new HTTP<font color="#990000">::</font><b><font color="#000000">Request</font></b><font color="#990000">(</font><font color="#CC3333">'GET'</font><font color="#990000">,</font> <font color="#009900">$url</font><font color="#990000">);</font>
   <b><font color="#3366FF">my</font></b> <font color="#009900">$res</font> <font color="#990000">=</font> <font color="#009900">$ua</font><font color="#990000">-&gt;</font><b><font color="#000000">request</font></b><font color="#990000">(</font><font color="#009900">$req</font><font color="#990000">);</font>
   <b><font color="#3366FF">my</font></b> <font color="#009900">$pjstatus</font> <font color="#990000">=</font> <font color="#993399">1</font><font color="#990000">;</font>
   <i><font color="#996633"># Check if the requested webpage is there and return results</font></i>
   <b><font color="#3366FF">if</font></b> <font color="#990000">(</font><font color="#009900">$res</font><font color="#990000">-&gt;</font>is_success<font color="#990000">)</font> <font color="#CC3333">{</font> <i><font color="#996633"># Request successful</font></i>
       <b><font color="#3366FF">open</font></b><font color="#990000">(</font>OUTFILE<font color="#990000">,</font><font color="#CC3333">"&gt;$nvd_file"</font><font color="#990000">)</font> <font color="#990000">||</font> <font color="#990000">(</font><font color="#009900">$pjstatus</font> <font color="#990000">=</font> <font color="#993399">0</font><font color="#990000">);</font>
       <b><font color="#3366FF">if</font></b> <font color="#990000">(</font><font color="#009900">$pjstatus</font><font color="#990000">)</font> <font color="#CC3333">{</font>
          <b><font color="#3366FF">print</font></b> OUTFILE <font color="#009900">$res</font><font color="#990000">-&gt;</font>content<font color="#990000">;</font>
       <font color="#CC3333">}</font>
       <b><font color="#3366FF">close</font></b><font color="#990000">(</font>OUTFILE<font color="#990000">);</font>
   <font color="#CC3333">}</font>
   <b><font color="#3366FF">else</font></b> <font color="#CC3333">{</font>
      <font color="#009900">$pjstatus</font> <font color="#990000">=</font> <font color="#993399">0</font><font color="#990000">;</font>
   <font color="#CC3333">}</font>
   <b><font color="#3366FF">return</font></b><font color="#990000">(</font><font color="#009900">$pjstatus</font><font color="#990000">);</font>
<font color="#CC3333">}</font>
</tt></pre>
</p>
<p>
Please <b>substitute</b> &#8220;http://your-proxy-server:proxy-port&#8221; with your site&#8217;s proxy server and port, if applicable.
</p>
<p><h4><b>Creating a MYSQL Table to Hold the Data</b></h4>
</p>
<p>
There is a great deal of information in the NVD CVE file.  You will need to determine what information your organization will be interested in storing and graphing.  For better or worse, folks have come to expect vulnerabilities to have a &#8220;Low,&#8221; &#8220;Medium,&#8221; or &#8220;High&#8221; score.  NIST has stated concerning the NVD Vulnerability <b>Severity Ratings</b>:</p>
<blockquote><p>
NVD provides severity rankings of &#8220;Low,&#8221; &#8220;Medium,&#8221; and &#8220;High&#8221; in addition to the numeric CVSS scores but these qualitative rankings are simply mapped from the numeric CVSS scores:<br />
1. Vulnerabilities are labeled &#8220;Low&#8221; severity if they have a CVSS base score of 0.0-3.9.<br />
2. Vulnerabilities will be labeled &#8220;Medium&#8221; severity if they have a base CVSS score of 4.0-6.9.<br />
3. Vulnerabilities will be labeled &#8220;High&#8221; severity if they have a CVSS base score of 7.0-10.0.
</p></blockquote>
<p>
While preferring quantitative over qualitative values, for this example I would like to create a stacked column chart.  We will add a severity column which is based on the CVSS score.  An example table follows:
</p>
<p><pre><tt><b><font color="#3366FF">CREATE</font></b> <b><font color="#3366FF">DATABASE</font></b> vulnerabilities<font color="#990000">;</font>
<b><font color="#3366FF">USE</font></b> vulnerabilities<font color="#990000">;</font>
<b><font color="#3366FF">DROP</font></b> <b><font color="#3366FF">TABLE</font></b> <b><font color="#3366FF">IF</font></b> <b><font color="#3366FF">EXISTS</font></b> <font color="#CC3333">`nvdcve`</font><font color="#990000">;</font>
<b><font color="#3366FF">CREATE</font></b> <b><font color="#3366FF">TABLE</font></b> <font color="#CC3333">`nvdcve`</font> <font color="#990000">(</font>
  <font color="#CC3333">`cve_id`</font> <font color="#009900">varchar</font><font color="#990000">(</font><font color="#993399">13</font><font color="#990000">)</font> <b><font color="#3366FF">NOT</font></b> <b><font color="#3366FF">NULL</font></b><font color="#990000">,</font>
  <font color="#CC3333">`published`</font> <font color="#009900">datetime</font> <b><font color="#3366FF">default</font></b> <b><font color="#3366FF">NULL</font></b><font color="#990000">,</font>
  <font color="#CC3333">`modified`</font> <font color="#009900">datetime</font> <b><font color="#3366FF">default</font></b> <b><font color="#3366FF">NULL</font></b><font color="#990000">,</font>
  <font color="#CC3333">`score`</font> <font color="#009900">DECIMAL</font><font color="#990000">(</font><font color="#993399">5</font><font color="#990000">,</font><font color="#993399">2</font><font color="#990000">)</font> <b><font color="#3366FF">default</font></b> <font color="#CC3333">'0.0'</font><font color="#990000">,</font>
  <font color="#CC3333">`severity`</font> <font color="#009900">varchar</font><font color="#990000">(</font><font color="#993399">6</font><font color="#990000">)</font> <b><font color="#3366FF">default</font></b> <font color="#CC3333">'LOW'</font><font color="#990000">,</font>
  <font color="#CC3333">`vector`</font> <font color="#009900">varchar</font><font color="#990000">(</font><font color="#993399">25</font><font color="#990000">)</font> <b><font color="#3366FF">default</font></b> <b><font color="#3366FF">NULL</font></b><font color="#990000">,</font>
  <font color="#CC3333">`complexity`</font> <font color="#009900">varchar</font><font color="#990000">(</font><font color="#993399">25</font><font color="#990000">)</font> <b><font color="#3366FF">default</font></b> <b><font color="#3366FF">NULL</font></b><font color="#990000">,</font>
  <font color="#CC3333">`authentication`</font> <font color="#009900">varchar</font><font color="#990000">(</font><font color="#993399">25</font><font color="#990000">)</font> <b><font color="#3366FF">default</font></b> <b><font color="#3366FF">NULL</font></b><font color="#990000">,</font>
  <font color="#CC3333">`confidentiality`</font> <font color="#009900">varchar</font><font color="#990000">(</font><font color="#993399">25</font><font color="#990000">)</font> <b><font color="#3366FF">default</font></b> <font color="#CC3333">'NONE'</font><font color="#990000">,</font>
  <font color="#CC3333">`integrity`</font> <font color="#009900">varchar</font><font color="#990000">(</font><font color="#993399">25</font><font color="#990000">)</font> <b><font color="#3366FF">default</font></b> <font color="#CC3333">'NONE'</font><font color="#990000">,</font>
  <font color="#CC3333">`availability`</font> <font color="#009900">varchar</font><font color="#990000">(</font><font color="#993399">25</font><font color="#990000">)</font> <b><font color="#3366FF">default</font></b> <font color="#CC3333">'NONE'</font><font color="#990000">,</font>
  <font color="#CC3333">`summary`</font> <font color="#009900">varchar</font><font color="#990000">(</font><font color="#993399">512</font><font color="#990000">)</font> <b><font color="#3366FF">default</font></b> <b><font color="#3366FF">NULL</font></b><font color="#990000">,</font>
  <b><font color="#3366FF">PRIMARY</font></b> <b><font color="#3366FF">KEY</font></b>  <font color="#990000">(</font><font color="#CC3333">`cve_id`</font><font color="#990000">),</font>
  <b><font color="#3366FF">INDEX</font></b> <font color="#990000">(</font>score<font color="#990000">),</font>
  <b><font color="#3366FF">INDEX</font></b> <font color="#990000">(</font>vector<font color="#990000">)</font>
<font color="#990000">)</font>
</tt></pre>
</p>
<p><h4><b>Using Perl Populating the Database</b></h4>
</p>
<p>
Populating the database table is simply a matter of reading the file and adding the entries to the table.  An example Perl subroutine follows:
</p>
<p>
<!-- Generator: GNU source-highlight 3.1.3<br />
by Lorenzo Bettini</p>
<p>http://www.lorenzobettini.it</p>
<p>http://www.gnu.org/software/src-highlite --></p>
<pre><tt><b><font color="#3366FF">sub</font></b> readxml <font color="#CC3333">{</font>
   <b><font color="#3366FF">my</font></b><font color="#990000">(</font><font color="#009900">$nvd_file</font><font color="#990000">,</font> <font color="#009900">$dbh</font><font color="#990000">)</font> <font color="#990000">=</font> <font color="#009900">@_</font><font color="#990000">;</font>
   <b><font color="#3366FF">my</font></b> <font color="#009900">$parser</font> <font color="#990000">=</font> XML<font color="#990000">::</font>LibXML<font color="#990000">-&gt;</font> <b><font color="#000000">new</font></b><font color="#990000">();</font>
   <b><font color="#3366FF">my</font></b> <font color="#009900">$doc</font>    <font color="#990000">=</font> <font color="#009900">$parser</font><font color="#990000">-&gt;</font> <b><font color="#000000">parse_file</font></b><font color="#990000">(</font><font color="#009900">$nvd_file</font><font color="#990000">);</font>
   <b><font color="#3366FF">my</font></b> <font color="#009900">$xc</font>     <font color="#990000">=</font> XML<font color="#990000">::</font>LibXML<font color="#990000">::</font>XPathContext<font color="#990000">-&gt;</font> <b><font color="#000000">new</font></b><font color="#990000">(</font> <font color="#009900">$doc</font><font color="#990000">-&gt;</font><b><font color="#000000">documentElement</font></b><font color="#990000">()</font> <font color="#990000">);</font>
   <font color="#009900">$xc</font><font color="#990000">-&gt;</font> <b><font color="#000000">registerNs</font></b><font color="#990000">(</font>
      def  <font color="#990000">=&gt;</font> <font color="#CC3333">'http://scap.nist.gov/schema/feed/vulnerability/2.0'</font> <font color="#990000">);</font>
   <font color="#009900">$xc</font><font color="#990000">-&gt;</font> <b><font color="#000000">registerNs</font></b><font color="#990000">(</font>
     vuln <font color="#990000">=&gt;</font> <font color="#CC3333">'http://scap.nist.gov/schema/vulnerability/0.4'</font> <font color="#990000">);</font>
   <font color="#009900">$xc</font><font color="#990000">-&gt;</font> <b><font color="#000000">registerNs</font></b><font color="#990000">(</font> cvss <font color="#990000">=&gt;</font> <font color="#CC3333">'http://scap.nist.gov/schema/cvss-v2/0.2'</font> <font color="#990000">);</font>
   <b><font color="#3366FF">for</font></b> <b><font color="#3366FF">my</font></b> <font color="#009900">$entry</font> <font color="#990000">(</font><font color="#009900">$xc</font><font color="#990000">-&gt;</font> <b><font color="#000000">findnodes</font></b><font color="#990000">(</font><font color="#CC3333">"/def:nvd/def:entry"</font><font color="#990000">))</font> <font color="#CC3333">{</font>
      <b><font color="#3366FF">my</font></b> <font color="#009900">$cve</font> <font color="#990000">=</font> <font color="#009900">$xc</font><font color="#990000">-&gt;</font> <b><font color="#000000">find</font></b><font color="#990000">(</font><font color="#CC3333">'vuln:cve-id'</font><font color="#990000">,</font><font color="#009900">$entry</font><font color="#990000">);</font>
      <b><font color="#3366FF">my</font></b> <font color="#009900">$published</font> <font color="#990000">=</font> <font color="#009900">$xc</font><font color="#990000">-&gt;</font> <b><font color="#000000">find</font></b><font color="#990000">(</font><font color="#CC3333">'vuln:published-datetime'</font><font color="#990000">,</font> <font color="#009900">$entry</font><font color="#990000">);</font>
      <b><font color="#3366FF">my</font></b> <font color="#009900">$modified</font> <font color="#990000">=</font> <font color="#009900">$xc</font><font color="#990000">-&gt;</font> <b><font color="#000000">find</font></b><font color="#990000">(</font><font color="#CC3333">'vuln:last-modified-datetime'</font><font color="#990000">,</font> <font color="#009900">$entry</font><font color="#990000">);</font>
      <b><font color="#3366FF">my</font></b> <font color="#009900">$summary</font> <font color="#990000">=</font> <font color="#009900">$xc</font><font color="#990000">-&gt;</font> <b><font color="#000000">find</font></b><font color="#990000">(</font><font color="#CC3333">'vuln:summary'</font><font color="#990000">,</font> <font color="#009900">$entry</font><font color="#990000">);</font>
      <b><font color="#3366FF">my</font></b> <font color="#009900">$skip</font> <font color="#990000">=</font> <font color="#993399">0</font><font color="#990000">;</font>
      <b><font color="#3366FF">my</font></b> <font color="#990000">(</font><font color="#009900">$metrics</font><font color="#990000">)</font> <font color="#990000">=</font> <font color="#009900">$xc</font><font color="#990000">-&gt;</font> <b><font color="#000000">findnodes</font></b><font color="#990000">(</font><font color="#CC3333">'vuln:cvss/cvss:base_metrics'</font><font color="#990000">,</font> <font color="#009900">$entry</font><font color="#990000">)</font> <b><font color="#000000">or</font></b> <font color="#990000">(</font><font color="#009900">$skip</font> <font color="#990000">=</font> <font color="#993399">1</font><font color="#990000">);</font>
      <b><font color="#3366FF">if</font></b> <font color="#990000">(!</font> <font color="#009900">$skip</font><font color="#990000">)</font> <font color="#CC3333">{</font>
         <b><font color="#3366FF">my</font></b> <font color="#009900">$score</font> <font color="#990000">=</font> <font color="#009900">$xc</font><font color="#990000">-&gt;</font> <b><font color="#000000">find</font></b><font color="#990000">(</font><font color="#CC3333">'cvss:score'</font><font color="#990000">,</font> <font color="#009900">$metrics</font><font color="#990000">);</font>
         <b><font color="#3366FF">my</font></b> <font color="#009900">$vector</font> <font color="#990000">=</font> <font color="#009900">$xc</font><font color="#990000">-&gt;</font> <b><font color="#000000">find</font></b><font color="#990000">(</font><font color="#CC3333">'cvss:access-vector'</font><font color="#990000">,</font> <font color="#009900">$metrics</font><font color="#990000">);</font>
         <b><font color="#3366FF">my</font></b> <font color="#009900">$complexity</font> <font color="#990000">=</font> <font color="#009900">$xc</font><font color="#990000">-&gt;</font> <b><font color="#000000">find</font></b><font color="#990000">(</font><font color="#CC3333">'cvss:access-complexity'</font><font color="#990000">,</font> <font color="#009900">$metrics</font><font color="#990000">);</font>
         <b><font color="#3366FF">my</font></b> <font color="#009900">$authentication</font> <font color="#990000">=</font> <font color="#009900">$xc</font><font color="#990000">-&gt;</font> <b><font color="#000000">find</font></b><font color="#990000">(</font><font color="#CC3333">'cvss:authentication'</font><font color="#990000">,</font> <font color="#009900">$metrics</font><font color="#990000">);</font>
         <b><font color="#3366FF">my</font></b> <font color="#009900">$confidentiality</font> <font color="#990000">=</font>
            <font color="#009900">$xc</font><font color="#990000">-&gt;</font> <b><font color="#000000">find</font></b><font color="#990000">(</font><font color="#CC3333">'cvss:confidentiality-impact'</font><font color="#990000">,</font> <font color="#009900">$metrics</font><font color="#990000">);</font>
         <b><font color="#3366FF">my</font></b> <font color="#009900">$integrity</font> <font color="#990000">=</font> <font color="#009900">$xc</font><font color="#990000">-&gt;</font> <b><font color="#000000">find</font></b><font color="#990000">(</font><font color="#CC3333">'cvss:integrity-impact'</font><font color="#990000">,</font> <font color="#009900">$metrics</font><font color="#990000">);</font>
         <b><font color="#3366FF">my</font></b> <font color="#009900">$availability</font> <font color="#990000">=</font> <font color="#009900">$xc</font><font color="#990000">-&gt;</font> <b><font color="#000000">find</font></b><font color="#990000">(</font><font color="#CC3333">'cvss:availability-impact'</font><font color="#990000">,</font> <font color="#009900">$metrics</font><font color="#990000">);</font>
         <b><font color="#3366FF">my</font></b> <font color="#009900">$severity</font> <font color="#990000">=</font> <font color="#CC3333">"LOW"</font><font color="#990000">;</font>
         <b><font color="#3366FF">if</font></b> <font color="#990000">(</font><b><font color="#3366FF">int</font></b><font color="#990000">(</font><font color="#009900">$score</font><font color="#990000">)</font> <font color="#990000">&gt;=</font> <font color="#993399">7</font><font color="#990000">)</font> <font color="#CC3333">{</font>
            <font color="#009900">$severity</font> <font color="#990000">=</font> <font color="#CC3333">"HIGH"</font><font color="#990000">;</font>
         <font color="#CC3333">}</font>
         <b><font color="#3366FF">elsif</font></b> <font color="#990000">(</font><b><font color="#3366FF">int</font></b><font color="#990000">(</font><font color="#009900">$score</font><font color="#990000">)</font> <font color="#990000">&gt;=</font> <font color="#993399">4</font><font color="#990000">)</font> <font color="#CC3333">{</font>
            <font color="#009900">$severity</font> <font color="#990000">=</font> <font color="#CC3333">"MEDIUM"</font><font color="#990000">;</font>
         <font color="#CC3333">}</font>
         <b><font color="#3366FF">my</font></b> <font color="#009900">$sql</font> <font color="#990000">=</font> <b><font color="#3366FF">qq</font></b><font color="#CC3333">{ SELECT count(*) FROM nvdcve WHERE cve_id=? }</font><font color="#990000">;</font>
         <b><font color="#3366FF">my</font></b> <font color="#009900">$sth</font> <font color="#990000">=</font> <font color="#009900">$dbh</font><font color="#990000">-&gt;</font><b><font color="#000000">prepare</font></b><font color="#990000">(</font> <font color="#009900">$sql</font> <font color="#990000">);</font>
         <b><font color="#3366FF">my</font></b> <font color="#009900">$rc</font> <font color="#990000">=</font> <font color="#009900">$sth</font><font color="#990000">-&gt;</font><b><font color="#000000">execute</font></b><font color="#990000">(</font><font color="#009900">$cve</font><font color="#990000">);</font>
         <b><font color="#3366FF">if</font></b> <font color="#990000">(</font> <font color="#009900">$rc</font><font color="#990000">)</font> <font color="#CC3333">{</font>
            <b><font color="#3366FF">my</font></b><font color="#990000">(</font><font color="#009900">$exist</font><font color="#990000">)</font> <font color="#990000">=</font> <font color="#009900">$sth</font><font color="#990000">-&gt;</font><b><font color="#000000">fetchrow_array</font></b><font color="#990000">();</font>
            <b><font color="#3366FF">if</font></b> <font color="#990000">(!</font> <font color="#009900">$exist</font><font color="#990000">)</font> <font color="#CC3333">{</font>
                <font color="#009900">$sql</font> <font color="#990000">=</font> <b><font color="#3366FF">qq</font></b><font color="#CC3333">{</font> INSERT INTO nvdcve SET cve_id<font color="#990000">=?,</font>
published<font color="#990000">=?,</font> modified<font color="#990000">=?,</font> score<font color="#990000">=?,</font> severity<font color="#990000">=?,</font> vector<font color="#990000">=?,</font> complexity<font color="#990000">=?,</font>
authentication<font color="#990000">=?,</font> confidentiality<font color="#990000">=?,</font> integrity<font color="#990000">=?,</font>availability<font color="#990000">=?,</font> summary<font color="#990000">=?</font> <font color="#CC3333">}</font><font color="#990000">;</font>
               <font color="#009900">$sth</font> <font color="#990000">=</font> <font color="#009900">$dbh</font><font color="#990000">-&gt;</font><b><font color="#000000">prepare</font></b><font color="#990000">(</font> <font color="#009900">$sql</font> <font color="#990000">);</font>
               <font color="#009900">$rc</font> <font color="#990000">=</font> <font color="#009900">$sth</font><font color="#990000">-&gt;</font><b><font color="#000000">execute</font></b><font color="#990000">(</font><font color="#009900">$cve</font><font color="#990000">,</font><font color="#009900">$published</font><font color="#990000">,</font><font color="#009900">$modified</font><font color="#990000">,</font><font color="#009900">$score</font><font color="#990000">,</font>
<font color="#009900">$severity</font><font color="#990000">,</font><font color="#009900">$vector</font><font color="#990000">,</font><font color="#009900">$complexity</font><font color="#990000">,</font><font color="#009900">$authentication</font><font color="#990000">,</font>
<font color="#009900">$confidentiality</font><font color="#990000">,</font><font color="#009900">$integrity</font><font color="#990000">,</font><font color="#009900">$availability</font><font color="#990000">,</font><font color="#009900">$summary</font><font color="#990000">);</font>
            <font color="#CC3333">}</font>
         <font color="#CC3333">}</font>
      <font color="#CC3333">}</font>
   <font color="#CC3333">}</font>
<font color="#CC3333">}</font>
</tt></pre>
</p>
<p><h4><b>The Perl Program to Pull It All Together</b></h4>
</p>
<p>
The above subroutines use the Perl modules <a href="http://search.cpan.org/~gaas/libwww-perl-5.834/lib/LWP/UserAgent.pm">LWP::UserAgent</a>, <a href="http://search.cpan.org/~pajas/XML-LibXML-1.70/LibXML.pod">XML::LibXML</a>, <a href="http://search.cpan.org/~pajas/XML-LibXML-XPathContext/">XML::LibXML::XPathContext</a>, and <a href="http://search.cpan.org/~timb/DBI-1.609/">DBI</a>. A sample Perl program that calls the above subroutines to pull down the NVD CVE data and load it into a MySQL table would be:
</p>
<p>
<!-- Generator: GNU source-highlight 3.1.3<br />
by Lorenzo Bettini</p>
<p>http://www.lorenzobettini.it</p>
<p>http://www.gnu.org/software/src-highlite --></p>
<pre><tt><i><font color="#996633">#!/usr/local/bin/perl -w</font></i>
<b><font color="#3366FF">use</font></b> LWP<font color="#990000">::</font>UserAgent<font color="#990000">;</font>
<b><font color="#3366FF">use</font></b> XML<font color="#990000">::</font>LibXML<font color="#990000">;</font>
<b><font color="#3366FF">use</font></b> XML<font color="#990000">::</font>LibXML<font color="#990000">::</font>XPathContext<font color="#990000">;</font>
<b><font color="#3366FF">use</font></b> DBI<font color="#990000">;</font>
BEGIN<font color="#CC3333">{</font><b><font color="#3366FF">push</font></b> <font color="#009900">@INC</font><font color="#990000">,</font> <font color="#CC3333">"/home/jgerber/projects/nvd/perl"</font><font color="#CC3333">}</font>
<b><font color="#3366FF">use</font></b> nvdsubs <b><font color="#3366FF">qw</font></b><font color="#990000">(</font><font color="#009900">$db_host</font> <font color="#009900">$db</font> <font color="#009900">$mysql_user</font> <font color="#009900">$mysql_passwd</font> <font color="#009900">$mysql</font><font color="#990000">.</font>sock
readpage readxml <font color="#990000">);</font>
<i><font color="#996633"># Main</font></i>
<b><font color="#3366FF">my</font></b> <font color="#009900">$datadir</font> <font color="#990000">=</font> <font color="#CC3333">"/home/johngerber/projects/nvd/data"</font><font color="#990000">;</font>
<b><font color="#3366FF">my</font></b> <font color="#009900">@timeData</font> <font color="#990000">=</font> <b><font color="#000000">localtime</font></b><font color="#990000">(</font>time<font color="#990000">);</font>
<b><font color="#3366FF">my</font></b> <font color="#009900">$year</font> <font color="#990000">=</font> <font color="#993399">1900</font> <font color="#990000">+</font> <font color="#009900">$timeData</font><font color="#990000">[</font><font color="#993399">5</font><font color="#990000">];</font>
<b><font color="#3366FF">my</font></b> <font color="#009900">$prev_year</font> <font color="#990000">=</font> <font color="#993399">1900</font> <font color="#990000">+</font> <font color="#009900">$timeData</font><font color="#990000">[</font><font color="#993399">5</font><font color="#990000">]</font> <font color="#990000">-</font> <font color="#993399">1</font><font color="#990000">;</font>
<b><font color="#3366FF">my</font></b> <font color="#009900">$url</font> <font color="#990000">=</font> <font color="#CC3333">"http://static.nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-"</font> <font color="#990000">.</font>
    <font color="#009900">$year</font> <font color="#990000">.</font> <font color="#CC3333">".xml"</font><font color="#990000">;</font>
<b><font color="#3366FF">my</font></b> <font color="#009900">$prev_url</font> <font color="#990000">=</font> <font color="#CC3333">"http://static.nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-"</font> <font color="#990000">.</font>
    <font color="#009900">$prev_year</font> <font color="#990000">.</font> <font color="#CC3333">".xml"</font><font color="#990000">;</font>
<b><font color="#3366FF">my</font></b> <font color="#009900">$nvd_file</font> <font color="#990000">=</font> <font color="#009900">$datadir</font>  <font color="#990000">.</font> <font color="#CC3333">"/nvdcve-"</font><font color="#990000">.</font> <font color="#009900">$year</font> <font color="#990000">.</font> <font color="#CC3333">".xml"</font><font color="#990000">;</font>
<b><font color="#3366FF">my</font></b> <font color="#009900">$prev_nvd_file</font> <font color="#990000">=</font> <font color="#009900">$datadir</font>  <font color="#990000">.</font> <font color="#CC3333">"/nvdcve-"</font><font color="#990000">.</font> <font color="#009900">$prev_year</font> <font color="#990000">.</font> <font color="#CC3333">".xml"</font><font color="#990000">;</font>
<font color="#009900">$db</font> <font color="#990000">=</font> <font color="#CC3333">"vulnerabilities"</font><font color="#990000">;</font>
<b><font color="#3366FF">local</font></b><font color="#990000">(</font><font color="#009900">$dbh</font><font color="#990000">)</font> <font color="#990000">=</font> DBI<font color="#990000">-&gt;</font><b><font color="#000000">connect</font></b><font color="#990000">(</font><font color="#CC3333">"DBI:mysql:mysql_socket=$mysql.sock;$db:$db_host"</font><font color="#990000">,</font>
<font color="#009900">$mysql_user</font><font color="#990000">,</font> <font color="#009900">$mysql_passwd</font><font color="#990000">)</font> <font color="#990000">||</font> <b><font color="#3366FF">die</font></b> <font color="#CC3333">"ERROR: Connecting: $DBI::errstr\n"</font><font color="#990000">;</font>
<b><font color="#3366FF">my</font></b> <font color="#990000">(</font><font color="#009900">$pjstatus</font><font color="#990000">)</font> <font color="#990000">=</font> <font color="#990000">&amp;</font><b><font color="#000000">readpage</font></b><font color="#990000">(</font><font color="#009900">$prev_url</font><font color="#990000">,</font><font color="#009900">$prev_nvd_file</font><font color="#990000">);</font>
<b><font color="#3366FF">if</font></b> <font color="#990000">(</font><font color="#009900">$pjstatus</font><font color="#990000">)</font> <font color="#CC3333">{</font>
   <font color="#990000">&amp;</font><b><font color="#000000">readxml</font></b><font color="#990000">(</font><font color="#009900">$prev_nvd_file</font><font color="#990000">,</font><font color="#009900">$dbh</font><font color="#990000">);</font>
<font color="#CC3333">}</font>
<font color="#009900">$pjstatus</font> <font color="#990000">=</font> <font color="#990000">&amp;</font><b><font color="#000000">readpage</font></b><font color="#990000">(</font><font color="#009900">$url</font><font color="#990000">,</font><font color="#009900">$nvd_file</font><font color="#990000">);</font>
<b><font color="#3366FF">if</font></b> <font color="#990000">(</font><font color="#009900">$pjstatus</font><font color="#990000">)</font> <font color="#CC3333">{</font>
   <font color="#990000">&amp;</font><b><font color="#000000">readxml</font></b><font color="#990000">(</font><font color="#009900">$nvd_file</font><font color="#990000">,</font><font color="#009900">$dbh</font><font color="#990000">);</font>
<font color="#CC3333">}</font>
<b><font color="#3366FF">exit</font></b><font color="#990000">;</font>
</tt></pre>
</p>
<p>
The <b>nvdsubs.pm</b> file will not be included in this post.  The subroutines are defined and the only pieces missing are the MySQL database username and password.  You don&#8217;t need mine.  Add your own.  At this point, we have everything we need to finally use Google Visualization to create a graph.
</p>
<p><h3>Google Visualization</h3>
</p>
<p>
We are going to create a Perl program that will read our MySQL nvdcve table and generate the JavaScript that will render our charts on the client&#8217;s browser.  First, we want to define the JavaScript we want to produce.  Just to alleviate some concerns, with Google Visualization your data is only shared between your server and the client connecting.  This is unlike Google Charts where your data is sent to Google where it is made into a chart and the result is sent back.  Google states concerning the logging of chart data (via Google Charts), &#8220;The chart data included in the HTTP request is saved in temporary logs for no longer than two weeks for internal testing and debugging purposes.&#8221;  Every example in the Google Visualization Gallery will state the data policy.  For Google Charts, stated at the bottom of the page for each gadget description the data policy:
</p>
<p>
<img src="http://blog.securitymonks.com/wp-content/uploads/2010/04/GoogleChartDataPolicy.png" />
</p>
<p>
While Google Visualization gadgets will have the following stated data policy:
</p>
<p>
<img src="http://blog.securitymonks.com/wp-content/uploads/2010/04/GoogleVisDataPolicy.png" />
</p>
<p><h4><b>Loading Google Libraries</b></h4>
</p>
<p>
The first thing the JavaScript needs to do is load the required libraries.  This is accomplished with the lines:
</p>
<p><pre>
&lt;script type="text/javascript" src="http://www.google.com/jsapi"&gt;&lt;/script&gt;
</pre>
</p>
<p><h4><b>Area Chart and Table</b></h4>
</p>
<p>
In this example we are going to create an <a href="http://code.google.com/apis/visualization/documentation/gallery/columnchart.html">column chart</a>. In a later section, &#8220;Other Charting Options&#8221; (see below) we define different Google Visualization charting options.
</p>
<p>
JavaScript code for a sample column chart would be:
</p>
<p>
<!-- Generator: GNU source-highlight 3.1.3<br />
by Lorenzo Bettini</p>
<p>http://www.lorenzobettini.it</p>
<p>http://www.gnu.org/software/src-highlite --></p>
<pre><tt>    <font color="#990000">&lt;</font>script type<font color="#990000">=</font><font color="#CC3333">'text/javascript'</font><font color="#990000">&gt;</font>
      google<font color="#990000">.</font><b><font color="#000000">load</font></b><font color="#990000">(</font><font color="#CC3333">'visualization'</font><font color="#990000">,</font> <font color="#CC3333">'1'</font><font color="#990000">,</font> <font color="#CC3333">{</font>packages<font color="#990000">:[</font><font color="#CC3333">'columnchart'</font><font color="#990000">]</font><font color="#CC3333">}</font><font color="#990000">);</font>
      google<font color="#990000">.</font><b><font color="#000000">setOnLoadCallback</font></b><font color="#990000">(</font>drawChart<font color="#990000">);</font>
      <b><font color="#008080">function</font></b> <b><font color="#000000">drawChart</font></b><font color="#990000">()</font> <font color="#CC3333">{</font>
        <b><font color="#008080">var</font></b> data <font color="#990000">=</font> <b><font color="#008080">new</font></b> google<font color="#990000">.</font>visualization<font color="#990000">.</font><b><font color="#000000">DataTable</font></b><font color="#990000">();</font>
        data<font color="#990000">.</font><b><font color="#000000">addColumn</font></b><font color="#990000">(</font><font color="#CC3333">'date'</font><font color="#990000">,</font> <font color="#CC3333">'Date'</font><font color="#990000">);</font>
        data<font color="#990000">.</font><b><font color="#000000">addColumn</font></b><font color="#990000">(</font><font color="#CC3333">'number'</font><font color="#990000">,</font> <font color="#CC3333">'High'</font><font color="#990000">);</font>
        data<font color="#990000">.</font><b><font color="#000000">addColumn</font></b><font color="#990000">(</font><font color="#CC3333">'number'</font><font color="#990000">,</font> <font color="#CC3333">'Medium'</font><font color="#990000">);</font>
        data<font color="#990000">.</font><b><font color="#000000">addColumn</font></b><font color="#990000">(</font><font color="#CC3333">'number'</font><font color="#990000">,</font> <font color="#CC3333">'Low'</font><font color="#990000">);</font>
        data<font color="#990000">.</font><b><font color="#000000">addRows</font></b><font color="#990000">([</font>
           <font color="#990000">[</font><b><font color="#008080">new</font></b> <b><font color="#000000">Date</font></b><font color="#990000">(</font><font color="#993399">2009</font><font color="#990000">,</font> <font color="#993399">0</font><font color="#990000">,</font> <font color="#993399">30</font><font color="#990000">),</font><font color="#993399">92</font><font color="#990000">,</font><font color="#993399">97</font><font color="#990000">,</font><font color="#993399">3</font><font color="#990000">],</font>
           <font color="#990000">[</font><b><font color="#008080">new</font></b> <b><font color="#000000">Date</font></b><font color="#990000">(</font><font color="#993399">2009</font><font color="#990000">,</font> <font color="#993399">1</font><font color="#990000">,</font> <font color="#993399">27</font><font color="#990000">),</font><font color="#993399">168</font><font color="#990000">,</font><font color="#993399">142</font><font color="#990000">,</font><font color="#993399">25</font><font color="#990000">],</font>
           <font color="#990000">[</font><b><font color="#008080">new</font></b> <b><font color="#000000">Date</font></b><font color="#990000">(</font><font color="#993399">2009</font><font color="#990000">,</font> <font color="#993399">2</font><font color="#990000">,</font> <font color="#993399">31</font><font color="#990000">),</font><font color="#993399">141</font><font color="#990000">,</font><font color="#993399">165</font><font color="#990000">,</font><font color="#993399">9</font><font color="#990000">],</font>
           <font color="#990000">[</font><b><font color="#008080">new</font></b> <b><font color="#000000">Date</font></b><font color="#990000">(</font><font color="#993399">2009</font><font color="#990000">,</font> <font color="#993399">3</font><font color="#990000">,</font> <font color="#993399">30</font><font color="#990000">),</font><font color="#993399">132</font><font color="#990000">,</font><font color="#993399">203</font><font color="#990000">,</font><font color="#993399">12</font><font color="#990000">],</font>
           <font color="#990000">[</font><b><font color="#008080">new</font></b> <b><font color="#000000">Date</font></b><font color="#990000">(</font><font color="#993399">2009</font><font color="#990000">,</font> <font color="#993399">4</font><font color="#990000">,</font> <font color="#993399">29</font><font color="#990000">),</font><font color="#993399">158</font><font color="#990000">,</font><font color="#993399">153</font><font color="#990000">,</font><font color="#993399">8</font><font color="#990000">],</font>
           <font color="#990000">[</font><b><font color="#008080">new</font></b> <b><font color="#000000">Date</font></b><font color="#990000">(</font><font color="#993399">2009</font><font color="#990000">,</font> <font color="#993399">5</font><font color="#990000">,</font> <font color="#993399">30</font><font color="#990000">),</font><font color="#993399">200</font><font color="#990000">,</font><font color="#993399">199</font><font color="#990000">,</font><font color="#993399">22</font><font color="#990000">],</font>
           <font color="#990000">[</font><b><font color="#008080">new</font></b> <b><font color="#000000">Date</font></b><font color="#990000">(</font><font color="#993399">2009</font><font color="#990000">,</font> <font color="#993399">6</font><font color="#990000">,</font> <font color="#993399">31</font><font color="#990000">),</font><font color="#993399">190</font><font color="#990000">,</font><font color="#993399">195</font><font color="#990000">,</font><font color="#993399">11</font><font color="#990000">],</font>
           <font color="#990000">[</font><b><font color="#008080">new</font></b> <b><font color="#000000">Date</font></b><font color="#990000">(</font><font color="#993399">2009</font><font color="#990000">,</font> <font color="#993399">7</font><font color="#990000">,</font> <font color="#993399">31</font><font color="#990000">),</font><font color="#993399">127</font><font color="#990000">,</font><font color="#993399">139</font><font color="#990000">,</font><font color="#993399">14</font><font color="#990000">],</font>
           <font color="#990000">[</font><b><font color="#008080">new</font></b> <b><font color="#000000">Date</font></b><font color="#990000">(</font><font color="#993399">2009</font><font color="#990000">,</font> <font color="#993399">8</font><font color="#990000">,</font> <font color="#993399">30</font><font color="#990000">),</font><font color="#993399">233</font><font color="#990000">,</font><font color="#993399">208</font><font color="#990000">,</font><font color="#993399">14</font><font color="#990000">],</font>
           <font color="#990000">[</font><b><font color="#008080">new</font></b> <b><font color="#000000">Date</font></b><font color="#990000">(</font><font color="#993399">2009</font><font color="#990000">,</font> <font color="#993399">9</font><font color="#990000">,</font> <font color="#993399">30</font><font color="#990000">),</font><font color="#993399">163</font><font color="#990000">,</font><font color="#993399">167</font><font color="#990000">,</font><font color="#993399">18</font><font color="#990000">],</font>
           <font color="#990000">[</font><b><font color="#008080">new</font></b> <b><font color="#000000">Date</font></b><font color="#990000">(</font><font color="#993399">2009</font><font color="#990000">,</font> <font color="#993399">10</font><font color="#990000">,</font> <font color="#993399">30</font><font color="#990000">),</font><font color="#993399">129</font><font color="#990000">,</font><font color="#993399">172</font><font color="#990000">,</font><font color="#993399">8</font><font color="#990000">],</font>
           <font color="#990000">[</font><b><font color="#008080">new</font></b> <b><font color="#000000">Date</font></b><font color="#990000">(</font><font color="#993399">2009</font><font color="#990000">,</font> <font color="#993399">11</font><font color="#990000">,</font> <font color="#993399">31</font><font color="#990000">),</font><font color="#993399">200</font><font color="#990000">,</font><font color="#993399">211</font><font color="#990000">,</font><font color="#993399">19</font><font color="#990000">],</font>
           <font color="#990000">[</font><b><font color="#008080">new</font></b> <b><font color="#000000">Date</font></b><font color="#990000">(</font><font color="#993399">2010</font><font color="#990000">,</font> <font color="#993399">0</font><font color="#990000">,</font> <font color="#993399">29</font><font color="#990000">),</font><font color="#993399">157</font><font color="#990000">,</font><font color="#993399">139</font><font color="#990000">,</font><font color="#993399">14</font><font color="#990000">],</font>
           <font color="#990000">[</font><b><font color="#008080">new</font></b> <b><font color="#000000">Date</font></b><font color="#990000">(</font><font color="#993399">2010</font><font color="#990000">,</font> <font color="#993399">1</font><font color="#990000">,</font> <font color="#993399">26</font><font color="#990000">),</font><font color="#993399">137</font><font color="#990000">,</font><font color="#993399">143</font><font color="#990000">,</font><font color="#993399">12</font><font color="#990000">],</font>
           <font color="#990000">[</font><b><font color="#008080">new</font></b> <b><font color="#000000">Date</font></b><font color="#990000">(</font><font color="#993399">2010</font><font color="#990000">,</font> <font color="#993399">2</font><font color="#990000">,</font> <font color="#993399">31</font><font color="#990000">),</font><font color="#993399">252</font><font color="#990000">,</font><font color="#993399">242</font><font color="#990000">,</font><font color="#993399">18</font><font color="#990000">],</font>
           <font color="#990000">[</font><b><font color="#008080">new</font></b> <b><font color="#000000">Date</font></b><font color="#990000">(</font><font color="#993399">2010</font><font color="#990000">,</font> <font color="#993399">3</font><font color="#990000">,</font> <font color="#993399">13</font><font color="#990000">),</font><font color="#993399">92</font><font color="#990000">,</font><font color="#993399">118</font><font color="#990000">,</font><font color="#993399">17</font><font color="#990000">]</font>
        <font color="#990000">]);</font>
        <b><font color="#008080">var</font></b> chart <font color="#990000">=</font> <b><font color="#008080">new</font></b> google<font color="#990000">.</font>visualization<font color="#990000">.</font><b><font color="#000000">ColumnChart</font></b><font color="#990000">(</font>document<font color="#990000">.</font><b><font color="#000000">getElementById</font></b><font color="#990000">(</font><font color="#CC3333">'s4graph'</font><font color="#990000">));</font>
        chart<font color="#990000">.</font><b><font color="#000000">draw</font></b><font color="#990000">(</font>data<font color="#990000">,</font> <font color="#CC3333">{</font>displayAnnotations<font color="#990000">:</font><b><font color="#008080">true</font></b><font color="#990000">,</font> is3D<font color="#990000">:</font> <b><font color="#008080">true</font></b><font color="#990000">,</font> isStacked<font color="#990000">:</font> <b><font color="#008080">true</font></b><font color="#990000">,</font> min<font color="#990000">:</font> <font color="#993399">0</font><font color="#990000">,</font>
          allowHtml<font color="#990000">:</font> <b><font color="#008080">true</font></b><font color="#990000">,</font> colors<font color="#990000">:[</font><font color="#CC3333">{</font>color<font color="#990000">:</font><font color="#CC3333">'#E41B17'</font><font color="#990000">,</font> darker<font color="#990000">:</font><font color="#CC3333">'#C11B17'</font><font color="#CC3333">}</font><font color="#990000">,</font> <font color="#CC3333">{</font>color<font color="#990000">:</font><font color="#CC3333">'#FFA500'</font><font color="#990000">,</font> darker<font color="#990000">:</font><font color="#CC3333">'#E56717'</font><font color="#CC3333">}</font><font color="#990000">,</font> <font color="#CC3333">{</font>color<font color="#990000">:</font><font color="#CC3333">'#FFE87C'</font><font color="#990000">,</font> darker<font color="#990000">:</font><font color="#CC3333">'#C8B560'</font><font color="#CC3333">}</font><font color="#990000">]</font><font color="#CC3333">}</font><font color="#990000">);</font>
      <font color="#CC3333">}</font>
    <font color="#990000">&lt;/</font>script<font color="#990000">&gt;</font>
</tt></pre>
</p>
<p>
The resulting image would be the following column chart:
</p>
<p>
<img src="http://blog.securitymonks.com/wp-content/uploads/2010/04/googlecolumn.png"  width=500 />
</p>
<p><h4><b>Rendering the Table</b></h4>
</p>
<p>
When providing qualitative results, I like to back them up with more accurate numeric values.  Let us include a table with links to the CVSS scores for each vulnerability.
</p>
<p>
<!-- Generator: GNU source-highlight 3.1.3<br />
by Lorenzo Bettini</p>
<p>http://www.lorenzobettini.it</p>
<p>http://www.gnu.org/software/src-highlite --></p>
<pre><tt>    <font color="#990000">&lt;</font>script type<font color="#990000">=</font><font color="#CC3333">'text/javascript'</font><font color="#990000">&gt;</font>
      google<font color="#990000">.</font><b><font color="#000000">load</font></b><font color="#990000">(</font><font color="#CC3333">'visualization'</font><font color="#990000">,</font> <font color="#CC3333">'1'</font><font color="#990000">,</font> <font color="#CC3333">{</font>packages<font color="#990000">:[</font><font color="#CC3333">'table'</font><font color="#990000">]</font><font color="#CC3333">}</font><font color="#990000">);</font>
      google<font color="#990000">.</font><b><font color="#000000">setOnLoadCallback</font></b><font color="#990000">(</font>drawChart<font color="#990000">);</font>
      <b><font color="#3366FF">function</font></b> <b><font color="#000000">drawChart</font></b><font color="#990000">()</font> <font color="#CC3333">{</font>
        <b><font color="#3366FF">var</font></b> data2 <font color="#990000">=</font> <b><font color="#3366FF">new</font></b> google<font color="#990000">.</font>visualization<font color="#990000">.</font><b><font color="#000000">DataTable</font></b><font color="#990000">();</font>
        data2<font color="#990000">.</font><b><font color="#000000">addColumn</font></b><font color="#990000">(</font><font color="#CC3333">'date'</font><font color="#990000">,</font> <font color="#CC3333">'Date'</font><font color="#990000">);</font>
        data2<font color="#990000">.</font><b><font color="#000000">addColumn</font></b><font color="#990000">(</font><font color="#CC3333">'number'</font><font color="#990000">,</font> <font color="#CC3333">'High'</font><font color="#990000">);</font>
        data2<font color="#990000">.</font><b><font color="#000000">addColumn</font></b><font color="#990000">(</font><font color="#CC3333">'number'</font><font color="#990000">,</font> <font color="#CC3333">'Medium'</font><font color="#990000">);</font>
        data2<font color="#990000">.</font><b><font color="#000000">addColumn</font></b><font color="#990000">(</font><font color="#CC3333">'number'</font><font color="#990000">,</font> <font color="#CC3333">'Low'</font><font color="#990000">);</font>
        data2<font color="#990000">.</font><b><font color="#000000">addRows</font></b><font color="#990000">([</font>
           <font color="#990000">[</font><font color="#CC3333">{</font>v<font color="#990000">:</font><b><font color="#3366FF">new</font></b> <b><font color="#000000">Date</font></b><font color="#990000">(</font><font color="#993399">2009</font><font color="#990000">,</font> <font color="#993399">0</font><font color="#990000">,</font> <font color="#993399">30</font><font color="#990000">),</font>
              f<font color="#990000">:</font><font color="#CC3333">'&lt;a href="/nvd/cvealerts.php?date=2009-01"&gt;2009-01-30&lt;/a&gt;'</font><font color="#CC3333">}</font><font color="#990000">,</font> <font color="#993399">92</font><font color="#990000">,</font><font color="#993399">97</font><font color="#990000">,</font><font color="#993399">3</font><font color="#990000">],</font>
           <font color="#990000">[</font><font color="#CC3333">{</font>v<font color="#990000">:</font><b><font color="#3366FF">new</font></b> <b><font color="#000000">Date</font></b><font color="#990000">(</font><font color="#993399">2009</font><font color="#990000">,</font> <font color="#993399">1</font><font color="#990000">,</font> <font color="#993399">27</font><font color="#990000">),</font>
              f<font color="#990000">:</font><font color="#CC3333">'&lt;a href="/nvd/cvealerts.php?date=2009-02"&gt;2009-02-27&lt;/a&gt;'</font><font color="#CC3333">}</font><font color="#990000">,</font> <font color="#993399">168</font><font color="#990000">,</font><font color="#993399">142</font><font color="#990000">,</font><font color="#993399">25</font><font color="#990000">],</font>
           <font color="#990000">[</font><font color="#CC3333">{</font>v<font color="#990000">:</font><b><font color="#3366FF">new</font></b> <b><font color="#000000">Date</font></b><font color="#990000">(</font><font color="#993399">2009</font><font color="#990000">,</font> <font color="#993399">2</font><font color="#990000">,</font> <font color="#993399">31</font><font color="#990000">),</font>
              f<font color="#990000">:</font><font color="#CC3333">'&lt;a href="/nvd/cvealerts.php?date=2009-03"&gt;2009-03-31&lt;/a&gt;'</font><font color="#CC3333">}</font><font color="#990000">,</font> <font color="#993399">141</font><font color="#990000">,</font><font color="#993399">165</font><font color="#990000">,</font><font color="#993399">9</font><font color="#990000">],</font>
           <font color="#990000">[</font><font color="#CC3333">{</font>v<font color="#990000">:</font><b><font color="#3366FF">new</font></b> <b><font color="#000000">Date</font></b><font color="#990000">(</font><font color="#993399">2009</font><font color="#990000">,</font> <font color="#993399">3</font><font color="#990000">,</font> <font color="#993399">30</font><font color="#990000">),</font>
              f<font color="#990000">:</font><font color="#CC3333">'&lt;a href="/nvd/cvealerts.php?date=2009-04"&gt;2009-04-30&lt;/a&gt;'</font><font color="#CC3333">}</font><font color="#990000">,</font> <font color="#993399">132</font><font color="#990000">,</font><font color="#993399">203</font><font color="#990000">,</font><font color="#993399">12</font><font color="#990000">],</font>
           <font color="#990000">[</font><font color="#CC3333">{</font>v<font color="#990000">:</font><b><font color="#3366FF">new</font></b> <b><font color="#000000">Date</font></b><font color="#990000">(</font><font color="#993399">2009</font><font color="#990000">,</font> <font color="#993399">4</font><font color="#990000">,</font> <font color="#993399">29</font><font color="#990000">),</font>
              f<font color="#990000">:</font><font color="#CC3333">'&lt;a href="/nvd/cvealerts.php?date=2009-05"&gt;2009-05-29&lt;/a&gt;'</font><font color="#CC3333">}</font><font color="#990000">,</font> <font color="#993399">158</font><font color="#990000">,</font><font color="#993399">153</font><font color="#990000">,</font><font color="#993399">8</font><font color="#990000">],</font>
           <font color="#990000">[</font><font color="#CC3333">{</font>v<font color="#990000">:</font><b><font color="#3366FF">new</font></b> <b><font color="#000000">Date</font></b><font color="#990000">(</font><font color="#993399">2009</font><font color="#990000">,</font> <font color="#993399">5</font><font color="#990000">,</font> <font color="#993399">30</font><font color="#990000">),</font>
              f<font color="#990000">:</font><font color="#CC3333">'&lt;a href="/nvd/cvealerts.php?date=2009-06"&gt;2009-06-30&lt;/a&gt;'</font><font color="#CC3333">}</font><font color="#990000">,</font> <font color="#993399">200</font><font color="#990000">,</font><font color="#993399">199</font><font color="#990000">,</font><font color="#993399">22</font><font color="#990000">],</font>
           <font color="#990000">[</font><font color="#CC3333">{</font>v<font color="#990000">:</font><b><font color="#3366FF">new</font></b> <b><font color="#000000">Date</font></b><font color="#990000">(</font><font color="#993399">2009</font><font color="#990000">,</font> <font color="#993399">6</font><font color="#990000">,</font> <font color="#993399">31</font><font color="#990000">),</font>
              f<font color="#990000">:</font><font color="#CC3333">'&lt;a href="/nvd/cvealerts.php?date=2009-07"&gt;2009-07-31&lt;/a&gt;'</font><font color="#CC3333">}</font><font color="#990000">,</font> <font color="#993399">190</font><font color="#990000">,</font><font color="#993399">195</font><font color="#990000">,</font><font color="#993399">11</font><font color="#990000">],</font>
           <font color="#990000">[</font><font color="#CC3333">{</font>v<font color="#990000">:</font><b><font color="#3366FF">new</font></b> <b><font color="#000000">Date</font></b><font color="#990000">(</font><font color="#993399">2009</font><font color="#990000">,</font> <font color="#993399">7</font><font color="#990000">,</font> <font color="#993399">31</font><font color="#990000">),</font>
              f<font color="#990000">:</font><font color="#CC3333">'&lt;a href="/nvd/cvealerts.php?date=2009-08"&gt;2009-08-31&lt;/a&gt;'</font><font color="#CC3333">}</font><font color="#990000">,</font> <font color="#993399">127</font><font color="#990000">,</font><font color="#993399">139</font><font color="#990000">,</font><font color="#993399">14</font><font color="#990000">],</font>
           <font color="#990000">[</font><font color="#CC3333">{</font>v<font color="#990000">:</font><b><font color="#3366FF">new</font></b> <b><font color="#000000">Date</font></b><font color="#990000">(</font><font color="#993399">2009</font><font color="#990000">,</font> <font color="#993399">8</font><font color="#990000">,</font> <font color="#993399">30</font><font color="#990000">),</font>
              f<font color="#990000">:</font><font color="#CC3333">'&lt;a href="/nvd/cvealerts.php?date=2009-09"&gt;2009-09-30&lt;/a&gt;'</font><font color="#CC3333">}</font><font color="#990000">,</font> <font color="#993399">233</font><font color="#990000">,</font><font color="#993399">208</font><font color="#990000">,</font><font color="#993399">14</font><font color="#990000">],</font>
           <font color="#990000">[</font><font color="#CC3333">{</font>v<font color="#990000">:</font><b><font color="#3366FF">new</font></b> <b><font color="#000000">Date</font></b><font color="#990000">(</font><font color="#993399">2009</font><font color="#990000">,</font> <font color="#993399">9</font><font color="#990000">,</font> <font color="#993399">30</font><font color="#990000">),</font>
              f<font color="#990000">:</font><font color="#CC3333">'&lt;a href="/nvd/cvealerts.php?date=2009-10"&gt;2009-10-30&lt;/a&gt;'</font><font color="#CC3333">}</font><font color="#990000">,</font> <font color="#993399">163</font><font color="#990000">,</font><font color="#993399">167</font><font color="#990000">,</font><font color="#993399">18</font><font color="#990000">],</font>
           <font color="#990000">[</font><font color="#CC3333">{</font>v<font color="#990000">:</font><b><font color="#3366FF">new</font></b> <b><font color="#000000">Date</font></b><font color="#990000">(</font><font color="#993399">2009</font><font color="#990000">,</font> <font color="#993399">10</font><font color="#990000">,</font> <font color="#993399">30</font><font color="#990000">),</font>
              f<font color="#990000">:</font><font color="#CC3333">'&lt;a href="/nvd/cvealerts.php?date=2009-11"&gt;2009-11-30&lt;/a&gt;'</font><font color="#CC3333">}</font><font color="#990000">,</font> <font color="#993399">129</font><font color="#990000">,</font><font color="#993399">172</font><font color="#990000">,</font><font color="#993399">8</font><font color="#990000">],</font>
           <font color="#990000">[</font><font color="#CC3333">{</font>v<font color="#990000">:</font><b><font color="#3366FF">new</font></b> <b><font color="#000000">Date</font></b><font color="#990000">(</font><font color="#993399">2009</font><font color="#990000">,</font> <font color="#993399">11</font><font color="#990000">,</font> <font color="#993399">31</font><font color="#990000">),</font>
              f<font color="#990000">:</font><font color="#CC3333">'&lt;a href="/nvd/cvealerts.php?date=2009-12"&gt;2009-12-31&lt;/a&gt;'</font><font color="#CC3333">}</font><font color="#990000">,</font> <font color="#993399">200</font><font color="#990000">,</font><font color="#993399">211</font><font color="#990000">,</font><font color="#993399">19</font><font color="#990000">],</font>
           <font color="#990000">[</font><font color="#CC3333">{</font>v<font color="#990000">:</font><b><font color="#3366FF">new</font></b> <b><font color="#000000">Date</font></b><font color="#990000">(</font><font color="#993399">2010</font><font color="#990000">,</font> <font color="#993399">0</font><font color="#990000">,</font> <font color="#993399">29</font><font color="#990000">),</font>
              f<font color="#990000">:</font><font color="#CC3333">'&lt;a href="/nvd/cvealerts.php?date=2010-01"&gt;2010-01-29&lt;/a&gt;'</font><font color="#CC3333">}</font><font color="#990000">,</font> <font color="#993399">157</font><font color="#990000">,</font><font color="#993399">139</font><font color="#990000">,</font><font color="#993399">14</font><font color="#990000">],</font>
           <font color="#990000">[</font><font color="#CC3333">{</font>v<font color="#990000">:</font><b><font color="#3366FF">new</font></b> <b><font color="#000000">Date</font></b><font color="#990000">(</font><font color="#993399">2010</font><font color="#990000">,</font> <font color="#993399">1</font><font color="#990000">,</font> <font color="#993399">26</font><font color="#990000">),</font>
              f<font color="#990000">:</font><font color="#CC3333">'&lt;a href="/nvd/cvealerts.php?date=2010-02"&gt;2010-02-26&lt;/a&gt;'</font><font color="#CC3333">}</font><font color="#990000">,</font> <font color="#993399">137</font><font color="#990000">,</font><font color="#993399">143</font><font color="#990000">,</font><font color="#993399">12</font><font color="#990000">],</font>
           <font color="#990000">[</font><font color="#CC3333">{</font>v<font color="#990000">:</font><b><font color="#3366FF">new</font></b> <b><font color="#000000">Date</font></b><font color="#990000">(</font><font color="#993399">2010</font><font color="#990000">,</font> <font color="#993399">2</font><font color="#990000">,</font> <font color="#993399">31</font><font color="#990000">),</font>
              f<font color="#990000">:</font><font color="#CC3333">'&lt;a href="/nvd/cvealerts.php?date=2010-03"&gt;2010-03-31&lt;/a&gt;'</font><font color="#CC3333">}</font><font color="#990000">,</font> <font color="#993399">252</font><font color="#990000">,</font><font color="#993399">242</font><font color="#990000">,</font><font color="#993399">18</font><font color="#990000">],</font>
           <font color="#990000">[</font><font color="#CC3333">{</font>v<font color="#990000">:</font><b><font color="#3366FF">new</font></b> <b><font color="#000000">Date</font></b><font color="#990000">(</font><font color="#993399">2010</font><font color="#990000">,</font> <font color="#993399">3</font><font color="#990000">,</font> <font color="#993399">13</font><font color="#990000">),</font>
              f<font color="#990000">:</font><font color="#CC3333">'&lt;a href="/nvd/cvealerts.php?date=2010-04"&gt;2010-04-13&lt;/a&gt;'</font><font color="#CC3333">}</font><font color="#990000">,</font> <font color="#993399">92</font><font color="#990000">,</font><font color="#993399">118</font><font color="#990000">,</font><font color="#993399">17</font><font color="#990000">],</font>
        <font color="#990000">]);</font>
        <b><font color="#3366FF">var</font></b> table <font color="#990000">=</font> <b><font color="#3366FF">new</font></b> google<font color="#990000">.</font>visualization<font color="#990000">.</font><b><font color="#000000">Table</font></b><font color="#990000">(</font>document<font color="#990000">.</font><b><font color="#000000">getElementById</font></b><font color="#990000">(</font><font color="#CC3333">'s4graph_tab'</font><font color="#990000">));</font>
        table<font color="#990000">.</font><b><font color="#000000">draw</font></b><font color="#990000">(</font>data2<font color="#990000">,</font> <font color="#CC3333">{</font>showRowNumber<font color="#990000">:</font> <b><font color="#3366FF">true</font></b><font color="#990000">,</font> sortAscending<font color="#990000">:</font> <b><font color="#3366FF">false</font></b><font color="#990000">,</font> sortColumn<font color="#990000">:</font> <font color="#993399">0</font><font color="#990000">,</font> allowHtml<font color="#990000">:</font> <b><font color="#3366FF">true</font></b><font color="#CC3333">}</font><font color="#990000">);</font>
      <font color="#CC3333">}</font>
    <font color="#990000">&lt;/</font>script<font color="#990000">&gt;</font>
</tt></pre>
</p>
<p>
The JavaScript code assumes there is a PHP program called <b>cvealerts.php</b> under the <b>/nvd</b> directory on your web server.  Adjust to your environment.  A sample PHP program that could be used for cvealerts.php is provided below.  The resulting table chart would look like:
</p>
<p>
<img src="http://blog.securitymonks.com/wp-content/uploads/2010/04/googletable.png" width=500 />
</p>
<p><h4><b>Handling Events: Interactions Between Graphs</b></h4>
</p>
<p>
We now have two different types of graphs representing the same data.  We want to add interaction between the graphs so the viewer can see the relationship.  With tables rows are selected when the user clicks, which correspond to the whole column of the stacked column chart.  It is not a perfect fit, but it does demonstrate nicely use of adding interactions.
</p>
<p>
<!-- Generator: GNU source-highlight 3.1.3<br />
by Lorenzo Bettini</p>
<p>http://www.lorenzobettini.it</p>
<p>http://www.gnu.org/software/src-highlite --></p>
<pre><tt>        <i><font color="#996633">// Set a 'select' event listener for the table.</font></i>
        <i><font color="#996633">// When the table is selected,</font></i>
        <i><font color="#996633">// we set the selection on the line graph.</font></i>
        google<font color="#990000">.</font>visualization<font color="#990000">.</font>events<font color="#990000">.</font><b><font color="#000000">addListener</font></b><font color="#990000">(</font>table<font color="#990000">,</font> <font color="#CC3333">'select'</font><font color="#990000">,</font> <b><font color="#3366FF">function</font></b><font color="#990000">()</font> <font color="#CC3333">{</font>
          chart<font color="#990000">.</font><b><font color="#000000">setSelection</font></b><font color="#990000">([</font><font color="#CC3333">{</font>row<font color="#990000">:</font> table<font color="#990000">.</font><b><font color="#000000">getSelection</font></b><font color="#990000">()[</font><font color="#993399">0</font><font color="#990000">].</font>row<font color="#990000">,</font> column<font color="#990000">:</font> <font color="#993399">1</font><font color="#CC3333">}</font><font color="#990000">]);</font>
         <font color="#CC3333">}</font><font color="#990000">);</font>
        <i><font color="#996633">// Set a 'select' event listener for the graph.</font></i>
        <i><font color="#996633">// When the graph is selected,</font></i>
        <i><font color="#996633">// we set the selection on the table.</font></i>
        google<font color="#990000">.</font>visualization<font color="#990000">.</font>events<font color="#990000">.</font><b><font color="#000000">addListener</font></b><font color="#990000">(</font>chart<font color="#990000">,</font> <font color="#CC3333">'select'</font><font color="#990000">,</font> <b><font color="#3366FF">function</font></b><font color="#990000">()</font> <font color="#CC3333">{</font>
           table<font color="#990000">.</font><b><font color="#000000">setSelection</font></b><font color="#990000">([</font><font color="#CC3333">{</font>row<font color="#990000">:</font> chart<font color="#990000">.</font><b><font color="#000000">getSelection</font></b><font color="#990000">()[</font><font color="#993399">0</font><font color="#990000">].</font>row<font color="#CC3333">}</font><font color="#990000">]);</font>
        <font color="#CC3333">}</font><font color="#990000">);</font>
</tt></pre>
</p>
<p><h4><b>Providing Detailed Information</b></h4>
</p>
<p>
When the table chart link is clicked, we would like to provide some detailed information about the vulnerability.  For this example, we will do this with a simple PHP program placed in the /nvd directory on the web server.  The program is called cvealerts.php.
</p>
<p>
<!-- Generator: GNU source-highlight 3.1.3<br />
by Lorenzo Bettini</p>
<p>http://www.lorenzobettini.it</p>
<p>http://www.gnu.org/software/src-highlite --></p>
<pre><tt><font color="#990000">&lt;?</font>
<b><font color="#000000">session_start</font></b><font color="#990000">();</font>
<b><font color="#3366FF">function</font></b> <b><font color="#000000">db_connect</font></b><font color="#990000">(</font><font color="#009900">$table</font><font color="#990000">)</font> <font color="#CC3333">{</font>
   <font color="#009900">$result</font> <font color="#990000">=</font> <b><font color="#000000">mysql_pconnect</font></b><font color="#990000">(</font><font color="#CC3333">"&lt;dbhost&gt;:&lt;dbport&gt;"</font><font color="#990000">,</font> <font color="#CC3333">"&lt;username&gt;"</font><font color="#990000">,</font> <font color="#CC3333">"&lt;password&gt;"</font><font color="#990000">);</font>
   <b><font color="#3366FF">if</font></b> <font color="#990000">(!</font><font color="#009900">$result</font><font color="#990000">)</font> <b><font color="#3366FF">return</font></b> false<font color="#990000">;</font>
   <b><font color="#3366FF">if</font></b> <font color="#990000">(!</font><b><font color="#000000">mysql_select_db</font></b><font color="#990000">(</font><font color="#009900">$table</font><font color="#990000">))</font> <b><font color="#3366FF">return</font></b> false<font color="#990000">;</font>
   <b><font color="#3366FF">return</font></b> <font color="#009900">$result</font><font color="#990000">;</font>
<font color="#CC3333">}</font>
<b><font color="#3366FF">function</font></b> <b><font color="#000000">do_html_header</font></b><font color="#990000">(</font><font color="#009900">$title</font><font color="#990000">,</font><font color="#009900">$checkuser</font><font color="#990000">,</font><font color="#009900">$logpage</font><font color="#990000">)</font> <font color="#CC3333">{</font>
<font color="#990000">?&gt;</font>
  <font color="#990000">&lt;</font>html<font color="#990000">&gt;</font> <font color="#990000">&lt;</font>head<font color="#990000">&gt;</font> <font color="#990000">&lt;</font>title<font color="#990000">&gt;&lt;?=</font><font color="#009900">$title</font><font color="#990000">?&gt;&lt;/</font>title<font color="#990000">&gt;&lt;/</font>head<font color="#990000">&gt;</font>
  <font color="#990000">&lt;</font>body bgcolor<font color="#990000">=</font><font color="#CC3333">"#FFFFFF"</font><font color="#990000">&gt;</font>
<font color="#990000">&lt;?</font>
<font color="#CC3333">}</font>
<b><font color="#3366FF">function</font></b> <b><font color="#000000">do_html_footer</font></b><font color="#990000">()</font> <font color="#CC3333">{</font>
<font color="#990000">?&gt;</font>
<font color="#990000">&lt;</font>table<font color="#990000">&gt;</font>
<font color="#990000">&lt;</font>tr<font color="#990000">&gt;&lt;</font>td ALIGN<font color="#990000">=</font>CENTER NOWRAP WIDTH<font color="#990000">=</font><font color="#CC3333">"590"</font><font color="#990000">&gt;&lt;/</font>font<font color="#990000">&gt;</font>
<font color="#990000">&lt;</font>font face<font color="#990000">=</font><font color="#CC3333">"Verdana, Arial, Helvetica"</font> size<font color="#990000">=-</font><font color="#993399">2</font><font color="#990000">&gt;</font>Notice to Users<font color="#990000">:</font> Use
of this system constitutes consent to security monitoring <b><font color="#3366FF">and</font></b> testing<font color="#990000">.</font>
<font color="#990000">&lt;</font>br<font color="#990000">&gt;</font>All activity is logged with your host name <b><font color="#3366FF">and</font></b> IP address<font color="#990000">.&lt;/</font>font<font color="#990000">&gt;</font>
<font color="#990000">&lt;/</font>td<font color="#990000">&gt;&lt;/</font>tr<font color="#990000">&gt;</font>
<font color="#990000">&lt;/</font>table<font color="#990000">&gt;</font>
<font color="#990000">&lt;/</font>body<font color="#990000">&gt;</font>
 <font color="#990000">&lt;/</font>html<font color="#990000">&gt;</font>
<font color="#990000">&lt;?</font>
<font color="#CC3333">}</font>
<i><font color="#996633">// Main</font></i>
<font color="#009900">$dates</font><font color="#990000">=</font> <b><font color="#3366FF">array</font></b><font color="#990000">();</font>
<font color="#009900">$stringlist</font> <font color="#990000">=</font> <font color="#CC3333">""</font><font color="#990000">;</font>
<b><font color="#3366FF">if</font></b> <font color="#990000">(</font><b><font color="#3366FF">isset</font></b><font color="#990000">(</font><font color="#009900">$_GET</font><font color="#990000">[</font><font color="#CC3333">'date'</font><font color="#990000">]))</font> <font color="#CC3333">{</font>
    <font color="#009900">$passdates</font> <font color="#990000">=</font> <b><font color="#000000">explode</font></b><font color="#990000">(</font><font color="#CC3333">","</font><font color="#990000">,</font><font color="#009900">$_GET</font><font color="#990000">[</font><font color="#CC3333">'date'</font><font color="#990000">]);</font>
    <b><font color="#3366FF">for</font></b> <font color="#990000">(</font><font color="#009900">$index</font><font color="#990000">=</font><font color="#993399">0</font><font color="#990000">;</font> <font color="#009900">$index</font><font color="#990000">&lt;</font><b><font color="#000000">count</font></b><font color="#990000">(</font><font color="#009900">$passdates</font><font color="#990000">);</font> <font color="#009900">$index</font><font color="#990000">++)</font> <font color="#CC3333">{</font>
       <b><font color="#000000">array_push</font></b><font color="#990000">(</font><font color="#009900">$dates</font><font color="#990000">,</font> <font color="#009900">$passdates</font><font color="#990000">[</font><font color="#009900">$index</font><font color="#990000">]);</font>
       <font color="#009900">$stringlist</font> <font color="#990000">.=</font> <font color="#009900">$passdates</font><font color="#990000">[</font><font color="#009900">$index</font><font color="#990000">]</font> <font color="#990000">.</font> <font color="#CC3333">" "</font><font color="#990000">;</font>
    <font color="#CC3333">}</font>
<font color="#CC3333">}</font>
<b><font color="#3366FF">else</font></b> <font color="#CC3333">{</font>
  <b><font color="#3366FF">print</font></b><font color="#990000">(</font><font color="#CC3333">"Confusion over how you arrived at this page.&lt;P&gt;\n"</font><font color="#990000">);</font>
  <b><font color="#3366FF">exit</font></b><font color="#990000">;</font>
<font color="#CC3333">}</font>
<font color="#009900">$stringlist</font> <font color="#990000">=</font> <b><font color="#000000">preg_replace</font></b><font color="#990000">(</font><font color="#CC3333">"/ $/"</font><font color="#990000">,</font> <font color="#CC3333">""</font><font color="#990000">,</font><font color="#009900">$stringlist</font><font color="#990000">);</font>
<b><font color="#000000">do_html_header</font></b><font color="#990000">(</font><font color="#CC3333">"Review NVD CVE Announcements for Month Ending $stringlist"</font><font color="#990000">,</font><font color="#993399">1</font><font color="#990000">,</font><font color="#993399">1</font><font color="#990000">);</font>
<font color="#009900">$nvd_host</font> <font color="#990000">=</font> <font color="#CC3333">"http://web.nvd.nist.gov/view/vuln/detail?vulnId="</font><font color="#990000">;</font>
<font color="#009900">$conn</font> <font color="#990000">=</font> <b><font color="#000000">db_connect</font></b><font color="#990000">(</font><font color="#CC3333">"vulnerabilities"</font><font color="#990000">);</font>
<b><font color="#3366FF">if</font></b> <font color="#990000">(!</font><font color="#009900">$conn</font><font color="#990000">)</font>
   <b><font color="#000000">logit</font></b><font color="#990000">(</font><font color="#CC3333">"Could not connect to database vulnerabilities - please try later.\n"</font><font color="#990000">,</font><font color="#993399">1</font><font color="#990000">);</font>
<b><font color="#3366FF">for</font></b> <font color="#990000">(</font><font color="#009900">$index</font><font color="#990000">=</font><font color="#993399">0</font><font color="#990000">;</font> <font color="#009900">$index</font><font color="#990000">&lt;</font><b><font color="#000000">count</font></b><font color="#990000">(</font><font color="#009900">$dates</font><font color="#990000">);</font> <font color="#009900">$index</font><font color="#990000">++)</font> <font color="#CC3333">{</font>
   <font color="#009900">$rule</font> <font color="#990000">=</font> <font color="#009900">$dates</font><font color="#990000">[</font><font color="#009900">$index</font><font color="#990000">];</font>
   <font color="#009900">$sql</font> <font color="#990000">=</font> <font color="#CC3333">"SELECT cve_id,score,published,vector,severity,complexity,left(summary,50)</font>
<font color="#CC3333">    FROM vulnerabilities.nvdcve</font>
<font color="#CC3333">      WHERE date_format(published,'%Y-%m')='$rule'</font>
<font color="#CC3333">       ORDER BY (score+0)"</font><font color="#990000">;</font>
   <font color="#009900">$result</font> <font color="#990000">=</font> <b><font color="#000000">mysql_query</font></b><font color="#990000">(</font><font color="#009900">$sql</font><font color="#990000">,</font><font color="#009900">$conn</font><font color="#990000">);</font>
   <b><font color="#3366FF">if</font></b> <font color="#990000">(!</font><font color="#009900">$result</font><font color="#990000">)</font>
       <b><font color="#000000">logit</font></b><font color="#990000">(</font><font color="#CC3333">"Problem with $sql\n"</font><font color="#990000">,</font><font color="#993399">1</font><font color="#990000">);</font>
   <b><font color="#3366FF">print</font></b><font color="#990000">(</font><font color="#CC3333">"&lt;table border=1&gt;&lt;tr&gt;&lt;td&gt;&lt;table border=0&gt;&lt;tr&gt;&lt;th bgcolor=\"#727D96\"&gt;</font>
<font color="#CC3333">&lt;font color=\"#ffffff\" face=\"arial,helvetica,sanserif\"&gt;Bulletin&lt;/font&gt;&lt;/th&gt;&lt;th bgcolor=\"#727D96\"&gt;</font>
<font color="#CC3333">&lt;font color=\"#ffffff\" face=\"arial,helvetica,sanserif\"&gt;Impact&lt;/font&gt;&lt;/th&gt;&lt;th bgcolor=\"#727D96\"&gt;</font>
<font color="#CC3333">&lt;font color=\"#ffffff\" face=\"arial,helvetica,sanserif\"&gt;Date&lt;/font&gt;&lt;/th&gt;&lt;th bgcolor=\"#727D96\"&gt;</font>
<font color="#CC3333">&lt;font color=\"#ffffff\" face=\"arial,helvetica,sanserif\"&gt;Vector&lt;/font&gt;&lt;/th&gt;&lt;th bgcolor=\"#727D96\"&gt;</font>
<font color="#CC3333">&lt;font color=\"#ffffff\" face=\"arial,helvetica,sanserif\"&gt;Severity&lt;/font&gt;&lt;/th&gt;&lt;th bgcolor=\"#727D96\"&gt;</font>
<font color="#CC3333">&lt;font color=\"#ffffff\" face=\"arial,helvetica,sanserif\"&gt;Complexity&lt;/font&gt;&lt;/th&gt;&lt;th bgcolor=\"#727D96\"&gt;</font>
<font color="#CC3333">&lt;font color=\"#ffffff\" face=\"arial,helvetica,sanserif\"&gt;Short Summary&lt;/font&gt;&lt;/th&gt;&lt;/tr&gt;\n"</font><font color="#990000">);</font>
   <b><font color="#3366FF">for</font></b> <font color="#990000">(</font><font color="#009900">$count</font> <font color="#990000">=</font> <font color="#993399">1</font><font color="#990000">;</font> <b><font color="#3366FF">list</font></b><font color="#990000">(</font><font color="#009900">$cve_id</font><font color="#990000">,</font> <font color="#009900">$score</font><font color="#990000">,</font> <font color="#009900">$date</font><font color="#990000">,</font> <font color="#009900">$vector</font><font color="#990000">,</font> <font color="#009900">$severity</font><font color="#990000">,</font><font color="#009900">$complexity</font><font color="#990000">,</font><font color="#009900">$shortsum</font><font color="#990000">)</font> <font color="#990000">=</font>
     <b><font color="#000000">mysql_fetch_array</font></b> <font color="#990000">(</font><font color="#009900">$result</font><font color="#990000">,</font> MYSQL_NUM<font color="#990000">);</font> <font color="#990000">++</font><font color="#009900">$count</font><font color="#990000">)</font> <font color="#CC3333">{</font>
<font color="#990000">?&gt;</font>
      <font color="#990000">&lt;</font>tr<font color="#990000">&gt;&lt;</font>td CLASS<font color="#990000">=</font><font color="#CC3333">"plfieldhdrleft"</font> WIDTH<font color="#990000">=</font><font color="#CC3333">"20%"</font> BGCOLOR<font color="#990000">=</font><font color="#CC3333">'#F0F5FF'</font><font color="#990000">&gt;</font>
      <font color="#990000">&lt;?</font>  <b><font color="#3366FF">print</font></b><font color="#990000">(</font><font color="#CC3333">"&lt;a href=\"$nvd_host$cve_id\"&gt;$cve_id&lt;/a&gt;"</font><font color="#990000">);</font> <font color="#990000">?&gt;</font>
      <font color="#990000">&lt;/</font>td<font color="#990000">&gt;</font>
      <font color="#990000">&lt;</font>td CLASS<font color="#990000">=</font><font color="#CC3333">"plfieldhdrleft"</font> BGCOLOR<font color="#990000">=</font><font color="#CC3333">'#F9FCFF'</font><font color="#990000">&gt;</font>
      <font color="#990000">&lt;?</font>  <b><font color="#3366FF">print</font></b><font color="#990000">(</font><font color="#009900">$score</font><font color="#990000">);</font> <font color="#990000">?&gt;</font>
      <font color="#990000">&lt;/</font>td<font color="#990000">&gt;</font>
      <font color="#990000">&lt;</font>td CLASS<font color="#990000">=</font><font color="#CC3333">"plfieldhdrleft"</font> BGCOLOR<font color="#990000">=</font><font color="#CC3333">'#F0F5FF'</font><font color="#990000">&gt;</font>
      <font color="#990000">&lt;?</font>  <b><font color="#3366FF">print</font></b><font color="#990000">(</font><font color="#009900">$date</font><font color="#990000">);</font> <font color="#990000">?&gt;</font>
      <font color="#990000">&lt;/</font>td<font color="#990000">&gt;</font>
      <font color="#990000">&lt;</font>td CLASS<font color="#990000">=</font><font color="#CC3333">"plfieldhdrleft"</font> BGCOLOR<font color="#990000">=</font><font color="#CC3333">'#F9FCFF'</font><font color="#990000">&gt;</font>
      <font color="#990000">&lt;?</font>  <b><font color="#3366FF">print</font></b><font color="#990000">(</font><font color="#009900">$vector</font><font color="#990000">);</font> <font color="#990000">?&gt;</font>
      <font color="#990000">&lt;/</font>td<font color="#990000">&gt;</font>
      <font color="#990000">&lt;</font>td CLASS<font color="#990000">=</font><font color="#CC3333">"plfieldhdrleft"</font> BGCOLOR<font color="#990000">=</font><font color="#CC3333">'#F0F5FF'</font><font color="#990000">&gt;</font>
      <font color="#990000">&lt;?</font>  <b><font color="#3366FF">print</font></b><font color="#990000">(</font><font color="#009900">$severity</font><font color="#990000">);</font> <font color="#990000">?&gt;</font>
      <font color="#990000">&lt;/</font>td<font color="#990000">&gt;</font>
      <font color="#990000">&lt;</font>td CLASS<font color="#990000">=</font><font color="#CC3333">"plfieldhdrleft"</font> BGCOLOR<font color="#990000">=</font><font color="#CC3333">'#F9FCFF'</font><font color="#990000">&gt;</font>
      <font color="#990000">&lt;?</font>  <b><font color="#3366FF">print</font></b><font color="#990000">(</font><font color="#009900">$complexity</font><font color="#990000">);</font> <font color="#990000">?&gt;</font>
      <font color="#990000">&lt;/</font>td<font color="#990000">&gt;</font>
      <font color="#990000">&lt;</font>td CLASS<font color="#990000">=</font><font color="#CC3333">"plfieldhdrleft"</font> BGCOLOR<font color="#990000">=</font><font color="#CC3333">'#F0F5FF'</font><font color="#990000">&gt;</font>
      <font color="#990000">&lt;?</font>  <b><font color="#3366FF">print</font></b><font color="#990000">(</font><font color="#009900">$shortsum</font><font color="#990000">);</font> <font color="#990000">?&gt;</font>
      <font color="#990000">&lt;/</font>td<font color="#990000">&gt;</font>
      <font color="#990000">&lt;/</font>tr<font color="#990000">&gt;</font>
<font color="#990000">&lt;?</font>
   <font color="#CC3333">}</font>
<font color="#CC3333">}</font>
<b><font color="#3366FF">print</font></b><font color="#990000">(</font><font color="#CC3333">"&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;"</font><font color="#990000">);</font>
<b><font color="#000000">do_html_footer</font></b><font color="#990000">();</font>
</tt></pre>
</p>
<p>
The PHP program would generate a HTML table displaying the NVD CVE alerts for that month.  The table would look like:
</p>
<p>
<img src="http://blog.securitymonks.com/wp-content/uploads/2010/04/googletable3.png" width=500 />
</p>
<p>
When the CVE link is clicked on, the user is taken to the NIST NVD site where additional information is available.
</p>
<p>
<img src="http://blog.securitymonks.com/wp-content/uploads/2010/04/nvdsite.png" width=500 />
</p>
<p><h4><b>Using Perl to Create the JavaScript</b></h4>
</p>
<p>
The Perl code is rather simple now that we have the MySQL tables defined and the JavaScript we want to generate.  Much of the code consists of the JavaScript listed above.
</p>
<p>
<!-- Generator: GNU source-highlight 3.1.3<br />
by Lorenzo Bettini</p>
<p>http://www.lorenzobettini.it</p>
<p>http://www.gnu.org/software/src-highlite --></p>
<pre><tt><i><font color="#996633">#!/usr/local/bin/perl -w</font></i>
<b><font color="#3366FF">use</font></b> DBI<font color="#990000">;</font>
<b><font color="#3366FF">use</font></b> Time<font color="#990000">::</font>Local<font color="#990000">;</font>
<b><font color="#3366FF">use</font></b> POSIX <b><font color="#3366FF">qw</font></b><font color="#990000">(</font>strftime<font color="#990000">);</font>
<b><font color="#3366FF">use</font></b> LWP<font color="#990000">::</font>UserAgent<font color="#990000">;</font>
BEGIN<font color="#CC3333">{</font><b><font color="#3366FF">push</font></b> <font color="#009900">@INC</font><font color="#990000">,</font> <font color="#CC3333">"/home/jgerber/projects/nvd/perl"</font><font color="#CC3333">}</font>
<b><font color="#3366FF">use</font></b> ornl_feds <b><font color="#3366FF">qw</font></b><font color="#990000">(</font><font color="#009900">$db_host</font> <font color="#009900">$db</font> <font color="#009900">$mysql_user</font> <font color="#009900">$mysql_passwd</font> <font color="#990000">);</font>
<b><font color="#3366FF">sub</font></b> slide_nvd_alerts <font color="#CC3333">{</font>
  <b><font color="#3366FF">my</font></b><font color="#990000">(</font><font color="#009900">$min_date</font><font color="#990000">,</font><font color="#009900">$graph_name</font><font color="#990000">,</font><font color="#009900">$web_link</font><font color="#990000">,</font><font color="#009900">$dbh</font><font color="#990000">)</font> <font color="#990000">=</font> <font color="#009900">@_</font><font color="#990000">;</font>
  <b><font color="#3366FF">my</font></b> <font color="#009900">$slide</font> <font color="#990000">=</font> <font color="#CC3333">""</font><font color="#990000">;</font>
  <b><font color="#3366FF">my</font></b> <font color="#009900">$slide_head</font> <font color="#990000">=</font> <b><font color="#3366FF">qq</font></b><font color="#990000">!</font>
    <font color="#CC3333">&lt;script type='text/javascript'&gt;</font>
      google<font color="#990000">.</font><b><font color="#000000">load</font></b><font color="#990000">(</font><font color="#CC3333">'visualization'</font><font color="#990000">,</font> <font color="#CC3333">'1'</font><font color="#990000">,</font> <font color="#CC3333">{</font>packages<font color="#990000">:[</font><font color="#CC3333">'columnchart,table'</font><font color="#990000">]</font><font color="#CC3333">}</font><font color="#990000">);</font>
      google<font color="#990000">.</font><b><font color="#000000">setOnLoadCallback</font></b><font color="#990000">(</font>drawChart<font color="#990000">);</font>
      function <b><font color="#000000">drawChart</font></b><font color="#990000">()</font> <font color="#CC3333">{</font>
        var data <font color="#990000">=</font> new google<font color="#990000">.</font>visualization<font color="#990000">.</font><b><font color="#000000">DataTable</font></b><font color="#990000">();</font>
        data<font color="#990000">.</font><b><font color="#000000">addColumn</font></b><font color="#990000">(</font><font color="#CC3333">'date'</font><font color="#990000">,</font> <font color="#CC3333">'Date'</font><font color="#990000">);</font>
        data<font color="#990000">.</font><b><font color="#000000">addColumn</font></b><font color="#990000">(</font><font color="#CC3333">'number'</font><font color="#990000">,</font> <font color="#CC3333">'High'</font><font color="#990000">);</font>
        data<font color="#990000">.</font><b><font color="#000000">addColumn</font></b><font color="#990000">(</font><font color="#CC3333">'number'</font><font color="#990000">,</font> <font color="#CC3333">'Medium'</font><font color="#990000">);</font>
        data<font color="#990000">.</font><b><font color="#000000">addColumn</font></b><font color="#990000">(</font><font color="#CC3333">'number'</font><font color="#990000">,</font> <font color="#CC3333">'Low'</font><font color="#990000">);</font>
        data<font color="#990000">.</font><b><font color="#000000">addRows</font></b><font color="#990000">([</font>
<font color="#990000">!;</font>
   <b><font color="#3366FF">my</font></b> <font color="#009900">$slide_head_table</font> <font color="#990000">=</font> <b><font color="#3366FF">qq</font></b><font color="#990000">!</font>
        var data2 <font color="#990000">=</font> new google<font color="#990000">.</font>visualization<font color="#990000">.</font><b><font color="#000000">DataTable</font></b><font color="#990000">();</font>
        data2<font color="#990000">.</font><b><font color="#000000">addColumn</font></b><font color="#990000">(</font><font color="#CC3333">'date'</font><font color="#990000">,</font> <font color="#CC3333">'Date'</font><font color="#990000">);</font>
        data2<font color="#990000">.</font><b><font color="#000000">addColumn</font></b><font color="#990000">(</font><font color="#CC3333">'number'</font><font color="#990000">,</font> <font color="#CC3333">'High'</font><font color="#990000">);</font>
        data2<font color="#990000">.</font><b><font color="#000000">addColumn</font></b><font color="#990000">(</font><font color="#CC3333">'number'</font><font color="#990000">,</font> <font color="#CC3333">'Medium'</font><font color="#990000">);</font>
        data2<font color="#990000">.</font><b><font color="#000000">addColumn</font></b><font color="#990000">(</font><font color="#CC3333">'number'</font><font color="#990000">,</font> <font color="#CC3333">'Low'</font><font color="#990000">);</font>
        data2<font color="#990000">.</font><b><font color="#000000">addRows</font></b><font color="#990000">([</font>
<font color="#990000">!;</font>
   <b><font color="#3366FF">my</font></b> <font color="#009900">$table_div</font> <font color="#990000">=</font> <font color="#009900">$graph_name</font> <font color="#990000">.</font> <font color="#CC3333">"_tab"</font><font color="#990000">;</font>
   <b><font color="#3366FF">my</font></b> <font color="#009900">$slide_tail</font> <font color="#990000">=</font> <b><font color="#3366FF">qq</font></b><font color="#990000">!</font>
        var chart <font color="#990000">=</font> new google<font color="#990000">.</font>visualization<font color="#990000">.</font><b><font color="#000000">ColumnChart</font></b><font color="#990000">(</font>document<font color="#990000">.</font><b><font color="#000000">getElementById</font></b><font color="#990000">(</font><font color="#CC3333">'$graph_name'</font><font color="#990000">));</font>
        chart<font color="#990000">.</font><b><font color="#000000">draw</font></b><font color="#990000">(</font>data<font color="#990000">,</font> <font color="#CC3333">{</font>displayAnnotations<font color="#990000">:</font>true<font color="#990000">,</font> is3D<font color="#990000">:</font> true<font color="#990000">,</font> isStacked<font color="#990000">:</font> true<font color="#990000">,</font> min<font color="#990000">:</font> <font color="#993399">0</font><font color="#990000">,</font> allowHtml<font color="#990000">:</font> true<font color="#990000">,</font>
 colors<font color="#990000">:[</font><font color="#CC3333">{</font>color<font color="#990000">:</font><font color="#CC3333">'#E41B17'</font><font color="#990000">,</font> darker<font color="#990000">:</font><font color="#CC3333">'#C11B17'</font><font color="#CC3333">}</font><font color="#990000">,</font> <font color="#CC3333">{</font>color<font color="#990000">:</font><font color="#CC3333">'#FFA500'</font><font color="#990000">,</font> darker<font color="#990000">:</font><font color="#CC3333">'#E56717'</font><font color="#CC3333">}</font><font color="#990000">,</font>
<font color="#CC3333">{</font>color<font color="#990000">:</font><font color="#CC3333">'#FFE87C'</font><font color="#990000">,</font> darker<font color="#990000">:</font><font color="#CC3333">'#C8B560'</font><font color="#CC3333">}</font><font color="#990000">]</font><font color="#CC3333">}</font><font color="#990000">);</font>
        var table <font color="#990000">=</font> new google<font color="#990000">.</font>visualization<font color="#990000">.</font><b><font color="#000000">Table</font></b><font color="#990000">(</font>document<font color="#990000">.</font><b><font color="#000000">getElementById</font></b><font color="#990000">(</font><font color="#CC3333">'$table_div'</font><font color="#990000">));</font>
        table<font color="#990000">.</font><b><font color="#000000">draw</font></b><font color="#990000">(</font>data2<font color="#990000">,</font> <font color="#CC3333">{</font>showRowNumber<font color="#990000">:</font> true<font color="#990000">,</font> sortAscending<font color="#990000">:</font> false<font color="#990000">,</font> sortColumn<font color="#990000">:</font> <font color="#993399">0</font><font color="#990000">,</font> allowHtml<font color="#990000">:</font> true<font color="#CC3333">}</font><font color="#990000">);</font>
            <font color="#CC3333">//</font> Set a <font color="#CC3333">'select'</font> event listener <b><font color="#3366FF">for</font></b> the table<font color="#990000">.</font>
        <font color="#CC3333">//</font> When the table is selected<font color="#990000">,</font>
        <font color="#CC3333">//</font> we set the selection on the line graph<font color="#990000">.</font>
        google<font color="#990000">.</font>visualization<font color="#990000">.</font>events<font color="#990000">.</font><b><font color="#000000">addListener</font></b><font color="#990000">(</font>table<font color="#990000">,</font> <font color="#CC3333">'select'</font><font color="#990000">,</font> <b><font color="#000000">function</font></b><font color="#990000">()</font> <font color="#CC3333">{</font>
          chart<font color="#990000">.</font><b><font color="#000000">setSelection</font></b><font color="#990000">([</font><font color="#CC3333">{</font>row<font color="#990000">:</font> table<font color="#990000">.</font><b><font color="#000000">getSelection</font></b><font color="#990000">()[</font><font color="#993399">0</font><font color="#990000">].</font>row<font color="#990000">,</font> column<font color="#990000">:</font> <font color="#993399">1</font><font color="#CC3333">}</font><font color="#990000">]);</font>
         <font color="#CC3333">}</font><font color="#990000">);</font>
      <font color="#CC3333">//</font> Set a <font color="#CC3333">'select'</font> event listener <b><font color="#3366FF">for</font></b> the graph<font color="#990000">.</font>
        <font color="#CC3333">//</font> When the graph is selected<font color="#990000">,</font>
        <font color="#CC3333">//</font> we set the selection on the table<font color="#990000">.</font>
        google<font color="#990000">.</font>visualization<font color="#990000">.</font>events<font color="#990000">.</font><b><font color="#000000">addListener</font></b><font color="#990000">(</font>chart<font color="#990000">,</font> <font color="#CC3333">'select'</font><font color="#990000">,</font> <b><font color="#000000">function</font></b><font color="#990000">()</font> <font color="#CC3333">{</font>
           table<font color="#990000">.</font><b><font color="#000000">setSelection</font></b><font color="#990000">([</font><font color="#CC3333">{</font>row<font color="#990000">:</font> chart<font color="#990000">.</font><b><font color="#000000">getSelection</font></b><font color="#990000">()[</font><font color="#993399">0</font><font color="#990000">].</font>row<font color="#CC3333">}</font><font color="#990000">]);</font>
        <font color="#CC3333">}</font><font color="#990000">);</font>
      <font color="#CC3333">}</font>
    <font color="#CC3333">&lt;/script&gt;</font>
<font color="#990000">!;</font>
   <b><font color="#3366FF">if</font></b> <font color="#990000">(</font><font color="#009900">$min_date</font> <b><font color="#3366FF">eq</font></b> <font color="#CC3333">""</font><font color="#990000">)</font> <font color="#CC3333">{</font>
      <b><font color="#3366FF">my</font></b> <font color="#009900">$sql2</font> <font color="#990000">=</font> <b><font color="#3366FF">qq</font></b><font color="#CC3333">{ SELECT min(published) FROM vulnerabilities.nvdcve }</font><font color="#990000">;</font>
      <b><font color="#3366FF">my</font></b> <font color="#009900">$sth2</font> <font color="#990000">=</font> <font color="#009900">$dbh</font><font color="#990000">-&gt;</font><b><font color="#000000">prepare</font></b><font color="#990000">(</font> <font color="#009900">$sql2</font> <font color="#990000">);</font>
      <b><font color="#3366FF">my</font></b> <font color="#009900">$rc2</font> <font color="#990000">=</font> <font color="#009900">$sth2</font><font color="#990000">-&gt;</font><b><font color="#000000">execute</font></b><font color="#990000">();</font>
      <b><font color="#3366FF">if</font></b> <font color="#990000">(</font><font color="#009900">$rc2</font><font color="#990000">)</font> <font color="#CC3333">{</font>
         <font color="#009900">$min_date</font> <font color="#990000">=</font> <font color="#009900">$sth2</font><font color="#990000">-&gt;</font><b><font color="#000000">fetchrow_array</font></b><font color="#990000">();</font>
      <font color="#CC3333">}</font>
   <font color="#CC3333">}</font>
   <b><font color="#3366FF">my</font></b> <font color="#009900">$table_data</font> <font color="#990000">=</font> <font color="#CC3333">""</font><font color="#990000">;</font>
   <b><font color="#3366FF">my</font></b> <font color="#009900">$graph_data</font> <font color="#990000">=</font> <font color="#CC3333">""</font><font color="#990000">;</font>
   <b><font color="#3366FF">my</font></b> <font color="#009900">$sql2</font> <font color="#990000">=</font> <b><font color="#3366FF">qq</font></b><font color="#CC3333">{</font> <b><font color="#3366FF">select</font></b> <b><font color="#000000">date_format</font></b><font color="#990000">(</font>published<font color="#990000">,</font><font color="#CC3333">'%Y-%m'</font><font color="#990000">),</font>severity<font color="#990000">,</font><b><font color="#000000">count</font></b><font color="#990000">(</font>severity<font color="#990000">)</font>
      FROM vulnerabilities<font color="#990000">.</font>nvdcve where published <font color="#990000">&gt;=</font> <font color="#990000">?</font> group by <b><font color="#000000">date_format</font></b><font color="#990000">(</font>published<font color="#990000">,</font><font color="#CC3333">'%Y-%m'</font><font color="#990000">),</font>severity <font color="#CC3333">}</font><font color="#990000">;</font>
   <b><font color="#3366FF">my</font></b> <font color="#009900">$sth2</font> <font color="#990000">=</font> <font color="#009900">$dbh</font><font color="#990000">-&gt;</font><b><font color="#000000">prepare</font></b><font color="#990000">(</font> <font color="#009900">$sql2</font> <font color="#990000">);</font>
   <b><font color="#3366FF">my</font></b> <font color="#009900">$rc2</font> <font color="#990000">=</font> <font color="#009900">$sth2</font><font color="#990000">-&gt;</font><b><font color="#000000">execute</font></b><font color="#990000">(</font><font color="#009900">$min_date</font><font color="#990000">);</font>
   <b><font color="#3366FF">if</font></b> <font color="#990000">(</font><font color="#009900">$rc2</font><font color="#990000">)</font> <font color="#CC3333">{</font>
      <b><font color="#3366FF">my</font></b> <font color="#990000">(</font><font color="#009900">$change</font><font color="#990000">,</font><font color="#009900">$virgin</font><font color="#990000">,</font><font color="#009900">$ht</font><font color="#990000">,</font><font color="#009900">$mt</font><font color="#990000">,</font><font color="#009900">$lt</font><font color="#990000">,</font><font color="#009900">$mmax_date</font><font color="#990000">)</font> <font color="#990000">=</font> <font color="#990000">(</font><font color="#CC3333">""</font><font color="#990000">,</font><font color="#993399">1</font><font color="#990000">,</font><font color="#993399">0</font><font color="#990000">,</font><font color="#993399">0</font><font color="#990000">,</font><font color="#993399">0</font><font color="#990000">,</font><font color="#CC3333">""</font><font color="#990000">);</font>
      <b><font color="#3366FF">while</font></b> <font color="#990000">(</font><b><font color="#3366FF">my</font></b><font color="#990000">(</font><font color="#009900">$snapshot_date</font><font color="#990000">,</font> <font color="#009900">$severity</font><font color="#990000">,</font> <font color="#009900">$pcount</font><font color="#990000">)</font> <font color="#990000">=</font> <font color="#009900">$sth2</font><font color="#990000">-&gt;</font><b><font color="#000000">fetchrow_array</font></b><font color="#990000">())</font> <font color="#CC3333">{</font>
         <b><font color="#3366FF">my</font></b> <font color="#009900">$sql3</font> <font color="#990000">=</font> <b><font color="#3366FF">qq</font></b><font color="#CC3333">{</font> SELECT <b><font color="#000000">max</font></b><font color="#990000">(</font>published<font color="#990000">)</font> FROM vulnerabilities<font color="#990000">.</font>nvdcve where
<b><font color="#000000">date_format</font></b><font color="#990000">(</font>published<font color="#990000">,</font><font color="#CC3333">'%Y-%m'</font><font color="#990000">)=?</font> <font color="#CC3333">}</font><font color="#990000">;</font>
         <b><font color="#3366FF">my</font></b> <font color="#009900">$sth3</font> <font color="#990000">=</font> <font color="#009900">$dbh</font><font color="#990000">-&gt;</font><b><font color="#000000">prepare</font></b><font color="#990000">(</font> <font color="#009900">$sql3</font> <font color="#990000">);</font>
         <b><font color="#3366FF">my</font></b> <font color="#009900">$rc3</font> <font color="#990000">=</font> <font color="#009900">$sth3</font><font color="#990000">-&gt;</font><b><font color="#000000">execute</font></b><font color="#990000">(</font><font color="#009900">$snapshot_date</font><font color="#990000">);</font>
         <font color="#009900">$max_date</font> <font color="#990000">=</font>  <font color="#009900">$sth3</font><font color="#990000">-&gt;</font><b><font color="#000000">fetchrow_array</font></b><font color="#990000">();</font>
         <font color="#009900">$max_date</font> <font color="#990000">=~</font> <b><font color="#3366FF">s</font></b><font color="#FF6600">/ \S+$//</font><font color="#990000">;</font>
         <b><font color="#3366FF">if</font></b> <font color="#990000">(</font><font color="#009900">$change</font> ne <font color="#009900">$snapshot_date</font><font color="#990000">)</font> <font color="#CC3333">{</font>
            <b><font color="#3366FF">if</font></b> <font color="#990000">(!</font> <font color="#009900">$virgin</font><font color="#990000">)</font> <font color="#CC3333">{</font>
                <b><font color="#3366FF">my</font></b><font color="#990000">(</font><font color="#009900">$year</font><font color="#990000">,</font><font color="#009900">$month</font><font color="#990000">,</font><font color="#009900">$day</font><font color="#990000">)</font> <font color="#990000">=</font> <b><font color="#3366FF">split</font></b><font color="#990000">(</font><font color="#CC3333">"-"</font><font color="#990000">,</font><font color="#009900">$mmax_date</font><font color="#990000">);</font>
                <b><font color="#3366FF">my</font></b> <font color="#009900">$mmonth</font> <font color="#990000">=</font> <font color="#009900">$month</font><font color="#990000">;</font>
                <font color="#009900">$month</font><font color="#990000">--;</font>
                <font color="#009900">$graph_data</font> <font color="#990000">.=</font> <b><font color="#3366FF">qq</font></b><font color="#990000">!</font>           <font color="#990000">[</font>new <b><font color="#000000">Date</font></b><font color="#990000">(</font><font color="#009900">$year</font><font color="#990000">,</font> <font color="#009900">$month</font><font color="#990000">,</font> <font color="#009900">$day</font><font color="#990000">),</font><font color="#009900">$ht</font><font color="#990000">,</font><font color="#009900">$mt</font><font color="#990000">,</font><font color="#009900">$lt</font><font color="#990000">],</font>
<font color="#990000">!;</font>
                <font color="#009900">$table_data</font> <font color="#990000">.=</font> <b><font color="#3366FF">qq</font></b><font color="#990000">!</font>           <font color="#990000">[</font><font color="#CC3333">{</font>v<font color="#990000">:</font>new <b><font color="#000000">Date</font></b><font color="#990000">(</font><font color="#009900">$year</font><font color="#990000">,</font> <font color="#009900">$month</font><font color="#990000">,</font> <font color="#009900">$day</font><font color="#990000">),</font>
              f<font color="#990000">:</font><font color="#CC3333">'&lt;a href="$web_link/cvealerts.php?date=$year-$mmonth"&gt;$mmax_date&lt;/a&gt;'</font><font color="#CC3333">}</font><font color="#990000">,</font> <font color="#009900">$ht</font><font color="#990000">,</font><font color="#009900">$mt</font><font color="#990000">,</font><font color="#009900">$lt</font><font color="#990000">],</font>
<font color="#990000">!;</font>
                <font color="#990000">(</font><font color="#009900">$ht</font><font color="#990000">,</font><font color="#009900">$mt</font><font color="#990000">,</font><font color="#009900">$lt</font><font color="#990000">)</font> <font color="#990000">=</font> <font color="#990000">(</font><font color="#993399">0</font><font color="#990000">,</font><font color="#993399">0</font><font color="#990000">,</font><font color="#993399">0</font><font color="#990000">);</font>
             <font color="#CC3333">}</font>
             <font color="#009900">$change</font> <font color="#990000">=</font> <font color="#009900">$snapshot_date</font><font color="#990000">;</font>
          <font color="#CC3333">}</font>
          <b><font color="#3366FF">if</font></b> <font color="#990000">(</font><font color="#009900">$severity</font> <b><font color="#3366FF">eq</font></b> <font color="#CC3333">"HIGH"</font><font color="#990000">)</font> <font color="#CC3333">{</font> <font color="#009900">$ht</font> <font color="#990000">=</font> <font color="#009900">$pcount</font><font color="#990000">;</font> <font color="#CC3333">}</font>
          <b><font color="#3366FF">elsif</font></b> <font color="#990000">(</font><font color="#009900">$severity</font> <b><font color="#3366FF">eq</font></b> <font color="#CC3333">"MEDIUM"</font><font color="#990000">)</font> <font color="#CC3333">{</font> <font color="#009900">$mt</font> <font color="#990000">=</font> <font color="#009900">$pcount</font><font color="#990000">;</font> <font color="#CC3333">}</font>
          <b><font color="#3366FF">elsif</font></b> <font color="#990000">(</font><font color="#009900">$severity</font> <b><font color="#3366FF">eq</font></b> <font color="#CC3333">"LOW"</font><font color="#990000">)</font> <font color="#CC3333">{</font> <font color="#009900">$lt</font> <font color="#990000">=</font> <font color="#009900">$pcount</font><font color="#990000">;</font> <font color="#CC3333">}</font>
          <b><font color="#3366FF">if</font></b> <font color="#990000">(</font><font color="#009900">$mmax_date</font> <b><font color="#3366FF">eq</font></b> <font color="#CC3333">""</font><font color="#990000">)</font> <font color="#CC3333">{</font> <font color="#009900">$mmax_date</font> <font color="#990000">=</font> <font color="#009900">$max_date</font><font color="#990000">;</font> <font color="#CC3333">}</font>
          <b><font color="#3366FF">if</font></b> <font color="#990000">(</font><font color="#009900">$mmax_date</font> lt <font color="#009900">$max_date</font><font color="#990000">)</font> <font color="#CC3333">{</font> <font color="#009900">$mmax_date</font> <font color="#990000">=</font> <font color="#009900">$max_date</font><font color="#990000">;</font> <font color="#CC3333">}</font>
          <font color="#009900">$virgin</font> <font color="#990000">=</font> <font color="#993399">0</font><font color="#990000">;</font>
      <font color="#CC3333">}</font>
      <b><font color="#3366FF">my</font></b><font color="#990000">(</font><font color="#009900">$year</font><font color="#990000">,</font><font color="#009900">$month</font><font color="#990000">,</font><font color="#009900">$day</font><font color="#990000">)</font> <font color="#990000">=</font> <b><font color="#3366FF">split</font></b><font color="#990000">(</font><font color="#CC3333">"-"</font><font color="#990000">,</font><font color="#009900">$mmax_date</font><font color="#990000">);</font>
      <b><font color="#3366FF">my</font></b> <font color="#009900">$mmonth</font> <font color="#990000">=</font> <font color="#009900">$month</font><font color="#990000">;</font>
      <font color="#009900">$month</font><font color="#990000">--;</font>
      <font color="#009900">$graph_data</font> <font color="#990000">.=</font> <b><font color="#3366FF">qq</font></b><font color="#990000">!</font>           <font color="#990000">[</font>new <b><font color="#000000">Date</font></b><font color="#990000">(</font><font color="#009900">$year</font><font color="#990000">,</font> <font color="#009900">$month</font><font color="#990000">,</font> <font color="#009900">$day</font><font color="#990000">),</font><font color="#009900">$ht</font><font color="#990000">,</font><font color="#009900">$mt</font><font color="#990000">,</font><font color="#009900">$lt</font><font color="#990000">]</font>
<font color="#990000">!;</font>
     <font color="#009900">$table_data</font> <font color="#990000">.=</font> <b><font color="#3366FF">qq</font></b><font color="#990000">!</font>           <font color="#990000">[</font><font color="#CC3333">{</font>v<font color="#990000">:</font>new <b><font color="#000000">Date</font></b><font color="#990000">(</font><font color="#009900">$year</font><font color="#990000">,</font> <font color="#009900">$month</font><font color="#990000">,</font> <font color="#009900">$day</font><font color="#990000">),</font>
              f<font color="#990000">:</font><font color="#CC3333">'&lt;a href="$web_link/cvealerts.php?date=$year-$mmonth"&gt;$mmax_date&lt;/a&gt;'</font><font color="#CC3333">}</font><font color="#990000">,</font> <font color="#009900">$ht</font><font color="#990000">,</font><font color="#009900">$mt</font><font color="#990000">,</font><font color="#009900">$lt</font><font color="#990000">],</font>
<font color="#990000">!;</font>
   <font color="#CC3333">}</font>
   <font color="#009900">$table_data</font> <font color="#990000">.=</font> <font color="#CC3333">"        ]);\n"</font><font color="#990000">;</font>
   <font color="#009900">$graph_data</font> <font color="#990000">.=</font> <font color="#CC3333">"        ]);\n"</font><font color="#990000">;</font>
   <font color="#009900">$slide</font> <font color="#990000">=</font> <font color="#009900">$slide_head</font> <font color="#990000">.</font>  <font color="#009900">$graph_data</font> <font color="#990000">.</font> <font color="#009900">$slide_head_table</font> <font color="#990000">.</font> <font color="#009900">$table_data</font> <font color="#990000">.</font> <font color="#009900">$slide_tail</font><font color="#990000">;</font>
   <b><font color="#3366FF">return</font></b><font color="#990000">(</font><font color="#009900">$slide</font><font color="#990000">);</font>
<font color="#CC3333">}</font>
<b><font color="#3366FF">sub</font></b> slide_body <font color="#CC3333">{</font>
  <b><font color="#3366FF">my</font></b><font color="#990000">(</font><font color="#009900">$graph_name</font><font color="#990000">,</font><font color="#009900">$title</font><font color="#990000">,</font><font color="#009900">$style</font><font color="#990000">)</font> <font color="#990000">=</font> <font color="#009900">@_</font><font color="#990000">;</font>
  <b><font color="#3366FF">my</font></b> <font color="#009900">$table_name</font> <font color="#990000">=</font> <font color="#009900">$graph_name</font> <font color="#990000">.</font> <font color="#CC3333">"_tab"</font><font color="#990000">;</font>
  <b><font color="#3366FF">my</font></b> <font color="#009900">$table_text</font> <font color="#990000">=</font> <font color="#CC3333">"div id=\"$table_name\""</font><font color="#990000">;</font>
  <b><font color="#3366FF">if</font></b> <font color="#990000">(</font><font color="#009900">$style</font> ne <font color="#CC3333">""</font><font color="#990000">)</font> <font color="#CC3333">{</font>
     <font color="#009900">$table_text</font> <font color="#990000">.=</font> <font color="#CC3333">" style=\'$style\'"</font><font color="#990000">;</font>
  <font color="#CC3333">}</font>
  <b><font color="#3366FF">my</font></b> <font color="#009900">$slide2</font> <font color="#990000">=</font> <font color="#CC3333">"&lt;h3&gt;$title&lt;/h3&gt;\n"</font><font color="#990000">;</font>
  <b><font color="#3366FF">my</font></b> <font color="#009900">$itext</font> <font color="#990000">=</font> <font color="#CC3333">"div id=\"$graph_name\""</font><font color="#990000">;</font>
  <b><font color="#3366FF">if</font></b> <font color="#990000">(</font><font color="#009900">$style</font> ne <font color="#CC3333">""</font><font color="#990000">)</font> <font color="#CC3333">{</font>
     <font color="#009900">$itext</font> <font color="#990000">.=</font> <font color="#CC3333">" style=\'$style\'"</font><font color="#990000">;</font>
  <font color="#CC3333">}</font>
  <font color="#009900">$slide2</font> <font color="#990000">.=</font> <b><font color="#3366FF">qq</font></b><font color="#CC3333">{</font>
    <font color="#CC3333">&lt;table&gt;&lt;tr&gt;</font>
    <font color="#CC3333">&lt;td valign="top"&gt;&lt;$itext&gt;&lt;/div&gt;&lt;/td&gt;</font>
    <font color="#CC3333">&lt;td valign="top"&gt;&lt;$table_text&gt;&lt;/div&gt;&lt;/td&gt;</font>
    <font color="#CC3333">&lt;td valign="top"&gt;</font>   <font color="#CC3333">&lt;/td&gt;</font>
    <font color="#CC3333">&lt;td valign="top"&gt;&lt;div id="labels"&gt;&lt;/div&gt;&lt;/td&gt;</font>
    <font color="#CC3333">&lt;/tr&gt;&lt;/table&gt;</font>
  <font color="#CC3333">}</font><font color="#990000">;</font>
  <b><font color="#3366FF">return</font></b><font color="#990000">(</font><font color="#009900">$slide2</font><font color="#990000">);</font>
<font color="#CC3333">}</font>
<i><font color="#996633"># Main</font></i>
<b><font color="#3366FF">my</font></b> <font color="#009900">$web_link</font> <font color="#990000">=</font> <font color="#CC3333">"/nvd"</font><font color="#990000">;</font>
<b><font color="#3366FF">my</font></b> <font color="#009900">$results_dir</font> <font color="#990000">=</font> <font color="#CC3333">"/data/html"</font> <font color="#990000">.</font> <font color="#009900">$web_link</font><font color="#990000">;</font>
<b><font color="#3366FF">my</font></b> <font color="#009900">$result_file</font> <font color="#990000">=</font> <font color="#009900">$results_dir</font> <font color="#990000">.</font> <font color="#CC3333">"/nvdcve_stats.html"</font><font color="#990000">;</font>
<b><font color="#3366FF">my</font></b> <font color="#009900">$debug</font> <font color="#990000">=</font> <font color="#993399">1</font><font color="#990000">;</font>
<b><font color="#3366FF">my</font></b> <font color="#009900">$db</font> <font color="#990000">=</font> <font color="#CC3333">"vulnerabilities"</font><font color="#990000">;</font>
<b><font color="#3366FF">local</font></b><font color="#990000">(</font><font color="#009900">$dbh</font><font color="#990000">)</font> <font color="#990000">=</font> DBI<font color="#990000">-&gt;</font><b><font color="#000000">connect</font></b><font color="#990000">(</font><font color="#CC3333">"DBI:mysql:$db:$db_host"</font><font color="#990000">,</font> <font color="#009900">$mysql_user</font><font color="#990000">,</font> <font color="#009900">$mysql_passwd</font><font color="#990000">)</font> <font color="#990000">||</font>
   <b><font color="#3366FF">die</font></b> <font color="#CC3333">"ERROR: Connecting: $DBI::errstr\n"</font><font color="#990000">;</font>
<font color="#009900">$slides_data</font> <font color="#990000">.=</font> <font color="#990000">&amp;</font><b><font color="#000000">slide_body</font></b><font color="#990000">(</font><font color="#CC3333">"s4graph"</font><font color="#990000">,</font><font color="#CC3333">"NVD CVE Alerts"</font><font color="#990000">,</font><font color="#CC3333">"width:700px; height:400px;"</font><font color="#990000">);</font>
<font color="#009900">$slides_head</font> <font color="#990000">.=</font> <font color="#990000">&amp;</font><b><font color="#000000">slide_nvd_alerts</font></b><font color="#990000">(</font><font color="#CC3333">""</font><font color="#990000">,</font><font color="#CC3333">"s4graph"</font><font color="#990000">,</font><font color="#009900">$web_link</font><font color="#990000">,</font><font color="#009900">$dbh</font><font color="#990000">);</font>
<b><font color="#3366FF">open</font></b><font color="#990000">(</font>OUTFILE<font color="#990000">,</font><font color="#CC3333">"&gt;$result_file"</font><font color="#990000">);</font>
<b><font color="#3366FF">print</font></b> OUTFILE <font color="#CC3333">"&lt;HTML&gt;\n&lt;HEAD&gt;&lt;TITLE&gt;NVD CVE Statistics&lt;/TITLE&gt;\n"</font><font color="#990000">;</font>
<b><font color="#3366FF">print</font></b> OUTFILE <font color="#CC3333">"&lt;script type=\"text/javascript\" src=\"http://www.google.com/jsapi\"&gt;&lt;/script&gt;\n"</font><font color="#990000">;</font>
<b><font color="#3366FF">print</font></b> OUTFILE <font color="#009900">$slides_head</font><font color="#990000">;</font>
<b><font color="#3366FF">print</font></b> OUTFILE <font color="#CC3333">"&lt;/HEAD&gt;\n&lt;BODY&gt;\n"</font><font color="#990000">;</font>
<b><font color="#3366FF">print</font></b> OUTFILE <font color="#009900">$slides_data</font><font color="#990000">;</font>
<b><font color="#3366FF">print</font></b> OUTFILE <font color="#CC3333">"&lt;/BODY&gt;\n"</font><font color="#990000">;</font>
<b><font color="#3366FF">close</font></b><font color="#990000">(</font>OUTFILE<font color="#990000">);</font>
<b><font color="#3366FF">exit</font></b><font color="#990000">;</font>
</tt></pre>
</p>
<p><h3>Other Charting Options</h3>
</p>
<p>
Google, Google users, and other companies have <a href="http://code.google.com/apis/visualization/documentation/gallery.html">shared</a> some JavaScript visualizations built on the Google Visualization API to help you get started.  Below are some example:
</p>
<table class="gviz_gallery" id="gviz_gallery" cellpadding="2" cellspacing="0">
<tr class="gallery_filter_featured gallery_filter_charts gallery_filter_google">
<td><a href="http://code.google.com/apis/visualization/documentation/gallery/annotatedtimeline.html"><br />
    <img src="http://blog.securitymonks.com/wp-content/uploads/2010/04/icon-annotatedtimeline.png" height="60" width="120" /></a></td>
<td><a class="gallery_doc_title" href="http://blog.securitymonks.com/apis/visualization/documentation/gallery/annotatedtimeline.html">Annotated Time Line</a> (<a class="gallery_gwt_link" href="http://code.google.com/docreader/#p=gwt-google-apis&amp;s=gwt-google-apis&amp;t=Visualization">GWT Integrated</a>)</p>
<p class="gallery_description">An animated time series chart.</p>
<p class="gallery_author">By: Google</p>
</td>
</tr>
<tr class="gallery_filter_charts gallery_filter_google">
<td><a href="http://code.google.com/apis/visualization/documentation/gallery/areachart.html"><br />
    <img src="http://blog.securitymonks.com/wp-content/uploads/2010/04/icon-areachart.png" height="60" width="120" /></a></td>
<td><a href="http://code.google.com/apis/visualization/documentation/gallery/areachart.html"  class="gallery_doc_title">Area Chart </a> (<a class="gallery_gwt_link" href="http://code.google.com/docreader/#p=gwt-google-apis&amp;s=gwt-google-apis&amp;t=Visualization">GWT Integrated</a>)</p>
<p class="gallery_description">Interactive area chart.</p>
<p class="gallery_author">By: Google</p>
</td>
</tr>
<tr class="gallery_filter_charts gallery_filter_google">
<td><a href="http://code.google.com/apis/visualization/documentation/gallery/barchart.html"><br />
    <img src="http://blog.securitymonks.com/wp-content/uploads/2010/04/icon-barchart.png" height="60" width="120" /></a></td>
<td><a class="gallery_doc_title" href="http://blog.securitymonks.com/apis/visualization/documentation/gallery/barchart.html">Bar Chart</a> (<a class="gallery_gwt_link" href="http://code.google.com/docreader/#p=gwt-google-apis&amp;s=gwt-google-apis&amp;t=Visualization">GWT Integrated</a>)</p>
<p class="gallery_description">Interactive bar chart.</p>
<p class="gallery_author">By: Google</p>
</td>
</tr>
<tr class="gallery_filter_featured gallery_filter_charts gallery_filter_fun">
<td><a href="http://visapi-gadgets.googlecode.com/svn/trunk/barsofstuff/doc.html" onclick="return warn()"><br />
    <img src="http://visapi-gadgets.googlecode.com/svn/trunk/barsofstuff/icon.png" height="60" width="120" /></a></td>
<td><a href="http://visapi-gadgets.googlecode.com/svn/trunk/barsofstuff/doc.html" class="gallery_doc_title" onClick="return warn()">Bars of Stuff</a></p>
<p class="gallery_description">Fun bar charts using images of trains, chocolate, worms, and more.</p>
<p class="gallery_author">By: The visapi project</p>
</td>
</tr>
<tr class="gallery_filter_charts">
<td><a href="http://informatics.systemsbiology.net/visualizations/heatmap/bioheatmap.html" onclick="return warn()"><img src="http://blog.securitymonks.com/wp-content/uploads/2010/04/bioheatmap_screenshot.png" height="60" width="120" /></a></td>
<td><a href="http://informatics.systemsbiology.net/visualizations/heatmap/bioheatmap.html" class="gallery_doc_title" onClick="return warn()">Bio Heat Map</a></p>
<p class="gallery_description">Heatmaps are a useful way to visualize matricies of data. Scientists often use green-black-red heatmaps to visualize gene expression data from microarrays. This visualization supports both three color heatmaps (ex: green to black to red) and two color heatmaps (ex: white to yellow).</p>
<p class="gallery_author">By: <a href="http://www.systemsbiology.org/">Institute for Systems Biology</a></p>
</td>
</tr>
<tr class="gallery_filter_charts gallery_filter_google">
<td><a href="http://code.google.com/apis/visualization/documentation/gallery/columnchart.html"><br />
    <img src="http://blog.securitymonks.com/wp-content/uploads/2010/04/icon-columnchart.png" height="60" width="120" /></a></td>
<td><a class="gallery_doc_title" href="http://code.google.com/apis/visualization/documentation/gallery/columnchart.html">Column Chart</a> (<a class="gallery_gwt_link" href="http://code.google.com/docreader/#p=gwt-google-apis&amp;s=gwt-google-apis&amp;t=Visualization">GWT Integrated</a>)</p>
<p class="gallery_description">Interactive column chart.</p>
<p class="gallery_author">By: Google</p>
</td>
</tr>
<tr class="gallery_filter_featured gallery_filter_project">
<td><a href="http://www.drasticdata.nl/DrasticTreemapGApi/index.html"><br />
    <img src="http://blog.securitymonks.com/wp-content/uploads/2010/04/icon-drastictreemap.png" height="60" width="120" /></a></td>
<td><a class="gallery_doc_title" href="http://www.drasticdata.nl/DrasticTreemapGApi/index.html">Drastic Treemap</a></p>
<p class="gallery_description">A dynamic treemap in Flash.</p>
<p class="gallery_author">By: <a href="http://www.drasticdata.nl">DrasticData</a></p>
</td>
</tr>
<tr class="gallery_filter_featured gallery_filter_charts">
<td><a href="http://danvk.org/dygraphs/"><br />
    <img src="http://blog.securitymonks.com/wp-content/uploads/2010/04/icon-dygraphs.png" height="60" width="120" /></a></td>
<td><a class="gallery_doc_title" href="http://danvk.org/dygraphs/">Dygraphs</a></p>
<p class="gallery_description">The dygraphs JavaScript library produces interactive, zoomable charts of time series.</p>
<p class="gallery_author">By: Dan Vanderkam</p>
</td>
</tr>
<tr class="gallery_filter_tables">
<td><a href="http://informatics.systemsbiology.net/visualizations/heatmap/FilterDataTableControl.html" onclick="return warn()"><img src="http://systemsbiology-visualizations.googlecode.com/svn/trunk/src/main/images/icon_filterDataTableControl.png" height="60" width="120" /></a></td>
<td><a href="http://informatics.systemsbiology.net/visualizations/heatmap/FilterDataTableControl.html" class="gallery_doc_title" onClick="return warn()">Filters </a></p>
<p class="gallery_description">A Visualization that acts as a control over other visualizations. It is rendered within the browser using HTML. This visualization offers the ability to select some criteria to filter the DataTable used by the controlled visualizations.</p>
<p class="gallery_author">By: <a href="http://www.systemsbiology.org/">Institute for Systems Biology</a></p>
</td>
</tr>
<tr class="gallery_filter_featured gallery_filter_charts gallery_filter_google">
<td><a href="http://code.google.com/apis/visualization/documentation/gallery/gauge.html"><br />
    <img src="http://blog.securitymonks.com/wp-content/uploads/2010/04//icon-gauge.png" height="60" width="120" /></a></td>
<td><a class="gallery_doc_title" href="http://code.google.com/apis/visualization/documentation/gallery/gauge.html">Gauge</a> (<a class="gallery_gwt_link" href="http://code.google.com/docreader/#p=gwt-google-apis&amp;s=gwt-google-apis&amp;t=Visualization">GWT Integrated</a>)</p>
<p class="gallery_description">Each numeric value is displayed as a gauge.</p>
<p class="gallery_author">By: Google</p>
</td>
</tr>
<tr class="gallery_filter_maps gallery_filter_featured gallery_filter_google">
<td><a href="http://code.google.com/apis/visualization/documentation/gallery/geomap.html"><br />
    <img src="http://blog.securitymonks.com/wp-content/uploads/2010/04//icon-geomap.png" height="60" width="120" /></a></td>
<td><a class="gallery_doc_title" href="http://code.google.com/apis/visualization/documentation/gallery/geomap.html">Geo Map</a> (<a class="gallery_gwt_link" href="http://code.google.com/docreader/#p=gwt-google-apis&amp;s=gwt-google-apis&amp;t=Visualization">GWT Integrated</a>)</p>
<p class="gallery_description">A map of a country, continent, or region map, with colors and values assigned to specific regions. Values are displayed as a color scale, and you can specify optional hovertext for regions.</p>
<p class="gallery_author">By: Google</p>
</td>
</tr>
<tr class="gallery_filter_maps gallery_filter_featured gallery_filter_google">
<td><a href="http://code.google.com/apis/visualization/documentation/gallery/intensitymap.html"><br />
    <img src="http://blog.securitymonks.com/wp-content/uploads/2010/04/icon-intensitymap.png" height="60" width="120" /></a></td>
<td><a class="gallery_doc_title" href="http://code.google.com/apis/visualization/documentation/gallery/intensitymap.html">Intensity Map</a> (<a class="gallery_gwt_link" href="http://code.google.com/docreader/#p=gwt-google-apis&amp;s=gwt-google-apis&amp;t=Visualization">GWT Integrated</a>)</p>
<p class="gallery_description">An intensity map that highlights regions or countries based on relative values.</p>
<p class="gallery_author">By: Google</p>
</td>
</tr>
<tr class="gallery_filter_charts gallery_filter_google">
<td><a href="http://code.google.com/apis/visualization/documentation/gallery/linechart.html"><br />
    <img src="http://blog.securitymonks.com/wp-content/uploads/2010/04/icon-linechart.png" height="60" width="120" /></a></td>
<td><a class="gallery_doc_title" href="http://code.google.com/apis/visualization/documentation/gallery/linechart.html">Line Chart</a> (<a class="gallery_gwt_link" href="http://code.google.com/docreader/#p=gwt-google-apis&amp;s=gwt-google-apis&amp;t=Visualization">GWT Integrated</a>)</p>
<p class="gallery_description">Interactive line chart.</p>
<p class="gallery_author">By: Google</p>
</td>
</tr>
<tr class="gallery_filter_featured gallery_filter_charts gallery_filter_tables gallery_filter_analytics">
<td><a href="http://magic-table.googlecode.com/svn/trunk/magic-table/google_visualisation/example_1.html" onclick="return warn()"><br />
    <img src="http://blog.securitymonks.com/wp-content/uploads/2010/04/scatterplot_google_thumb.png" height="60" width="120" /></a></td>
<td><a href="http://magic-table.googlecode.com/svn/trunk/magic-table/google_visualisation/example_1.html" class="gallery_doc_title" onClick="return warn()">Magic-Table</a></p>
<p class="gallery_description">The Magic Table is a JavaScript library that allows you to see more in your data by applying some simple visual techniques to transform a table. The table is displayed in the browser by the canvas element. Internet Explorer is not supported.</p>
<p class="gallery_author">By: <a href="http://code.google.com/p/magic-table/">Greg Ross</a></p>
</td>
</tr>
<tr class="gallery_filter_maps gallery_filter_featured gallery_filter_google">
<td><a href="http://code.google.com/apis/visualization/documentation/gallery/map.html"><br />
    <img src="http://blog.securitymonks.com/wp-content/uploads/2010/04/icon-map.png" height="60" width="120" /></a></td>
<td><a class="gallery_doc_title" href="http://code.google.com/apis/visualization/documentation/gallery/map.html">Map</a> (<a class="gallery_gwt_link" href="http://code.google.com/docreader/#p=gwt-google-apis&amp;s=gwt-google-apis&amp;t=Visualization">GWT Integrated</a>)</p>
<p class="gallery_description">An interactive map that uses the <a href="http://code.google.com/apis/maps">Google Maps API</a>.</p>
<p class="gallery_author">By: Google</p>
</td>
</tr>
<tr class="gallery_filter_featured gallery_filter_charts gallery_filter_google">
<td><a href="http://code.google.com/apis/visualization/documentation/gallery/motionchart.html"><br />
    <img src="http://blog.securitymonks.com/wp-content/uploads/2010/04/icon-motionchart.png" height="60" width="120" /></a></td>
<td>
<p><a class="gallery_doc_title" href="http://code.google.com/apis/visualization/documentation/gallery/motionchart.html">Motion Chart</a> (<a class="gallery_gwt_link" href="http://code.google.com/docreader/#p=gwt-google-apis&amp;s=gwt-google-apis&amp;t=Visualization">GWT Integrated</a>)</p>
<p class="gallery_description">Motion Chart: A dynamic flash based chart to explore several indicators over time. Required columns: bubble name, time and 2 columns of numeric values. Optional columns: Numeric values or categories.</p>
<p class="gallery_author">By: Google</p>
</td>
</tr>
<tr class="gallery_filter_featured gallery_filter_google gallery_filter_project">
<td><a href="http://code.google.com/apis/visualization/documentation/gallery/orgchart.html"><br />
    <img src="http://blog.securitymonks.com/wp-content/uploads/2010/04/icon-orgchart.png" height="60" width="120" /></a></td>
<td><a class="gallery_doc_title" href="http://code.google.com/apis/visualization/documentation/gallery/orgchart.html">Organizational Chart</a></p>
<p class="gallery_description">A <a class="gallery_gwt_link" href="http://code.google.com/docreader/#p=gwt-google-apis&amp;s=gwt-google-apis&amp;t=Visualization">GWT Integrated</a> simple organizational chart.</p>
<p class="gallery_author">By: Google</p>
</td>
</tr>
<tr class="gallery_filter_charts">
<td><a href="http://parallel-coordinates.googlecode.com/svn/trunk/documentation/documentation.html" onclick="return warn()"><br />
    <img src="http://blog.securitymonks.com/wp-content/uploads/2010/04/parallelcords.jpg" height="60" width="120" /></a></td>
<td><a href="http://parallel-coordinates.googlecode.com/svn/trunk/documentation/documentation.html" class="gallery_doc_title" onClick="return warn()">Parallel Coordinates Chart</a></p>
<p class="gallery_description">Parallel Coordinates is a method of visualizing multivariate data. An n-dimensional space is represented as n parallel lines.  Works for browsers based on Gecko or Presto (does not work in IE). This is written in Javascript, no Flash required.</p>
<p class="gallery_author">By: <a href="http://sriharsha451.googlepages.com/">Sri Harsha Allamraju</a></p>
</td>
</tr>
<tr class="gallery_filter_charts gallery_filter_google">
<td><a href="http://code.google.com/apis/visualization/documentation/gallery/piechart.html"><br />
    <img src="http://blog.securitymonks.com/wp-content/uploads/2010/04/icon-piechart.png" height="60" width="120" /></a></td>
<td><a class="gallery_doc_title" href="http://code.google.com/apis/visualization/documentation/gallery/piechart.html">Pie Chart</a> (<a class="gallery_gwt_link" href="http://code.google.com/docreader/#p=gwt-google-apis&amp;s=gwt-google-apis&amp;t=Visualization">GWT Integrated</a>)</p>
<p class="gallery_description">Interactive pie chart.</p>
<p class="gallery_author">By: Google</p>
</td>
</tr>
<tr class="gallery_filter_featured gallery_filter_charts gallery_filter_fun">
<td><a href="http://visapi-gadgets.googlecode.com/svn/trunk/pilesofmoney/doc.html" onclick="return warn()"><br />
    <img src="http://visapi-gadgets.googlecode.com/svn/trunk/pilesofmoney/icon.png" height="60" width="120" /></a></td>
<td><a href="http://visapi-gadgets.googlecode.com/svn/trunk/pilesofmoney/doc.html" class="gallery_doc_title" onClick="return warn()">Piles of Money</a></p>
<p class="gallery_description">Column chart made of of money bills.</p>
<p class="gallery_author">By: The visapi project</p>
</td>
</tr>
<tr class="gallery_filter_charts gallery_filter_google">
<td><a href="http://code.google.com/apis/visualization/documentation/gallery/scatterchart.html"><br />
    <img src="http://blog.securitymonks.com/wp-content/uploads/2010/04/icon-scatterchart.png" height="60" width="120" /></a></td>
<td><a class="gallery_doc_title" href="http://code.google.com/apis/visualization/documentation/gallery/scatterchart.html">Scatter Chart</a> (<a class="gallery_gwt_link" href="http://code.google.com/docreader/#p=gwt-google-apis&amp;s=gwt-google-apis&amp;t=Visualization">GWT Integrated</a>)</p>
<p class="gallery_description">Interactive scatter chart.</p>
<p class="gallery_author">By: Google</p>
</td>
</tr>
<tr class="gallery_filter_google gallery_filter_tables">
<td><a href="http://code.google.com/apis/visualization/documentation/gallery/table.html"><br />
    <img src="http://blog.securitymonks.com/wp-content/uploads/2010/04/icon-table.png" height="60" width="120" /></a></td>
<td><a href="http://code.google.com/apis/visualization/documentation/gallery/table.html"  class="gallery_doc_title">Table</a> (<a class="gallery_gwt_link" href="http://code.google.com/docreader/#p=gwt-google-apis&amp;s=gwt-google-apis&amp;t=Visualization">GWT Integrated</a>)</p>
<p class="gallery_description">A highly customizable table with sorting, paging and selection capabilities.</p>
<p class="gallery_author">By: Google</p>
</td>
</tr>
<tr class="gallery_filter_featured gallery_filter_text">
<td><a href="http://visapi-gadgets.googlecode.com/svn/trunk/termcloud/doc.html" onclick="return warn()"><br />
    <img src="http://visapi-gadgets.googlecode.com/svn/trunk/termcloud/icon.png" height="60" width="120" /></a></td>
<td><a href="http://visapi-gadgets.googlecode.com/svn/trunk/termcloud/doc.html" class="gallery_doc_title" onClick="return warn()">TermCloud</a></p>
<p class="gallery_description">A list of terms, where the size and color of each word is determined by a specified frequency value (typically the number of times it appears in some text).</p>
<p class="gallery_author">By: The visapi project</p>
</td>
</tr>
<tr class="gallery_filter_featured gallery_filter_maps">
<td><img src="http://blog.securitymonks.com/wp-content/uploads/2010/04/thematicmapping.png" height="60" width="120" /></td>
<td><a href="http://thematicmapping.org/api/gvapi.php" class="gallery_doc_title" onClick="return warn()">Thematic Mapping API</a></p>
<p class="gallery_description">Enables visualization of data in Google Earth or other geobrowsers through the use of the Google Visualization API and KML.</p>
<p class="gallery_author"> By: <a href="http://thematicmapping.org/">Thematicmapping.org</a></p>
</td>
</tr>
<tr class="gallery_filter_text">
<td><a href="http://visapi-gadgets.googlecode.com/svn/trunk/wordcloud/doc.html" onclick="return warn()"><br />
    <img src="http://blog.securitymonks.com/wp-content/uploads/2010/04/worldcloud.png" height="60" width="120" /></a></td>
<td>
<p><a href="http://visapi-gadgets.googlecode.com/svn/trunk/wordcloud/doc.html" class="gallery_doc_title" onClick="return warn()">WordCloud</a>
      </p>
<p class="gallery_description">Displays all words in text with size and color based on the number of time each word appears.</p>
<p class="gallery_author">By: The visapi project</p>
</td>
</tr>
</table>
<p><h3>Additional Information</h3>
</p>
<p>
Below is the talk that Itai Raz, the lead engineer for the Visualization API product at Google, gave at <a href="http://code.google.com/events/io/2009/">Google I/O 2009</a> titled &#8220;Using the Visualization API with GWT:&#8221;
</p>
<p>
<object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/5PV8OH-ML-Q&#038;color1=0xb1b1b1&#038;color2=0xcfcfcf&#038;hl=en_US&#038;feature=player_embedded&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.youtube.com/v/5PV8OH-ML-Q&#038;color1=0xb1b1b1&#038;color2=0xcfcfcf&#038;hl=en_US&#038;feature=player_embedded&#038;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="640" height="385"></embed></object>
</p>
<p><h3>Additional Possibilities</h3>
</p>
<p>
The work above is meant only to serve as a starting point.  There is a great deal more information to expand upon.  For example, we began this post pulling some information from the XML schema for CVE-2010-1228.  One field we did not pull out from the XML file is:
</p>
<p><pre>    &lt;vuln:cwe id="CWE-362" /&gt;
</pre>
</p>
<p>
The Common Weakness Enumeration (CWE) represents vulnerability types and NIST provides a <a href="http://nvd.nist.gov/cwe.cfm#cwes">CWE Cross Section Mapped into by NVD</a> table.  In the above example, we see an entry:
</p>
<table Border="1">
<tr>
<th>Name</th>
<th width="66">CWE-ID</th>
<th>Description</th>
</tr>
<tr>
<td>
<a name="CWE-362"/>Race Conditions
</td>
<td width="66">
<a href = "http://cwe.mitre.org/data/definitions/362.html" target = "blank">CWE-362</a>
</td>
<td>The state of a resource can change between the time the resource is checked to when it is accessed.</td>
</tr>
</table>
<p>
Clicking on the link will take us to the MITRE site that provides a great deal more information on CWE entries.  It is easy enough to expand on the above program to harvest this information for a richer information database.
</p>
<p>
Another possibility is to expand the above program to pull additional information on the CVE entry.  In additional to the data in the NVD CVE XML file, we could pull information from the NVD site.  Using CVE-2010-1228 as an example, we could have the program pull down the page:
</p>
<p><pre>http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2010-1228</pre>
</p>
<p>
Notice the line:
</p>
<p>
<span class="label">CVSS v2 Base Score:</span><a href="http://nvd.nist.gov/cvss.cfm?version=2&amp;name=CVE-2010-1228&amp;vector=(AV%3AN/AC%3AL/Au%3AN/C%3AC/I%3AC/A%3AC)" target="_blank">10.0</a> (HIGH) <a href="http://nvd.nist.gov/cvss.cfm?version=2&amp;name=CVE-2010-1228&amp;vector=(AV%3AN/AC%3AL/Au%3AN/C%3AC/I%3AC/A%3AC)" target="_blank">(AV:N/AC:L/Au:N/C:C/I:C/A:C)</a> (<a href="http://nvd.nist.gov/cvss.cfm?vectorinfo&amp;version=2" target="_blank">legend</a>)
</p>
<p>
The <b>(AV:N/AC:L/Au:N/C:C/I:C/A:C)</b> provides values that were used in determining the base score.  If you follow the link, you will see the values used in the calculations:
</p>
<ul>
<li><strong>CVSS Base Score</strong>: 10
<ul>
<li><b>Impact Subscore</b>: 10</li>
<li><b>Exploitability Subscore</b>: 10</li>
</ul>
</li>
<li><b>CVSS Temporal Score</b>: Undefined</li>
<li><strong>CVSS Environmental Score</strong>: Undefined</li>
<li><strong>Overall CVSS Score</strong>: 10</li>
</ul>
<p>
NVD has made available <a href="http://nvd.nist.gov/cvsseq2.htm">the equations</a> used in calculating the CVSS base score, temporal score, and environmental score.
</p>
<p>
Three other pieces of information that might provide interesting groupings are:
</p>
<ul>
<li><b>Access Complexity</b>:  Low  **NOTE: Access Complexity scored Low due to insufficient information</li>
<li><b>Authentication</b>:  Not required to exploit</li>
<li><b>Impact Type</b>:  Allows unauthorized disclosure of information; Allows unauthorized modification; Allows disruption of service</li>
</ul>
<p>
What information is of interest and how it is used will be dependent on your organization.  There is a great deal of information available and many directions you start examining.
</p>
<p><h3>Final Thoughts</h3>
</p>
<p>
I am often reminded of the old phrase, “Trust us, we are from the government.”   No one really trusts anyone, especially when it comes to matters they do not understand.  Just because you are from the security group at your organization, is that reason enough for the CEO to give you unlimited money and authority to do what you see fit?  Of course not.  While management might trust you, they may not believe that you are capable of seeing the big picture.  That is after all their job.
</p>
<p>
Another great old saying is that “the devil is in the details.”  Those details will likely fall in the security domain.  In organization across the planet there is a tug of war between the details and the big picture with multiple groups adding in their opinions and views.  You need to make the details understandable to your higher management to effectively argue your view.  Finding effective metrics and finding clear representation is essential in today&#8217;s business.  Google Visualization can be a useful tool in accomplishing this task.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.securitymonks.com/2010/04/16/google-visualization-an-example-graphing-nvd-cve-data/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>RTIR:  Adding Incident Response Capabilities to RT</title>
		<link>http://blog.securitymonks.com/2008/08/07/rtir-adding-incident-response-capabilities-to-rt/</link>
		<comments>http://blog.securitymonks.com/2008/08/07/rtir-adding-incident-response-capabilities-to-rt/#comments</comments>
		<pubDate>Thu, 07 Aug 2008 21:11:37 +0000</pubDate>
		<dc:creator>John Gerber</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[RTIR]]></category>
		<category><![CDATA[Request Tracker]]></category>

		<guid isPermaLink="false">http://blog.securitymonks.com/?p=257</guid>
		<description><![CDATA[In our last post, &#8220;Request Tracker Installation (Part 2 of 2),&#8221; we implemented Request Track (RT) on an Apache web server.  As a reminder, RT is an enterprise-grade ticketing system which allows for the checking of the status of various tasks including when the tasks were requested, who requested the tasks and why, when [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.securitymonks.com/images/IMMM.jpg"><img src="/images/IMMM_small.jpg" alt="Incident Management Mind Map Image" align="left" width=250/></a>In our last post, &#8220;<a href="http://blog.securitymonks.com/2008/08/03/request-tracker-installation-part-2-of-2/">Request Tracker Installation (Part 2 of 2)</a>,&#8221; we implemented <a href="http://bestpractical.com/rt/">Request Track (<strong>RT</strong>)</a> on an <a href="http://www.apache.org/">Apache</a> web server.  As a reminder, RT is an enterprise-grade ticketing system which allows for the checking of the status of various tasks including when the tasks were requested, who requested the tasks and why, when the tasks were completed, prioritizing, etc.  It was developed by the folks over at <a href="http://www.bestpractical.com">Best Practical</a>, and is the leading open-source issue tracking system.  Best Practical has also created RT for Incident Response (<strong>RTIR</strong>), which is &#8220;<em>an Open Source incident handling system designed with the needs of CERT teams and other incident-response teams in mind</em>.&#8221;  The posting &#8220;<a href="http://bestpractical.com/rtir/comparison.html">RTIR: RT for Incident Response</a>&#8221; outlines the added features of RTIR.  Today&#8217;s post will build upon the implementation of RT and will walk through the steps to implement RTIR.  </p>
<p>
Before going any further, I did want to give credit to the Doctor, who has been good enough to post over on his <a href="http://itservicemngmt.blogspot.com/2007/05/incident-management-mind-map.html">ITIL Service Management blog</a> a <a href="http://blog.securitymonks.com/2008/03/23/mind-mapping/">mind mapping</a> of the incident management process under <a href="http://en.wikipedia.org/wiki/ITIL_v3">ITIL</a>.  That mind map is the image used in today&#8217;s blog.  While it has nothing directly to do with RTIR, it is interesting in terms of incident management and I wanted to give proper credit.
</p>
<p><h3>Installation</h3>
</p>
<p>
Below are the basic steps involved with installing RTIR.  </p>
<h4><strong>1. Download and install required Perl modules.</strong></h4>
</p>
<p>
There are several Perl packages, which are dependent on other packages, and so the cycle goes.  You can install there packages using cpan, with commands like:
</p>
<p><table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 /usr/local/src root# perl -MCPAN -e 'install Business::Hours'
 /usr/local/src root# perl -MCPAN -e 'install Net::Whois::RIPE'
</pre>
</td>
</table>
<p>
</p>
<p>
Sometimes you can run into problems installing modules in that manner.  Another alternative is to pull down the package, untar, configure, compile, and install in a manner similar to:
</p>
<p><table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 root# cd /usr/local/src
 /usr/local/src root# wget http://search.cpan.org/CPAN/authors/\
id/M/MR/MRSAM/Net-CIDR-0.11.tar.gz
 /usr/local/src root# tar xzf Net-CIDR-0.11.tar.gz
 /usr/local/src root# cd Net-CIDR-0.11
 /usr/local/src/Net-CIDR-0.11 root# perl Makefile.PL
 /usr/local/src/Net-CIDR-0.11root# make test
 /usr/local/src/Net-CIDR-0.11 root# make install
</pre>
</td>
</table>
<p>
</p>
<p>
To make installation of RTIR as easy as possibly, you may want to make sure the following packages are installed.
</p>
<table border=1 width="90%">
<tr>
<th width=100 align=left>Package</th>
<th width=300 align=left>File</th>
</tr>
<tr>
<td>Business::Hours</td>
<td>http://search.cpan.org/CPAN/authors/id/J/JE/JESSE/\<br />
Business-Hours-0.07.tar.gz</td>
</tr>
<tr>
<td>Net::Whois::RIPE</td>
<td>http://search.cpan.org/CPAN/authors/id/P/PA/PAULG/<br />
Net-Whois-RIPE-1.23.tar.gz</td>
</tr>
<tr>
<td>Net::CIDR</td>
<td>http://search.cpan.org/CPAN/authors/id/M/MR/MRSAM/\<br />
Net-CIDR-0.11.tar.gz</td>
</tr>
<tr>
<td>Business::SLA</td>
<td>http://search.cpan.org/CPAN/authors/id/R/RU/RUZ/\<br />
Business-SLA-0.05.tar.gz</td>
</tr>
<tr>
<td>Regexp::Common::net::CIDR</td>
<td>http://search.cpan.org/CPAN/authors/id/R/RU/RUZ/\<br />
Regexp-Common-net-CIDR-0.02.tar.gz</td>
</tr>
<tr>
<td>Devel::Cycle</td>
<td>http://search.cpan.org/CPAN/authors/id/L/LD/LDS/\<br />
Devel-Cycle-1.10.tar.gz</td>
</tr>
<tr>
<td>PadWalker</td>
<td>http://search.cpan.org/CPAN/authors/id/R/RO/ROBIN/\<br />
PadWalker-1.7.tar.gz</td>
</tr>
<tr>
<td>Devel::Symdump</td>
<td>http://search.cpan.org/CPAN/authors/id/A/AN/ANDK/\<br />
Devel-Symdump-2.08.tar.gz</td>
</tr>
<tr>
<td>Pod::Coverage</td>
<td>http://search.cpan.org/CPAN/authors/id/R/RC/RCLAMP/\<br />
Pod-Coverage-0.19.tar.gz</td>
</tr>
<tr>
<td>Test::Pod::Coverage</td>
<td>http://search.cpan.org/CPAN/authors/id/P/PE/PETDANCE/\<br />
Test-Pod-Coverage-1.08.tar.gz</td>
</tr>
<tr>
<td>Test::Memory::Cycle</td>
<td>http://search.cpan.org/CPAN/authors/id/P/PE/PETDANCE/\<br />
Test-Memory-Cycle-1.04.tar.gz</td>
</tr>
<tr>
<td>Test::Taint</td>
<td>http://search.cpan.org/CPAN/authors/id/P/PE/PETDANCE/\<br />
Test-Taint-1.04.tar.gz</td>
</tr>
<tr>
<td>WWW::Mechanize</td>
<td>http://search.cpan.org/CPAN/authors/id/P/PE/PETDANCE/\<br />
WWW-Mechanize-1.34.tar.gz</td>
</tr>
<tr>
<td>Test::HTTP::Server::Simple</td>
<td>http://search.cpan.org/CPAN/authors/id/J/JE/JESSE/\<br />
Test-HTTP-Server-Simple-0.09.tar.gz</td>
</tr>
</table>
<p><h4><strong>2. Download, configure, and install RTFM.</strong></h4>
</p>
<p>
The stable RTIR package was released back to 2004, way before the most recent RT 3 release.  Pull down the most recently updated for RT 3 release of the <a href="http://www.bestpractical.com/rtfm/">RT FAQ Manager (RTFM)</a>.  To quote from the FAQ, &#8220;<em>RTFM lets you open, categorize and search for &#8216;articles.&#8217; Like RT, RTFM lets your users contribute additional information to existing articles and makes sure that each article&#8217;s full history is preserved for future inspection. RTFM makes it easy to quickly search the knowledge base and find critical information</em>.&#8221;
</p>
<p><table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 root# cd /usr/local/src
 /usr/local/src root# wget http://download.bestpractical.com/pub/rt/devel/\
RTIR_M3/RTFM-2.2.2.tar.gz
 /usr/local/src root# tar xzf RTFM-2.2.2.tar.gz
 /usr/local/src root# cd RTFM-2.2.2
 /usr/local/src/RTFM-2.2.2 root# perl Makefile.PL
 /usr/local/src/RTFM-2.2.2 root# make
 /usr/local/src/RTFM-2.2.2 root# make install
 /usr/local/src/RTFM-2.2.2 root# make initdb
 /usr/local/src/RTFM-2.2.2 root# cd ..
 /usr/local/src root# wget http://download.bestpractical.com/pub/rt/devel/\
RTIR_M3/RTFM-Extension-ArticleTemplates-0.01.tar.gz
 /usr/local/src root# tar xzf RTFM-Extension-ArticleTemplates-0.01.tar.gz
 /usr/local/src root# cd RTFM-Extension-ArticleTemplates-0.01
 /usr/local/src/RTFM-Extension-ArticleTemplates-0.01root# perl Makefile.PL
 /usr/local/src/RTFM-Extension-ArticleTemplates-0.01root# make
 /usr/local/src/RTFM-Extension-ArticleTemplates-0.01root# make install
 /usr/local/src/RTFM-Extension-ArticleTemplates-0.01root# cd ..
</pre>
</td>
</table>
<p>
</p>
<p><h4><strong>3. Download, configure, and install RTIR.</strong></h4>
</p>
<p>
Pull down the most recently updated for RT 3 release of RTIR.
</p>
<p><table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 root# cd /usr/local/src
 /usr/local/src root# wget http://download.bestpractical.com/pub/rt/devel/\
RTIR_M3/RT-IR-2.3.17.tar.gz
 /usr/local/src root# tar xzf RT-IR-2.3.17.tar.gz
 /usr/local/src root# cd RT-IR-2.3.17
 /usr/local/src/RT-IR-2.3.17 root# perl Makefile.PL
 /usr/local/src/RT-IR-2.3.17 root# make install
 </pre>
</td>
</table>
<p>
</p>
<p><h4><strong>4. Edit RT configuration file.</strong></h4>
</p>
<p>
Edit the RT configuration file /opt/rt3/etc/RT_SiteConfig.pm adding the RTIR configuration file /opt/rt3/local/plugins/RT-IR/etc/RTIR_Config.pm.
</p>
<p><table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 /usr/local/src/RT-IR-2.3.17 root#  vi /opt/rt3/etc/RT_SiteConfig.pm
</pre>
</td>
</table>
<p>
</p>
<p>
Add the lines:
</p>
<p><table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
# The RTIR config file
$RTIR_CONFIG_FILE = "/opt/rt3/local/plugins/RT-IR/etc/RTIR_Config.pm";
require $RTIR_CONFIG_FILE || die ("Couldn't load RTIR config file '$RTIR_CONFIG_FILE'\n$@");
Set(@Plugins, 'RT::FM', 'RT::IR');
</pre>
</td>
</table>
<p>
</p>
<p><h4><strong>5. Initialize the database.</strong></h4>
</p>
<p>
Update the RT database.
</p>
<p><table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 /usr/local/src/RT-IR-2.3.17 root# make initdb
</pre>
</td>
</table>
<p>
</p>
<p><h4><strong>6. Stop and restart the Apache server.</strong></h4>
</p>
<p>
For good measure, restart the Apache server.
</p>
<p><table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 /usr/local/src/RT-IR-2.3.17 root# /usr/local/apache/bin/apachectl stop
 /usr/local/src/RT-IR-2.3.17 root# /usr/local/apache/bin/apachectl start
</pre>
</td>
</table>
<p>
</p>
<p><h4><strong>7. Configure RTIR.</strong></h4>
</p>
<p>
Configuration of RT and RTIR is a topic for another post; maybe even a book.  I will include below basic instructions from RTIR readme.  Please see the next section for additional documentation.</p>
<blockquote><p>
1) Using RT&#8217;s configuration interface, add the email address<br />
   of the Network Operations Team (the people who will handle<br />
   activating and removing Blocks) as AdminCC on the Blocks queue.<br />
   RT -&gt; Configuration -&gt; Queues -&gt; Blocks -&gt; Watchers</p>
<p>2) You may want to modify the email messages that are automatically<br />
   sent on the creation of Investigations and Blocks.<br />
   RT -&gt; Queues -&gt; &lt;select RTIR&#8217;s Queue&gt; -&gt; Templates.<br />
   RT -&gt; Global -&gt; Templates.</p>
<p>3) By default, RT ships with a number of global Scrips.  You should use<br />
   RT&#8217;s configuration interface to look through them, and disable any<br />
   that aren&#8217;t apropriate in your environment.<br />
   RT -&gt; Queues -&gt; &lt;/select&gt;&lt;select RTIR&#8217;s Queue&gt; -&gt; Scrips.<br />
   RT -&gt; Global -&gt; Scrips.</p>
<p>4) Add staff members who handle incidents to the DutyTeam group.<br />
   RT -&gt; Configuration -&gt; Groups -&gt; DutyTeam -&gt; Members.</p>
<p>5) You can override values in the RTIR_Config.pm in your<br />
   RT_SiteConfig.pm file. Just add your customizations after the &#8220;require&#8221;<br />
   line mentioned above.
</p></blockquote>
<h3>Additional Information</h3>
</p>
<p>
RT has a nice user interface.  In order to figure out and use the program, you need to read the documentation.  We may come back and do a post on configuration.  How you configure RTIR software depends on the environment and your plans for using the software.  Below is a listing of several information sources.</p>
<ul>
<li><a href="http://svn.bestpractical.com/cgi-bin/index.cgi/bps/view/rtir/branches/2.3-EXPERIMENTAL/lib/RT/IR/DocIndex.pod">DocIndex.pod</a> &#8211; Can also view DocIndex.pod with the command:<br />
<strong>perldoc lib/RT/IR/DocIndex.pod</strong></li>
<li><a href="http://svn.bestpractical.com/cgi-bin/index.cgi/bps/view/rtir/branches/2.3-EXPERIMENTAL/lib/RT/IR/AdministrationTutorial.pod">AdministrationTutorial.pod</a>  &#8211; Can also view AdministrationTutorial.pod with the command:<br />
<strong>perldoc lib/RT/IR/AdministrationTutorial.pod</strong></li>
<li><a href="http://svn.bestpractical.com/cgi-bin/index.cgi/bps/view/rtir/branches/2.3-EXPERIMENTAL/lib/RT/IR/Config.pm">Config.pm</a> &#8211; Can also view Constituencies.pod with the command:<br />
<strong>perldoc lib/RT/IR/Config.pm</strong></li>
<li><a href="http://svn.bestpractical.com/cgi-bin/index.cgi/bps/view/rtir/branches/2.3-EXPERIMENTAL/lib/RT/IR/Constituencies.pod">Constituencies.pod</a>  &#8211; Can also view Constituencies.pod with the command:<br />
<strong>perldoc lib/RT/IR/Constituencies.pod</strong></li>
<li><a href="http://svn.bestpractical.com/cgi-bin/index.cgi/bps/view/rtir/branches/2.3-EXPERIMENTAL/lib/RT/IR/Ticket.pm">Ticket.pm</a> &#8211; Can also view Ticket.pm with the command:<br />
<strong>perldoc lib/RT/IR/Tutorial.pod</strong></li>
<li><a href="http://svn.bestpractical.com/cgi-bin/index.cgi/bps/view/rtir/branches/2.3-EXPERIMENTAL/lib/RT/IR/Tutorial.pod">Tutorial.pod </a> &#8211; Can also view Tutorial.pod with the command:<br />
<strong>perldoc lib/RT/IR/Tutorial.pod</strong></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.securitymonks.com/2008/08/07/rtir-adding-incident-response-capabilities-to-rt/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Request Tracker Installation  (Part 2 of 2)</title>
		<link>http://blog.securitymonks.com/2008/08/03/request-tracker-installation-part-2-of-2/</link>
		<comments>http://blog.securitymonks.com/2008/08/03/request-tracker-installation-part-2-of-2/#comments</comments>
		<pubDate>Mon, 04 Aug 2008 02:33:46 +0000</pubDate>
		<dc:creator>John Gerber</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Leopard]]></category>
		<category><![CDATA[Links]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[ModSecurity]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[NIST]]></category>
		<category><![CDATA[OpenSSL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Request Tracker]]></category>

		<guid isPermaLink="false">http://blog.securitymonks.com/?p=211</guid>
		<description><![CDATA[Awhile back, I posted &#8220;Request Tracker Installation  (Part 1 of 2),&#8221; which provided information and additional links concerning Request Tracker (RT).  As a reminder, RT is an enterprise-grade ticketing system which allows for the checking of the status of various tasks including when the tasks were requested, who requested the tasks and why, [...]]]></description>
			<content:encoded><![CDATA[<p><img src="/images/opensource.jpg" alt="Open Source Installation" align="left"/>Awhile back, I posted &#8220;<a href="http://blog.securitymonks.com/category/request-tracker">Request Tracker Installation  (Part 1 of 2)</a>,&#8221; which provided information and additional links concerning <a href="http://bestpractical.com/rt/">Request Tracker (RT)</a>.  As a reminder, RT is an enterprise-grade ticketing system which allows for the checking of the status of various tasks including when the tasks were requested, who requested the tasks and why, when the tasks were completed, prioritizing, etc.  I delayed the second part of the post, which was to step through installation of RT, until I could add some background information.  I wanted to walk through implementing secure open source software such as <a href="http://www.apache.org/">Apache</a>, <a href="http://www.php.net">PHP</a>, <a href="http://www.mysql.com">MySQL</a>, <a href="http://www.openssl.org">OpenSSL</a>, and <a href="http://www.modsecurity.org">ModSecurity</a>.  No small task.  It is all about integration both in terms of security and the power that a software package like RT can provide your organization.  That is why I selected the image on the left of all these various open source software symbols for this post on RT.</p>
<p>
If you are going to be using RT, you need to get the &#8220;<a href="http://rtbook.bestpractical.com/">RT Essentials</a>&#8221; book written by Jesse Vincent, Robert Spier, Dave Rolsky, Darren Chamberlain, and Richard Foley.  It is a good reference and a quick read.  For up-to-date information, see the <a href="http://wiki.bestpractical.com/view/HomePage">RT Wiki</a> and the <a href="http://blog.bestpractical.com/">Best Practical Solutions blog site</a>.
</p>
<p><h3>Prerequisites</h3>
<p>To start, please review the following posts:</p>
<ol>
<li><a href="http://blog.securitymonks.com/2008/04/14/an-apache-implementation/">An Apache Implementation</a>
	</li>
<li><a href="http://blog.securitymonks.com/2008/04/24/apache-and-openssl/">Apache and OpenSSL</a></li>
<li><a href="http://blog.securitymonks.com/2008/04/21/php-implementation/">PHP Implementation</a></li>
<ul>
<li><a href="http://blog.securitymonks.com/2008/04/21/php-as-a-module/">PHP as a Module</a></li>
<li><a href="http://blog.securitymonks.com/2008/04/21/php-as-a-cgi/">PHP as a CGI</a></li>
<li><a href="http://blog.securitymonks.com/2008/04/21/php-configuration-modifications/">PHP Configuration Modifications</a></li>
</ul>
<li><a href="http://blog.securitymonks.com/2008/04/07/introduction-to-mysql/">Introduction to MySQL</a></li>
<li><a href="http://blog.securitymonks.com/2008/02/28/setting-up-and-securing-mysql-references/">Setting Up and Securing MySQL: References</a></li>
<li><a href="http://blog.securitymonks.com/2008/07/31/implementing-a-web-application-firewall-with-modsecurity/">Implementing a Web Application Firewall with ModSecurity</a></li>
</ol>
<h3>Install Software</h3>
<p>With Apache, MySQL, PHP, OpenSSL, and ModSecurity installed, we are now ready to focus on software packages required by RT.</p>
<h4><strong>1.  Installing <a href="http://expat.sourceforge.net/">expat</a>.</strong></h4>
<p>Different operating systems will vary on whether <a href="http://expat.sourceforge.net/">expat</a>, the XML parser, is installed.  Expat is needed to complete the cpan install for <a href="http://perl-rss.sourceforge.net/">XML::RSS</a>.  Check your particular operating system.</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 root# cd /usr/local/src
 /usr/local/src root# wget http://downloads.sourceforge.net/expat/expat-2.0.1.tar.gz
 /usr/local/src root# tar xzf expat-2.0.1.tar.gz
 /usr/local/src root# cd expat-2.0.1
 /usr/local/src/expat-2.0.1 root# ./configure
 /usr/local/src/expat-2.0.1 root# make
 /usr/local/src/expat-2.0.1 root# make check
 /usr/local/src/expat-2.0.1 root# make install
</pre>
</td>
</table>
<p></p>
<h4><strong>2.  Install FastCGI</strong></h4>
<p>For RT, you can install <a href="http://perl.apache.org/">mod_perl</a> or <a href="http://www.fastcgi.com/">mod_fastcgi</a>.  In this posting, we are going to walks through the installation of FastCGI.  Information concerning mod_perl will be provided below so the reader can chose what fits best in their environment.  FastCGI is much simpler to install and allows the core Apache process to stay small in size.  With FastCGI, RT runs as a separate process from Apache allowing RT to be stopped and restarted without affecting the Apache server.  In general, FastCGI programs are easier to manage.
</p>
<p>
The Apache module mod_fastcgi allows a web server to run CGI scripts via a separate, persistent program.  PHP comes with FastCGI support compiled in by default, so nothing needs to be done to the PHP installation.
</p>
<p>
You can have the Apache program call FastCGI, and have it run as the same user as the Apache server or use suexec to have FastCGI switch to a different user.  Under some operating systems, suexec may not get compiled and installed when installing Apache.  Check if suexec is installed, and if not go back to the Apache source, compile it, and install it.  Initially, we are not going to use the suexec program.  Instead we will create the group &#8220;rt&#8221;, add user httpd to group rt, and set permissions that way.  You may choose later to use suexec.  </p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 root# ls -la /usr/local/apache/bin/suexec
ls: /usr/local/apache/bin/suexec: No such file or directory
 root# cd /usr/local/src/httpd-2.2.8
 /usr/local/src/httpd-2.2.8 root# make suexec
 /usr/local/src/httpd-2.2.8 root# cp ./support/suexec /usr/local/apache/bin/suexec
</pre>
</td>
</table>
<p>
Now, we are ready to get mod_fastcgi installed.</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 root# cd /usr/local/src
 /usr/local/src root# wget http://www.fastcgi.com/dist/mod_fastcgi-2.4.6.tar.gz
 /usr/local/src root# tar xzf mod_fastcgi-2.4.6.tar.gz
 /usr/local/src root# cd mod_fastcgi-2.4.6
 /usr/local/src/mod_fastcgi-2.4.6 root# cp Makefile.AP2 Makefile
 /usr/local/src/mod_fastcgi-2.4.6 root# make top_dir=/usr/local/apache
 /usr/local/src/mod_fastcgi-2.4.6 root# make top_dir=/usr/local/apache install
 /usr/local/src/mod_fastcgi-2.4.6 root# /usr/local/apache/bin/apachectl stop
 /usr/local/src/mod_fastcgi-2.4.6 root# vi /usr/local/apache/conf/httpd.conf
</pre>
</td>
</table>
<p>
Add the following lines to the Apache httpd.conf file:</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
# Load the mod_fastcgi module.
LoadModule fastcgi_module modules/mod_fastcgi.so
</pre>
</td>
</table>
<p>
Check if installation and configuration is working.</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 /usr/local/src/mod_fastcgi-2.4.6 root# /usr/local/apache/bin/apachectl configtest
Syntax OK
 /usr/local/src/mod_fastcgi-2.4.6 root# /usr/local/apache/bin/apachectl start
 /usr/local/src/mod_fastcgi-2.4.6 root# cat /var/www/logs/error_log | grep -i fastcgi
[Fri Aug 01 12:17:22 2008] [notice] FastCGI: process manager initialized (pid 15221)
[Fri Aug 01 12:17:22 2008] [notice] Apache/2.2.8 (Unix) mod_ssl/2.2.8
OpenSSL/0.9.7a mod_fastcgi/2.4.6 configured -- resuming normal operations
</pre>
</td>
</table>
<p>
For in depth coverage of mod_perl, <a href="http://stason.org/">Stas Bekman</a> and <a href="http://www.oreillynet.com/pub/au/999">Eric Cholet</a> have written the book, &#8220;<a href="http://modperlbook.org/">Practical mod_perl</a>.&#8221;  They have made the complete book available online in both <a href="http://modperlbook.org/html/index.html">HTML</a> and <a href="http://modperlbook.org/pdf/index.html">PDF</a> format under the <a href="http://creativecommons.org/">Creative Commons</a> Attributes Share-Alike License.  <a href="http://stason.org/">Stas Bekman</a> and <a href="http://www.onyxneon.com/people/jim_brandt.html">Jim Brandt</a> have also written the &#8220;<a href="http://www.amazon.com/gp/product/0977920119?ie=UTF8&#038;tag=theultimatlearna&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=0977920119">mod_perl2 User&#8217;s Guide Book</a>&#8221; where 50% of the book&#8217;s proceeds go to <a href="http://www.perlfoundation.org/">The Perl Foundation</a>.
</p>
<p>
If you are installing under Mac OS X, mod_perl may complain about Perl 5.8.8 being built without threads and you will get a message about building perl with -Duserthreads.  If you are determined to use mod_perl, consider dropping back to Apache 1.3.x and using mod_perl 1.x.  While Apache 1.3.x is legacy code, and I tend to want to use the code that is being actively developed, there is an argument for using Apache 1.3.x.  One major feature of Apache 2.x is threading. On Windows, where most basic libraries are and must be threadsafe, Apache 2 is really the only choice.  <a href="http://search.cpan.org/~nwclark/perl-5.8.8/README.macosx">Earlier Mac OS X</a> releases did not include a completely thread-safe libc, so threading is still not fully supported in Perl.  This is why the Perl version that comes with Mac OS X is not compiled to use threads.  To use  Apache2.x, Perl will need to be configured to use threads.  The code is available from the <a href="http://www.perl.com/download.csp">Perl web site</a>.
</p>
<p>
Rather than getting bogged down in compiling Perl to use thread, we will move ahead and use FastCGI.  By the time this post, I will have worked on getting RT installed under Linux, Mac OS X, and FreeBSD.  Figuring out what software works best in a multi OS environment can be challenging.  </p>
<h4><strong>3. Configure RT</strong></h4>
<p>Let us start by adding the group RT.  Under many operating systems, this would be done with the simple command &#8220;<strong>groupadd rt</strong>.&#8221;  Things are always more interesting under Mac OS X, where you would have to first look at what group ids (gid), choose an unused gid, and then create the rt group using that gid.  Under Mac OS X Leopard, group rt would be created with the commands:</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 root# dscl . list /groups PrimaryGroupID | sort -k 2,2 -n
 root# dscl . create /groups/rt gid gid-of-rt
 root# dscl . create /groups/rt passwd '*'
 root# dscl . read /groups/rt
AppleMetaNodeLocation: /Local/Default
Password: *
PrimaryGroupID: gid-of-rt
RecordName: rt
RecordType: dsRecTypeNative:groups
</pre>
</td>
</table>
<p>
RT&#8217;s primary maintenance and documentation site is <a href="http://www.bestpractical.com">http://www.bestpractical.com</a>.   Documentation can be found at the Best Practical Solutions RT Wiki located at <a href="http://wiki.bestpractical.com/view/HomePage">http://wiki.bestpractical.com/</a>. The latest TAR/GZ is located at <a href="http://download.bestpractical.com/pub/rt/release/rt.tar.gz">http://download.bestpractical.com/pub/rt/release/rt.tar.gz</a>. The lack of any version numbers means the version can be updated at any time. The latest version, as of this writing, is 3.8.0.
</p>
<p>
The following are the steps for downloading and configuring RT:</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 root# cd /usr/local/src
 /usr/local/src root# wget http://download.bestpractical.com/pub/rt/release/rt.tar.gz
 /usr/local/src root# tar xzf rt.tar.gz
 /usr/local/src root# cd rt-3.8.0
 /usr/local/src/rt-3.6.5 root# ./configure \
  --with-web-user="httpd" \
  --with-web-group="httpd" \
  --with-rt-user="httpd" \
  --with-rt-group="rt"
</pre>
</td>
</table>
<p></p>
<h4><strong>4.  Install Apache::TEST</strong></h4>
<p>Perl module Apache::TEST will not allow you to run the test check as root. You can download the module separately as a non root user and after configuring, compiling, and testing the program, you install it as root.</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 root# su - goofy
 ~$ cd src
 ~/src goofy$ wget http://search.cpan.org/CPAN/authors/id/P/PH/PHRED/Apache-Test-1.30.tar.gz
 ~/src goofy$ tar xzf Apache-Test-1.30.tar.gz
 ~/src goofy$ cd Apache-Test-1.30
 ~/src goofy$ perl Makefile.PL
 ~/src goofy$ make
 ~/src goofy$ make test
 ~/src goofy$ sudo su root
 root# make instal
</pre>
</td>
</table>
<p></p>
<h4><strong>5.  Run fixdeps Command and Install Perl Modules</strong></h4>
<p>Now you are ready to utilize the <strong>fixedeps</strong> utility that comes with RT to install required Perl modules.  There is also the <strong>testdeps</strong> utility to test if all dependencies are installed and RT is ready to be installed.  You may need to run fixdeps multiple times before testdeps reports that you have all required software packages.  The first time through, it can take awhile (depending on your installation).  Be aware that some perl modules may need to be installed manually.  It various depending on OS and your environment.  You will be able to tell which modules need manual installation by the final message provided by the fixdeps program.</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 root# cd /usr/local/src/rt-3.8.0
 /usr/local/src/rt-3.8.0 root# make fixdeps
 /usr/local/src/rt-3.8.0 root# make fixdeps
 /usr/local/src/rt-3.8.0 root# make testdeps
</pre>
</td>
</table>
<p></p>
<h4><strong>6.  Install RT</strong></h4>
</p>
<p>
The final installation of RT is the easy part.</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 /usr/local/src/rt-3.8.0 root# make install
</pre>
</td>
</table>
<p></p>
<h4><strong>7.  Configure RT_SiteConfig.pm</strong></h4>
<p>We now will configure /opt/rt3/etc/RT_SiteConfig.pm.  In the next step a database user and a database will be setup.  We are only adding those values to the configuration file in this step.  I am going to set up a hostname (rt.securitymonks.com) for my current machine.  Please do not copy blindly.  Change this to your environment.  We will create the hostname so it only exists locally by adding an entry into the machines /etc/hosts file.  Right now, I am only going to access the Apache server from this machine.  In other words, the client and server will be on the same box.</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 /usr/local/src/rt-3.8.0 root# vi /etc/hosts
</pre>
</td>
</table>
<p>
Add the following line, adapting it to your organization:</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 /usr/local/src/rt-3.8.0 root# vi /etc/hosts
##
127.0.0.1       localhost
10.1.218.202   rt.securitymonks.com
</pre>
</td>
</table>
<p>
We are now ready to modify the RT_SiteConfig.pm file.</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 /usr/local/src/rt-3.8.0 root# vi /opt/rt3/etc/RT_SiteConfig.pm
</pre>
</td>
</table>
<p>
At minimum, add the following linesto /opt/rt3/etc/RT_SiteConfig.pm:</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
Set($rtname, 'BRORT');
Set($Organization, 'securitymonks');

Set($CorrespondAddress , 'john@securitymonks.com');
Set($CommentAddress , 'john@securitymonks.com');

Set($Timezone , 'US/Eastern'); # obviously choose what suits you

# THE DATABASE:

Set($DatabaseType, 'mysql'); # e.g. Pg or mysql

# These are the settings we used above when creating the RT database,
# you MUST set these to what you chose in the section above.

Set($DatabaseUser , 'rtuser');
Set($DatabasePassword , 'secret');
Set($DatabaseName , 'rtdb');

# THE WEBSERVER:

Set($WebPath , '');
Set($WebBaseURL , 'https://rt.securitymonks.com');

# Logging
Set($LogToSyslog, '');
Set($LogToFile, 'debug');
Set($LogDir, '/opt/rt3/var/log');
Set($LogToFileNamed, "rt.log");
</pre>
</td>
</table>
<p></p>
<h4><strong>8.  Initialize the Database</strong></h4>
<p>RT needs to create the rtdb database, the rt db users, and initialize some tables.  This can be done with the command <strong>initialize-database</strong>, which should be run only once.</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 /usr/local/src/rt-3.8.0 root# make initialize-database
 /usr/local/bin/perl sbin/rt-setup-database --action init --dba root --prompt-for-dba-password
In order to create or update your RT database, this script needs to connect to your mysql
instance on localhost as root.  Please specify that user's database password below. If the
user has no database

password, just press return.

Password:
Working with:
Type:   mysql
Host:   localhost
Name:   rtdb
User:   rtuser
DBA:    root
Now creating a mysql database rtdb for RT.
Done.
Now populating database schema.
Done.
Now inserting database ACLs
Granting access to rtuser@'localhost' on rtdb.
Done.
Now inserting RT core system objects
Done.
Now inserting data
Done inserting data
Done.
</pre>
</td>
</table>
<p>
Check the MySQL database out.</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 /usr/local/src/rt-3.8.0 root# mysql -u rtuser -p
mysql> use rtdb;
</pre>
</td>
</table>
<p>
</p>
<h4><strong>9.  Modify Apache Configuration File</strong> </h4>
<p>Edit the /usr/local/apache/conf/httpd.conf file.</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 /usr/local/src/rt-3.8.0 root# /usr/local/apache/bin/apachectl stop
 /usr/local/src/rt-3.8.0 root# vi /usr/local/apache/conf/httpd.conf
</pre>
</td>
</table>
<p>
We are going to have the RT server run under our secure web server.  Find the &#8220;<strong>&#60virtualhost _default_:443&#62</strong>&#8221; line, change it to &#8220;<strong>&#60virtualhost 10.1.218.202:443&#62</strong>&#8220;.  Add the following lines to that section (adjusting to your environment):</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
   ServerName rt.securitymonks.com
   DocumentRoot /opt/rt3/share/html
   ErrorLog /usr/local/apache/logs/rt.error
   LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
   CustomLog /usr/local/apache/logs/rt.access_log combined
   AddHandler fastcgi-script fcgi
   ScriptAlias / /opt/rt3/bin/mason_handler.fcgi/
</pre>
</td>
</table>
<p>
Add the user the Apache server runs as (httpd by default), to the RT group.  For non Mac OS X, modify group membership by editing the file /etc/group (<strong>vi /etc/group</strong>).  Mac OS X users need to user the dscl command.</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 root# dscl . append /groups/rt GroupMembership httpd
 root# dscl . read /groups/rt
</pre>
</td>
</table>
<p>
Change the group and permission on the log area if you have told RT to log to /opt/rt3/var/log. </p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 root# chgrp rt /opt/rt3/var/log
 root# chmod g+w /opt/rt3/var/log
</pre>
</td>
</table>
<p>
Test the configuration of the file, and if everything checks out start up Apache. </p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 /usr/local/src/rt-3.8.0 root# /usr/local/apache/bin/apachectl configtest
Syntax OK
 /usr/local/src/rt-3.8.0 root# /usr/local/apache/bin/apachectl start
</pre>
</td>
</table>
<p>
 Remember there are now three files to check for problems with RT.
<ul>
<li>/opt/rt3/var/log/rt.log</li>
<li>/usr/local/apache/logs/rt.error</li>
<li>/usr/local/apache/logs/rt.access_log</li>
</ul>
<p>There are many configuration operations.  The options chosen in this post represents only the minimal to get RT running.  Please see the <a href="http://wiki.bestpractical.com/view/FastCGIConfiguration">RT Wiki&#8217;s FastCGIConfiguration</a> page for additional information.</p>
<h4><strong>10.  Access RT and Change the Default Password</strong> </h4>
<p><a href="http://blog.securitymonks.com/images/RT_login.jpg"><img align="left" width="150" title="ModifyUserImage" src="/images/RT_login.jpg"/></a>Now it is time to log in and change the default password.  Using the entry we made in our /etc/hosts file, we can now access the site by going to <strong>https://rt.securitymonks.com</strong>.  This URL should be different for your site.  You will see a login screen similar to the image on the left.</p>
<p>
Log in using the username &#8220;<strong>root</strong>&#8221; and password &#8220;<strong>password</strong>&#8220;.  Once logged in, you will see the screen similar to the image below (click on the image if you need to enlarge):<br />
<a href="http://blog.securitymonks.com/images/RT_ataglance.jpg"><img width="400" title="RT_at_a_glance" src="/images/RT_ataglance.jpg"/></a><br />
Over on the left menu bar, select &#8220;<strong>Configuration</strong>.&#8221;  That will bring you to the &#8220;RT Administration&#8221; screen:<br />
<a href="http://blog.securitymonks.com/images/RT_Administration.jpg"><img width="200" title="RT_administration" src="/images/RT_Administration.jpg"/></a><br />
Select, &#8220;<strong>Users</strong>.&#8221;  That will bring you to the &#8220;Select a user&#8221; screen:<br />
<a href="http://blog.securitymonks.com/images/RT_selectauser.jpg"><img width="300" title="RT_Select_a_User" src="/images/RT_selectauser.jpg"/></a><br />
Select the user &#8220;<strong>root</strong>,&#8221; which will bring you to the &#8220;Modify the user root&#8221; screen.  If you look at the lower left of the screen, there is a &#8220;Access Control area.&#8221;  There is a place to enter &#8220;New Password.&#8221;  Do so.  The screen looks like:<br />
<a href="http://blog.securitymonks.com/images/RT_modifyauser.png"><img width="200"  title="RT_Modify" src="/images/RT_modifyauser.png"/></a><br />
Make sure to hit the &#8220;Save Changes&#8221; button at the bottom of the screen.  With a working copy of RT, you are not ready to start adjusting configurations and working with the program.  For additional information, Please check out the “<a href="http://rtbook.bestpractical.com/">RT Essentials</a>” and the <a href="http://wiki.bestpractical.com/view/HomePage">RT Wiki</a> and the Best Practical Solutions <a href="http://blog.bestpractical.com/">blog site</a>.  Look for future posts to build upon the RT installation and database.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.securitymonks.com/2008/08/03/request-tracker-installation-part-2-of-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Introduction to MySQL</title>
		<link>http://blog.securitymonks.com/2008/04/07/introduction-to-mysql/</link>
		<comments>http://blog.securitymonks.com/2008/04/07/introduction-to-mysql/#comments</comments>
		<pubDate>Mon, 07 Apr 2008 08:28:43 +0000</pubDate>
		<dc:creator>John Gerber</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[References]]></category>

		<guid isPermaLink="false">http://blog.securitymonks.com/2008/04/07/introduction-to-mysql/</guid>
		<description><![CDATA[


&#8220;If you want to change your direction
If your time of life is at hand
Well don’t be the rule be the exception
A good way to start is to stand.&#8221;
  &#8212; Song &#8220;Put One Foot In Front Of The Other&#8221; by Jules Bass


With my recent post, &#8220;Introduction to SQLite,&#8221; I have received some questions concerning MySQL. [...]]]></description>
			<content:encoded><![CDATA[<table>
<tr>
<td><img src="/images/mysql1.png" alt="MySQL" align="left" width=90 /></td>
<td>&#8220;<em>If you want to change your direction<br />
If your time of life is at hand<br />
Well don’t be the rule be the exception<br />
A good way to start is to stand</em>.&#8221;<br />
  &#8212; Song &#8220;<a href="http://youtube.com/watch?v=zScm2X3S2AM&#038;feature=related">Put One Foot In Front Of The Other</a>&#8221; by <a href="http://www.rankinbass.com/">Jules Bass</a></td>
</tr>
</table>
<p>With my recent post, &#8220;<a href="http://blog.securitymonks.com/2008/04/03/introduction-to-sqlite/">Introduction to SQLite</a>,&#8221; I have received some questions concerning <a href="http://www.mysql.com">MySQL</a>.  Many <a href="http://books.google.com/books?q=mysql&#038;btnG=Search+Books">fine books</a> have been written on MySQL and those books cover MySQL much better than a simple blog post could ever hope to do.  Still, there are some interesting links that might be useful for those looking to setup a MySQL server.  The purpose of this post is to introduce the reader to sources of information on MySQL and follow up with some basic installation instructions.  The sources linked in this post will provide a starting point to find additional in-depth discussions on MySQL. </p>
<p>
Theres is no definitive source of information for MySQL.  No &#8220;<a href="http://en.wikipedia.org/wiki/The_Hitchhiker's_Guide_to_the_Galaxy">Hitchhikers Guide</a> to MySQL.&#8221; The closest source fitting that description would be, &#8220;<a href="http://dev.mysql.com/doc/refman/5.0/en/index.html">MySQL 5.0 Reference Manual</a>.&#8221;  While it contains a wealth of information, it is somewhat boring.  The good news is a wealth of information from different sources does exist.  These sources focus in on different areas of interest, allowing you to access material on what is important to you.  While <a href="http://www.douglasadams.com/">Douglas Adams</a> might not have been involved in writing any MySQL references, at least you can choose to delve into details on topics that interest you in formats that may hold your attention (books, articles, podcasts, slides, videos). </p>
<h3>Documents and Articles</h3>
<p>There is nothing like the printed document when doing an installation, even if it is in electronic format.  As <a href="http://en.wikipedia.org/wiki/Joseph_Jacobson">Prof. Joseph M. Jacobson</a> once stated, &#8220;<em>If books had been invented after the computer, they would have been considered a big breakthrough. Books have several hundred simultaneous paper-thin, flexible displays. They boot instantly. They run on very low power at a very low cost.</em>&#8221;  Below are a few documents and articles that are most helpful when setting up MySQL.</p>
<ul>
<li><a href="http://dev.mysql.com/doc/refman/5.0/en/index.html">MySQL 5.0 Reference Manual</a> &#8211; the best place to start is the reference manual.  Generally, I prefer printed version verses accessing material online.  Since the reference manual is 2372 pages, I would suggest keeping to the electronic version.  In relation to security, please pay particular attention to:
<ul>
<li><a href="http://dev.mysql.com/doc/refman/5.1/en/installing-source.html">2.9. MySQL Installation Using a Source Distribution</a>.</li>
<li><a href="http://dev.mysql.com/doc/refman/5.1/en/security.html">5.3. General Security Issues</a>.</li>
<li><a href="http://dev.mysql.com/doc/refman/5.1/en/privilege-system.html">5.4. The MySQL Access Privilege System</a>.</li>
<li><a href="http://dev.mysql.com/doc/refman/5.1/en/user-account-management.html">5.5. MySQL User Account Management</a>.</li>
</ul>
</li>
<li><a href="http://www.cisecurity.org/bench_mysql.html">Center for Internet Security Benchmark for MySQL Versions 4.1, 5.0, and 5.1 Community Editions</a> by <a href="http://phed.org/">Mike Eddington</a>, Leviathan Security Group.</li>
<li><a href="http://dev.mysql.com/tech-resources/articles/mysql-complete-reference-ch14.html">MySQL: The Complete Reference, chapter 14: Security, Access Control, and Privileges</a> by <a href="http://devzone.zend.com/member/3034-vvaswani">Vikram Vaswani</a>.</li>
<li><a href="http://www.net-security.org/secworld.php?id=4135">10 steps to fortify the security of your MySQL installation</a>.</li>
<li><a href="http://www.securityfocus.com/infocus/1726">Securing MySQL: step-by-step</a> by <a href="http://www.zoominfo.com/people/Maj_Artur_-199910.aspx">Artur Maj</a>.</li>
<li><a href="http://www.securityfocus.com/infocus/1667">Secure MySQL Database Design</a> by <a href="http://www.zoominfo.com/Search/PersonDetail.aspx?PersonID=321895428">Kristy Westphal</a>.</li>
<li><a href="http://mysqldump.azundris.com/archives/49-Security-and-the-real-world.html#extended">Security and the real world </a>by <a href="http://www.spock.com/Kristian-Kohntopp-MZ20R18m">Kristian Köhntopp</a>.</li>
<li><a href="http://dev.mysql.com/tech-resources/articles/security_vulnerabilities.html">How MySQL Treats Security Vulnerabilities</a> by <a href="http://blogs.mysql.com/kaj/">Kaj Arno</a>.</li>
<li><a href="http://dev.mysql.com/tech-resources/articles/proxy-gettingstarted.html">Getting started with MySQL Proxy</a> by <a href="http://gmax.oltrelinux.com/">Giuseppe Maxia</a>.</li>
</ul>
<h3>Forums and Blogs</h3>
<p>Documents and articles are great, but frequently they can become out of date.  While most details remain the same even after versions advance or the software is implemented under different operating systems, the devil is always in the details.  Forums and blogs are a good source for finding resolution to those annoying details that can stop an installation cold.  Below is a listing of a few forums and blogs that might be of great help if you run into one of those devilish details.</p>
<ul>
<li><a href="http://forums.mysql.com/">MySQL Forums</a> &#8211; this forum is off the MySQL site and there are many forums of special interest, including a <a href="http://forums.mysql.com/list.php?30"><strong>Security Forum</strong></a>.  If you run into problems with the installation, there is an <a href="http://forums.mysql.com/list.php?11">Install Forum</a>.</li>
<li><a href="http://www.planetmysql.org/">Planet MySQL</a> &#8211; offers blogs, news, and opinions on MySQL.  If you try to access <strong>blogs.mysql.com</strong>, you will be redirected to planetmysql.org.</li>
<li><a href="http://sheeri.com/">Sheeri </a>by Sheeri Kritzer Cabral, MySQL and Oracle DBA for The Pythian Group.  Also see her podcast, <a href="http://sheeri.net/archives/category/oursql-database-podcast/">OurSQL MySQL Database Podcast</a>.</li>
<li><a href="http://rpbouman.blogspot.com">Roland Bouman&#8217;s blog</a>, by <a href="http://en.oreilly.com/mysql2008/public/schedule/speaker/198">Roland Bouman</a>, Training Course Curriculum Developer for MySQL AB and contributor to O&#8217;Reilly Databases site.</li>
<li><a href="http://datacharmer.blogspot.com/">The Data Charmer</a> by <a href="http://gmax.oltrelinux.com/">Giuseppe Maxia</a>, Database Analyst and Designer.  Contributor to O&#8217;Reilly Databases site (and a whole lot more).</li>
<li>MikeKruckenbery by <a href="http://mike.kruckenberg.com/resume.html">Mike Kruckenberg</a>, coauthor of <a href="http://www.amazon.com/gp/product/159059505X/sr=8-1/qid=1141098333/ref=pd_bbs_1/103-0418551-1549445?%5Fencoding=UTF8">Pro MySQL</a>.</li>
<li><a href="http://mysqldump.azundris.com/">MySQL-dump</a>.</li>
<li><a href="http://mysql-qa.blogspot.com/">MyQSL QA</a> by Jonathan Miller, Senior Lead Quality Assurance Developer.</li>
<li><a href="http://mysqlmusings.blogspot.com/">MySQL Musings</a> by <a href="http://pipl.com/directory/people/Mats/Kindahl">Mats Kindahl</a>, lead developer at MySQL with replication as main focus.</li>
<li><a href="http://mysqldatabaseadministration.blogspot.com/">Senior MySQL DBA Blog</a> by <a href="http://www.linkedin.com/in/mashraqi">Farhan Mashraqi</a>.</li>
<li><a href="http://www.mysqlperformanceblog.com/">MySQL Performance Blog</a> by <a href="http://www.percona.com/team/peter-zaitsev.html">Peter Zaitsev</a>.</li>
</ul>
<h3>Slides/Videos</h3>
<p>One of the more interesting way to view information on many a topic is through having it given in a presentation.  The speaker has to reduce topics to bullet points and hopefully do the presentation in an interesting and informative manner.  While many of the below presentations were given at conferences and user groups across the planet, the presentations have been generously provides for online access.  Below are a few videos and slides to serve as an introduction on MySQL topics.</p>
<ul>
<li><a href="http://video.google.com/videoplay?docid=4024533064019936096">MySQL Basics</a> by Chad Godfirnon</li>
<li><a href="http://video.google.com/videoplay?docid=-6510132373772175248">An Overview of the MySQL Engine and its Latest Features</a> by <a href="http://www.zoominfo.com/people/Katchaounov_Timour_694944861.aspx">Timour Katchaounov</a></li>
<li><a href="http://krow.net/talks/5.1%20In-Depth.pdf">5.1 In Depth</a> by <a href="http://krow.net/3069/Slides_for_the_MySQL_User%27s_Conference.html">Brian Aker</a></li>
<li><a href="http://video.google.com/videoplay?docid=-4567104036778249401">A Googly MySQL Cluster Talk</a> by <a href="http://www.flamingspork.com/blog/">Stewart Smith</a></li>
<li><a href="http://video.google.com/videoplay?docid=2524524540025172110">Performance Tuning Best Practices for MySQL</a> by <a href="http://jpipes.com/index.php">Jay Pipes</a>, co-author of <a href="http://www.apress.com/book/view/159059505X">Pro MySQL</a> (Apress, 2005)</li>
<li><a href="http://video.google.com/videoplay?docid=-1188570725316773434">MySQL Community Meetup: MySQL Proxies</a> by <a href="http://consoleninja.net/">Alan Kasindorf</a> </li>
<li><a href="http://video.google.com/videoplay?docid=-7162067881891962009">MySQL Backups</a> by <a href="http://www.sheeri.com/">Sheeri Kritzer</a></li>
<li><a href="http://video.google.com/videoplay?docid=-6304964351441328559">Scalability: YouTube Scalability</a> by Cuong Do Cuong</li>
<li><a href="http://technocation.org/node/106/play">MySQL Security</a> by <a href="www.sheeri.com">Sheeri Kritzer Cabral</a></li>
<li><a href="http://sheeri.net/archives/198">Testing the Security of Your Site</a> by <a href="www.sheeri.com">Sheeri Kritzer Cabral</a></li>
<li><a href="http://technocation.org/node/107/play">Auditing MySQL for Security and Compliance</a> by <a href="http://www.rippletech.com/index.php?page=management-team">Mehlam Shakir</a></li>
<li><a href="http://technocation.org/files/doc/2008_02_SecuringDBs.pdf">Why Are Databases So Hard To Secure?</a> by <a href="www.sheeri.com">Sheeri Kritzer Cabral</a></li>
<li><a href="http://www.mysql.com/news-and-events/on-demand-webinars/security-2006-04-19.php">Best Practices for Securing MySQL 5.0</a> by <a href="http://jimmyguerrero.blogspot.com/">Jimmy Guerrero</a>, Senior Product Manager, MySQL AB</li>
<li><a href="http://technocation.org/content/2007-mysql-user-conference-and-expo-presentations-and-videos">2007 MySQL User Conference And Expo Presentations and Videos</a></li>
</ul>
<h3>Installing MySQL</h3>
<p>Many operating systems come with MySQL already installed.  If MySQL is not installed, download it from the <a href="http://dev.mysql.com/downloads/mysql/">MySQL download page</a>.  In addition to the sources above, documentation on installation for particular operating systems can be found on the <a href="http://dev.mysql.com/doc/">MySQL Documentation page</a>.  There are instruction for:</p>
<ul>
<li><a href="http://dev.mysql.com/doc/refman/5.1/en/windows-installation.html">Installing on Windows</a></li>
<li><a href="http://dev.mysql.com/doc/refman/5.1/en/linux-rpm.html">Installing from RPM Packages on Linux</a> </li>
<li><a href="http://dev.mysql.com/doc/refman/5.1/en/mac-os-x-installation.html">Installing on Mac OS X</a></li>
<li><a href="http://dev.mysql.com/doc/refman/5.1/en/solaris-installation.html">Installing on Solaris</a></li>
<li><a href="http://dev.mysql.com/doc/refman/5.1/en/netware-installation.html">Installing on Netware</a></li>
<li><a href="http://dev.mysql.com/doc/refman/5.1/en/installing-binary.html">Installing from tar.gz Packages on Other Unix-Like Systems</a></li>
<li><a href="http://dev.mysql.com/doc/refman/5.1/en/installing-source.html">Installation Using a Source Distribution</a></li>
</ul>
<p>Once installed, there is much more configuration than can be adequately covered in a blog post. The below instructions are meant as a demonstration on what is involved in the installation of MySQL.  Please refer to MySQL installation documentation, books, and other information source for full details particular to your setup.
</p>
<p>
Additional steps may be taken to better secure the database.  For example, it may be desirable to <a href="http://www.linuxquestions.org/questions/linux-security-4/short-howto-chrooting-mysql-34338/">chrooting the MySQL server</a>.  The instructions below do not include those steps.  Please see Artur Maj excellent <a href="http://www.securityfocus.com/infocus/1726">article</a> for additional information.  The decisions to setup such an environment depends greatly on how the database will be used.  <a href="http://www.sei.cmu.edu/publications/documents/06.reports/06hb003.html">Defense in depth</a> is a great strategy, but security cannot be implemented without understanding.  One has to be careful not to add so many layers of security that implementation becomes impossible.  Under some circumstances, chrooting the MySQL server is a valid strategy.  That is not the case in all environments and uses.
</p>
<p>
The option for the <a href="http://www.zlib.net/">zlib</a> compression library will be used in this installation based on future requirements for the database.  On most operating systems, zlib is installed under the /usr directory (/usr/lib, /usr/include).  Make sure zlib is installed on your system.
</p>
<p>
If your get the error message &#8220;<strong>Cannot find libmysqlclient_r under /usr/local/mysql</strong>&#8221; it is because your client programs are using threads.  You need to compile a thread-safe version of the MySQL client library using the <strong>&#8211;enable-thread-safe-client</strong> configure option. This creates a libmysqlclient_r  library with which you should link your threaded applications.  For additional information, see the MySQL documentation &#8220;<a href="http://dev.mysql.com/doc/refman/5.1/en/threaded-clients.html">Section 26.2.16. How to Make a Threaded Client</a>.&#8221;
</p>
<p>
The MYSQL team compiles Mac OS X  with the following configuration:</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
CC=gcc CFLAGS="-O3 -fno-omit-frame-pointer" CXX=gcc \
CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors \
    -fno-exceptions -fno-rtti" \
    ./configure --prefix=/usr/local/mysql \
    --with-extra-charsets=complex --enable-thread-safe-client \
    --enable-local-infile --disable-shared
</pre>
</td>
</table>
<p>
This is close to what we will be using, with a few changes.  The configuration option <strong>&#8211;enable-local-infile</strong> allows &#8220;LOAD DATA LOCAL&#8221; to be used.  See MySQL documentation &#8220;<a href="http://dev.mysql.com/doc/refman/5.1/en/load-data-local.html">5.3.4. Security Issues with LOAD DATA LOCAL</a>&#8221; for reasons this may not be desirable.  The -fno-omit-frame-pointer Indicates whether the compiler should use the frame pointer for <a href="http://en.wikipedia.org/wiki/IA-32">IA32 </a>(Intel Architecture, 32-bit).  The option -felide-constructors tells the C++ compiler to use elide constructors when this plausible.  Error detection is done through the -fno-rtti -fno-exceptions options.  The &#8211;with-extra-charsets=complex adds code to all standard programs that enables them to handle latin1 and all multi-byte character sets within the binary.  For our purpose, this is not needed.  The  &#8211;disable-shared option disables the use of shared libraries.
</p>
<p>
The below instructions are meant to show the basic steps in setting up a MySQL database.  Additional steps may be required depending on your requirements.  The additional sources provided in this post are meant to provide assistance in determining solutions for the requirements of your environment.  </p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 root# cd /usr/local/src
 /usr/local/src root# groupadd mysql
 /usr/local/src root# useradd -g mysql mysql
 /usr/local/src root# wget \

http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-5.0.51a.tar.gz\

/from/http://mirror.services.wisc.edu/mysql/
 /usr/local/src root# /sbin/md5 mysql-5.0.51a.tar.gz
MD5 (mysql-5.0.51a.tar.gz) = a83dbdbb91267daf73d2297a9c283dd1
 /usr/local/src root# mkdir /usr/local/mysql-5.0.51a
 /usr/local/src root# ln -s /usr/local/mysql-5.0.51a /usr/local/mysql
 /usr/local/src root# tar xzf mysql-5.0.51a.tar.gz
 /usr/local/src root# cd mysql-5.0.51a
 /usr/local/src/mysql-5.0.51a root# CC=gcc \
      CFLAGS="-O3 -fno-omit-frame-pointer" \
      CXX=gcc CXXFLAGS="-O3 -fno-omit-frame-pointer \
       -felide-constructors -fno-exceptions -fno-rtti" \
       ./configure --prefix=/usr/local/mysql \
       --enable-assembler \
       --with-mysqld-ldflags=-all-static \
       --enable-thread-safe-client \
       --with-zlib-dir=/usr
 /usr/local/src/mysql-5.0.51a root# make
 /usr/local/src/mysql-5.0.51a root# make test
 /usr/local/src/mysql-5.0.51a root# make install
 /usr/local/src/mysql-5.0.51a root# scripts/mysql_install_db --user=mysql
 /usr/local/src/mysql-5.0.51a root# cd /usr/local/mysql
 /usr/local/mysql root# chown -R root .
 /usr/local/mysql root# chgrp -R mysql .
 /usr/local/mysql root# chown -R mysql var
</pre>
</td>
</table>
<p>
At this point, you will want to add the mysql binaries to your PATH, start up the MySQL server, and run the <strong>mysql_secure_installation</strong> command.</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 /usr/local/mysql root# export PATH="/bin:/sbin:/usr/bin:/usr/local/bin:/usr/sbin:/usr/local/mysql/bin"
 /usr/local/mysql root# bin/mysqld_safe --user=mysql &#038;
 /usr/local/mysql root# /usr/local/mysql/bin/mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] <strong>Y</strong>
New password: <strong>SecretPassword</strong>
Re-enter new password: <strong>SecretPassword</strong>
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] <strong>Y</strong>
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] <strong>Y</strong>
 ... Success!

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] <strong>Y</strong>
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] <strong>Y</strong>
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

 /usr/local/mysql root# mysql -u root -p
</pre>
</td>
</table>
<p>
Please do not use <strong>SecretPassword</strong> as the root account password.  That is used only to demonstrate a password is entered.  If you ever need to grant full access to a particular database (say snort) to user (say snortadmin) do the following:</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 /usr/local/src root# mysql -u root -p
 mysql> create database snort;
 mysql> GRANT ALL PRIVILEGES ON snort.* TO
    'snortadmin'@'localhost' IDENTIFIED BY 'newpasswd' WITH GRANT OPTION;
</pre>
</td>
</table>
<p>
Now, shutdown the MySQL server, create a MySQL configuration file, and finally bring the server back up.  Depending on your sites requirement, you may want to set a few security variables in the MySQL configuration file:
</p>
<p>
skip-networking<br />
skip-show-database<br />
secure-auth<br />
safe-user-create<br />
skip-automatic_sp_privileges<br />
set-variable=local-infile=0
</p>
<p>
Generally, you want to build a server configuration file with only the commands required to run the server in the manner you desire.  For simplicity, and to keep this post size from becoming too large, we are going to copy an existing MySQL configuration file from support-files to a default location of /etc/my.cnf.  That file will be modified.  The &#8220;skip-networking&#8221; line will limit access to the MySQL database to local communication only through the mysql.sock socket.  The &#8220;skip-show-database&#8221; line will limit the SHOW DATABASES  statement only to users who have the SHOW DATABASES privilege.  The &#8220;secure-auth&#8221; line dsallow authentication by clients that attempt to use accounts that have old (pre-4.1) passwords.  With the &#8220;safe-user-create&#8221; line a user cannot create new MySQL users by using the GRANT statement unless the user has the INSERT privilege for the mysql.user table or any column in the table.  With the line &#8220;skip-automatic_sp_privileges&#8221; the server does not automatically add and drop the EXECUTE  and ALTER ROUTINE privileges to the creator of a stored routine, if the user cannot already execute and alter or drop the routine.
</p>
<p>
There is an option to run MySQL with the &#8211;secure-file-priv=path option limits the effect of the LOAD_FILE() function and the LOAD DATA and SELECT &#8230; INTO OUTFILE statements to work only with files in the specified directory. You can also disable the use of LOAD DATA LOCAL INFILE command by adding the line &#8220;set-variable=local-infile=0.&#8221;  MySQL clients and libraries in binary distributions are compiled with the &#8211;enable-local-infile option, to be compatible with MySQL 3.23.48 and before.  When we configured from source, we did not include the &#8211;enable-local-infile option.
</p>
<p>
First, we should confirm that the MySQL server is running on port 3306.  Then, we will modify the MySQL configuration file adding the lines discussed above, restart the MySQL server, and confirm the changes have been made.</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 /usr/local/src root# lsof -i TCP:3306
COMMAND   PID   USER   FD   TYPE    DEVICE SIZE/OFF NODE NAME
mysqld  56676 _mysql   10u  IPv4 0x91abe64      0t0  TCP *:mysql (LISTEN)

 /usr/local/src root# /usr/local/mysql/bin/mysqladmin -u root -p shutdown
 /usr/local/src root# cd /usr/local/src/mysql-5.0.51a
 /usr/local/src/mysql-5.0.51a root# cp support-files/my-medium.cnf /etc/my.cnf
 /usr/local/src/mysql-5.0.51a root# chown root:sys /etc/my.cnf
 /usr/local/src/mysql-5.0.51a root# chmod 640 /etc/my.cnf
 /usr/local/src/mysql-5.0.51a root# vi  /etc/my.cnf 

Add the lines above under the [mysqld] section.
Comment out the "port = 3306" lines.

 /usr/local/src/mysql-5.0.51a root# cd /usr/local/mysql
 /usr/local/mysql root# bin/mysqld_safe --user=mysql &#038;
 /usr/local/mysql root# lsof -i TCP:3306
 /usr/local/mysql root# ls -la /tmp/mysql.sock
 /usr/local/mysql root# mysql -u root -p
</pre>
</td>
</table>
<p>
The final command &#8220;lsof -i TCP:3306&#8243; should confirm that the &#8220;skip-networking&#8221; line in /etc/my.cnf stopped MySQL from listening on port 3306.  The command &#8220;/tmp/mysql.sock&#8221; will confirm the creation of the file for local communication.  If you created the user &#8220;snortadmin&#8221; you can confirm the &#8220;skip-show-database&#8221; command and that we cannot load a local file into the database.</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 root# mysql -u snortadmin -p
 mysql> show databases;
ERROR 1227 (42000): Access denied; you need the SHOW DATABASES privilege for this operation
 mysql> use snort;
 mysql> create table test (fulltxt TEXT);
 mysql> LOAD DATA LOCAL INFILE '/etc/passwd' INTO TABLE test;
ERROR 1148 (42000): The used command is not allowed with this MySQL version
</pre>
</td>
</table>
<p></p>
<p><h3>Perl and MySQL: DBD::mysql and DBI</h3>
<p>Many operating systems will have DBD::mysql installed.  The binary distribution for the operating system and version of the MySQL can be downloaded and installed.  The following instruction on the configuration, compilation, and installation of the source is provided as one example of how the Perl modules DBD::mysql and DBI can be installed.  When upgrading the MySQL database, make sure to reinstall DBD::mysql.</p>
<table width="100%" cellpadding="0" cellspacing="1" border="1">
<td class="code-outline" BGCOLOR="#F5F5F5">
<pre class="displaycode">
 root# cd /usr/local/src
 /usr/local/src root# wget http://search.cpan.org/CPAN/\
 authors/id/C/CA/CAPTTOFU/DBD-mysql-4.006.tar.gz
 /usr/local/src root# wget http://search.cpan.org/CPAN/\
 authors/id/T/TI/TIMB/DBI-1.604.tar.gz
 /usr/local/src root# tar xzf DBD-mysql-4.006.tar.gz
 /usr/local/src root# tar xzf DBI-1.604.tar.gz
 /usr/local/src root# cd DBI-1.604
 /usr/local/src/DBI-1.604 root# perl Makefile.PL
 /usr/local/src/DBI-1.604 root# make
 /usr/local/src/DBI-1.604 root# make test
 /usr/local/src/DBI-1.604 root# make install
 /usr/local/src/DBI-1.604 root# cd ../DBD-mysql-4.006
 /usr/local/src/DBD-mysql-4.006 root# perl Makefile.PL
 /usr/local/src/DBD-mysql-4.006 root# make
 /usr/local/src/DBD-mysql-4.006 root# make test
 /usr/local/src/DBD-mysql-4.006 root# make install
</pre>
</td>
</table>
<p></p>
<h3>Additional Sources</h3>
<p>Below are a few sources of information with continously changing content. </p>
<ul>
<li><a href="http://dev.mysql.com/tech-resources/articles/">Developer Articles</a></li>
<li><a href="http://www.onlamp.com/onlamp/general/mysql.csp">O&#8217;Reilly ONLamp</a></li>
<li><a href="http://www.oreillynet.com/databases/">O&#8217;Reilly Databases Site</a></li>
<li><a href="http://www.databasejournal.com/features/mysql/">Database Journal</a></li>
<li><a href="http://www.devshed.com/c/b/MySQL/">Dev Shed</a></li>
<li><a href="http://www.sitepoint.com/search/search.php?ps=10&#038;q=mysql&#038;submit=Search">SitePoint</a></li>
</ul>
<h3>Conclusions</h3>
<p>There are many more tools and much more information available on MySQL.  The above sources are meant only as a starting point.  As <a href="http://plato.stanford.edu/entries/confucius/">Confucius</a> once wrote, &#8220;<em>a journey of a thousand miles begins with a single step</em>.&#8221;  Or if you prefer <a href="http://en.wikipedia.org/wiki/Jules_Bass">Jules Bass</a>, &#8220;<em>Put one foot in front of the other and soon you’ll be walking cross the floor</em>.&#8221;  You do not need to have watched each video, gone through each presentation, read every document, nor be familiar with the content on every blog concerning MySQL in order to begin working with MySQL.  One has to start somewhere.  The best piece of advice is simply take one step at a time and start now.  In the immortal words of <a href="http://en.wikipedia.org/wiki/Meredith_Grey">Meredith</a> from <a href="http://www.greysanatomyinsider.com/quotes/episodes/if-tomorrow-never-comes/">Grey&#8217;s Anatomy</a>, &#8220;<em>The early bird catches the worm; a stitch in time saves nine. He who hesitates is lost. We can&#8217;t pretend we haven&#8217;t been told. We&#8217;ve all heard the proverbs, heard the philosophers, heard our grandparents warning us about wasted time, heard the damn poets urging us to ‘seize the day&#8217;. Still sometimes we have to see for ourselves. We have to make our own mistakes. We have to learn our own lessons. We have to sweep today&#8217;s possibility under tomorrow&#8217;s rug until we can&#8217;t anymore, until we finally understand for ourselves like Benjamin Franklin meant. That knowing is better than wondering; that waking is better than sleeping. And that even the biggest failure, even the worst most intractable mistake beats the hell out of never trying</em>.&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.securitymonks.com/2008/04/07/introduction-to-mysql/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Setting Up and Securing MySQL: References</title>
		<link>http://blog.securitymonks.com/2008/02/28/setting-up-and-securing-mysql-references/</link>
		<comments>http://blog.securitymonks.com/2008/02/28/setting-up-and-securing-mysql-references/#comments</comments>
		<pubDate>Thu, 28 Feb 2008 20:10:09 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[References]]></category>
		<category><![CDATA[Resources]]></category>

		<guid isPermaLink="false">http://blog.securitymonks.com/2008/02/28/setting-up-and-securing-mysql-references/</guid>
		<description><![CDATA[Recently I was involved with testing a companies&#8217; employees susceptibility to a phishing attack using fake Valentine day e-cards.   The employees had all undergone training on phishing.  Still many people clicked, in hopes of finding out that they were loved.  It really is not surprising.  This is why we practiced [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blogs.sun.com/portal/resource/info.jpg" alt="Research" align="left" width=100 />Recently I was involved with testing a companies&#8217; employees susceptibility to a <a href="http://cups.cs.cmu.edu/trust.php">phishing</a> attack using fake <a href="http://www.jibjab.com/sendables/307/Valentine_s_Day/Happy_Valentine_s_Day">Valentine day e-cards</a>.   The employees had all undergone training on phishing.  Still many people clicked, in hopes of finding out that they were loved.  It really is not surprising.  This is why we practiced <a href="http://www.sei.cmu.edu/publications/documents/06.reports/06hb003.html">defense-in-depth</a>.  Normally, controls would have prevented this e-card from getting through.  Other controls would have pulled the phishing attempt before most people would of viewed it.  We wanted to test the employees, so those controls were not activated.  We had one person tell us that they figured if it was anything bad we would have stopped it, so he felt it was safe to click.  The layers had instilled in him a false sense of security.  Others went further telling us how security needs to make sure they never get these phishing attempts.  It was not their job to worry about security.</p>
<p>
Unfortunately, when it comes to installing software, secure design is often the last consideration. I know a gentleman who frequently will state, &#8220;I just have to get this done.&#8221;  When it comes to software installation, he will find packages that will take care of the installation of the software for him.  Unfortunately, frequently those packages are design to cause the least problems installing on as many varied systems as possible.  Now consider what an importance role that the database plays.  Should you not invest some time in configuring it correctly and learning how to properly manage the database?
</p>
<p>
Like my previous posting, &#8220;<a href="http://blog.securitymonks.com/2008/02/24/securing-apache-references/">Securing Apache: References</a>,&#8221; I wanted to start off by providing references.  My focus is on the security aspects of setting up <a href="http://www.mysql.com">MySQL</a>.  This posting will be followed by a hands on step-by-step posting.  The below references will provide a great deal more information than I could ever provide in blog postings.  I am only trying to point the way to greater understanding.</p>
<h3>Documents and Articles</h3>
<p>Podcasts, blogs, and forums are great ways to get specific information.  A document, such as a reference manual, will provide a better breadth of coverage.  For this reason, when starting any project, I like to start out with documents, books, and articles.  Articles are good in that the tend to be somewhat authoritative, and lead to additional articles within the magazine/site.</p>
<ul>
<li><a href="http://dev.mysql.com/doc/refman/5.1/en/index.html">MySQL 5.1 Reference Manual</a> &#8211; the best place to start is the reference manual.  Generally, I prefer printed version verses accessing material online.  Since the reference manual is 2372 pages, I would suggest keeping to the electronic version.  In relation to security, please pay particular attention to:
<ul>
<li><a href="http://dev.mysql.com/doc/refman/5.1/en/installing-source.html">2.9. MySQL Installation Using a Source Distribution</a>.</li>
<li><a href="http://dev.mysql.com/doc/refman/5.1/en/security.html">5.3. General Security Issues</a>.</li>
<li><a href="http://dev.mysql.com/doc/refman/5.1/en/privilege-system.html">5.4. The MySQL Access Privilege System</a>.</li>
<li><a href="http://dev.mysql.com/doc/refman/5.1/en/user-account-management.html">5.5. MySQL User Account Management</a>.</li>
</ul>
</li>
<li><a href="http://www.cisecurity.org/bench_mysql.html">Center for Internet Security Benchmark for MySQL Versions 4.1, 5.0, and 5.1 Community Editions</a> by <a href="http://phed.org/">Mike Eddington</a>, Leviathan Security Group.</li>
<li><a href="http://dev.mysql.com/tech-resources/articles/mysql-complete-reference-ch14.html">MySQL: The Complete Reference, chapter 14: Security, Access Control, and Privileges</a> by <a href="http://devzone.zend.com/member/3034-vvaswani">Vikram Vaswani</a>.</li>
<li><a href="http://www.net-security.org/secworld.php?id=4135">10 steps to fortify the security of your MySQL installation</a>.</li>
<li><a href="http://www.securityfocus.com/infocus/1726">Securing MySQL: step-by-step</a> by <a href="http://www.zoominfo.com/people/Maj_Artur_-199910.aspx">Artur Maj</a>.</li>
<li><a href="http://www.securityfocus.com/infocus/1667">Secure MySQL Database Design</a> by <a href="http://www.zoominfo.com/Search/PersonDetail.aspx?PersonID=321895428">Kristy Westphal</a>.</li>
<li><a href="http://mysqldump.azundris.com/archives/49-Security-and-the-real-world.html#extended">Security and the real world </a>by <a href="http://www.spock.com/Kristian-Kohntopp-MZ20R18m">Kristian Köhntopp</a>.</li>
<li><a href="http://dev.mysql.com/tech-resources/articles/security_vulnerabilities.html">How MySQL Treats Security Vulnerabilities</a> by <a href="http://blogs.mysql.com/kaj/">Kaj Arno</a>.</li>
<li><a href="http://dev.mysql.com/tech-resources/articles/proxy-gettingstarted.html">Getting started with MySQL Proxy</a> by <a href="http://gmax.oltrelinux.com/">Giuseppe Maxia</a>.</li>
</ul>
<h3>Web Seminars and Podcasts</h3>
<p>The MySQL site does offer <a href="http://www.mysql.com/news-and-events/on-demand-webinars/">on-demand web seminars</a>.  Of particular interest is &#8220;<a href="http://www.mysql.com/news-and-events/on-demand-webinars/security-2006-04-19.php">Best Practices for Securing MySQL 5.0</a>&#8221; by <a href="http://jimmyguerrero.blogspot.com/">Jimmy Guerrero</a>, Senior Product Manager, MySQL AB.  <a href="http://en.oreilly.com/mysql2008/public/schedule/speaker/803">Sheeri Kritzer Cabral</a> (blog site listed below) made available her presentation to the Boston MySQL user group, titled &#8220;<a href="http://sheeri.net/archives/183">MySQL Security</a>&#8220;.  Sheeri has also made available her podcast, &#8220;<a href="http://sheeri.net/archives/179">Basic MySQL Security</a>.&#8221;  The <a href="http://sheeri.net/archives/category/oursql-database-podcast/">OurSQL MySQL Database Podcast</a> is a very interesting podcast.  It is a great way to keep informed on MySQL.  Sheeri will be presenting at the MySQL Conference and Expo &#8220;<a href="http://en.oreilly.com/mysql2008/public/schedule/detail/981">Database Security Using White-Hat Google Hacking</a>.&#8221;  It should be a great talk.
</p>
<p><h3>Forums and Blogs</h3>
<p>While most of these forums and blogs might not focus on security, blogs can having postings on a variety of topics.  There are many more great MySQL blogs.  The list below were chosen because they had some security posts and/or the blogger had written articles, did presentations, or in some way indicated an awareness of security.</p>
<ul>
<li><a href="http://forums.mysql.com/">MySQL Forums</a> &#8211; this forum is off the MySQL site and there are many forums of special interest, including a <a href="http://forums.mysql.com/list.php?30"><strong>Security Forum</strong></a>.  If you run into problems with the installation, there is an <a href="http://forums.mysql.com/list.php?11">Install Forum</a>.</li>
<li><a href="http://www.planetmysql.org/">Planet MySQL</a> &#8211; offers blogs, news, and opinions on MySQL.  If you try to access <strong>blogs.mysql.com</strong>, you will be redirected to planetmysql.org.</li>
<li><a href="http://sheeri.com/">Sheeri </a>by Sheeri Kritzer Cabral, MySQL and Oracle DBA for The Pythian Group.  Also see her podcast, <a href="http://sheeri.net/archives/category/oursql-database-podcast/">OurSQL MySQL Database Podcast</a>.</li>
<li><a href="http://rpbouman.blogspot.com">Roland Bouman&#8217;s blog</a>, by <a href="http://en.oreilly.com/mysql2008/public/schedule/speaker/198">Roland Bouman</a>, Training Course Curriculum Developer for MySQL AB and contributor to O&#8217;Reilly Databases site.</li>
<li><a href="http://datacharmer.blogspot.com/">The Data Charmer</a> by <a href="http://gmax.oltrelinux.com/">Giuseppe Maxia</a>, Database Analyst and Designer.  Contributor to O&#8217;Reilly Databases site (and a whole lot more).</li>
<li>MikeKruckenbery by <a href="http://mike.kruckenberg.com/resume.html">Mike Kruckenberg</a>, coauthor of <a href="http://www.amazon.com/gp/product/159059505X/sr=8-1/qid=1141098333/ref=pd_bbs_1/103-0418551-1549445?%5Fencoding=UTF8">Pro MySQL</a>.</li>
<li><a href="http://mysqldump.azundris.com/">MySQL-dump</a>.</li>
<li><a href="http://mysql-qa.blogspot.com/">MyQSL QA</a> by Jonathan Miller, Senior Lead Quality Assurance Developer.</li>
<li><a href="http://mysqlmusings.blogspot.com/">MySQL Musings</a> by <a href="http://pipl.com/directory/people/Mats/Kindahl">Mats Kindahl</a>, lead developer at MySQL with replication as main focus.</li>
<li><a href="http://mysqldatabaseadministration.blogspot.com/">Senior MySQL DBA Blog</a> by <a href="http://www.linkedin.com/in/mashraqi">Farhan Mashraqi</a>.</li>
<li><a href="http://www.mysqlperformanceblog.com/">MySQL Performance Blog</a> by <a href="http://www.percona.com/team/peter-zaitsev.html">Peter Zaitsev</a>.</li>
</ul>
<h3>Sites</h3>
<p>A few sites with articles on MySQL that might be of interest.  Their focus is not on security or configuration, but the sites are good sources for MySQL information:</p>
<ul>
<li><a href="http://www.onlamp.com/onlamp/general/mysql.csp">O&#8217;Reilly ONLamp</a>.</li>
<li><a href="http://www.oreillynet.com/databases/">O&#8217;Reilly Databases Site</a>.</li>
<li><a href="http://www.databasejournal.com/features/mysql/">Database Journal</a>.</li>
<li><a href="http://www.devshed.com/c/b/MySQL/">Dev Shed</a>.</li>
<li><a href="http://www.sitepoint.com/search/search.php?ps=10&#038;q=mysql&#038;submit=Search">SitePoint</a>.</li>
</ul>
<h3>Wrap Up</h3>
<p>The above sources provide not only a good starting point for MySQL secure installation, but a library for help with MySQL operations.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.securitymonks.com/2008/02/28/setting-up-and-securing-mysql-references/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

