{"id":120,"date":"2012-10-02T00:11:01","date_gmt":"2012-10-01T23:11:01","guid":{"rendered":"http:\/\/cyber-cottage.co.uk\/en\/?p=120"},"modified":"2014-10-29T09:42:08","modified_gmt":"2014-10-29T09:42:08","slug":"installing-webdav-on-centos-with-untrusted-ssl-certificates","status":"publish","type":"post","link":"https:\/\/www.cyber-cottage.co.uk\/?p=120","title":{"rendered":"Installing Webdav on Centos with untrusted ssl certificates"},"content":{"rendered":"<p><strong>Webdav (Web-based Distributed Authoring and Versioning)<\/strong>\u00a0is a set of methods based on the Hypertext Transfer Protocol (HTTP) that facilitates collaboration between users in editing and managing documents and files stored on World Wide Web servers.This can be useful to allow backing up of data between servers. In Linux there is a command line client called cadaver that in theory allows you to script its use.<\/p>\n<p>This isnt as staight forward as it could have been and we spent half a day and a lot of Googling to get to the bottom of common problems, Such as auto loging in, Untrusted ssl certificates and scripting.<\/p>\n<p>So here is a simple run down on what you have to do to script with webdav and cadaver<\/p>\n<p>Install cadaver<\/p>\n<p><strong>yum install cadaver<\/strong><\/p>\n<p>once installed you will need to install the certificate for the untrusted ssl site<\/p>\n<p>for example<br \/>\n<strong>wget http:\/\/website\/untrusted.server.com.cer<\/strong><br \/>\nnow convert this to a .pem file<br \/>\n<strong>openssl x509 -inform der -in untrusted.server.com.cer -out untrusted.server.com.pem<\/strong><\/p>\n<p>now add this to your cert.pem file.<\/p>\n<p>in centos this seems to be in the\u00a0 \/usr\/share\/ssl\/ directory<br \/>\n<strong>cat untrusted.server.com.pem &gt;&gt; \/usr\/share\/ssl\/cert.pem<\/strong><\/p>\n<p>you now need to edit the .\/netrc file with the server and logon details<br \/>\n<strong>vi ~\/.netrc<\/strong><\/p>\n<p><em>machine untrusted.server.com<br \/>\nlogin\u00a0\u00a0 user<br \/>\npassword\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 secret<\/em><\/p>\n<p>save the file.<\/p>\n<p>now when you connect you wont be promted for accepting the certificate or a username and password<\/p>\n<p><strong>cadaver -et\u00a0 https:\/\/untrusted.server.com<\/strong><br \/>\n<strong>dav:\/&gt;<\/strong><\/p>\n<p>Ok now we want to script the actions.<br \/>\nThis is as simple as creating a script file.<\/p>\n<p>for example<\/p>\n<p><strong>vi ~\/.cadavscript<\/strong><br \/>\n<em>ls<br \/>\npwd<br \/>\nquit<\/em><\/p>\n<p>will give the following output<\/p>\n<p><strong>cadaver -et\u00a0 https:\/\/untrusted.server.com\/ &lt; ~\/.cadavscript<\/strong><br \/>\n<em>dav:\/&gt; Listing collection `\/&#8217;: succeeded.<br \/>\ntest.txt\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 35\u00a0 Aug 19 15:04<br \/>\ndav:\/&gt; Current collection is `https:\/\/untrusted.server.com\/&#8217;.<br \/>\ndav:\/&gt; Connection to `untrusted.server.com&#8217; closed.<\/em><\/p>\n<p>So create a script to do what you want and your done<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Webdav (Web-based Distributed Authoring and Versioning)\u00a0is a set of methods based on the Hypertext Transfer Protocol (HTTP) that facilitates collaboration between users in editing and managing documents and files stored on World Wide Web servers.This can be useful to allow backing up of data between servers. In Linux there is a command line client called [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"content-type":"","advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[11,7],"tags":[23,29,30,51,73,100],"class_list":["post-120","post","type-post","status-publish","format-standard","hentry","category-knowledge","category-technical","tag-asterisk","tag-chrome","tag-crm","tag-linux","tag-support","tag-technical"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p5daZy-1W","jetpack_sharing_enabled":true,"jetpack_likes_enabled":false,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.cyber-cottage.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/120","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cyber-cottage.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cyber-cottage.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cyber-cottage.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cyber-cottage.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=120"}],"version-history":[{"count":1,"href":"https:\/\/www.cyber-cottage.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/120\/revisions"}],"predecessor-version":[{"id":1371,"href":"https:\/\/www.cyber-cottage.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/120\/revisions\/1371"}],"wp:attachment":[{"href":"https:\/\/www.cyber-cottage.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=120"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cyber-cottage.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=120"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cyber-cottage.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=120"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}