[SOLVED] Some files gives 503 error at web server (Bad Signature)

Nextcloud version (eg, 12.0.2): 18.0.3
Operating system and version (eg, Ubuntu 17.04): Archlinux
Apache or nginx version (eg, Apache 2.4.25): tried with Apache 2.4.41 and Nginx 1.16.1
PHP version (eg, 7.1): 7.4.4

The issue you are facing:
Some of the files inside a couple of folders can not be accessed, client doesn’t download them (it gives error). From web interface server returns a 503 error, but in data dir I saw them and they seems ok.

For example this file:

[root@server 1- Conociendo a mis amigos]# pwd
/path/nextcloud/data/myusername/files/aARCHIVADO ANTERIOR/opos AL 2017/programacion/PROGRAMACION DEFENSA/Unidades didácticas/1- Conociendo a mis amigos
[root@server 1- Conociendo a mis amigos]# ls -l ficha\ del\ PA.doc 
-rw-r--r-- 1 http http 68352 Nov  8  2016 'ficha del PA.doc'

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Try to download some files
  2. Web server gives error 503
  3. No file is retrieved

The output of your Nextcloud log in Admin > Logging:

This is the output of my nextcloud.log when I try to open the file:

{"reqId":"UFKl0xv9JI3l4RoC7lKn","level":4,"time":"March 27, 2020 14:07:32","remoteAddr":"xxx.xxx.xxx.xxx","user":"myusername","app":"webdav","method":"GET","url":"/remote.php/webdav/aARCHIVADO%20ANTERIOR/opos%20AL%202017/programacion/PROGRAMACION%20DEFENSA/Unidades%20did%C3%A1cticas/1-%20Conociendo%20a%20mis%20amigos/ficha%20del%20PA.doc","message":{"Exception":"OCP\\Encryption\\Exceptions\\GenericEncryptionException","Message":"Bad Signature","Code":0,"Trace":[{"file":"/usr/share/webapps/nextcloud/apps/encryption/lib/Crypto/Crypt.php","line":468,"function":"checkSignature","class":"OCA\\Encryption\\Crypto\\Crypt","type":"->"},{"file":"/usr/share/webapps/nextcloud/apps/encryption/lib/Crypto/Encryption.php","line":380,"function":"symmetricDecryptFileContent","class":"OCA\\Encryption\\Crypto\\Crypt","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/Files/Stream/Encryption.php","line":507,"function":"decrypt","class":"OCA\\Encryption\\Crypto\\Encryption","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/usr/share/webapps/nextcloud/lib/private/Files/Stream/Encryption.php","line":302,"function":"readCache","class":"OC\\Files\\Stream\\Encryption","type":"->"},{"function":"stream_read","class":"OC\\Files\\Stream\\Encryption","type":"->"},{"file":"/usr/share/webapps/nextcloud/apps/files_external/3rdparty/icewind/streams/src/Wrapper.php","line":91,"function":"fread"},{"file":"/usr/share/webapps/nextcloud/apps/files_external/3rdparty/icewind/streams/src/CallbackWrapper.php","line":98,"function":"stream_read","class":"Icewind\\Streams\\Wrapper","type":"->"},{"function":"stream_read","class":"Icewind\\Streams\\CallbackWrapper","type":"->"},{"file":"/usr/share/webapps/nextcloud/3rdparty/sabre/http/lib/Sapi.php","line":80,"function":"stream_copy_to_stream"},{"file":"/usr/share/webapps/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":498,"function":"sendResponse","class":"Sabre\\HTTP\\Sapi","type":"::"},{"file":"/usr/share/webapps/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":254,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/usr/share/webapps/nextcloud/apps/dav/appinfo/v1/webdav.php","line":82,"function":"exec","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/usr/share/webapps/nextcloud/remote.php","line":165,"args":["/usr/share/webapps/nextcloud/apps/dav/appinfo/v1/webdav.php"],"function":"require_once"}],"File":"/usr/share/webapps/nextcloud/apps/encryption/lib/Crypto/Crypt.php","Line":492,"Hint":"Firma err\u00f3nea","CustomMessage":"--"},"userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36","version":"18.0.3.0"}
{"reqId":"UFKl0xv9JI3l4RoC7lKn","level":3,"time":"March 27, 2020 14:07:32","remoteAddr":"xxx.xxx.xxx.xxx","user":"myusername","app":"no app in context","method":"GET","url":"/remote.php/webdav/aARCHIVADO%20ANTERIOR/opos%20AL%202017/programacion/PROGRAMACION%20DEFENSA/Unidades%20did%C3%A1cticas/1-%20Conociendo%20a%20mis%20amigos/ficha%20del%20PA.doc","message":{"Exception":"Symfony\\Component\\Routing\\Exception\\RouteNotFoundException","Message":"Unable to generate a URL for the named route \"calendar.view.index\" as such route does not exist.","Code":0,"Trace":[{"file":"/usr/share/webapps/nextcloud/lib/private/Route/Router.php","line":339,"function":"generate","class":"Symfony\\Component\\Routing\\Generator\\UrlGenerator","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/URLGenerator.php","line":82,"function":"generate","class":"OC\\Route\\Router","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/NavigationManager.php","line":293,"function":"linkToRoute","class":"OC\\URLGenerator","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/NavigationManager.php","line":114,"function":"init","class":"OC\\NavigationManager","type":"->"},{"file":"/usr/share/webapps/nextcloud/apps/theming/lib/ThemingDefaults.php","line":182,"function":"getAll","class":"OC\\NavigationManager","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/public/Defaults.php","line":160,"function":"getShortFooter","class":"OCA\\Theming\\ThemingDefaults","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/Template/JSConfigHelper.php","line":284,"function":"getShortFooter","class":"OCP\\Defaults","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/TemplateLayout.php","line":190,"function":"getConfig","class":"OC\\Template\\JSConfigHelper","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/legacy/template.php","line":184,"function":"__construct","class":"OC\\TemplateLayout","type":"->"},{"file":"/usr/share/webapps/nextcloud/apps/dav/lib/Files/BrowserErrorPagePlugin.php","line":98,"function":"fetchPage","class":"OC_Template","type":"->"},{"file":"/usr/share/webapps/nextcloud/apps/dav/lib/Files/BrowserErrorPagePlugin.php","line":83,"function":"generateBody","class":"OCA\\DAV\\Files\\BrowserErrorPagePlugin","type":"->"},{"function":"logException","class":"OCA\\DAV\\Files\\BrowserErrorPagePlugin","type":"->"},{"file":"/usr/share/webapps/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php","line":105,"function":"call_user_func_array"},{"file":"/usr/share/webapps/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":259,"function":"emit","class":"Sabre\\Event\\EventEmitter","type":"->"},{"file":"/usr/share/webapps/nextcloud/apps/dav/appinfo/v1/webdav.php","line":82,"function":"exec","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/usr/share/webapps/nextcloud/remote.php","line":165,"args":["/usr/share/webapps/nextcloud/apps/dav/appinfo/v1/webdav.php"],"function":"require_once"}],"File":"/usr/share/webapps/nextcloud/3rdparty/symfony/routing/Generator/UrlGenerator.php","Line":144,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36","version":"18.0.3.0"}
{"reqId":"UFKl0xv9JI3l4RoC7lKn","level":3,"time":"March 27, 2020 14:07:32","remoteAddr":"xxx.xxx.xxx.xxx","user":"myusername","app":"no app in context","method":"GET","url":"/remote.php/webdav/aARCHIVADO%20ANTERIOR/opos%20AL%202017/programacion/PROGRAMACION%20DEFENSA/Unidades%20did%C3%A1cticas/1-%20Conociendo%20a%20mis%20amigos/ficha%20del%20PA.doc","message":{"Exception":"Symfony\\Component\\Routing\\Exception\\RouteNotFoundException","Message":"Unable to generate a URL for the named route \"news.page.index\" as such route does not exist.","Code":0,"Trace":[{"file":"/usr/share/webapps/nextcloud/lib/private/Route/Router.php","line":339,"function":"generate","class":"Symfony\\Component\\Routing\\Generator\\UrlGenerator","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/URLGenerator.php","line":82,"function":"generate","class":"OC\\Route\\Router","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/NavigationManager.php","line":293,"function":"linkToRoute","class":"OC\\URLGenerator","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/NavigationManager.php","line":114,"function":"init","class":"OC\\NavigationManager","type":"->"},{"file":"/usr/share/webapps/nextcloud/apps/theming/lib/ThemingDefaults.php","line":182,"function":"getAll","class":"OC\\NavigationManager","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/public/Defaults.php","line":160,"function":"getShortFooter","class":"OCA\\Theming\\ThemingDefaults","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/Template/JSConfigHelper.php","line":284,"function":"getShortFooter","class":"OCP\\Defaults","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/TemplateLayout.php","line":190,"function":"getConfig","class":"OC\\Template\\JSConfigHelper","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/legacy/template.php","line":184,"function":"__construct","class":"OC\\TemplateLayout","type":"->"},{"file":"/usr/share/webapps/nextcloud/apps/dav/lib/Files/BrowserErrorPagePlugin.php","line":98,"function":"fetchPage","class":"OC_Template","type":"->"},{"file":"/usr/share/webapps/nextcloud/apps/dav/lib/Files/BrowserErrorPagePlugin.php","line":83,"function":"generateBody","class":"OCA\\DAV\\Files\\BrowserErrorPagePlugin","type":"->"},{"function":"logException","class":"OCA\\DAV\\Files\\BrowserErrorPagePlugin","type":"->"},{"file":"/usr/share/webapps/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php","line":105,"function":"call_user_func_array"},{"file":"/usr/share/webapps/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":259,"function":"emit","class":"Sabre\\Event\\EventEmitter","type":"->"},{"file":"/usr/share/webapps/nextcloud/apps/dav/appinfo/v1/webdav.php","line":82,"function":"exec","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/usr/share/webapps/nextcloud/remote.php","line":165,"args":["/usr/share/webapps/nextcloud/apps/dav/appinfo/v1/webdav.php"],"function":"require_once"}],"File":"/usr/share/webapps/nextcloud/3rdparty/symfony/routing/Generator/UrlGenerator.php","Line":144,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36","version":"18.0.3.0"}
{"reqId":"UFKl0xv9JI3l4RoC7lKn","level":3,"time":"March 27, 2020 14:07:32","remoteAddr":"xxx.xxx.xxx.xxx","user":"myusername","app":"no app in context","method":"GET","url":"/remote.php/webdav/aARCHIVADO%20ANTERIOR/opos%20AL%202017/programacion/PROGRAMACION%20DEFENSA/Unidades%20did%C3%A1cticas/1-%20Conociendo%20a%20mis%20amigos/ficha%20del%20PA.doc","message":{"Exception":"Symfony\\Component\\Routing\\Exception\\RouteNotFoundException","Message":"Unable to generate a URL for the named route \"photos.page.index\" as such route does not exist.","Code":0,"Trace":[{"file":"/usr/share/webapps/nextcloud/lib/private/Route/Router.php","line":339,"function":"generate","class":"Symfony\\Component\\Routing\\Generator\\UrlGenerator","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/URLGenerator.php","line":82,"function":"generate","class":"OC\\Route\\Router","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/NavigationManager.php","line":293,"function":"linkToRoute","class":"OC\\URLGenerator","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/NavigationManager.php","line":114,"function":"init","class":"OC\\NavigationManager","type":"->"},{"file":"/usr/share/webapps/nextcloud/apps/theming/lib/ThemingDefaults.php","line":182,"function":"getAll","class":"OC\\NavigationManager","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/public/Defaults.php","line":160,"function":"getShortFooter","class":"OCA\\Theming\\ThemingDefaults","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/Template/JSConfigHelper.php","line":284,"function":"getShortFooter","class":"OCP\\Defaults","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/TemplateLayout.php","line":190,"function":"getConfig","class":"OC\\Template\\JSConfigHelper","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/legacy/template.php","line":184,"function":"__construct","class":"OC\\TemplateLayout","type":"->"},{"file":"/usr/share/webapps/nextcloud/apps/dav/lib/Files/BrowserErrorPagePlugin.php","line":98,"function":"fetchPage","class":"OC_Template","type":"->"},{"file":"/usr/share/webapps/nextcloud/apps/dav/lib/Files/BrowserErrorPagePlugin.php","line":83,"function":"generateBody","class":"OCA\\DAV\\Files\\BrowserErrorPagePlugin","type":"->"},{"function":"logException","class":"OCA\\DAV\\Files\\BrowserErrorPagePlugin","type":"->"},{"file":"/usr/share/webapps/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php","line":105,"function":"call_user_func_array"},{"file":"/usr/share/webapps/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":259,"function":"emit","class":"Sabre\\Event\\EventEmitter","type":"->"},{"file":"/usr/share/webapps/nextcloud/apps/dav/appinfo/v1/webdav.php","line":82,"function":"exec","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/usr/share/webapps/nextcloud/remote.php","line":165,"args":["/usr/share/webapps/nextcloud/apps/dav/appinfo/v1/webdav.php"],"function":"require_once"}],"File":"/usr/share/webapps/nextcloud/3rdparty/symfony/routing/Generator/UrlGenerator.php","Line":144,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36","version":"18.0.3.0"}

This is the output if I try to copy with the web interface the same file to another location:

{"reqId":"kbiiRuL4vnGTnoUFXwRG","level":3,"time":"March 27, 2020 14:11:15","remoteAddr":"192.168.250.6","user":"myusername","app":"PHP","method":"GET","url":"/ocs/v2.php/apps/notifications/api/v2/notifications","message":"file_exists(): open_basedir restriction in effect. File(/var/cache/nextcloud/myusername) is not within the allowed path(s): (/usr/share/webapps/nextcloud/:/etc/webapps/nextcloud/:/var/lib/nextcloud/:/var/log/nextcloud/:/usr/lib/php/:/tmp/) at /usr/share/webapps/nextcloud/lib/private/Files/Mount/CacheMountProvider.php#59","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36","version":"18.0.3.0"}
{"reqId":"kbiiRuL4vnGTnoUFXwRG","level":3,"time":"March 27, 2020 14:11:15","remoteAddr":"192.168.250.6","user":"myusername","app":"PHP","method":"GET","url":"/ocs/v2.php/apps/notifications/api/v2/notifications","message":"mkdir(): open_basedir restriction in effect. File(/var/cache/nextcloud/myusername) is not within the allowed path(s): (/usr/share/webapps/nextcloud/:/etc/webapps/nextcloud/:/var/lib/nextcloud/:/var/log/nextcloud/:/usr/lib/php/:/tmp/) at /usr/share/webapps/nextcloud/lib/private/Files/Mount/CacheMountProvider.php#60","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36","version":"18.0.3.0"}
{"reqId":"kbiiRuL4vnGTnoUFXwRG","level":3,"time":"March 27, 2020 14:11:15","remoteAddr":"192.168.250.6","user":"myusername","app":"PHP","method":"GET","url":"/ocs/v2.php/apps/notifications/api/v2/notifications","message":"mkdir(): open_basedir restriction in effect. File(/var/cache/nextcloud/myusername/uploads) is not within the allowed path(s): (/usr/share/webapps/nextcloud/:/etc/webapps/nextcloud/:/var/lib/nextcloud/:/var/log/nextcloud/:/usr/lib/php/:/tmp/) at /usr/share/webapps/nextcloud/lib/private/Files/Mount/CacheMountProvider.php#61","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36","version":"18.0.3.0"}
{"reqId":"kbiiRuL4vnGTnoUFXwRG","level":3,"time":"March 27, 2020 14:11:15","remoteAddr":"192.168.250.6","user":"myusername","app":"PHP","method":"GET","url":"/ocs/v2.php/apps/notifications/api/v2/notifications","message":"realpath(): open_basedir restriction in effect. File(/var/cache/nextcloud/myusername) is not within the allowed path(s): (/usr/share/webapps/nextcloud/:/etc/webapps/nextcloud/:/var/lib/nextcloud/:/var/log/nextcloud/:/usr/lib/php/:/tmp/) at /usr/share/webapps/nextcloud/lib/private/Files/Storage/Local.php#70","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36","version":"18.0.3.0"}
{"reqId":"s4rBb4IEhbRWTVIi7W0R","level":3,"time":"March 27, 2020 14:11:27","remoteAddr":"xxx.xxx.xxx.xxx","user":"myusername","app":"no app in context","method":"COPY","url":"/remote.php/dav/files/myusername/aARCHIVADO%20ANTERIOR/opos%20AL%202017/programacion/PROGRAMACION%20DEFENSA/Unidades%20did%C3%A1cticas/1-%20Conociendo%20a%20mis%20amigos/ficha%20del%20PA.doc","message":{"Exception":"OCP\\Encryption\\Exceptions\\GenericEncryptionException","Message":"Bad Signature","Code":0,"Trace":[{"file":"/usr/share/webapps/nextcloud/apps/encryption/lib/Crypto/Crypt.php","line":468,"function":"checkSignature","class":"OCA\\Encryption\\Crypto\\Crypt","type":"->"},{"file":"/usr/share/webapps/nextcloud/apps/encryption/lib/Crypto/Encryption.php","line":380,"function":"symmetricDecryptFileContent","class":"OCA\\Encryption\\Crypto\\Crypt","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/Files/Stream/Encryption.php","line":507,"function":"decrypt","class":"OCA\\Encryption\\Crypto\\Encryption","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/usr/share/webapps/nextcloud/lib/private/Files/Stream/Encryption.php","line":302,"function":"readCache","class":"OC\\Files\\Stream\\Encryption","type":"->"},{"function":"stream_read","class":"OC\\Files\\Stream\\Encryption","type":"->"},{"file":"/usr/share/webapps/nextcloud/apps/files_external/3rdparty/icewind/streams/src/Wrapper.php","line":91,"function":"fread"},{"file":"/usr/share/webapps/nextcloud/apps/files_external/3rdparty/icewind/streams/src/CallbackWrapper.php","line":98,"function":"stream_read","class":"Icewind\\Streams\\Wrapper","type":"->"},{"function":"stream_read","class":"Icewind\\Streams\\CallbackWrapper","type":"->"},{"file":"/usr/share/webapps/nextcloud/apps/files_external/3rdparty/icewind/streams/src/Wrapper.php","line":91,"function":"fread"},{"file":"/usr/share/webapps/nextcloud/apps/files_external/3rdparty/icewind/streams/src/CallbackWrapper.php","line":98,"function":"stream_read","class":"Icewind\\Streams\\Wrapper","type":"->"},{"function":"stream_read","class":"Icewind\\Streams\\CallbackWrapper","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/legacy/helper.php","line":254,"function":"fread"},{"file":"/usr/share/webapps/nextcloud/lib/private/Files/Storage/Wrapper/Encryption.php","line":1038,"function":"streamCopy","class":"OC_Helper","type":"::"},{"file":"/usr/share/webapps/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php","line":630,"function":"writeStream","class":"OC\\Files\\Storage\\Wrapper\\Encryption","type":"->"},{"file":"/usr/share/webapps/nextcloud/apps/dav/lib/Connector/Sabre/File.php","line":192,"function":"writeStream","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->"},{"file":"/usr/share/webapps/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php","line":156,"function":"put","class":"OCA\\DAV\\Connector\\Sabre\\File","type":"->"},{"file":"/usr/share/webapps/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php","line":316,"function":"createFile","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->"},{"file":"/usr/share/webapps/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php","line":130,"function":"copyNode","class":"Sabre\\DAV\\Tree","type":"->"},{"file":"/usr/share/webapps/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":684,"function":"copy","class":"Sabre\\DAV\\Tree","type":"->"},{"function":"httpCopy","class":"Sabre\\DAV\\CorePlugin","type":"->"},{"file":"/usr/share/webapps/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php","line":105,"function":"call_user_func_array"},{"file":"/usr/share/webapps/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":479,"function":"emit","class":"Sabre\\Event\\EventEmitter","type":"->"},{"file":"/usr/share/webapps/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":254,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/usr/share/webapps/nextcloud/apps/dav/lib/Server.php","line":319,"function":"exec","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/usr/share/webapps/nextcloud/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->"},{"file":"/usr/share/webapps/nextcloud/remote.php","line":165,"args":["/usr/share/webapps/nextcloud/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/usr/share/webapps/nextcloud/apps/encryption/lib/Crypto/Crypt.php","Line":492,"Hint":"Firma err\u00f3nea","CustomMessage":"--"},"userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36","version":"18.0.3.0"}
{"reqId":"s4rBb4IEhbRWTVIi7W0R","level":4,"time":"March 27, 2020 14:11:27","remoteAddr":"xxx.xxx.xxx.xxx","user":"myusername","app":"webdav","method":"COPY","url":"/remote.php/dav/files/myusername/aARCHIVADO%20ANTERIOR/opos%20AL%202017/programacion/PROGRAMACION%20DEFENSA/Unidades%20did%C3%A1cticas/1-%20Conociendo%20a%20mis%20amigos/ficha%20del%20PA.doc","message":{"Exception":"Sabre\\DAV\\Exception\\ServiceUnavailable","Message":"Encryption not ready: Bad Signature","Code":0,"Trace":[{"file":"/usr/share/webapps/nextcloud/apps/dav/lib/Connector/Sabre/File.php","line":244,"function":"convertToSabreException","class":"OCA\\DAV\\Connector\\Sabre\\File","type":"->"},{"file":"/usr/share/webapps/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php","line":156,"function":"put","class":"OCA\\DAV\\Connector\\Sabre\\File","type":"->"},{"file":"/usr/share/webapps/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php","line":316,"function":"createFile","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->"},{"file":"/usr/share/webapps/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php","line":130,"function":"copyNode","class":"Sabre\\DAV\\Tree","type":"->"},{"file":"/usr/share/webapps/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":684,"function":"copy","class":"Sabre\\DAV\\Tree","type":"->"},{"function":"httpCopy","class":"Sabre\\DAV\\CorePlugin","type":"->"},{"file":"/usr/share/webapps/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php","line":105,"function":"call_user_func_array"},{"file":"/usr/share/webapps/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":479,"function":"emit","class":"Sabre\\Event\\EventEmitter","type":"->"},{"file":"/usr/share/webapps/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":254,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/usr/share/webapps/nextcloud/apps/dav/lib/Server.php","line":319,"function":"exec","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/usr/share/webapps/nextcloud/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->"},{"file":"/usr/share/webapps/nextcloud/remote.php","line":165,"args":["/usr/share/webapps/nextcloud/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/usr/share/webapps/nextcloud/apps/dav/lib/Connector/Sabre/File.php","Line":650,"Previous":{"Exception":"OCP\\Encryption\\Exceptions\\GenericEncryptionException","Message":"Bad Signature","Code":0,"Trace":[{"file":"/usr/share/webapps/nextcloud/apps/encryption/lib/Crypto/Crypt.php","line":468,"function":"checkSignature","class":"OCA\\Encryption\\Crypto\\Crypt","type":"->"},{"file":"/usr/share/webapps/nextcloud/apps/encryption/lib/Crypto/Encryption.php","line":380,"function":"symmetricDecryptFileContent","class":"OCA\\Encryption\\Crypto\\Crypt","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/Files/Stream/Encryption.php","line":507,"function":"decrypt","class":"OCA\\Encryption\\Crypto\\Encryption","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/usr/share/webapps/nextcloud/lib/private/Files/Stream/Encryption.php","line":302,"function":"readCache","class":"OC\\Files\\Stream\\Encryption","type":"->"},{"function":"stream_read","class":"OC\\Files\\Stream\\Encryption","type":"->"},{"file":"/usr/share/webapps/nextcloud/apps/files_external/3rdparty/icewind/streams/src/Wrapper.php","line":91,"function":"fread"},{"file":"/usr/share/webapps/nextcloud/apps/files_external/3rdparty/icewind/streams/src/CallbackWrapper.php","line":98,"function":"stream_read","class":"Icewind\\Streams\\Wrapper","type":"->"},{"function":"stream_read","class":"Icewind\\Streams\\CallbackWrapper","type":"->"},{"file":"/usr/share/webapps/nextcloud/apps/files_external/3rdparty/icewind/streams/src/Wrapper.php","line":91,"function":"fread"},{"file":"/usr/share/webapps/nextcloud/apps/files_external/3rdparty/icewind/streams/src/CallbackWrapper.php","line":98,"function":"stream_read","class":"Icewind\\Streams\\Wrapper","type":"->"},{"function":"stream_read","class":"Icewind\\Streams\\CallbackWrapper","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/legacy/helper.php","line":254,"function":"fread"},{"file":"/usr/share/webapps/nextcloud/lib/private/Files/Storage/Wrapper/Encryption.php","line":1038,"function":"streamCopy","class":"OC_Helper","type":"::"},{"file":"/usr/share/webapps/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php","line":630,"function":"writeStream","class":"OC\\Files\\Storage\\Wrapper\\Encryption","type":"->"},{"file":"/usr/share/webapps/nextcloud/apps/dav/lib/Connector/Sabre/File.php","line":192,"function":"writeStream","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->"},{"file":"/usr/share/webapps/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php","line":156,"function":"put","class":"OCA\\DAV\\Connector\\Sabre\\File","type":"->"},{"file":"/usr/share/webapps/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php","line":316,"function":"createFile","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->"},{"file":"/usr/share/webapps/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php","line":130,"function":"copyNode","class":"Sabre\\DAV\\Tree","type":"->"},{"file":"/usr/share/webapps/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":684,"function":"copy","class":"Sabre\\DAV\\Tree","type":"->"},{"function":"httpCopy","class":"Sabre\\DAV\\CorePlugin","type":"->"},{"file":"/usr/share/webapps/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php","line":105,"function":"call_user_func_array"},{"file":"/usr/share/webapps/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":479,"function":"emit","class":"Sabre\\Event\\EventEmitter","type":"->"},{"file":"/usr/share/webapps/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":254,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/usr/share/webapps/nextcloud/apps/dav/lib/Server.php","line":319,"function":"exec","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/usr/share/webapps/nextcloud/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->"},{"file":"/usr/share/webapps/nextcloud/remote.php","line":165,"args":["/usr/share/webapps/nextcloud/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/usr/share/webapps/nextcloud/apps/encryption/lib/Crypto/Crypt.php","Line":492,"Hint":"Firma err\u00f3nea"},"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36","version":"18.0.3.0"}

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

As the issue only happens in some files, I don't know if it's necessary, but I can.

The output of your Apache/nginx/system log in /var/log/____:

xxx.xxx.xxx.xxx - - [27/Mar/2020:14:00:33 +0100] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/2.0" 200 629 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
xxx.xxx.xxx.xxx - - [27/Mar/2020:14:00:34 +0100] "GET /index.php/apps/news/feeds HTTP/2.0" 200 42952 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
xxx.xxx.xxx.xxx - - [27/Mar/2020:14:00:34 +0100] "GET /index.php/apps/news/folders HTTP/2.0" 200 875 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
xxx.xxx.xxx.xxx - - [27/Mar/2020:14:00:40 +0100] "GET /remote.php/webdav/aARCHIVADO%20ANTERIOR/opos%20AL%202017/programacion/PROGRAMACION%20DEFENSA/Unidades%20did%C3%A1cticas/1-%20Conociendo%20a%20mis%20amigos/ficha%20del%20PA.doc HTTP/2.0" 500 11402 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
xxx.xxx.xxx.xxx - - [27/Mar/2020:14:00:41 +0100] "GET /remote.php/webdav/aARCHIVADO%20ANTERIOR/opos%20AL%202017/programacion/PROGRAMACION%20DEFENSA/Unidades%20did%C3%A1cticas/1-%20Conociendo%20a%20mis%20amigos/ficha%20del%20PA.doc HTTP/2.0" 503 - "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"

I was trying to figure out if I can be absolutely sure that those files are corrupted somehow in my system, because they are 3 years old and they are not changed in all this time. Can I do something to try to recover them with the access to physical files, all encryption keys, etc?

Thank you very much

1 Like

Anybody? Is not possible?

1 Like

I see the same issue on a number of files. Setting encryption_skip_signature_check ( see https://github.com/nextcloud/server/pull/12678 ) helps recover some files which are good despite the bad signature.

However most of the files fail to download. The connection is interrupted while downloading them for no apparent reason (no trace in the Nextcloud logs nor in the web server logs). It is not a size problem or configuration problem: other files are downloaded fine, even those that exceed the size of all the files marked as having a Bad Signature.

There are tools to deal with this specific problem:

published in 2019 which may indicate the issue was still non trivial to solve a few months ago.

See also the latest encryption documentation.

Given what the user did when moving the files in the now-corrupt folder, I assume this problem happened because it almost exactly matches the reproducer explained in great details. Anyone interested should upvote the issue to increase its priority.

When user move file around and make mistakes, moving them back and forth from shared to unshared folders, it has a high probability to occur. And once files are marked with BadSignature, there is no easy recovery path.

In the use case I was dealing with, I workdaround the problem by:

  • Renaming the folder into Bug with bad signature
  • Created a new folder
  • Uploaded all the data again

It worked.

1 Like

It seems I could recover most of files by adding “‘encryption_skip_signature_check’ => ‘false’,”

Thank you very much for the idea.

1 Like

@figue it would help reference this topic if you update the title to include Bad Signature which is likely the keywords people are looking for when they stumble on this issue :slight_smile:

After I moved the data folder to a new location, two of my users got all their files missing. The files were still on the server, so I had to run an 8h-long occ files:scan --all

After that all files were back on the web interface, but I was facing the same Bad Signature 503 error, unable to preview or download. Maybe because after the folder move NC thinks the files are different because of timestamp?

This solved my problem:

Adding 'encryption_skip_signature_check' => true to the config/config.php file but I’m unsure if this generates any security risk.