OpenCloud: Difference between revisions

I added a section for people wanting to install Collabora Online and extra fonts on OpenCloud, as it is tricky.
Lhf (talk | contribs)
Forward radicale traffic through opencloud instead of nginx. The previous configuration allowed anyone to query the public endpoint and override the remote user header. This edit matches: https://github.com/opencloud-eu/opencloud-compose/blob/main/config/radicale/config https://github.com/opencloud-eu/opencloud-compose/blob/main/config/opencloud/proxy.yaml
Tags: Mobile edit Mobile web edit
Line 17: Line 17:


==== Nginx ====
==== Nginx ====
This snippet enables the Nginx endpoint for OpenCloud and a Radicale service.
This snippet enables the Nginx endpoint for OpenCloud.
 
<syntaxhighlight lang="nix">
OpenCloud itself does not have support for CalDAV/CardDAV but it integrates well with Radicale.<syntaxhighlight lang="nix">
   services.nginx.virtualHosts = {
   services.nginx.virtualHosts = {
     "cloud.your.domain" = {
     "cloud.your.domain" = {
       enableACME = true;
       enableACME = true;
       forceSSL = true;
       forceSSL = true;
       locations = {
       locations."/" = {
        # Endpoint for OpenCloud
        proxyPass = "http://127.0.0.1:9200";
        "/" = {
        proxyWebsockets = true;
          proxyPass = "http://127.0.0.1:9200";
          proxyWebsockets = true;
        };
        # Radicale endpoints for CalDAV and CardDAV
        "/caldav/" = {
          proxyPass = "http://127.0.0.1:5232";
          extraConfig = "
            proxy_set_header X-Remote-User $remote_user; # provide username to CalDAV
            proxy_set_header X-Script-Name /caldav;
          ";
        }
        "/.well-known/caldav" = {
          proxyPass = "http://127.0.0.1:5232";
          extraConfig = "
            proxy_set_header X-Remote-User $remote_user; # provide username to CalDAV
            proxy_set_header X-Script-Name /caldav;
          ";
        }
        "/carddav/" = {
          proxyPass = "http://127.0.0.1:5232";
          extraConfig = "
            proxy_set_header X-Remote-User $remote_user; # provide username to CardDAV
            proxy_set_header X-Script-Name /carddav;
          ";
        }
        "/.well-known/carddav/" = {
          proxyPass = "http://127.0.0.1:5232";
          extraConfig = "
            proxy_set_header X-Remote-User $remote_user; # provide username to CardDAV
            proxy_set_header X-Script-Name /carddav;
          ";
        }
       };
       };
     };
     };
   };
   };
</syntaxhighlight>
</syntaxhighlight>


==== Radicale ====
==== Radicale ====
To use OpenCloud with CalDAV we need to enable the [https://github.com/Kozea/Radicale Radicale] service.<syntaxhighlight lang="nix">
OpenCloud doesn't natively support CalDAV and CardDAV but can serve as a proxy to a Radicale service.
 
<syntaxhighlight lang="nix">
  services.opencloud.settings.proxy.additional_policies = [
    {
      name = "default";
      routes = [
        {
          endpoint = "/caldav/";
          backend = "127.0.0.1:5232";
          remote_user_header = "X-Remote-User";
          skip_x_access_token = true;
          additional_headers = [{"X-Script-Name" = "/caldav";}];
        }
        {
          endpoint = "/.well-known/caldav";
          backend = "127.0.0.1:5232";
          remote_user_header = "X-Remote-User";
          skip_x_access_token = true;
          additional_headers = [{"X-Script-Name" = "/caldav";}];
        }
        {
          endpoint = "/carddav/";
          backend = "127.0.0.1:5232";
          remote_user_header = "X-Remote-User";
          skip_x_access_token = true;
          additional_headers = [{"X-Script-Name" = "/carddav";}];
        }
        {
          endpoint = "/.well-known/carddav";
          backend = "127.0.0.1:5232";
          remote_user_header = "X-Remote-User";
          skip_x_access_token = true;
          additional_headers = [{"X-Script-Name" = "/carddav";}];
        }
      ];
    }
  ];
 
   services.radicale = {
   services.radicale = {
     enable = true;
     enable = true;
Line 75: Line 79:
       };
       };
       auth = {
       auth = {
         type = "http_x_remote_user"; # disable authentication, and use the username that OpenCloud provides is
         type = "http_x_remote_user"; # disable authentication, and use the username that OpenCloud provides
       };
       };
       web = {
       web = {
Line 82: Line 86:
       storage = {
       storage = {
         filesystem_folder = "/var/lib/radicale/collections";
         filesystem_folder = "/var/lib/radicale/collections";
        predefined_collections = builtins.toJSON {
          def-addressbook = {
            "D:displayname" = "OpenCloud Address Book";
            tag = "VADDRESSBOOK";
          };
          def-calendar = {
            "C:supported-calendar-component-set" = "VEVENT,VJOURNAL,VTODO";
            "D:displayname" = "OpenCloud Calendar";
            tag = "VCALENDAR";
          };
        };
       };
       };
       logging = {
       logging = {