Giter Club home page Giter Club logo

karadav's People

Contributors

ameyp avatar bnyro avatar bohwaz avatar dimitripapadopoulos avatar lubiana avatar povoq avatar tofee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

karadav's Issues

Server replied "413 Request Entity Too Large" to PUT with Nextcloud apps on upload

With this PR I got the Nextcloud apps to connect correctly to my KaraDAV behind Nginx, but somehow the apps fail to upload anything with a "413 Request Entity Too Large" error.

This might or might not be related to this similar error with Nextcloud itself. But it happens on any file regardless of the size.

Uploading files with normal WebDAV apps or the built in web-client works.

Any idea what I could try to troubleshoot this? Thanks!

Very slow with many files on BindFS (FUSE filesystem)

When KaraDAV has to serve files stored on a BindFS mountpoint, calculating size and showing the file list is very slow.

After clicking on the directory, it took 8 minutes before the file list is shown. This is a 200 MB directory with 400 files. Showing directories with more files will fail because of time-out. During this process, the bindfs task is using 80+% of the CPU.

BindFS (or FUSE filesystems) may be the cause of this, but I need it to map user, group and permissions for the files and directories.

This issue is partly related to issue #27, but the problem I have not only happens right after login (when the total size is calculated), but also after clicking on the directory.

If I remember correctly, Nextcloud had a cronjob. Maybe this cronjob is reading the directory once and then store all information in the database. Every time the directory is accessed, the database will be used.

iOS apps

It seems that iOS NextCloud and ownCloud apps don't work, each with different bugs.

I don't have any Apple device, and I'm not really interested, but if anyone is interested to try and fix the server for those clients, feel free :)

Possible TOCTOU

Here:

$size -= filesize($target);

The scenario would lead to a user being able to overcome its quota:

  1. Let's say a user create a file of 500 bytes called a and he's 501 bytes below his quota
  2. The check file_exists and filesize is passed in one request and $quota computation
  3. The user calls delete on the first file before the upload is completed (since the user is directing the upload, it can pause it if he wants), thus increasing his quota to 1001 bytes left
  4. The user upload another file of 1000 bytes (again, the former upload is struck) but the reported $quota still doesn't account for the upcoming first file, so he has 1001 bytes left before upload, 1 byte after upload.
  5. The user finishes uploading its 500 bytes file.
  6. He has created a file with 500 bytes over his quota.

This is user controllable with 100% chances of success.

There are also many TOCTOU in the pattern file_exists and later filesize (or is_dir) since a file can be modified between both call. This is harder to exploit but not impossible. For example, one could delete a file after it was checked, so filesize will return 0 when checked later on and not accounted in the quota. Yet the initial file can be copied before the initial code is resumed (or worse, a directory could be created instead) and lead to over quota scenarios.

In all cases, it would be better to use stat here and store the result in a variable and only refer to this variable in the complete function call, since stat gets both file size, file type, file existence in an atomic way.

NextCloud Client: Internal Server Error

I'm using KaraDAV 0.3.0 (035793e) with docker on a Linux host. The container was built using the official dockerfile.

The service runs behind a reverse proxy (traefik) which handles TLS termination, routing, etc.
It is available on one of my domains (https://dav.domain.my).
Everything works fine:

  • Webfrontend with different users & quotas
  • Bookmark-Sync with floccus
  • External Storage with NextCloud
  • KDE Dolphin (with webdavs://dav.domain.my/files/user/ )

But syncing with NextCloud Desktop Client Version 3.6.1 (KDE) does not work. (Also tested with several older versions down to 2.6 with the exact same result.)

I was able to add a new account and login with the NextCloud client. It lists all available directories correctly. (The same NextCloud Desktop Client syncs flawlessly with my local NextCloud 25 instance behind the same Traefik reverse proxy and with a remote NextCloud 20 installation.)
The NextCloud Client identifies KaraDAV as NextCloud 24.0.4.1

The NextCloud Client displays the following error message:
Server replied with an error while reading directory "" : Error transferring https://dav.domain.my/remote.php/dav/files/user/ - server replied: Internal Server Error

There is no error message in the container's log:

[1] [Fri Nov 4 18:37:25 2022] 172.29.8.1:38482 Accepted
/remote.php/dav/files/florian/
[1] [Fri Nov 4 18:37:25 2022] 172.29.8.1:38482 Closing

On opening the URL https://dav.domain.my/remote.php/dav/files/user/ in the browser, I have to provide my login credentials. After successful login the server responses with an Error: 404 Not Found

CORS issues with reverse-proxy

I am not sure if this is actually an issue with Karadav or my nginx reverseproxy configuration.

However despite having set const ACCESS_CONTROL_ALL = true; I get a CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 207 error in the browser when trying to access my otherwise working Karadav through the Webdav-manager demo.

I tried forcing the CORS header via my reverse-proxy (not an expert at all though) and then I get:
CORS header 'Access-Control-Allow-Origin' does not match '*, *'

Maybe you got an idea what could be the ultimate source of this problem?

is it possible to add X-Accel-Redirect support

i searched X-Accel-Redirect in source code and found nothing only X-SENDFILE exist. i think nignx would not do anything to X-SENDFILE header. but nowadays, most ppl using nginx and depend on some plugin from nginx like ddns stuff. so is it possible to add x-accel header in this project?

Empty "var" folder in each user directory

I cloned the repo, built it on docker and ran it with

docker run --rm -d -t --name karadav -p [port]:8080 -v $(pwd)/data:/var/karadav/data -v $(pwd)/config.local.php:/var/karadav/config.local.php karadav

The only changes on my config.local.php are:

const WWW_URL = 'https://[url:port]/';
const ERRORS_SHOW = false;

When I create a new user on the web interface, an empty ./data/[usernmame] directory is created. But if I create or upload a new file either on the web interface or via a webdav client (I tested on Nemo v5.8.5), this var directory is created, in the sctructure, i.e. data/bob/var/karadav/data/bob.

Removing this empty folder has apparently no issues on file access, but uploading a new file or even overwriting an existing file (like editing it on notepad) recreates this empty folder.

the last nexcloud cliend from f-droid crashes

  1. start karadav in docker: https://f-droid.org/en/packages/com.nextcloud.client/
  2. Install https://f-droid.org/en/packages/com.nextcloud.client/

Cause of error

Exception in thread "Thread-7" java.lang.NumberFormatException: For input string: "eJwrTi1K"
    at java.lang.Long.parseLong(Long.java:736)
    at java.lang.Long.parseLong(Long.java:861)
    at com.owncloud.android.datamodel.OCFile.getLocalId(OCFile.java:606)
    at com.owncloud.android.datamodel.FileDataStorageManager.createContentValuesBase(FileDataStorageManager.java:461)
    at com.owncloud.android.datamodel.FileDataStorageManager.createContentValuesForFolder(FileDataStorageManager.java:478)
    at com.owncloud.android.datamodel.FileDataStorageManager.saveFolder(FileDataStorageManager.java:392)
    at com.owncloud.android.operations.RefreshFolderOperation.synchronizeData(RefreshFolderOperation.java:538)
    at com.owncloud.android.operations.RefreshFolderOperation.fetchAndSyncRemoteFolder(RefreshFolderOperation.java:409)
    at com.owncloud.android.operations.RefreshFolderOperation.run(RefreshFolderOperation.java:239)
    at com.owncloud.android.lib.common.operations.RemoteOperation.run(RemoteOperation.java:399)
    at java.lang.Thread.run(Thread.java:1012)

App information

  • ID: com.nextcloud.client
  • Version: 30240190
  • Build flavor: generic

Device information

  • Brand: OnePlus
  • Device: OnePlus9Pro
  • Model: LE2120
  • Id: TQ2A.230505.002
  • Product: OnePlus9Pro

Firmware

  • SDK: 33
  • Release: 13
  • Incremental: 121

Problem with latest version and Docker: symlink to php binary missing

First of all, thanks a lot for this wonderful piece of software. It is very helpful!

I run my instance with Docker. I stick to your Dockerfile, just pushing my local config.

When trying to upgrade from 0.4.1 to 0.5.0 I faced this Docker error when starting my container:

Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "php": executable file not found in $PATH: unknown

After investigations, it appears the symlink from /usr/bin/php82 to /usr/bin/php was missing.

So I modified my Dockerfile to add it after PHP installation:

...

# Add missing symlink
RUN ln -s /usr/bin/php82 /usr/bin/php

...

I'm not sure what's the root cause. I was maybe unlucky and ended-up downloading a bugged version of alpine:edge. I just wanted you to be aware of it. You might want to amend the Dockerfile, or just add a warning somewhere. Or simply ignore it. Up to you :)

Support for custom endpoint

Hello,
I'm trying to install KaraDAV on my server.

In my setup, I'm hosting a nice GUI for my files on cloud.mysite.tld, and I want to open a WebDAV endpoint on cloud.mysite.tld/webdav.
This is possible with other DAV servers like dave and docker-webdav.
I initially thought that it would be possible in KaraDAV as well, since there is an option to set up the base URL of the server (https://github.com/kd2org/karadav/blob/main/config.dist.php#L30), however I've set it to https://cloud.mysite.tld/webdav and it's ignored - if I open it on my browser I get a 404 error.
I'm running the Docker container which I have just compiled.

I know that with KaraDAV it's slightly trickier than with other solutions because there is a whole web GUI, not just the WebDAV endpoint, but I believe it should be doable.
Feel free to ask if you need clarifications, and thanks for your work on KaraDAV!

Missing WebDAV::hash causing 500

Hi,

When trying to open a file that sends you to a Collabora or OnlyOffice instance, it throw a 500 error because the Storage.php script is trying to call an undefined hash function.

I tried to find to search for such a function in all the files inside this project, without any result.

Please find the error logs below :

[8] [Tue Nov 22 22:53:21 2022] =========== Error ref. 38r5nis6 ===========

Error: Call to undefined method KaraDAV\WebDAV::hash() in /var/karadav/lib/KaraDAV/Storage.php:518
Stack trace:
#0 /var/karadav/lib/KaraDAV/Storage.php(225): KaraDAV\Storage->createWopiToken('...')
#1 /var/karadav/lib/KD2/WebDAV/Server.php(711): KaraDAV\Storage->properties('...', Array, 0)
#2 /var/karadav/lib/KD2/WebDAV/Server.php(1267): KD2\WebDAV\Server->http_propfind('...')
#3 /var/karadav/lib/KaraDAV/Server.php(68): KD2\WebDAV\Server->route('...')
#4 /var/karadav/www/_router.php(47): KaraDAV\Server->route('...')
#5 {main}

<errorReport>
{
    "errors": [
        {
            "message": "Call to undefined method KaraDAV\\WebDAV::hash()",
            "errorCode": 0,
            "type": "PHP error",
            "backtrace": [
                {
                    "file": "\/var\/karadav\/lib\/KaraDAV\/Storage.php",
                    "line": 518,
                    "code": {
                        "514": "\t\t$user = $this->users->current();",
                        "515": "\t\t$ttl = time()+(3600*10);",
                        "516": "",
                        "517": "\t\t\/\/ Use the user password as a server secret",
                        "518": "\t\t$check = WebDAV::hash(compact('ttl', 'uri'), $user->password);",
                        "519": "\t\t$data = sprintf('%s_%s_%s', $check, $ttl, $user->login);",
                        "520": "",
                        "521": "\t\treturn [",
                        "522": "\t\t\tWOPI::PROP_TOKEN => WOPI::base64_encode_url_safe($data),"
                    }
                },
                {
                    "function": "KaraDAV\\Storage->createWopiToken",
                    "file": "\/var\/karadav\/lib\/KaraDAV\/Storage.php",
                    "line": 225,
                    "args": {
                        "$uri": "string(25) \"Excel_File.xlsx\""
                    },
                    "code": {
                        "221": "\t\t$out = [];",
                        "222": "",
                        "223": "\t\t\/\/ Generate a new token for WOPI, and provide also TTL",
                        "224": "\t\tif (in_array(WOPI::PROP_TOKEN, $properties)) {",
                        "225": "\t\t\t$out = $this->createWopiToken($uri);",
                        "226": "\t\t\tunset($properties[WOPI::PROP_TOKEN], $properties[WOPI::PROP_TOKEN_TTL]);",
                        "227": "\t\t}",
                        "228": "",
                        "229": "\t\tforeach ($properties as $name) {"
                    }
                },
                {
                    "function": "KaraDAV\\Storage->properties",
                    "file": "\/var\/karadav\/lib\/KD2\/WebDAV\/Server.php",
                    "line": 711,
                    "args": {
                        "$uri": "string(25) \"Excel_File.xlsx\"",
                        "$properties": "array(3) {\n  [0]=> string(70) \"https:\/\/interoperability.blob.core.windows.net\/files\/MS-WOPI\/:file-url\"\n  [1]=> string(67) \"https:\/\/interoperability.blob.core.windows.net\/files\/MS-WOPI\/:token\"\n  [2]=> string(71) \"https:\/\/interoperability.blob.core.windows.net\/files\/MS-WOPI\/:token-ttl\"\n}",
                        "$depth": "int(0)"
                    },
                    "code": {
                        "707": "\t\t$requested = $this->extractRequestedProperties($body);",
                        "708": "\t\t$requested_keys = $requested ? array_keys($requested) : null;",
                        "709": "",
                        "710": "\t\t\/\/ Find root element properties",
                        "711": "\t\t$properties = $this->storage->properties($uri, $requested_keys, $depth);",
                        "712": "",
                        "713": "\t\tif (null === $properties) {",
                        "714": "\t\t\tthrow new Exception('This does not exist', 404);",
                        "715": "\t\t}"
                    }
                },
                {
                    "function": "KD2\\WebDAV\\Server->http_propfind",
                    "file": "\/var\/karadav\/lib\/KD2\/WebDAV\/Server.php",
                    "line": 1267,
                    "args": {
                        "$uri": "string(25) \"Excel_File.xlsx\""
                    },
                    "code": {
                        "1263": "\t\t\tif (!method_exists($this, $method)) {",
                        "1264": "\t\t\t\tthrow new Exception('Invalid request method', 405);",
                        "1265": "\t\t\t}",
                        "1266": "",
                        "1267": "\t\t\t$out = $this->$method($uri);",
                        "1268": "",
                        "1269": "\t\t\t$this->log('=> %d', http_response_code());",
                        "1270": "",
                        "1271": "\t\t\tif (null !== $out) {"
                    }
                },
                {
                    "function": "KD2\\WebDAV\\Server->route",
                    "file": "\/var\/karadav\/lib\/KaraDAV\/Server.php",
                    "line": 68,
                    "args": {
                        "$uri": "string(25) \"Excel_File.xlsx\""
                    },
                    "code": {
                        "64": "\t\t}",
                        "65": "",
                        "66": "\t\t$this->dav->setBaseURI('\/files\/' . $user->login . '\/');",
                        "67": "",
                        "68": "\t\treturn $this->dav->route($uri);",
                        "69": "\t}",
                        "70": "}",
                        "71": ""
                    }
                },
                {
                    "function": "KaraDAV\\Server->route",
                    "file": "...\/_router.php",
                    "line": 47,
                    "args": {
                        "$uri": "string(40) \"\/files\/theo546\/Excel_File.xlsx\""
                    },
                    "code": {
                        "43": "if (isset($_SERVER['REDIRECT_REQUEST_METHOD'])) {",
                        "44": "\t$_SERVER['REQUEST_METHOD'] = $_SERVER['REDIRECT_REQUEST_METHOD'];",
                        "45": "}",
                        "46": "",
                        "47": "if (!$s->route($uri)) {",
                        "48": "\tif (PHP_SAPI == 'cli-server') {",
                        "49": "\t\t$s->dav->log(\"ROUTER: => Route is not managed: 404\");",
                        "50": "\t}",
                        "51": ""
                    }
                }
            ]
        }
    ],
    "context": {
        "date": "2022-11-22T22:53:21+00:00",
        "duration": 0.5710124969482422,
        "environment": "development",
        "hostname": "0.0.0.0",
        "http_files": "array(0) {\n}",
        "http_method": "PROPFIND",
        "http_post": "array(0) {\n}",
        "http_referrer": "https:\/\/karadav.redacted.com\/files\/theo546\/",
        "http_user_agent": "Mozilla\/5.0 (X11; Linux x86_64; rv:107.0) Gecko\/20100101 Firefox\/107.0",
        "id": "38r5nis6",
        "language": "PHP 8.1.12",
        "memory_peak": 2097152,
        "memory_used": 2097152,
        "os": "Linux",
        "php_sapi": "cli-server",
        "remote_ip": "172.19.0.3",
        "root_directory": "\/var\/karadav\/www",
        "user_addr": "172.19.0.3",
        "url": "http:\/\/karadav:8080\/files\/theo546\/Excel_File.xlsx"
    }
}
</errorReport>

Docker lacks php81-fileinfo

When running the Docker, everything run fine until I open "Manage my Files" , then an error PHP error Call to undefined function KaraDAV\mime_content_type() pops.

I fix it by adding php81-fileinfo to the apk --no-cache add command of the Dockerfile to have the mime_content_type() function available.

Redirecting to 0.0.0.0:8080 when logout ore user change.

When build using docker and port binding to example: 1234 opening 10.10.15.52:1234 this loads the webdav server, but if you logout then you are redirected to 0.0.0.0:8080/login.php and this persists until you manualy open 10.10.15.52:1234/login.php

second:
On the main page under WebDAV URL is a link that always points to http://0.0.0.0:8080/files/<user>/

third:
When in user managment and you change user name/pass and click Save you are redirected to http://0.0.0.0:8080/users.php

So my conclusion is that there are no dynamic links will try to make a PR.
PS: This persists with domains.

can't get it to work with any webdav client

It does not work
The "error.log" file contains:

[11-Feb-2023 15:10:30 Europe/Berlin] =========== Error ref. 1spsjz8l ===========

ErrorException: Deprecated: Creation of dynamic property KaraDAV\Storage::$properties is deprecated in C:\xampp\htdocs\lib\KaraDAV\Storage.php:428
Stack trace:
#0 C:\xampp\htdocs\lib\KaraDAV\Storage.php(428): KD2\ErrorManager::errorHandler(8192, 'Deprecated: Cre...', 'C:\xampp\htdocs...', 428)
#1 C:\xampp\htdocs\lib\KaraDAV\Storage.php(206): KaraDAV\Storage->getResourceProperties('')
#2 C:\xampp\htdocs\lib\KaraDAV\Storage.php(230): KaraDAV\Storage->get_file_property('', 'DAV::href', 1)
#3 C:\xampp\htdocs\lib\KD2\WebDAV\Server.php(740): KaraDAV\Storage->properties('', Array, 1)
#4 C:\xampp\htdocs\lib\KD2\WebDAV\Server.php(1296): KD2\WebDAV\Server->http_propfind('')
#5 C:\xampp\htdocs\lib\KaraDAV\Server.php(68): KD2\WebDAV\Server->route('')
#6 C:\xampp\htdocs\www_router.php(47): KaraDAV\Server->route('/files/admin/')
#7 {main}

Enable fail2ban by logging failed requests

TL;DR: please log the IP (X-Forwarded-For) of failed accesses to error.log, so fail2ban can pick them up and ban them.

I'm trying out this project and I'm quite impressed with the speed, great work! :)

Before using it for real data, however, I would want to harden it a little. One thing that's really easy to add is fail2ban. It works by monitoring any log file, looking for a well-defined pattern representing an unauthorized access attempt, nd bans the offending IPs.

To support fail2ban, KaraDAV would need to:

  1. Read the client IP, using the X-Forwarded-For header if present (otherwise it breaks reverse proxies!)

  2. If password_verify() fails, print something like "{IP} - Login failed as user {user}: wrong password"

  3. If a client attempts to request a non-index.php or command while not logged in (or logged in as the wrong user), print something like "{IP} - Attempted to access unauthorized page"

I can make a quick PR for this if necessary.

Missing SQLite3.php in lib folder

/!\ PHP error 
Warning: require_once(/var/www/webdav.xxxxxx.com/www/../lib/SQLite3.php): Failed to open stream: No such file or directory
#0 .../_inc.php(9)
#1 .../_inc.php(9)
#2 /var/www/webdav.gcc3.com/lib/KaraDAV/DB.php(5): KaraDAV\{closure}(string(7) "SQLite3")
#3 .../_inc.php(9): require_once(string(43) "/var/ww…)
#4 .../_inc.php(121): KaraDAV\{closure}(string(10) "KaraDAV…)
#5 .../_router.php(5): require_once(string(12) ".../_in…)

It seems in lib folder there is not a SQLite3.php

User and session management (CMS)

I was wondering why a SQL database was required. I've found that you're using a DB mainly for storing the user's session and file's locks.

However, I've found this in the code:

if (time() % 100 == 0) {

Which, IMHO is wrong. Either you should store a file in a tmpfs (/tmp) and use its timestamp to know when last expiry happened and check it every call, but you can't rely on the server script being called at a specific time to trigger session deletions. You only have 1% chance (with the current code) that it'll happen so some session might linger for month or years depending on the server's usage.

I wonder if it's possible to:

  1. Use an external script to validate users (like a CMS does in fact), so you don't care about session in your code. One can either use a default implementation of this script that'll fallback to LDAP or SQLite3's DB. Ideally, you should have a code that's creating the session object without triggering other thing elsewhere, so it can be called upon CMS' login. Once the user query the Webdav URL, it'll give a cookie that'll let you call session_start() on this with your object.
  2. Use POSIX file locks instead of a SQL database ?
  3. Allow to set the user's base path in the session (so that it's possible for a user to browse /home/joe). There are multiple security implication in doing this, since it means either letting www-data user access to the users' home directory (this is bad and dangerous in general) or using a proxy script to do that (like running a root's FTP server that's only listening on localhost and using Flysystem to access user home with the identify of the user herself).

SQLite3::prepare(): Unable to prepare statement: 1, no such table: users

Bonjour,

Après avoir installé Karadav sur mon serveur mutualisé OVH, et créé le répertoire data manuellement, j'ai une page qui s'affiche avec plusieurs messages d'erreur, qui ont tous l'air d'être lié à la non création la base SQlite :

PHP error
Warning: SQLite3::prepare(): Unable to prepare statement: 1, no such table: users

Erreur 1


in .../lib/KaraDAV/DB.php:29

25	}
26
27	public function run(string $sql, ...$params)
28	{
29		$st = $this->prepare($sql);
30
31		foreach ($params as $key => $value) {
32			$st->bindValue(is_int($key) ? $key+1 : ':' . $key, $value);
33		}

Erreur 2

in .../lib/KaraDAV/DB.php:29
→ SQLite3->prepare (1 arg.)
$query	

string(36) "SELECT * FROM users WHERE login = ?;"

25	}
26
27	public function run(string $sql, ...$params)
28	{
29		$st = $this->prepare($sql);
30
31		foreach ($params as $key => $value) {
32			$st->bindValue(is_int($key) ? $key+1 : ':' . $key, $value);
33		}

Erreur 3


in .../lib/KaraDAV/DB.php:48
→ KaraDAV\DB->run (2 arg.)
$sql	

string(36) "SELECT * FROM users WHERE login = ?;"

$params	

string(4) "demo"

44	}
45
46	public function first(string $sql, ...$params)
47	{
48		$row = $this->run($sql, ...$params)->fetchArray(\SQLITE3_ASSOC);
49		return $row ? (object) $row : null;
50	}
51
52	public function firstColumn(string $sql, ...$params)

Erreur 4

in .../lib/KaraDAV/Users.php:33
→ KaraDAV\DB->first (2 arg.)
$sql	

string(36) "SELECT * FROM users WHERE login = ?;"

$params	

string(4) "demo"

29	}
30
31	public function fetch(string $login): ?stdClass
32	{
33		return DB::getInstance()->first('SELECT * FROM users WHERE login = ?;', $login);
34	}
35
36	public function get(string $login): ?stdClass
37	{

Erreur 5

in .../lib/KaraDAV/Users.php:38
→ KaraDAV\Users->fetch (1 arg.)
$login	

string(4) "demo"

34	}
35
36	public function get(string $login): ?stdClass
37	{
38		$user = $this->fetch($login);
39
40		if (!$user && LDAP::enabled() && LDAP::checkUser($login)) {
41			$this->create($login, self::generatePassword(), DEFAULT_QUOTA);
42			$user = $this->fetch($login);

Erreur 6

in .../lib/KaraDAV/Users.php:158
→ KaraDAV\Users->get (1 arg.)
$login	

string(4) "demo"

154			return null;
155		}
156
157		// If not, try to login
158		$user = $this->get($login);
159
160		if (!$user) {
161			return null;
162		}

Erreur 7

in .../login.php:17
→ KaraDAV\Users->login (2 arg.)
$login	

string(4) "demo"

$password	

string(11) "demokaradav"

13
14$error = 0;
15
16if (!empty($_POST['login']) && !empty($_POST['password']) && csrf_check()) {
17	if ($users->login($_POST['login'], $_POST['password'])) {
18		$url = null;
19
20		if (!empty($_POST['nc']) && $_POST['nc'] == 'redirect') {
21			$url = $users->appSessionCreateAndGetRedirectURL();

Comment puis-je remédier au problème ?

NextCloud/OwnCloud/Webclient: 500 Internal Server Error

The error come:
1- when I want to create a new file
2- for existing file starting with a dot (hidden file in linux)

Debian 11, PHP 8.1, Nginx 1.18.0, NextCloud/OwnCloud latest version
data directory: permission's 770, owner/group www-data:www-data (db.sqlite owned by root)
Where could it come from ?

401 Error | WebDAV

Hello, I am currently testing with Karadav, and find the speed and simplicity great. What I can't do is to upload data remotely with a webdav client. I have example.de/files/user as WEBDAV URL then I get login, but no matter how I log in I always get 401 - and can't authenticate myself. https://example.de/remote.php/webdav as well. Do you have any tips on how I can fix this, or what the cause is?

{ "installed": true, "maintenance": false, "needsDbUpgrade": false, "version": "99.0.0", "versionstring": "99.0.0", "edition": "", "productname": "NextCloud", "extendedSupport": false }

from error.log:
ROUTER: => 401 Response headers: X-Powered-By: PHP/8.2.17 Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate Pragma: no-cache WWW-Authenticate: Basic realm="Please login"

Nextcloud client not work

Hello, i install karadav and it work with navigator or webdav acces, but not work properly with client nextcloud.
Connection with client is ok, but cant see files/folder, and can't add files (touch "+" grey in nextcloud client, tested with different version of nextcloud client.
I try with docker installation and with apache server directly.
I don't have error in apache or karadav.

Docker fails to create the database

Hello again,
Thanks for responding to #29 so quickly and efficiently, however I'm still having some other problems with KaraDAV that prevent me from using it.
It looks like when using Docker KaraDAV fails to create the database and user.
I've set the following in my config.local.php: const DB_FILE = __DIR__ . '/data/karadav.sqlite';, and I've mounted a volume in my docker-compose.yml as follows: /media/hdd/filebrowser:/var/karadav/data
I expected to get a file /media/hdd/filebrowser:/var/karadav/data/karadav.sqlite, but that didn't come up. When I started the container, I got errors like Exception Unable to open database: unable to open database file, so I created it as a regular SQLite file using the schema. I tried starting it like that, but I saw it didn't work so I added my user manually, hashing the password manually with PHP's password_hash(), but while I don't get any error now, it's telling me that the username of password are incorrect.
As before, please tell me if I need to provide any additional information. Thank you for your help!

Ah right sorry, was probably the wrong link. But there is definitly something that prevents the Android app to recognize my Karadav server, while normal WebDAV used to work fine.

          Ah right sorry, was probably the wrong link. But there is definitly something that prevents the Android app to recognize my Karadav server, while normal WebDAV used to work fine.

But unrelated to this: Can you please re-open this issue? The web -based filemanager works fine after updating to 0.4.1, but the webdav access via (non-nextcloud) apps is still not working. It returns a 500 error.

Edit: hmmm, very odd. Oryzly does connect via webdav, but creates directories instead of the orgmode files, and then complaints that it can't sync because the file is a directory (409 error).

Edit: the same happens when I try to manually create text files via the web file manager. It gives an 500 error and when I refresh the page a directory has been created with the name of the text file that I tried to create.

Originally posted by @poVoq in #42 (comment)

Reopened!

does not work with many files

This is due to this function :
public function quota(?stdClass $user = null): stdClass
...that takes ages to compute the number of byte used by the current user.
So much time that the WebDav Client "times out" with an error.

owncloud/nextcloud clients doesnt work if installed in sub-directory

Hello there, I followed the instructions for a clean install with apache vhost for subdirectory, everything works perfectly apart the owncloud/nextcloud clients, when they search for the server they fails and in the apache log I have error 404 for the path me.localhost/dav/status.php. If I reach the path from browser I have "Invalid URL" message.

If I instead install karadav in the webserver root karadav.localhost, the everything works correctly included owncloud/nextclod apps.

It seems that the suggested vhost for installing in a subdirectory doesn't work.

Unfortunatly I can't install it in the root but I have to install it in a subdirectory.

I'm trying to solve this problem from two days with no luck. Can someone help me?

Can't find index.php, but don't look at the right place

Hello
I'm trying to test karadav, but there is a little problem. my setup
Debian 11, PHP 8.1, Nginx 1.18.0, Karadav 0.3.3
Karadav root's folder: /usr/local/share/karadav
Data folder: /home/data and I've put a symbolic link to /home/data in the karadav root folder
When I try to go to Manage my files with the demo user (or with a user that I've create, I get an error 404, and in the log I've the following line:
2022/11/14 21:43:10 [error] 3700999#3700999: *264 "/usr/local/share/karadav/www/files/user/index.php" is not found (2: No such file or directory), client: XX.XX.XX.XX, server: karadav.example.com, request: "GET /files/user/ HTTP/2.0", host: "karadav.example.com", referrer: "https://karadav.example.com/" (I've replace the user name by user, and the real hostname by karadav.example.com :-))

If you need more information to investigate, feel free to ask.
Thanks

https not working - redirects to normal http ip when using reverse proxy

to use ssl with services i usually just make a rule in nginx proxy manager like this
image
image
image

however what's strange is that accessing karadav.box through that reverse proxy, just redirects me to the normal http ip?
image
I also tried using port 445, (i changed 443 to 445 in the config), but it fails to access that entirely.

Mirrored folder structure on SSD

Hello, I love the project but I'm having a small issue that's confusing me.

I have karadav installed with Nginx on a raspberry pi 3 running DietPi (Debian 11), connected through USB is an SSD mounted to /mnt/ssd. For a given karadav user, the data folder at /home/server/data/user/ is a symlink to /mnt/ssd/user/.

When user adds a new file, let's say work/file.txt, that is thus stored in /mnt/ssd/user/work/file.txt, a new empty folder structure appears in /mnt/ssd/user/ that copies the home directory structure, like so: /mnt/ssd/user/home/server/data/user/work/.

Editing the STORAGE_PATH constant in conf.dist.php to /mnt/ssd/ only changes the name of the mirrored folder once a new file is added (making it /mnt/ssd/user/mnt/ssd/user/work/)

And it only goes one way, as deleting the original work/file.txt does not delete the mirrored folder. I'm not sure if this is some kind of symlink trickery or messed up configuration, I'd just like to know how to stop it from doing that.

Configure per user quota and link to LDAP groups?

I can only see a way to configure the default storage quota, how can I configure that per user easily? Edit: ah I guess it's behind the "manage users" option on the web-interface?

Also a nice addition would be to link some different default quotas to LDAP groups.

Thanks!

Blank page on dietpi bookworm.

I'm trying to host karodav on my nanopi neo2, dietpi bookworm. But I get blank page. I need only local server, for backup my files by time.

I use nginx with php 8.2.

my config:

# /etc/nginx/sites-available/default
server {
    listen 80;
    listen [::]:80;

    server_name "$hostname";

    root /home/karadav/www;

    index index.php;

    # Serve files
    location / {
        try_files $uri $uri/ /_router.php?$query_string;
    }

    location ~* \.php$ {
        fastcgi_pass unix:/run/php/php-fpm.sock;
        include fastcgi_params;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}

After update to 0.4.0 no access to web file manager, only "Invalid URL"

I was running a fully working main branch pull from early june or so (0.3.11/12) and just updated to 0.4.0, but the internal web file manager became inaccessible.

I can log in fine and manage users etc., but when I click on the "Manage my files" button, I just get a white page with "Invalid URL" written on it.

Webdav clients also stopped working.

I checked the usual suspects, and log files, but I don't really see what could be causing this. The changelog also doesn't mention any breaking config changes that I might have missed.

Any idea what might be causing this?

Edit: Debug logs say: DAV: <= /files/{myusername}/ is not a managed URL

Installation

Hello, I can’t get karadav installed properly.

I followed the instructions but it shows “Exception
Unable to open database: unable to open database file”.

65A63A36-5952-4633-BB18-ADC0EAFF94D3
B4C1BE5D-437F-4AEC-9BF5-899C549CCB7D

[bug] webdav unuseable

mountain duck (based on cyberduck)
image

and using the nextcloud client (successfully opens browser and logs-in but can't sync files)
image

also tried dolphin on another device and no luck

edit: owncloud clients also don't work

In case this was related to my reverse proxy, i also tried removing the reverse proxy entirely and connected over http with the ip, but still got the same errors

installation method: used docker guide

docker-compose.yml

Well...

it's a docker-compose.yml - technically. However, for people using docker and docker-compose you usually fire up the service with docker-compose up -d.

Which is not working here, you have to build it. And that requires the entire sources from GitHub. Not perfect...

Any chance to publish an working out of the box image on dockerhub which can be pulled and started in seconds?

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.