Enable WebDAV and set up Basic Authentication
-
Determine if the WebDAV module is enabled.
sudo httpd -M | grep fs
If WebDAV is already enabled, you will see the following output:
dav_fs_module (shared)
By default, the WebDAV module is included and enabled with the Apache installations. -
Create a WebDAV directory under the Apache web root directory.
sudo mkdir /var/www/html/webdav
-
Change the ownership and permission of the WebDAV directory.
sudo chown -R apache:apache /var/www/html/webdav
sudo chmod -R 755 /var/www/html/webdav
-
Optional. To set up password authentication for the WebDAV directory by
creating an
.htpasswd
file, perform the following steps:- Create an
.htpasswd
file.sudo htpasswd -c /etc/httpd/.htpasswd {User Name}
- Assign group ownership to the Apache user and lock down permissions for
other users.
sudo chown root:apache /etc/httpd/.htpasswd
sudo chmod 640 /etc/httpd/.htpasswd
- Create an
-
Create a site configuration file called
webdav.conf
.vi /etc/httpd/conf.d/webdav.conf
-
Add the following code to the
/etc/httpd/conf.d/webdav.conf
file.DavLockDB /var/www/html/DavLock <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/html/webdav/ ErrorLog /var/log/httpd/error.log CustomLog /var/log/httpd/access.log combined Alias /webdav /var/www/html/webdav <Directory /var/www/html/webdav> DAV On AuthType Basic AuthName "webdav" AuthUserFile /etc/httpd/.htpasswd Require valid-user </Directory> </VirtualHost>
NOTE:The
AuthName
must be same as the user name specified in step 4. -
Save the file and restart Apache.
service httpd restart
After restarting the web server, login details are requested.
NOTE:Only Basic Authentication and OpenSSL certificates are supported for https in HPE OneView.
-
Optional. Skip this step to add the web server to
HPE OneView with the provided credentials and HTTP.
HPE OneView will discover all the valid bundles. To add the web server as an external repository using HTTPS, perform the following steps:
- Navigate to
/etc/httpd/conf
, and edit thehttpd.conf
.vi httpd.conf
- Search for the following line of code in the
httpd.conf
file.DocumentRoot "/var/www/html/" # # Relax access to content within /var/www. #
- Search for the directory path and change the path from
<Directory "/var/www/html/>
to<Directory "/var/www/html/webdav">
. - Add the following code in the
<Directory>
block.DAV On AuthType Basic AuthName "webdav" AuthUserFile /etc/httpd/.htpasswd Require valid-user # All access controls and authentication are disabled # in this directory #AuthType None #Satisfy all #Allow from all #AllowOverride None Header set MaxRepoSize 100G AllowOverride AuthConfig #Require all granted
NOTE:The code line,
Header set MaxRepoSize 100G
configures the size of the web server. - Save the file and restart Apache.
service httpd restart
- Navigate to
-
Optional. To add the web server to
HPE OneView without requiring a password, perform the following steps:
- Navigate to
/etc/httpd/conf
, and edithttpd.conf
.vi httpd.conf
- Remove
#
from the following lines:#AuthType None #Satisfy all #Allow from all #AllowOverride None #Require all granted
- Add
#
to the following code line:AllowOverride AuthConfig
- Save the file and restart Apache.
service httpd restart
Now that you have installed and configured the Linux Apache web server, you can add the web server to HPE OneView and copy the firmware bundles to the external repository.
NOTE:Hewlett Packard Enterprise recommends downloading the new file to another folder in the Linux repository in the same mount point. This action prevents Linux from keeping a partial download in the repository path. You can then move the file to the folder that is registered in the Linux repository. For example, in this use case, move the file to
/var/www/html/webdav
.
- Navigate to
-
Optional. To update
/etc/httpd/conf.d/webdav.conf
to allow only https requests, perform the following steps:- Add the following text to the
webdav.conf
.Make sure
CN
matches theSubjectAltName
in/etc/pki/tls/openssl.cnf
.<VirtualHost *:443> ServerAdmin webmaster@localhost DocumentRoot /var/www/html/webdav/ SSLEngine on SSLProxyEngine on SSLCertificateFile /etc/pki/tls/certs/localhost.crt SSLCertificateKeyFile /etc/pki/tls/private/localhost.key ErrorLog /var/log/httpd/error.log CustomLog /var/log/httpd/access.log combined Alias /webdav /var/www/html/webdav <Directory /var/www/html/webdav> DAV On AuthType Basic AuthName "webdav" AuthUserFile /etc/httpd/.htpasswd Require valid-user </Directory> </VirtualHost>
- Update
/etc/httpd/conf/httpd.conf
to commentListen 80
to disable port 80. - Restart the server.
More information - Add the following text to the