Merge pull request #78 from OCSInventory-NG/update
Add 2.9.2 and update to ubuntu 20.04 + MySQL 8
This commit is contained in:
commit
9407b4c2f3
75
2.9.2/Dockerfile
Normal file
75
2.9.2/Dockerfile
Normal file
@ -0,0 +1,75 @@
|
||||
FROM ubuntu:20.04
|
||||
|
||||
ENV OCS_VERSION 2.9.2
|
||||
|
||||
LABEL maintainer="contact@ocsinventory-ng.org" \
|
||||
version="${OCS_VERSION}" \
|
||||
description="OCS Inventory docker image"
|
||||
|
||||
ARG APT_FLAGS="-y"
|
||||
|
||||
ENV APACHE_RUN_USER=www-data APACHE_RUN_GROUP=www-data \
|
||||
APACHE_LOG_DIR=/var/log/apache2 APACHE_PID_FILE=/var/run/apache2/apache2.pid APACHE_RUN_DIR=/var/run/apache2 APACHE_LOCK_DIR=/var/lock/apache2 \
|
||||
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
|
||||
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
VOLUME /var/lib/ocsinventory-reports /etc/ocsinventory-server /usr/share/ocsinventory-reports/ocsreports/extensions
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
wget \
|
||||
curl \
|
||||
make \
|
||||
perl \
|
||||
apache2 \
|
||||
php \
|
||||
libxml-simple-perl \
|
||||
libdbi-perl \
|
||||
libdbd-mysql-perl \
|
||||
libapache-dbi-perl \
|
||||
libnet-ip-perl \
|
||||
libsoap-lite-perl \
|
||||
libarchive-zip-perl \
|
||||
libswitch-perl \
|
||||
libmojolicious-perl \
|
||||
libplack-perl \
|
||||
build-essential \
|
||||
php-pclzip \
|
||||
php-mbstring \
|
||||
php-soap \
|
||||
php-mysql \
|
||||
php-curl \
|
||||
php-xml \
|
||||
php-zip \
|
||||
php-gd
|
||||
|
||||
RUN wget https://github.com/OCSInventory-NG/OCSInventory-ocsreports/releases/download/${OCS_VERSION}/OCSNG_UNIX_SERVER-${OCS_VERSION}.tar.gz -P /tmp && \
|
||||
tar xzf /tmp/OCSNG_UNIX_SERVER-${OCS_VERSION}.tar.gz -C /tmp;
|
||||
|
||||
RUN cd /tmp/OCSNG_UNIX_SERVER-${OCS_VERSION}/Apache/ && \
|
||||
perl Makefile.PL && \
|
||||
make && \
|
||||
make install
|
||||
|
||||
WORKDIR /etc/apache2/conf-available
|
||||
|
||||
# Redirect Apache2 Logs to stdout e stderr
|
||||
# https://github.com/docker-library/httpd/blob/5f92ab18146f41d1d324e99c5e197bdeda65d063/2.4/Dockerfile#L202
|
||||
RUN sed -ri \
|
||||
-e 's!^(\s*CustomLog)\s+\S+!\1 /proc/self/fd/1!g' \
|
||||
-e 's!^(\s*ErrorLog)\s+\S+!\1 /proc/self/fd/2!g' \
|
||||
-e 's!^(\s*TransferLog)\s+\S+!\1 /proc/self/fd/1!g' \
|
||||
"/etc/apache2/apache2.conf"
|
||||
|
||||
COPY conf/ /tmp/conf
|
||||
COPY ./scripts/docker-entrypoint.sh /usr/bin/docker-entrypoint.sh
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#entrypoint
|
||||
ENTRYPOINT ["/usr/bin/docker-entrypoint.sh"]
|
||||
CMD ["/usr/sbin/apache2", "-DFOREGROUND"]
|
||||
34
2.9.2/conf/dbconfig.inc.php
Normal file
34
2.9.2/conf/dbconfig.inc.php
Normal 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");
|
||||
?>
|
||||
120
2.9.2/conf/ocsinventory-reports.conf
Normal file
120
2.9.2/conf/ocsinventory-reports.conf
Normal file
@ -0,0 +1,120 @@
|
||||
################################################################################
|
||||
#
|
||||
# OCS Inventory NG Administration Server
|
||||
#
|
||||
# Copyleft 2008 OCS Inventory NG Team
|
||||
# Web: http://www.ocsinventory-ng.org
|
||||
#
|
||||
# This code is open source and may be copied and modified as long as the source
|
||||
# code is always made freely available.
|
||||
# Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt
|
||||
################################################################################
|
||||
|
||||
#
|
||||
# ANY CHANGE ON THIS FILE REQUIRES APACHE RESTART TO TAKE EFFECT
|
||||
#
|
||||
|
||||
################################################################################
|
||||
# Administration console public pages
|
||||
#
|
||||
# Alias used to put Administration Server static page (typically PHP) outside
|
||||
# Apache document root directory
|
||||
#
|
||||
Alias OCSREPORTS_ALIAS PATH_TO_OCSREPORTS_DIR
|
||||
|
||||
<Directory PATH_TO_OCSREPORTS_DIR>
|
||||
# By default, users can use console from everywhere
|
||||
<IfModule mod_authz_core.c>
|
||||
# Apache 2.4
|
||||
Require all granted
|
||||
</IfModule>
|
||||
<IfModule !mod_authz_core.c>
|
||||
Order deny,allow
|
||||
Allow from all
|
||||
</IfModule>
|
||||
Options Indexes FollowSymLinks
|
||||
DirectoryIndex index.php
|
||||
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
|
||||
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"
|
||||
|
||||
#!! Mandatory !! : set magic_quotes_gpc to off (to make ocsreports works correctly)
|
||||
php_flag magic_quotes_gpc off
|
||||
</IfModule>
|
||||
# Duplicate for php7 compatibility
|
||||
<IfModule mod_php7.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
|
||||
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"
|
||||
|
||||
#!! Mandatory !! : set magic_quotes_gpc to off (to make ocsreports works correctly)
|
||||
php_flag magic_quotes_gpc off
|
||||
</IfModule>
|
||||
|
||||
# Uncomment following to allow HTTP body request up to 4 MB
|
||||
# instead default 512 KB
|
||||
#LimitRequestBody 4194304
|
||||
|
||||
</Directory>
|
||||
|
||||
################################################################################
|
||||
# Deployment packages download area
|
||||
#
|
||||
# Alias to put Deployment package files outside Apache document root directory
|
||||
#
|
||||
<Directory PATH_TO_PACKAGES_DIR>
|
||||
<IfModule mod_authz_core.c>
|
||||
# Apache 2.4
|
||||
Require all granted
|
||||
</IfModule>
|
||||
<IfModule !mod_authz_core.c>
|
||||
Order deny,allow
|
||||
Allow from all
|
||||
</IfModule>
|
||||
</Directory>
|
||||
Alias PACKAGES_ALIAS PATH_TO_PACKAGES_DIR
|
||||
|
||||
|
||||
################################################################################
|
||||
# Snmp communities area
|
||||
#
|
||||
# Alias to put Snmp custom Mibs files outside Apache document root directory
|
||||
#
|
||||
<Directory PATH_TO_SNMP_DIR>
|
||||
<IfModule mod_authz_core.c>
|
||||
# Apache 2.4
|
||||
Require all granted
|
||||
</IfModule>
|
||||
<IfModule !mod_authz_core.c>
|
||||
Order deny,allow
|
||||
Allow from all
|
||||
</IfModule>
|
||||
</Directory>
|
||||
Alias SNMP_ALIAS PATH_TO_SNMP_DIR
|
||||
23
2.9.2/conf/ocsinventory-restapi.conf
Normal file
23
2.9.2/conf/ocsinventory-restapi.conf
Normal file
@ -0,0 +1,23 @@
|
||||
PerlOptions +Parent
|
||||
|
||||
<Perl>
|
||||
$ENV{PLACK_ENV} = 'production';
|
||||
$ENV{MOJO_HOME} = 'REST_API_PATH';
|
||||
$ENV{MOJO_MODE} = 'deployment';
|
||||
$ENV{OCS_DB_HOST} = 'DATABASE_SERVER';
|
||||
$ENV{OCS_DB_PORT} = 'DATABASE_PORT';
|
||||
$ENV{OCS_DB_LOCAL} = 'DATABASE_NAME';
|
||||
$ENV{OCS_DB_USER} = 'DATABASE_USER';
|
||||
$ENV{OCS_DB_PWD} = 'DATABASE_PASSWD';
|
||||
$ENV{OCS_DB_SSL_ENABLED} = OCS_SSL_ENABLED;
|
||||
# $ENV{OCS_DB_SSL_CLIENT_KEY} = '';
|
||||
# $ENV{OCS_DB_SSL_CLIENT_CERT} = '';
|
||||
# $ENV{OCS_DB_SSL_CA_CERT} = '';
|
||||
$ENV{OCS_DB_SSL_MODE} = 'SSL_MODE_PREFERRED';
|
||||
</Perl>
|
||||
|
||||
<Location /ocsapi>
|
||||
SetHandler perl-script
|
||||
PerlResponseHandler Plack::Handler::Apache2
|
||||
PerlSetVar psgi_app 'REST_API_LOADER_PATH'
|
||||
</Location>
|
||||
383
2.9.2/conf/ocsinventory-server.conf
Normal file
383
2.9.2/conf/ocsinventory-server.conf
Normal file
@ -0,0 +1,383 @@
|
||||
################################################################################
|
||||
#
|
||||
# OCS Inventory NG Communication Server Perl Module Setup
|
||||
#
|
||||
# Copyleft 2006 Pascal DANEK
|
||||
# Web: http://www.ocsinventory-ng.org
|
||||
#
|
||||
# This code is open source and may be copied and modified as long as the source
|
||||
# code is always made freely available.
|
||||
# Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt
|
||||
################################################################################
|
||||
|
||||
<IfModule mod_perl.c>
|
||||
|
||||
# Which version of mod_perl we are using
|
||||
# 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 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 DATABASE_NAME
|
||||
PerlSetEnv OCS_DB_LOCAL DATABASE_NAME
|
||||
# User allowed to connect to database
|
||||
PerlSetEnv OCS_DB_USER DATABASE_USER
|
||||
# Password for user
|
||||
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 DATABASE_SERVER by hostname or ip of MySQL server for READ
|
||||
# Useful if you handle mysql slave databases
|
||||
# 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 "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,
|
||||
# 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
|
||||
PerlSetEnv OCS_OPT_WEB_SERVICE_RESULTS_LIMIT 100
|
||||
# PerlSetEnv OCS_OPT_WEB_SERVICE_PRIV_MODS_CONF "WEBSERV_PRIV_MOD_CONF_FILE"
|
||||
|
||||
# Be careful: you must restart apache to make settings taking effects
|
||||
|
||||
# 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 =====#
|
||||
##############################################################
|
||||
|
||||
# NOTE: IF YOU WANT TO USE THIS CONFIG FILE INSTEAD, set OCS_OPT_OPTIONS_NOT_OVERLOADED to '1'
|
||||
|
||||
# ===== MAIN SETTINGS =====
|
||||
|
||||
# Enable engine logs (see LOGPATH setting)
|
||||
PerlSetEnv OCS_OPT_LOGLEVEL 0
|
||||
# Specify agent's prolog frequency
|
||||
PerlSetEnv OCS_OPT_PROLOG_FREQ 12
|
||||
# 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
|
||||
# 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)
|
||||
PerlSetEnv OCS_OPT_INVENTORY_TRANSACTION 1
|
||||
# Configure engine to make a differential update of inventory sections (row level). Lower DB backend load, higher frontend load
|
||||
PerlSetEnv OCS_OPT_INVENTORY_WRITE_DIFF 1
|
||||
# Enable some stuff to improve DB queries, especially for GUI multicriteria searching system
|
||||
PerlSetEnv OCS_OPT_INVENTORY_CACHE_ENABLED 1
|
||||
# Specify when the engine will clean the inventory cache structures
|
||||
PerlSetEnv OCS_OPT_INVENTORY_CACHE_REVALIDATE 7
|
||||
# Enable you to keep trace of every elements encountered in db life
|
||||
PerlSetEnv OCS_OPT_INVENTORY_CACHE_KEEP 1
|
||||
|
||||
# ===== SOFTWARES DEPLOYMENT SETTINGS =====
|
||||
|
||||
# Enable this feature
|
||||
PerlSetEnv OCS_OPT_DOWNLOAD 0
|
||||
# Package which have a priority superior than this value will not be downloaded
|
||||
PerlSetEnv OCS_OPT_DOWNLOAD_PERIOD_LENGTH 10
|
||||
# Time between two download cycles (bandwidth control)
|
||||
PerlSetEnv OCS_OPT_DOWNLOAD_CYCLE_LATENCY 60
|
||||
# Time between two fragment downloads (bandwidth control)
|
||||
PerlSetEnv OCS_OPT_DOWNLOAD_FRAG_LATENCY 60
|
||||
# Specify if you want to track packages affected to a group on computer's level
|
||||
PerlSetEnv OCS_OPT_DOWNLOAD_GROUPS_TRACE_EVENTS 1
|
||||
# Time between two download periods (bandwidth control)
|
||||
PerlSetEnv OCS_OPT_DOWNLOAD_PERIOD_LATENCY 60
|
||||
# Agents will send ERR_TIMEOUT event and clean the package it is older than this setting
|
||||
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
|
||||
PerlSetEnv OCS_OPT_ENABLE_GROUPS 1
|
||||
# Random number computed in the defined range. Designed to avoid computing many groups in the same process
|
||||
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)
|
||||
PerlSetEnv OCS_OPT_IPDISCOVER 2
|
||||
# Specify the minimal difference to replace an ipdiscover agent
|
||||
PerlSetEnv OCS_OPT_IPDISCOVER_BETTER_THRESHOLD 1
|
||||
# Time between 2 arp requests (mini: 10 ms)
|
||||
PerlSetEnv OCS_OPT_IPDISCOVER_LATENCY 100
|
||||
# Specify when to remove a computer when it has not come until this period
|
||||
PerlSetEnv OCS_OPT_IPDISCOVER_MAX_ALIVE 14
|
||||
# Disable the time before a first election (not recommended)
|
||||
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
|
||||
# Link ipdiscover network to computer TAG
|
||||
PerlSetEnv OCS_OPT_IPDISCOVER_LINK_TAG_NETWORK 0
|
||||
|
||||
# ===== INVENTORY FILES MAPPING SETTINGS =====
|
||||
|
||||
# Use with ocsinventory-injector, enable the multi entities feature
|
||||
PerlSetEnv OCS_OPT_GENERATE_OCS_FILES 0
|
||||
# Generate either compressed file or clear XML text
|
||||
PerlSetEnv OCS_OPT_OCS_FILES_FORMAT OCS
|
||||
# Specify if you want to keep trace of all inventory between to synchronisation with the higher level server
|
||||
PerlSetEnv OCS_OPT_OCS_FILES_OVERWRITE 0
|
||||
# Path to ocs files directory (must be writeable)
|
||||
PerlSetEnv OCS_OPT_OCS_FILES_PATH /tmp
|
||||
|
||||
# ===== FILTER SETTINGS =====
|
||||
|
||||
# Enable prolog filter stack
|
||||
PerlSetEnv OCS_OPT_PROLOG_FILTER_ON 0
|
||||
# Enable core filter system to modify some things "on the fly"
|
||||
PerlSetEnv OCS_OPT_INVENTORY_FILTER_ENABLED 0
|
||||
# Enable inventory flooding filter. A dedicated ipaddress ia allowed to send a new computer only once in this period
|
||||
PerlSetEnv OCS_OPT_INVENTORY_FILTER_FLOOD_IP 0
|
||||
# Period definition for INVENTORY_FILTER_FLOOD_IP
|
||||
PerlSetEnv OCS_OPT_INVENTORY_FILTER_FLOOD_IP_CACHE_TIME 300
|
||||
# Enable inventory filter stack
|
||||
PerlSetEnv OCS_OPT_INVENTORY_FILTER_ON 0
|
||||
|
||||
# ===== 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
|
||||
|
||||
|
||||
# ===== REGISTRY SETTINGS =====
|
||||
|
||||
# Enable the registry capacity
|
||||
PerlSetEnv OCS_OPT_REGISTRY 1
|
||||
|
||||
# ===== SNMP SETTINGS =====
|
||||
|
||||
# Enable the SNMP capacity
|
||||
PerlSetEnv OCS_OPT_SNMP 0
|
||||
# Configure engine to update snmp inventory regarding to snmp_laststate table (lower DB backend load)
|
||||
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
|
||||
|
||||
# Validity of a session (prolog=>postinventory)
|
||||
PerlSetEnv OCS_OPT_SESSION_VALIDITY_TIME 600
|
||||
# Consider a session obsolete if it is older thant this value
|
||||
PerlSetEnv OCS_OPT_SESSION_CLEAN_TIME 86400
|
||||
# Accept an inventory only if required by server
|
||||
#( Refuse "forced" inventory)
|
||||
PerlSetEnv OCS_OPT_INVENTORY_SESSION_ONLY 0
|
||||
|
||||
# ===== TAG =====
|
||||
|
||||
# The default behavior of the server is to ignore TAG changes from the
|
||||
# agent.
|
||||
PerlSetEnv OCS_OPT_ACCEPT_TAG_UPDATE_FROM_CLIENT 0
|
||||
|
||||
# ===== EXTERNAL USERAGENTS =====
|
||||
|
||||
#Path for external useragents reference file
|
||||
#!! 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 "PATH_TO_PLUGINS_PERL_DIRECTORY"
|
||||
PerlSetEnv OCS_PLUGINS_CONF_DIR "PATH_TO_PLUGINS_CONFIG_DIRECTORY"
|
||||
|
||||
# ===== DEPRECATED =====
|
||||
|
||||
# Set the proxy cache validity in http headers when sending a file
|
||||
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
|
||||
|
||||
# Ocs
|
||||
PerlModule Apache::Ocsinventory
|
||||
PerlModule Apache::Ocsinventory::Server::Constants
|
||||
PerlModule Apache::Ocsinventory::Server::System
|
||||
PerlModule Apache::Ocsinventory::Server::Communication
|
||||
PerlModule Apache::Ocsinventory::Server::Inventory
|
||||
PerlModule Apache::Ocsinventory::Server::Duplicate
|
||||
|
||||
# Capacities
|
||||
PerlModule Apache::Ocsinventory::Server::Capacities::Registry
|
||||
PerlModule Apache::Ocsinventory::Server::Capacities::Update
|
||||
PerlModule Apache::Ocsinventory::Server::Capacities::Ipdiscover
|
||||
PerlModule Apache::Ocsinventory::Server::Capacities::Download
|
||||
PerlModule Apache::Ocsinventory::Server::Capacities::Notify
|
||||
PerlModule Apache::Ocsinventory::Server::Capacities::Snmp
|
||||
# This module guides you through the module creation
|
||||
# PerlModule Apache::Ocsinventory::Server::Capacities::Example
|
||||
# This module adds some rules to filter some request sent to ocs server in the prolog and inventory stages
|
||||
# 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
|
||||
#SSLEngine "SSL_ENABLE"
|
||||
#SSLCertificateFile "SSL_CERTIFICATE_FILE"
|
||||
#SSLCertificateKeyFile "SSL_CERTIFICATE_KEY_FILE"
|
||||
#SSLCACertificateFile "SSL_CERTIFICATE_FILE"
|
||||
#SSLCACertificatePath "SSL_CERTIFICATE_PATH"
|
||||
#SSLVerifyClient "SSL_VALIDATE_CLIENT"
|
||||
|
||||
# Engine apache settings
|
||||
# "Virtual" directory for handling OCS Inventory NG agents communications
|
||||
# Be careful, do not create such directory into your web server root document !
|
||||
<Location /ocsinventory>
|
||||
<IfModule mod_authz_core.c>
|
||||
# Apache 2.4
|
||||
Require all granted
|
||||
</IfModule>
|
||||
<IfModule !mod_authz_core.c>
|
||||
# Apache 2.2
|
||||
order deny,allow
|
||||
allow from all
|
||||
</IfModule>
|
||||
# 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"
|
||||
# require valid-user
|
||||
SetHandler perl-script
|
||||
PerlHandler Apache::Ocsinventory
|
||||
</Location>
|
||||
|
||||
#Web Service for plugin engine
|
||||
<Location /ocsplugins>
|
||||
<IfModule mod_authz_core.c>
|
||||
# Apache 2.4
|
||||
Require local
|
||||
</IfModule>
|
||||
<IfModule !mod_authz_core.c>
|
||||
# Apache 2.2
|
||||
order deny,allow
|
||||
allow from 127.0.0.1
|
||||
</IfModule>
|
||||
SetHandler perl-script
|
||||
PerlHandler Apache::Ocsinventory::Plugins::Apache
|
||||
</Location>
|
||||
|
||||
|
||||
# Web service apache settings
|
||||
PerlModule Apache::Ocsinventory::SOAP
|
||||
|
||||
<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
|
||||
Require all granted
|
||||
</IfModule>
|
||||
<IfModule !mod_authz_core.c>
|
||||
Order deny,allow
|
||||
Allow from all
|
||||
</IfModule>
|
||||
AuthType Basic
|
||||
AuthName "OCS Inventory SOAP Area"
|
||||
# Use htpasswd to create/update soap-user (or another granted user)
|
||||
AuthUserFile "APACHE_AUTH_USER_FILE"
|
||||
<IfModule mod_authz_core.c>
|
||||
# Apache 2.4
|
||||
Require user "SOAP_USER"
|
||||
</IfModule>
|
||||
<IfModule !mod_authz_core.c>
|
||||
require "SOAP_USER"
|
||||
</IfModule>
|
||||
</location>
|
||||
</IfModule>
|
||||
85
2.9.2/docker-compose.yml
Normal file
85
2.9.2/docker-compose.yml
Normal file
@ -0,0 +1,85 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
ocsapplication:
|
||||
image: ocsinventory/ocsinventory-docker-image:2.9.2
|
||||
container_name : ocsinventory-server
|
||||
restart: always
|
||||
expose:
|
||||
- "80"
|
||||
volumes:
|
||||
- "perlcomdata:/etc/ocsinventory-server"
|
||||
- "ocsreportsdata:/usr/share/ocsinventory-reports/ocsreports/extensions"
|
||||
- "varlibdata:/var/lib/ocsinventory-reports"
|
||||
- "httpdconfdata:/etc/apache2/conf-available"
|
||||
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:8.0
|
||||
container_name : ocsinventory-db
|
||||
restart: always
|
||||
expose :
|
||||
- "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
|
||||
|
||||
ocsproxy:
|
||||
image: nginx
|
||||
container_name: ocsinventory-proxy
|
||||
restart: always
|
||||
ports:
|
||||
- 80:80
|
||||
- 443:443
|
||||
volumes:
|
||||
- ./nginx/conf:/etc/nginx/templates
|
||||
- ./nginx/certs:/etc/nginx/certs
|
||||
- ./nginx/auth:/etc/nginx/auth
|
||||
environment:
|
||||
# 80 or 443
|
||||
LISTEN_PORT: 80
|
||||
# empty or ssl
|
||||
PORT_TYPE: ""
|
||||
SSL_CERT: ocs-dummy.crt
|
||||
SSL_KEY: ocs-dummy.key
|
||||
# OCS Api user restriction (default ocsapi/ocapi)
|
||||
API_AUTH_FILE: ocsapi.htpasswd
|
||||
# OCS Download
|
||||
READ_TIMEOUT: 300
|
||||
CONNECT_TIMEOUT: 300
|
||||
SEND_TIMEOUT: 300
|
||||
MAX_BODY_SIZE: 1G
|
||||
depends_on:
|
||||
- ocsapplication
|
||||
networks:
|
||||
- localocs
|
||||
|
||||
networks:
|
||||
localocs:
|
||||
|
||||
volumes:
|
||||
perlcomdata:
|
||||
ocsreportsdata:
|
||||
varlibdata:
|
||||
httpdconfdata:
|
||||
sqldata:
|
||||
|
||||
1
2.9.2/nginx/auth/ocsapi.htpasswd
Normal file
1
2.9.2/nginx/auth/ocsapi.htpasswd
Normal file
@ -0,0 +1 @@
|
||||
ocsapi:$apr1$BcAk5f/A$0O5c/DSy92/o.vpwwshWQ.
|
||||
22
2.9.2/nginx/certs/ocs-dummy.crt
Normal file
22
2.9.2/nginx/certs/ocs-dummy.crt
Normal file
@ -0,0 +1,22 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDlzCCAn+gAwIBAgIUZq+XFJryUuBpkwebSwjSy/hfMCkwDQYJKoZIhvcNAQEL
|
||||
BQAwWzELMAkGA1UEBhMCRlIxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM
|
||||
GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEUMBIGA1UEAwwLbXlvY3NzZXJ2ZXIw
|
||||
HhcNMjIwNDEzMDk0OTUzWhcNMzIwNDEwMDk0OTUzWjBbMQswCQYDVQQGEwJGUjET
|
||||
MBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0cyBQ
|
||||
dHkgTHRkMRQwEgYDVQQDDAtteW9jc3NlcnZlcjCCASIwDQYJKoZIhvcNAQEBBQAD
|
||||
ggEPADCCAQoCggEBAOQDcGzmYzzgVycXSEZWMJ2TEtnmjouNuUKAVQUcELMkZOk0
|
||||
TIRz7QhPIOCiH2bklji+ByyVZg/uXRFJlT/P46rPor/OuRK2Lkrt+APr+FmkLgvf
|
||||
JHMfm7YRbZuWVRJq0htNNL6szwHEFE99GlRy7SuapkhKSo4qY/LjrrR7E7DnPj/G
|
||||
7o21ge3OpOfbmx9xVWbEZaJqMOZDt1y3fbp3hQsflVM0AKdg7OoHOBWnv65iJIkN
|
||||
LtG7Icqcp+8AKnL1PaiMU+P970GTMZyZ0NWVAWgab9+Wl+makTTdDdQgJIhg19og
|
||||
ReLeYspEQlzXmEz+8JAxWGqsu+HuiZ6ClSl04W0CAwEAAaNTMFEwHQYDVR0OBBYE
|
||||
FEljOkF7g17RD+pOpJ7M6dovwI9uMB8GA1UdIwQYMBaAFEljOkF7g17RD+pOpJ7M
|
||||
6dovwI9uMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAKA2Fcot
|
||||
58X97tsLWC6eJrF2MLJzcNeSiiJayG9bT8agsUE8WGq5fvHvf5E54tueCp/q+a7V
|
||||
k4ZowCJF3RAvAqzRkMLQWaGms0Brz4qRtVvRqhWkP7aMGhUieOS2rTfLZ+TYPKfK
|
||||
561w8gSpxs9uRXbhnYeUchxJxCUg0CbxQwsjltrvnOF2LVP6JJDtYcc/NiDXhP4W
|
||||
pTp+EdwXt87VSRkTrqjEQO7/3TMsNjhi0PMFHnQf47ijLt44XaNGKh9pY31Ae9oo
|
||||
6IuRygJc6QNVoGRmF2bxsorU4i4rA3kR2Ir9AUbxJT6MtuLtx8DGB8Dmp6bKmIv+
|
||||
HZH21wRRhwrYJb8=
|
||||
-----END CERTIFICATE-----
|
||||
28
2.9.2/nginx/certs/ocs-dummy.key
Normal file
28
2.9.2/nginx/certs/ocs-dummy.key
Normal file
@ -0,0 +1,28 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDkA3Bs5mM84Fcn
|
||||
F0hGVjCdkxLZ5o6LjblCgFUFHBCzJGTpNEyEc+0ITyDgoh9m5JY4vgcslWYP7l0R
|
||||
SZU/z+Oqz6K/zrkSti5K7fgD6/hZpC4L3yRzH5u2EW2bllUSatIbTTS+rM8BxBRP
|
||||
fRpUcu0rmqZISkqOKmPy4660exOw5z4/xu6NtYHtzqTn25sfcVVmxGWiajDmQ7dc
|
||||
t326d4ULH5VTNACnYOzqBzgVp7+uYiSJDS7RuyHKnKfvACpy9T2ojFPj/e9BkzGc
|
||||
mdDVlQFoGm/flpfpmpE03Q3UICSIYNfaIEXi3mLKREJc15hM/vCQMVhqrLvh7ome
|
||||
gpUpdOFtAgMBAAECggEBAM4BGXMaV/CpU7R6wY7i0jubpH2AY6tMGWQu5CGgsKnZ
|
||||
qN5VpQhKYI6QR0kM0Mg6oEqVzY+HT1X3athynciwf6ZUwFsBX467UGncRKbubEw5
|
||||
HG0XZywoE5vUdS4MDcJ9BmUqRQw8vy5+REdo5QAFcahiqfdIP8HgJLtO4Aop5Kl/
|
||||
HoLqR83q3vBHfidxTX2z4m05t6ucAbmqLAgAb2GzRHEvdCpSXvs7M9ZyR/rvdhSV
|
||||
pswWR7XIUic50Lc8tHXyaKinuBFOCWCszsirPLAVPrs1D7Gq8kmdxUEEj0V9VbEE
|
||||
8afsb9cCojrDISn814WwjX+zVwjRwyr3v3BLHVGu06ECgYEA+1VHUwBTUnHmnMR+
|
||||
6XE1nkBStedvXGsMDIxK/VhNXAylUz4kfJ0bMPKdzbxSieHwA8O1+Hg4gN31V2Sn
|
||||
RgT5P0sLGdideysoy8yR5Aiiwx+7EXGqSQltY2lpaykP9wvpznWi3k/Wd7dAaTCd
|
||||
jPCtkzoLYMDzaQ9uc4A2VyY00RkCgYEA6D9PPvV6YE8S7G7sGwTSt9mgobZNm1AV
|
||||
BjDmtEPfDSK59rT8PpoN+225c1qaIIODdH0DHK9ZbPzo/29tW1l9zgGjEXEw396v
|
||||
Q9y99Ofh0JEsQbJJw/nPdV8dHKOL2ek3UWsscpsk5dUb+4gBpE+/wH21j7UiczKt
|
||||
a8whmMFw+XUCgYAPYdHCr7NpyVTO5WvLB8W7UL5/KZH0Owz6u59fUAc0CgYYSSZc
|
||||
hhUC8uZbkBoRHEXfRRwe/+SdZng8iAmAzI8go4wjYdGJl0Og7X1EUo77mDaPw8Aj
|
||||
RjNusSXljBbRDOabXzG/n21F2G5VwcbyuEw3RYcqvcRn+qzM3tz0in8TCQKBgDe1
|
||||
N+T6LOh9DyT3VlsExSakZQtlFyhyBRj/EdebkB0ufzzWHMtHWKM+poUs7ltuMFH4
|
||||
yo5O4TxrTdg3ehu3U53edqbwZ7DLUW8Nu+LK3DeTGvKHOXpwqXqV3f3InPsgHczB
|
||||
0F+NJ0SZ4aRr8zjeiDg77xkRcboAJej9hfGGNPshAoGALPS2HtT/1ycsER3a33NW
|
||||
A8j/2TfovcjZ9u15q5KDLRZ+3UngLvVwPJO1j/uLPqyyRsQID7SE29KCj/E8kOZH
|
||||
clbLXZmslyk369HOlpXZEXvR7rDxOt1jdojQrtEyW4gDT8k4iEw8nPcJyJ7YSVp/
|
||||
Qa0OOCtQPPvBt0Be1bHTGek=
|
||||
-----END PRIVATE KEY-----
|
||||
48
2.9.2/nginx/conf/ocsinventory.conf.template
Normal file
48
2.9.2/nginx/conf/ocsinventory.conf.template
Normal file
@ -0,0 +1,48 @@
|
||||
##
|
||||
# You should look at the following URL's in order to grasp a solid understanding
|
||||
# of Nginx configuration files in order to fully unleash the power of Nginx.
|
||||
# https://www.nginx.com/resources/wiki/start/
|
||||
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
|
||||
# https://wiki.debian.org/Nginx/DirectoryStructure
|
||||
#
|
||||
# In most cases, administrators will remove this file from sites-enabled/ and
|
||||
# leave it as reference inside of sites-available where it will continue to be
|
||||
# updated by the nginx packaging team.
|
||||
#
|
||||
# This file will automatically load configuration files provided by other
|
||||
# applications, such as Drupal or Wordpress. These applications will be made
|
||||
# available underneath a path with that package name, such as /drupal8.
|
||||
#
|
||||
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
|
||||
##
|
||||
|
||||
# OCS server configuration
|
||||
#
|
||||
server {
|
||||
listen ${LISTEN_PORT} ${PORT_TYPE} default_server;
|
||||
|
||||
ssl_certificate /etc/nginx/certs/${SSL_CERT};
|
||||
ssl_certificate_key /etc/nginx/certs/${SSL_KEY};
|
||||
|
||||
location / {
|
||||
proxy_redirect off;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Frame-Options SAMEORIGIN;
|
||||
proxy_pass http://ocsapplication;
|
||||
}
|
||||
|
||||
location /ocsapi {
|
||||
auth_basic "OCS Api area";
|
||||
auth_basic_user_file /etc/nginx/auth/${API_AUTH_FILE};
|
||||
}
|
||||
|
||||
location /download {
|
||||
proxy_read_timeout ${READ_TIMEOUT};
|
||||
proxy_connect_timeout ${CONNECT_TIMEOUT};
|
||||
proxy_send_timeout ${SEND_TIMEOUT};
|
||||
client_max_body_size ${MAX_BODY_SIZE};
|
||||
}
|
||||
}
|
||||
184
2.9.2/scripts/docker-entrypoint.sh
Executable file
184
2.9.2/scripts/docker-entrypoint.sh
Executable file
@ -0,0 +1,184 @@
|
||||
#!/bin/bash
|
||||
|
||||
API_CONF_FILE="/etc/apache2/conf-available/zz-ocsinventory-restapi.conf"
|
||||
SRV_CONF_FILE="/etc/apache2/conf-available/z-ocsinventory-server.conf"
|
||||
REPORTS_CONF_FILE="/etc/apache2/conf-available/ocsinventory-reports.conf"
|
||||
DB_CONFIG_INC_FILE="${OCS_WEBCONSOLE_DIR}/ocsreports/dbconfig.inc.php"
|
||||
|
||||
API_ROUTE=$(perl -e "print \"@INC[2]\"")
|
||||
API_ROUTE_LOADER="${API_ROUTE}/Api/Ocsinventory/Restapi/Loader.pm"
|
||||
|
||||
echo
|
||||
echo "+----------------------------------------------------------+"
|
||||
echo "| |"
|
||||
echo "| Welcome to OCS Inventory NG Management Docker! |"
|
||||
echo "| |"
|
||||
echo "+----------------------------------------------------------+"
|
||||
echo
|
||||
|
||||
# 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-${OCS_VERSION}/ocsreports/ ${OCS_WEBCONSOLE_DIR}
|
||||
rm -rf ${DB_CONFIG_INC_FILE}
|
||||
fi;
|
||||
|
||||
cp -R /tmp/OCSNG_UNIX_SERVER-${OCS_VERSION}/Api/ ${API_ROUTE}
|
||||
|
||||
if [ ! -z ${OCS_DISABLE_API_MODE+x} ]; then
|
||||
echo
|
||||
echo "+---------------------------------------------------------------------------+"
|
||||
echo "| Warning: OCS_DISABLE_API_MODE environment variable is set! |"
|
||||
echo "| REST API will be DISABLED |"
|
||||
echo "+---------------------------------------------------------------------------+"
|
||||
echo
|
||||
fi
|
||||
|
||||
if [ ! -z ${OCS_DISABLE_COM_MODE+x} ]; then
|
||||
echo
|
||||
echo "+---------------------------------------------------------------------------+"
|
||||
echo "| Warning: OCS_DISABLE_COM_MODE environment variable is set! |"
|
||||
echo "| Communication server, which handles HTTP communications between database |"
|
||||
echo "| server and agents (Apache, perl and mod_perl) will be DISABLED! |"
|
||||
echo "+---------------------------------------------------------------------------+"
|
||||
echo
|
||||
fi
|
||||
|
||||
if [ ! -z ${OCS_DISABLE_WEB_MODE+x} ]; then
|
||||
echo
|
||||
echo "+---------------------------------------------------------------------------+"
|
||||
echo "| Warning: OCS_DISABLE_WEB_MODE environment variable is set! |"
|
||||
echo "| Administration console, which allows administrators to query the database |"
|
||||
echo "| server using their favorite browser (Apache, php) will be DISABLED! |"
|
||||
echo "+---------------------------------------------------------------------------+"
|
||||
echo
|
||||
fi
|
||||
|
||||
echo "+----------------------------------------------------------+"
|
||||
echo "| Setting Apache Server Name to '${APACHE_SERVER_NAME:-localhost}'"
|
||||
echo "+----------------------------------------------------------+"
|
||||
echo
|
||||
sed -ri -e "s!^#(ServerName)\s+\S+!\1 ${APACHE_SERVER_NAME:-localhost}:80!g" \
|
||||
"/etc/apache2/apache2.conf"
|
||||
|
||||
# Configure z-ocsinventory-server file
|
||||
if [ ! -f ${SRV_CONF_FILE} ] && [ -z ${OCS_DISABLE_COM_MODE+x} ]; then
|
||||
cp /tmp/conf/ocsinventory-server.conf ${SRV_CONF_FILE}
|
||||
sed -i 's/VERSION_MP/2/g' ${SRV_CONF_FILE}
|
||||
sed -i 's/DATABASE_SERVER/'"$OCS_DB_SERVER"'/g' ${SRV_CONF_FILE}
|
||||
sed -i 's/DATABASE_PORT/'"$OCS_DB_PORT"'/g' ${SRV_CONF_FILE}
|
||||
sed -i 's/DATABASE_NAME/'"$OCS_DB_NAME"'/g' ${SRV_CONF_FILE}
|
||||
sed -i 's/DATABASE_USER/'"$OCS_DB_USER"'/g' ${SRV_CONF_FILE}
|
||||
sed -i 's/DATABASE_PASSWD/'"$OCS_DB_PASS"'/g' ${SRV_CONF_FILE}
|
||||
sed -i 's/"PATH_TO_LOG_DIRECTORY"/'"${OCS_LOG_DIR//\//\\/}"'/g' ${SRV_CONF_FILE}
|
||||
sed -i 's/"PATH_TO_PLUGINS_PERL_DIRECTORY"/'"${OCS_PERLEXT_DIR//\//\\/}"'/g' ${SRV_CONF_FILE}
|
||||
sed -i 's/"PATH_TO_PLUGINS_CONFIG_DIRECTORY"/'"${OCS_PLUGINSEXT_DIR//\//\\/}"'/g' ${SRV_CONF_FILE}
|
||||
fi
|
||||
|
||||
# Configure zz-ocsinventory-restapi file
|
||||
if [ ! -f ${API_CONF_FILE} ] && [ -z ${OCS_DISABLE_API_MODE+x} ] && [ -z ${OCS_DISABLE_COM_MODE+x} ]; then
|
||||
cp /tmp/conf/ocsinventory-restapi.conf ${API_CONF_FILE}
|
||||
sed -i 's/DATABASE_SERVER/'"$OCS_DB_SERVER"'/g' ${API_CONF_FILE}
|
||||
sed -i 's/DATABASE_PORT/'"$OCS_DB_PORT"'/g' ${API_CONF_FILE}
|
||||
sed -i 's/DATABASE_NAME/'"$OCS_DB_NAME"'/g' ${API_CONF_FILE}
|
||||
sed -i 's/DATABASE_USER/'"$OCS_DB_USER"'/g' ${API_CONF_FILE}
|
||||
sed -i 's/DATABASE_PASSWD/'"$OCS_DB_PASS"'/g' ${API_CONF_FILE}
|
||||
sed -i 's/OCS_SSL_ENABLED/'"$OCS_SSL_ENABLED"'/g' ${API_CONF_FILE}
|
||||
sed -i 's/REST_API_PATH/'"${API_ROUTE//\//\\/}"'/g' ${API_CONF_FILE}
|
||||
sed -i 's/REST_API_LOADER_PATH/'"${API_ROUTE_LOADER//\//\\/}"'/g' ${API_CONF_FILE}
|
||||
fi
|
||||
|
||||
# Replace Variables
|
||||
if [ -f ${SRV_CONF_FILE} ] && [ -z ${OCS_DISABLE_COM_MODE+x} ]; then
|
||||
echo "+-----------------------------------------------+"
|
||||
echo "| Customizing from environment variables... |"
|
||||
echo "+-----------------------------------------------+"
|
||||
echo
|
||||
# Get all env vars starting with 'OCS_'
|
||||
for var in $(env | cut -f1 -d= | grep -i OCS_); do
|
||||
# Check that the current var is not commented out in conf file
|
||||
if grep -q "^\s*PerlSetEnv ${var^^}" ${SRV_CONF_FILE} ; then
|
||||
echo "Applying Config ${var^^}=${!var} from environment variable"
|
||||
sed -i "s,^\(\s*PerlSetEnv ${var^^}\).*$,\1 ${!var},g" ${SRV_CONF_FILE}
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Configure ocsinventory-reports file
|
||||
if [ ! -f ${REPORTS_CONF_FILE} ] && [ -z ${OCS_DISABLE_WEB_MODE+x} ]; then
|
||||
cp /tmp/conf/ocsinventory-reports.conf ${REPORTS_CONF_FILE}
|
||||
sed -i 's/OCSREPORTS_ALIAS/\/ocsreports/g' ${REPORTS_CONF_FILE}
|
||||
sed -i 's/PATH_TO_OCSREPORTS_DIR/'"${OCS_WEBCONSOLE_DIR//\//\\/}"'\/ocsreports/g' ${REPORTS_CONF_FILE}
|
||||
sed -i 's/PACKAGES_ALIAS/\/download/g' ${REPORTS_CONF_FILE}
|
||||
sed -i 's/PATH_TO_PACKAGES_DIR/'"${OCS_VARLIB_DIR//\//\\/}"'download/g' ${REPORTS_CONF_FILE}
|
||||
sed -i 's/SNMP_ALIAS/\/snmp/g' ${REPORTS_CONF_FILE}
|
||||
sed -i 's/PATH_TO_SNMP_DIR/'"${OCS_VARLIB_DIR//\//\\/}"'snmp/g' ${REPORTS_CONF_FILE}
|
||||
fi
|
||||
|
||||
# Generate dbconfig.inc.php
|
||||
if [ ! -f ${DB_CONFIG_INC_FILE} ] && [ -z ${OCS_DISABLE_WEB_MODE+x} ]; then
|
||||
|
||||
cp /tmp/conf/dbconfig.inc.php $OCS_WEBCONSOLE_DIR/ocsreports
|
||||
sed -i 's/OCS_DB_NAME/'"$OCS_DB_NAME"'/g' ${DB_CONFIG_INC_FILE}
|
||||
sed -i 's/OCS_READ_NAME/'"$OCS_DB_SERVER"'/g' ${DB_CONFIG_INC_FILE}
|
||||
sed -i 's/OCS_WRITE_NAME/'"$OCS_DB_SERVER"'/g' ${DB_CONFIG_INC_FILE}
|
||||
sed -i 's/OCS_DB_PORT/'"$OCS_DB_PORT"'/g' ${DB_CONFIG_INC_FILE}
|
||||
sed -i 's/OCS_DB_USER/'"$OCS_DB_USER"'/g' ${DB_CONFIG_INC_FILE}
|
||||
sed -i 's/OCS_DB_PASS/'"$OCS_DB_PASS"'/g' ${DB_CONFIG_INC_FILE}
|
||||
sed -i 's/OCS_SSL_ENABLED/'"$OCS_SSL_ENABLED"'/g' ${DB_CONFIG_INC_FILE}
|
||||
sed -i 's/OCS_SSL_WEB_MODE/'"$OCS_SSL_WEB_MODE"'/g' ${DB_CONFIG_INC_FILE}
|
||||
sed -i 's/OCS_SSL_KEY/'"${OCS_SSL_KEY//\//\\/}"'/g' ${DB_CONFIG_INC_FILE}
|
||||
sed -i 's/OCS_SSL_CERT/'"${OCS_SSL_CERT//\//\\/}"'/g' ${DB_CONFIG_INC_FILE}
|
||||
sed -i 's/OCS_SSL_CA/'"${OCS_SSL_CA//\//\\/}"'/g' ${DB_CONFIG_INC_FILE}
|
||||
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
|
||||
echo
|
||||
echo "+--------------------------------+"
|
||||
echo "| Removing not used files... |"
|
||||
echo "+--------------------------------+"
|
||||
echo
|
||||
cd /tmp
|
||||
shopt -s extglob
|
||||
rm -rf !("conf")
|
||||
|
||||
# Enable conf
|
||||
a2enconf ocsinventory-reports
|
||||
a2enconf z-ocsinventory-server
|
||||
a2enconf zz-ocsinventory-restapi
|
||||
|
||||
# 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
|
||||
|
||||
echo "+----------------------------------------------------------+"
|
||||
echo "| OK, prepare finshed ;-) |"
|
||||
echo "| |"
|
||||
echo "| Starting OCS Inventory NG Management Docker... |"
|
||||
echo "+----------------------------------------------------------+"
|
||||
echo
|
||||
|
||||
exec "$@"
|
||||
2678
2.9.2/sql/ocsbase.sql
Normal file
2678
2.9.2/sql/ocsbase.sql
Normal file
File diff suppressed because one or more lines are too long
@ -1,15 +1,13 @@
|
||||
FROM centos:centos7
|
||||
FROM ubuntu:20.04
|
||||
|
||||
LABEL maintainer="contact@ocsinventory-ng.org" \
|
||||
version="dev" \
|
||||
description="OCS Inventory docker image"
|
||||
|
||||
ARG YUM_FLAGS="-y"
|
||||
ARG APT_FLAGS="-y"
|
||||
|
||||
VOLUME /var/lib/ocsinventory-reports /usr/share/ocsinventory-reports/ocsreports /etc/ocsinventory-server
|
||||
|
||||
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 \
|
||||
ENV APACHE_RUN_USER=www-data APACHE_RUN_GROUP=www-data \
|
||||
APACHE_LOG_DIR=/var/log/apache2 APACHE_PID_FILE=/var/run/apache2/apache2.pid APACHE_RUN_DIR=/var/run/apache2 APACHE_LOCK_DIR=/var/lock/apache2 \
|
||||
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/ocsreports/ \
|
||||
OCS_PERLEXT_DIR=/etc/ocsinventory-server/perl/ OCS_PLUGINSEXT_DIR=/etc/ocsinventory-server/plugins/ \
|
||||
@ -20,56 +18,44 @@ ENV APACHE_RUN_USER=apache APACHE_RUN_GROUP=apache \
|
||||
|
||||
WORKDIR /tmp
|
||||
|
||||
RUN yum ${YUM_FLAGS} install wget \
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
VOLUME /var/lib/ocsinventory-reports /etc/ocsinventory-server /usr/share/ocsinventory-reports/ocsreports
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
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 \
|
||||
perl \
|
||||
apache2 \
|
||||
php \
|
||||
libxml-simple-perl \
|
||||
libdbi-perl \
|
||||
libdbd-mysql-perl \
|
||||
libapache-dbi-perl \
|
||||
libnet-ip-perl \
|
||||
libsoap-lite-perl \
|
||||
libarchive-zip-perl \
|
||||
libswitch-perl \
|
||||
libmojolicious-perl \
|
||||
libplack-perl \
|
||||
build-essential \
|
||||
php-pclzip \
|
||||
php-mbstring \
|
||||
php-soap \
|
||||
php-mysql \
|
||||
php-curl \
|
||||
php-xml \
|
||||
php-zip \
|
||||
php-gd \
|
||||
git \
|
||||
vim \
|
||||
nano ;
|
||||
nano \
|
||||
composer
|
||||
|
||||
COPY conf/* /tmp/
|
||||
COPY ./scripts/docker-entrypoint.sh /usr/bin/docker-entrypoint.sh
|
||||
|
||||
EXPOSE 80 443
|
||||
|
||||
ENTRYPOINT ["/usr/bin/docker-entrypoint.sh"]
|
||||
ENTRYPOINT ["/usr/bin/docker-entrypoint.sh"]
|
||||
|
||||
@ -12,7 +12,7 @@ services:
|
||||
- "perlcomdata:/etc/ocsinventory-server"
|
||||
- "ocsreportsdata:/usr/share/ocsinventory-reports/ocsreports"
|
||||
- "varlibdata:/var/lib/ocsinventory-reports"
|
||||
- "httpdconfdata:/etc/httpd/conf.d"
|
||||
- "httpdconfdata:/etc/apache2/conf-available"
|
||||
environment:
|
||||
OCS_DB_SERVER: ocsinventory-db-dev
|
||||
OCS_DB_USER: ocsuser
|
||||
@ -33,7 +33,7 @@ services:
|
||||
- ocsdb
|
||||
|
||||
ocsdb :
|
||||
image : mysql:5.7
|
||||
image : mysql:8.0
|
||||
container_name : ocsinventory-db-dev
|
||||
restart: always
|
||||
ports :
|
||||
|
||||
@ -1,9 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Composer install
|
||||
cd /opt
|
||||
php73 -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
||||
php73 composer-setup.php --quiet
|
||||
API_CONF_FILE="/etc/apache2/conf-available/zz-ocsinventory-restapi.conf"
|
||||
SRV_CONF_FILE="/etc/apache2/conf-available/z-ocsinventory-server.conf"
|
||||
REPORTS_CONF_FILE="/etc/apache2/conf-available/ocsinventory-reports.conf"
|
||||
DB_CONFIG_INC_FILE="${OCS_WEBCONSOLE_DIR}/dbconfig.inc.php"
|
||||
|
||||
API_ROUTE=$(perl -e "print \"@INC[2]\"")
|
||||
API_ROUTE_LOADER="${API_ROUTE}/Api/Ocsinventory/Restapi/Loader.pm"
|
||||
|
||||
# Move to temp and download OCS
|
||||
cd /tmp
|
||||
@ -11,11 +14,11 @@ git clone $SERVER_REPOSITORY_GIT_URL OCSNG_UNIX_SERVER -b $SERVER_REPOSITORY_BRA
|
||||
cd OCSNG_UNIX_SERVER/
|
||||
git clone $OCSREPORTS_REPOSITORY_GIT_URL ocsreports -b $OCSREPORTS_REPOSITORY_BRANCH
|
||||
cd ocsreports/
|
||||
php73 /opt/composer.phar install
|
||||
composer install
|
||||
cd /tmp/OCSNG_UNIX_SERVER
|
||||
|
||||
# Create all directories
|
||||
mkdir -p $OCS_WEBCONSOLE_DIR
|
||||
mkdir -p ${OCS_WEBCONSOLE_DIR}
|
||||
mkdir -p $OCS_LOG_DIR
|
||||
mkdir -p $OCS_PERLEXT_DIR/Apache/Ocsinventory/Plugins
|
||||
mkdir -p $OCS_PLUGINSEXT_DIR
|
||||
@ -32,68 +35,73 @@ make
|
||||
make install
|
||||
cd ..
|
||||
|
||||
cp -R Api/ /usr/local/share/perl5
|
||||
cp -R Api/ $API_ROUTE
|
||||
|
||||
# Webconsole
|
||||
cp -R ocsreports/. $OCS_WEBCONSOLE_DIR
|
||||
cp -R ocsreports/. ${OCS_WEBCONSOLE_DIR}
|
||||
|
||||
# Configure z-ocsinventory-server file
|
||||
cp /tmp/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
|
||||
cp /tmp/ocsinventory-server.conf ${SRV_CONF_FILE}
|
||||
sed -i 's/VERSION_MP/2/g' ${SRV_CONF_FILE}
|
||||
sed -i 's/DATABASE_SERVER/'"$OCS_DB_SERVER"'/g' ${SRV_CONF_FILE}
|
||||
sed -i 's/DATABASE_PORT/'"$OCS_DB_PORT"'/g' ${SRV_CONF_FILE}
|
||||
sed -i 's/DATABASE_NAME/'"$OCS_DB_NAME"'/g' ${SRV_CONF_FILE}
|
||||
sed -i 's/DATABASE_USER/'"$OCS_DB_USER"'/g' ${SRV_CONF_FILE}
|
||||
sed -i 's/DATABASE_PASSWD/'"$OCS_DB_PASS"'/g' ${SRV_CONF_FILE}
|
||||
sed -i 's/"PATH_TO_LOG_DIRECTORY"/'"${OCS_LOG_DIR//\//\\/}"'/g' ${SRV_CONF_FILE}
|
||||
sed -i 's/"PATH_TO_PLUGINS_PERL_DIRECTORY"/'"${OCS_PERLEXT_DIR//\//\\/}"'/g' ${SRV_CONF_FILE}
|
||||
sed -i 's/"PATH_TO_PLUGINS_CONFIG_DIRECTORY"/'"${OCS_PLUGINSEXT_DIR//\//\\/}"'/g' ${SRV_CONF_FILE}
|
||||
sed -i 's/OCS_SSL_ENABLED/'"$OCS_SSL_ENABLED"'/g' ${SRV_CONF_FILE}
|
||||
sed -i 's/OCS_SSL_KEY/'"${OCS_SSL_KEY//\//\\/}"'/g' ${SRV_CONF_FILE}
|
||||
sed -i 's/OCS_SSL_CERT/'"${OCS_SSL_CERT//\//\\/}"'/g' ${SRV_CONF_FILE}
|
||||
sed -i 's/OCS_SSL_CA/'"${OCS_SSL_CA//\//\\/}"'/g' ${SRV_CONF_FILE}
|
||||
sed -i 's/OCS_SSL_COM_MODE/'"$OCS_SSL_COM_MODE"'/g' ${SRV_CONF_FILE}
|
||||
|
||||
# Configure zz-ocsinventory-restapi file
|
||||
if [ ! -f /etc/httpd/conf.d/zz-ocsinventory-restapi.conf ]; then
|
||||
cp /tmp/conf/ocsinventory-restapi.conf /etc/httpd/conf.d/zz-ocsinventory-restapi.conf
|
||||
sed -i 's/DATABASE_SERVER/'"$OCS_DB_SERVER"'/g' /etc/httpd/conf.d/zz-ocsinventory-restapi.conf
|
||||
sed -i 's/DATABASE_PORT/'"$OCS_DB_PORT"'/g' /etc/httpd/conf.d/zz-ocsinventory-restapi.conf
|
||||
sed -i 's/DATABASE_NAME/'"$OCS_DB_NAME"'/g' /etc/httpd/conf.d/zz-ocsinventory-restapi.conf
|
||||
sed -i 's/DATABASE_USER/'"$OCS_DB_USER"'/g' /etc/httpd/conf.d/zz-ocsinventory-restapi.conf
|
||||
sed -i 's/DATABASE_PASSWD/'"$OCS_DB_PASS"'/g' /etc/httpd/conf.d/zz-ocsinventory-restapi.conf
|
||||
sed -i 's/OCS_SSL_ENABLED/'"$OCS_SSL_ENABLED"'/g' /etc/httpd/conf.d/zz-ocsinventory-restapi.conf
|
||||
sed -i 's/REST_API_PATH/\/usr\/local\/share\/perl5/g' /etc/httpd/conf.d/zz-ocsinventory-restapi.conf
|
||||
sed -i 's/REST_API_LOADER_PATH/\/usr\/local\/share\/perl5\/Api\/Ocsinventory\/Restapi\/Loader.pm/g' /etc/httpd/conf.d/zz-ocsinventory-restapi.conf
|
||||
if [ ! -f ${API_CONF_FILE} ]; then
|
||||
cp /tmp/ocsinventory-restapi.conf ${API_CONF_FILE}
|
||||
sed -i 's/DATABASE_SERVER/'"$OCS_DB_SERVER"'/g' ${API_CONF_FILE}
|
||||
sed -i 's/DATABASE_PORT/'"$OCS_DB_PORT"'/g' ${API_CONF_FILE}
|
||||
sed -i 's/DATABASE_NAME/'"$OCS_DB_NAME"'/g' ${API_CONF_FILE}
|
||||
sed -i 's/DATABASE_USER/'"$OCS_DB_USER"'/g' ${API_CONF_FILE}
|
||||
sed -i 's/DATABASE_PASSWD/'"$OCS_DB_PASS"'/g' ${API_CONF_FILE}
|
||||
sed -i 's/OCS_SSL_ENABLED/'"$OCS_SSL_ENABLED"'/g' ${API_CONF_FILE}
|
||||
sed -i 's/REST_API_PATH/'"${API_ROUTE//\//\\/}"'/g' ${API_CONF_FILE}
|
||||
sed -i 's/REST_API_LOADER_PATH/'"${API_ROUTE_LOADER//\//\\/}"'/g' ${API_CONF_FILE}
|
||||
fi
|
||||
|
||||
# Configure ocsinventory-reports file
|
||||
cp /tmp/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//\//\\/}"'/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
|
||||
cp /tmp/ocsinventory-reports.conf ${REPORTS_CONF_FILE}
|
||||
sed -i 's/OCSREPORTS_ALIAS/\/ocsreports/g' ${REPORTS_CONF_FILE}
|
||||
sed -i 's/PATH_TO_OCSREPORTS_DIR/'"${OCS_WEBCONSOLE_DIR//\//\\/}"'/g' ${REPORTS_CONF_FILE}
|
||||
sed -i 's/PACKAGES_ALIAS/\/download/g' ${REPORTS_CONF_FILE}
|
||||
sed -i 's/PATH_TO_PACKAGES_DIR/'"${OCS_VARLIB_DIR//\//\\/}"'download/g' ${REPORTS_CONF_FILE}
|
||||
sed -i 's/SNMP_ALIAS/\/snmp/g' ${REPORTS_CONF_FILE}
|
||||
sed -i 's/PATH_TO_SNMP_DIR/'"${OCS_VARLIB_DIR//\//\\/}"'snmp/g' ${REPORTS_CONF_FILE}
|
||||
|
||||
# Generate dbconfig.inc.php
|
||||
cp /tmp/dbconfig.inc.php $OCS_WEBCONSOLE_DIR
|
||||
sed -i 's/OCS_DB_NAME/'"$OCS_DB_NAME"'/g' $OCS_WEBCONSOLE_DIR/dbconfig.inc.php
|
||||
sed -i 's/OCS_READ_NAME/'"$OCS_DB_SERVER"'/g' $OCS_WEBCONSOLE_DIR/dbconfig.inc.php
|
||||
sed -i 's/OCS_WRITE_NAME/'"$OCS_DB_SERVER"'/g' $OCS_WEBCONSOLE_DIR/dbconfig.inc.php
|
||||
sed -i 's/OCS_DB_PORT/'"$OCS_DB_PORT"'/g' $OCS_WEBCONSOLE_DIR/dbconfig.inc.php
|
||||
sed -i 's/OCS_DB_USER/'"$OCS_DB_USER"'/g' $OCS_WEBCONSOLE_DIR/dbconfig.inc.php
|
||||
sed -i 's/OCS_DB_PASS/'"$OCS_DB_PASS"'/g' $OCS_WEBCONSOLE_DIR/dbconfig.inc.php
|
||||
sed -i 's/OCS_SSL_ENABLED/'"$OCS_SSL_ENABLED"'/g' $OCS_WEBCONSOLE_DIR/dbconfig.inc.php
|
||||
sed -i 's/OCS_SSL_WEB_MODE/'"$OCS_SSL_WEB_MODE"'/g' $OCS_WEBCONSOLE_DIR/dbconfig.inc.php
|
||||
sed -i 's/OCS_SSL_KEY/'"${OCS_SSL_KEY//\//\\/}"'/g' $OCS_WEBCONSOLE_DIR/dbconfig.inc.php
|
||||
sed -i 's/OCS_SSL_CERT/'"${OCS_SSL_CERT//\//\\/}"'/g' $OCS_WEBCONSOLE_DIR/dbconfig.inc.php
|
||||
sed -i 's/OCS_SSL_CA/'"${OCS_SSL_CA//\//\\/}"'/g' $OCS_WEBCONSOLE_DIR/dbconfig.inc.php
|
||||
cp /tmp/dbconfig.inc.php ${OCS_WEBCONSOLE_DIR}
|
||||
sed -i 's/OCS_DB_NAME/'"$OCS_DB_NAME"'/g' ${DB_CONFIG_INC_FILE}
|
||||
sed -i 's/OCS_READ_NAME/'"$OCS_DB_SERVER"'/g' ${DB_CONFIG_INC_FILE}
|
||||
sed -i 's/OCS_WRITE_NAME/'"$OCS_DB_SERVER"'/g' ${DB_CONFIG_INC_FILE}
|
||||
sed -i 's/OCS_DB_PORT/'"$OCS_DB_PORT"'/g' ${DB_CONFIG_INC_FILE}
|
||||
sed -i 's/OCS_DB_USER/'"$OCS_DB_USER"'/g' ${DB_CONFIG_INC_FILE}
|
||||
sed -i 's/OCS_DB_PASS/'"$OCS_DB_PASS"'/g' ${DB_CONFIG_INC_FILE}
|
||||
sed -i 's/OCS_SSL_ENABLED/'"$OCS_SSL_ENABLED"'/g' ${DB_CONFIG_INC_FILE}
|
||||
sed -i 's/OCS_SSL_WEB_MODE/'"$OCS_SSL_WEB_MODE"'/g' ${DB_CONFIG_INC_FILE}
|
||||
sed -i 's/OCS_SSL_KEY/'"${OCS_SSL_KEY//\//\\/}"'/g' ${DB_CONFIG_INC_FILE}
|
||||
sed -i 's/OCS_SSL_CERT/'"${OCS_SSL_CERT//\//\\/}"'/g' ${DB_CONFIG_INC_FILE}
|
||||
sed -i 's/OCS_SSL_CA/'"${OCS_SSL_CA//\//\\/}"'/g' ${DB_CONFIG_INC_FILE}
|
||||
|
||||
# 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
|
||||
chown -R $APACHE_RUN_USER: ${OCS_WEBCONSOLE_DIR}
|
||||
|
||||
# Enable conf
|
||||
a2enconf ocsinventory-reports
|
||||
a2enconf z-ocsinventory-server
|
||||
a2enconf zz-ocsinventory-restapi
|
||||
|
||||
# Apache start
|
||||
if [ ! -d "$APACHE_RUN_DIR" ]; then
|
||||
@ -104,4 +112,4 @@ if [ -f "$APACHE_PID_FILE" ]; then
|
||||
rm "$APACHE_PID_FILE"
|
||||
fi
|
||||
|
||||
/usr/sbin/httpd -DFOREGROUND
|
||||
/usr/sbin/apache2 -DFOREGROUND
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
FROM centos:centos7
|
||||
FROM ubuntu:20.04
|
||||
|
||||
ENV OCS_VERSION nightly
|
||||
|
||||
@ -6,62 +6,46 @@ LABEL maintainer="contact@ocsinventory-ng.org" \
|
||||
version="${OCS_VERSION}" \
|
||||
description="OCS Inventory docker image"
|
||||
|
||||
ARG YUM_FLAGS="-y"
|
||||
ARG APT_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 \
|
||||
ENV APACHE_RUN_USER=www-data APACHE_RUN_GROUP=www-data \
|
||||
APACHE_LOG_DIR=/var/log/apache2 APACHE_PID_FILE=/var/run/apache2/apache2.pid APACHE_RUN_DIR=/var/run/apache2 APACHE_LOCK_DIR=/var/lock/apache2 \
|
||||
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
|
||||
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
VOLUME /var/lib/ocsinventory-reports /etc/ocsinventory-server /usr/share/ocsinventory-reports/ocsreports/extensions
|
||||
|
||||
RUN yum ${YUM_FLAGS} install wget \
|
||||
RUN apt-get update && apt-get install -y \
|
||||
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-Apache2-SOAP \
|
||||
perl-Archive-Zip \
|
||||
perl-Mojolicious \
|
||||
perl-Plack \
|
||||
perl-XML-Entities \
|
||||
perl-Switch \
|
||||
perl-Apache-DBI \
|
||||
httpd \
|
||||
php73-php \
|
||||
php73-php-cli \
|
||||
php73-php-ldap \
|
||||
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-zip \
|
||||
php73-php-opcache ;
|
||||
perl \
|
||||
apache2 \
|
||||
php \
|
||||
libxml-simple-perl \
|
||||
libdbi-perl \
|
||||
libdbd-mysql-perl \
|
||||
libapache-dbi-perl \
|
||||
libnet-ip-perl \
|
||||
libsoap-lite-perl \
|
||||
libarchive-zip-perl \
|
||||
libswitch-perl \
|
||||
libmojolicious-perl \
|
||||
libplack-perl \
|
||||
build-essential \
|
||||
php-pclzip \
|
||||
php-mbstring \
|
||||
php-soap \
|
||||
php-mysql \
|
||||
php-curl \
|
||||
php-xml \
|
||||
php-zip \
|
||||
php-gd
|
||||
|
||||
RUN wget http://download.ocsinventory-ng.org/nightly/latest.tar.gz -P /tmp && \
|
||||
tar xzf /tmp/latest.tar.gz -C /tmp;
|
||||
@ -71,7 +55,7 @@ RUN cd /tmp/OCSNG_UNIX_SERVER/Apache/ && \
|
||||
make && \
|
||||
make install ;
|
||||
|
||||
WORKDIR /etc/httpd/conf.d
|
||||
WORKDIR /etc/apache2/conf-available
|
||||
|
||||
# Redirect Apache2 Logs to stdout e stderr
|
||||
# https://github.com/docker-library/httpd/blob/5f92ab18146f41d1d324e99c5e197bdeda65d063/2.4/Dockerfile#L202
|
||||
@ -79,13 +63,13 @@ RUN sed -ri \
|
||||
-e 's!^(\s*CustomLog)\s+\S+!\1 /proc/self/fd/1!g' \
|
||||
-e 's!^(\s*ErrorLog)\s+\S+!\1 /proc/self/fd/2!g' \
|
||||
-e 's!^(\s*TransferLog)\s+\S+!\1 /proc/self/fd/1!g' \
|
||||
"/etc/httpd/conf/httpd.conf"
|
||||
"/etc/apache2/apache2.conf"
|
||||
|
||||
COPY conf/ /tmp/conf
|
||||
COPY ./scripts/docker-entrypoint.sh /usr/bin/docker-entrypoint.sh
|
||||
|
||||
EXPOSE 80 443
|
||||
EXPOSE 80
|
||||
|
||||
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#entrypoint
|
||||
ENTRYPOINT ["/usr/bin/docker-entrypoint.sh"]
|
||||
CMD ["/usr/sbin/httpd", "-DFOREGROUND"]
|
||||
CMD ["/usr/sbin/apache2", "-DFOREGROUND"]
|
||||
|
||||
@ -6,13 +6,12 @@ services:
|
||||
container_name : ocsinventory-server
|
||||
restart: always
|
||||
ports:
|
||||
- 80:80
|
||||
- 443:443
|
||||
- "80"
|
||||
volumes:
|
||||
- "perlcomdata:/etc/ocsinventory-server"
|
||||
- "ocsreportsdata:/usr/share/ocsinventory-reports/ocsreports"
|
||||
- "varlibdata:/var/lib/ocsinventory-reports"
|
||||
- "httpdconfdata:/etc/httpd/conf.d"
|
||||
- "httpdconfdata:/etc/apache2/conf-available"
|
||||
environment:
|
||||
OCS_DB_SERVER: ocsinventory-db
|
||||
OCS_DB_USER: ocsuser
|
||||
@ -28,11 +27,11 @@ services:
|
||||
- ocsdb
|
||||
|
||||
ocsdb :
|
||||
image : mysql:5.7
|
||||
image : mysql:8.0
|
||||
container_name : ocsinventory-db
|
||||
restart: always
|
||||
ports :
|
||||
- 3306:3306
|
||||
- "3306"
|
||||
volumes :
|
||||
- ./sql/:/docker-entrypoint-initdb.d/
|
||||
- sqldata:/var/lib/mysql
|
||||
@ -43,6 +42,36 @@ services:
|
||||
MYSQL_DATABASE : ocsweb
|
||||
networks:
|
||||
- localocs
|
||||
|
||||
ocsproxy:
|
||||
image: nginx
|
||||
container_name: ocsinventory-proxy
|
||||
restart: always
|
||||
ports:
|
||||
- 80:80
|
||||
- 443:443
|
||||
volumes:
|
||||
- ./nginx/conf:/etc/nginx/templates
|
||||
- ./nginx/certs:/etc/nginx/certs
|
||||
- ./nginx/auth:/etc/nginx/auth
|
||||
environment:
|
||||
# 80 or 443
|
||||
LISTEN_PORT: 80
|
||||
# empty or ssl
|
||||
PORT_TYPE: ""
|
||||
SSL_CERT: ocs-dummy.crt
|
||||
SSL_KEY: ocs-dummy.key
|
||||
# OCS Api user restriction (default ocsapi/ocapi)
|
||||
API_AUTH_FILE: ocsapi.htpasswd
|
||||
# OCS Download
|
||||
READ_TIMEOUT: 300
|
||||
CONNECT_TIMEOUT: 300
|
||||
SEND_TIMEOUT: 300
|
||||
MAX_BODY_SIZE: 1G
|
||||
depends_on:
|
||||
- ocsapplication
|
||||
networks:
|
||||
- localocs
|
||||
|
||||
networks:
|
||||
localocs:
|
||||
|
||||
1
nightly/nginx/auth/ocsapi.htpasswd
Normal file
1
nightly/nginx/auth/ocsapi.htpasswd
Normal file
@ -0,0 +1 @@
|
||||
ocsapi:$apr1$BcAk5f/A$0O5c/DSy92/o.vpwwshWQ.
|
||||
22
nightly/nginx/certs/ocs-dummy.crt
Normal file
22
nightly/nginx/certs/ocs-dummy.crt
Normal file
@ -0,0 +1,22 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDlzCCAn+gAwIBAgIUZq+XFJryUuBpkwebSwjSy/hfMCkwDQYJKoZIhvcNAQEL
|
||||
BQAwWzELMAkGA1UEBhMCRlIxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM
|
||||
GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEUMBIGA1UEAwwLbXlvY3NzZXJ2ZXIw
|
||||
HhcNMjIwNDEzMDk0OTUzWhcNMzIwNDEwMDk0OTUzWjBbMQswCQYDVQQGEwJGUjET
|
||||
MBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0cyBQ
|
||||
dHkgTHRkMRQwEgYDVQQDDAtteW9jc3NlcnZlcjCCASIwDQYJKoZIhvcNAQEBBQAD
|
||||
ggEPADCCAQoCggEBAOQDcGzmYzzgVycXSEZWMJ2TEtnmjouNuUKAVQUcELMkZOk0
|
||||
TIRz7QhPIOCiH2bklji+ByyVZg/uXRFJlT/P46rPor/OuRK2Lkrt+APr+FmkLgvf
|
||||
JHMfm7YRbZuWVRJq0htNNL6szwHEFE99GlRy7SuapkhKSo4qY/LjrrR7E7DnPj/G
|
||||
7o21ge3OpOfbmx9xVWbEZaJqMOZDt1y3fbp3hQsflVM0AKdg7OoHOBWnv65iJIkN
|
||||
LtG7Icqcp+8AKnL1PaiMU+P970GTMZyZ0NWVAWgab9+Wl+makTTdDdQgJIhg19og
|
||||
ReLeYspEQlzXmEz+8JAxWGqsu+HuiZ6ClSl04W0CAwEAAaNTMFEwHQYDVR0OBBYE
|
||||
FEljOkF7g17RD+pOpJ7M6dovwI9uMB8GA1UdIwQYMBaAFEljOkF7g17RD+pOpJ7M
|
||||
6dovwI9uMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAKA2Fcot
|
||||
58X97tsLWC6eJrF2MLJzcNeSiiJayG9bT8agsUE8WGq5fvHvf5E54tueCp/q+a7V
|
||||
k4ZowCJF3RAvAqzRkMLQWaGms0Brz4qRtVvRqhWkP7aMGhUieOS2rTfLZ+TYPKfK
|
||||
561w8gSpxs9uRXbhnYeUchxJxCUg0CbxQwsjltrvnOF2LVP6JJDtYcc/NiDXhP4W
|
||||
pTp+EdwXt87VSRkTrqjEQO7/3TMsNjhi0PMFHnQf47ijLt44XaNGKh9pY31Ae9oo
|
||||
6IuRygJc6QNVoGRmF2bxsorU4i4rA3kR2Ir9AUbxJT6MtuLtx8DGB8Dmp6bKmIv+
|
||||
HZH21wRRhwrYJb8=
|
||||
-----END CERTIFICATE-----
|
||||
28
nightly/nginx/certs/ocs-dummy.key
Normal file
28
nightly/nginx/certs/ocs-dummy.key
Normal file
@ -0,0 +1,28 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDkA3Bs5mM84Fcn
|
||||
F0hGVjCdkxLZ5o6LjblCgFUFHBCzJGTpNEyEc+0ITyDgoh9m5JY4vgcslWYP7l0R
|
||||
SZU/z+Oqz6K/zrkSti5K7fgD6/hZpC4L3yRzH5u2EW2bllUSatIbTTS+rM8BxBRP
|
||||
fRpUcu0rmqZISkqOKmPy4660exOw5z4/xu6NtYHtzqTn25sfcVVmxGWiajDmQ7dc
|
||||
t326d4ULH5VTNACnYOzqBzgVp7+uYiSJDS7RuyHKnKfvACpy9T2ojFPj/e9BkzGc
|
||||
mdDVlQFoGm/flpfpmpE03Q3UICSIYNfaIEXi3mLKREJc15hM/vCQMVhqrLvh7ome
|
||||
gpUpdOFtAgMBAAECggEBAM4BGXMaV/CpU7R6wY7i0jubpH2AY6tMGWQu5CGgsKnZ
|
||||
qN5VpQhKYI6QR0kM0Mg6oEqVzY+HT1X3athynciwf6ZUwFsBX467UGncRKbubEw5
|
||||
HG0XZywoE5vUdS4MDcJ9BmUqRQw8vy5+REdo5QAFcahiqfdIP8HgJLtO4Aop5Kl/
|
||||
HoLqR83q3vBHfidxTX2z4m05t6ucAbmqLAgAb2GzRHEvdCpSXvs7M9ZyR/rvdhSV
|
||||
pswWR7XIUic50Lc8tHXyaKinuBFOCWCszsirPLAVPrs1D7Gq8kmdxUEEj0V9VbEE
|
||||
8afsb9cCojrDISn814WwjX+zVwjRwyr3v3BLHVGu06ECgYEA+1VHUwBTUnHmnMR+
|
||||
6XE1nkBStedvXGsMDIxK/VhNXAylUz4kfJ0bMPKdzbxSieHwA8O1+Hg4gN31V2Sn
|
||||
RgT5P0sLGdideysoy8yR5Aiiwx+7EXGqSQltY2lpaykP9wvpznWi3k/Wd7dAaTCd
|
||||
jPCtkzoLYMDzaQ9uc4A2VyY00RkCgYEA6D9PPvV6YE8S7G7sGwTSt9mgobZNm1AV
|
||||
BjDmtEPfDSK59rT8PpoN+225c1qaIIODdH0DHK9ZbPzo/29tW1l9zgGjEXEw396v
|
||||
Q9y99Ofh0JEsQbJJw/nPdV8dHKOL2ek3UWsscpsk5dUb+4gBpE+/wH21j7UiczKt
|
||||
a8whmMFw+XUCgYAPYdHCr7NpyVTO5WvLB8W7UL5/KZH0Owz6u59fUAc0CgYYSSZc
|
||||
hhUC8uZbkBoRHEXfRRwe/+SdZng8iAmAzI8go4wjYdGJl0Og7X1EUo77mDaPw8Aj
|
||||
RjNusSXljBbRDOabXzG/n21F2G5VwcbyuEw3RYcqvcRn+qzM3tz0in8TCQKBgDe1
|
||||
N+T6LOh9DyT3VlsExSakZQtlFyhyBRj/EdebkB0ufzzWHMtHWKM+poUs7ltuMFH4
|
||||
yo5O4TxrTdg3ehu3U53edqbwZ7DLUW8Nu+LK3DeTGvKHOXpwqXqV3f3InPsgHczB
|
||||
0F+NJ0SZ4aRr8zjeiDg77xkRcboAJej9hfGGNPshAoGALPS2HtT/1ycsER3a33NW
|
||||
A8j/2TfovcjZ9u15q5KDLRZ+3UngLvVwPJO1j/uLPqyyRsQID7SE29KCj/E8kOZH
|
||||
clbLXZmslyk369HOlpXZEXvR7rDxOt1jdojQrtEyW4gDT8k4iEw8nPcJyJ7YSVp/
|
||||
Qa0OOCtQPPvBt0Be1bHTGek=
|
||||
-----END PRIVATE KEY-----
|
||||
48
nightly/nginx/conf/ocsinventory.conf.template
Normal file
48
nightly/nginx/conf/ocsinventory.conf.template
Normal file
@ -0,0 +1,48 @@
|
||||
##
|
||||
# You should look at the following URL's in order to grasp a solid understanding
|
||||
# of Nginx configuration files in order to fully unleash the power of Nginx.
|
||||
# https://www.nginx.com/resources/wiki/start/
|
||||
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
|
||||
# https://wiki.debian.org/Nginx/DirectoryStructure
|
||||
#
|
||||
# In most cases, administrators will remove this file from sites-enabled/ and
|
||||
# leave it as reference inside of sites-available where it will continue to be
|
||||
# updated by the nginx packaging team.
|
||||
#
|
||||
# This file will automatically load configuration files provided by other
|
||||
# applications, such as Drupal or Wordpress. These applications will be made
|
||||
# available underneath a path with that package name, such as /drupal8.
|
||||
#
|
||||
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
|
||||
##
|
||||
|
||||
# OCS server configuration
|
||||
#
|
||||
server {
|
||||
listen ${LISTEN_PORT} ${PORT_TYPE} default_server;
|
||||
|
||||
ssl_certificate /etc/nginx/certs/${SSL_CERT};
|
||||
ssl_certificate_key /etc/nginx/certs/${SSL_KEY};
|
||||
|
||||
location / {
|
||||
proxy_redirect off;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Frame-Options SAMEORIGIN;
|
||||
proxy_pass http://ocsapplication;
|
||||
}
|
||||
|
||||
location /ocsapi {
|
||||
auth_basic "OCS Api area";
|
||||
auth_basic_user_file /etc/nginx/auth/${API_AUTH_FILE};
|
||||
}
|
||||
|
||||
location /download {
|
||||
proxy_read_timeout ${READ_TIMEOUT};
|
||||
proxy_connect_timeout ${CONNECT_TIMEOUT};
|
||||
proxy_send_timeout ${SEND_TIMEOUT};
|
||||
client_max_body_size ${MAX_BODY_SIZE};
|
||||
}
|
||||
}
|
||||
@ -1,10 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
API_CONF_FILE="/etc/httpd/conf.d/zz-ocsinventory-restapi.conf"
|
||||
SRV_CONF_FILE="/etc/httpd/conf.d/z-ocsinventory-server.conf"
|
||||
REPORTS_CONF_FILE="/etc/httpd/conf.d/ocsinventory-reports.conf"
|
||||
API_CONF_FILE="/etc/apache2/conf-available/zz-ocsinventory-restapi.conf"
|
||||
SRV_CONF_FILE="/etc/apache2/conf-available/z-ocsinventory-server.conf"
|
||||
REPORTS_CONF_FILE="/etc/apache2/conf-available/ocsinventory-reports.conf"
|
||||
DB_CONFIG_INC_FILE="${OCS_WEBCONSOLE_DIR}/ocsreports/dbconfig.inc.php"
|
||||
|
||||
API_ROUTE=$(perl -e "print \"@INC[2]\"")
|
||||
API_ROUTE_LOADER="${API_ROUTE}/Api/Ocsinventory/Restapi/Loader.pm"
|
||||
|
||||
echo
|
||||
echo "+----------------------------------------------------------+"
|
||||
echo "| |"
|
||||
@ -28,7 +31,7 @@ if [ ! -f $OCS_WEBCONSOLE_DIR/ocsreports/var.php ]; then
|
||||
rm -rf ${DB_CONFIG_INC_FILE}
|
||||
fi;
|
||||
|
||||
cp -r /tmp/OCSNG_UNIX_SERVER/Api/ /usr/local/share/perl5
|
||||
cp -R /tmp/OCSNG_UNIX_SERVER/Api/ ${API_ROUTE}
|
||||
|
||||
if [ ! -z ${OCS_DISABLE_API_MODE+x} ]; then
|
||||
echo
|
||||
@ -64,7 +67,7 @@ echo "| Setting Apache Server Name to '${APACHE_SERVER_NAME:-localhost}'"
|
||||
echo "+----------------------------------------------------------+"
|
||||
echo
|
||||
sed -ri -e "s!^#(ServerName)\s+\S+!\1 ${APACHE_SERVER_NAME:-localhost}:80!g" \
|
||||
"/etc/httpd/conf/httpd.conf"
|
||||
"/etc/apache2/apache2.conf"
|
||||
|
||||
# Configure z-ocsinventory-server file
|
||||
if [ ! -f ${SRV_CONF_FILE} ] && [ -z ${OCS_DISABLE_COM_MODE+x} ]; then
|
||||
@ -81,16 +84,16 @@ if [ ! -f ${SRV_CONF_FILE} ] && [ -z ${OCS_DISABLE_COM_MODE+x} ]; then
|
||||
fi
|
||||
|
||||
# Configure zz-ocsinventory-restapi file
|
||||
if [ ! -f ${API_CONF_FILE} ] && [ -z ${OCS_DISABLE_API_MODE+x} ]; then
|
||||
cp /tmp/conf/ocsinventory-restapi.conf ${API_CONF_FILE}
|
||||
sed -i 's/DATABASE_SERVER/'"$OCS_DB_SERVER"'/g' ${API_CONF_FILE}
|
||||
sed -i 's/DATABASE_PORT/'"$OCS_DB_PORT"'/g' ${API_CONF_FILE}
|
||||
sed -i 's/DATABASE_NAME/'"$OCS_DB_NAME"'/g' ${API_CONF_FILE}
|
||||
sed -i 's/DATABASE_USER/'"$OCS_DB_USER"'/g' ${API_CONF_FILE}
|
||||
sed -i 's/DATABASE_PASSWD/'"$OCS_DB_PASS"'/g' ${API_CONF_FILE}
|
||||
sed -i 's/OCS_SSL_ENABLED/'"$OCS_SSL_ENABLED"'/g' ${API_CONF_FILE}
|
||||
sed -i 's/REST_API_PATH/\/usr\/local\/share\/perl5/g' ${API_CONF_FILE}
|
||||
sed -i 's/REST_API_LOADER_PATH/\/usr\/local\/share\/perl5\/Api\/Ocsinventory\/Restapi\/Loader.pm/g' ${API_CONF_FILE}
|
||||
if [ ! -f ${API_CONF_FILE} ] && [ -z ${OCS_DISABLE_API_MODE+x} ] && [ -z ${OCS_DISABLE_COM_MODE+x} ]; then
|
||||
cp /tmp/conf/ocsinventory-restapi.conf ${API_CONF_FILE}
|
||||
sed -i 's/DATABASE_SERVER/'"$OCS_DB_SERVER"'/g' ${API_CONF_FILE}
|
||||
sed -i 's/DATABASE_PORT/'"$OCS_DB_PORT"'/g' ${API_CONF_FILE}
|
||||
sed -i 's/DATABASE_NAME/'"$OCS_DB_NAME"'/g' ${API_CONF_FILE}
|
||||
sed -i 's/DATABASE_USER/'"$OCS_DB_USER"'/g' ${API_CONF_FILE}
|
||||
sed -i 's/DATABASE_PASSWD/'"$OCS_DB_PASS"'/g' ${API_CONF_FILE}
|
||||
sed -i 's/OCS_SSL_ENABLED/'"$OCS_SSL_ENABLED"'/g' ${API_CONF_FILE}
|
||||
sed -i 's/REST_API_PATH/'"${API_ROUTE//\//\\/}"'/g' ${API_CONF_FILE}
|
||||
sed -i 's/REST_API_LOADER_PATH/'"${API_ROUTE_LOADER//\//\\/}"'/g' ${API_CONF_FILE}
|
||||
fi
|
||||
|
||||
# Replace Variables
|
||||
@ -156,6 +159,11 @@ cd /tmp
|
||||
shopt -s extglob
|
||||
rm -rf !("conf")
|
||||
|
||||
# Enable conf
|
||||
a2enconf ocsinventory-reports
|
||||
a2enconf z-ocsinventory-server
|
||||
a2enconf zz-ocsinventory-restapi
|
||||
|
||||
# Apache start
|
||||
if [ ! -d "$APACHE_RUN_DIR" ]; then
|
||||
mkdir "$APACHE_RUN_DIR"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user