Seafile + Collabora

Hello,

I’m trying to configure Seafile to use Collabora.
Seafile working with HTTPS through apache 2.4.
Collabora working with HTTPS through apache 2.4 as well.
But it’s not working

Docker logs:

wsd-00022-03 00:01:49.791302 [ client_req_hdl ] Request from 172.17.0.1:42696: POST /loleaflet/1.8.3/loleaflet.html?WOPISrc=https%3A%2F%2Fcloud.xxxx.fr%2Fapi2%2Fwopi%2Ffiles%2F2a561bb5dbf8be53d034e7923d5876e81567c1a8 HTTP/1.1 / Host: beta.xxxx.fr / Cache-Control: max-age=0 / Origin: https://cloud.xxxx.fr / Upgrade-Insecure-Requests: 1 / User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.59 Safari/537.36 / Content-Type: application/x-www-form-urlencoded / Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 / Referer: https://cloud.xxxx.fr/lib/6f679903-1041-4994-bb8a-ad2891642778/file/test.docx / Accept-Encoding: gzip, deflate, br / Accept-Language: fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4 / Cookie: Horde=5t152k9du9smqfnevualt2ldj3 / X-Forwarded-For: 193.57.249.4 / X-Forwarded-Host: beta.xxxx.fr / X-Forwarded-Server: beta.xxxx.fr / Connection: Keep-Alive / Content-Length: 80
wsd-00022-03 00:01:49.791573 [ client_req_hdl ] Preprocessing file: /usr/share/loolwsd//loleaflet/dist/loleaflet.html
wsd-00022-04 00:01:50.775772 [ client_req_hdl ] Request from 172.17.0.1:42704: GET /lool/ws/https://cloud.xxxx.fr/api2/wopi/files/2a561bb5dbf8be53d034e7923d5876e81567c1a8?access_token=d088f0fe-4737-4fd2-9c76-9d76ac110e31 HTTP/1.1 / Host: beta.xxxx.fr / Pragma: no-cache / Cache-Control: no-cache / Origin: https://beta.xxxx.fr / Sec-WebSocket-Version: 13 / User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.59 Safari/537.36 / Accept-Encoding: gzip, deflate, sdch, br / Accept-Language: fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4 / Cookie: Horde=5t152k9du9smqfnevualt2ldj3 / Sec-WebSocket-Key: sNc/YcpqzQ6PYtyg7ybhYA== / Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits / X-Forwarded-For: 193.57.249.4 / X-Forwarded-Host: beta.xxxx.fr / X-Forwarded-Server: beta.xxxx.fr / Connection: Keep-Alive
wsd-00022-04 00:01:50.775918 [ client_ws_0001 ] Thread started.
wsd-00022-04 00:01:50.775957 [ client_ws_0001 ] Post request: [/lool/ws/https://cloud.xxxx.fr/api2/wopi/files/2a561bb5dbf8be53d034e7923d5876e81567c1a8?access_token=d088f0fe-4737-4fd2-9c76-9d76ac110e31]
wsd-00022-04 00:01:50.776016 [ client_ws_0001 ] File download request.
wsd-00022-04 00:01:50.776042 [ client_ws_0001 ] HTTP request for: /opt/lool/child-roots/ws/user/docs/https:/
wsd-00022-04 00:01:50.776120 [ client_ws_0001 ] Download file [/opt/lool/child-roots/ws/user/docs/https:/] not found.
wsd-00022-04 00:01:50.776334 [ client_ws_0001 ] ClientRequestHandler::handleRequest: BadRequestException: Invalid or unknown request.

Apache conf for Collabora:

<VirtualHost *:443>
ServerName beta.xxx.fr:443
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/beta.xxx.fr/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/beta.xxx.fr/privkey.pem

SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES12
8-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SH
A:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-S
HA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS
SSLHonorCipherOrder on

AllowEncodedSlashes On

SSLProxyEngine On
SSLProxyVerify None
SSLProxyCheckPeerCN Off
SSLProxyCheckPeerName Off

ProxyPreserveHost On

ProxyPass /loleaflet https://127.0.0.1:9980/loleaflet retry=0
ProxyPassReverse /loleaflet https://127.0.0.1:9980/loleaflet

WOPI discovery URL

ProxyPass /hosting/discovery https://127.0.0.1:9980/hosting/discovery retry=0
ProxyPassReverse /hosting/discovery https://127.0.0.1:9980/hosting/discovery

Main websocket

ProxyPassMatch “/lool/(.*)/ws$” wss://127.0.0.1:9980/lool/$1/ws

Admin Console websocket

ProxyPass /lool/adminws wss://127.0.0.1:9980/lool/adminws

Download as, Fullscreen presentation and Image upload operations

ProxyPass /lool https://127.0.0.1:9980/lool
ProxyPassReverse /lool https://127.0.0.1:9980/lool

CustomLog /var/log/apache2/ssl-beta-access.log combined
ErrorLog /var/log/apache2/ssl-beta-error.log

Thank you.

i have the exact same problem

distribution: Ubuntu 16.04

1 Like

For me:

Distributor ID: Ubuntu
Description: Ubuntu 14.04.5 LTS
Release: 14.04
Codename: trusty

Linux ubuntu-server 4.4.0-42-generic #62~14.04.1-Ubuntu SMP Fri Oct 7 23:15:48 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Nobody can help us ?

What domains do you use for Seafile server and Collabora Online?

Two different subdomain on my own domain.
cloud for Seafile and beta for Collabora.

From the log, the Collabora Online receives wrong URL /lool/ws/https://cloud.xxxx.fr/. It is probably caused by your Apache config, adding the wrong /lool/ws/ prefix.

Edit: My bad, I was starting Collabora with the wrong domain, using beta instead of cloud.
Now it’s working fine !

I have enabled proxy_wstunnel:

a2enmod proxy_wstunnel

Now the error is:

wsd-00022-04 00:01:29.425161 [ client_ws_0002 ] WOPI host is not on the same host as the WOPI client: “xx.xx.xx.xx”. Connection is not allowed.
wsd-00022-04 00:01:29.425258 [ client_ws_0002 ] No acceptable WOPI hosts found matching the target host [cloud.xxx.fr] in config.

How can I allow my cloud domain ?

this manual shows how we deploy demo.seafile.com with collabora online, but as this announcement says: a new collaboration feature in the latest CODE is incompatible with the current Seafile 6.0,

if you want to use/test collabora online feature, you must manually change some codes of Seafile for temporary use/test:

add this two lines to ../seafile-server-latest/seahub_extra/wopi/views.py

 result = {}
 result['BaseFileName'] = os.path.basename(file_path)
 result['OwnerId'] = request_user
+result['UserId'] = request_user
+result['UserFriendlyName'] = request_user
 result['Size'] = file_size
 # used for office web app cache
 result['Version'] = obj_id

and don’t forget clear cache and restart Seafile/Seahub.

Hi @lian

I plan to test Collabora CODE with Seafile and I have three questions :

Regards,
Gautier

We use the same damain, demo.seafile.com for Seafile and collabora-online.seafile.com for CollaboraOffice.

For using different domains, sorry for we can’t give you an exact answer now as we are not the developer of CollaboraOffice and haven’t test using different domains yet.

We deployed ColloboraOffice CODE on Ubuntu 16 server. But we know someone has deployed CODE on Debian Jessie successfully.

You can get more info about CODE from Collabora Online Development Edition (CODE) - Collabora Office and Collabora Online .

CODE 2.0 will be compatible with the next Seafile release.

Hi @lian

I use Seafile pro server 6.04 and in

../seafile-server-latest/seahub-extra/seahub_extra/wopi/views.py

(check the extra seahub_extra folder from your previous post)

I already have these lines

result = {}
        result['BaseFileName'] = os.path.basename(file_path)
        result['OwnerId'] = seafile_api.get_repo_owner(repo_id)
        result['UserId'] = request_user
        result['UserFriendlyName'] = email2nickname(request_user)
        result['Size'] = file_size
        # used for office web app cache
        result['Version'] = obj_id

Do i have to change them to

result['UserId'] = request_user
result['UserFriendlyName'] = request_user

I followed all the instructions here https://manual.seafile.com/deploy_pro/libreoffice_online.html

I have this log in seahub.log

2016-11-12 06:38:56,843 [ERROR] root:1088 prepare_converted_html failed to add_office_convert_task:
Traceback (most recent call last):
  File "/home/cc/seafile/seafile-pro-server-6.0.2/seahub/seahub/utils/__init__.py", line 1086, in prepare_converted_html
    add_office_convert_task(obj_id, doctype, raw_path)
  File "/home/cc/seafile/seafile-pro-server-6.0.2/seahub/seahub/utils/__init__.py", line 1000, in real_func
    return func(*args)
  File "/home/cc/seafile/seafile-pro-server-6.0.2/seahub/seahub/utils/__init__.py", line 1059, in add_office_convert_task
    d = rpc.add_task(file_id, doctype, raw_path)
  File "/home/cc/seafile/seafile-pro-server-6.0.2/seafile/lib64/python2.6/site-packages/pysearpc/client.py", line 110, in newfunc
    ret_str = self.call_remote_func_sync(fcall_str)
  File "/home/cc/seafile/seafile-pro-server-6.0.2/seafile/lib64/python2.6/site-packages/ccnet/rpc.py", line 92, in call_remote_func_sync
    req_id = self._start_service(client)
  File "/home/cc/seafile/seafile-pro-server-6.0.2/seafile/lib64/python2.6/site-packages/ccnet/rpc.py", line 36, in _start_service
    raise SearpcError("Error received: %s %s (In _start_service)" % (rsp.code, rsp.code_msg))
SearpcError: Error received: 511 Unknown service (In _start_service)
2016-11-12 17:42:03,224 [ERROR] seahub.api2.endpoints.query_zip_progress:34 get Zip progress info not found.
2016-12-16 18:35:25,492 [INFO] urllib3.connectionpool:697 _new_conn Starting new HTTPS connection (1): xxx.campus-condorcet.fr

Collabora is configured on https://xxx.campus-condorcet.fr and is accessible on
https://xxx.campus-condorcet.fr/loleaflet/1.9.8/loleaflet.html

Seafile opens office files on preview mode and does not transfers them to collabora

I have put extra folders in seahub_settings as follows :

OFFICE_WEB_APP_BASE_URL = 'https://xxx.campus-condorcet.fr/hosting/discovery'

On Collabora NGinx access.log, i only have one line

`134.158.33.197 - - [16/Dec/2016:12:17:10 +0100] "GET /hosting/discovery HTTP/1.1" 200 17164 "-" "python-requests/2.4.3 CPython/2.7.9 Linux/3.16.0-4-amd64"`

Regards

How do you start Collabora ? Which command line ?
It should be :
docker run -t -p 9980:9980 -e “domain=cloud\.campus-condorcet\.fr” --cap-add MKNOD collabora/code
If Seafile domain is cloud.campus-concorcet.fr

Do you have error in Collabora logs ?

Yes i started it using the appropriate domain.

Logs from collabora tells :

sudo docker logs 8e1b46d8cc84
Generating RSA private key, 2048 bit long modulus
......................+++
............................................................+++
e is 65537 (0x10001)
Generating RSA private key, 2048 bit long modulus
..................+++
.......+++
e is 65537 (0x10001)
Signature ok
subject=/C=DE/ST=BW/L=Stuttgart/O=Dummy Authority/CN=localhost
Getting CA Private Key
loolwsd version details: 1.9.8 - 1.9.8
loolforkit version details: 1.9.8 - 1.9.8
office version details: { "ProductName": "Collabora Office", "ProductVersion": "5.1", "ProductExtension": ".10.12", "BuildId": "653cc4c38dd2c05aecbee156aef460f5a361e579" }
wsd-00025-0028 0:46:26.212864 [ client_req_hdl ] ERR  FileServerRequestHandler: File not found: Invalid file.
wsd-00025-0027 0:46:34.109853 [ client_req_hdl ] ERR  FileServerRequestHandler: File not found: Invalid file.
wsd-00025-0028 0:46:48.579333 [ client_ws_0005 ] ERR  ClientRequestHandler::handleClientRequest: Exception: Invalid URI.| LOOLWSD.cpp:1176
wsd-00025-0027 0:47:00.405119 [ client_ws_0006 ] ERR  ClientRequestHandler::handleClientRequest: Exception: Invalid URI.| LOOLWSD.cpp:1176
wsd-00025-0028 0:47:02.736467 [ client_ws_0007 ] ERR  ClientRequestHandler::handleClientRequest: Exception: Invalid URI.| LOOLWSD.cpp:1176
wsd-00025-0028 0:47:16.269773 [ client_ws_0008 ] ERR  ClientRequestHandler::handleClientRequest: Exception: Invalid URI.| LOOLWSD.cpp:1176
wsd-00025-0027 0:47:17.056129 [ client_ws_0009 ] ERR  ClientRequestHandler::handleClientRequest: Exception: Invalid URI.| LOOLWSD.cpp:1176
wsd-00025-0028 0:47:38.859494 [ client_ws_000a ] ERR  ClientRequestHandler::handleClientRequest: Exception: Invalid URI.| LOOLWSD.cpp:1176
wsd-00025-0028 1:29:28.984175 [ client_ws_000d ] ERR  ClientRequestHandler::handleClientRequest: Exception: Invalid URI.| LOOLWSD.cpp:1176
wsd-00025-0027 1:29:42.677039 [ client_ws_000e ] ERR  ClientRequestHandler::handleClientRequest: Exception: Invalid URI.| LOOLWSD.cpp:1176
wsd-00025-0028 1:29:47.142647 [ client_ws_000f ] ERR  ClientRequestHandler::handleClientRequest: Exception: Invalid URI.| LOOLWSD.cpp:1176

But as is typed

sudo ufw allow 9980/tcp

I do not have any error anymore.

I’v read a lot of similar issues from nexcloud.

I wonder if i have to use my domain CERT Into Docker Collabora image or use any Nginx proxy.

I’m quite confused…

How do you access collobora ?
And Seafile ?

I’m using Apache to server both through proxy.
I have two domains, cloud.xxx.fr for seafile and beta.xxx.fr for collabora.
Both are https. As it’s apache that handle https part I didn’t put any cert in collabora docker image.
I started Collabora with cloud.xxx.fr in command line to allow access from this domains.
But I haven’t change anything in Seafile files.

I access Seafile from https://sss.campus-condorcet.fr (Apache HTTPS)
I access collabora from https://ccc.campus-condorcet.fr (Nginx HTTPS)
They both are on the same LAN (private IPs) but accessible from the intrenet (pubic subdomains)

I think it is du to the incompatibility between seafile 6.0 and collabora CODE 2.0.
I’ll wait for the new release of seafile pro.

That’s right,

For now, if you want to use CODE 2.0, you have to change some code manually:

diff --git a/seahub_extra/wopi/utils.py b/seahub_extra/wopi/utils.py
index d3c5177..a7637ce 100644
--- a/seahub_extra/wopi/utils.py
+++ b/seahub_extra/wopi/utils.py
@@ -112,7 +112,7 @@ def get_wopi_dict(request_user, repo_id, file_path, action_name='view'):
         return None

     # generate full action url
-    full_file_info = '_'.join([request_user, repo_id, file_path])
+    full_file_info = '_'.join([repo_id, file_path])
     fake_file_id = hashlib.sha1(full_file_info.encode('utf8')).hexdigest()

     base_url = get_site_scheme_and_netloc()
@@ -129,7 +129,10 @@ def get_wopi_dict(request_user, repo_id, file_path, action_name='view'):

     # generate access token
     file_info = (request_user, repo_id, file_path)
-    access_token = uuid.uuid4()
+
+    # collobora office only allowed alphanumeric and _
+    uid = uuid.uuid4()
+    access_token = uid.hex
     key = generate_access_token_cache_key(access_token)
     cache.set(key, file_info, WOPI_ACCESS_TOKEN_EXPIRATION)

diff --git a/seahub_extra/wopi/views.py b/seahub_extra/wopi/views.py
index 25d97bd..b9edbf4 100644
--- a/seahub_extra/wopi/views.py
+++ b/seahub_extra/wopi/views.py
@@ -5,6 +5,7 @@ import logging
 import urllib2
 import requests
 import hashlib
+import urlparse

 from rest_framework.views import APIView

@@ -19,7 +20,7 @@ from seahub.utils import gen_inner_file_get_url, \
     gen_file_upload_url, get_file_type_and_ext
 from seahub.base.templatetags.seahub_tags import email2nickname

-from seahub.settings import FILE_LOCK_EXPIRATION_DAYS
+from seahub.settings import FILE_LOCK_EXPIRATION_DAYS, SITE_ROOT

 from .utils import get_file_info_by_token

@@ -71,13 +72,20 @@ class WOPIFilesView(APIView):

         result = {}
         result['BaseFileName'] = os.path.basename(file_path)
-        result['OwnerId'] = seafile_api.get_repo_owner(repo_id)
-        result['UserId'] = request_user
-        result['UserFriendlyName'] = email2nickname(request_user)
         result['Size'] = file_size
-        # used for office web app cache
         result['Version'] = obj_id

+        # for use of collobora office
+        result['UserFriendlyName'] = email2nickname(request_user)
+        result['OwnerId'] = seafile_api.get_repo_owner(repo_id)
+        result['UserId'] = request_user
+        absolute_uri = request.build_absolute_uri('/')
+        result['PostMessageOrigin'] = urlparse.urljoin(absolute_uri, SITE_ROOT).strip('/')
+        result['HidePrintOption'] = False
+        result['HideSaveOption'] = False
+        result['HideExportOption'] = False
+        result['EnableOwnerTermination'] = True
+
         filename = os.path.basename(file_path)
         filetype, fileext = get_file_type_and_ext(filename)
         is_locked, locked_by_me = check_file_lock(repo_id,

I noticed that there is no slash before dots in your domain cloud.campus-condorcet.fr.

According to Collabora Online Development Edition (CODE) - Collabora Office and Collabora Online, you must escape the dots with backslash:

docker run -t -p 9980:9980 -e "domain=cloud\.campus-condorcet\.fr" --cap-add MKNOD collabora/code

And also, don’t forget to clean Seafile’s cache every time you restart CODE.

Hi @lian
Docker run parameters were good, only my post omit backslashes.

I did update two files as you mentioned
seahub_extra/wopi/views.py b/seahub_extra/wopi/views.py
seahub_extra/wopi/views.py b/seahub_extra/wopi/utils.py

It causes A 500 internal error at first access to seafile web UI.
I checked the logs but i can’t find anything bad.