Welcome to OCS Inventory NG community support, where you can ask questions and receive answers from other members of the community.

Please ask questions only in English or French.

Release 2.11.1 available

The official documentation can be found on http://wiki.ocsinventory-ng.org. Read it before asking your question.

OCS dans un sous domaine avec certificat SSL

Bonjour,

J'ai un serveur WEB (Debian) et sur ce serveur j'ai aussi mon serveur OCS, je souhaiterai pouvoir configurer OCS dans un sous domaine (ocs.exemple.lan). J'ai donc fait "a2disconf ocsinventory-reports" puis créer un fichier ocsinventory-reports.conf dans "/etc/apache2/sites-avaible". Mais dès que je décommente la partie SSL j'ai une erreur. Je ne sais pas trop comment régler ce soucis.

Je vous remercie,

Cordialement,

Gabriel

<VirtualHost *:80>
    ServerName ocs.exemple.lan
    Redirect 301 / https://ocs.exemple.lan
</VirtualHost>
<VirtualHost *:443>
    ServerAdmin webmaster@localhost
    ServerName ocs.exemple.lan
    ServerAlias *.ocs.exemple.lan
    
    DocumentRoot /usr/share/ocsinventory-reports
    
    # Uncomment following to force use of HTTPS in Administration Server
    #SSLRequireSSL
    #SSLCertificateFile /etc/ssl/ocs.exemple.lan/ocs.exemple.lan.crt
    #SSLCertificateKeyFile /etc/ssl/ocs.exemple.lan/ocs.exemple.lan.key
    
    ErrorLog ${APACHE_LOG_DIR}/error_ocsinventory-reports.log
    CustomLog ${APACHE_LOG_DIR}/access_ocsinventory-reports.log combined

    Alias /ocsreports /usr/share/ocsinventory-reports/ocsreports
    <Directory /usr/share/ocsinventory-reports/ocsreports>
        # 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

        # 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         1200m
            php_value upload_max_filesize   1000m
            # 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 /var/lib/ocsinventory-reports/download>
       <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 /download /var/lib/ocsinventory-reports/download


    ################################################################################
    # Snmp communities area
    #
    # Alias to put Snmp custom Mibs files outside Apache document root directory
    #
    <Directory /var/lib/ocsinventory-reports/snmp>
       <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 /var/lib/ocsinventory-reports/snmp
</VirtualHost>



juil. 15 10:51:37 SRV-DEBIAN-WEB-01 systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
juil. 15 10:51:37 SRV-DEBIAN-WEB-01 systemd[1]: Reload failed for The Apache HTTP Server.
juil. 15 10:52:10 SRV-DEBIAN-WEB-01 systemd[1]: Reloading The Apache HTTP Server.
juil. 15 10:52:10 SRV-DEBIAN-WEB-01 apachectl[707353]: ocsinventory-server: Bad setting. `IPDISCOVER_LINK_TAG_NETWORK` is not set. Default: `0`
juil. 15 10:52:11 SRV-DEBIAN-WEB-01 apachectl[707353]: AH00526: Syntax error on line 17 of /etc/apache2/sites-enabled/ocsinventory-reports.conf:
juil. 15 10:52:11 SRV-DEBIAN-WEB-01 apachectl[707353]: SSLRequireSSL not allowed in <VirtualHost> context
juil. 15 10:52:11 SRV-DEBIAN-WEB-01 apachectl[707350]: Action 'graceful' failed.
juil. 15 10:52:11 SRV-DEBIAN-WEB-01 apachectl[707350]: The Apache error log may have more information.
juil. 15 10:52:11 SRV-DEBIAN-WEB-01 systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
juil. 15 10:52:11 SRV-DEBIAN-WEB-01 systemd[1]: Reload failed for The Apache HTTP Server.

in OCS Inventory NG server for Unix by (120 points)

1 Answer

0 votes
Il vous manque un minimum de knowlegde autour d'Apache (ou d'un serveur web) ...

Un block 'virtualhost' permet à Apache de

- répondre sur un port indiqué,

- répondre pour une nom dns donné, défini par le ServerName.

C'est donc TRES utile si on souhaite que le serveur web réponde selon le nom dns choisi par le client (même si tous les noms dns pointe sur l'adresse ip du serveur).

Quand Apache écoute sur le port 443, il va fonctionner en HTTPS, et il faut nécessairement indiquer le certificat associé (dont le CommonName correspondra à ServerName ou à *.domaine.dom).

La commande intéressante est 'apache2ctl -S' qui donne les noms et fichiers 'sites' correspondant.

NB : ServerAlias fonctionne pour HTTP = 80/tcp et ne fonctionne pas pour HTTPS (sauf, peut-être, avec un certificat spécial). De plus je ne pense pas qu'il soit possible de faire 'ServerAlias *'.

L'un des meilleurs sites de tutoriels incluant la création et l'utilisation de certificat https://miloszengel.com/ocs-inventory-ng-2-5-install-guide-on-debian-stretch-with-ssl-and-deployment/
by (18.9k points)
edited by
 
Powered by Question2Answer
...