Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117764539
D5523.1775227357.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
6 KB
Referenced Files
None
Subscribers
None
D5523.1775227357.diff
View Options
diff --git a/bin/podman_shared b/bin/podman_shared
--- a/bin/podman_shared
+++ b/bin/podman_shared
@@ -166,15 +166,15 @@
-e APP_WEBSITE_DOMAIN \
-e SSL_CERTIFICATE=${KOLAB_SSL_CERTIFICATE} \
-e SSL_CERTIFICATE_KEY=${KOLAB_SSL_CERTIFICATE_KEY} \
- -e WEBAPP_BACKEND="http://localhost:8000" \
- -e MEET_BACKEND="http://localhost:12080" \
- -e ROUNDCUBE_BACKEND="http://localhost:8080" \
- -e DAV_BACKEND="http://localhost:11080" \
- -e DAV_PATH="/dav" \
- -e FREEBUSY_BACKEND="http://localhost:11080" \
- -e FREEBUSY_PATH="/freebusy" \
- -e COLLABORA_BACKEND="http://localhost:9980" \
- -e SIEVE_BACKEND="localhost:4190" \
+ -e WEBAPP_BACKEND="http://127.0.0.1:8000" \
+ -e MEET_BACKEND="http://127.0.0.1:12080" \
+ -e ROUNDCUBE_BACKEND="http://127.0.0.1:8080" \
+ -e DAV_BACKEND="http://127.0.0.1:11080" \
+ -e DAV_PATH="/dav/" \
+ -e DAV_ALTERNATIVE_BACKEND="http://127.0.0.1:8080" \
+ -e DAV_ALTERNATIVE_PATH="/dav/" \
+ -e COLLABORA_BACKEND="http://127.0.0.1:9980" \
+ -e SIEVE_BACKEND="127.0.0.1:4190" \
kolab-proxy:latest $@
}
@@ -283,7 +283,7 @@
-v ./src:/src/kolabsrc.orig:ro \
-v ./$CONFIG/src:/src/overlay:ro \
-e NOENVFILE=true \
- -e APP_SERVICES_ALLOWED_DOMAINS="webapp,localhost,services.$HOST" \
+ -e APP_SERVICES_ALLOWED_DOMAINS="webapp,localhost,127.0.0.1,services.$HOST" \
-e KOLAB_ROLE=combined \
-e PASSPORT_PRIVATE_KEY="$PASSPORT_PRIVATE_KEY" \
-e PASSPORT_PUBLIC_KEY="$PASSPORT_PUBLIC_KEY" \
diff --git a/docker/proxy/Dockerfile b/docker/proxy/Dockerfile
--- a/docker/proxy/Dockerfile
+++ b/docker/proxy/Dockerfile
@@ -28,6 +28,8 @@
ENV ROUNDCUBE_BACKEND http://roundcube:8080
ENV DAV_BACKEND http://imap:11080
ENV DAV_PATH /dav
+ENV DAV_ALTERNATIVE_BACKEND http://roundcube:8080
+ENV DAV_ALTERNATIVE_PATH /dav
ENV FREEBUSY_BACKEND http://imap:11080
ENV FREEBUSY_PATH /freebusy
ENV COLLABORA_BACKEND http://collabora:9980
diff --git a/docker/proxy/rootfs/init.sh b/docker/proxy/rootfs/init.sh
--- a/docker/proxy/rootfs/init.sh
+++ b/docker/proxy/rootfs/init.sh
@@ -35,14 +35,22 @@
'' close;
}
+EOF
+
+cat <<EOF >> /etc/nginx/nginx.conf
+ # FIXME this requires a resolver to resolve domainnames
+ resolver 192.168.1.1 valid=10s;
+
+ map \$dav_backend \$backend_url {
+ default $DAV_BACKEND$DAV_PATH;
+ alternative $DAV_ALTERNATIVE_BACKEND$DAV_ALTERNATIVE_PATH;
+ }
+
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
-EOF
-
-cat <<EOF >> /etc/nginx/nginx.conf
server {
listen 6080 default_server;
listen 6443 default_server ssl;
@@ -180,7 +188,11 @@
}
location ~* ^/\.well-known/(caldav|carddav) {
- proxy_pass $DAV_BACKEND;
+ auth_request /auth;
+ auth_request_set \$dav_backend \$upstream_http_davbackend;
+
+ # We can't dynamically set the proxy target with vanilla nginx. We can only select between a list of predefined options via map.
+ proxy_pass \$backend_url;
proxy_redirect http:// \$scheme://;
proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr;
@@ -188,7 +200,11 @@
}
location /dav {
- proxy_pass $DAV_BACKEND$DAV_PATH;
+ auth_request /auth;
+ auth_request_set \$dav_backend \$upstream_http_davbackend;
+
+ # We can't dynamically set the proxy target with vanilla nginx. We can only select between a list of predefined options via map.
+ proxy_pass \$backend_url;
proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
diff --git a/src/app/Http/Controllers/API/V4/ConfigController.php b/src/app/Http/Controllers/API/V4/ConfigController.php
--- a/src/app/Http/Controllers/API/V4/ConfigController.php
+++ b/src/app/Http/Controllers/API/V4/ConfigController.php
@@ -30,8 +30,11 @@
$skus = $user->skuTitles();
- // TODO conditionally switch to kolabobjects
- $config['kolab-configuration-overlays'][] = 'kolab4';
+ if ((bool) $user->getSetting('kolabobjects_storage')) {
+ $config['kolab-configuration-overlays'][] = 'kolabobjects';
+ } else {
+ $config['kolab-configuration-overlays'][] = 'kolab4';
+ }
if (in_array('activesync', $skus)) {
$config['kolab-configuration-overlays'][] = 'activesync';
diff --git a/src/app/Http/Controllers/API/V4/NGINXController.php b/src/app/Http/Controllers/API/V4/NGINXController.php
--- a/src/app/Http/Controllers/API/V4/NGINXController.php
+++ b/src/app/Http/Controllers/API/V4/NGINXController.php
@@ -98,6 +98,20 @@
return $username;
}
+ private function authenticateHTTP($user = null)
+ {
+ $backend = "default";
+ if ($user && (bool) $user->getSetting('kolabobjects_storage')) {
+ $backend = "alternative";
+ }
+ $response = response('')->withHeaders(
+ [
+ "davbackend" => $backend,
+ ]
+ );
+ return $response;
+ }
+
/**
* Authentication request from the ngx_http_auth_request_module
*
@@ -128,7 +142,7 @@
if (empty($username)) {
// Allow unauthenticated requests
- return response('');
+ return $this->authenticateHTTP();
}
if (empty($password)) {
@@ -137,14 +151,14 @@
}
try {
- $this->authorizeRequest($username, $password, $ip);
+ $user = $this->authorizeRequest($username, $password, $ip);
} catch (\Exception $e) {
\Log::debug("Authentication attempt failed: {$e->getMessage()}");
return response("", 403);
}
\Log::debug("Authentication attempt succeeded");
- return response('');
+ return $this->authenticateHTTP($user);
}
/**
diff --git a/src/app/Observers/UserSettingObserver.php b/src/app/Observers/UserSettingObserver.php
--- a/src/app/Observers/UserSettingObserver.php
+++ b/src/app/Observers/UserSettingObserver.php
@@ -49,7 +49,7 @@
UpdateJob::dispatch($userSetting->user_id);
}
- if ($userSetting->key === 'debug') {
+ if ($userSetting->key === 'debug' || $userSetting->key === 'kolabobjects_storage') {
Roundcube::resetConfigCache($userSetting->user);
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Apr 3, 2:42 PM (8 h, 44 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18824340
Default Alt Text
D5523.1775227357.diff (6 KB)
Attached To
Mode
D5523: Dav backend switching based on auth request and kolabobjects_storage setting
Attached
Detach File
Event Timeline