Add Dockerfile and components
This commit is contained in:
commit
e85e625e55
4 changed files with 170 additions and 0 deletions
37
Dockerfile
Normal file
37
Dockerfile
Normal file
|
@ -0,0 +1,37 @@
|
|||
ARG oo_version=5.5.0.165
|
||||
FROM onlyoffice/documentserver:$oo_version
|
||||
|
||||
|
||||
RUN sed -is \
|
||||
's/isSupportEditFeature:function(){return!1}/isSupportEditFeature:function(){return true}/g' \
|
||||
/var/www/onlyoffice/documentserver/web-apps/apps/documenteditor/mobile/app.js
|
||||
|
||||
RUN sed -is \
|
||||
's/isSupportEditFeature:function(){return!1}/isSupportEditFeature:function(){return true}/g' \
|
||||
/var/www/onlyoffice/documentserver/web-apps/apps/presentationeditor/mobile/app.js
|
||||
|
||||
RUN sed -is \
|
||||
's/isSupportEditFeature:function(){return!1}/isSupportEditFeature:function(){return true}/g' \
|
||||
/var/www/onlyoffice/documentserver/web-apps/apps/spreadsheeteditor/mobile/app.js
|
||||
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
python3-pip \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& pip3 install pycryptodome
|
||||
|
||||
|
||||
COPY license.py /tmp/
|
||||
RUN python3 /tmp/license.py
|
||||
|
||||
RUN pip3 uninstall -y pycryptodome \
|
||||
&& apt-get purge -y python3-pip \
|
||||
&& apt-get purge -y --autoremove \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
|
||||
COPY run-oo.sh /usr/local/bin/run-oo.sh
|
||||
RUN chmod a+x /usr/local/bin/run-oo.sh
|
||||
|
||||
|
||||
ENTRYPOINT [ "/usr/local/bin/run-oo.sh" ]
|
36
README.md
Normal file
36
README.md
Normal file
|
@ -0,0 +1,36 @@
|
|||
# OnlyOffice Community server with license
|
||||
|
||||
## Usage
|
||||
|
||||
```sh
|
||||
docker build \
|
||||
--tag=onlyoffice-patched \
|
||||
https://github.com/aleho/onlyoffice-ce-docker-license.git
|
||||
```
|
||||
|
||||
```sh
|
||||
docker run \
|
||||
--name=onlyoffice \
|
||||
--detach \
|
||||
--volume=$(pwd)/ooData:/var/www/onlyoffice/Data onlyoffice-patched \
|
||||
onlyoffice-patched
|
||||
```
|
||||
|
||||
## Background
|
||||
Recently, just about a month after Nextcloud announced their partnership with
|
||||
Ascensio and featuring a community version of OnlyOffice, the latter decided
|
||||
to remove support for mobile editing of documents via the Nextcloud app.
|
||||
|
||||
This happened without any prior notice and alienated quite a lot of home users,
|
||||
who would now be forced to pay more than €1.000 to unlock that previously free
|
||||
feature. Only after some outcries Ascensio deigned to release a statement and
|
||||
a new, albeit "limited", offer of €90 for home servers.
|
||||
|
||||
In my opinion these deceptive practices are unacceptable for a company
|
||||
advertising itself and their product as open source .
|
||||
|
||||
|
||||
## Thanks
|
||||
|
||||
This repo is heavily inspired by the works of
|
||||
[Zegorax/OnlyOffice-Unlimited](https://github.com/Zegorax/OnlyOffice-Unlimited).
|
87
license.py
Normal file
87
license.py
Normal file
|
@ -0,0 +1,87 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
from Crypto.Hash import SHA, SHA256
|
||||
from Crypto.Signature import PKCS1_v1_5
|
||||
from Crypto.PublicKey import RSA
|
||||
from shutil import copyfile
|
||||
import json
|
||||
import codecs
|
||||
|
||||
|
||||
|
||||
def gen_keys():
|
||||
privKey = RSA.generate(1024)
|
||||
publKey = privKey.publickey().exportKey('PEM')
|
||||
|
||||
f = open("/var/www/onlyoffice/license_key.pub", "w+")
|
||||
f.write(publKey.decode('utf-8'))
|
||||
f.close()
|
||||
|
||||
return publKey, privKey
|
||||
|
||||
|
||||
|
||||
def write_license(publKey, privKey):
|
||||
license = {
|
||||
"branding": False,
|
||||
"connections": 9999,
|
||||
"customization": False,
|
||||
"end_date": "2099-01-01T23:59:59.000Z",
|
||||
"light": "False",
|
||||
"mode": "",
|
||||
"portal_count": "0",
|
||||
"process": 2,
|
||||
"ssbranding": False,
|
||||
"test": "False",
|
||||
"trial": "False",
|
||||
"user_quota": "0",
|
||||
"users_count": 9999,
|
||||
"users_expire": 99999,
|
||||
"whiteLabel": False,
|
||||
"customer_id": "customerID",
|
||||
"start_date": "2020-01-01T00:00:00.000Z",
|
||||
"users": [],
|
||||
"version": 2
|
||||
}
|
||||
|
||||
jsonData = codecs.encode(json.dumps(license, separators=(',', ':')), encoding='utf-8')
|
||||
|
||||
digest = SHA.new(jsonData)
|
||||
signer = PKCS1_v1_5.new(privKey)
|
||||
signature = signer.sign(digest)
|
||||
finalSignature = signature.hex()
|
||||
|
||||
license['signature'] = finalSignature
|
||||
|
||||
f = open("/var/www/onlyoffice/license.lic", "w+")
|
||||
f.write(json.dumps(license))
|
||||
f.close
|
||||
|
||||
|
||||
|
||||
def patch_files():
|
||||
basePath = "/var/www/onlyoffice/documentserver/server/"
|
||||
files = ["DocService/docservice", "FileConverter/converter"]
|
||||
|
||||
for file in files:
|
||||
f = open(basePath + file, 'rb')
|
||||
data = f.read()
|
||||
f.close()
|
||||
|
||||
replacedData = data.replace(b"-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDRhGF7X4A0ZVlEg594WmODVVUI\niiPQs04aLmvfg8SborHss5gQXu0aIdUT6nb5rTh5hD2yfpF2WIW6M8z0WxRhwicg\nXwi80H1aLPf6lEPPLvN29EhQNjBpkFkAJUbS8uuhJEeKw0cE49g80eBBF4BCqSL6\nPFQbP9/rByxdxEoAIQIDAQAB\n-----END PUBLIC KEY-----", bytes(publKey))
|
||||
|
||||
f = open(basePath + file, 'wb')
|
||||
f.write(replacedData)
|
||||
f.close()
|
||||
|
||||
|
||||
|
||||
|
||||
print("Generating and exporting key pair...")
|
||||
publKey, privKey = gen_keys()
|
||||
|
||||
print("Writing license file...")
|
||||
write_license(publKey, privKey)
|
||||
|
||||
print("Patching document server and converter...")
|
||||
patch_files()
|
10
run-oo.sh
Normal file
10
run-oo.sh
Normal file
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
|
||||
echo "Providing license"
|
||||
cp -f /var/www/onlyoffice/license.lic /var/www/onlyoffice/Data/license.lic
|
||||
|
||||
echo "Starting server"
|
||||
/app/ds/run-document-server.sh
|
||||
|
Loading…
Reference in a new issue