29 Commits (a48f37c0c95bd24fb38a1455e62c2dfca47ffac5)

Author SHA1 Message Date
Tom Hacohen 8c6d04e8d3 Replace aioredis with redis-py
aioredis has been merged into redis-py and will no longer be maintained
as a separate project.
2 years ago
Tom Hacohen 2f1f95fea9 Optimize how we fetch the latest (current) revision
The way were were doing it was implicitly sorting the query items and it
was causing millions of items to be sorted (even though the result should
only have one) making it slow.

By switching away from `get()` and `first()` we are telling django to
not try to sort.
3 years ago
PapaTutuWawa fac36aae11
Implement checking the username against LDAP (#64)
This commit adds code to allow users that prefer to do user management
via LDAP to do so. Since Etebase does not store the password (proof) in
a LDAP compatible fashion, we compromise and instead two checks: One while
registering an account to see if the username is the LDAP directory and
one whenever the API is accessed. To prevent too many LDAP requests, the
result of the request is cached for an configurable amount of hours.

Make sure you have python-ldap installed and can successfully import
ldap. Then, if you use the easy config, add the following to your
config:

```
; [...]
; Regular etesync configuration

[ldap]
bind_dn = <Your LDAP "user" to bind as. See Note 1>
bind_pw = <The password to authenticate as your bind user>
; Or if you have the password in a file:
; bind_pw_file = /path/to/the/file.txt
server = <The URL to your LDAP server>
search_base = <Your search base>
filter = <Your LDAP filter query. See Note 2>
; In case a cache TTL of 1 hour is too short for you, set `cache_ttl` to
the preferred
; amount of hours a cache entry should be viewed as valid:
; cache_ttl = 5
```

With this config, I am able to make the EteSync server check with my
LDAP server if a user should be able to login or register.
Note that if a user is allowed to login or register, the password of the
LDAP user will be ignored. This LDAP patch is nothing more than an
additional check before the actual authentication.

A successful LDAP check will be cached, if not configured (correctly),
for one hour, after which the LDAP query will be performed again.

Note 1: This commit only works with a bind user
Note 2: The query must be specified. If an LDAP query returns more than
one or no result, then the authentication fails. If your query needs to
include the username that currently tries to perform a login or
registration, you can use %%s, which will be subsituted for the used
username.
3 years ago
Tom Hacohen 3a4da142dc Fix import of sendfile backend due to python package changes.
Broke in c7d1de31a1.
3 years ago
Xiretza 791de952f4 fix: move template directory into source directory
This is in preparation for creating a python package.
3 years ago
Xiretza ada5181a7e fix: move django_etebase module from toplevel to under etebase_server
This is in preparation for creating a python package, which should only
occupy the "etebase_server" name in the global module namespace.
3 years ago
Xiretza 9d6e0ae60a fix: move myauth module from toplevel to under etebase_server
This is in preparation for creating a python package, which should only
occupy the "etebase_server" name in the global module namespace.
3 years ago
Xiretza 163f7766f1 fix: move etebase_fastapi module from toplevel to under etebase_server
This is in preparation for creating a python package, which should only
occupy the "etebase_server" name in the global module namespace.
3 years ago
Xiretza 13a137a128 fix: remove obsolete static file handler 3 years ago
Xiretza e635e081c7 fix: use django.urls.path instead of deprecated django.conf.urls.url 3 years ago
Xiretza 04ca0ae5db
feat(config): allow specifying engine-specific database options (#135)
These are required to e.g. use PostgreSQL client certificates using
sslcert=/sslkey=.
3 years ago
Xiretza 70b753cd31
fix: don't create secrets file as world-readable (#136) 3 years ago
Victor R. Santos 7bb1bf9d22 Fix Django 3.2 warnings models.W042 3 years ago
Dustin J. Mitchell 43d5af32d7 Fix sendfile settings
* set SENDFILE_ROOT to the filesystem path for media, not the URL
  component
* use the correct import path to the sendfile backend
4 years ago
Tom Hacohen 8485806046 Easy config: add support for setting redis URI. 4 years ago
Tom Hacohen c1f171bde0 Change how we create applications. 4 years ago
Tom Hacohen 4ceb42780e Remove unused django_etebase code. 4 years ago
Tom Hacohen 0fa2f2da3b Make the fastapi application the main asgi one. 4 years ago
Tom Hacohen b081d0129f Add support for read/write permissions. 4 years ago
Tom Hacohen 9559a0fd35 Chunk download: use the new sendfile to serve files. 4 years ago
Tom Hacohen 070abfcdd8 Format using black. 4 years ago
Tal Leibman d8e5c37db1
Use black for code formatting and format the code
Merge #65
4 years ago
Victor R. Santos e9de8f1adb Add env variable to change configuration file path.
ETEBASE_EASY_CONFIG_PATH is optional, the server serches for the
configurations files in this order:
- "ETEBASE_EASY_CONFIG_PATH"
- etebase-server.ini
- /etc/etebase-server/etebase-server.ini
4 years ago
Tom Hacohen 8a557ff82c Disable signups by default.
The next commit includes README instructions on how to create users
and enable signups.
4 years ago
Tom Hacohen 5c803d8a51 Only expose drf's auth in debug mode. 4 years ago
Tom Hacohen 38e0700ac0 Update django and remove unused deps. 4 years ago
Pierre-Alain TORET 5785f803ac Port over easyconfig from the etesync server code.
Migrated by Tom, but kept the credit to daftaupe
4 years ago
Tom Hacohen cc163d27af Add settings and configuration to run the etebase app. 5 years ago
Tom Hacohen 4aa3daaa97 Create a new django project. 5 years ago