📜 ⬆️ ⬇️

DLink DNS-325 - we connect cloud storages via WebDav

I remember a long time ago I wrote an article about the remarkable possibilities for expanding NAS's DNS-325 functionality , and complained in an article that, they say, it’s not a damn thing to have WebDAV on it for connecting, for example, Yandex.Disk. But recently it has turned out in some way , with the help of wwwalex , which prompted a trick with editing the source code. Details under the cut!

Important. It is understood that you have already installed and configured fun_plug , if not - see my first article .

  1. First, update the libraries and install important applications.
    ipkg update ipkg install neon gcc optware-devel 

  2. Next - download and unpack to any directory on the NAS davfs2, at the time of this writing this is version 1.4.7
     wget http://mirrors.zerg.biz/nongnu/davfs2/davfs2-1.4.7.tar.gz tar -xzf davfs2-1.4.7.tar.gz 

  3. Next, we do a very tough and dangerous thing - we edit the source code of the application, disabling the validation of the server certificate. In fact, you can not do so, and download the appropriate certificate for each service, then connect it, follow its updates ... But I did not figure out how to do it with a minimum of problems, but according to this we are on the path of least resistance.
    We will edit the file src / webdav.c , and specifically - the last line in the ssl_verify function changing return ret to return 0



  4. Compile and install webdav2
     ./configure --prefix=/opt --with-neon=/opt && make && make install 

  5. Installed. Now through the NAS web interface we create user davfs2 and user group davfs2
     groupadd davfs2 useradd -g davfs2 davfs2 

  6. Configure settings in the /opt/etc/davfs2/davfs2.conf file
    In particular, we put ask_auth 0
    ')


    And cache_dir , for example / mnt / HD / HD_a2 / cache_webdav2
    (the main thing is not to forget to create the folder cache_webdav2 and give it rights to the user davfs2 )



  7. We register the login and password for the desired service, for example, Yandex.Disk in the / opt / etc / davfs2 / secrets file
    as
     _ LOGIN  



  8. Now we can mount the screw, for example, such a command
     /opt/sbin/mount.davfs https://webdav.yandex.ru /mnt/HD/HD_a2/yandex 

    Moreover, the folder / mnt / HD / HD_a2 / yandex first needs to be created (and give it the rights to the corresponding user).

  9. You can disable the storage by the command
     /opt/sbin/umount.davfs /mnt/HD/HD_a2/yandex 

    Result:





And it would seem that the bright future has come, the files from the Yandex.disk in the folder are visible, the five-year plan in 3 years and no one leaves offended? Not really. Reading files is normal. But writing large files or a large number of small files goes something like this:

  1. The file is quickly and quickly copied to a temporary folder.
  2. The webdav2 process stops responding. Now you cannot go into folders with mounted remote repositories (you can, but it hangs when trying to get a list of files).

At the same time, the process actually works in the background, and when files are loaded into the storage, the mounted storage will begin to respond. Maybe I did not understand something, or I need to play around with some parameters. A similar problem pops up on the forums, but I did not find a complete solution to it.
However, there are reviews and such that the process hangs tight, i.e. loads nothing. True, he did not come across it.

Links


Source: https://habr.com/ru/post/179323/


All Articles