diff --git a/templates/template02-collabora-code/Readme.md b/templates/template02-collabora-code/Readme.md deleted file mode 100644 index e6e1a8d..0000000 --- a/templates/template02-collabora-code/Readme.md +++ /dev/null @@ -1,25 +0,0 @@ - -### Collabora Online server (CODE or Enterprise Edition) - -#### Setup - -* Assuming that the copy of the template is called `collabora-instance`, move to folder `collabora-instance`. -* Check the content of folder `artifacts` - - -|File name | Description| -| --- | --- | -| `collaboraonline.sources` | Apt sources file for Collabora packages | -| `coolwsd.xml` | Configuration file for the Collabora server | -| `coolwsd.service` | Systemd service file for Collabora server | -| `mkcert` | mkcert - command line utility to be downloaded [here](https://github.com/FiloSottile/mkcert/releases). Pick the latest binary for amd64 and rename it to `mkcert` | -| `rootCA.pem` | The rootCA previously created in your host machine | -| `rootCA-key.pem` | The rootCA key previously created in your host machine | - - -* Create folder `log` -* Open `Vagrantfile` and change the value of variable `lxd.name`. It makes sense to give the same name as the folder, in this example `collabora-instance`. -* Open `provision.sh` and change the value of variable `MACHINE_HOSTNAME`, `CO_VERSION` and `CUSTOMER_HASH`. For `MACHINE_HOSTNAME`, it makes sense to give the same name as the folder, plus the domain, in this example `collabora-instance.localenv.com`. -* Run `vagrant up > log/provisioning.log` -* Make sure your system is able to resolve the domain name that you specified in variable `MACHINE_HOSTNAME`, for example by adding an entry in `/etc/hosts` -* Start using your environment diff --git a/templates/template02-collabora-code/Vagrantfile b/templates/template02-collabora-code/Vagrantfile deleted file mode 100644 index 85ae5d4..0000000 --- a/templates/template02-collabora-code/Vagrantfile +++ /dev/null @@ -1,30 +0,0 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : - - -Vagrant.configure("2") do |config| - - config.vm.box = "hibox/focal64" - - config.vm.box_check_update = false - - ## This is the latest box version as of 19/01/2022 - ## Box versions are available here: https://app.vagrantup.com/hibox/boxes/focal64 - config.vm.box_version = "1.0.1639726498" - - config.vm.provider 'lxd' do |lxd| - lxd.api_endpoint = 'https://127.0.0.1:8443' - lxd.timeout = 10 - lxd.name = 'your-container-name' - # lxd.nesting = nil - # lxd.privileged = nil - # lxd.ephemeral = false - # lxd.profiles = ['default'] - # lxd.environment = {} - # lxd.config = {} - end - - config.vm.provision :shell, path: "provision.sh" - -end - diff --git a/templates/template02-collabora-code/artifacts/collaboraonline.sources b/templates/template02-collabora-code/artifacts/collaboraonline.sources deleted file mode 100644 index 8dc4d3f..0000000 --- a/templates/template02-collabora-code/artifacts/collaboraonline.sources +++ /dev/null @@ -1,4 +0,0 @@ -Types: deb -URIs: #APT_REPOSITORY_URL# -Suites: ./ -Signed-By: /usr/share/keyrings/collaboraonline-release-keyring.gpg diff --git a/templates/template02-collabora-code/artifacts/coolwsd.service b/templates/template02-collabora-code/artifacts/coolwsd.service deleted file mode 100644 index 2360fc5..0000000 --- a/templates/template02-collabora-code/artifacts/coolwsd.service +++ /dev/null @@ -1,24 +0,0 @@ -[Unit] -Description=Collabora Online WebSocket Daemon -After=network.target - -[Service] -EnvironmentFile=-/etc/sysconfig/coolwsd -ExecStart=/usr/bin/coolwsd --version --o:sys_template_path=/opt/cool/systemplate --o:child_root_path=/opt/cool/child-roots --o:file_server_root_path=/usr/share/coolwsd --port 443 -KillSignal=SIGINT -TimeoutStopSec=120 -User=cool -KillMode=control-group -Restart=always -LimitNOFILE=infinity:infinity - -ProtectSystem=strict -ReadWritePaths=/opt/cool /var/log - -ProtectHome=yes -PrivateTmp=yes -ProtectControlGroups=yes -CapabilityBoundingSet=CAP_FOWNER CAP_CHOWN CAP_MKNOD CAP_SYS_CHROOT CAP_SYS_ADMIN CAP_NET_BIND_SERVICE - -[Install] -WantedBy=multi-user.target diff --git a/templates/template02-collabora-code/artifacts/coolwsd.xml b/templates/template02-collabora-code/artifacts/coolwsd.xml deleted file mode 100644 index 7a494f4..0000000 --- a/templates/template02-collabora-code/artifacts/coolwsd.xml +++ /dev/null @@ -1,229 +0,0 @@ - - - - - - - - - de_DE en_GB en_US es_ES fr_FR it nl pt_BR pt_PT ru - - - - - - - - - - - 1 - - 4 - 5 - - false - 96 - 3600 - - - 30 - 300 - false - 0 - 8000 - 0 - 0 - 100 - 100 - - 10000 - 60 - 300 - 3072 - 85 - 120 - - - - - 120 - 900 - - - - - - true - - warning - notice - fatal - false - - -INFO-WARN - - - /var/log/coolwsd.log - never - timestamp - true - 10 days - 10 - true - false - - - false - 82589933 - - - - - - /var/log/coolwsd.trace.json - - - false - - - - - - - - false - - - - - - all - any - - - - 192\.168\.[0-9]{1,3}\.[0-9]{1,3} - ::ffff:192\.168\.[0-9]{1,3}\.[0-9]{1,3} - 127\.0\.0\.1 - ::ffff:127\.0\.0\.1 - ::1 - 172\.17\.[0-9]{1,3}\.[0-9]{1,3} - ::ffff:172\.17\.[0-9]{1,3}\.[0-9]{1,3} - 10\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3} - ::ffff:10\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3} - - - - - - - - - - - true - - false - /etc/coolwsd/fullchain.pem - /etc/coolwsd/privatekey.pem - - - - 1000 - - - - - - - - - true - - false - 1800 - false - 1 - false - - - - - - - - - true - false - - - - - default - - - - - - localhost - 10\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3} - 172\.1[6789]\.[0-9]{1,3}\.[0-9]{1,3} - 172\.2[0-9]\.[0-9]{1,3}\.[0-9]{1,3} - 172\.3[01]\.[0-9]{1,3}\.[0-9]{1,3} - 192\.168\.[0-9]{1,3}\.[0-9]{1,3} - 192\.168\.1\.1 - 0 - - 900 - - - - true - - - - - - - - - true - - - true - false - - - - - - - - - - - - - - - - - - - diff --git a/templates/template02-collabora-code/provision.sh b/templates/template02-collabora-code/provision.sh deleted file mode 100644 index acefece..0000000 --- a/templates/template02-collabora-code/provision.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/bash - -timedatectl set-timezone Europe/Madrid - -start_time=`date` - -echo "provisioning started: ${start_time}" - -############################### -#### The user must fill these variables - START -############################### -# Fully Qualified Name -MACHINE_HOSTNAME= - -## Collabora Online Version -CO_VERSION= - -## Customer Hash as obtained from Collabora. If left -## empty, CODE will be installed -CUSTOMER_HASH= - -############################## -#### The user must fill these variables - END -############################## - -COLLABORA_USER=usrv - -NETWORK_INTERFACE=eth0 - -hostnamectl set-hostname ${MACHINE_HOSTNAME} - -# Print some information about the container OS -hostnamectl - -# Print some information about the container timezone -timedatectl - -##################################################################### -## Get the IP address into an environment variable. This command outputs -## an empty variable if the network interface name is not ${NETWORK_INTERFACE} -##################################################################### -ip_address=`ip -4 addr show ${NETWORK_INTERFACE} | grep -oP '(?<=inet\s)\d+(\.\d+){3}'` - -adduser --disabled-password --gecos GECOS ${COLLABORA_USER} - -usermod -p "`openssl passwd -1 -salt 5RPVAd ${COLLABORA_USER}`" ${COLLABORA_USER} - -adduser ${COLLABORA_USER} sudo - -## How-To: Setting up and configuring native CODE packages on Linux -## https://www.collaboraoffice.com/code/linux-packages/ - -apt update - -apt install -y gnupg wget ca-certificates - -wget -O /usr/share/keyrings/collaboraonline-release-keyring.gpg https://collaboraoffice.com/downloads/gpg/collaboraonline-release-keyring.gpg - - -if [ "${CUSTOMER_HASH}" == "" ]; then - APT_REPOSITORY_URL=https://www.collaboraoffice.com/repos/CollaboraOnline/CODE-ubuntu2004 -else - APT_REPOSITORY_URL=https://www.collaboraoffice.com/repos/CollaboraOnline/${CO_VERSION}/customer-ubuntu2004-${CUSTOMER_HASH} -fi - -cp /vagrant/artifacts/collaboraonline.sources /etc/apt/sources.list.d/ - -## Changing the APT Repository URL in the APT source file -sed -i "s|#APT_REPOSITORY_URL#|${APT_REPOSITORY_URL}|g" /etc/apt/sources.list.d/collaboraonline.sources - -apt update - -if [ "${CUSTOMER_HASH}" == "" ]; then - apt install -y coolwsd code-brand -else - apt install -y coolwsd collabora-online-brand -fi - -## Install the mkcert rootCA (see https://github.com/FiloSottile/mkcert#installing-the-ca-on-other-systems) -chmod u+x /vagrant/artifacts/mkcert - -export CAROOT=/vagrant/artifacts/ - -/vagrant/artifacts/mkcert -install - -/vagrant/artifacts/mkcert --cert-file /etc/coolwsd/fullchain.pem --key-file /etc/coolwsd/privatekey.pem "${MACHINE_HOSTNAME}" - -chown cool.cool /etc/coolwsd/fullchain.pem /etc/coolwsd/privatekey.pem - -## Install the provisioned configuration file for the Collabora Server (coolwsd.xml) -cp /vagrant/artifacts/coolwsd.xml /etc/coolwsd/ - -## Install the provisioned systemd service file (coolwsd.service) -cp /vagrant/artifacts/coolwsd.service /lib/systemd/system/coolwsd.service - -## The Collabora executable must be given the capability to bind to port 443, HTTPS standard port -setcap CAP_NET_BIND_SERVICE=+eip /usr/bin/coolwsd - -systemctl daemon-reload - -systemctl restart coolwsd - -systemctl status coolwsd - -end_time=`date` - -echo "This container has IP (interface: ${NETWORK_INTERFACE}): ${ip_address}" - -echo "If you add this IP to the hostname (${MACHINE_HOSTNAME}) in your hosts file:" - -echo " You can connect with user ${COLLABORA_USER} via ssh (password ${COLLABORA_USER}): ssh ${COLLABORA_USER}@${MACHINE_HOSTNAME}" - -echo " Your Collabora Server instance is accessible via the following URL: https://${MACHINE_HOSTNAME}:9980" - -echo "provisioning started: ${start_time}" - -echo "provisioning ended: ${end_time}" diff --git a/templates/template02-collabora-online/Readme.md b/templates/template02-collabora-online/Readme.md new file mode 100644 index 0000000..b471d76 --- /dev/null +++ b/templates/template02-collabora-online/Readme.md @@ -0,0 +1,24 @@ + +### Collabora Online server (CODE or Enterprise Edition) + +#### Setup + +* Assuming that the copy of the template is called `collabora-instance`, move to folder `collabora-instance`. +* Check the content of folder `artifacts` + + +|File name | Description| +| --- | --- | +| `collaboraonline.sources` | Apt sources file for Collabora packages | +| `coolwsd.xml` | Configuration file for the Collabora server | +| `coolwsd.service` | Systemd service file for Collabora server | +| `rootCA.pem` | The rootCA previously created in your host machine | +| `rootCA-key.pem` | The rootCA key previously created in your host machine | + + +* Create folder `log` +* Open `Vagrantfile` and change the value of variable `lxd.name`. It makes sense to give the same name as the folder, in this example `collabora-instance`. +* Open `provision.sh` and change the value of variable `MACHINE_HOSTNAME`, `CO_VERSION` and `CUSTOMER_HASH`. For `MACHINE_HOSTNAME`, it makes sense to give the same name as the folder, plus the domain, in this example `collabora-instance.localenv.com`. +* Run `vagrant up > log/provisioning.log` +* Make sure your system is able to resolve the domain name that you specified in variable `MACHINE_HOSTNAME`, for example by adding an entry in `/etc/hosts` +* Start using your environment diff --git a/templates/template02-collabora-online/Vagrantfile b/templates/template02-collabora-online/Vagrantfile new file mode 100644 index 0000000..61de529 --- /dev/null +++ b/templates/template02-collabora-online/Vagrantfile @@ -0,0 +1,28 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + + +Vagrant.configure("2") do |config| + + config.vm.box = "isc/lxc-ubuntu-22.04" + + config.vm.box_check_update = false + + config.vm.provider 'lxd' do |lxd| + lxd.api_endpoint = 'https://127.0.0.1:8443' + lxd.timeout = 10 + lxd.name = 'your-container-name' + lxd.project = 'default' + lxd.profiles = ['default'] + # lxd.nesting = nil + # lxd.privileged = nil + # lxd.ephemeral = false + # lxd.profiles = ['default'] + # lxd.environment = {} + # lxd.config = {} + end + + config.vm.provision :shell, path: "provision.sh" + +end + diff --git a/templates/template02-collabora-online/artifacts/collaboraonline.sources b/templates/template02-collabora-online/artifacts/collaboraonline.sources new file mode 100644 index 0000000..8dc4d3f --- /dev/null +++ b/templates/template02-collabora-online/artifacts/collaboraonline.sources @@ -0,0 +1,4 @@ +Types: deb +URIs: #APT_REPOSITORY_URL# +Suites: ./ +Signed-By: /usr/share/keyrings/collaboraonline-release-keyring.gpg diff --git a/templates/template02-collabora-online/artifacts/coolwsd.service b/templates/template02-collabora-online/artifacts/coolwsd.service new file mode 100644 index 0000000..2360fc5 --- /dev/null +++ b/templates/template02-collabora-online/artifacts/coolwsd.service @@ -0,0 +1,24 @@ +[Unit] +Description=Collabora Online WebSocket Daemon +After=network.target + +[Service] +EnvironmentFile=-/etc/sysconfig/coolwsd +ExecStart=/usr/bin/coolwsd --version --o:sys_template_path=/opt/cool/systemplate --o:child_root_path=/opt/cool/child-roots --o:file_server_root_path=/usr/share/coolwsd --port 443 +KillSignal=SIGINT +TimeoutStopSec=120 +User=cool +KillMode=control-group +Restart=always +LimitNOFILE=infinity:infinity + +ProtectSystem=strict +ReadWritePaths=/opt/cool /var/log + +ProtectHome=yes +PrivateTmp=yes +ProtectControlGroups=yes +CapabilityBoundingSet=CAP_FOWNER CAP_CHOWN CAP_MKNOD CAP_SYS_CHROOT CAP_SYS_ADMIN CAP_NET_BIND_SERVICE + +[Install] +WantedBy=multi-user.target diff --git a/templates/template02-collabora-online/artifacts/coolwsd.xml b/templates/template02-collabora-online/artifacts/coolwsd.xml new file mode 100644 index 0000000..7a494f4 --- /dev/null +++ b/templates/template02-collabora-online/artifacts/coolwsd.xml @@ -0,0 +1,229 @@ + + + + + + + + + de_DE en_GB en_US es_ES fr_FR it nl pt_BR pt_PT ru + + + + + + + + + + + 1 + + 4 + 5 + + false + 96 + 3600 + + + 30 + 300 + false + 0 + 8000 + 0 + 0 + 100 + 100 + + 10000 + 60 + 300 + 3072 + 85 + 120 + + + + + 120 + 900 + + + + + + true + + warning + notice + fatal + false + + -INFO-WARN + + + /var/log/coolwsd.log + never + timestamp + true + 10 days + 10 + true + false + + + false + 82589933 + + + + + + /var/log/coolwsd.trace.json + + + false + + + + + + + + false + + + + + + all + any + + + + 192\.168\.[0-9]{1,3}\.[0-9]{1,3} + ::ffff:192\.168\.[0-9]{1,3}\.[0-9]{1,3} + 127\.0\.0\.1 + ::ffff:127\.0\.0\.1 + ::1 + 172\.17\.[0-9]{1,3}\.[0-9]{1,3} + ::ffff:172\.17\.[0-9]{1,3}\.[0-9]{1,3} + 10\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3} + ::ffff:10\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3} + + + + + + + + + + + true + + false + /etc/coolwsd/fullchain.pem + /etc/coolwsd/privatekey.pem + + + + 1000 + + + + + + + + + true + + false + 1800 + false + 1 + false + + + + + + + + + true + false + + + + + default + + + + + + localhost + 10\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3} + 172\.1[6789]\.[0-9]{1,3}\.[0-9]{1,3} + 172\.2[0-9]\.[0-9]{1,3}\.[0-9]{1,3} + 172\.3[01]\.[0-9]{1,3}\.[0-9]{1,3} + 192\.168\.[0-9]{1,3}\.[0-9]{1,3} + 192\.168\.1\.1 + 0 + + 900 + + + + true + + + + + + + + + true + + + true + false + + + + + + + + + + + + + + + + + + + diff --git a/templates/template02-collabora-online/provision.sh b/templates/template02-collabora-online/provision.sh new file mode 100644 index 0000000..d168f34 --- /dev/null +++ b/templates/template02-collabora-online/provision.sh @@ -0,0 +1,115 @@ +#!/bin/bash + +timedatectl set-timezone Europe/Madrid + +start_time=`date` + +echo "provisioning started: ${start_time}" + +############################### +#### The user must fill these variables - START +############################### +# Fully Qualified Name +MACHINE_HOSTNAME= + +## Collabora Online Version +CO_VERSION= + +## Customer Hash as obtained from Collabora. If left +## empty, CODE will be installed +CUSTOMER_HASH= + +############################## +#### The user must fill these variables - END +############################## +OS_VERSION=ubuntu2204 + +COLLABORA_USER=usrv + +NETWORK_INTERFACE=eth0 + +hostnamectl set-hostname ${MACHINE_HOSTNAME} + +# Print some information about the container OS +hostnamectl + +# Print some information about the container timezone +timedatectl + +##################################################################### +## Get the IP address into an environment variable. This command outputs +## an empty variable if the network interface name is not ${NETWORK_INTERFACE} +##################################################################### +ip_address=`ip -4 addr show ${NETWORK_INTERFACE} | grep -oP '(?<=inet\s)\d+(\.\d+){3}'` + +adduser --disabled-password --gecos GECOS ${COLLABORA_USER} + +usermod -p "`openssl passwd -1 -salt 5RPVAd ${COLLABORA_USER}`" ${COLLABORA_USER} + +adduser ${COLLABORA_USER} sudo + +## How-To: Setting up and configuring native CODE packages on Linux +## https://www.collaboraoffice.com/code/linux-packages/ + +apt update + +apt install -y gnupg wget ca-certificates mkcert + +wget -O /usr/share/keyrings/collaboraonline-release-keyring.gpg https://collaboraoffice.com/downloads/gpg/collaboraonline-release-keyring.gpg + + +if [ "${CUSTOMER_HASH}" == "" ]; then + APT_REPOSITORY_URL=https://www.collaboraoffice.com/repos/CollaboraOnline/CODE-${OS_VERSION} +else + APT_REPOSITORY_URL=https://www.collaboraoffice.com/repos/CollaboraOnline/${CO_VERSION}/customer-${OS_VERSION}-${CUSTOMER_HASH} +fi + +cp /vagrant/artifacts/collaboraonline.sources /etc/apt/sources.list.d/ + +## Changing the APT Repository URL in the APT source file +sed -i "s|#APT_REPOSITORY_URL#|${APT_REPOSITORY_URL}|g" /etc/apt/sources.list.d/collaboraonline.sources + +apt update + +if [ "${CUSTOMER_HASH}" == "" ]; then + apt install -y coolwsd code-brand +else + apt install -y coolwsd collabora-online-brand +fi + +export CAROOT=/vagrant/artifacts/ + +mkcert -install + +mkcert --cert-file /etc/coolwsd/fullchain.pem --key-file /etc/coolwsd/privatekey.pem "${MACHINE_HOSTNAME}" + +chown cool.cool /etc/coolwsd/fullchain.pem /etc/coolwsd/privatekey.pem + +## Install the provisioned configuration file for the Collabora Server (coolwsd.xml) +cp /vagrant/artifacts/coolwsd.xml /etc/coolwsd/ + +## Install the provisioned systemd service file (coolwsd.service) +cp /vagrant/artifacts/coolwsd.service /lib/systemd/system/coolwsd.service + +## The Collabora executable must be given the capability to bind to port 443, HTTPS standard port +setcap CAP_NET_BIND_SERVICE=+eip /usr/bin/coolwsd + +systemctl daemon-reload + +systemctl restart coolwsd + +systemctl status coolwsd + +end_time=`date` + +echo "This container has IP (interface: ${NETWORK_INTERFACE}): ${ip_address}" + +echo "If you add this IP to the hostname (${MACHINE_HOSTNAME}) in your hosts file:" + +echo " You can connect with user ${COLLABORA_USER} via ssh (password ${COLLABORA_USER}): ssh ${COLLABORA_USER}@${MACHINE_HOSTNAME}" + +echo " Your Collabora Server instance is accessible via the following URL: https://${MACHINE_HOSTNAME}:443" + +echo "provisioning started: ${start_time}" + +echo "provisioning ended: ${end_time}"