Package: ocsinventory-server
Version: 1.02-2
Severity: normal
Hello,
This is the last patch of this bug report.
It remove the use of install.php, the dbconfig.inc.php is now
automatically generated by dbconfig-common.
Log from my bzr repository:
revno: 9
committer: Daniel Dehennin <[email protected]>
timestamp: Fri 2009-05-22 10:09:04 +0200
branch nick: 1.02-create-db
message: ocsinventory-reports provides a dbconfig-common based
dbconfig.inc.php.
* debian/conf/dbconfig.inc.php: Add dbconfig-common template.
* debian/ocsinventory-reports.install: Install the template.
* debian/ocsinventory-reports.config: Remove htpasswd handling.
Add dbconfig-common frontend.
* debian/ocsinventory-reports.postinst: Do not add write mode in
/var/lib/ocsinventory-server/config for php.
Generate the config file from the template and install it in
/etc/ocsinventory/.
Provide default values if dbconfig-common is not use.
* debian/ocsinventory-reports.links: Fix links, dbconfig.inc.php is
placed in /etc/ocsinventory.
* debian/ocsinventory-reports.postrm: Use dbconfig-common frontend.
Remove dbconfig-common configuration file.
htpasswd.setup is not created anymore.
revno: 8
committer: Daniel Dehennin <[email protected]>
timestamp: Thu 2009-05-21 11:59:10 +0200
branch nick: 1.02-create-db
message: htpasswd access is now useless.
* debian/ocsinventory-reports.postinst: Do not generate an htpasswd for
install.php.
revno: 7
committer: Daniel Dehennin <[email protected]>
timestamp: Thu 2009-05-21 11:52:24 +0200
branch nick: 1.02-create-db
message: install.php is useless now.
* debian/conf/ocsreports.conf: Deny access to install.php.
Regards.
-- System Information:
Debian Release: squeeze/sid
APT prefers unstable
APT policy: (500, 'unstable'), (90, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.30-rc6+hati.1 (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
=== added file 'debian/conf/dbconfig.inc.php'
--- debian/conf/dbconfig.inc.php 1970-01-01 00:00:00 +0000
+++ debian/conf/dbconfig.inc.php 2009-05-21 10:12:35 +0000
@@ -0,0 +1,5 @@
+<?php
+$_SESSION["SERVEUR_SQL"]="_DBC_DBSERVER_";
+$_SESSION["COMPTE_BASE"]="_DBC_DBUSER_";
+$_SESSION["PSWD_BASE"]="_DBC_DBPASS_";
+?>
=== modified file 'debian/conf/ocsreports.conf'
--- debian/conf/ocsreports.conf 2009-05-19 05:39:42 +0000
+++ debian/conf/ocsreports.conf 2009-05-21 09:51:41 +0000
@@ -11,21 +11,10 @@
Options Indexes FollowSymLinks
DirectoryIndex index.php
- # Authorize for setup
+ # Disable install.php
<Files install.php>
- # For Apache 1.3 and 2.0
- <IfModule mod_auth.c>
- AuthType Basic
- AuthName "OCS Reports Setup"
- AuthUserFile /etc/ocsinventory/htpasswd.setup
- </IfModule>
- # For Apache 2.2
- <IfModule mod_authn_file.c>
- AuthType Basic
- AuthName "OCS Reports Setup"
- AuthUserFile /etc/ocsinventory/htpasswd.setup
- </IfModule>
- Require valid-user
+ Order deny,allow
+ Deny from all
</Files>
<IfModule mod_php4.c>
=== modified file 'debian/ocsinventory-reports.install'
--- debian/ocsinventory-reports.install 2009-05-19 05:39:42 +0000
+++ debian/ocsinventory-reports.install 2009-05-21 10:02:51 +0000
@@ -1,3 +1,4 @@
ocsreports usr/share/ocsinventory-server
#ipdiscover-util/ipdiscover-util.pl
usr/share/ocsinventory-server/ocsreports
debian/conf/ocsreports.conf etc/ocsinventory
+debian/conf/dbconfig.inc.php usr/share/ocsinventory-server/files
=== modified file 'debian/ocsinventory-reports.links'
--- debian/ocsinventory-reports.links 2009-05-19 05:39:42 +0000
+++ debian/ocsinventory-reports.links 2009-05-21 10:13:34 +0000
@@ -1,3 +1,3 @@
-var/lib/ocsinventory-server/config/dbconfig.inc.php
usr/share/ocsinventory-server/ocsreports/dbconfig.inc.php
-var/lib/ocsinventory-server/config/dbconfig.inc.php
etc/ocsinventory/dbconfig.inc.php
-var/lib/ocsinventory-server/ipd
usr/share/ocsinventory-server/ocsreports/ipd
+etc/ocsinventory/dbconfig.inc.php
usr/share/ocsinventory-server/ocsreports/dbconfig.inc.php
+etc/ocsinventory/dbconfig.inc.php
var/lib/ocsinventory-server/config/dbconfig.inc.php
+var/lib/ocsinventory-server/ipd
usr/share/ocsinventory-server/ocsreports/ipd
=== modified file 'debian/ocsinventory-reports.postinst'
--- debian/ocsinventory-reports.postinst 2009-05-19 05:39:42 +0000
+++ debian/ocsinventory-reports.postinst 2009-05-21 10:11:54 +0000
@@ -15,31 +15,35 @@
varpath="/var/lib/ocsinventory-server"
confpath="/etc/ocsinventory"
conffile="ocsreports.conf"
+ dbconffile="dbconfig.inc.php"
# Allow php to write there
- for dirname in config ipd download; do
+ for dirname in ipd download; do
chown www-data:www-data $varpath/$dirname
chmod g+w $varpath/$dirname
done
- # Generate an htpasswd file for the web based setup
- if [ ! -f $confpath/htpasswd.setup ]; then
- touch $confpath/htpasswd.setup
- chgrp www-data $confpath/htpasswd.setup
- chmod 0640 $confpath/htpasswd.setup
- db_get ocsinventory-reports/setup-username
- setup_username=${RET:-admin}
- db_get ocsinventory-reports/setup-password
- if [ -n "$RET" ]; then
- setup_password=`perl -le 'print crypt($ARGV[0], join("",
map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..2)))' "$RET"`
- else
- setup_password="*"
- fi
- echo "$setup_username:$setup_password" > $confpath/htpasswd.setup
- db_reset ocsinventory-reports/setup-username || true
- db_reset ocsinventory-reports/setup-password || true
+ # use dbconfig to setup vars in apache config file
+ . /usr/share/dbconfig-common/dpkg/postinst.mysql
+ dbc_generate_include=template:$confpath/$dbconffile
+ dbc_generate_include_args="-U -o
template_infile='$pkgpath/files/$dbconffile'"
+ dbc_generate_include_owner="root:www-data"
+ dbc_generate_include_perms="0640"
+
+ dbc_go ocsinventory-server $@
+
+ # if not using dbconfig, set default values to have a valid config file
+ db_get ocsinventory-server/dbconfig-install
+ use_dbconfig=${RET:-false}
+ if [ "x$use_dbconfig" != "xtrue" ]; then
+ sed -i -e 's/^\([^]]*\["SERVEUR_SQL"\]="\).*/\1localhost";/' \
+ -e 's/^\([^]]*\["COMPTE_BASE"\]="\).*/\1ocs";/' \
+ -e 's/^\([^]]*\["PSWD_BASE"\]="\).*/\1ocs";/' \
+ $confpath/$conffile
fi
+ db_stop
+
# link apache config files in apache's conf.d dir
webservers="apache2"
for webserver in $webservers; do