« Collabora CODE » : différence entre les versions

De Linux Server Wiki
Aller à la navigation Aller à la recherche
 
(19 versions intermédiaires par le même utilisateur non affichées)
Ligne 3 : Ligne 3 :
L'accès à l'instance Collabora se fera via un serveur proxy situé sur le serveur/vm hébergeant nextcloud.
L'accès à l'instance Collabora se fera via un serveur proxy situé sur le serveur/vm hébergeant nextcloud.


Dans cet exemple:  
Dans cet exemple nous aurons donc :
* la VM collabora a l'IP 192.168.30.30
* Une VM collabora avec l'IP 192.168.30.30, hébergeant une instance coolwsd utilisant un certificat SSL autosigné.
* VM nextcloud a l'IP 192.168.30.15 ainsi qu'une IP publique accessible depuis internet (188.165.180.60, avec l'hostname nextcloud.domain.tld)
* Une VM nextcloud avec l'IP 192.168.30.15 ainsi qu'une IP publique accessible depuis internet (188.165.180.60, avec l'hostname nextcloud.domain.tld). Cette VM héberge un serveur apache qui sert nextcloud (sécurisé avec un certificat SSL) ainsi qu'un proxy apache (lui aussi sécurisé par un certificat SSL).
* L'hostname collabora.domain.tld renvoi lui aussi vers l'ip publique de nextcloud (188.165.180.60)
* L'hostname collabora.domain.tld renvoi lui aussi vers l'ip publique de nextcloud (188.165.180.60) (le même serveur servira de proxy)
<br>


=Installation et configuration de Collabora CODE sur la VM dédié à Collabora=
=Installation et configuration de Collabora CODE sur la VM dédié à Collabora=


https://www.collaboraoffice.com/code/linux-packages/
==Installation du logiciel==


<pre>
<pre>
Ligne 25 : Ligne 26 :
</pre>
</pre>


Installez les paquets suivants :
<pre>
<pre>
apt update  
apt update  
Ligne 30 : Ligne 32 :
</pre>
</pre>


Génération du certificat (basé sur https://github.com/CollaboraOnline/Docker-CODE/blob/master/scripts/start-libreoffice.sh)
==Configuration==
 
Par défaut, coolwsd est configuré pour utiliser une connexion sécurisée en ssl. Il faut donc lui générer un certificat SSL.
Génération du certificat (basé sur https://github.com/CollaboraOnline/Docker-CODE/blob/master/scripts/start-libreoffice.sh) :
<pre>
<pre>
openssl genrsa -out /etc/coolwsd/root.key.pem 2048
openssl genrsa -out /etc/coolwsd/root.key.pem 2048
Ligne 45 : Ligne 50 :
</pre>
</pre>


Modification de la configuration :
Dans le fichier <code>/etc/coolwsd/coolwsd.xml</code> remplacez la ligne :
Remplacez la ligne :
<pre><host allow="true" desc="Regex pattern of hostname to allow or deny.">localhost</host></pre>
<pre><host allow="true" desc="Regex pattern of hostname to allow or deny.">localhost</host></pre>
par :
par :
<host allow="true" desc="Regex pattern of hostname to allow or deny.">nextcloud\.domain\.tld</host>
<pre><host allow="true" desc="Regex pattern of hostname to allow or deny.">nextcloud\.domain\.tld</host></pre>
 
Dans le fichier <code>/etc/coolwsd/coolwsd.xml</code> définissez la valeur <code>server_name</code> à <code>collabora.domain.tld</code>. Dans cet exemple la ligne devient :
<pre><server_name default="" desc="External hostname:port of the server running coolwsd. If empty, it's derived from the request (please set it if this doesn't work). Must be specified when behind a reverse-proxy or when the hostname is not reachable directly." type="string">collabora.domain.tld</server_name></pre>


Définissez le mot-de-passe admin :
Définissez le mot-de-passe admin :
<pre>
<pre>
loolconfig set-admin-password
coolconfig set-admin-password
</pre>
</pre>


Ligne 72 : Ligne 79 :
==Exemple de proxy apache==
==Exemple de proxy apache==


Notez que cette configuration est valide si votre instance Collabora utilise un certificat SSL (autosigné ou non). Reportez vous à https://www.collaboraoffice.com/code/apache-reverse-proxy/ pour les autres cas de figure.
Notez que cette configuration est valide si votre instance Collabora utilise un certificat SSL (autosigné ou non). Reportez vous à https://sdk.collaboraonline.com/docs/installation/Proxy_settings.html pour les autres cas de figure.
 
Pour le proxy, vous pouvez utiliser un certificat signé par une autorité (par exemple letsencrypt) ou un certificat autosigné.
 
Activez les modules suivant :
<pre>
a2enmod proxy
a2enmod proxy_http
a2enmod proxy_wstunnel
</pre>


Configuration de la vhost collabora.domain.tld :
<pre>
<pre>
<VirtualHost *:443>
<VirtualHost *:443>
  ServerName collabora.domain.tld
ServerName collabora.domain.tld
  Options -Indexes
Options -Indexes
 
  # SSL configuration, you may want to take the easy route instead and use Lets Encrypt!
  SSLEngine on
  SSLCertificateFile /path/to/signed_certificate
  SSLCertificateChainFile /path/to/intermediate_certificate
  SSLCertificateKeyFile /path/to/private/key


  # Encoded slashes need to be allowed
# SSL configuration, you may want to take the easy route instead and use Lets Encrypt!
  AllowEncodedSlashes NoDecode
SSLEngine on
SSLCertificateFile /path/to/signed_certificate
SSLCertificateChainFile /path/to/intermediate_certificate
SSLCertificateKeyFile /path/to/private/key


  # Container uses a unique non-signed certificate
AllowEncodedSlashes NoDecode
  SSLProxyEngine On
SSLProxyEngine On
  SSLProxyVerify None
ProxyPreserveHost On
  SSLProxyCheckPeerCN Off
  SSLProxyCheckPeerName Off


  # keep the host
# cert is issued for collaboraonline.example.com which is autosigned
  ProxyPreserveHost On
SSLProxyVerify None
SSLProxyCheckPeerCN Off
SSLProxyCheckPeerName Off


  # static html, js, images, etc. served from loolwsd
# static html, js, images, etc. served from coolwsd
  # loleaflet is the client part of Collabora Online
# browser is the client part of Collabora Online
  ProxyPass          /loleaflet https://192.168.30.30:9980/loleaflet retry=0
ProxyPass          /browser https://192.168.30.30:9980/browser retry=0
  ProxyPassReverse    /loleaflet https://192.168.30.30:9980/loleaflet
ProxyPassReverse    /browser https://192.168.30.30:9980/browser


  # WOPI discovery URL
# WOPI discovery URL
  ProxyPass          /hosting/discovery https://192.168.30.30:9980/hosting/discovery retry=0
ProxyPass          /hosting/discovery https://192.168.30.30:9980/hosting/discovery retry=0
  ProxyPassReverse    /hosting/discovery https://192.168.30.30:9980/hosting/discovery
ProxyPassReverse    /hosting/discovery https://192.168.30.30:9980/hosting/discovery


  # Capabilities
# Capabilities
  ProxyPass          /hosting/capabilities https://192.168.30.30:9980/hosting/capabilities retry=0
ProxyPass          /hosting/capabilities https://192.168.30.30:9980/hosting/capabilities retry=0
  ProxyPassReverse    /hosting/capabilities https://192.168.30.30:9980/hosting/capabilities
ProxyPassReverse    /hosting/capabilities https://192.168.30.30:9980/hosting/capabilities


  # Main websocket
# Main websocket
  ProxyPassMatch "/lool/(.*)/ws$" wss://192.168.30.30:9980/lool/$1/ws nocanon
ProxyPassMatch     "/cool/(.*)/ws$"     wss://192.168.30.30:9980/cool/$1/ws nocanon


  # Admin Console websocket
# Admin Console websocket
  ProxyPass   /lool/adminws wss://192.168.30.30:9980/lool/adminws
ProxyPass           /cool/adminws wss://192.168.30.30:9980/cool/adminws


  # Download as, Fullscreen presentation and Image upload operations
# Download as, Fullscreen presentation and Image upload operations
  ProxyPass          /lool https://192.168.30.30:9980/lool
ProxyPass          /cool https://192.168.30.30:9980/cool
  ProxyPassReverse    /lool https://192.168.30.30:9980/lool
ProxyPassReverse    /cool https://192.168.30.30:9980/cool
# Compatibility with integrations that use the /lool/convert-to endpoint
ProxyPass          /lool https://192.168.30.30:9980/cool
ProxyPassReverse    /lool https://192.168.30.30:9980/cool
</VirtualHost>
</VirtualHost>
</pre>
</pre>
Ligne 128 : Ligne 145 :


Une page d'administration de l'instance collabora est accessible à  
Une page d'administration de l'instance collabora est accessible à  
https://collabora.domain.tld/loleaflet/dist/admin/admin.html
https://collabora.domain.tld/browser/dist/admin/admin.html
 
=Désactivation du SSL côté Collabora=


=Documentation officielle=
=Documentation officielle=
https://www.collaboraoffice.com/code/linux-packages/
https://www.collaboraoffice.com/code-install-and-test/ <br>
https://www.collaboraoffice.com/code/linux-packages/ <br>
https://sdk.collaboraonline.com/docs/installation/Proxy_settings.html <br>
https://sdk.collaboraonline.com/docs/installation/Configuration.html

Dernière version du 12 décembre 2021 à 12:02

Exemple d'installation de Collabora CODE sur un serveur/vm dédié, accessible derrière un serveur proxy situé sur votre instance nextcloud.
Nextcloud est donc installé sur un autre serveur/vm.
L'accès à l'instance Collabora se fera via un serveur proxy situé sur le serveur/vm hébergeant nextcloud.

Dans cet exemple nous aurons donc :

  • Une VM collabora avec l'IP 192.168.30.30, hébergeant une instance coolwsd utilisant un certificat SSL autosigné.
  • Une VM nextcloud avec l'IP 192.168.30.15 ainsi qu'une IP publique accessible depuis internet (188.165.180.60, avec l'hostname nextcloud.domain.tld). Cette VM héberge un serveur apache qui sert nextcloud (sécurisé avec un certificat SSL) ainsi qu'un proxy apache (lui aussi sécurisé par un certificat SSL).
  • L'hostname collabora.domain.tld renvoi lui aussi vers l'ip publique de nextcloud (188.165.180.60) (le même serveur servira de proxy)


Installation et configuration de Collabora CODE sur la VM dédié à Collabora

Installation du logiciel

cd /usr/share/keyrings
sudo wget https://collaboraoffice.com/downloads/gpg/collaboraonline-release-keyring.gpg

Créez le fichier /etc/apt/sources.list.d/collaboraonline.sources contenant :

Types: deb
URIs: https://www.collaboraoffice.com/repos/CollaboraOnline/CODE-debian11
Suites: ./
Signed-By: /usr/share/keyrings/collaboraonline-release-keyring.gpg

Installez les paquets suivants :

apt update 
apt install coolwsd code-brand

Configuration

Par défaut, coolwsd est configuré pour utiliser une connexion sécurisée en ssl. Il faut donc lui générer un certificat SSL. Génération du certificat (basé sur https://github.com/CollaboraOnline/Docker-CODE/blob/master/scripts/start-libreoffice.sh) :

openssl genrsa -out /etc/coolwsd/root.key.pem 2048
openssl req -x509 -new -nodes -key /etc/coolwsd/root.key.pem -days 9131 -out /etc/coolwsd/ca-chain.cert.pem -subj "/C=DE/ST=BW/L=Stuttgart/O=Dummy Authority/CN=Dummy Authority"
openssl genrsa -out /etc/coolwsd/key.pem 2048 -key /etc/coolwsd/key.pem
openssl req -key /etc/coolwsd/key.pem -new -sha256 -out /etc/coolwsd/localhost.csr.pem -subj "/C=DE/ST=BW/L=Stuttgart/O=Dummy Authority/CN=localhost"
openssl x509 -req -in /etc/coolwsd/localhost.csr.pem -CA /etc/coolwsd/ca-chain.cert.pem -CAkey /etc/coolwsd/root.key.pem -CAcreateserial -out /etc/coolwsd/cert.pem -days 9131

Sécurisation du certificat

chgrp cool /etc/coolwsd/key.pem
chmod g+r /etc/coolwsd/key.pem

Dans le fichier /etc/coolwsd/coolwsd.xml remplacez la ligne :

<host allow="true" desc="Regex pattern of hostname to allow or deny.">localhost</host>

par :

<host allow="true" desc="Regex pattern of hostname to allow or deny.">nextcloud\.domain\.tld</host>

Dans le fichier /etc/coolwsd/coolwsd.xml définissez la valeur server_name à collabora.domain.tld. Dans cet exemple la ligne devient :

<server_name default="" desc="External hostname:port of the server running coolwsd. If empty, it's derived from the request (please set it if this doesn't work). Must be specified when behind a reverse-proxy or when the hostname is not reachable directly." type="string">collabora.domain.tld</server_name>

Définissez le mot-de-passe admin :

coolconfig set-admin-password

Note sur coolwsd.xml :

  • Les IP/hosts dans storage/wopi peuvent toutes êtres supprimées sauf nextcloud\.domain\.tld (avec les \)
  • Les IPs dans net/post_allow peuvent toutes êtres supprimées au profit de l'adresse IP du proxy (192.168.30.15)

Relancez le service :

systemctl restart coolwsd

Logs :

journalctl -u coolwsd

Sur le serveur nextcloud

Exemple de proxy apache

Notez que cette configuration est valide si votre instance Collabora utilise un certificat SSL (autosigné ou non). Reportez vous à https://sdk.collaboraonline.com/docs/installation/Proxy_settings.html pour les autres cas de figure.

Pour le proxy, vous pouvez utiliser un certificat signé par une autorité (par exemple letsencrypt) ou un certificat autosigné.

Activez les modules suivant :

a2enmod proxy
a2enmod proxy_http
a2enmod proxy_wstunnel

Configuration de la vhost collabora.domain.tld :

<VirtualHost *:443>
 ServerName collabora.domain.tld
 Options -Indexes

 # SSL configuration, you may want to take the easy route instead and use Lets Encrypt!
 SSLEngine on
 SSLCertificateFile /path/to/signed_certificate
 SSLCertificateChainFile /path/to/intermediate_certificate
 SSLCertificateKeyFile /path/to/private/key

 AllowEncodedSlashes NoDecode
 SSLProxyEngine On
 ProxyPreserveHost On

 # cert is issued for collaboraonline.example.com which is autosigned
 SSLProxyVerify None
 SSLProxyCheckPeerCN Off
 SSLProxyCheckPeerName Off

 # static html, js, images, etc. served from coolwsd
 # browser is the client part of Collabora Online
 ProxyPass           /browser https://192.168.30.30:9980/browser retry=0
 ProxyPassReverse    /browser https://192.168.30.30:9980/browser

 # WOPI discovery URL
 ProxyPass           /hosting/discovery https://192.168.30.30:9980/hosting/discovery retry=0
 ProxyPassReverse    /hosting/discovery https://192.168.30.30:9980/hosting/discovery

 # Capabilities
 ProxyPass           /hosting/capabilities https://192.168.30.30:9980/hosting/capabilities retry=0
 ProxyPassReverse    /hosting/capabilities https://192.168.30.30:9980/hosting/capabilities

 # Main websocket
 ProxyPassMatch      "/cool/(.*)/ws$"      wss://192.168.30.30:9980/cool/$1/ws nocanon

 # Admin Console websocket
 ProxyPass           /cool/adminws wss://192.168.30.30:9980/cool/adminws

 # Download as, Fullscreen presentation and Image upload operations
 ProxyPass           /cool https://192.168.30.30:9980/cool
 ProxyPassReverse    /cool https://192.168.30.30:9980/cool
 # Compatibility with integrations that use the /lool/convert-to endpoint
 ProxyPass           /lool https://192.168.30.30:9980/cool
 ProxyPassReverse    /lool https://192.168.30.30:9980/cool
</VirtualHost>

Configuration de l'application Collabora de Nextcloud

  • Définissez l'hostname à https://collabora.domain.tld
  • cochez la case Disable certificate verification si votre proxy utilise un certificat autosigné

Une page d'administration de l'instance collabora est accessible à https://collabora.domain.tld/browser/dist/admin/admin.html

Désactivation du SSL côté Collabora

Documentation officielle

https://www.collaboraoffice.com/code-install-and-test/
https://www.collaboraoffice.com/code/linux-packages/
https://sdk.collaboraonline.com/docs/installation/Proxy_settings.html
https://sdk.collaboraonline.com/docs/installation/Configuration.html