Help needed with WebDAV script

Advertisement

nabil.asif
Joined:
Posts:
1
Location:
London, England, United Kingdom

Help needed with WebDAV script

Hi!

I've been trying to set a daily task to do a one-way sync from a WebDAV URL to a local folder. But log file gives me a
405 Method Not Allowed
authentication error which I cannot figure why it is being caused.

Any insights would be highly appreciated!

This is the script that I'm trying to execute (generated using GUI):
/log="C:\PerfLogs\sync_log2.log"/ini=nul /command "open davs://username:password@share.site.com/ -certificate=""xx:xx:xx:xx:xx:xx:xx:xx:xx""" "synchronize local C:\Users\path_to_folder\raw_data /remote.php/dav/files/USERNAME/Reports" "exit"

But it doesn't Sync. This is the log report which I've anonymized

. 2021-02-12 16:26:35.764 --------------------------------------------------------------------------
. 2021-02-12 16:26:35.764 WinSCP Version 5.17.10 (Build 11087) (OS 10.0.18363 - Windows 10 Enterprise)
. 2021-02-12 16:26:35.764 Configuration: nul
. 2021-02-12 16:26:35.764 Log level: Normal
. 2021-02-12 16:26:35.764 Local account: USERID
. 2021-02-12 16:26:35.764 Working directory: C:\WINDOWS\system32
. 2021-02-12 16:26:35.765 Process ID: 29504
. 2021-02-12 16:26:35.765 Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe" /log="C:\PerfLogs\sync_log2.log" /ini=nul /command "see above"
. 2021-02-12 16:26:35.765 Time zone: Current: GMT+0, Standard: GMT+0 (GMT Standard Time), DST: GMT+1 (GMT Daylight Time), DST Start: 28/03/2021, DST End: 31/10/2021
. 2021-02-12 16:26:35.766 Login time: 12 February 2021 16:26:35
. 2021-02-12 16:26:35.766 --------------------------------------------------------------------------
. 2021-02-12 16:26:35.766 Script: Retrospectively logging previous script records:
> 2021-02-12 16:26:35.766 Script: open davs://username:***@share.site.com/ -certificate="xx:xx:xx:xx"
. 2021-02-12 16:26:35.766 --------------------------------------------------------------------------
. 2021-02-12 16:26:35.766 Session name: username@share.site.com (Ad-Hoc site)
. 2021-02-12 16:26:35.766 Host name: share.site.com (Port: 443)
. 2021-02-12 16:26:35.766 User name: USERNAME (Password: Yes, Key file: No, Passphrase: No)
. 2021-02-12 16:26:35.766 Transfer Protocol: WebDAV
. 2021-02-12 16:26:35.766 Proxy: None
. 2021-02-12 16:26:35.766 HTTPS: Yes [Client certificate: No]
. 2021-02-12 16:26:35.766 TLS/SSL versions: TLSv1.0-TLSv1.2
. 2021-02-12 16:26:35.766 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2021-02-12 16:26:35.766 Cache directory changes: Yes, Permanent: Yes
. 2021-02-12 16:26:35.766 Recycle bin: Delete to: No, Overwritten to: No, Bin path: 
. 2021-02-12 16:26:35.766 DST mode: Unix
. 2021-02-12 16:26:35.766 Compression: No
. 2021-02-12 16:26:35.766 --------------------------------------------------------------------------
. 2021-02-12 16:26:35.766 HTTP session to https://share.site.com:443 begins.
. 2021-02-12 16:26:35.767 ssl: SNI enabled by default.
. 2021-02-12 16:26:35.767 ah_create, for WWW-Authenticate
. 2021-02-12 16:26:35.767 Sending request headers:
. 2021-02-12 16:26:35.767 OPTIONS / HTTP/1.1
 
. 2021-02-12 16:26:35.767 User-Agent: WinSCP/5.17.10 neon/0.31.1
 
. 2021-02-12 16:26:35.767 Keep-Alive: 
 
. 2021-02-12 16:26:35.767 Connection: TE, Keep-Alive
 
. 2021-02-12 16:26:35.767 TE: trailers
 
. 2021-02-12 16:26:35.767 Host: share.site.com
. 2021-02-12 16:26:35.767 Sending request-line and headers:
. 2021-02-12 16:26:35.767 Doing DNS lookup on share.site.com...
. 2021-02-12 16:26:35.789 req: Connecting to 62.204.xx.xx:443
. 2021-02-12 16:26:35.813 Doing SSL negotiation.
. 2021-02-12 16:26:35.859 Identity match for 'share.site.com': good
. 2021-02-12 16:26:35.859 Verifying certificate for "share.site.com" with fingerprint XX:XX:XX:XX:XX:XX:XX and 08 failures
. 2021-02-12 16:26:35.860 Certificate for "share.site.com" matches configured fingerprint
. 2021-02-12 16:26:35.860 Using TLSv1.2, cipher TLSv1.2: ECDHE-RSA-AES256-GCM-SHA384, 2048 bit RSA
. 2021-02-12 16:26:35.860 Request sent; retry is 0.
. 2021-02-12 16:26:36.045 [status-line] < HTTP/1.1 302 Found
. 2021-02-12 16:26:36.046 Header Name: [date], Value: [Fri, 12 Feb 2021 16:26:36 GMT]
. 2021-02-12 16:26:36.046 Header Name: [server], Value: [Apache/2.4.41 (Ubuntu)]
. 2021-02-12 16:26:36.046 Header Name: [strict-transport-security], Value: [max-age=63072000;]
. 2021-02-12 16:26:36.046 Header Name: [referrer-policy], Value: [no-referrer]
. 2021-02-12 16:26:36.046 Header Name: [x-content-type-options], Value: [nosniff]
. 2021-02-12 16:26:36.046 Header Name: [x-download-options], Value: [noopen]
. 2021-02-12 16:26:36.046 Header Name: [x-frame-options], Value: [SAMEORIGIN]
. 2021-02-12 16:26:36.046 Header Name: [x-permitted-cross-domain-policies], Value: [none]
. 2021-02-12 16:26:36.046 Header Name: [x-robots-tag], Value: [none]
. 2021-02-12 16:26:36.046 Header Name: [x-xss-protection], Value: [1; mode=block]
. 2021-02-12 16:26:36.046 Header Name: [expires], Value: [Thu, 19 Nov 1981 08:52:00 GMT]
. 2021-02-12 16:26:36.046 Header Name: [cache-control], Value: [no-store, no-cache, must-revalidate]
. 2021-02-12 16:26:36.046 Header Name: [pragma], Value: [no-cache]
. 2021-02-12 16:26:36.046 Header Name: [content-security-policy], Value: [default-src 'self'; script-src 'self' 'nonce-xxxxxx='; style-src 'self' 'unsafe-inline'; frame-src *; img-src * data: blob:; font-src 'self' data:; media-src *; connect-src *; object-src 'none'; base-uri 'self';]
. 2021-02-12 16:26:36.046 Header Name: [location], Value: [https://share.site.com/index.php/login]
. 2021-02-12 16:26:36.046 Header Name: [content-length], Value: [0]
. 2021-02-12 16:26:36.046 Header Name: [content-type], Value: [text/html; charset=UTF-8]
. 2021-02-12 16:26:36.046 Header Name: [set-cookie], Value: [oc7bontmbpit=oihhsb1lb5e3g3ue0qvg488uie; path=/; secure; HttpOnly; SameSite=Lax]
. 2021-02-12 16:26:36.046 Header Name: [set-cookie], Value: [oc_sessionPassphrase=xxxx; path=/; secure; HttpOnly; SameSite=Lax]
. 2021-02-12 16:26:36.046 Header Name: [set-cookie], Value: [__Host-nc_sameSiteCookielax=true; path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=lax]
. 2021-02-12 16:26:36.046 Header Name: [set-cookie], Value: [__Host-nc_sameSiteCookiestrict=true; path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=strict]
. 2021-02-12 16:26:36.046 Header Name: [keep-alive], Value: [timeout=5, max=100]
. 2021-02-12 16:26:36.046 Header Name: [connection], Value: [Keep-Alive]
. 2021-02-12 16:26:36.046 End of headers.
. 2021-02-12 16:26:36.046 Request ends, status 302 class 3xx, error line:
. 2021-02-12 16:26:36.046 302 Found
. 2021-02-12 16:26:36.046 Request ends.
. 2021-02-12 16:26:36.046 Redirected to "https://share.site.com/index.php/login".
. 2021-02-12 16:26:36.046 sess: Destroying session.
. 2021-02-12 16:26:36.046 sess: Closing connection.
. 2021-02-12 16:26:36.046 sess: Connection closed.
. 2021-02-12 16:26:36.046 HTTP session to https://share.site.com:443 begins.
. 2021-02-12 16:26:36.046 ssl: SNI enabled by default.
. 2021-02-12 16:26:36.046 ah_create, for WWW-Authenticate
. 2021-02-12 16:26:36.046 Sending request headers:
. 2021-02-12 16:26:36.046 OPTIONS /index.php/login HTTP/1.1
 
. 2021-02-12 16:26:36.046 User-Agent: WinSCP/5.17.10 neon/0.31.1
 
. 2021-02-12 16:26:36.046 Keep-Alive: 
 
. 2021-02-12 16:26:36.046 Connection: TE, Keep-Alive
 
. 2021-02-12 16:26:36.046 TE: trailers
 
. 2021-02-12 16:26:36.046 Host: share.site.com
. 2021-02-12 16:26:36.046 Sending request-line and headers:
. 2021-02-12 16:26:36.046 Doing DNS lookup on share.site.com...
. 2021-02-12 16:26:36.047 req: Connecting to 62.204.xx.xx:443
. 2021-02-12 16:26:36.062 Doing SSL negotiation.
. 2021-02-12 16:26:36.098 Identity match for 'share.site.com': good
. 2021-02-12 16:26:36.098 Verifying certificate for "share.site.com" with fingerprint XX:XX:XX:XX:XX:XX:XX and 08 failures
. 2021-02-12 16:26:36.098 Certificate for "share.site.com" matches configured fingerprint
. 2021-02-12 16:26:36.098 Using TLSv1.2, cipher TLSv1.2: ECDHE-RSA-AES256-GCM-SHA384, 2048 bit RSA
. 2021-02-12 16:26:36.098 Request sent; retry is 0.
. 2021-02-12 16:26:36.267 [status-line] < HTTP/1.1 302 Found
. 2021-02-12 16:26:36.267 Header Name: [date], Value: [Fri, 12 Feb 2021 16:26:36 GMT]
. 2021-02-12 16:26:36.267 Header Name: [server], Value: [Apache/2.4.41 (Ubuntu)]
. 2021-02-12 16:26:36.267 Header Name: [strict-transport-security], Value: [max-age=63072000;]
. 2021-02-12 16:26:36.267 Header Name: [referrer-policy], Value: [no-referrer]
. 2021-02-12 16:26:36.267 Header Name: [x-content-type-options], Value: [nosniff]
. 2021-02-12 16:26:36.267 Header Name: [x-download-options], Value: [noopen]
. 2021-02-12 16:26:36.267 Header Name: [x-frame-options], Value: [SAMEORIGIN]
. 2021-02-12 16:26:36.267 Header Name: [x-permitted-cross-domain-policies], Value: [none]
. 2021-02-12 16:26:36.267 Header Name: [x-robots-tag], Value: [none]
. 2021-02-12 16:26:36.267 Header Name: [x-xss-protection], Value: [1; mode=block]
. 2021-02-12 16:26:36.267 Header Name: [expires], Value: [Thu, 19 Nov 1981 08:52:00 GMT]
. 2021-02-12 16:26:36.267 Header Name: [cache-control], Value: [no-store, no-cache, must-revalidate]
. 2021-02-12 16:26:36.267 Header Name: [pragma], Value: [no-cache]
. 2021-02-12 16:26:36.267 Header Name: [content-security-policy], Value: [default-src 'self'; script-src 'self' 'nonce-Nxxxxxxxx='; style-src 'self' 'unsafe-inline'; frame-src *; img-src * data: blob:; font-src 'self' data:; media-src *; connect-src *; object-src 'none'; base-uri 'self';]
. 2021-02-12 16:26:36.267 Header Name: [location], Value: [https://share.site.com/index.php/apps/user_saml/saml/selectUserBackEnd?redirectUrl=]
. 2021-02-12 16:26:36.267 Header Name: [content-length], Value: [0]
. 2021-02-12 16:26:36.267 Header Name: [content-type], Value: [text/html; charset=UTF-8]
. 2021-02-12 16:26:36.268 Header Name: [set-cookie], Value: [oc7bontmbpit=qstrje0g826qkh8po3nhe3oas4; path=/; secure; HttpOnly; SameSite=Lax]
. 2021-02-12 16:26:36.268 Header Name: [set-cookie], Value: [oc_sessionPassphrase=Bxxxxxxxs; path=/; secure; HttpOnly; SameSite=Lax]
. 2021-02-12 16:26:36.268 Header Name: [set-cookie], Value: [__Host-nc_sameSiteCookielax=true; path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=lax]
. 2021-02-12 16:26:36.268 Header Name: [set-cookie], Value: [__Host-nc_sameSiteCookiestrict=true; path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=strict]
. 2021-02-12 16:26:36.268 Header Name: [keep-alive], Value: [timeout=5, max=100]
. 2021-02-12 16:26:36.268 Header Name: [connection], Value: [Keep-Alive]
. 2021-02-12 16:26:36.268 End of headers.
. 2021-02-12 16:26:36.268 Request ends, status 302 class 3xx, error line:
. 2021-02-12 16:26:36.268 302 Found
. 2021-02-12 16:26:36.268 Request ends.
. 2021-02-12 16:26:36.268 Redirected to "https://share.site.com/index.php/apps/user_saml/saml/selectUserBackEnd?redirectUrl=".
. 2021-02-12 16:26:36.268 sess: Destroying session.
. 2021-02-12 16:26:36.268 sess: Closing connection.
. 2021-02-12 16:26:36.268 sess: Connection closed.
. 2021-02-12 16:26:36.268 HTTP session to https://share.site.com:443 begins.
. 2021-02-12 16:26:36.268 ssl: SNI enabled by default.
. 2021-02-12 16:26:36.268 ah_create, for WWW-Authenticate
. 2021-02-12 16:26:36.268 Sending request headers:
. 2021-02-12 16:26:36.268 OPTIONS /index.php/apps/user_saml/saml/selectUserBackEnd HTTP/1.1
 
. 2021-02-12 16:26:36.268 User-Agent: WinSCP/5.17.10 neon/0.31.1
 
. 2021-02-12 16:26:36.268 Keep-Alive: 
 
. 2021-02-12 16:26:36.268 Connection: TE, Keep-Alive
 
. 2021-02-12 16:26:36.268 TE: trailers
 
. 2021-02-12 16:26:36.268 Host: share.site.com
. 2021-02-12 16:26:36.268 Sending request-line and headers:
. 2021-02-12 16:26:36.268 Doing DNS lookup on share.site.com...
. 2021-02-12 16:26:36.269 req: Connecting to 62.204.xx.xx:443
. 2021-02-12 16:26:36.286 Doing SSL negotiation.
. 2021-02-12 16:26:36.327 Identity match for 'share.site.com': good
. 2021-02-12 16:26:36.327 Verifying certificate for "share.site.com" with fingerprint XX:XX:XX:XX:XX:XX:XX and 08 failures
. 2021-02-12 16:26:36.327 Certificate for "share.site.com" matches configured fingerprint
. 2021-02-12 16:26:36.327 Using TLSv1.2, cipher TLSv1.2: xxxx-SHA384, 2048 bit RSA
. 2021-02-12 16:26:36.327 Request sent; retry is 0.
. 2021-02-12 16:26:36.505 [status-line] < HTTP/1.1 405 Method Not Allowed
. 2021-02-12 16:26:36.505 Header Name: [date], Value: [Fri, 12 Feb 2021 16:26:36 GMT]
. 2021-02-12 16:26:36.505 Header Name: [server], Value: [Apache/2.4.41 (Ubuntu)]
. 2021-02-12 16:26:36.505 Header Name: [strict-transport-security], Value: [max-age=63072000;]
. 2021-02-12 16:26:36.505 Header Name: [referrer-policy], Value: [no-referrer]
. 2021-02-12 16:26:36.505 Header Name: [x-content-type-options], Value: [nosniff]
. 2021-02-12 16:26:36.505 Header Name: [x-download-options], Value: [noopen]
. 2021-02-12 16:26:36.505 Header Name: [x-frame-options], Value: [SAMEORIGIN]
. 2021-02-12 16:26:36.505 Header Name: [x-permitted-cross-domain-policies], Value: [none]
. 2021-02-12 16:26:36.505 Header Name: [x-robots-tag], Value: [none]
. 2021-02-12 16:26:36.505 Header Name: [x-xss-protection], Value: [1; mode=block]
. 2021-02-12 16:26:36.505 Header Name: [expires], Value: [Thu, 19 Nov 1981 08:52:00 GMT]
. 2021-02-12 16:26:36.505 Header Name: [cache-control], Value: [no-store, no-cache, must-revalidate]
. 2021-02-12 16:26:36.505 Header Name: [pragma], Value: [no-cache]
. 2021-02-12 16:26:36.505 Header Name: [content-security-policy], Value: [default-src 'self'; script-src 'self' 'nonce-xxxx='; style-src 'self' 'unsafe-inline'; frame-src *; img-src * data: blob:; font-src 'self' data:; media-src *; connect-src *; object-src 'none'; base-uri 'self';]
. 2021-02-12 16:26:36.505 Header Name: [content-length], Value: [0]
. 2021-02-12 16:26:36.505 Header Name: [content-type], Value: [text/html; charset=UTF-8]
. 2021-02-12 16:26:36.505 Header Name: [set-cookie], Value: [oxxxx; path=/; secure; HttpOnly; SameSite=Lax]
. 2021-02-12 16:26:36.505 Header Name: [set-cookie], Value: [oc_sessionPassphrase=2NY6CxxxxIo; path=/; secure; HttpOnly; SameSite=Lax]
. 2021-02-12 16:26:36.505 Header Name: [set-cookie], Value: [__Host-nc_sameSiteCookielax=true; path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=lax]
. 2021-02-12 16:26:36.505 Header Name: [set-cookie], Value: [__Host-nc_sameSiteCookiestrict=true; path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=strict]
. 2021-02-12 16:26:36.505 Header Name: [keep-alive], Value: [timeout=5, max=100]
. 2021-02-12 16:26:36.505 Header Name: [connection], Value: [Keep-Alive]
. 2021-02-12 16:26:36.505 End of headers.
. 2021-02-12 16:26:36.505 ah_post_send (#0), code is 405 (want 401), WWW-Authenticate is (none)
. 2021-02-12 16:26:36.505 Request ends, status 405 class 4xx, error line:
. 2021-02-12 16:26:36.505 405 Method Not Allowed
. 2021-02-12 16:26:36.505 Request ends.
. 2021-02-12 16:26:36.505 sess: Destroying session.
. 2021-02-12 16:26:36.505 sess: Closing connection.
. 2021-02-12 16:26:36.505 sess: Connection closed.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
35,190
Location:
Prague, Czechia

Re: Help needed with WebDAV script

This does not look like a pure WebDAV server. It seems that the server redirects to some web-based login portal. Can you login to your server using any other WebDAV client?

Reply with quote

Advertisement

You can post new topics in this forum