From 0be70026d569a8fea92b5901479e809c15f312aa Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 31 Oct 2011 09:03:30 +0100 Subject: osinventory, improves packaging + disable snmp --- ocsinventory-dbconf.patch | 88 +++++++++++++++++++++++++++++++++++++++++++++++ ocsinventory-reports.conf | 4 ++- ocsinventory.spec | 16 ++++++--- 3 files changed, 102 insertions(+), 6 deletions(-) create mode 100644 ocsinventory-dbconf.patch diff --git a/ocsinventory-dbconf.patch b/ocsinventory-dbconf.patch new file mode 100644 index 0000000..2312f8a --- /dev/null +++ b/ocsinventory-dbconf.patch @@ -0,0 +1,88 @@ +diff -up ocsreports/install.php.var ocsreports/install.php +--- ocsreports/install.php.var 2011-10-31 08:42:38.914660647 +0100 ++++ ocsreports/install.php 2011-10-31 08:44:55.353669573 +0100 +@@ -96,9 +96,9 @@ if( isset($_POST["name"])) { + else + $instOk = true; + } +-if( $hnd = @fopen("dbconfig.inc.php", "r") ) { ++if( $hnd = @fopen(CONF_MYSQL, "r") ) { + fclose($hnd); +- require("dbconfig.inc.php"); ++ require(CONF_MYSQL); + if (defined('COMPTE_BASE')) { // Upgrade from 2.0.x + $valNme = COMPTE_BASE; + } else if (isset($_SESSION["COMPTE_BASE"])) { // Upgrade from 1.3.x +@@ -188,7 +188,7 @@ if($_POST["fin"]=="fin") { + . "
"; + + echo "
" . $l->g(2065) . "
"; +- unlink("dbconfig.inc.php"); ++ unlink(CONF_MYSQL); + } + else { + msg_success("" . $l->g(2050) . "

" . $l->g(2051) . ""); +@@ -197,7 +197,7 @@ if($_POST["fin"]=="fin") { + } + + +-if(!$ch = @fopen("dbconfig.inc.php","w")) { ++if(!$ch = @fopen(CONF_MYSQL,"w")) { + echo "
" . $l->g(2052) . "
"; + die(); + } +@@ -424,7 +424,7 @@ if( ! $erralter ) { + + if($nberr) { + echo "
" . $l->g(2065) . "
"; +- unlink("dbconfig.inc.php"); ++ unlink(CONF_MYSQL); + die(); + } + $nberr=0; +@@ -469,7 +469,7 @@ foreach($filenames as $fil) { + " " . $l->g(2068) . + ""; + echo "
" . $l->g(2065) . "
"; +- unlink("dbconfig.inc.php"); ++ unlink(CONF_MYSQL); + die(); + } + echo "
" . $l->g(2001) . +@@ -505,7 +505,7 @@ else + + if($nberr) { + echo "
" . $l->g(2065) . "
"; +- unlink("dbconfig.inc.php"); ++ unlink(CONF_MYSQL); + die(); + } + +diff -up ocsreports/require/header.php.var ocsreports/require/header.php +--- ocsreports/require/header.php.var 2011-10-31 08:42:31.249548540 +0100 ++++ ocsreports/require/header.php 2011-10-31 08:43:52.704407954 +0100 +@@ -25,7 +25,6 @@ if(substr($_SERVER['DOCUMENT_ROOT'],-1) + }else{ + define("DOCUMENT_ROOT",$_SERVER['DOCUMENT_ROOT']); + } +-//echo DOCUMENT_ROOT."
".DOCUMENT_REAL_ROOT; + //print_r($_SERVER); + + if ($_SESSION['OCS']['LOG_GUI'] == 1){ +@@ -72,14 +71,14 @@ if (isset($_POST['LOGOUT']) and $_POST[' + } + + /***************************************************** First installation checking *********************************************************/ +-if( (!$fconf=@fopen("dbconfig.inc.php","r")) ++if( (!$fconf=@fopen(CONF_MYSQL,"r")) + || (!function_exists('session_start')) + || (!function_exists('mysql_connect')) ) { + require('install.php'); + die(); + } + else{ +- require_once('dbconfig.inc.php'); ++ require_once(CONF_MYSQL); + fclose($fconf); + } + diff --git a/ocsinventory-reports.conf b/ocsinventory-reports.conf index a481341..331f5ad 100644 --- a/ocsinventory-reports.conf +++ b/ocsinventory-reports.conf @@ -65,7 +65,9 @@ Alias PACKAGES_ALIAS PATH_TO_PACKAGES_DIR # # Alias to put Snmp communities reference file (snmp_com.txt) outside Apache document root directory # -Alias SNMP_ALIAS PATH_TO_SNMP_DIR +# Uncomment this Alias to allow SNMP discovery feature +# WARNING this file, with communities definition, will be publicly available +#Alias SNMP_ALIAS PATH_TO_SNMP_DIR # diff --git a/ocsinventory.spec b/ocsinventory.spec index 4e76e9f..6a9ab44 100644 --- a/ocsinventory.spec +++ b/ocsinventory.spec @@ -12,7 +12,7 @@ Name: ocsinventory Summary: Open Computer and Software Inventory Next Generation Version: 2.0.2 -Release: 1%{?dist}.1 +Release: 1%{?dist}.2 Group: Applications/Internet License: GPLv2 @@ -23,7 +23,10 @@ Source0: http://launchpad.net/ocsinventory-server/stable-2.0/%{version}/+dow Source1: ocsinventory-reports.conf # Manage upgrade from 1.3.x +# http://bazaar.launchpad.net/~ocsinventory-core/ocsinventory-ocsreports/stable-2.0/revision/794 Patch0: %{name}-upgrade.patch +# Use CONF_MYSQL everywhere +Patch1: %{name}-dbconf.patch BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -132,6 +135,7 @@ navigateur favori. %setup -q -n %{tarname}-%{version} %patch0 -p0 +%patch1 -p0 chmod -x binutils/ocs-errors @@ -194,9 +198,6 @@ mkdir -p %{buildroot}%{_sysconfdir}/ocsinventory/ocsinventory-reports mv %{buildroot}%{_datadir}/ocsinventory-reports/ocsreports/dbconfig.inc.php \ %{buildroot}%{_sysconfdir}/ocsinventory/ocsinventory-reports/dbconfig.inc.php -ln -s %{_sysconfdir}/ocsinventory/ocsinventory-reports/dbconfig.inc.php \ - %{buildroot}%{_datadir}/ocsinventory-reports/ocsreports/dbconfig.inc.php - # Not usefull for now (path is harcoded) sed -i -e '/CONF_MYSQL/s;dbconfig.inc.php;%{_sysconfdir}/ocsinventory/ocsinventory-reports/dbconfig.inc.php;' \ %{buildroot}%{_datadir}/ocsinventory-reports/ocsreports/var.php @@ -290,7 +291,7 @@ fi %defattr(-, root, root, -) %doc LICENSE.txt README %dir %{_sysconfdir}/ocsinventory -%dir %{_sysconfdir}/ocsinventory/ocsinventory-reports +%attr(750,apache,root) %dir %{_sysconfdir}/ocsinventory/ocsinventory-reports %attr(640,apache,root) %config(noreplace) %{_sysconfdir}/ocsinventory/ocsinventory-reports/dbconfig.inc.php %config(noreplace) %{_sysconfdir}/httpd/conf.d/ocsinventory-reports.conf %{_datadir}/ocsinventory-reports @@ -302,6 +303,11 @@ fi %changelog +* Mon Oct 31 2011 Remi Collet - 2.0.2-1.2 +- add patch to use CONF_MYSQL (and avoid link to dbconfig) +- comment /snmp alias for security +- give apache right to create dbconfig.php + * Thu Oct 27 2011 Remi Collet - 2.0.2-1.1 - add patch for upgrade from 1.3.x - restart apache -- cgit