ONTAP Discussions

Configuration backup upload to a https destination

Matthias_Buggle
310 Views

Hello,

I'am searching for a working solution to upload the configuration files from the Netapp to a https destination. I have tested with webdav on IIS and apache 2.4 on Windows. On IIS, I get a 405 error, when I try to upload a file, because the POST method is not allowed. On Apache 2.4 I have also created a webdav server with ssl enabled. When I mount the webdav ressource as a network drive in Windows, everything works fine, I can upload and download files without a problem. If I try to upload a configuration file with system configuration upload on the Netapp then I get the error 404 - file not found.  In the case, a file with the same name is already there, the Netapp says that the file was uploaded. But the file was not written.

The same webserver configuration with http works fine.

In the log-files I can see, that on the Netapp the POST method was used. The upload over a mounted drive on Windows uses the PUT Method.

 

Thank you in advance, best regards Matthias

 

3 REPLIES 3

TMACMD
291 Views

Have you read the Docs regarding this?

Why are trying to use webdav? Pretty sure that is not supported. Just the HTTP POST command is needed.

 

The web server to which you are uploading the configuration backup file must have PUT operations enabled for HTTP and POST operations enabled for HTTPS. Some web servers might require the installation of an additional module. For more information, see your web server’s documentation. Supported URL formats vary by ONTAP release. See the command line help for your ONTAP version.

Matthias_Buggle
251 Views

Hallo TMACMD,

thank you for your answer.  Every example that I found on the Internet on the subject was a solution using Webdav and http, unfortunately none with https. Is there a sample configuration with Apache and POST enabled that I can use as a template to configure a web server ?

 

Thank you.

 

Matthias_Buggle
145 Views

In the meantime I was able to find a solution to this problem using PHP.

I'd like to document this in case anyone else is struggling with this problem.

This description only documents the solution for performing a configuration upload , ssl and security settings are not part of the description.

The upload to a https destination uses the POST method.


I used Apache 2.4 ( from https://www.apachehaus.com ) on Windows and PHP for Apache version 8.1.9 (from www.php.net).

 

After installing Apache and unpacking the PHP package rename the file php.production to php.ini.

 

- Modify php.ini and set:

memory_limit = 250M
sys_temp_dir = < your temp directory >
file_uploads = on
upload_max_filesize = 100M

 

- To activate PHP modify the Apache httpd.conf file:

 

PHPIniDir "c:/php"
LoadModule php_module "c:/php/php8apache2_4.dll"
AddHandler application/x-httpd-php .php

 

- In the Apache htdocs directory create a directory backup

 

- In the Apache htdocs directory create a file backup.php:

 

<html>
<body>
<?php

$pathinfo = $_SERVER['PATH_INFO'];
$destination = 'backup'.$pathinfo;

 

file_put_contents($destination, file_get_contents('php://input'));

 

file_put_contents('php://stderr',print_r($destination,TRUE));

file_put_contents('php://stderr',print_r(PHP_EOL,TRUE));

?>
</body>
</html>

 

- Now you can backup the cluster configuration on the NAS filer:

set adv
system configuration backup show
system configuration backup upload -node <NAS-node> -backup <configuration.7z> -destination https://web-server/backup.php

 

Public