Compare commits

...

182 Commits
2.3 ... master

Author SHA1 Message Date
Gilles Dubois
2f4609fe7d
Merge pull request #128 from OCSInventory-NG/update-ubuntu-image
Update ubuntu jammy to ubuntu noble
2025-08-18 14:52:58 +02:00
Gilles Dubois
34d5887bca
Merge pull request #125 from OCSInventory-NG/auth-type
Add authtype configuration
2025-08-18 14:52:30 +02:00
Charlene Auger
993d2ba609 refactor(dockerfile): update ubuntu jammy to ubuntu noble 2025-08-11 16:00:54 +02:00
Charlene Auger
5f26c756c4 feat(docker): add authtype configuration 2025-03-12 14:45:33 +01:00
Léa
653cd01eaf
Merge pull request #123 from Y0plait/patch-1
Update 10-com-server.sh
2024-10-30 11:39:23 +01:00
Y0plait
8638ad8a1f
Update 10-com-server.sh
Add quick and dirty fix for https://github.com/OCSInventory-NG/OCSInventory-Docker-Stack/issues/16
Add a sed replacement
2024-10-24 20:08:13 +02:00
Charlène Auger
a4d2b62bd1
Merge pull request #120 from OCSInventory-NG/update-2.12.3
chore: add 2.12.3 version
2024-09-23 09:17:24 +02:00
Lea9250
db6cc3011c
chore: add 2.12.3 version 2024-09-19 15:15:54 +02:00
Lea9250
8ae06ac86f
Merge pull request #117 from OCSInventory-NG/v2.12.2
Add 2.12.2 docker folder
2024-07-11 14:43:57 +02:00
Charlene Auger
efdf762a58 Fix copy command for conf files 2024-07-05 09:21:40 +02:00
Charlene Auger
73c103f062 Update symlink for latest folder 2024-07-05 09:18:33 +02:00
Charlene Auger
4219abd5ea Add 2.12.2 docker folder 2024-07-05 09:16:05 +02:00
Charlène Auger
3ebd025290
Merge pull request #111 from OCSInventory-NG/root_redirect
refactor(nginx): redirect to ocsreports
2023-12-18 14:06:17 +01:00
Charlene Auger
dc835e424a Apply nginx rewrite on nightly 2023-12-18 14:04:48 +01:00
Charlène Auger
3c5895bb43
Merge pull request #108 from wiltonsr/fix-profiles-bug
Fix custom profiles missing
2023-12-18 11:40:05 +01:00
Lea9250
509af7b598
refactor(nginx): redirect to ocsreports 2023-12-05 17:48:04 +01:00
Wilton Rodrigues
fb10415fbb Fix custom profiles missing
- Add volume to persist custom profiles
- Fixes #105
2023-10-27 09:51:19 -03:00
Lea9250
f4334c8a58
Merge pull request #106 from OCSInventory-NG/update-2.12.1
[IN DEVELOPMENT] Add OCS version 2.12.1
2023-10-04 11:59:48 +02:00
Lea9250
1cd4698c3e update latest 2023-10-04 11:29:23 +02:00
Charlene Auger
88a7710929 Add OCS version 2.12.1 2023-09-26 15:44:10 +02:00
Gilles Dubois
99287c72dd
Merge pull request #102 from OCSInventory-NG/update-2.12
Update 2.12
2023-07-12 14:25:59 +02:00
Charlene Auger
ed9a72c8a7 Update symbolic link 2023-07-12 14:15:35 +02:00
Charlene Auger
521ec4f17f Add 2.12 docker version 2023-07-12 14:15:25 +02:00
Gilles Dubois
655da1a5c5
Merge pull request #94 from OCSInventory-NG/docker_update
Docker update
2022-11-14 15:14:24 +01:00
Léa
2bf5ece0b1 add proxy_pass to nginx conf 2022-11-14 13:11:53 +00:00
Léa
c44eb4d253 update latest link to 2.11 2022-11-14 13:10:27 +00:00
Gilles Dubois
00306e60e2
Merge pull request #91 from OCSInventory-NG/updat2.11
Add 2.11
2022-10-17 11:27:46 +02:00
Charlene Auger
fd4888a6f6 Add 2.11 folder 2022-10-17 11:24:19 +02:00
Gilles Dubois
fe5effb3c6
Merge pull request #90 from OCSInventory-NG/update2.10
Add 2.10 and update dev and nightly with @wiltonsr modifications
2022-06-28 17:06:30 +02:00
Charlene Auger
441b26a8e6 Update nightly with @wiltonsr modifications 2022-06-28 14:26:45 +02:00
Charlene Auger
5cda3b80b6 Update dev to 2.10 and add @wiltonsr modifications 2022-06-28 14:26:01 +02:00
Charlene Auger
000e103e91 Add 2.10 server version 2022-06-28 10:04:49 +02:00
Charlène Auger
e4dc443b80
Merge pull request #86 from OCSInventory-NG/updatedevandnightly
Update dev and nightly with @wiltonsr contributions
2022-06-24 16:29:11 +02:00
Charlène Auger
7ee977e851
Merge pull request #87 from wiltonsr/refactoring-script-startup
Refactoring entrypoint scripts
2022-06-22 10:55:22 +02:00
Wilton Rodrigues
4d9bc72369 Refactoring entrypoint scripts
- Break large entrypoint script in small scripts
- Separates the responsibility of the contexts (api, communication and reports) in specific files
- Make it easy for users to add custom scripts across volumes in /docker-entrypoint.d directory
2022-05-03 14:52:16 -03:00
Charlène Auger
43b2f79bbd Update dev and nightly with @wiltonsr contributions 2022-05-03 14:39:04 +02:00
Charlène Auger
2b6013841c
Merge pull request #84 from wiltonsr/patch-3
Update Dockerfile
2022-05-03 14:34:10 +02:00
Charlène Auger
f9b975a3d1
Merge pull request #85 from wiltonsr/patch-5
Fix Apache Log Redirection
2022-05-03 14:34:01 +02:00
Wilton Rodrigues
4b4c27c8f2
Fix Apache Log Redirection
Adapt Apache's Logs redirection to work on Ubuntu base Image
2022-04-27 10:21:47 -03:00
Wilton Rodrigues
e5c34fa976
Update Dockerfile
Add missing lib php-ldap
2022-04-26 16:39:14 -03:00
Gilles Dubois
9407b4c2f3
Merge pull request #78 from OCSInventory-NG/update
Add 2.9.2 and update to ubuntu 20.04 + MySQL 8
2022-04-19 14:04:57 +02:00
Charlène Auger
3fcff42cd4 Update nightly 2022-04-19 11:38:23 +02:00
Charlène Auger
771d940567 Merge branch 'update' of https://github.com/OCSInventory-NG/OCSInventory-Docker-Image into update 2022-04-19 11:21:07 +02:00
Charlène Auger
62d0a66939 Update dev 2022-04-19 11:20:53 +02:00
Gilles Dubois
310b10675c Change syn link to 2.9.2 image 2022-04-15 17:41:38 +02:00
Charlène Auger
1e61e99ba5 Add nginx container 2022-04-13 17:39:17 +02:00
Charlène Auger
b28c17f21e Remove API ssl in ocsapplication container 2022-04-13 09:33:21 +02:00
Charlène Auger
255d7a5d39 Add API restrictions 2022-04-12 16:43:39 +02:00
Charlène Auger
44f23d6cff Fix API access 2022-04-12 15:12:56 +02:00
Charlène Auger
60d2add227 Remove CPAN call end XML::Entities and add API lib 2022-04-12 14:31:17 +02:00
Charlène Auger
071ea13ffe Fix typo 2022-01-12 09:56:34 +01:00
Charlène Auger
2f925f2c16 Add Switch lib 2022-01-12 09:56:25 +01:00
Charlène Auger
167c4ef252 Replace httpd by apache2 2022-01-12 09:45:19 +01:00
Charlène Auger
b9888f89cb Fix build 2022-01-11 15:23:52 +01:00
Charlène Auger
515107f1a7 Add 2.9.2 with ubuntu 2022-01-11 14:11:18 +01:00
Charlène Auger
0b60593438
Merge pull request #76 from OCSInventory-NG/nightlyImprovement
Standardize nightly with 2.9 docker file
2021-12-03 14:08:07 +01:00
Gilles Dubois
d953d5afa8 Standardize nightly with 2.9 docker file 2021-12-03 11:45:53 +01:00
Charlène Auger
497d6246dc
Merge pull request #74 from OCSInventory-NG/minorImprovments
Minor improvments
2021-12-02 17:32:35 +01:00
Gilles Dubois
9a070943c4 Fix replace mistake 2021-12-02 17:18:53 +01:00
Gilles Dubois
06b5c207b5 Use ocs version variable / fix typo 2021-12-02 17:12:08 +01:00
Gilles Dubois
4410cc9983 Remove broken links 2021-12-02 16:58:03 +01:00
Gilles Dubois
cac9a0d5d3 Add configurable API / Use variable avoid repetition 2021-12-02 16:56:36 +01:00
Gilles Dubois
94c9201764
Merge pull request #71 from wiltonsr/dockerfile-best-practices
Dockerfile best practices
2021-12-02 16:51:09 +01:00
Gilles Dubois
4e63073cc4
Merge branch 'master' into dockerfile-best-practices 2021-12-02 16:35:40 +01:00
Gilles Dubois
a12eb2d284
Merge pull request #70 from wiltonsr/minors-fixings
Minors fixings
2021-12-02 16:34:00 +01:00
Gilles Dubois
fea8eeec4c
Merge pull request #73 from cgregoirovh/dev/cgregoir/ISSUE-72
implemented api feature on docker image for latest version, nightly a…
2021-12-02 16:08:28 +01:00
Charly Gregoire
d1bec1d31d implemented api feature on docker image for latest version, nightly and dev 2021-11-08 16:30:00 +00:00
Wilton Rodrigues
a2140c7ab4 Setting Apache Server Name
- This prevents the warning 'Could not reliably determine the server's fully qualified domain name'
- Config Apache Server Name with APACHE_SERVER_NAME env var or
  'localhost'
2021-10-30 12:28:53 -03:00
Wilton Rodrigues
d6a2d58b3c Adding IPDISCOVER_LINK_TAG_NETWORK missing config
- This prevents the warning 'Bad setting. `IPDISCOVER_LINK_TAG_NETWORK` is not set.' on logs
2021-10-30 11:58:02 -03:00
Wilton Rodrigues
769e4cc2fb Changing perl SOAP module
- This prevents the error 'Can't load SOAP::Transport::HTTP* - Web service will be unavailable'
2021-10-30 11:48:09 -03:00
Wilton Rodrigues
a1c948f57f Improving the Dockerfile
- Configure Apache2 to output Logs to stdout and stderr
- Based on 5f92ab1814/2.4/Dockerfile (L202)
- Remove unecessary layers to WORKDIR and using directory params
2021-10-30 11:34:46 -03:00
Wilton Rodrigues
5ed05a5946 Changing how container starts
- Using best practices from https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#entrypoint
- This way, the apache proccess will be PID 1
- It can simply start Apache2
- Or run Apache2 and pass parameters to the Server
2021-10-30 11:16:18 -03:00
Wilton Rodrigues
28537752ce Minors Fixings
- Removing wrong parameter for sed
- Using OCS_VERSION in docker-entrypoint.sh
2021-10-29 14:59:17 -03:00
Wilton Rodrigues
90ae7d238a Replacing repetition of config files 2021-10-29 11:21:26 -03:00
Gilles Dubois
0acb4d800e
Merge pull request #67 from wiltonsr/add-some-improvements
Add some improvements
2021-10-28 18:03:21 +02:00
Gilles Dubois
87ac393dac
Merge pull request #66 from wiltonsr/dry-ocs-version
Adding Don't repeat yourself (DRY) to OCS Version on Dockerfile
2021-10-28 18:00:18 +02:00
Wilton Rodrigues
b0adeb01d5 Control if container will run Communication, WebServer or both
- If OCS_DISABLE_COM_MODE environment variable is set, Communication server will be disabled
- If OCS_DISABLE_WEB_MODE environment variable is set, Administration server will be disabled
- Add Some logs to entrypoint.sh based on setup.sh
2021-10-26 15:54:10 -03:00
Wilton Rodrigues
ab0da4cdb0 Add OCS_ options to /etc/httpd/conf.d/z-ocsinventory-server.conf
- All environment variables starting with OCS_ and match valid options
will be added to Communication Server conf file
- Available valid options https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-a-OCS-Inventory-Server/
2021-10-26 13:41:39 -03:00
Wilton Rodrigues
152abe7d63 Adding Don't repeat yourself (DRY) to OCS Version on Dockerfile 2021-10-22 11:52:23 -03:00
Gilles Dubois
1ad8ae3f19
Merge pull request #62 from balmha/patch-1
Update Dockerfile
2021-08-23 08:22:19 +02:00
balmha
b329d1ebf0
Update Dockerfile
add php73-php-ldap and php73-php-zip
2021-07-19 16:38:41 -03:00
Charlène Auger
677bf97883
Merge pull request #60 from OCSInventory-NG/fix29volumes
Fix 2.9 volume mgmt
2021-07-05 16:13:53 +02:00
Gilles Dubois
7a3e7e91af Fix 2.9 volume mgmt 2021-06-29 16:33:22 +02:00
Gilles Dubois
3c6b0bef87
Add zip dep on 2.9 tag 2021-06-08 14:44:45 +02:00
Lea9250
ca02e0fa84
Merge pull request #55 from OCSInventory-NG/add-29
Add 29
2021-05-19 10:45:47 +02:00
Gilles Dubois
0170648359 Add ldap module in 2.9 image close #54 2021-05-19 10:41:02 +02:00
Gilles Dubois
a0e83cce70 Update symlink 2021-05-19 10:36:48 +02:00
Gilles Dubois
22bdb320b6 Add 2.9 version 2021-05-19 10:36:35 +02:00
Charlène Auger
65268e7580
Merge pull request #51 from OCSInventory-NG/add-281-version
Add 281 version
2020-12-15 16:16:50 +01:00
Gilles DUBOIS
a3cb44c6fe Update latest symlink 2020-12-15 14:37:56 +00:00
Gilles DUBOIS
b5eba01036 Add 2.8.1 version 2020-12-15 14:37:42 +00:00
Gilles DUBOIS
0efaa0b815 Execution permissions 2020-09-11 14:52:13 +00:00
Charlène Auger
3be8295146
Merge pull request #49 from OCSInventory-NG/2.8-release
Remove 2.3.1 version / add 2.8
2020-09-11 14:12:34 +02:00
Gilles Dubois
6e87843062 Remove 2.3.1 version / add 2.8 2020-09-11 11:48:33 +02:00
Gilles Dubois
8e78123b6d
Merge pull request #47 from OCSInventory-NG/minor-fix
Minor fix
2020-08-20 17:06:42 +02:00
Gilles Dubois
e7a1cad6f1 Update config with master 2020-08-20 16:48:47 +02:00
Gilles Dubois
60405d4ddd Remove bad symlink 2020-08-20 16:48:28 +02:00
Gilles Dubois
8437a3c585
Merge pull request #45 from OCSInventory-NG/fix-41
Fix 41
2020-08-19 13:59:59 +02:00
Gilles Dubois
da4cc9dd3c Rework 2.7 2020-08-19 12:25:03 +02:00
Gilles Dubois
3a428ac7bf Rework nightly 2020-08-19 12:24:55 +02:00
Gilles Dubois
2a41f678d9 Fix permissions on 2.7 image 2020-06-27 18:06:41 +02:00
Charlène Auger
f377df4cec
Merge pull request #34 from OCSInventory-NG/update-to-27
Update to 27
2020-03-20 10:32:03 +01:00
Gilles Dubois
04bdfbeacb Update docker compose and docker file tag 2020-03-17 17:48:58 +01:00
Gilles Dubois
c66316fae0 Add 2.7 version as docker image 2020-03-17 17:47:31 +01:00
Gilles Dubois
60cad7f1d6 Add 2.7 folder 2020-03-17 17:47:18 +01:00
Gilles Dubois
dfc4167d79
Merge pull request #33 from OCSInventory-NG/add-srv-port-mgmt
Add srv port mgmt
2020-03-17 17:36:24 +01:00
Gilles Dubois
38214119c1 Add SQL Port management for webconsole 2020-03-17 16:50:33 +01:00
Gilles Dubois
bb3fd09920 Add SQL Port management for webconsole 2020-03-17 16:50:26 +01:00
Charlène Auger
7779fcfe5f
Merge pull request #31 from OCSInventory-NG/nightly-dockerfile-update
Remove *
2020-03-09 10:53:52 +01:00
Gilles Dubois
f33993812c Remove * 2020-03-09 10:51:57 +01:00
Charlène Auger
9e4a8ecef7
Merge pull request #30 from OCSInventory-NG/Remove-2.3
Remove now unsupported 2.3 verison
2020-03-09 10:43:24 +01:00
Gilles Dubois
2a0848221c Remove now unsupported 2.3 verison 2020-03-09 08:55:31 +01:00
Charlène Auger
f924b69d26
Merge pull request #29 from OCSInventory-NG/no-remove-dev
No tmp files removal
2020-03-05 16:01:09 +01:00
Gilles Dubois
de24ee9964 No tmp files removal 2020-03-05 15:59:30 +01:00
Charlène Auger
311c31c470
Merge pull request #28 from OCSInventory-NG/fix-nightly
Fix nightly
2020-03-05 15:47:10 +01:00
Gilles Dubois
80705c67a6 Fix nightly 2020-03-05 15:44:28 +01:00
Gilles Dubois
d0b2dbefe0
Merge pull request #26 from alexandreChichmanian/master
Fix issue #25 missing files at container restart
2020-02-21 11:05:32 +01:00
alexandre
81fd20c8f5 Fix issue missing files at container restart 2020-02-19 18:25:50 -05:00
Gilles Dubois
1a227c3df7
Merge pull request #23 from OCSInventory-NG/rework
Rework
2020-01-08 16:13:22 +01:00
Gilles Dubois
b2ec9d2ef3 Update entry point 2020-01-08 15:09:36 +01:00
Gilles Dubois
b913a6545c Add dev variables in docker compose example 2020-01-08 15:03:52 +01:00
Gilles Dubois
386dfcbe72 Add default value for MySQL SSL to prevent crash 2020-01-08 15:03:26 +01:00
Gilles Dubois
efef9c9edf Add repo configuration for developpment 2020-01-08 15:03:07 +01:00
Gilles Dubois
9efa567305 Fix entrypoint 2020-01-08 14:10:13 +01:00
Gilles Dubois
2822d858da Update readme link and documentationg 2020-01-08 12:03:53 +01:00
Gilles Dubois
174c568d31 Update nightly and dev compose file 2020-01-08 11:28:12 +01:00
Gilles Dubois
489f715b22 Update entry point for nightly 2020-01-08 11:09:53 +01:00
Gilles Dubois
a3329bea58 Add SSL Configuration for Nightly 2020-01-08 11:09:34 +01:00
Gilles Dubois
8bc2369925 Add ENV vars for MySQL SSL configuration 2020-01-08 11:07:00 +01:00
Gilles Dubois
91d7235ab2 Set debug mode by default for dev tag 2020-01-08 11:06:15 +01:00
Gilles Dubois
5a2ebbc2a1 Add new configuration informations for mysql ssl 2020-01-07 17:27:49 +01:00
Gilles Dubois
b614812250 Remove install script removal 2020-01-06 17:31:55 +01:00
Gilles Dubois
1e26aefeb9 Add dev mode 2020-01-06 16:40:28 +01:00
Gilles Dubois
3dd2e07bf8 Update dbconfig with variables 2020-01-06 15:09:55 +01:00
Gilles Dubois
14f6a2361c Update dbconfig with variables 2020-01-06 14:45:01 +01:00
Gilles Dubois
c3b9e63bde Move docker compose 2020-01-06 12:34:06 +01:00
Gilles Dubois
706fee081b Move docker compose 2020-01-06 12:32:35 +01:00
Gilles Dubois
5e654de9aa Fix nightly 2020-01-06 12:22:27 +01:00
Gilles Dubois
fde830b6fc Structure / refactor and fix minor bug 2020-01-03 12:50:32 +01:00
Gilles Dubois
67364dcace Edit symlink 2019-12-30 17:21:02 +01:00
Gilles Dubois
912638c2ad Add 2.6and nightly builds 2019-12-30 17:20:53 +01:00
Valentin Deville
f25b502f10
Merge pull request #20 from codeurimpulsif/fix-log-permissions
Fix ocsinventory log directory permissions
2019-08-07 22:45:39 +02:00
codeurimpulsif
421267bb45 Fix ocsinventory log directory permissions 2019-08-07 16:56:52 +02:00
Valentin Deville
cc59facefb
Merge pull request #17 from gid9798/TEST
Add timzone and DB port
2019-06-25 16:01:42 +02:00
gid9798
a106894b81 readme and docker 2019-06-25 15:40:00 +03:00
gid9798
a8f63ce539 dockerfile 2019-06-25 15:17:25 +03:00
gid9798
7c56d94dd4 dockerfile 2019-06-25 15:00:34 +03:00
gid9798
371b2d2324 change readme and dockerfile 2019-06-25 14:22:17 +03:00
gid9798
5784422f40 add port an timezone 2019-06-25 03:34:07 +03:00
Valentin Deville
a6e3e350de
Merge pull request #11 from chadyred/patch-3
Allow zip for list plugin availbale
2018-12-01 23:46:45 +01:00
Florian C
536815e046
Allow zip for list plugin availbale
See issue #10
2018-11-29 14:33:56 +01:00
Valentin Deville
101ffe3e4a
Change bash text instructions 2018-10-19 09:42:19 +02:00
Valentin Deville
f07d2eba4b
Merge pull request #7 from chadyred/patch-1
Replace quoted text by source code element
2018-10-19 09:39:40 +02:00
Valentin Deville
f735f712f6
Merge pull request #8 from chadyred/patch-2
Little fix
2018-10-17 19:24:31 +02:00
Florian C
119a8f6149
Little fix
* replace master version of image docker with latest instead of master
* remove interpretation of result at the end of script.
2018-10-17 09:49:39 -04:00
Florian C
19024afa2c
Replace quoted text by source code element
Better for copy paste to have all backslash for bash.
2018-10-17 08:42:32 -04:00
Valentin Deville
af73341239
Merge pull request #6 from zerossB/master
Add OCS 2.5
2018-10-08 13:31:42 +02:00
Valentin Deville
2ec65e1e4c
Change permissions on dbconfig.inc.php 2018-10-08 13:29:25 +02:00
Hayness
f51e148c81 Add OCS 2.5 2018-10-02 07:22:27 -03:00
Gilles Dubois
7cfc8edd4a Add pull request template 2017-08-12 15:25:03 +02:00
Gilles Dubois
3b7c8f4195 Add contributing md 2017-08-12 15:24:56 +02:00
Valentin Deville
9ce9622514
Remove APT list 2017-03-18 13:49:16 +01:00
Valentin Deville
b1dac3938c
Reduce image size 2017-03-15 17:44:17 +01:00
Valentin Deville
f6e4425ee8
Fix write problem 2017-03-15 16:48:14 +01:00
Valentin Deville
be71b0d3a9
Move latest to symlink with lastest version 2017-03-15 16:38:48 +01:00
Valentin Deville
500cce0add
Update latest 2017-03-15 16:15:23 +01:00
Valentin Deville
297bfe1e5d
Add 2.3.1 2017-03-15 16:13:00 +01:00
Valentin Deville
1b62642373
Update download script 2017-03-15 16:11:15 +01:00
Lepetit Paul
f3904f1c3a Fix Webservice 2017-03-07 17:25:26 +01:00
Lepetit Paul
3add7f78bb Add inventory on startup feature 2017-03-07 16:57:38 +01:00
Lepetit Paul
ab21ebe5cf Add inventory on startup feature 2017-03-07 16:56:35 +01:00
Lepetit Paul
e0861b070a Update README.md 2017-03-01 15:01:08 +01:00
Lepetit Paul
51ce651116 Update README.md 2017-02-22 16:59:30 +01:00
paullepetit
e21199335a Update structure Docker 2017-02-22 16:01:04 +01:00
Damien Belliard
14868a6938 Update README.md 2017-02-22 15:27:02 +01:00
Damien Belliard
a16e9430af Update README.md 2017-02-22 15:26:04 +01:00
Lepetit Paul
433aeed2c4 Update README.md 2017-02-22 14:36:56 +01:00
Lepetit Paul
613779ac9a Update Dockerfile 2017-02-22 12:56:46 +01:00
Lepetit Paul
2a50f720a8 Update README.md 2017-02-22 11:59:54 +01:00
Lepetit Paul
66d81eb1d3 Update README.md 2017-02-22 11:58:00 +01:00
Lepetit Paul
f512854e32 Update Dockerfile 2.3 2017-02-22 11:54:41 +01:00
Gilles Dubois
17ff75604c Add tag management for docker hub 2017-02-22 11:31:20 +01:00
202 changed files with 51024 additions and 277 deletions

120
.github/Contributing.md vendored Normal file
View File

@ -0,0 +1,120 @@
<p align="center">
<img src="https://cdn.ocsinventory-ng.org/common/banners/banner660px.png" height=300 width=660 alt="Banner">
</p>
<h1 align="center">OCS Inventory</h1>
<p align="center">
<b>Some Links:</b><br>
<a href="http://ask.ocsinventory-ng.org">Ask question</a> |
<a href="#COMMING_SOON_STAY_CONNECTED">Installation</a> |
<a href="https://www.ocsinventory-ng.org/?utm_source=github-ocs">Website</a>
</p>
# OCS Inventory Contributing Guidelines
## Pull Request Process
1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Add your changes: `git add folder/file1.php`
4. Commit your changes: `git commit -m 'Add some feature'`
5. Push to the branch: `git push origin my-new-feature`
6. Submit a pull request !
## Pull Request Informations
When contributing, please open an issue before or contact the team using mail. This will prevent all the duplicate of work.
Also, check if your contribution is not already in the roadmap or affiliated to an issue.
If you are contributing on a small scale (translation, a few line modification), you don't need open an issue or contact the team but you will need to explain what you've done in the Pull Request comment and provide as accurate commit messages as possible.
Cf. Commits Messages Name Informations
If you need to discuss about a big change or need some help of our team during the development of your contribution,
we can use other communication method like Telegram, IRC, Skype.
## Commits Messages Name Informations
Try to create as accurate as possible commit messages.
This will help us to speed up the review process and to reduce the misunderstanding (which can lead to a Pull Request to be rejected)
There is no commit messages convention but here are some examples :
1. Create as short as possible commit name
2. One commit for one modification
3. Always leave the second commit line blank
If it seems difficult to summarize what your commit does, it may be because it includes several logical changes or bug fixes, and are better split up into several commits using `git add -p`.
## Code of Conduct
### Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.
### Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
### Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
### Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
### Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at `contact@ocsinventory-ng.org` . All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
### Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/

40
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,40 @@
## Must read before submitting
Please, take a look to our contributing guidelines before submitting your pull request.
There's some simple rules that will help us to speed up the review process and avoid any misunderstanding
[Contributors GuideLines](https://github.com/OCSInventory-NG/OCSInventory-ocsreports/blob/master/.github/Contributing.md)
## Status
**READY/IN DEVELOPMENT/HOLD**
## Description
A few sentences describing the overall goals of the pull request's commits.
## Related Issues
Put here all the related issues link
## Todos
- [ ] Tests
- [ ] Documentation
## Test environment
If some tests has been already made, please give us your test environment' specs
#### General informations
Docker host's operating system :
Mysql Server version :
#### Docker informations
Docker compose version :
Docker version :
## Deploy Notes
Notes regarding deployment the contained body of work. These should note any dependencies changes,
logical changes, etc.
1.
## Impacted Areas in Application
List general components of the application that this PR will affect:
*

74
2.10/Dockerfile Normal file
View File

@ -0,0 +1,74 @@
FROM ubuntu:22.04
ENV OCS_VERSION 2.10.0
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 \
php-ldap
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
RUN ln -sf /proc/self/fd/1 /var/log/apache2/access.log && \
ln -sf /proc/self/fd/2 /var/log/apache2/error.log
COPY conf/ /tmp/conf
COPY ./docker-entrypoint.sh /docker-entrypoint.sh
COPY ./docker-entrypoint.d /docker-entrypoint.d
EXPOSE 80
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#entrypoint
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["/usr/sbin/apache2", "-DFOREGROUND"]

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

@ -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

View 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>

View 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.10/docker-compose.yml Normal file
View File

@ -0,0 +1,85 @@
version: '3'
services:
ocsapplication:
image: ocsinventory/ocsinventory-docker-image:2.10
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:

View File

@ -0,0 +1,17 @@
#!/bin/bash
echo "+----------------------------------------------------------+"
echo "| |"
echo "| Welcome to OCS Inventory NG Management Docker! |"
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

View File

@ -0,0 +1,48 @@
#!/bin/bash
SRV_CONF_FILE="/etc/apache2/conf-available/z-ocsinventory-server.conf"
if [ ! -z "${OCS_DISABLE_COM_MODE}" ]; then
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 "+---------------------------------------------------------------------------+"
exit 0
fi
# Configure z-ocsinventory-server file
if [ ! -f ${SRV_CONF_FILE} ]; 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
# Replace Variables
if [ -f ${SRV_CONF_FILE} ]; 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
# Permissions
chown -R $APACHE_RUN_USER: $OCS_LOG_DIR
# Enable conf
a2enconf z-ocsinventory-server

View File

@ -0,0 +1,57 @@
#!/bin/bash
REPORTS_CONF_FILE="/etc/apache2/conf-available/ocsinventory-reports.conf"
DB_CONFIG_INC_FILE="${OCS_WEBCONSOLE_DIR}/ocsreports/dbconfig.inc.php"
if [ ! -z "${OCS_DISABLE_WEB_MODE}" ]; then
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 "+---------------------------------------------------------------------------+"
exit 0
fi
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
# Configure ocsinventory-reports file
if [ ! -f ${REPORTS_CONF_FILE} ]; 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} ]; 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_WEBCONSOLE_DIR
# rm install.php
if [ -f $OCS_WEBCONSOLE_DIR/ocsreports/install.php ]; then
rm $OCS_WEBCONSOLE_DIR/ocsreports/install.php
fi
# Enable conf
a2enconf ocsinventory-reports

View File

@ -0,0 +1,32 @@
#!/bin/bash
if [ ! -z "${OCS_DISABLE_API_MODE}" ] || [ ! -z "${OCS_DISABLE_COM_MODE}" ]; then
echo "+---------------------------------------------------------------------------+"
echo "| Warning: OCS_DISABLE_API_MODE or OCS_DISABLE_COM_MODE environment |"
echo "| variable is set! |"
echo "| REST API will be DISABLED |"
echo "+---------------------------------------------------------------------------+"
exit 0
fi
API_CONF_FILE="/etc/apache2/conf-available/zz-ocsinventory-restapi.conf"
API_ROUTE=$(perl -e "print \"@INC[2]\"")
API_ROUTE_LOADER="${API_ROUTE}/Api/Ocsinventory/Restapi/Loader.pm"
cp -R /tmp/OCSNG_UNIX_SERVER-${OCS_VERSION}/Api/ ${API_ROUTE}
# Configure zz-ocsinventory-restapi file
if [ ! -f ${API_CONF_FILE} ]; 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
# Enable conf
a2enconf zz-ocsinventory-restapi

View File

@ -0,0 +1,35 @@
#!/bin/bash
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"
# Remove temp files
echo "+--------------------------------+"
echo "| Removing not used files... |"
echo "+--------------------------------+"
echo
cd /tmp
shopt -s extglob
rm -rf !("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
echo "+----------------------------------------------------------+"
echo "| OK, prepare finshed ;-) |"
echo "| |"
echo "| Starting OCS Inventory NG Management Docker... |"
echo "+----------------------------------------------------------+"
echo

35
2.10/docker-entrypoint.sh Executable file
View File

@ -0,0 +1,35 @@
#!/bin/bash
# vim:sw=4:ts=4:et
set -e
if [ -z "${OCS_ENTRYPOINT_QUIET_LOGS:-}" ]; then
exec 3>&1
else
exec 3>/dev/null
fi
if /usr/bin/find "/docker-entrypoint.d/" -mindepth 1 -maxdepth 1 -type f -print -quit 2>/dev/null | read v; then
echo >&3 "$0: /docker-entrypoint.d/ is not empty, will attempt to perform configuration"
echo >&3 "$0: Looking for shell scripts in /docker-entrypoint.d/"
find "/docker-entrypoint.d/" -follow -type f -print | sort -V | while read -r f; do
case "$f" in
*.sh)
if ! [ -x "$f" ]; then
chmod +x $f
fi
echo -e >&3 "\n$0: Launching ${f}\n"
"$f"
;;
*) echo -e >&3 "\n$0: Ignoring ${f}\n" ;;
esac
done
echo >&3 "$0: Configuration complete; ready for start up"
else
echo >&3 "$0: No files found in /docker-entrypoint.d/, skipping configuration"
fi
exec "$@"

View File

@ -0,0 +1 @@
ocsapi:$apr1$BcAk5f/A$0O5c/DSy92/o.vpwwshWQ.

View 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-----

View 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-----

View 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};
}
}

2678
2.10/sql/ocsbase.sql Normal file

File diff suppressed because one or more lines are too long

74
2.11/Dockerfile Normal file
View File

@ -0,0 +1,74 @@
FROM ubuntu:22.04
ENV OCS_VERSION 2.11.0
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 \
php-ldap
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
RUN ln -sf /proc/self/fd/1 /var/log/apache2/access.log && \
ln -sf /proc/self/fd/2 /var/log/apache2/error.log
COPY conf/ /tmp/conf
COPY ./docker-entrypoint.sh /docker-entrypoint.sh
COPY ./docker-entrypoint.d /docker-entrypoint.d
EXPOSE 80
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#entrypoint
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["/usr/sbin/apache2", "-DFOREGROUND"]

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

@ -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

View 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>

View 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.11/docker-compose.yml Normal file
View File

@ -0,0 +1,85 @@
version: '3'
services:
ocsapplication:
image: ocsinventory/ocsinventory-docker-image:2.11
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:

View File

@ -0,0 +1,17 @@
#!/bin/bash
echo "+----------------------------------------------------------+"
echo "| |"
echo "| Welcome to OCS Inventory NG Management Docker! |"
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

View File

@ -0,0 +1,48 @@
#!/bin/bash
SRV_CONF_FILE="/etc/apache2/conf-available/z-ocsinventory-server.conf"
if [ ! -z "${OCS_DISABLE_COM_MODE}" ]; then
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 "+---------------------------------------------------------------------------+"
exit 0
fi
# Configure z-ocsinventory-server file
if [ ! -f ${SRV_CONF_FILE} ]; 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
# Replace Variables
if [ -f ${SRV_CONF_FILE} ]; 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
# Permissions
chown -R $APACHE_RUN_USER: $OCS_LOG_DIR
# Enable conf
a2enconf z-ocsinventory-server

View File

@ -0,0 +1,57 @@
#!/bin/bash
REPORTS_CONF_FILE="/etc/apache2/conf-available/ocsinventory-reports.conf"
DB_CONFIG_INC_FILE="${OCS_WEBCONSOLE_DIR}/ocsreports/dbconfig.inc.php"
if [ ! -z "${OCS_DISABLE_WEB_MODE}" ]; then
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 "+---------------------------------------------------------------------------+"
exit 0
fi
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
# Configure ocsinventory-reports file
if [ ! -f ${REPORTS_CONF_FILE} ]; 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} ]; 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_WEBCONSOLE_DIR
# rm install.php
if [ -f $OCS_WEBCONSOLE_DIR/ocsreports/install.php ]; then
rm $OCS_WEBCONSOLE_DIR/ocsreports/install.php
fi
# Enable conf
a2enconf ocsinventory-reports

View File

@ -0,0 +1,32 @@
#!/bin/bash
if [ ! -z "${OCS_DISABLE_API_MODE}" ] || [ ! -z "${OCS_DISABLE_COM_MODE}" ]; then
echo "+---------------------------------------------------------------------------+"
echo "| Warning: OCS_DISABLE_API_MODE or OCS_DISABLE_COM_MODE environment |"
echo "| variable is set! |"
echo "| REST API will be DISABLED |"
echo "+---------------------------------------------------------------------------+"
exit 0
fi
API_CONF_FILE="/etc/apache2/conf-available/zz-ocsinventory-restapi.conf"
API_ROUTE=$(perl -e "print \"@INC[2]\"")
API_ROUTE_LOADER="${API_ROUTE}/Api/Ocsinventory/Restapi/Loader.pm"
cp -R /tmp/OCSNG_UNIX_SERVER-${OCS_VERSION}/Api/ ${API_ROUTE}
# Configure zz-ocsinventory-restapi file
if [ ! -f ${API_CONF_FILE} ]; 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
# Enable conf
a2enconf zz-ocsinventory-restapi

View File

@ -0,0 +1,35 @@
#!/bin/bash
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"
# Remove temp files
echo "+--------------------------------+"
echo "| Removing not used files... |"
echo "+--------------------------------+"
echo
cd /tmp
shopt -s extglob
rm -rf !("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
echo "+----------------------------------------------------------+"
echo "| OK, prepare finshed ;-) |"
echo "| |"
echo "| Starting OCS Inventory NG Management Docker... |"
echo "+----------------------------------------------------------+"
echo

35
2.11/docker-entrypoint.sh Executable file
View File

@ -0,0 +1,35 @@
#!/bin/bash
# vim:sw=4:ts=4:et
set -e
if [ -z "${OCS_ENTRYPOINT_QUIET_LOGS:-}" ]; then
exec 3>&1
else
exec 3>/dev/null
fi
if /usr/bin/find "/docker-entrypoint.d/" -mindepth 1 -maxdepth 1 -type f -print -quit 2>/dev/null | read v; then
echo >&3 "$0: /docker-entrypoint.d/ is not empty, will attempt to perform configuration"
echo >&3 "$0: Looking for shell scripts in /docker-entrypoint.d/"
find "/docker-entrypoint.d/" -follow -type f -print | sort -V | while read -r f; do
case "$f" in
*.sh)
if ! [ -x "$f" ]; then
chmod +x $f
fi
echo -e >&3 "\n$0: Launching ${f}\n"
"$f"
;;
*) echo -e >&3 "\n$0: Ignoring ${f}\n" ;;
esac
done
echo >&3 "$0: Configuration complete; ready for start up"
else
echo >&3 "$0: No files found in /docker-entrypoint.d/, skipping configuration"
fi
exec "$@"

View File

@ -0,0 +1 @@
ocsapi:$apr1$BcAk5f/A$0O5c/DSy92/o.vpwwshWQ.

View 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-----

View 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-----

View File

@ -0,0 +1,50 @@
##
# 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};
proxy_pass http://ocsapplication/ocsapi;
}
location /download {
proxy_read_timeout ${READ_TIMEOUT};
proxy_connect_timeout ${CONNECT_TIMEOUT};
proxy_send_timeout ${SEND_TIMEOUT};
client_max_body_size ${MAX_BODY_SIZE};
proxy_pass http://ocsapplication/download;
}
}

2678
2.11/sql/ocsbase.sql Normal file

File diff suppressed because one or more lines are too long

74
2.12.1/Dockerfile Normal file
View File

@ -0,0 +1,74 @@
FROM ubuntu:22.04
ENV OCS_VERSION 2.12.1
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 \
php-ldap
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
RUN ln -sf /proc/self/fd/1 /var/log/apache2/access.log && \
ln -sf /proc/self/fd/2 /var/log/apache2/error.log
COPY conf/ /tmp/conf
COPY ./docker-entrypoint.sh /docker-entrypoint.sh
COPY ./docker-entrypoint.d /docker-entrypoint.d
EXPOSE 80
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#entrypoint
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["/usr/sbin/apache2", "-DFOREGROUND"]

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

@ -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

View 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>

View 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 OCS_DBI_PRINT_ERROR
# 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>

87
2.12.1/docker-compose.yml Normal file
View File

@ -0,0 +1,87 @@
version: '3'
services:
ocsapplication:
image: ocsinventory/ocsinventory-docker-image:2.12.1
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"
- "profilesconfdata:/usr/share/ocsinventory-reports/ocsreports/config/profiles"
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
OCS_DBI_PRINT_ERROR: 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:
profilesconfdata:

View File

@ -0,0 +1,17 @@
#!/bin/bash
echo "+----------------------------------------------------------+"
echo "| |"
echo "| Welcome to OCS Inventory NG Management Docker! |"
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

View File

@ -0,0 +1,49 @@
#!/bin/bash
SRV_CONF_FILE="/etc/apache2/conf-available/z-ocsinventory-server.conf"
if [ ! -z "${OCS_DISABLE_COM_MODE}" ]; then
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 "+---------------------------------------------------------------------------+"
exit 0
fi
# Configure z-ocsinventory-server file
if [ ! -f ${SRV_CONF_FILE} ]; 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}
sed -i 's/OCS_DBI_PRINT_ERROR/'"$OCS_DBI_PRINT_ERROR"'/g' ${SRV_CONF_FILE}
fi
# Replace Variables
if [ -f ${SRV_CONF_FILE} ]; 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
# Permissions
chown -R $APACHE_RUN_USER: $OCS_LOG_DIR
# Enable conf
a2enconf z-ocsinventory-server

View File

@ -0,0 +1,57 @@
#!/bin/bash
REPORTS_CONF_FILE="/etc/apache2/conf-available/ocsinventory-reports.conf"
DB_CONFIG_INC_FILE="${OCS_WEBCONSOLE_DIR}/ocsreports/dbconfig.inc.php"
if [ ! -z "${OCS_DISABLE_WEB_MODE}" ]; then
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 "+---------------------------------------------------------------------------+"
exit 0
fi
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
# Configure ocsinventory-reports file
if [ ! -f ${REPORTS_CONF_FILE} ]; 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} ]; 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_WEBCONSOLE_DIR
# rm install.php
if [ -f $OCS_WEBCONSOLE_DIR/ocsreports/install.php ]; then
rm $OCS_WEBCONSOLE_DIR/ocsreports/install.php
fi
# Enable conf
a2enconf ocsinventory-reports

View File

@ -0,0 +1,32 @@
#!/bin/bash
if [ ! -z "${OCS_DISABLE_API_MODE}" ] || [ ! -z "${OCS_DISABLE_COM_MODE}" ]; then
echo "+---------------------------------------------------------------------------+"
echo "| Warning: OCS_DISABLE_API_MODE or OCS_DISABLE_COM_MODE environment |"
echo "| variable is set! |"
echo "| REST API will be DISABLED |"
echo "+---------------------------------------------------------------------------+"
exit 0
fi
API_CONF_FILE="/etc/apache2/conf-available/zz-ocsinventory-restapi.conf"
API_ROUTE=$(perl -e "print \"@INC[2]\"")
API_ROUTE_LOADER="${API_ROUTE}/Api/Ocsinventory/Restapi/Loader.pm"
cp -R /tmp/OCSNG_UNIX_SERVER-${OCS_VERSION}/Api/ ${API_ROUTE}
# Configure zz-ocsinventory-restapi file
if [ ! -f ${API_CONF_FILE} ]; 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
# Enable conf
a2enconf zz-ocsinventory-restapi

View File

@ -0,0 +1,35 @@
#!/bin/bash
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"
# Remove temp files
echo "+--------------------------------+"
echo "| Removing not used files... |"
echo "+--------------------------------+"
echo
cd /tmp
shopt -s extglob
rm -rf !("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
echo "+----------------------------------------------------------+"
echo "| OK, prepare finshed ;-) |"
echo "| |"
echo "| Starting OCS Inventory NG Management Docker... |"
echo "+----------------------------------------------------------+"
echo

35
2.12.1/docker-entrypoint.sh Executable file
View File

@ -0,0 +1,35 @@
#!/bin/bash
# vim:sw=4:ts=4:et
set -e
if [ -z "${OCS_ENTRYPOINT_QUIET_LOGS:-}" ]; then
exec 3>&1
else
exec 3>/dev/null
fi
if /usr/bin/find "/docker-entrypoint.d/" -mindepth 1 -maxdepth 1 -type f -print -quit 2>/dev/null | read v; then
echo >&3 "$0: /docker-entrypoint.d/ is not empty, will attempt to perform configuration"
echo >&3 "$0: Looking for shell scripts in /docker-entrypoint.d/"
find "/docker-entrypoint.d/" -follow -type f -print | sort -V | while read -r f; do
case "$f" in
*.sh)
if ! [ -x "$f" ]; then
chmod +x $f
fi
echo -e >&3 "\n$0: Launching ${f}\n"
"$f"
;;
*) echo -e >&3 "\n$0: Ignoring ${f}\n" ;;
esac
done
echo >&3 "$0: Configuration complete; ready for start up"
else
echo >&3 "$0: No files found in /docker-entrypoint.d/, skipping configuration"
fi
exec "$@"

View File

@ -0,0 +1 @@
ocsapi:$apr1$BcAk5f/A$0O5c/DSy92/o.vpwwshWQ.

View 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-----

View 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-----

View File

@ -0,0 +1,51 @@
##
# 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 / {
rewrite ^/$ /ocsreports permanent;
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};
proxy_pass http://ocsapplication/ocsapi;
}
location /download {
proxy_read_timeout ${READ_TIMEOUT};
proxy_connect_timeout ${CONNECT_TIMEOUT};
proxy_send_timeout ${SEND_TIMEOUT};
client_max_body_size ${MAX_BODY_SIZE};
proxy_pass http://ocsapplication/download;
}
}

2678
2.12.1/sql/ocsbase.sql Normal file

File diff suppressed because one or more lines are too long

74
2.12.2/Dockerfile Normal file
View File

@ -0,0 +1,74 @@
FROM ubuntu:22.04
ENV OCS_VERSION 2.12.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 \
php-ldap
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
RUN ln -sf /proc/self/fd/1 /var/log/apache2/access.log && \
ln -sf /proc/self/fd/2 /var/log/apache2/error.log
COPY conf/* /tmp/conf/
COPY ./docker-entrypoint.sh /docker-entrypoint.sh
COPY ./docker-entrypoint.d /docker-entrypoint.d
EXPOSE 80
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#entrypoint
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["/usr/sbin/apache2", "-DFOREGROUND"]

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

@ -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

View 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>

View File

@ -0,0 +1,391 @@
################################################################################
#
# 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 OCS_DBI_PRINT_ERROR
# 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
# ARP Scan bandwidth
PerlSetEnv OCS_OPT_SCAN_ARP_BANDWIDTH 256
# IpDiscover scan type
PerlSetEnv OCS_OPT_SCAN_TYPE_IPDISCOVER ICMP
# Link TAG to network entry
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
# SNMP Scan Type
PerlSetEnv OCS_OPT_SCAN_TYPE_SNMP ICMP
# SNMP Generate files
PerlSetEnv OCS_OPT_GENERATE_OCS_FILES_SNMP 0
# ===== 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>

87
2.12.2/docker-compose.yml Normal file
View File

@ -0,0 +1,87 @@
version: '3'
services:
ocsapplication:
image: ocsinventory/ocsinventory-docker-image:2.12.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"
- "profilesconfdata:/usr/share/ocsinventory-reports/ocsreports/config/profiles"
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
OCS_DBI_PRINT_ERROR: 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:
profilesconfdata:

View File

@ -0,0 +1,17 @@
#!/bin/bash
echo "+----------------------------------------------------------+"
echo "| |"
echo "| Welcome to OCS Inventory NG Management Docker! |"
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

View File

@ -0,0 +1,49 @@
#!/bin/bash
SRV_CONF_FILE="/etc/apache2/conf-available/z-ocsinventory-server.conf"
if [ ! -z "${OCS_DISABLE_COM_MODE}" ]; then
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 "+---------------------------------------------------------------------------+"
exit 0
fi
# Configure z-ocsinventory-server file
if [ ! -f ${SRV_CONF_FILE} ]; 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}
sed -i 's/OCS_DBI_PRINT_ERROR/'"$OCS_DBI_PRINT_ERROR"'/g' ${SRV_CONF_FILE}
fi
# Replace Variables
if [ -f ${SRV_CONF_FILE} ]; 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
# Permissions
chown -R $APACHE_RUN_USER: $OCS_LOG_DIR
# Enable conf
a2enconf z-ocsinventory-server

View File

@ -0,0 +1,57 @@
#!/bin/bash
REPORTS_CONF_FILE="/etc/apache2/conf-available/ocsinventory-reports.conf"
DB_CONFIG_INC_FILE="${OCS_WEBCONSOLE_DIR}/ocsreports/dbconfig.inc.php"
if [ ! -z "${OCS_DISABLE_WEB_MODE}" ]; then
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 "+---------------------------------------------------------------------------+"
exit 0
fi
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
# Configure ocsinventory-reports file
if [ ! -f ${REPORTS_CONF_FILE} ]; 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} ]; 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_WEBCONSOLE_DIR
# rm install.php
if [ -f $OCS_WEBCONSOLE_DIR/ocsreports/install.php ]; then
rm $OCS_WEBCONSOLE_DIR/ocsreports/install.php
fi
# Enable conf
a2enconf ocsinventory-reports

View File

@ -0,0 +1,32 @@
#!/bin/bash
if [ ! -z "${OCS_DISABLE_API_MODE}" ] || [ ! -z "${OCS_DISABLE_COM_MODE}" ]; then
echo "+---------------------------------------------------------------------------+"
echo "| Warning: OCS_DISABLE_API_MODE or OCS_DISABLE_COM_MODE environment |"
echo "| variable is set! |"
echo "| REST API will be DISABLED |"
echo "+---------------------------------------------------------------------------+"
exit 0
fi
API_CONF_FILE="/etc/apache2/conf-available/zz-ocsinventory-restapi.conf"
API_ROUTE=$(perl -e "print \"@INC[2]\"")
API_ROUTE_LOADER="${API_ROUTE}/Api/Ocsinventory/Restapi/Loader.pm"
cp -R /tmp/OCSNG_UNIX_SERVER-${OCS_VERSION}/Api/ ${API_ROUTE}
# Configure zz-ocsinventory-restapi file
if [ ! -f ${API_CONF_FILE} ]; 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
# Enable conf
a2enconf zz-ocsinventory-restapi

View File

@ -0,0 +1,35 @@
#!/bin/bash
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"
# Remove temp files
echo "+--------------------------------+"
echo "| Removing not used files... |"
echo "+--------------------------------+"
echo
cd /tmp
shopt -s extglob
rm -rf !("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
echo "+----------------------------------------------------------+"
echo "| OK, prepare finshed ;-) |"
echo "| |"
echo "| Starting OCS Inventory NG Management Docker... |"
echo "+----------------------------------------------------------+"
echo

35
2.12.2/docker-entrypoint.sh Executable file
View File

@ -0,0 +1,35 @@
#!/bin/bash
# vim:sw=4:ts=4:et
set -e
if [ -z "${OCS_ENTRYPOINT_QUIET_LOGS:-}" ]; then
exec 3>&1
else
exec 3>/dev/null
fi
if /usr/bin/find "/docker-entrypoint.d/" -mindepth 1 -maxdepth 1 -type f -print -quit 2>/dev/null | read v; then
echo >&3 "$0: /docker-entrypoint.d/ is not empty, will attempt to perform configuration"
echo >&3 "$0: Looking for shell scripts in /docker-entrypoint.d/"
find "/docker-entrypoint.d/" -follow -type f -print | sort -V | while read -r f; do
case "$f" in
*.sh)
if ! [ -x "$f" ]; then
chmod +x $f
fi
echo -e >&3 "\n$0: Launching ${f}\n"
"$f"
;;
*) echo -e >&3 "\n$0: Ignoring ${f}\n" ;;
esac
done
echo >&3 "$0: Configuration complete; ready for start up"
else
echo >&3 "$0: No files found in /docker-entrypoint.d/, skipping configuration"
fi
exec "$@"

View File

@ -0,0 +1 @@
ocsapi:$apr1$BcAk5f/A$0O5c/DSy92/o.vpwwshWQ.

View 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-----

View 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-----

View File

@ -0,0 +1,51 @@
##
# 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 / {
rewrite ^/$ /ocsreports permanent;
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};
proxy_pass http://ocsapplication/ocsapi;
}
location /download {
proxy_read_timeout ${READ_TIMEOUT};
proxy_connect_timeout ${CONNECT_TIMEOUT};
proxy_send_timeout ${SEND_TIMEOUT};
client_max_body_size ${MAX_BODY_SIZE};
proxy_pass http://ocsapplication/download;
}
}

2980
2.12.2/sql/ocsbase.sql Normal file

File diff suppressed because one or more lines are too long

74
2.12.3/Dockerfile Normal file
View File

@ -0,0 +1,74 @@
FROM ubuntu:24.04
ENV OCS_VERSION 2.12.3
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 \
php-ldap
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
RUN ln -sf /proc/self/fd/1 /var/log/apache2/access.log && \
ln -sf /proc/self/fd/2 /var/log/apache2/error.log
COPY conf/* /tmp/conf/
COPY ./docker-entrypoint.sh /docker-entrypoint.sh
COPY ./docker-entrypoint.d /docker-entrypoint.d
EXPOSE 80
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#entrypoint
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["/usr/sbin/apache2", "-DFOREGROUND"]

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

@ -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

View 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>

View File

@ -0,0 +1,391 @@
################################################################################
#
# 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 OCS_DBI_PRINT_ERROR
# 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
# ARP Scan bandwidth
PerlSetEnv OCS_OPT_SCAN_ARP_BANDWIDTH 256
# IpDiscover scan type
PerlSetEnv OCS_OPT_SCAN_TYPE_IPDISCOVER ICMP
# Link TAG to network entry
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
# SNMP Scan Type
PerlSetEnv OCS_OPT_SCAN_TYPE_SNMP ICMP
# SNMP Generate files
PerlSetEnv OCS_OPT_GENERATE_OCS_FILES_SNMP 0
# ===== 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>

95
2.12.3/docker-compose.yml Normal file
View File

@ -0,0 +1,95 @@
version: '3'
services:
ocsapplication:
image: ocsinventory/ocsinventory-docker-image:2.12.3
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"
- "profilesconfdata:/usr/share/ocsinventory-reports/ocsreports/config/profiles"
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
OCS_DBI_PRINT_ERROR: 0
# Define the auth type :
# 1 : Local Only
# 2 : Local and LDAP
# 3 : LDAP Only
# 4 : LDAP with SSO
# 5 : Always OK, won't ask for user and password
# 6 : CAS authentication
AUTH_TYPE: 1
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:
profilesconfdata:

View File

@ -0,0 +1,17 @@
#!/bin/bash
echo "+----------------------------------------------------------+"
echo "| |"
echo "| Welcome to OCS Inventory NG Management Docker! |"
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

View File

@ -0,0 +1,52 @@
#!/bin/bash
SRV_CONF_FILE="/etc/apache2/conf-available/z-ocsinventory-server.conf"
if [ ! -z "${OCS_DISABLE_COM_MODE}" ]; then
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 "+---------------------------------------------------------------------------+"
exit 0
fi
# Configure z-ocsinventory-server file
if [ ! -f ${SRV_CONF_FILE} ]; 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}
sed -i 's/OCS_DBI_PRINT_ERROR/'"$OCS_DBI_PRINT_ERROR"'/g' ${SRV_CONF_FILE}
fi
# Replace Variables
if [ -f ${SRV_CONF_FILE} ]; 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
# Quick fix https://github.com/OCSInventory-NG/OCSInventory-Docker-Stack/issues/16
sed -i 's/^.*PerlSetEnv OCS_OPT_DBI_PRINT_ERROR.*$/PerlSetEnv OCS_OPT_DBI_PRINT_ERROR 0/' ${SRV_CONF_FILE}
# Permissions
chown -R $APACHE_RUN_USER: $OCS_LOG_DIR
# Enable conf
a2enconf z-ocsinventory-server

View File

@ -0,0 +1,57 @@
#!/bin/bash
REPORTS_CONF_FILE="/etc/apache2/conf-available/ocsinventory-reports.conf"
DB_CONFIG_INC_FILE="${OCS_WEBCONSOLE_DIR}/ocsreports/dbconfig.inc.php"
if [ ! -z "${OCS_DISABLE_WEB_MODE}" ]; then
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 "+---------------------------------------------------------------------------+"
exit 0
fi
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
# Configure ocsinventory-reports file
if [ ! -f ${REPORTS_CONF_FILE} ]; 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} ]; 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_WEBCONSOLE_DIR
# rm install.php
if [ -f $OCS_WEBCONSOLE_DIR/ocsreports/install.php ]; then
rm $OCS_WEBCONSOLE_DIR/ocsreports/install.php
fi
# Enable conf
a2enconf ocsinventory-reports

View File

@ -0,0 +1,11 @@
#!/bin/bash
VAR_FILE=${OCS_WEBCONSOLE_DIR}/ocsreports/var.php
if [ -f ${VAR_FILE} ]; then
echo "+-----------------------------------------------+"
echo "| Customizing OCS Console AUTHTYPE... |"
echo "+-----------------------------------------------+"
echo
sed -ri -e "/AUTH_TYPE/c\define('AUTH_TYPE', $AUTH_TYPE);" ${VAR_FILE}
fi

View File

@ -0,0 +1,32 @@
#!/bin/bash
if [ ! -z "${OCS_DISABLE_API_MODE}" ] || [ ! -z "${OCS_DISABLE_COM_MODE}" ]; then
echo "+---------------------------------------------------------------------------+"
echo "| Warning: OCS_DISABLE_API_MODE or OCS_DISABLE_COM_MODE environment |"
echo "| variable is set! |"
echo "| REST API will be DISABLED |"
echo "+---------------------------------------------------------------------------+"
exit 0
fi
API_CONF_FILE="/etc/apache2/conf-available/zz-ocsinventory-restapi.conf"
API_ROUTE=$(perl -e "print \"@INC[2]\"")
API_ROUTE_LOADER="${API_ROUTE}/Api/Ocsinventory/Restapi/Loader.pm"
cp -R /tmp/OCSNG_UNIX_SERVER-${OCS_VERSION}/Api/ ${API_ROUTE}
# Configure zz-ocsinventory-restapi file
if [ ! -f ${API_CONF_FILE} ]; 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
# Enable conf
a2enconf zz-ocsinventory-restapi

View File

@ -0,0 +1,35 @@
#!/bin/bash
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"
# Remove temp files
echo "+--------------------------------+"
echo "| Removing not used files... |"
echo "+--------------------------------+"
echo
cd /tmp
shopt -s extglob
rm -rf !("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
echo "+----------------------------------------------------------+"
echo "| OK, prepare finshed ;-) |"
echo "| |"
echo "| Starting OCS Inventory NG Management Docker... |"
echo "+----------------------------------------------------------+"
echo

35
2.12.3/docker-entrypoint.sh Executable file
View File

@ -0,0 +1,35 @@
#!/bin/bash
# vim:sw=4:ts=4:et
set -e
if [ -z "${OCS_ENTRYPOINT_QUIET_LOGS:-}" ]; then
exec 3>&1
else
exec 3>/dev/null
fi
if /usr/bin/find "/docker-entrypoint.d/" -mindepth 1 -maxdepth 1 -type f -print -quit 2>/dev/null | read v; then
echo >&3 "$0: /docker-entrypoint.d/ is not empty, will attempt to perform configuration"
echo >&3 "$0: Looking for shell scripts in /docker-entrypoint.d/"
find "/docker-entrypoint.d/" -follow -type f -print | sort -V | while read -r f; do
case "$f" in
*.sh)
if ! [ -x "$f" ]; then
chmod +x $f
fi
echo -e >&3 "\n$0: Launching ${f}\n"
"$f"
;;
*) echo -e >&3 "\n$0: Ignoring ${f}\n" ;;
esac
done
echo >&3 "$0: Configuration complete; ready for start up"
else
echo >&3 "$0: No files found in /docker-entrypoint.d/, skipping configuration"
fi
exec "$@"

View File

@ -0,0 +1 @@
ocsapi:$apr1$BcAk5f/A$0O5c/DSy92/o.vpwwshWQ.

View 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-----

View 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-----

View File

@ -0,0 +1,51 @@
##
# 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 / {
rewrite ^/$ /ocsreports permanent;
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};
proxy_pass http://ocsapplication/ocsapi;
}
location /download {
proxy_read_timeout ${READ_TIMEOUT};
proxy_connect_timeout ${CONNECT_TIMEOUT};
proxy_send_timeout ${SEND_TIMEOUT};
client_max_body_size ${MAX_BODY_SIZE};
proxy_pass http://ocsapplication/download;
}
}

2980
2.12.3/sql/ocsbase.sql Normal file

File diff suppressed because one or more lines are too long

74
2.12/Dockerfile Normal file
View File

@ -0,0 +1,74 @@
FROM ubuntu:22.04
ENV OCS_VERSION 2.12.0
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 \
php-ldap
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
RUN ln -sf /proc/self/fd/1 /var/log/apache2/access.log && \
ln -sf /proc/self/fd/2 /var/log/apache2/error.log
COPY conf/ /tmp/conf
COPY ./docker-entrypoint.sh /docker-entrypoint.sh
COPY ./docker-entrypoint.d /docker-entrypoint.d
EXPOSE 80
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#entrypoint
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["/usr/sbin/apache2", "-DFOREGROUND"]

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

@ -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

View 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>

View 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.12/docker-compose.yml Normal file
View File

@ -0,0 +1,85 @@
version: '3'
services:
ocsapplication:
image: ocsinventory/ocsinventory-docker-image:2.12
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:

View File

@ -0,0 +1,17 @@
#!/bin/bash
echo "+----------------------------------------------------------+"
echo "| |"
echo "| Welcome to OCS Inventory NG Management Docker! |"
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

View File

@ -0,0 +1,48 @@
#!/bin/bash
SRV_CONF_FILE="/etc/apache2/conf-available/z-ocsinventory-server.conf"
if [ ! -z "${OCS_DISABLE_COM_MODE}" ]; then
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 "+---------------------------------------------------------------------------+"
exit 0
fi
# Configure z-ocsinventory-server file
if [ ! -f ${SRV_CONF_FILE} ]; 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
# Replace Variables
if [ -f ${SRV_CONF_FILE} ]; 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
# Permissions
chown -R $APACHE_RUN_USER: $OCS_LOG_DIR
# Enable conf
a2enconf z-ocsinventory-server

View File

@ -0,0 +1,57 @@
#!/bin/bash
REPORTS_CONF_FILE="/etc/apache2/conf-available/ocsinventory-reports.conf"
DB_CONFIG_INC_FILE="${OCS_WEBCONSOLE_DIR}/ocsreports/dbconfig.inc.php"
if [ ! -z "${OCS_DISABLE_WEB_MODE}" ]; then
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 "+---------------------------------------------------------------------------+"
exit 0
fi
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
# Configure ocsinventory-reports file
if [ ! -f ${REPORTS_CONF_FILE} ]; 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} ]; 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_WEBCONSOLE_DIR
# rm install.php
if [ -f $OCS_WEBCONSOLE_DIR/ocsreports/install.php ]; then
rm $OCS_WEBCONSOLE_DIR/ocsreports/install.php
fi
# Enable conf
a2enconf ocsinventory-reports

View File

@ -0,0 +1,32 @@
#!/bin/bash
if [ ! -z "${OCS_DISABLE_API_MODE}" ] || [ ! -z "${OCS_DISABLE_COM_MODE}" ]; then
echo "+---------------------------------------------------------------------------+"
echo "| Warning: OCS_DISABLE_API_MODE or OCS_DISABLE_COM_MODE environment |"
echo "| variable is set! |"
echo "| REST API will be DISABLED |"
echo "+---------------------------------------------------------------------------+"
exit 0
fi
API_CONF_FILE="/etc/apache2/conf-available/zz-ocsinventory-restapi.conf"
API_ROUTE=$(perl -e "print \"@INC[2]\"")
API_ROUTE_LOADER="${API_ROUTE}/Api/Ocsinventory/Restapi/Loader.pm"
cp -R /tmp/OCSNG_UNIX_SERVER-${OCS_VERSION}/Api/ ${API_ROUTE}
# Configure zz-ocsinventory-restapi file
if [ ! -f ${API_CONF_FILE} ]; 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
# Enable conf
a2enconf zz-ocsinventory-restapi

View File

@ -0,0 +1,35 @@
#!/bin/bash
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"
# Remove temp files
echo "+--------------------------------+"
echo "| Removing not used files... |"
echo "+--------------------------------+"
echo
cd /tmp
shopt -s extglob
rm -rf !("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
echo "+----------------------------------------------------------+"
echo "| OK, prepare finshed ;-) |"
echo "| |"
echo "| Starting OCS Inventory NG Management Docker... |"
echo "+----------------------------------------------------------+"
echo

35
2.12/docker-entrypoint.sh Executable file
View File

@ -0,0 +1,35 @@
#!/bin/bash
# vim:sw=4:ts=4:et
set -e
if [ -z "${OCS_ENTRYPOINT_QUIET_LOGS:-}" ]; then
exec 3>&1
else
exec 3>/dev/null
fi
if /usr/bin/find "/docker-entrypoint.d/" -mindepth 1 -maxdepth 1 -type f -print -quit 2>/dev/null | read v; then
echo >&3 "$0: /docker-entrypoint.d/ is not empty, will attempt to perform configuration"
echo >&3 "$0: Looking for shell scripts in /docker-entrypoint.d/"
find "/docker-entrypoint.d/" -follow -type f -print | sort -V | while read -r f; do
case "$f" in
*.sh)
if ! [ -x "$f" ]; then
chmod +x $f
fi
echo -e >&3 "\n$0: Launching ${f}\n"
"$f"
;;
*) echo -e >&3 "\n$0: Ignoring ${f}\n" ;;
esac
done
echo >&3 "$0: Configuration complete; ready for start up"
else
echo >&3 "$0: No files found in /docker-entrypoint.d/, skipping configuration"
fi
exec "$@"

Some files were not shown because too many files have changed in this diff Show More