From d8e54f96fb0516b0fd750016e60bf9cd37e0acc8 Mon Sep 17 00:00:00 2001 From: Jose Alberto Suarez Lopez Date: Wed, 20 Oct 2004 14:17:46 +0000 Subject: [PATCH] New ebuild --- net-analyzer/midas-nms/ChangeLog | 9 + net-analyzer/midas-nms/Manifest | 5 + .../midas-nms/files/digest-midas-nms-2.2f | 1 + net-analyzer/midas-nms/files/install.php | 456 ++++++++++++++++++ net-analyzer/midas-nms/metadata.xml | 12 + net-analyzer/midas-nms/midas-nms-2.2f.ebuild | 65 +++ 6 files changed, 548 insertions(+) create mode 100644 net-analyzer/midas-nms/ChangeLog create mode 100644 net-analyzer/midas-nms/Manifest create mode 100644 net-analyzer/midas-nms/files/digest-midas-nms-2.2f create mode 100644 net-analyzer/midas-nms/files/install.php create mode 100644 net-analyzer/midas-nms/metadata.xml create mode 100644 net-analyzer/midas-nms/midas-nms-2.2f.ebuild diff --git a/net-analyzer/midas-nms/ChangeLog b/net-analyzer/midas-nms/ChangeLog new file mode 100644 index 000000000000..29ec26690f76 --- /dev/null +++ b/net-analyzer/midas-nms/ChangeLog @@ -0,0 +1,9 @@ +# ChangeLog for net-analyzer/midas-nms +# Copyright 1999-2004 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/midas-nms/ChangeLog,v 1.1 2004/10/20 14:17:46 bass Exp $ + +*midas-nms-2.2f (20 Oct 2004) + + 20 Oct 2004; ,,, +midas-nms-2.2f.ebuild: + New ebuild + diff --git a/net-analyzer/midas-nms/Manifest b/net-analyzer/midas-nms/Manifest new file mode 100644 index 000000000000..01276de8f700 --- /dev/null +++ b/net-analyzer/midas-nms/Manifest @@ -0,0 +1,5 @@ +MD5 11bdb9bb14ceb80e733527424090d7ce midas-nms-2.2f.ebuild 1579 +MD5 bd0d28d086d5fa43770b826efd95ae02 ChangeLog 321 +MD5 2325a593d0fbd031c1c826c09c608094 metadata.xml 497 +MD5 e7a862adf3ca3c2e272a105a9d0f8508 files/install.php 19473 +MD5 e695413f3cb4faaa8d209e436ca8e97c files/digest-midas-nms-2.2f 63 diff --git a/net-analyzer/midas-nms/files/digest-midas-nms-2.2f b/net-analyzer/midas-nms/files/digest-midas-nms-2.2f new file mode 100644 index 000000000000..80c8550ba25a --- /dev/null +++ b/net-analyzer/midas-nms/files/digest-midas-nms-2.2f @@ -0,0 +1 @@ +MD5 ff8752c914dd23a25bc9bc094aab2c38 MIDAS-2.2f.tar.gz 1245707 diff --git a/net-analyzer/midas-nms/files/install.php b/net-analyzer/midas-nms/files/install.php new file mode 100644 index 000000000000..b7fa68c25e11 --- /dev/null +++ b/net-analyzer/midas-nms/files/install.php @@ -0,0 +1,456 @@ +\n"); +printf("\n"); +printf("%s %s\n", _APPNAME, _VERSION); +printf("\n"); +printf("\n", $color['css']); + +printf("\n", $color[3]); + +$DIR = _DOC_ROOT . "inc/config"; +$IMGDIR = _DOC_ROOT . "php-graph"; +$CONFIG = $DIR . "/config.php"; +$TEMPLATE = $DIR . "/config.template"; + +if($_POST['LOC'] == "") { + $info = null; + $error = FALSE; + + if(@is_readable($CONFIG)) { + $schk .= html_tag("TR", + html_tag("TD", "Site Config Exists", $color[0], "class=blacksmall align=left") . + html_tag("TD", "WARNING", $color[1], "class=blacksmall align=center"), + "", ""); + } else { + $schk .= html_tag("TR", + html_tag("TD", "Site Config Exists", $color[0], "class=blacksmall align=left") . + html_tag("TD", "OK", $color[12], "class=blacksmall align=center"), + "", ""); + } + + if(@is_readable($TEMPLATE)) { + $schk .= html_tag("TR", + html_tag("TD", "Site Config Template Exists", $color[0], "class=blacksmall align=left") . + html_tag("TD", "OK", $color[12], "class=blacksmall align=center"), + "", ""); + } else { + $schk .= html_tag("TR", + html_tag("TD", "Site Config Template Exists", $color[0], "class=blacksmall align=left") . + html_tag("TD", "ERROR", $color[2], "class=blacksmall align=center"), + "", ""); + $error = TRUE; + } + + if(@!is_writeable($DIR)) { + $schk .= html_tag("TR", + html_tag("TD", "/inc/config directory is Writable", $color[0], "class=blacksmall align=left") . + html_tag("TD", "ERROR", $color[2], "class=blacksmall align=center"), + "", ""); + $error = TRUE; + } else { + $schk .= html_tag("TR", + html_tag("TD", "/inc/config directory is Writable", $color[0], "class=blacksmall align=left") . + html_tag("TD", "OK", $color[12], "class=blacksmall align=center"), + "", ""); + } + + if(@!is_writeable($IMGDIR)) { + $schk .= html_tag("TR", + html_tag("TD", "/php-graph directory is Writable", $color[0], "class=blacksmall align=left") . + html_tag("TD", "ERROR", $color[2], "class=blacksmall align=center"), + "", ""); + $error = TRUE; + } else { + $schk .= html_tag("TR", + html_tag("TD", "/php-graph directory is Writable", $color[0], "class=blacksmall align=left") . + html_tag("TD", "OK", $color[12], "class=blacksmall align=center"), + "", ""); + } + if(@!function_exists(mysql_connect)) { + $schk .= html_tag("TR", + html_tag("TD", "PHP with MySQL support", $color[0], "class=blacksmall align=left") . + html_tag("TD", "ERROR", $color[2], "class=blacksmall align=center"), + "", ""); + $error = TRUE; + } else { + $schk .= html_tag("TR", + html_tag("TD", "PHP with MySQL support", $color[0], "class=blacksmall align=left") . + html_tag("TD", "OK", $color[12], "class=blacksmall align=center"), + "", ""); + } + if(@!function_exists(imagepng)) { + $schk .= html_tag("TR", + html_tag("TD", "PHP with GD+PNG support", $color[0], "class=blacksmall align=left") . + html_tag("TD", "WARNING", $color[1], "class=blacksmall align=center"), + "", ""); + } else { + $schk .= html_tag("TR", + html_tag("TD", "PHP with GD+PNG support", $color[0], "class=blacksmall align=left") . + html_tag("TD", "OK", $color[12], "class=blacksmall align=center"), + "", ""); + } + + $conf = html_tag("TR", + html_tag("TD", "Absolute directory\n", $color[0], "class=blacksmall align=left") . + html_tag("TD", "\n", $color[3], "class=blacksmall align=left"), + "", "") . + html_tag("TR", + html_tag("TD", "URL Directory\n", $color[0], "class=blacksmall align=left") . + html_tag("TD", "\n", $color[3], "class=blacksmall align=left"), + "", "") . + sprintf("\n") . + html_tag("TR", + html_tag("TD", "PHP Graphics URL Location\n", $color[0], "class=blacksmall align=left") . + html_tag("TD", "/php-graph\n", $color[3], "class=blacksmall align=left"), + "", "") . + html_tag("TR", + html_tag("TD", "MySQL Server\n", $color[0], "class=blacksmall align=left") . + html_tag("TD", "\n", $color[3], "class=blacksmall align=left"), + "", "") . + html_tag("TR", + html_tag("TD", "MySQL user\n", $color[0], "class=blacksmall align=left") . + html_tag("TD", "\n", $color[3], "class=blacksmall align=left"), + "", "") . + html_tag("TR", + html_tag("TD", "MySQL passwd\n", $color[0], "class=blacksmall align=left") . + html_tag("TD", "\n", $color[3], "class=blacksmall align=left"), + "", "") . + html_tag("TR", + html_tag("TD", "MySQL dB\n", $color[0], "class=blacksmall align=left") . + html_tag("TD", "\n", $color[3], "class=blacksmall align=left"), + "", "") . + html_tag("TR", + html_tag("TD", "MIDAS MySQL allowed hosts\n", $color[0], "class=blacksmall align=left") . + html_tag("TD", "\n", $color[3], "class=blacksmall align=left"), + "", "") . + html_tag("TR", + html_tag("TD", "MIDAS MySQL user\n", $color[0], "class=blacksmall align=left") . + html_tag("TD", "\n", $color[3], "class=blacksmall align=left"), + "", "") . + html_tag("TR", + html_tag("TD", "MIDAS MySQL passwd\n", $color[0], "class=blacksmall align=left") . + html_tag("TD", "\n", $color[3], "class=blacksmall align=left"), + "", "") . + html_tag("TR", + html_tag("TD", "MIDAS dB SQL file\n", $color[0], "class=blacksmall align=left") . + html_tag("TD", "\n", $color[3], "class=blacksmall align=left"), + "", "") . + html_tag("TR", + html_tag("TD", "SNORT Default Rules SQL file\n", $color[0], "class=blacksmall align=left") . + html_tag("TD", "\n", $color[3], "class=blacksmall align=left"), + "", "") . + html_tag("TR", + html_tag("TD", "Create inc/config/config.php file\n", $color[0], "class=blacksmall align=left") . + html_tag("TD", "\n", $color[3], "class=blacksmall align=center"), + "", "") . + html_tag("TR", + html_tag("TD", "Create MIDAS dB user\n", $color[0], "class=blacksmall align=left") . + html_tag("TD", "\n", $color[3], "class=blacksmall align=center"), + "", "") . + html_tag("TR", + html_tag("TD", "Install MIDAS SQL\n", $color[0], "class=blacksmall align=left") . + html_tag("TD", "\n", $color[3], "class=blacksmall align=center"), + "", "") . + html_tag("TR", + html_tag("TD", "Install SNORT Default Rules SQL file\n", $color[0], "class=blacksmall align=left") . + html_tag("TD", "\n", $color[3], "class=blacksmall align=center"), + "", ""); + + $info = html_tag("TABLE", + html_tag("TR", + html_tag("TD", "Site Configuration Sanity Checks", $color[9], "colspan=2 class=blacksmall align=center"), + "", "") . + $schk, + $color[10], "width=50% cellspacing=1 cellpadding=2") . + "
" . + ((!$error) ? + html_tag("TABLE", + html_tag("TR", + sprintf("
\n") . + html_tag("TD", "Site Configuration", $color[9], "colspan=2 class=blacksmall align=center"), + "", "") . + $conf . + html_tag("TR", + html_tag("TD", "\n", $color[3], "colspan=2 class=blacksmall align=center") . + sprintf("
\n"), + "", ""), + $color[10], "width=50% cellspacing=1 cellpadding=2") : + "The above error(s) must be fixed before continuing!\n"); +} else if($_POST['LOC'] == "INSTALL") { + // Building /inc/config/config.php + if($_POST['CREATE_CONFIG_FILE']) { + if($tp = @fopen($TEMPLATE, "r")) { + if($fp = @fopen($CONFIG, "w+")) { + while(!@feof($tp)) { + $line = @fgets($tp, 1024); + $pattern = null; + $replace = null; + $x = 0; + $sPOS = 0; + $ePOS = 0; + while(($sPOS = strpos($line, "$[", $ePOS)) !== FALSE) { + if(($ePOS = strpos($line, "]$", $sPOS)) !== FALSE) { + $pattern[$x] = substr($line, $sPOS, $ePOS-($sPOS-2)); + $replace[$x] = $_POST[str_replace(Array("$[", "]$"), Array("", ""), $pattern[$x])]; + $x++; + } else { + $ePOS = $sPOS; + } + } + fputs($fp, str_replace($pattern, $replace, $line)); + } + fclose($fp); + } else { + $inst = html_tag("TR", + html_tag("TD", "config.php created", $color[0], "class=blacksmall align=left") . + html_tag("TD", "ERROR", $color[2], "class=blacksmall align=center"), + "", ""); + } + fclose($tp); + if(is_null($inst)) { + $inst = html_tag("TR", + html_tag("TD", "config.php created", $color[0], "class=blacksmall align=left") . + html_tag("TD", "OK", $color[12], "class=blacksmall align=center"), + "", ""); + } + } else { + $inst = html_tag("TR", + html_tag("TD", "config.php created", $color[0], "class=blacksmall align=left") . + html_tag("TD", "ERROR", $color[2], "class=blacksmall align=center"), + "", ""); + } + } + + // SQL install (If applicable) + $credentials['mySQL']['server'] = $_POST['SERVER']; + $credentials['mySQL']['user'] = $_POST['USER']; + $credentials['mySQL']['passwd'] = $_POST['PASSWD']; + $db = new conn_mySQL($credentials); + + $db->db_new_conn(); + + if($_POST['CREATE_MIDAS_USER']) { + $db->db = "mysql"; + $hostList = explode(",", $_POST['ALLOWED_HOSTS']); + for($x=0;$xadd_table("user"); + $db->add_data("Host", $hostList[$x]); + $db->add_data("User", $_POST['MIDAS_USER']); + $db->add_data("Password", sprintf("PASSWORD('%s')", $_POST['MIDAS_PASSWD']), FALSE); + $ret = $db->compile_query("INSERT"); + if($ret['return']) { + $db->run_query(); + $inst .= html_tag("TR", + html_tag("TD", sprintf("MIDAS User created (%s)", $hostList[$x]), $color[0], "class=blacksmall align=left") . + html_tag("TD", "OK", $color[12], "class=blacksmall align=center"), + "", ""); + $db->clear_res(); + + $db->add_table("db"); + $db->add_data("Host", $hostList[$x]); + $db->add_data("Db", $_POST['DB']); + $db->add_data("User", $_POST['MIDAS_USER']); + $db->add_data("Select_priv", "Y"); + $db->add_data("Insert_priv", "Y"); + $db->add_data("Update_priv", "Y"); + $db->add_data("Delete_priv", "Y"); + $db->add_data("Create_priv", "Y"); + $db->add_data("Drop_priv", "Y"); + $db->add_data("Grant_priv", "Y"); + $db->add_data("References_priv", "Y"); + $db->add_data("Index_priv", "Y"); + $db->add_data("Alter_priv", "Y"); + $ret = $db->compile_query("INSERT"); + if($ret['return']) { + $db->run_query(); + $inst .= html_tag("TR", + html_tag("TD", sprintf("MIDAS User dB privileges (%s)", $hostList[$x]), $color[0], "class=blacksmall align=left") . + html_tag("TD", "OK", $color[12], "class=blacksmall align=center"), + "", ""); + } else { + $inst .= html_tag("TR", + html_tag("TD", sprintf("MIDAS User dB privileges (%s)", $hostList[$x]), $color[0], "class=blacksmall align=left") . + html_tag("TD", "ERROR", $color[2], "class=blacksmall align=center"), + "", ""); + } + } else { + $inst .= html_tag("TR", + html_tag("TD", sprintf("MIDAS User created (%s)", $hostList[$x]), $color[0], "class=blacksmall align=left") . + html_tag("TD", "ERROR", $color[2], "class=blacksmall align=center"), + "", ""); + } + $db->clear_res(); + } + + $db->db = null; + $db->run_query("FLUSH PRIVILEGES"); + if($db->sqlResults) { + $inst .= html_tag("TR", + html_tag("TD", "Flushing privileges", $color[0], "class=blacksmall align=left") . + html_tag("TD", "OK", $color[12], "class=blacksmall align=center"), + "", ""); + } else { + $inst .= html_tag("TR", + html_tag("TD", "Flushing privileges", $color[0], "class=blacksmall align=left") . + html_tag("TD", "ERROR", $color[2], "class=blacksmall align=center"), + "", ""); + } + } + + $db->clear_res(); + $db->db = null; + + if($_POST['INSTALL_MIDAS_SQL'] || $_POST['INSTALL_SNORT_SQL']) { + $db->run_query(sprintf("CREATE DATABASE IF NOT EXISTS %s", $_POST['DB'])); + if($db->sqlResults) { + $inst .= html_tag("TR", + html_tag("TD", "MIDAS dB created", $color[0], "class=blacksmall align=left") . + html_tag("TD", "OK", $color[12], "class=blacksmall align=center"), + "", ""); + $db->clear_res(); + if($_POST['INSTALL_MIDAS_SQL']) { + if($SQL = parseSQL($_POST['MIDAS_SQL'])) { + $ERROR = FALSE; + $db->db = $_POST['DB']; + @reset($SQL); + while(!is_null($key = @key($SQL))) { + $db->run_query($SQL[$key]); + if(!$db->sqlResults) { + $ERROR = TRUE; + } + @next($SQL); + } + if($ERROR) { + $inst .= html_tag("TR", + html_tag("TD", "MIDAS SQL Import", $color[0], "class=blacksmall align=left") . + html_tag("TD", "ERROR", $color[2], "class=blacksmall align=center"), + "", ""); + } else { + $inst .= html_tag("TR", + html_tag("TD", "MIDAS SQL Import", $color[0], "class=blacksmall align=left") . + html_tag("TD", "OK", $color[12], "class=blacksmall align=center"), + "", ""); + } + } else { + $inst .= html_tag("TR", + html_tag("TD", "MIDAS SQL Import", $color[0], "class=blacksmall align=left") . + html_tag("TD", "ERROR", $color[2], "class=blacksmall align=center"), + "", ""); + } + } + + if($_POST['INSTALL_SNORT_SQL']) { + if($SQL = parseSQL($_POST['SNORT_SQL'])) { + $ERROR = FALSE; + $db->db = $_POST['DB']; + @reset($SQL); + while(!is_null($key = @key($SQL))) { + $db->run_query($SQL[$key]); + if(!$db->sqlResults) { + $ERROR = TRUE; + } + @next($SQL); + } + if($ERROR) { + $inst .= html_tag("TR", + html_tag("TD", "SNORT SQL Import", $color[0], "class=blacksmall align=left") . + html_tag("TD", "ERROR", $color[2], "class=blacksmall align=center"), + "", ""); + } else { + $inst .= html_tag("TR", + html_tag("TD", "SNORT SQL Import", $color[0], "class=blacksmall align=left") . + html_tag("TD", "OK", $color[12], "class=blacksmall align=center"), + "", ""); + } + } else { + $inst .= html_tag("TR", + html_tag("TD", "SNORT SQL Import", $color[0], "class=blacksmall align=left") . + html_tag("TD", "ERROR", $color[2], "class=blacksmall align=center"), + "", ""); + } + } + } else { + $inst .= html_tag("TR", + html_tag("TD", "MIDAS dB created", $color[0], "class=blacksmall align=left") . + html_tag("TD", "ERROR", $color[2], "class=blacksmall align=center"), + "", ""); + } + } + + $info = html_tag("TABLE", + html_tag("TR", + html_tag("TD", "Site Installation Results", $color[9], "colspan=2 class=blacksmall align=center"), + "", "") . + $inst . + html_tag("TR", + html_tag("TD", sprintf("Click here to access the logon screen\n"), + $color[12], "colspan=2 class=blacksmall align=center"), + "", ""), + $color[10], "width=50% cellspacing=1 cellpadding=1 align=center"); +} + + echo html_tag("TABLE", + html_tag("TR", + html_tag("TD", + sprintf("%s %s

\n", _APPNAME, _VERSION), $color[4], "height=50 align=right valign=center"), + "", "") . + html_tag("TR", + html_tag("TD", $info, $color[12], "width=100% height=100% align=center valign=center"), + "", ""), + $color[10], "width=100% height=100% align=center valign=center"); + +printf("\n"); +printf("\n"); +?> diff --git a/net-analyzer/midas-nms/metadata.xml b/net-analyzer/midas-nms/metadata.xml new file mode 100644 index 000000000000..3cea6c1653f8 --- /dev/null +++ b/net-analyzer/midas-nms/metadata.xml @@ -0,0 +1,12 @@ + + + +no-herd + + bass@gentoo.org + José Alberto Suárez López + + +MIDAS is a cross platform Monitoring and NIDS server. The goal of this project is to build a robust and complete network/system monitoring suite that is capable of scaling to very large networks. + + diff --git a/net-analyzer/midas-nms/midas-nms-2.2f.ebuild b/net-analyzer/midas-nms/midas-nms-2.2f.ebuild new file mode 100644 index 000000000000..030b678e924b --- /dev/null +++ b/net-analyzer/midas-nms/midas-nms-2.2f.ebuild @@ -0,0 +1,65 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License, v2 +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/midas-nms/midas-nms-2.2f.ebuild,v 1.1 2004/10/20 14:17:46 bass Exp $ + +inherit webapp + +S="${WORKDIR}/MIDAS-${PV}" +DESCRIPTION="Monitoring, Intrusion Detection, Administration System" +SRC_URI="mirror://sourceforge/midas-nms/MIDAS-${PV}.tar.gz" +HOMEPAGE="http://midas-nms.sf.net" +LICENSE="MIT" + +KEYWORDS="~x86" + +DEPEND="dev-db/mysql + net-libs/libpcap + net-www/webapp-config + media-libs/gd" +RDEPEND="net-www/apache + dev-php/mod_php" + +pkg_setup() { + webapp_pkg_setup +} + +src_compile() { + econf || die "./configure failed" + emake || die +} + +src_install () { + webapp_src_preinst + + make DESTDIR=${D} install || die + + dodir /usr/share/midas-nms + dodir /usr/share/midas-nms/sql + insinto /usr/share/midas-nms/sql + doins sql/* /usr/share/midas-nms/sql/ + + # web + cp -r MIDAS/* ${D}${MY_HTDOCSDIR}/ + webapp_serverowned ${MY_HTDOCSDIR} + webapp_src_install + + # Install documentation. + dodoc COPYING + dodoc docs/CHANGELOG + dodoc docs/INSTALL.txt +} + +pkg_postinst() { + webapp_pkg_postinst + chown -R :apache /var/www/localhost/htdocs/midas-nms/{inc/config,php-graph} + chmod g+w /var/www/localhost/htdocs/midas-nms/{inc/config,php-graph} + cp ${FILESDIR}/install.php /var/www/localhost/htdocs/midas-nms/install + + einfo + einfo "To install the web interface go to:" + einfo "http://localhost/midas-nms/install/install.php" + einfo + einfo "The conf files are located in /usr/etc/MIDAS*.cf.dist" + einfo "Please read INSTALL.txt for more info." + einfo +} -- 2.26.2