Run the following command:
apt -y install apache2-utils
Create a user account that has access to the server. Enter the following details:
htpasswd -c /etc/apache2/.htpasswd <username>
New password:
Re-type new password:
Adding password for user <username>
Go to directory cd /etc/apache2/sites-enabled/.
In nano openxpki.conf, add the following lines in <VirtualHost *: 443 block>:
#HTTPS BASIC AUTH FOR LABELS
Location /.well-known/est/*/simpleenroll
AuthType Basic
AuthName "estrealm"
AuthUserFile /etc/apache2/.htpasswd
require valid-user
</Location>
#HTTPS BASIC AUTH FOR NO LABEL
<Location /.well-known/est/simpleenroll>
AuthType Basic
AuthName "estrealm"
AuthUserFile /etc/apache2/.htpasswd
require valid-user
</Location>
Add ErrorDocument 401 %{unescape:%00} before SSLEngine in the same virtual Host block.
Example
ServerAlias *
DocumentRoot /var/www/
ErrorDocument 401 %{unescape:%00}
SSLEngine On
Restart the apache2 service using service apache2 restart.
Note: Basic authentication works using the above user name and password.