Thank You very much for respons! Your answer helped me take a closer look at the configuration file. AuthRequired functionality configuration was easier than I thought!
Here is instruction (OCS Inventory Server release 2.12.3, Ubuntu 24.04 LTS):
1. Generate Apache user (ocsagent for this example) and password:
sudo htpasswd -c /etc/apache2/.htpasswd ocsagent
2. Edit z-ocsinventory-server.conf configuration file in section: <Location /ocsinventory>
Comment:
Require all granted
allow from all
Uncomment the following lines:
AuthType Basic
AuthName "OCS Inventory agent area"
require valid-user
Change:
AuthUserFile "APACHE_AUTH_USER_FILE"
to:
AuthUserFile "/etc/apache2/.htpasswd"
3. Apache2 restart:
service apache2 restart
I was blind, I didn't read the comments contained in the configuration files. Those files are described very well.
If I missing something or write something wrong please correct me.
Kind regards