OPNsense Forum

English Forums => Development and Code Review => Topic started by: Dimi3 on April 30, 2018, 08:17:02 pm

Title: WebDav backups
Post by: Dimi3 on April 30, 2018, 08:17:02 pm
Hello,

Sorry for maybe stupid question..there is a feature planned for 18.7 (most probably) to have backups via WebDav (nextcloud).

Would this feature also work with other cloud solutions accessible via webdav? Personally I'm using pCloud, that is fairly popular in EU, and pcloud is also accessible via https://webdav.pcloud.com, or the implementation is specific to nextcloud?

Thanks for sharing the light :)

Regards,
Title: Re: WebDav backups
Post by: fabian on April 30, 2018, 10:48:24 pm
I made this code probably very specific to Nextcloud because I hardcoded the Nextcloud webdav endpoint which is "/index.php/webdav/USERNAME". If the path and the PROPFIND responses are the same, it will probably work.
Title: Re: WebDav backups
Post by: Dimi3 on May 01, 2018, 08:10:19 pm
fabian thanks for explaining this..out of curiosity i fired up opnsense in vmware and test it..unfortunate it doesn't work..log file below.

I don't know much about coding, but maybe for the future a generic webdav option would be nice..not sure if this can be done..:)


May 1 18:03:21    config[41014]: {"url":"https:\/\/webdav.pcloud.com\/remote.php\/dav\/files\/myemail.com\/","content_type":"text\/html; charset=iso-8859-1","http_code":404,"header_size":161,"request_size":213,"filetime":-1,"ssl_verify_result":0,"redirect_count":0,"total_time":0.840269,"namelookup_time":0.137024,"connect_time":0.280039,"pretransfer_time":0.664595,"size_upload":0,"size_download":328,"speed_download":390,"speed_upload":0,"download_content_length":328,"upload_content_length":-1,"starttransfer_time":0.839998,"redirect_time":0,"redirect_url":"","primary_ip":"74.120.8.227","certinfo":[],"primary_port":443,"local_ip":"10.0.0.29","local_port":49755}

May 1 18:03:21    config[41014]: Error while fetching filelist from Nextcloud
Title: Re: WebDav backups
Post by: fabian on May 01, 2018, 10:06:44 pm
The error means that the directory cannot be fetched because the endpoint was not found.

I think most people are using webdav via a Nextcloud or Owncloud server and very likely it works for Owncloud too.
BTW: I have never heard of that service before. Ad made the Backup scripts extendable so it is only a script that needs to be put into a special directory. You can find the source here:
https://github.com/opnsense/core/blob/master/src/opnsense/mvc/app/library/OPNsense/Backup/Nextcloud.php

Title: Re: WebDav backups
Post by: Dimi3 on May 02, 2018, 07:44:03 am
thanks for the link...i will try to study the code...pcloud is commercial cloud storage provider..its not self hosting like nextcloud or owncloud.

Title: Re: WebDav backups
Post by: akron on May 23, 2018, 04:19:23 pm
thanks for the link...i will try to study the code...pcloud is commercial cloud storage provider..its not self hosting like nextcloud or owncloud.

Hi Guys

I am also interested in backing up to Nextcloud as I don't use public cloud services.

How can I install the plug in for nextcloud ?

Thank You
Title: Re: WebDav backups
Post by: fabian on May 23, 2018, 04:30:43 pm
I am also interested in backing up to Nextcloud as I don't use public cloud services.

How can I install the plug in for nextcloud ?
This is not a plugin, if it is not available in the backup section, it will be included in a future release without having to install anything except updates ;)

You can test it in the developer preview.
Title: Re: WebDav backups
Post by: akron on May 23, 2018, 04:54:31 pm
I am also interested in backing up to Nextcloud as I don't use public cloud services.

How can I install the plug in for nextcloud ?
This is not a plugin, if it is not available in the backup section, it will be included in a future release without having to install anything except updates ;)

You can test it in the developer preview.

OK Thank you, how do I transform my version into developer preview or upgrade ?

I am running stable 18.1.8

cheers

Title: Re: WebDav backups
Post by: fabian on May 23, 2018, 09:01:17 pm
pkg install opnsense-devel should work.
Title: Re: WebDav backups
Post by: franco on May 23, 2018, 10:09:14 pm
Noooooooooooooooo, please don't. ;)

https://forum.opnsense.org/index.php?topic=8700.0


Cheers,
Franco
Title: Re: WebDav backups
Post by: fabian on May 24, 2018, 05:21:50 pm
Totally forgot about this. Sometimes it is hard to do something differently than you always did before ;)
Title: Re: WebDav backups
Post by: franco on May 24, 2018, 10:23:10 pm
pkg-install for devel hasn't worked ever since...err.. 16.7.3

https://github.com/opnsense/changelog/blob/a4008b74e0315b1fd9fda7ef042ec7e297237a77/doc/16.7/16.7.3#L20-L21

The porcelain command changed to...

# opnsense-update -t opnsense-devel

But with the addition in the GUI it may revert to the state that is selected in the GUI, aligning it with how everything else works in this general area. :)


Cheers,
Franco
Title: Re: WebDav backups
Post by: akron on May 25, 2018, 05:10:28 pm
Totally forgot about this. Sometimes it is hard to do something differently than you always did before ;)

Thank you working great

Cheers
Title: Re: WebDav backups
Post by: fabian on May 25, 2018, 05:37:23 pm
Before I forget it. Like almost all my OPNsense code, it has basic user documentation:
https://docs.opnsense.org/manual/how-tos/cloud_backup.html#setup-nextcloud-api-usage (https://docs.opnsense.org/manual/how-tos/cloud_backup.html#setup-nextcloud-api-usage)