{{tag>Brouillon HTTP Web}} # Notes Webdav * https://linuxfr.org/news/webdav-manager-un-client-webdav-ultra-leger-en-js * https://blog.skullsecurity.org/2009/webdav-detection-vulnerability-checking-and-exploitation * http://www.cs.unibo.it/~fabio/webdav/WebDAV.pdf * http://bernaerts.dyndns.org/linux/75-debian/62-debian-webdav-share * http://www.tldp.org/pub/Linux/docs/HOWTO/translations/fr/html-1page/Apache-WebDAV-LDAP-HOWTO.html * http://www.agoragames.com/blog/2009/03/ * http://nginx.org/en/docs/http/ngx_http_dav_module.html * https://gist.github.com/dysinger/269688 * http://www.agoragames.com/blog/2009/03/20/webdav-nginx-play-nice/ * http://manual.seafile.com/extension/webdav.html * http://www.monkeysnatchbanana.com/2010/10/05/setting-up-a-monticello-repository-using-nginx/ Voir : * https://fr.wikipedia.org/wiki/Pydio ## Serveur Voir : * [[Notes rclone]] * [KaraDAV](https://linuxfr.org/news/karadav-un-serveur-webdav-leger-compatible-avec-les-applications-owncloud-et-nextcloud) Vérifier que votre serveur implémente implémente correctement le protocole Webdav avec Litmus WebDAV server protocol compliance test suite * http://www.webdav.org/neon/litmus/ ### Nginx Voir `proxy_request_buffering off;` ~~~bash apt-get install nginx-full ~~~ `/etc/nginx/sites-available/webdav` ~~~nginx server { listen 80; server_name webdav.acme.fr; access_log /var/log/nginx/webdav-access.log; error_log /var/log/nginx/webdav-error.log; autoindex on; charset utf-8; client_max_body_size 10M; location / { root /var/www/webdav; #client_body_temp_path /var/www/webdav-tmp; dav_methods PUT DELETE MKCOL COPY MOVE; dav_ext_methods PROPFIND OPTIONS; #auth_basic_user_file $HOME/.htpasswd; #min_delete_depth 0; #auth_basic "Restricted"; #auth_basic_user_file /etc/nginx/webdav.htpasswd; create_full_put_path on; dav_access user:rw group:rw all:r; limit_except GET { allow 192.168.1.22; allow all; #deny all; } } } ~~~ ### davserver (python) Voir : * http://nilvec.com/nginx-and-git-via-http.html * http://stephane-klein.info/blog/2009/08/19/un-serveur-webdav-en-python-base-sur-wsgi-etat-des-lieux-pywebdav-et-wsgidav/ ~~~bash #sudo apt-get install python3-webdav python3 -m pip install PyWebDAV3 ~~~ `config.ini` ~~~ini [DAV] #baseurl = baseurl = https://dav.acme.fr # Verbose? # verbose enabled is like loglevel = INFO verbose = 1 #log level : DEBUG, INFO, WARNING, ERROR, CRITICAL (Default is WARNING) #loglevel = WARNING # main directory directory = /var/www/webdav # Server address port = 8082 host = localhost # disable auth noauth = 1 # Enable mysql auth mysql_auth=0 # admin user user = test password = test00 # daemonize? daemonize = 0 daemonaction = start # instance counter counter = 0 # mimetypes support #mimecheck = 1 mimecheck = 0 # webdav level (1 = webdav level 2) lockemulation = 1 # internal features #chunked_http_response = 1 #http_request_use_iterator = 0 #http_response_use_iterator = 0 ~~~ ~~~bash su - www-data davserver -c config.ini ~~~ ### Weborf - Le serveur ultra léger https://github.com/ltworf/weborf/blob/master/examples/auth.py ~~~bash apt-get install weborf ~~~ ~~~bash python /usr/share/doc/weborf/examples/auth.py chmod 777 /tmp/weborf_auth.socket ~~~ ~~~bash iptables -A INPUT -i eth0 -p tcp -m tcp --dport 8083 -j REJECT iptables-save > /etc/iptables/rules.v4 ~~~ ## Client Voir : * [[Notes rclone]] * [[Notes client FTP lftp]] davfs2 http://doc.ubuntu-fr.org/davfs2 ~~~bash cadaver https://webdav.acme.fr ~~~ Pour ne pas taper le mdp à chaque fois `~/.netrc` ~~~ini default login myusername password P@ssw0rd machine webdav.acme.fr login myusername password P@ssw0rd ~~~ ~~~bash chmod 600 ~/.netrc ~~~ Voir `man netrc` Exemple de fichier conf (commandes lancées automatique au démarrage de cadaver) `~/.cadaverrc` ~~~ set editor vim set pager less set tolerant cd home ~~~ ### WDFS Voir aussi : * [udevil](http://ignorantguru.github.io/udevil/) Ajout de l'utilisateur "jean" au groupe "fuse" Apparement pas nécessaire si fuse est installé alors qu'il n'existe pas de compte "fuse" Est-ce lié à systemd ? ~~~bash adduser jean fuse ~~~ Montage (dans un dossier vide) \\ Exemples : ~~~bash mkdir -p ~/mnt/wd-partage wdfs -o username=utilisateur -o password=MDP_En_Clair https://webdav.acme.fr/partage ~/mnt/wd-partage ~~~ Pour démonter ~~~bash fusermount -u ~/mnt/ ~~~ ## Protocole ### Curl Faut-il préciser le `Content-Type` ? ~~~bash curl -XPROPFIND https://user:pass@dav.acme.fr/ -H "Depth:infinity" | xmllint --format - curl --request PROPFIND --user user:pass --header "Content-Type: text/xml" --header "Brief:t" --data "" https://dav.acme.fr/ curl -X PROPFIND -H "Content-Type: text/xml" http://USER:PASSWORD@HOST/owncloud/remote.php/webdav/FOLDER | xmllint --format - ~~~ Envoyer un fichier ~~~bash curl -X PUT https://webdav.server/dir/file.txt -d @~/file.txt ~~~ Déplacer un fichier ~~~bash curl -X MOVE -H 'Destination: https://webdav.server/dir/file2.txt' https://webdav.server/dir/file.txt ~~~ Juste un bout d'un fichier grâce à `Content-Range` ~~~bash curl -H 'Content-Range: bytes 10-20/*' https://webdav.server/dir.file.txt ~~~