Remove 2.3.1 version / add 2.8

This commit is contained in:
Gilles Dubois 2020-09-11 11:48:33 +02:00
parent 8e78123b6d
commit 6e87843062
11 changed files with 2091 additions and 294 deletions

View File

@ -1,108 +0,0 @@
FROM debian:jessie-slim
LABEL maintainer="contact@ocsinventory-ng.org"
LABEL version="2.3.1"
LABEL description="OCS (Open Computers and Software Inventory Next Generation)"
ARG APT_FLAGS="-y --no-install-recommends"
VOLUME /var/lib/mysql
RUN apt-get update ; \
apt-get ${APT_FLAGS} install \
apache2 \
apache2-doc \
apt-utils \
php5 \
php5-gd \
php5-mysql \
php5-cgi \
php5-curl \
perl \
build-essential \
libapache2-mod-php5 \
libxml2 \
libxml-simple-perl \
libc6-dev \
libnet-ip-perl \
libxml-libxml-perl \
libapache2-mod-perl2 \
libdbi-perl \
libapache-dbi-perl \
libdbd-mysql-perl \
libio-compress-perl \
libxml-simple-perl \
libsoap-lite-perl \
libarchive-zip-perl \
libnet-ip-perl \
libphp-pclzip \
libsoap-lite-perl \
libarchive-zip-perl \
libmodule-build-perl \
wget \
tar \
make ;\
cpan -i XML::Entities ;\
/usr/sbin/a2dissite 000-default ;\
/usr/sbin/a2enmod rewrite ;\
/usr/sbin/a2enmod ssl ;\
/usr/sbin/a2enmod authz_user ;\
wget https://raw.githubusercontent.com/OCSInventory-NG/OCSInventory-Server/master/binutils/docker-download.sh ;\
sh docker-download.sh 2.3.1
WORKDIR /tmp/ocs/Apache
RUN perl Makefile.PL ;\
make ;\
make install ;\
cp /usr/share/zoneinfo/Europe/Paris /etc/localtime ;\
cp -R blib/lib/Apache /usr/local/share/perl/5.20.2/ ;\
cp -R Ocsinventory /usr/local/share/perl/5.20.2/ ;\
cp /tmp/ocs/etc/logrotate.d/ocsinventory-server /etc/logrotate.d/ ;\
mkdir -p /etc/ocsinventory-server/plugins ;\
mkdir -p /etc/ocsinventory-server/perl ;\
mkdir -p /usr/share/ocsinventory-reports/ocsreports
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2
ENV APACHE_PID_FILE /var/run/apache2.pid
ENV APACHE_RUN_DIR /var/run/apache2f
ENV APACHE_LOCK_DIR /var/lock/apache2
ENV APACHE_LOG_DIR /var/log/apache2
WORKDIR /tmp/ocs
COPY dbconfig.inc.php /usr/share/ocsinventory-reports/ocsreports/
RUN cp -R ocsreports/* /usr/share/ocsinventory-reports/ocsreports ;\
bash -c 'mkdir -p /var/lib/ocsinventory-reports/{download,ipd,logs,scripts,snmp}' ;\
chmod -R +w /var/lib/ocsinventory-reports ;\
chown www-data: -R /var/lib/ocsinventory-reports ;\
cp binutils/ipdiscover-util.pl /usr/share/ocsinventory-reports/ocsreports/ipdiscover-util.pl ;\
chown www-data: /usr/share/ocsinventory-reports/ocsreports/ipdiscover-util.pl ;\
chmod 755 /usr/share/ocsinventory-reports/ocsreports/ipdiscover-util.pl ;\
chmod +w /usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php ;\
mkdir -p /var/log/ocsinventory-server/ ;\
chmod +w /var/log/ocsinventory-server/ ;\
chown -R www-data: /var/log/ocsinventory-server ;\
chown -R www-data: /usr/share/ocsinventory-reports/
COPY /conf/ocsinventory-reports.conf /conf/z-ocsinventory-server.conf /etc/apache2/conf-available/
COPY ./scripts/run.sh /root/run.sh
RUN chmod +x /root/run.sh ;\
ln -s /etc/apache2/conf-available/ocsinventory-reports.conf /etc/apache2/conf-enabled/ocsinventory-reports.conf ;\
ln -s /etc/apache2/conf-available/z-ocsinventory-server.conf /etc/apache2/conf-enabled/z-ocsinventory-server.conf ;\
rm /usr/share/ocsinventory-reports/ocsreports/install.php ;\
rm -rf /tmp/ocs ;\
apt-get clean ;\
apt-get autoclean ;\
apt-get autoremove ;\
rm -rf /var/lib/apt/lists/* ;\
rm -rf /var/cache/apt/archives/* ;
EXPOSE 80
EXPOSE 443
CMD ["/bin/bash", "/root/run.sh"]

View File

@ -1,8 +0,0 @@
<?php
define("DB_NAME", getenv('OCS_DBNAME'));
define("SERVER_READ", getenv('OCS_DBSERVER_READ'));
define("SERVER_WRITE", getenv('OCS_DBSERVER_WRITE'));
define("COMPTE_BASE", getenv('OCS_DBUSER'));
define("PSWD_BASE", getenv('OCS_DBPASS'));
$_SESSION["PSWD_BASE"]=PSWD_BASE;
?>

View File

@ -1,9 +0,0 @@
#!/bin/bash
if [ ! -d "$APACHE_RUN_DIR" ]; then
mkdir "$APACHE_RUN_DIR"
chown $APACHE_RUN_USER:$APACHE_RUN_GROUP "$APACHE_RUN_DIR"
fi
if [ -f "$APACHE_PID_FILE" ]; then
rm "$APACHE_PID_FILE"
fi
/usr/sbin/apache2ctl -D FOREGROUND

View File

@ -1,101 +0,0 @@
#!/bin/bash
echo "Welcome to OCSInventory Docker image setup"
echo "Please specify container name"
read containerName
while ! [[ $containerName =~ ^[[:lower:]_]+$ ]]; do
echo "Please choose another name without uppercase and number, only letters."
read containerName
done
echo "Your container name: $containerName"
echo "Please specify your database parameters in next steps:"
echo "Database name"
read databaseName
while ! [[ $databaseName =~ ^[a-zA-Z_0-9]+$ ]]; do
echo "Please choose valid database name"
read databaseName
done
echo "Database server READ"
read databaseServerRead
while ! [[ $databaseServerRead =~ ^[a-zA-Z_0-9.]+$ ]]; do
echo "Please choose valid database server"
read databaseServerRead
done
echo "Database server WRITE"
read databaseServerWrite
while ! [[ $databaseServerWrite =~ ^[a-zA-Z_0-9.]+$ ]]; do
echo "Please choose valid database server"
read databaseServerWrite
done
echo "Database user"
read databaseUser
while ! [[ $databaseUser =~ ^[a-zA-Z_0-9]+$ ]]; do
echo "Please choose valid database user"
read databaseUser
done
echo "Database password"
read databasePassword
while [[ -z $databasePassword ]]; do
echo "Please choose valid database password"
read databasePassword
done
echo "Do you want to attach existing data volume ? (yes / no)"
read dataVolume
VOLUME_ARGS=""
if [ $dataVolume = "yes" ]
then
echo "Name of data volume:"
read dataVolumeName
VOLUME_ARGS="-v ${dataVolumeName}:/usr/share/ocsinventory-reports/ocsreports/ -v ${dataVolumeName}:/etc/ocsinventory-reports/ -v ${dataVolumeName}:/var/lib/ocsinventory-reports/"
fi
BASEPATH=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
#MODIFY APACHE CONFIGURATION
#sed -i -e "s/PerlSetEnv OCS_DB_HOST localhost/PerlSetEnv OCS_DB_HOST ${databaseServerWrite}/g" $BASEPATH/conf/z-ocsinventory-server.conf
#sed -i -e "s/PerlSetEnv OCS_DB_NAME ocsweb/PerlSetEnv OCS_DB_NAME ${databaseName}/g" $BASEPATH/conf/z-ocsinventory-server.conf
#sed -i -e "s/PerlSetEnv OCS_DB_LOCAL ocsweb/PerlSetEnv OCS_DB_LOCAL ${databaseName}/g" $BASEPATH/conf/z-ocsinventory-server.conf
#sed -i -e "s/PerlSetEnv OCS_DB_USER ocs/PerlSetEnv OCS_DB_USER ${databaseUser}/g" $BASEPATH/conf/z-ocsinventory-server.conf
#sed -i -e "s/PerlSetVar OCS_DB_PWD ocs/PerlSetVar OCS_DB_PWD ${databasePassword}/g" $BASEPATH/conf/z-ocsinventory-server.conf
COMMAND="docker run -p 80:80 --name ${containerName} -e OCS_DBNAME=${databaseName} \
-e OCS_DBSERVER_READ=${databaseServerRead} -e OCS_DBSERVER_WRITE=${databaseServerWrite} \
-e OCS_DBUSER=${databaseUser} -e OCS_DBPASS=${databasePassword} ${VOLUME_ARGS} -itd ocsinventory/ocsinventory-docker-image:master"
echo "========================================="
echo ""
echo "The command to launch your container is:"
echo ""
echo ${COMMAND}
echo ""
echo "=========================================="
echo ""
echo "Do you want to run container now ? (yes / no)"
read launchNow
if [ $launchNow = "yes" ]
then
$(${COMMAND})
fi

82
2.8/Dockerfile Normal file
View File

@ -0,0 +1,82 @@
FROM centos:centos7
LABEL maintainer="contact@ocsinventory-ng.org" \
version="2.8" \
description="OCS Inventory docker image"
ARG YUM_FLAGS="-y"
ENV APACHE_RUN_USER=apache APACHE_RUN_GROUP=apache \
APACHE_LOG_DIR=/var/log/httpd APACHE_PID_FILE=/var/run/httpd.pid APACHE_RUN_DIR=/var/run/httpd APACHE_LOCK_DIR=/var/lock/httpd \
OCS_DB_SERVER=dbsrv OCS_DB_PORT=3306 OCS_DB_USER=ocs OCS_DB_PASS=ocs OCS_DB_NAME=ocsweb \
OCS_LOG_DIR=/var/log/ocsinventory-server OCS_VARLIB_DIR=/var/lib/ocsinventory-reports/ OCS_WEBCONSOLE_DIR=/usr/share/ocsinventory-reports \
OCS_PERLEXT_DIR=/etc/ocsinventory-server/perl/ OCS_PLUGINSEXT_DIR=/etc/ocsinventory-server/plugins/ \
OCS_SSL_ENABLED=0 OCS_SSL_WEB_MODE=DISABLED OCS_SSL_COM_MODE=DISABLED OCS_SSL_KEY=/path/to/key OCS_SSL_CERT=/path/to/cert OCS_SSL_CA=/path/to/ca \
TZ=Europe/Paris
VOLUME /var/lib/ocsinventory-reports /etc/ocsinventory-server /usr/share/ocsinventory-reports
WORKDIR /tmp
RUN yum ${YUM_FLAGS} install wget \
curl \
yum-utils \
tar \
make \
yum ${YUM_FLAGS} install epel-release ; \
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm ; \
wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm ; \
rpm -Uvh remi-release-7.rpm ; \
yum-config-manager --enable remi-php73 ; \
yum ${YUM_FLAGS} update ; \
yum ${YUM_FLAGS} install perl \
perl-XML-Simple \
perl-Compress-Zlib \
perl-DBI perl-DBD-MySQL \
perl-Net-IP \
perl-SOAP-Lite \
perl-Archive-Zip \
perl-Mojolicious \
perl-Plack \
perl-XML-Entities \
perl-Switch \
perl-Apache-DBI \
httpd \
php73-php \
php73-php-cli \
php73-php-cli \
php73-php-gd \
php73-php-imap \
php73-php-pdo \
php73-php-pear \
php73-php-mbstring \
php73-php-intl \
php73-php-mysqlnd \
php73-php-xml \
php73-php-xmlrpc \
php73-php-pecl-mysql \
php73-php-pecl-mcrypt \
php73-php-pecl-apcu \
php73-php-json \
php73-php-fpm \
php73-php-soap \
php73-php-opcache ;
RUN wget https://github.com/OCSInventory-NG/OCSInventory-ocsreports/releases/download/2.8/OCSNG_UNIX_SERVER_2.8.tar.gz && \
tar xzf OCSNG_UNIX_SERVER_2.8.tar.gz ;
WORKDIR /tmp/OCSNG_UNIX_SERVER_2.8
RUN cd Apache/ && \
perl Makefile.PL && \
make && \
make install ;
WORKDIR /tmp
COPY conf/ /tmp/conf
COPY ./scripts/docker-entrypoint.sh /usr/bin/docker-entrypoint.sh
EXPOSE 80 443
ENTRYPOINT ["/usr/bin/docker-entrypoint.sh"]

34
2.8/conf/dbconfig.inc.php Normal file
View File

@ -0,0 +1,34 @@
<?php
/*
* Copyright 2005-2016 OCSInventory-NG/OCSInventory-ocsreports contributors.
* See the Contributors file for more details about them.
*
* This file is part of OCSInventory-NG/OCSInventory-ocsreports.
*
* OCSInventory-NG/OCSInventory-ocsreports is free software: you can redistribute
* it and/or modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of the License,
* or (at your option) any later version.
*
* OCSInventory-NG/OCSInventory-ocsreports is distributed in the hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with OCSInventory-NG/OCSInventory-ocsreports. if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
define("DB_NAME", "OCS_DB_NAME");
define("SERVER_READ", "OCS_READ_NAME");
define("SERVER_WRITE", "OCS_WRITE_NAME");
define("SERVER_PORT", "OCS_DB_PORT");
define("COMPTE_BASE", "OCS_DB_USER");
define("PSWD_BASE", "OCS_DB_PASS");
define("ENABLE_SSL","OCS_SSL_ENABLED");
define("SSL_MODE","OCS_SSL_WEB_MODE");
define("SSL_KEY","OCS_SSL_KEY");
define("SSL_CERT","OCS_SSL_CERT");
define("CA_CERT","OCS_SSL_CA");
?>

View File

@ -16,13 +16,13 @@
################################################################################
# Administration console public pages
#
#
# Alias used to put Administration Server static page (typically PHP) outside
# Apache document root directory
#
Alias /ocsreports /usr/share/ocsinventory-reports/ocsreports
Alias OCSREPORTS_ALIAS PATH_TO_OCSREPORTS_DIR
<Directory /usr/share/ocsinventory-reports/ocsreports>
<Directory PATH_TO_OCSREPORTS_DIR>
# By default, users can use console from everywhere
<IfModule mod_authz_core.c>
# Apache 2.4
@ -34,24 +34,24 @@ Alias /ocsreports /usr/share/ocsinventory-reports/ocsreports
</IfModule>
Options Indexes FollowSymLinks
DirectoryIndex index.php
AllowOverride Options
AllowOverride Options AuthConfig
# Uncomment following to force use of HTTPS in Administration Server
#SSLRequireSSL
# PHP tuning (not working on all distribution, use php.ini instead)
<IfModule mod_php5.c>
AddType application/x-httpd-php .php
php_flag file_uploads on
# Some PHP tuning for deployment feature up to 8 MB
# post_max_size must be greater than upload_max_filesize
# because of HTTP headers
# because of HTTP headers
php_value post_max_size 101m
php_value upload_max_filesize 100m
# You may have to uncomment following on errors
#php_value max_execution_time -1
#php_value max_input_time -1
# Uncomment following if you need to specify a mysql socket
#php_value mysql.default_socket "path/to/mysql/unix/socket"
@ -64,13 +64,13 @@ Alias /ocsreports /usr/share/ocsinventory-reports/ocsreports
php_flag file_uploads on
# Some PHP tuning for deployment feature up to 8 MB
# post_max_size must be greater than upload_max_filesize
# because of HTTP headers
# because of HTTP headers
php_value post_max_size 101m
php_value upload_max_filesize 100m
# You may have to uncomment following on errors
#php_value max_execution_time -1
#php_value max_input_time -1
# Uncomment following if you need to specify a mysql socket
#php_value mysql.default_socket "path/to/mysql/unix/socket"
@ -86,10 +86,10 @@ Alias /ocsreports /usr/share/ocsinventory-reports/ocsreports
################################################################################
# Deployment packages download area
#
#
# Alias to put Deployment package files outside Apache document root directory
#
<Directory /var/lib/ocsinventory-reports/download>
<Directory PATH_TO_PACKAGES_DIR>
<IfModule mod_authz_core.c>
# Apache 2.4
Require all granted
@ -99,7 +99,7 @@ Alias /ocsreports /usr/share/ocsinventory-reports/ocsreports
Allow from all
</IfModule>
</Directory>
Alias /download /var/lib/ocsinventory-reports/download
Alias PACKAGES_ALIAS PATH_TO_PACKAGES_DIR
################################################################################
@ -107,7 +107,7 @@ Alias /download /var/lib/ocsinventory-reports/download
#
# Alias to put Snmp custom Mibs files outside Apache document root directory
#
<Directory /var/lib/ocsinventory-reports/snmp>
<Directory PATH_TO_SNMP_DIR>
<IfModule mod_authz_core.c>
# Apache 2.4
Require all granted
@ -117,4 +117,4 @@ Alias /download /var/lib/ocsinventory-reports/download
Allow from all
</IfModule>
</Directory>
Alias /snmp /var/lib/ocsinventory-reports/snmp
Alias SNMP_ALIAS PATH_TO_SNMP_DIR

View File

@ -11,55 +11,80 @@
################################################################################
<IfModule mod_perl.c>
# Which version of mod_perl we are using
# For mod_perl <= 1.999_21, replace 2 by 1
# For mod_perl > 1.999_21, replace 2 by 2
PerlSetEnv OCS_MODPERL_VERSION 2
# For mod_perl <= 1.999_21, replace VERSION_MP by 1
# For mod_perl > 1.999_21, replace VERSION_MP by 2
PerlSetEnv OCS_MODPERL_VERSION VERSION_MP
# Master Database settings
# Replace localhost by hostname or ip of MySQL server for WRITE
PerlSetEnv OCS_DB_HOST ${OCS_DBSERVER_WRITE}
# Replace 3306 by port where running MySQL server, generally 3306
PerlSetEnv OCS_DB_PORT 3306
# Replace DATABASE_SERVER by hostname or ip of MySQL server for WRITE
PerlSetEnv OCS_DB_HOST DATABASE_SERVER
# Replace DATABASE_PORT by port where running MySQL server, generally 3306
PerlSetEnv OCS_DB_PORT DATABASE_PORT
# Name of database
PerlSetEnv OCS_DB_NAME ${OCS_DBNAME}
PerlSetEnv OCS_DB_LOCAL ${OCS_DBNAME}
PerlSetEnv OCS_DB_NAME DATABASE_NAME
PerlSetEnv OCS_DB_LOCAL DATABASE_NAME
# User allowed to connect to database
PerlSetEnv OCS_DB_USER ${OCS_DBUSER}
PerlSetEnv OCS_DB_USER DATABASE_USER
# Password for user
PerlSetVar OCS_DB_PWD ${OCS_DBPASS}
PerlSetVar OCS_DB_PWD DATABASE_PASSWD
# SSL Configuration
# 0 to disable the SSL support for MySQL/MariaDB
# 1 to enable the SSL support for MySQL/MariaDB
PerlSetEnv OCS_DB_SSL_ENABLED 0
# PerlSetEnv OCS_DB_SSL_CLIENT_KEY /etc/ssl/private/client.key
# PerlSetEnv OCS_DB_SSL_CLIENT_CERT /etc/ssl/certs/client.crt
# PerlSetEnv OCS_DB_SSL_CA_CERT /etc/ssl/certs/ca.crt
# SSL Mode
# - SSL_MODE_PREFERRED (SSL enabled but optional)
# - SSL_MODE_REQUIRED (SSL enabled, mandatory but don't verify server certificate. Ex self signed cert)
# - SSL_MODE_STRICT (SSL enabled, mandatory and server cert must be trusted)
PerlSetEnv OCS_DB_SSL_MODE SSL_MODE_PREFERRED
# Slave Database settings
# Replace localhost by hostname or ip of MySQL server for READ
# Slave Database settings
# Replace DATABASE_SERVER by hostname or ip of MySQL server for READ
# Useful if you handle mysql slave databases
# PerlSetEnv OCS_DB_SL_HOST localhost
# Replace 3306 by port where running MySQL server, generally 3306
# PerlSetEnv OCS_DB_SL_PORT_SLAVE 3306
# PerlSetEnv OCS_DB_SL_HOST DATABASE_SERVER
# Replace DATABASE_PORT by port where running MySQL server, generally 3306
# PerlSetEnv OCS_DB_SL_PORT_SLAVE DATABASE_PORT
# User allowed to connect to database
# PerlSetEnv OCS_DB_SL_USER ocs
# Name of the database
# PerlSetEnv OCS_DB_SL_NAME ocsweb
# Password for user
# PerlSetVar OCS_DB_SL_PWD ocs
# SSL Configuration for Slave database
# 0 to disable the SSL support for MySQL/MariaDB
# 1 to enable the SSL support for MySQL/MariaDB
# PerlSetEnv OCS_DB_SL_SSL_ENABLED 0
# PerlSetEnv OCS_DB_SL_SSL_CLIENT_KEY /etc/ssl/private/client.key
# PerlSetEnv OCS_DB_SL_SSL_CLIENT_CERT /etc/ssl/certs/client.crt
# PerlSetEnv OCS_DB_SL_SSL_CA_CERT /etc/ssl/certs/ca.crt
# SSL Mode
# - SSL_MODE_PREFERRED (SSL enabled but optional)
# - SSL_MODE_REQUIRED (SSL enabled, mandatory but don't verify server certificate. Ex self signed cert)
# - SSL_MODE_STRICT (SSL enabled, mandatory and server cert must be trusted)
# PerlSetEnv OCS_DB_SL_SSL_MODE SSL_MODE_PREFERRED
# Path to log directory (must be writeable)
PerlSetEnv OCS_OPT_LOGPATH "/var/log/ocsinventory-server"
PerlSetEnv OCS_OPT_LOGPATH "PATH_TO_LOG_DIRECTORY"
# If you need to specify a mysql socket that the client's built-in
#PerlSetEnv OCS_OPT_DBI_MYSQL_SOCKET "path/to/mysql/unix/socket"
# DBI verbosity
PerlSetEnv OCS_OPT_DBI_PRINT_ERROR 0
# Unicode support
PerlSetEnv OCS_OPT_UNICODE_SUPPORT 1
# If you are using a multi server architecture,
# If you are using a multi server architecture,
# Put the ip addresses of the slaves on the master
# (This is read as perl regular expressions)
PerlAddVar OCS_OPT_TRUSTED_IP 127.0.0.1
#PerlAddVar OCS_OPT_TRUSTED_IP XXX.XXX.XXX.XXX
# ===== WEB SERVICE (SOAP) SETTINGS =====
PerlSetEnv OCS_OPT_WEB_SERVICE_ENABLED 0
@ -68,13 +93,13 @@
# Be careful: you must restart apache to make settings taking effects
# Configure engine to use the settings from this file
# Configure engine to use the settings from this file
PerlSetEnv OCS_OPT_OPTIONS_NOT_OVERLOADED 0
# Try to use other compress algorithm than raw zlib
# GUNZIP and clear XML are supported
PerlSetEnv OCS_OPT_COMPRESS_TRY_OTHERS 1
##############################################################
# ===== OPTIONS BELOW ARE OVERLOADED IF YOU USE OCS GUI =====#
##############################################################
@ -87,21 +112,21 @@
PerlSetEnv OCS_OPT_LOGLEVEL 0
# Specify agent's prolog frequency
PerlSetEnv OCS_OPT_PROLOG_FREQ 12
# Configure the duplicates detection system
PerlSetEnv OCS_OPT_AUTO_DUPLICATE_LVL 15
# Specify if agent take contact on service startup
PerlSetEnv OCS_OPT_INVENTORY_ON_STARTUP 0
# Configure the duplicates detection system
PerlSetEnv OCS_OPT_AUTO_DUPLICATE_LVL 15
# Futur security improvements
PerlSetEnv OCS_OPT_SECURITY_LEVEL 0
# Validity of a computer's lock
PerlSetEnv OCS_OPT_LOCK_REUSE_TIME 600
# Enable the history tracking system (useful for external data synchronisation
PerlSetEnv OCS_OPT_TRACE_DELETED 0
# ===== INVENTORY SETTINGS =====
# Specify the validity of inventory data
PerlSetEnv OCS_OPT_FREQUENCY 0
PerlSetEnv OCS_OPT_FREQUENCY 0
# Configure engine to update inventory regarding to CHECKSUM agent value (lower DB backend load)
PerlSetEnv OCS_OPT_INVENTORY_DIFF 1
# Make engine consider an inventory as a transaction (lower concurency, better disk usage)
@ -133,11 +158,11 @@
PerlSetEnv OCS_OPT_DOWNLOAD_TIMEOUT 7
# Agents will send an error event and clean the package if package command does not respond during this setting
PerlSetEnv OCS_OPT_DOWNLOAD_EXECUTION_TIMEOUT 120
# Enable ocs engine to deliver agent's files (deprecated)
PerlSetEnv OCS_OPT_DEPLOY 0
# Enable the softwares deployment capacity (bandwidth control)
# ===== GROUPS SETTINGS =====
# Enable the computer\s groups feature
@ -146,7 +171,7 @@
PerlSetEnv OCS_OPT_GROUPS_CACHE_OFFSET 43200
# Specify the validity of computer's groups (default: compute it once a day - see offset)
PerlSetEnv OCS_OPT_GROUPS_CACHE_REVALIDATE 43200
# ===== IPDISCOVER SETTINGS =====
# Specify how much agent per LAN will discovered connected peripherals (0 to disable)
@ -161,7 +186,7 @@
PerlSetEnv OCS_OPT_IPDISCOVER_NO_POSTPONE 0
# Enable groups for ipdiscover (for example, you might want to prevent some groups to be ipdiscover agents)
PerlSetEnv OCS_OPT_IPDISCOVER_USE_GROUPS 1
# ===== INVENTORY FILES MAPPING SETTINGS =====
# Use with ocsinventory-injector, enable the multi entities feature
@ -189,13 +214,13 @@
# ===== DATA FILTER =====
#Enable the dat filtering capacity
PerlSetEnv OCS_OPT_DATA_FILTER 0
# Set the table names and the field associated you want to filter
#PerlAddVar OCS_OPT_DATA_TO_FILTER HARDWARE
#PerlAddVar OCS_OPT_DATA_TO_FILTER USERID
PerlSetEnv OCS_OPT_DATA_FILTER 0
# Set the table names and the field associated you want to filter
#PerlAddVar OCS_OPT_DATA_TO_FILTER HARDWARE
#PerlAddVar OCS_OPT_DATA_TO_FILTER USERID
# ===== REGISTRY SETTINGS =====
# Enable the registry capacity
@ -209,7 +234,7 @@
PerlSetEnv OCS_OPT_SNMP_INVENTORY_DIFF 1
# Display error message about agent https communication in logfile
PerlSetEnv OCS_OPT_SNMP_PRINT_HTTPS_ERROR 1
# ===== SESSION SETTINGS =====
# Not yet in GUI
@ -230,13 +255,13 @@
# ===== EXTERNAL USERAGENTS =====
#Path for external useragents reference file
#!! WARNING !! : external agents may not be supported by OCS NG Community !
#!! WARNING !! : external agents may not be supported by OCS NG Community !
#PerlSetEnv OCS_OPT_EXT_USERAGENTS_FILE_PATH /tmp/yourfile.txt
# ===== PLUGINS =====
PerlSetEnv OCS_PLUGINS_PERL_DIR "/etc/ocsinventory-server/perl"
PerlSetEnv OCS_PLUGINS_CONF_DIR "/etc/ocsinventory-server/plugins"
PerlSetEnv OCS_PLUGINS_PERL_DIR "PATH_TO_PLUGINS_PERL_DIRECTORY"
PerlSetEnv OCS_PLUGINS_CONF_DIR "PATH_TO_PLUGINS_CONFIG_DIRECTORY"
# ===== DEPRECATED =====
@ -244,18 +269,17 @@
PerlSetEnv OCS_OPT_PROXY_REVALIDATE_DELAY 3600
# Deprecated
PerlSetEnv OCS_OPT_UPDATE 0
############ DO NOT MODIFY BELOW ! #######################
# External modules
PerlModule Apache::DBI
PerlModule Compress::Zlib
PerlModule XML::Simple
# Ocs plugins
PerlModule Apache::Ocsinventory::Plugins::Apache
PerlModule Apache::Ocsinventory::Plugins
# Ocs
PerlModule Apache::Ocsinventory
PerlModule Apache::Ocsinventory::Server::Constants
@ -277,10 +301,10 @@
# PerlModule Apache::Ocsinventory::Server::Capacities::Filter
# This module add availibity to filter data from HARDWARE section (data filtered won't be stored in database)
# PerlModule Apache::Ocsinventory::Server::Capacities::Datafilter
# PerlTaintCheck On
# SSL apache settings
# SSL apache settings
#SSLEngine "SSL_ENABLE"
#SSLCertificateFile "SSL_CERTIFICATE_FILE"
#SSLCertificateKeyFile "SSL_CERTIFICATE_KEY_FILE"
@ -301,7 +325,7 @@
order deny,allow
allow from all
</IfModule>
# If you protect this area you have to deal with http_auth_* agent's parameters
# If you protect this area you have to deal with http_auth_* agent's parameters
# AuthType Basic
# AuthName "OCS Inventory agent area"
# AuthUserFile "APACHE_AUTH_USER_FILE"
@ -311,7 +335,7 @@
</Location>
#Web Service for plugin engine
<Location /plugin>
<Location /ocsplugins>
<IfModule mod_authz_core.c>
# Apache 2.4
Require local
@ -332,7 +356,7 @@
<location /ocsinterface>
SetHandler perl-script
PerlHandler "Apache::Ocsinventory::SOAP"
# By default, you can query web service from everywhere with a valid user
<IfModule mod_authz_core.c>
# Apache 2.4
@ -354,4 +378,4 @@
require "SOAP_USER"
</IfModule>
</location>
</IfModule>
</IfModule>

56
2.8/docker-compose.yml Normal file
View File

@ -0,0 +1,56 @@
version: '3'
services:
ocsapplication:
image: ocsinventory/ocsinventory-docker-image:2.8
container_name : ocsinventory-server
restart: always
ports:
- 80:80
- 443:443
volumes:
- "perlcomdata:/etc/ocsinventory-server"
- "ocsreportsdata:/usr/share/ocsinventory-reports/ocsreports"
- "varlibdata:/var/lib/ocsinventory-reports"
- "httpdconfdata:/etc/httpd/conf.d"
environment:
OCS_DB_SERVER: ocsinventory-db
OCS_DB_USER: ocsuser
OCS_DB_PASS: ocspass
OCS_DB_NAME: ocsweb
# See documentation to set up SSL for MySQL
OCS_SSL_ENABLED: 0
links:
- ocsdb
networks:
- localocs
depends_on:
- ocsdb
ocsdb :
image : mysql:5.7
container_name : ocsinventory-db
restart: always
ports :
- 3306:3306
volumes :
- ./sql/:/docker-entrypoint-initdb.d/
- sqldata:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD : rootpass
MYSQL_USER : ocsuser
MYSQL_PASSWORD : ocspass
MYSQL_DATABASE : ocsweb
networks:
- localocs
networks:
localocs:
volumes:
perlcomdata:
ocsreportsdata:
varlibdata:
httpdconfdata:
sqldata:

View File

@ -0,0 +1,89 @@
#!/bin/bash
# Create all directories
mkdir -p $OCS_LOG_DIR
mkdir -p $OCS_PERLEXT_DIR/Apache/Ocsinventory/Plugins
mkdir -p $OCS_PLUGINSEXT_DIR
mkdir -p $OCS_VARLIB_DIR/download
mkdir -p $OCS_VARLIB_DIR/ipd
mkdir -p $OCS_VARLIB_DIR/logs
mkdir -p $OCS_VARLIB_DIR/scripts
mkdir -p $OCS_VARLIB_DIR/snmp
if [ ! -f $OCS_WEBCONSOLE_DIR/ocsreports/var.php ]; then
cp -r /tmp/OCSNG_UNIX_SERVER_2.8/ocsreports/ ${OCS_WEBCONSOLE_DIR}
rm -rf ${OCS_WEBCONSOLE_DIR}/ocsreports/dbconfig.inc.php
fi;
# Configure z-ocsinventory-server file
if [ ! -f /etc/httpd/conf.d/z-ocsinventory-server.conf ]; then
cp /tmp/conf/ocsinventory-server.conf /etc/httpd/conf.d/z-ocsinventory-server.conf
sed -i 's/VERSION_MP/2/g' /etc/httpd/conf.d/z-ocsinventory-server.conf
sed -i 's/DATABASE_SERVER/'"$OCS_DB_SERVER"'/g' /etc/httpd/conf.d/z-ocsinventory-server.conf
sed -i 's/DATABASE_PORT/'"$OCS_DB_PORT"'/g' /etc/httpd/conf.d/z-ocsinventory-server.conf
sed -i 's/DATABASE_NAME/'"$OCS_DB_NAME"'/g' /etc/httpd/conf.d/z-ocsinventory-server.conf
sed -i 's/DATABASE_USER/'"$OCS_DB_USER"'/g' /etc/httpd/conf.d/z-ocsinventory-server.conf
sed -i 's/DATABASE_PASSWD/'"$OCS_DB_PASS"'/g' /etc/httpd/conf.d/z-ocsinventory-server.conf
sed -i 's/"PATH_TO_LOG_DIRECTORY"/'"${OCS_LOG_DIR//\//\\/}"'/g' /etc/httpd/conf.d/z-ocsinventory-server.conf
sed -i 's/"PATH_TO_PLUGINS_PERL_DIRECTORY"/'"${OCS_PERLEXT_DIR//\//\\/}"'/g' /etc/httpd/conf.d/z-ocsinventory-server.conf
sed -i 's/"PATH_TO_PLUGINS_CONFIG_DIRECTORY"/'"${OCS_PLUGINSEXT_DIR//\//\\/}"'/g' /etc/httpd/conf.d/z-ocsinventory-server.conf
sed -i 's/OCS_SSL_ENABLED/'"$OCS_SSL_ENABLED"'/g' /etc/httpd/conf.d/z-ocsinventory-server.conf
sed -i 's/OCS_SSL_KEY/'"${OCS_SSL_KEY//\//\\/}"'/g' /etc/httpd/conf.d/z-ocsinventory-server.conf
sed -i 's/OCS_SSL_CERT/'"${OCS_SSL_CERT//\//\\/}"'/g' /etc/httpd/conf.d/z-ocsinventory-server.conf
sed -i 's/OCS_SSL_CA/'"${OCS_SSL_CA//\//\\/}"'/g' /etc/httpd/conf.d/z-ocsinventory-server.conf
sed -i 's/OCS_SSL_COM_MODE/'"$OCS_SSL_COM_MODE"'/g' /etc/httpd/conf.d/z-ocsinventory-server.conf
fi
# Configure ocsinventory-reports file
if [ ! -f /etc/httpd/conf.d/ocsinventory-reports.conf ]; then
cp /tmp/conf/ocsinventory-reports.conf /etc/httpd/conf.d/ocsinventory-reports.conf
sed -i 's/OCSREPORTS_ALIAS/\/ocsreports/g' /etc/httpd/conf.d/ocsinventory-reports.conf
sed -i 's/PATH_TO_OCSREPORTS_DIR/'"${OCS_WEBCONSOLE_DIR//\//\\/}"'\/ocsreports/g' /etc/httpd/conf.d/ocsinventory-reports.conf
sed -i 's/PACKAGES_ALIAS/\/download/g' /etc/httpd/conf.d/ocsinventory-reports.conf
sed -i 's/PATH_TO_PACKAGES_DIR/'"${OCS_VARLIB_DIR//\//\\/}"'download/g' /etc/httpd/conf.d/ocsinventory-reports.conf
sed -i 's/SNMP_ALIAS/\/snmp/g' /etc/httpd/conf.d/ocsinventory-reports.conf
sed -i 's/PATH_TO_SNMP_DIR/'"${OCS_VARLIB_DIR//\//\\/}"'snmp/g' /etc/httpd/conf.d/ocsinventory-reports.conf
fi
# Generate dbconfig.inc.php
if [ ! -f $OCS_WEBCONSOLE_DIR/ocsreports/dbconfig.inc.php ]; then
cp /tmp/conf/dbconfig.inc.php $OCS_WEBCONSOLE_DIR/ocsreports
sed -i 's/OCS_DB_NAME/'"$OCS_DB_NAME"'/g' $OCS_WEBCONSOLE_DIR/ocsreports/dbconfig.inc.php
sed -i 's/OCS_READ_NAME/'"$OCS_DB_SERVER"'/g' $OCS_WEBCONSOLE_DIR/ocsreports/dbconfig.inc.php
sed -i 's/OCS_WRITE_NAME/'"$OCS_DB_SERVER"'/g' $OCS_WEBCONSOLE_DIR/ocsreports/dbconfig.inc.php
sed -i 's/OCS_DB_PORT/'"$OCS_DB_PORT"'/g' $OCS_WEBCONSOLE_DIR/ocsreports/dbconfig.inc.php
sed -i 's/OCS_DB_USER/'"$OCS_DB_USER"'/g' $OCS_WEBCONSOLE_DIR/ocsreports/dbconfig.inc.php
sed -i 's/OCS_DB_PASS/'"$OCS_DB_PASS"'/g' $OCS_WEBCONSOLE_DIR/ocsreports/dbconfig.inc.php
sed -i 's/OCS_SSL_ENABLED/'"$OCS_SSL_ENABLED"'/g' $OCS_WEBCONSOLE_DIR/ocsreports/dbconfig.inc.php
sed -i 's/OCS_SSL_WEB_MODE/'"$OCS_SSL_WEB_MODE"'/g' $OCS_WEBCONSOLE_DIR/ocsreports/dbconfig.inc.php
sed -i 's/OCS_SSL_KEY/'"${OCS_SSL_KEY//\//\\/}"'/g' $OCS_WEBCONSOLE_DIR/ocsreports/dbconfig.inc.php
sed -i 's/OCS_SSL_CERT/'"${OCS_SSL_CERT//\//\\/}"'/g' $OCS_WEBCONSOLE_DIR/ocsreports/dbconfig.inc.php
sed -i 's/OCS_SSL_CA/'"${OCS_SSL_CA//\//\\/}"'/g' $OCS_WEBCONSOLE_DIR/ocsreports/dbconfig.inc.php
fi
# Permissions
chown -R $APACHE_RUN_USER: $OCS_VARLIB_DIR
chown -R $APACHE_RUN_USER: $OCS_LOG_DIR
chown -R $APACHE_RUN_USER: $OCS_WEBCONSOLE_DIR
# rm install.php
if [ -f $OCS_WEBCONSOLE_DIR/ocsreports/install.php ]; then
rm $OCS_WEBCONSOLE_DIR/ocsreports/install.php
fi
# Remove temp files
cd /tmp
shopt -s extglob
rm -rf -v !("conf")
# Apache start
if [ ! -d "$APACHE_RUN_DIR" ]; then
mkdir "$APACHE_RUN_DIR"
chown $APACHE_RUN_USER:$APACHE_RUN_GROUP "$APACHE_RUN_DIR"
fi
if [ -f "$APACHE_PID_FILE" ]; then
rm "$APACHE_PID_FILE"
fi
/usr/sbin/httpd -DFOREGROUND

1738
2.8/sql/ocsbase.sql Normal file

File diff suppressed because one or more lines are too long